[Glamor] [PATCH 2/2] Release previous textre/fb when bind a new texture to a pixmap.

zhigang.gong at linux.intel.com zhigang.gong at linux.intel.com
Tue Jan 10 01:07:51 PST 2012


From: Zhigang Gong <zhigang.gong at linux.intel.com>

As we want to support DRI2 drawable which may create a new textured_drm
to a pre-existing texture_only pixmap, we have to add this logical.

Signed-off-by: Zhigang Gong <zhigang.gong at linux.intel.com>
---
 src/glamor.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/glamor.c b/src/glamor.c
index 6ee11f7..1f5f944 100644
--- a/src/glamor.c
+++ b/src/glamor.c
@@ -86,6 +86,7 @@ glamor_set_pixmap_texture(PixmapPtr pixmap, int w, int h, unsigned int tex)
 	glamor_pixmap_private *pixmap_priv;
 	glamor_screen_private *glamor_priv =
 	    glamor_get_screen_private(screen);
+	glamor_gl_dispatch *dispatch = &glamor_priv->dispatch;
 
 	pixmap_priv = glamor_get_pixmap_private(pixmap);
 	if (pixmap_priv == NULL) {
@@ -96,6 +97,12 @@ glamor_set_pixmap_texture(PixmapPtr pixmap, int w, int h, unsigned int tex)
 		pixmap_priv->glamor_priv = glamor_priv;
 	}
 
+	if (pixmap_priv->fb)
+		dispatch->glDeleteFramebuffers(1, &pixmap_priv->fb);
+		
+	if (pixmap_priv->tex)
+		dispatch->glDeleteTextures(1, &pixmap_priv->tex);
+		
 	pixmap_priv->tex = tex;
 
 	/* Create a framebuffer object wrapping the texture so that we can render
-- 
1.7.4.4



More information about the Glamor mailing list