mesa/src/loader
Thomas Hellstrom 54a58b2856 loader/dri3: Improve dri3 thread-safety
It turned out that with recent changes that call into dri3 from glFinish(),
it appears like different thread end up waiting for X events simultaneously,
causing deadlocks since they steal events from eachoter and update the dri3
counters behind eachothers backs.

This patch intends to improve on that. It allows at most one thread at a
time to wait on events for a single drawable. If another thread intends to
do the same, it's put to sleep until the first thread finishes waiting, and
then it rechecks counters and optionally retries the waiting. Threads that
poll for X events never pulls X events off the event queue if there are
other threads waiting for events on that drawable. Counters in the
dri3 drawable structure are protected by a mutex. Finally, the mutex we
introduce is never held while waiting for the X server to avoid
unnecessary stalls.

This does not make dri3 drawables completely thread-safe but at least it's a
first step.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102358
Fixes: d5ba75f888 "st/dri2 Plumb the flush_swapbuffer functionality through to dri3"
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Acked-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-11-13 12:43:39 +01:00
..
Android.mk Android: move libdrm settings to top-level Android.common.mk 2016-06-13 15:31:29 +01:00
loader.c loader: drop empty function alias 2017-10-26 16:25:33 +01:00
loader.h egl: turn one more boolean int into a bool 2017-06-21 21:42:14 +01:00
loader_dri3_helper.c loader/dri3: Improve dri3 thread-safety 2017-11-13 12:43:39 +01:00
loader_dri3_helper.h loader/dri3: Improve dri3 thread-safety 2017-11-13 12:43:39 +01:00
Makefile.am loader: rework xmlconfig dependency 2017-08-04 23:54:52 +01:00
Makefile.sources loader: Add headers to distribution. 2014-12-12 12:11:47 -08:00
meson.build meson: split and simplify dependencies 2017-10-16 16:32:43 -07:00
pci_id_driver_map.c nouveau: allow NV3x's to be used with nouveau_vieux 2016-08-30 00:21:42 -04:00
pci_id_driver_map.h radeonsi: remove unused field in the PCI ID table 2017-11-07 17:26:36 +01:00
SConscript scons: remove all libudev references 2016-10-18 17:06:21 +01:00