mesa/src
Hans-Kristian Arntzen 9e55766f63 wsi/x11: Fix possible deadlock with wait_ready.
With the introduction of locks around the XCB polling mechanism,
a possible deadlock was introduced.

If all 5 images were rapidly acquired and presented before the
FIFO thread had the chance to submit a present,
we would deadlock.

Before the lock however, it was still buggy since the two threads would
race to poll events and update internal state.

The fix is to just ensure that there are pending presentation requests
in flight, so that forward progress is guaranteed before we take the
poll lock.

Also, use a timedlock for acquire next image.

Similar as WaitForPresentKHR.
Also need to make the busy flag atomic to actually allow acquire thread
and present threads to access the busy flag.
Take advantage of busy flag being atomic so that we can gracefully handle
timeout == 0 scenarios where there actually are images available.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Fixes: 8fc7927787 ("wsi/x11: Implement VK_KHR_present_wait on X11.)
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19990>
2022-12-14 14:20:54 +00:00
..
amd radv: Don't lower subgroup shuffle on GFX11. 2022-12-14 13:54:04 +00:00
android_stub
asahi nir: Eliminate nir_op_i2b 2022-12-14 06:23:21 +00:00
broadcom nir: Eliminate nir_op_i2b 2022-12-14 06:23:21 +00:00
c11 c11: Remove _MTX_INITIALIZER_NP for windows 2022-11-09 04:38:28 +00:00
compiler spirv: add support for AMD_shader_early_and_late_fragment_tests 2022-12-14 08:16:27 +00:00
drm-shim drm-shim: add __readlink_chk as readlink with overflow check 2022-12-08 21:05:15 +00:00
egl gallium: rename st_framebuffer_iface -> pipe_frontend_drawable, etc. 2022-12-09 13:14:03 +00:00
etnaviv tree-wide: Use __func__ instead of __FUNCTION__ in non-gallium code 2022-11-22 06:53:46 +00:00
freedreno nir: Eliminate nir_op_i2b 2022-12-14 06:23:21 +00:00
gallium iris: Enable compression for image load/store in more cases 2022-12-14 13:01:27 +00:00
gbm gbm: Don't look up the DRI2_FENCE extension. 2022-12-09 05:32:18 +00:00
getopt
glx glx: fix xshm check to init xshm_opcode. 2022-12-06 22:31:14 +00:00
gtest gtest: Fix maybe-uninitialized compiler warning 2022-06-29 21:02:18 +00:00
hgl
imagination pvr: Check depth/stencil attachment is tile-aligned 2022-12-08 14:53:13 +00:00
imgui
intel anv: assert when number of primitives is higher than max 2022-12-14 09:55:11 +00:00
loader dri: Introduce internal Mesa DRI driver loader extension. 2022-12-05 19:26:41 +00:00
mapi mapi: update gles 1.1 extention packet link 2022-11-20 15:14:01 +00:00
mesa mesa: move the _mesa_set_varying_vp_inputs call to where the state changes 2022-12-12 19:15:34 +00:00
microsoft nir: Eliminate nir_op_i2b 2022-12-14 06:23:21 +00:00
nouveau nir: Eliminate nir_op_i2b 2022-12-14 06:23:21 +00:00
panfrost nir: Eliminate nir_op_i2b 2022-12-14 06:23:21 +00:00
tool pps: make pps-producer RT only on freedreno 2022-11-15 21:21:42 +00:00
util radv: Force non uniform texture sampling with NV Remix 2022-12-12 18:18:32 +00:00
virtio ci/venus: add a VKCTS mapping test to the flakes list 2022-12-14 13:36:38 +00:00
vulkan wsi/x11: Fix possible deadlock with wait_ready. 2022-12-14 14:20:54 +00:00
meson.build meson: build radeon drm-shim also for r300 and r600 2022-11-16 14:37:47 +00:00