From bdd72da0c525faf2aac38a7a8afa1cd88cd8dc1b Mon Sep 17 00:00:00 2001 From: Zhigang Gong Date: Tue, 10 Jan 2012 17:04:48 +0800 Subject: [PATCH] Release previous textre/fb when bind a new texture to a pixmap. 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 Tested-by: He Junyan --- glamor/glamor.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/glamor/glamor.c b/glamor/glamor.c index 6ee11f7b1..8f74daa21 100644 --- a/glamor/glamor.c +++ b/glamor/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