[Glamor] [PATCH 31/34] glamor: Don't forget to unmap our PBOs before usng them to upload.

Alex Deucher alexdeucher at gmail.com
Fri Feb 28 10:02:26 PST 2014


From: Eric Anholt <eric at anholt.net>

>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 at anholt.net>
Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
---
 src/glamor_pixmap.c | 5 +++--
 1 file 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,
-- 
1.8.3.1



More information about the Glamor mailing list