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 <keithp@keithp.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Keith Packard 2014-10-13 10:31:52 -07:00
parent 63bb5c5ef1
commit 65cc0982af
3 changed files with 5 additions and 1 deletions

View File

@ -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);
}

View File

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

View File

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