From 65cc0982afb1d47d17e655efaef40d4a82e7574a Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 13 Oct 2014 10:31:52 -0700 Subject: [PATCH] glamor: Don't insert fbos from external objects into fbo cache Mark fbos created from external buffers so that when the associated pixmap is destroyed, they aren't put into the fbo cache for later re-use and are instead freed immediately. Signed-off-by: Keith Packard Reviewed-by: Alex Deucher --- glamor/glamor.c | 1 + glamor/glamor_fbo.c | 3 ++- glamor/glamor_priv.h | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/glamor/glamor.c b/glamor/glamor.c index fc24b1bdd..d228e35ad 100644 --- a/glamor/glamor.c +++ b/glamor/glamor.c @@ -106,6 +106,7 @@ glamor_set_pixmap_texture(PixmapPtr pixmap, unsigned int tex) ErrorF("XXX fail to create fbo.\n"); return; } + fbo->external = TRUE; glamor_pixmap_attach_fbo(pixmap, fbo); } diff --git a/glamor/glamor_fbo.c b/glamor/glamor_fbo.c index 090dfd8e7..42738268c 100644 --- a/glamor/glamor_fbo.c +++ b/glamor/glamor_fbo.c @@ -153,7 +153,7 @@ glamor_pixmap_fbo_cache_put(glamor_pixmap_fbo *fbo) #else n_format = cache_format(fbo->format); - if (fbo->fb == 0 || n_format == -1 + if (fbo->fb == 0 || fbo->external || n_format == -1 || fbo->glamor_priv->fbo_cache_watermark >= FBO_CACHE_THRESHOLD) { fbo->glamor_priv->tick += GLAMOR_CACHE_EXPIRE_MAX; glamor_fbo_expire(fbo->glamor_priv); @@ -237,6 +237,7 @@ glamor_create_fbo_from_tex(glamor_screen_private *glamor_priv, fbo->tex = tex; fbo->width = w; fbo->height = h; + fbo->external = FALSE; fbo->format = format; fbo->glamor_priv = glamor_priv; diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h index c089db895..885f12a6d 100644 --- a/glamor/glamor_priv.h +++ b/glamor/glamor_priv.h @@ -352,6 +352,7 @@ enum glamor_fbo_state { * @pbo: attached pbo. * @width: width of this fbo. * @height: height of this fbo. + * @external set when the texture was not created by glamor * @format: internal format of this fbo's texture. * @type: internal type of this fbo's texture. * @glamor_priv: point to glamor private data. @@ -365,6 +366,7 @@ typedef struct glamor_pixmap_fbo { GLuint pbo; int width; int height; + Bool external; GLenum format; GLenum type; glamor_screen_private *glamor_priv;