[Glamor] [PATCH 3/3] Fix the problem of VBO leak.

junyan.he at linux.intel.com junyan.he at linux.intel.com
Thu Jul 19 14:52:57 PDT 2012


From: Junyan He <junyan.he at linux.intel.com>

 In some cases we allocate the VBO but have no vertex to
 emit, which cause the VBO fail to be released. Fix it.

Signed-off-by: Junyan He <junyan.he at linux.intel.com>
---
 src/glamor_render.c    |    6 +++---
 src/glamor_trapezoid.c |    6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/glamor_render.c b/src/glamor_render.c
index 6dacd44..9b80295 100644
--- a/src/glamor_render.c
+++ b/src/glamor_render.c
@@ -826,9 +826,6 @@ glamor_flush_composite_rects(ScreenPtr screen)
 	    glamor_get_screen_private(screen);
 	glamor_gl_dispatch *dispatch;
 
-	if (!glamor_priv->render_nr_verts)
-		return;
-
 	dispatch = glamor_get_dispatch(glamor_priv);
 	if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP)
 		dispatch->glUnmapBuffer(GL_ARRAY_BUFFER);
@@ -840,6 +837,9 @@ glamor_flush_composite_rects(ScreenPtr screen)
 				       glamor_priv->vb, GL_DYNAMIC_DRAW);
 	}
 
+	if (!glamor_priv->render_nr_verts)
+		return;
+
 	dispatch->glDrawElements(GL_TRIANGLES, (glamor_priv->render_nr_verts * 3) / 2,
 				 GL_UNSIGNED_SHORT, NULL);
 	glamor_put_dispatch(glamor_priv);
diff --git a/src/glamor_trapezoid.c b/src/glamor_trapezoid.c
index 5c02a8c..fd63062 100644
--- a/src/glamor_trapezoid.c
+++ b/src/glamor_trapezoid.c
@@ -199,9 +199,6 @@ glamor_flush_composite_triangles(ScreenPtr screen)
 	    glamor_get_screen_private(screen);
 	glamor_gl_dispatch *dispatch;
 
-	if (!glamor_priv->render_nr_verts)
-		return;
-
 	dispatch = glamor_get_dispatch(glamor_priv);
 	if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP)
 		dispatch->glUnmapBuffer(GL_ARRAY_BUFFER);
@@ -213,6 +210,9 @@ glamor_flush_composite_triangles(ScreenPtr screen)
 		        glamor_priv->vb, GL_DYNAMIC_DRAW);
 	}
 
+	if (!glamor_priv->render_nr_verts)
+		return;
+
 	dispatch->glDrawArrays(GL_TRIANGLES, 0, glamor_priv->render_nr_verts);
 	glamor_put_dispatch(glamor_priv);
 }
-- 
1.7.7.6



More information about the Glamor mailing list