[Development] QtWayland synchronisation between GL and compositor

Tomek Bury tomek.bury at gmail.com
Thu May 26 11:45:16 CEST 2016

Hi all,

Is there any mechanism that that synchronises wl_buffer release by the
compositor to the GL driver's pipeline?

I can't figure out how this synchronisation is supposed to work. My initial
thought was that the sequence of actions will be something like this.
The client
sends a new frame to the compositor, in response the compositor would:

* create EGL image from wl_buffer
* create GL texture from the EGL image
* draw client's buffer somewhere
* destroy texture
* destry image
* swap buffers

and perhaps in a different thread:
* release wl_buffer back to the client

But I can't see any sync objects created or waited on.

Simply depending on eglSwapBuffers() can't work, especially for a
tripple-buffered compositor. Let's say GL driver uses buffers called A, B
and C in the compositor process. Buffer A is visible now, B is already
finished in terms of GL API calls and the compositor has just finished
issuing draw commands to buffer C and calls eglSwapBuffers(). In response
the GL/EGL driver has to wait until hardware completes all drawing
associated with buffer B, hide A ,show B and start using A as a new back
buffer. Buffer C can still be in the making.

Releasing client's wl_buffer only because eglSwapBuffers() was called by
the compositor will create a race between compositor's GL driver completing
frame C in a background and client's GL driver reusing it's buffer. What am
I missing?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20160526/7309e72d/attachment.html>

More information about the Development mailing list