summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2014-02-28 13:02:26 -0500
committerZhigang Gong <zhigang.gong@gmail.com>2014-03-13 21:52:34 +0800
commitbcc1f164b35925d74e4cc363de206c53ed514edf (patch)
treec94681caa8f021b8b746d78e779030424421c72e
parent5044c1d10b44ead9312c38b6f40f5cc49ae8d5b1 (diff)
glamor: Don't forget to unmap our PBOs before usng them to upload.
From the GL_ARB_vertex_buffer_object spec: After the client has specified the contents of a mapped data store, and before the data in that store are dereferenced by any GL commands, the mapping must be relinquished by calling boolean UnmapBufferARB(enum target); Our mappings were only getting reaped at PBO destroy time, after the upload. If the GL implementation wasn't coherent, it would have used stale data to do the texture upload. Ported from Eric's xserver glamor tree. Signed-off-by: Eric Anholt <eric@anholt.net> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--src/glamor_pixmap.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/glamor_pixmap.c b/src/glamor_pixmap.c
index 36e285f..fc71151 100644
--- a/src/glamor_pixmap.c
+++ b/src/glamor_pixmap.c
@@ -724,10 +724,11 @@ __glamor_upload_pixmap_to_texture(PixmapPtr pixmap, unsigned int *tex,
dispatch->glPixelStorei(GL_UNPACK_ALIGNMENT, alignment);
assert(pbo || bits != 0);
- if (bits == NULL)
+ if (bits == NULL) {
dispatch->glBindBuffer(GL_PIXEL_UNPACK_BUFFER,
pbo);
-
+ dispatch->glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
+ }
dispatch->glPixelStorei(GL_UNPACK_ROW_LENGTH, stride / alignment);
if (non_sub)
dispatch->glTexImage2D(GL_TEXTURE_2D,