[Glamor] [PATCH 12/34] glamor: Avoid generating GL errors when doing two-pass CA.

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


From: Eric Anholt <eric at anholt.net>

We were double-unmapping the VBO, and the second would throw an error.

Ported from Eric's glamor xserver tree.

Signed-off-by: Eric Anholt <eric at anholt.net>
Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
---
 src/glamor_priv.h   | 1 +
 src/glamor_render.c | 8 ++++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/glamor_priv.h b/src/glamor_priv.h
index 39d09a6..8c118cb 100644
--- a/src/glamor_priv.h
+++ b/src/glamor_priv.h
@@ -248,6 +248,7 @@ typedef struct glamor_screen_private {
 
 	/* vertext/elment_index buffer object for render */
 	GLuint vbo, ebo;
+	Bool vbo_mapped;
 	int vbo_offset;
 	int vbo_size;
 	char *vb;
diff --git a/src/glamor_render.c b/src/glamor_render.c
index 607a636..f7610bd 100644
--- a/src/glamor_render.c
+++ b/src/glamor_render.c
@@ -756,6 +756,7 @@ glamor_setup_composite_vbo(ScreenPtr screen, int n_verts)
 							     GL_MAP_INVALIDATE_RANGE_BIT);
 		assert(glamor_priv->vb != NULL);
 		glamor_priv->vb -= glamor_priv->vbo_offset;
+		glamor_priv->vbo_mapped = TRUE;
 	} else
 		glamor_priv->vbo_offset = 0;
 
@@ -830,9 +831,12 @@ glamor_flush_composite_rects(ScreenPtr screen)
 	glamor_gl_dispatch *dispatch;
 
 	dispatch = glamor_get_dispatch(glamor_priv);
-	if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP)
+	if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
+	    if (glamor_priv->vbo_mapped) {
 		dispatch->glUnmapBuffer(GL_ARRAY_BUFFER);
-	else {
+		glamor_priv->vbo_mapped = FALSE;
+	    }
+	} else {
 
 		dispatch->glBindBuffer(GL_ARRAY_BUFFER, glamor_priv->vbo);
 		dispatch->glBufferData(GL_ARRAY_BUFFER,
-- 
1.8.3.1



More information about the Glamor mailing list