compositor: fix starvation of wl_buffer::release
authorMatt Hoosier <matt.hoosier@gmail.com>
Tue, 26 Sep 2017 13:09:40 +0000 (08:09 -0500)
committerDerek Foreman <derekf@osg.samsung.com>
Tue, 26 Sep 2017 16:22:45 +0000 (11:22 -0500)
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.

v2:

More information about the historical reasons why this change hadn't
happened yet, and the consensus to finally move ahead with it can be
found at the discussion terminating in this message:

https://lists.freedesktop.org/archives/wayland-devel/2017-September/035147.html

Signed-off-by: Matt Hoosier <matt.hoosier@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
clients/nested.c
libweston/compositor.c

index e9070e9bbccb6f8f954589db47d01b584ae5d067..e2bdf68499f7caa63362f0b152ac213da7e7e919 100644 (file)
@@ -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);
        }
index 813b6634038d0e58c574bc1cf4f036ab2716d8c7..878cd53513a5aecef6f531e1e4c603f68f59f46c 100644 (file)
@@ -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);
        }