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

junyan.he at linux.intel.com junyan.he at linux.intel.com
Mon Jul 16 15:53:51 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 d986e9a..5a81d78 100644
--- a/src/glamor_render.c
+++ b/src/glamor_render.c
@@ -824,9 +824,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);
@@ -838,6 +835,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 969fbac..7d24212 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