[PATCH] compositor: fix starvation of wl_buffer::release

Pekka Paalanen ppaalanen at gmail.com
Tue Sep 26 07:28:03 UTC 2017


On Mon, 25 Sep 2017 10:31:35 -0500
Matt Hoosier <matt.hoosier at gmail.com> wrote:

> This change replaces a queued emission of buffer-release events (which
> is prone to starvation) with a regular event emission. This means that
> client programs no longer need to secretly install surface frame
> listeners just to guarantee that they get correctly notified of buffer
> lifecycle events.
> 
> Signed-off-by: Matt Hoosier <matt.hoosier at gmail.com>
> ---
>  clients/nested.c       | 3 +--
>  libweston/compositor.c | 3 +--
>  2 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/clients/nested.c b/clients/nested.c
> index e9070e9b..e2bdf684 100644
> --- a/clients/nested.c
> +++ b/clients/nested.c
> @@ -228,8 +228,7 @@ nested_buffer_reference(struct nested_buffer_reference *ref,
>  		ref->buffer->busy_count--;
>  		if (ref->buffer->busy_count == 0) {
>  			assert(wl_resource_get_client(ref->buffer->resource));
> -			wl_resource_queue_event(ref->buffer->resource,
> -						WL_BUFFER_RELEASE);
> +			wl_buffer_send_release(ref->buffer->resource);
>  		}
>  		wl_list_remove(&ref->destroy_listener.link);
>  	}
> diff --git a/libweston/compositor.c b/libweston/compositor.c
> index 813b6634..878cd535 100644
> --- a/libweston/compositor.c
> +++ b/libweston/compositor.c
> @@ -1954,8 +1954,7 @@ weston_buffer_reference(struct weston_buffer_reference *ref,
>  		ref->buffer->busy_count--;
>  		if (ref->buffer->busy_count == 0) {
>  			assert(wl_resource_get_client(ref->buffer->resource));
> -			wl_resource_queue_event(ref->buffer->resource,
> -						WL_BUFFER_RELEASE);
> +			wl_buffer_send_release(ref->buffer->resource);
>  		}
>  		wl_list_remove(&ref->destroy_listener.link);
>  	}

Hi,

this patch is exactly right, but I feel we should be more verbose on
the reasoning behind this change. The old behaviour has been kept for a
long time. Maybe a link to my email?

That's the only thing I'd like to have before giving my Reviewed-by.

Let's also wait for other comments before landing this.


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20170926/4fd2a88e/attachment.sig>


More information about the wayland-devel mailing list