[PATCH mesa v4] wayland: Add support for eglSwapInterval

Neil Roberts neil at linux.intel.com
Tue Oct 29 17:45:44 CET 2013


Jason Ekstrand <jason at jlekstrand.net> writes:

> You don't have to continuously sync, just sync after every
> attach/commit. While it may be somewhat non-obvious, I don't see how
> calling sync once per frame is any worse than setting some flag
> somewhere.

Hrmm thinking about it, I suppose sending the sync request isn't totally
free because it will end up waking up the client an extra time to get
the sync complete event. In a normal client this information wouldn't be
used until the next time get_back_bo is called and Mesa's event queue is
flushed so the wake up is not necessary. Waking up an extra time
effectively negates the whole point of having the queuing mechanism in
the first place.

In this version 4 of the patch I made it so that it always does a sync
request even if the application is using eglSwapInterval(1). This is
needed because otherwise if the application isn't installing its own
frame callback then it won't try to block for Mesa's frame callback
until the next eglSwapInterval which means it won't have had a chance to
receive any release events when get_back_bo is called. That would cause
it to use an extra unnecessary buffer.

So the patch effectively just turns off the queuing mechanism for all
EGL clients through the backdoor.

You could argue that we shouldn't use the sync request for
eglSwapInterval(0) but I don't think that would be a good idea. The case
where this would cause an extra redundant buffer is not a corner case.
I think most game-style applications (eg, something using SDL) would hit
this case because they would be relying on eglSwapInterval to do the
throttling.

I think making those games use an extra buffer is a worse crime than
waking up the clients an extra time. The problem is not specific to the
my patch and is happening right now with Weston master. I'm starting to
wonder if we should just give up on the event queuing altogether.

Regards,
- Neil


More information about the wayland-devel mailing list