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>
This commit is contained in:
Zhigang Gong 2012-01-10 17:04:48 +08:00 committed by Eric Anholt
parent d7352d57b9
commit bdd72da0c5

View File

@ -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