[PATCH 26/27] glamor: Don't forget to unmap our PBOs before usng them to upload.

Eric Anholt eric at anholt.net
Tue Mar 11 14:30:40 PDT 2014


>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.

Signed-off-by: Eric Anholt <eric at anholt.net>
---
 glamor/glamor_pixmap.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/glamor/glamor_pixmap.c b/glamor/glamor_pixmap.c
index ff07483..f54b348 100644
--- a/glamor/glamor_pixmap.c
+++ b/glamor/glamor_pixmap.c
@@ -726,8 +726,10 @@ __glamor_upload_pixmap_to_texture(PixmapPtr pixmap, unsigned int *tex,
     glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
 
     assert(pbo || bits != 0);
-    if (bits == NULL)
+    if (bits == NULL) {
         glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbo);
+        glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
+    }
     if (non_sub)
         glTexImage2D(GL_TEXTURE_2D, 0, iformat, w, h, 0, format, type, bits);
     else
-- 
1.9.0



More information about the xorg-devel mailing list