[PATCH] gl-renderer: Always release previous EGL images on attach

Sinclair Yeh sinclair.yeh at intel.com
Thu Jun 6 17:48:46 PDT 2013


On Wed, 5 Jun 2013 12:21:05 +0300
Ander Conselvan de Oliveira <conselvan2 at gmail.com> wrote:

> From: Ander Conselvan de Oliveira
> <ander.conselvan.de.oliveira at intel.com>
> 
> When attaching a new buffer, the EGL images created for the previous
> one would be released if this new buffer was an EGL or NULL buffer,
> but not if is was an SHM buffer. This wouldn't cause the resources to
> be leaked becaused they are free()'d when the surface is destroyed,
> but they would linger around for longer than necessary.
> 
> Note that this change the behaviour when attaching an unknow buffer
> type. Before the EGL images would still be around, but now that would
> cause them to be destroyed.
> ---
>  src/gl-renderer.c |   14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/src/gl-renderer.c b/src/gl-renderer.c
> index d783a0b..13c0fa9 100644
> --- a/src/gl-renderer.c
> +++ b/src/gl-renderer.c
> @@ -1192,12 +1192,13 @@ gl_renderer_attach(struct weston_surface *es,
> struct wl_buffer *buffer) 
>  	weston_buffer_reference(&gs->buffer_ref, buffer);
>  
> +	for (i = 0; i < gs->num_images; i++) {
> +		gr->destroy_image(gr->egl_display, gs->images[i]);
> +		gs->images[i] = NULL;
> +	}
> +	gs->num_images = 0;
> +

I just got around to looking at this, now I wonder if I need to modify
my patch or you need to modify this one.  :)


More information about the wayland-devel mailing list