Buffer release events (was: Add support for eglSwapInterval)

Neil Roberts neil at linux.intel.com
Fri Oct 4 09:56:20 PDT 2013

Here is a quick summary of the discussion about the release event
handling that has partially happened on this list and partially on IRC.

Currently the release events are put into a queue so that they are only
sent alongside another event sent by the compositor in order to avoid
waking up the client more times than necessary. Usually this will end up
being sent alongside the frame complete callback. The assumption is that
most clients don't care about the buffer release events until they are
about to draw something, which usually only happens when they get the
frame callback so they don't need to wake up early.

This assumption doesn't work if the client isn't installing a frame
callback for example when doing eglSwapInterval(0). In that case the
client may be blocked waiting for a buffer release event but the queue
will never get flushed because no other events are being sent from the
compositor. It could also happen if the compositor is not sending the
release events until some time after the frame callback completes, for
example if it waits until a pending swap buffer completes before
releasing the buffer. Currently this doesn't happen for normal clients
because the GL renderer immediately releases the buffer when a new one
is attached but it may happen for fullscreen clients.

One solution is to always post the release event instead of queuing
whenever the client doesn't have a frame callback currently installed.
This fixes the clients doing eglSwapInterval(0) without breaking all the
normal clients. However this still isn't a perfect solution because it's
still possible that a client would want to do eglSwapInterval(0) and
render as fast as possible but still install its own frame callback,
perhaps just to get information about how fast the frames are being
displayed on the screen.

Currently the only proposed complete solution is just to add a request
to explicitly disable the queuing mechanism. This would have to be a
request on the surface rather than being hidden away as part of wl_drm
because the compositor needs to know about it. Mesa could implicitly
send this request whenever eglSwapInterval is called.

As far as I understand the explicit toggle is the current expected plan
although it does feel a bit like a kludge so we may want to sit on it a
bit in case we can think of something better.

- Neil
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