summaryrefslogtreecommitdiff
path: root/glamor/glamor.c
diff options
context:
space:
mode:
authorZhigang Gong <zhigang.gong@linux.intel.com>2012-01-10 17:04:48 +0800
committerEric Anholt <eric@anholt.net>2013-12-18 11:23:47 -0800
commitbdd72da0c525faf2aac38a7a8afa1cd88cd8dc1b (patch)
tree0358f70d8dcd4028c01e79c847bb6f3b99694e78 /glamor/glamor.c
parentd7352d57b9ceb809d47c922ed8c820a44f8a0ee5 (diff)
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 <zhigang.gong@linux.intel.com> Tested-by: He Junyan<junyan.he@linux.intel.com>
Diffstat (limited to 'glamor/glamor.c')
-rw-r--r--glamor/glamor.c7
1 files changed, 7 insertions, 0 deletions
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