From a3932dc93a2738b8ce64b45b18107c12588c4ffc Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Tue, 25 Apr 2023 10:49:16 +0200 Subject: [PATCH] Backport fix for a deadlock with DRI3 See https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1057 and https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21339 Resolves: #2189434 --- ...resentConfigureNotify-event-for-dest.patch | 105 ++++++++++++++++++ xorg-x11-server.spec | 9 +- 2 files changed, 112 insertions(+), 2 deletions(-) create mode 100644 0001-present-Send-a-PresentConfigureNotify-event-for-dest.patch diff --git a/0001-present-Send-a-PresentConfigureNotify-event-for-dest.patch b/0001-present-Send-a-PresentConfigureNotify-event-for-dest.patch new file mode 100644 index 0000000..d9eea48 --- /dev/null +++ b/0001-present-Send-a-PresentConfigureNotify-event-for-dest.patch @@ -0,0 +1,105 @@ +From b98fc07d3442a289c6bef82df50dd0a2d01de71a Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Thu, 2 Feb 2023 12:26:27 -0500 +Subject: [PATCH xserver] present: Send a PresentConfigureNotify event for + destroyed windows +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This enables fixing a deadlock case on the client side, where the client +ends up blocked waiting for a Present event that will never come because +the window was destroyed. The new PresentWindowDestroyed flag allows the +client to avoid blocking indefinitely. + +Signed-off-by: Adam Jackson +See-also: https://gitlab.freedesktop.org/mesa/mesa/-/issues/116 +See-also: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6685 +Reviewed-by: Michel Dänzer +(cherry picked from commit 462b06033e66a32308d940eb5fc47f5e4c914dc0) +--- + present/present_event.c | 5 +++-- + present/present_priv.h | 7 ++++++- + present/present_screen.c | 11 ++++++++++- + 3 files changed, 19 insertions(+), 4 deletions(-) + +diff --git a/present/present_event.c b/present/present_event.c +index 435b26b70..849732dc8 100644 +--- a/present/present_event.c ++++ b/present/present_event.c +@@ -102,7 +102,8 @@ present_event_swap(xGenericEvent *from, xGenericEvent *to) + } + + void +-present_send_config_notify(WindowPtr window, int x, int y, int w, int h, int bw, WindowPtr sibling) ++present_send_config_notify(WindowPtr window, int x, int y, int w, int h, ++ int bw, WindowPtr sibling, CARD32 flags) + { + present_window_priv_ptr window_priv = present_window_priv(window); + +@@ -122,7 +123,7 @@ present_send_config_notify(WindowPtr window, int x, int y, int w, int h, int bw, + .off_y = 0, + .pixmap_width = w, + .pixmap_height = h, +- .pixmap_flags = 0 ++ .pixmap_flags = flags + }; + present_event_ptr event; + +diff --git a/present/present_priv.h b/present/present_priv.h +index 6ebd009a2..4ad729864 100644 +--- a/present/present_priv.h ++++ b/present/present_priv.h +@@ -43,6 +43,11 @@ + #define DebugPresent(x) + #endif + ++/* XXX this belongs in presentproto */ ++#ifndef PresentWindowDestroyed ++#define PresentWindowDestroyed (1 << 0) ++#endif ++ + extern int present_request; + + extern DevPrivateKeyRec present_screen_private_key; +@@ -307,7 +312,7 @@ void + present_free_events(WindowPtr window); + + void +-present_send_config_notify(WindowPtr window, int x, int y, int w, int h, int bw, WindowPtr sibling); ++present_send_config_notify(WindowPtr window, int x, int y, int w, int h, int bw, WindowPtr sibling, CARD32 flags); + + void + present_send_complete_notify(WindowPtr window, CARD8 kind, CARD8 mode, CARD32 serial, uint64_t ust, uint64_t msc); +diff --git a/present/present_screen.c b/present/present_screen.c +index 15684eda4..2c29aafd2 100644 +--- a/present/present_screen.c ++++ b/present/present_screen.c +@@ -93,6 +93,15 @@ present_destroy_window(WindowPtr window) + present_screen_priv_ptr screen_priv = present_screen_priv(screen); + present_window_priv_ptr window_priv = present_window_priv(window); + ++ present_send_config_notify(window, ++ window->drawable.x, ++ window->drawable.y, ++ window->drawable.width, ++ window->drawable.height, ++ window->borderWidth, ++ window->nextSib, ++ PresentWindowDestroyed); ++ + if (window_priv) { + present_clear_window_notifies(window); + present_free_events(window); +@@ -123,7 +132,7 @@ present_config_notify(WindowPtr window, + ScreenPtr screen = window->drawable.pScreen; + present_screen_priv_ptr screen_priv = present_screen_priv(screen); + +- present_send_config_notify(window, x, y, w, h, bw, sibling); ++ present_send_config_notify(window, x, y, w, h, bw, sibling, 0); + + unwrap(screen_priv, screen, ConfigNotify); + if (screen->ConfigNotify) +-- +2.40.0 + diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec index 2086fcd..26d66b7 100644 --- a/xorg-x11-server.spec +++ b/xorg-x11-server.spec @@ -46,7 +46,7 @@ Summary: X.Org X11 X server Name: xorg-x11-server Version: 1.20.14 -Release: 22%{?gitdate:.%{gitdate}}%{?dist} +Release: 23%{?gitdate:.%{gitdate}}%{?dist} URL: http://www.x.org License: MIT @@ -137,8 +137,10 @@ Patch122: 0008-Xext-fix-invalid-event-type-mask-in-XTestSwapFakeInp.patch Patch123: 0001-Xi-fix-potential-use-after-free-in-DeepCopyPointerCl.patch # CVE-2023-1393 Patch124: 0001-composite-Fix-use-after-free-of-the-COW.patch - +# https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1114 Patch125: xorg-x11-server-fb-access-wrapper.patch +# https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1057 +Patch126: 0001-present-Send-a-PresentConfigureNotify-event-for-dest.patch # Only on F38 and later (patch number starts at 3801, see autopatch below) # Upstream commits 73d6e88, f69280dd and 4127776, minus the xwayland.pc.in change @@ -558,6 +560,9 @@ find %{inst_srcdir}/hw/xfree86 -name \*.c -delete %changelog +* Tue Apr 25 2023 Olivier Fourdan - 1.20.14-23 +- Backport fix for a deadlock with DRI3 (#2189434) + * Thu Apr 13 2023 Florian Weimer - 1.20.14-22 - Make more functions available in fb.h with !FB_ACCESS_WRAPPER