[PATCH] glamor: Don't insert fbos from external objects into fbo cache
Alex Deucher
alexdeucher at gmail.com
Thu Nov 6 06:34:33 PST 2014
On Wed, Nov 5, 2014 at 5:32 PM, Keith Packard <keithp at keithp.com> wrote:
> 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 at keithp.com>
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
> ---
> 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 fc24b1b..d228e35 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 090dfd8..4273826 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 c089db8..885f12a 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;
> --
> 2.1.1
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
More information about the xorg-devel
mailing list