[Mesa-dev] [PATCH] egl/wayland: Avoid race conditions when on non-main thread

Daniel Stone daniel at fooishbar.org
Wed May 4 09:22:35 UTC 2016

Hi Jonas,

On 4 May 2016 at 09:53, Jonas Ã…dahl <jadahl at gmail.com> wrote:
> When EGL is used on some other thread than the thread that drives the
> main wl_display queue, the Wayland EGL dri2 implementation is
> vulnerable to a race condition related to display round trips and global
> object advertisements.
> The race that may happen is that after after a proxy is created, but
> before the queue is set, events meant to be emitted via the yet to be
> set queue may already have been queued on the wrong queue.
> In order to make it possible to avoid this race, wayland 1.11
> introduced new API that allows creating a proxy wrapper that may be used
> as the factory proxy when creating new proxies via Wayland requests. The
> queue of a proxy wrapper can be changed without effecting what queue
> events emitted by the actual proxy will be queued on, while still
> effecting what default queue proxies created from it will have.

This looks good to me, but I am worried about the hard dependency,
both at build and run-time. It would be great to make it optional at
build-time (#ifdef wrapper creation and destruction, just doing a
straight assignment otherwise to allow the other code to not be
#ifdefed), but even better if it could also use dlsym() to discover if
the symbol is available at runtime. Maybe the latter is overkill


More information about the mesa-dev mailing list