[PATCH v2] Post buffer release events instead of queue when no frame callback

Neil Roberts neil at linux.intel.com
Wed Oct 2 08:07:58 PDT 2013

I don't think this function would help in cases where the buffer is
released after the frame is drawn but the compositor is not drawing
anything else. Ie, if the events were like this:

1 - client attaches a buffer and waits for the next release
2 - compositor redraws a frame
3 - the redraw completes so the compositor flushes all event queues
4 - the swap completes and the compositor queues a release event

If nothing else causes the compositor to queue a redraw the release
event will just sit in the event queue forever and the client will still
be blocked waiting for it.

I think this doesn't actually happen at the moment because as far as I
can tell the gl-renderer immediately queues the buffer release when you
attach a new one rather than waiting for the swap to actually complete.
I think that would mean you could cause tearing if you are using
eglSwapInterval(0) because you could write into the released buffer
while the GPU is actually still rendering the previous frame using the
buffer in a texture.

I will try an experiment to check this. If that's right then we should
probably add an extra buffer reference in the gl-renderer whenever it
uses a texture to draw and then only release it when the frame is

- Neil

Jason Ekstrand <jason at jlekstrand.net> writes:

> All,
> Perhaps a simpler approach would be better.  We could add a function to
> wayland-server called wl_client_post_event_queue which would simply set the
> wants_flush flag on the client connection. This function would be fast
> ,require no I/O, and safe to call multiple times so Weston could simply
> call it on all clients with surfaces visible on the output in question at
> the time when it would call frame events.  Then, when the event loop
> flushes the clients, the release events will get sent out.
> --Jason Ekstrand
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

More information about the wayland-devel mailing list