diff --git a/SOURCES/0001-modesetting-Reduce-glamor-initialization-failed-mess.patch b/SOURCES/0001-modesetting-Reduce-glamor-initialization-failed-mess.patch new file mode 100644 index 0000000..75f47b1 --- /dev/null +++ b/SOURCES/0001-modesetting-Reduce-glamor-initialization-failed-mess.patch @@ -0,0 +1,37 @@ +From 41e265988a0b6ec456ddd562253e0f82a7c2ede2 Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Fri, 27 Sep 2019 11:43:52 -0400 +Subject: [PATCH xserver] modesetting: Reduce "glamor initialization failed" + message to X_INFO +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This might be an error or not, for example refusing to work on llvmpipe +is normal and expected. glamor_egl_init() will print X_ERROR messages if +appropriate, so we don't need to here. + +Reviewed-by: Michel Dänzer + +(cherry picked from commit cbdde938cbaf604741cd057fac743859ada342ec) +Signed-off-by: Michel Dänzer +--- + hw/xfree86/drivers/modesetting/driver.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c +index 2aaea5f7d..783d53eaa 100644 +--- a/hw/xfree86/drivers/modesetting/driver.c ++++ b/hw/xfree86/drivers/modesetting/driver.c +@@ -772,7 +772,7 @@ try_enable_glamor(ScrnInfoPtr pScrn) + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "glamor initialized\n"); + ms->drmmode.glamor = TRUE; + } else { +- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, ++ xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "glamor initialization failed\n"); + } + } else { +-- +2.26.2 + diff --git a/SOURCES/0001-present-wnmd-Keep-pixmap-pointer-in-present_wnmd_cle.patch b/SOURCES/0001-present-wnmd-Keep-pixmap-pointer-in-present_wnmd_cle.patch new file mode 100644 index 0000000..c6ae2eb --- /dev/null +++ b/SOURCES/0001-present-wnmd-Keep-pixmap-pointer-in-present_wnmd_cle.patch @@ -0,0 +1,37 @@ +From f32c851a0ba41f5d8d0f8c869bc394858de721df Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michel=20D=C3=A4nzer?= +Date: Thu, 25 Jun 2020 18:09:27 +0200 +Subject: [PATCH xserver 1/4] present/wnmd: Keep pixmap pointer in + present_wnmd_clear_window_flip +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The comment was incorrect: Any reference held by the window (see +present_wnmd_execute) is in addition to the one in struct present_vblank +(see present_vblank_create). So if we don't drop the latter, the pixmap +will be leaked. + +Reviewed-by: Dave Airlie +(cherry picked from commit bc9dd1c71c3722284ffaa7183f4119151b25a44f) +Signed-off-by: Michel Dänzer +--- + present/present_screen.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/present/present_screen.c b/present/present_screen.c +index c7e37c5fd..c435f55f4 100644 +--- a/present/present_screen.c ++++ b/present/present_screen.c +@@ -122,8 +122,6 @@ present_wnmd_clear_window_flip(WindowPtr window) + + xorg_list_for_each_entry_safe(vblank, tmp, &window_priv->idle_queue, event_queue) { + present_pixmap_idle(vblank->pixmap, vblank->window, vblank->serial, vblank->idle_fence); +- /* The pixmap will be destroyed by freeing the window resources. */ +- vblank->pixmap = NULL; + present_vblank_destroy(vblank); + } + +-- +2.26.2 + diff --git a/SOURCES/0001-xwayland-Disable-Present-support.patch b/SOURCES/0001-xwayland-Disable-Present-support.patch deleted file mode 100644 index 16e474b..0000000 --- a/SOURCES/0001-xwayland-Disable-Present-support.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 6d0aaa3279d4671c4c17fdf9c049fc03b8ba273d Mon Sep 17 00:00:00 2001 -From: Olivier Fourdan -Date: Thu, 11 Oct 2018 15:48:17 +0200 -Subject: [PATCH xserver] xwayland: Disable Present support - -The addition of Present support in xserver-1.20.x introduced some -instability and hard to reproduce bugs which can cause Xwayland to crash -and take the entire user session with it. - -Disable Present in support until it's stabilized. - -This patch is a temporary workaround, it is not meant to be submitted -upstream. - -Signed-off-by: Olivier Fourdan ---- - hw/xwayland/xwayland.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c -index 605c9f56b..cb29ce81c 100644 ---- a/hw/xwayland/xwayland.c -+++ b/hw/xwayland/xwayland.c -@@ -1071,9 +1071,10 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv) - xwl_screen->glamor = 0; - } - } -- -+#if 0 /* Disable Present support in Xwayland for now */ - if (xwl_screen->glamor && xwl_screen->rootless) - xwl_screen->present = xwl_present_init(pScreen); -+#endif - #endif - - if (!xwl_screen->glamor) { --- -2.19.1 - diff --git a/SOURCES/0002-present-wnmd-Free-flip_queue-entries-in-present_wnmd.patch b/SOURCES/0002-present-wnmd-Free-flip_queue-entries-in-present_wnmd.patch new file mode 100644 index 0000000..6bce17f --- /dev/null +++ b/SOURCES/0002-present-wnmd-Free-flip_queue-entries-in-present_wnmd.patch @@ -0,0 +1,45 @@ +From 732507ed3255dff3970c5f92bd6ea13bf877e637 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michel=20D=C3=A4nzer?= +Date: Thu, 25 Jun 2020 18:11:31 +0200 +Subject: [PATCH xserver 2/4] present/wnmd: Free flip_queue entries in + present_wnmd_clear_window_flip +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When present_wnmd_clear_window_flip is done, present_destroy_window +frees struct present_window_priv, and the events in the flip queue +become unreachable. So if we don't free them first, they're leaked. + +Also drop the call to present_wnmd_set_abort_flip, which just sets a +flag in struct present_window_priv and thus can't have any observable +effect after present_destroy_window. + +Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1042 +Reviewed-by: Dave Airlie +(cherry picked from commit 1bdedc8dbb9d035b85444c2558a137470ff52113) +Signed-off-by: Michel Dänzer +--- + present/present_screen.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/present/present_screen.c b/present/present_screen.c +index c435f55f4..bfd30b8ba 100644 +--- a/present/present_screen.c ++++ b/present/present_screen.c +@@ -115,9 +115,9 @@ present_wnmd_clear_window_flip(WindowPtr window) + present_window_priv_ptr window_priv = present_window_priv(window); + present_vblank_ptr vblank, tmp; + +- if (window_priv->flip_pending) { +- present_wnmd_set_abort_flip(window); +- window_priv->flip_pending->window = NULL; ++ xorg_list_for_each_entry_safe(vblank, tmp, &window_priv->flip_queue, event_queue) { ++ present_pixmap_idle(vblank->pixmap, vblank->window, vblank->serial, vblank->idle_fence); ++ present_vblank_destroy(vblank); + } + + xorg_list_for_each_entry_safe(vblank, tmp, &window_priv->idle_queue, event_queue) { +-- +2.26.2 + diff --git a/SOURCES/0003-xwayland-Always-use-xwl_present_free_event-for-freei.patch b/SOURCES/0003-xwayland-Always-use-xwl_present_free_event-for-freei.patch new file mode 100644 index 0000000..7925adc --- /dev/null +++ b/SOURCES/0003-xwayland-Always-use-xwl_present_free_event-for-freei.patch @@ -0,0 +1,94 @@ +From 99e9854c5fab7114b26c272088d9202548da55bf Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michel=20D=C3=A4nzer?= +Date: Fri, 19 Jun 2020 18:14:35 +0200 +Subject: [PATCH xserver 3/4] xwayland: Always use xwl_present_free_event for + freeing Present events +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Minor cleanup, and will make the next change simpler. No functional +change intended. + +Reviewed-by: Dave Airlie +(cherry picked from commit 1beffba699e2cc3f23039d2177c025bc127966de) +Signed-off-by: Michel Dänzer +--- + hw/xwayland/xwayland-present.c | 27 ++++++++++++--------------- + 1 file changed, 12 insertions(+), 15 deletions(-) + +diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c +index 5ba7dce08..492e4a876 100644 +--- a/hw/xwayland/xwayland-present.c ++++ b/hw/xwayland/xwayland-present.c +@@ -111,6 +111,13 @@ xwl_present_reset_timer(struct xwl_present_window *xwl_present_window) + } + } + ++static void ++xwl_present_free_event(struct xwl_present_event *event) ++{ ++ xorg_list_del(&event->list); ++ free(event); ++} ++ + void + xwl_present_cleanup(WindowPtr window) + { +@@ -128,17 +135,15 @@ xwl_present_cleanup(WindowPtr window) + } + + /* Clear remaining events */ +- xorg_list_for_each_entry_safe(event, tmp, &xwl_present_window->event_list, list) { +- xorg_list_del(&event->list); +- free(event); +- } ++ xorg_list_for_each_entry_safe(event, tmp, &xwl_present_window->event_list, list) ++ xwl_present_free_event(event); + + /* Clear remaining buffer releases and inform Present about free ressources */ + event = xwl_present_window->sync_flip; + xwl_present_window->sync_flip = NULL; + if (event) { + if (event->buffer_released) { +- free(event); ++ xwl_present_free_event(event); + } else { + event->pending = FALSE; + event->abort = TRUE; +@@ -160,13 +165,6 @@ xwl_present_cleanup(WindowPtr window) + free(xwl_present_window); + } + +-static void +-xwl_present_free_event(struct xwl_present_event *event) +-{ +- xorg_list_del(&event->list); +- free(event); +-} +- + static void + xwl_present_buffer_release(void *data, struct wl_buffer *buffer) + { +@@ -216,7 +214,7 @@ xwl_present_msc_bump(struct xwl_present_window *xwl_present_window) + /* If the buffer was already released, clean up now */ + present_wnmd_event_notify(xwl_present_window->window, event->event_id, + xwl_present_window->ust, msc); +- free(event); ++ xwl_present_free_event(event); + } else { + xorg_list_add(&event->list, &xwl_present_window->release_queue); + } +@@ -392,8 +390,7 @@ xwl_present_abort_vblank(WindowPtr present_window, + + xorg_list_for_each_entry_safe(event, tmp, &xwl_present_window->event_list, list) { + if (event->event_id == event_id) { +- xorg_list_del(&event->list); +- free(event); ++ xwl_present_free_event(event); + return; + } + } +-- +2.26.2 + diff --git a/SOURCES/0004-xwayland-Free-all-remaining-events-in-xwl_present_cl.patch b/SOURCES/0004-xwayland-Free-all-remaining-events-in-xwl_present_cl.patch new file mode 100644 index 0000000..ab526e7 --- /dev/null +++ b/SOURCES/0004-xwayland-Free-all-remaining-events-in-xwl_present_cl.patch @@ -0,0 +1,77 @@ +From 1466a4fdfa8156dd4fd8b6ee6acd1b44f72ee3b1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michel=20D=C3=A4nzer?= +Date: Fri, 19 Jun 2020 18:10:18 +0200 +Subject: [PATCH xserver 4/4] xwayland: Free all remaining events in + xwl_present_cleanup +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +At the end of xwl_present_cleanup, these events aren't reachable +anymore, so if we don't free them first, they're leaked. + +(cherry picked from commit 64565ea344fef0171497952ef75f019cb420fe3b) + +v2: +* Simpler backport, no need to keep a reference to the pixmap on the + 1.20 branch. + +Signed-off-by: Michel Dänzer +--- + hw/xwayland/xwayland-present.c | 26 +++++++++++--------------- + 1 file changed, 11 insertions(+), 15 deletions(-) + +diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c +index 492e4a876..2cec63f59 100644 +--- a/hw/xwayland/xwayland-present.c ++++ b/hw/xwayland/xwayland-present.c +@@ -114,6 +114,12 @@ xwl_present_reset_timer(struct xwl_present_window *xwl_present_window) + static void + xwl_present_free_event(struct xwl_present_event *event) + { ++ if (!event) ++ return; ++ ++ if (event->buffer) ++ wl_buffer_set_user_data(event->buffer, NULL); ++ + xorg_list_del(&event->list); + free(event); + } +@@ -138,21 +144,10 @@ xwl_present_cleanup(WindowPtr window) + xorg_list_for_each_entry_safe(event, tmp, &xwl_present_window->event_list, list) + xwl_present_free_event(event); + +- /* Clear remaining buffer releases and inform Present about free ressources */ +- event = xwl_present_window->sync_flip; +- xwl_present_window->sync_flip = NULL; +- if (event) { +- if (event->buffer_released) { +- xwl_present_free_event(event); +- } else { +- event->pending = FALSE; +- event->abort = TRUE; +- } +- } +- xorg_list_for_each_entry_safe(event, tmp, &xwl_present_window->release_queue, list) { +- xorg_list_del(&event->list); +- event->abort = TRUE; +- } ++ xwl_present_free_event(xwl_present_window->sync_flip); ++ ++ xorg_list_for_each_entry_safe(event, tmp, &xwl_present_window->release_queue, list) ++ xwl_present_free_event(event); + + /* Clear timer */ + xwl_present_free_timer(xwl_present_window); +@@ -353,6 +348,7 @@ xwl_present_queue_vblank(WindowPtr present_window, + return BadAlloc; + + event->event_id = event_id; ++ event->buffer = NULL; + event->xwl_present_window = xwl_present_window; + event->target_msc = msc; + +-- +2.26.2 + diff --git a/SPECS/xorg-x11-server.spec b/SPECS/xorg-x11-server.spec index e4bc917..f33660f 100644 --- a/SPECS/xorg-x11-server.spec +++ b/SPECS/xorg-x11-server.spec @@ -46,7 +46,7 @@ Summary: X.Org X11 X server Name: xorg-x11-server Version: 1.20.8 -Release: 1%{?gitdate:.%{gitdate}}%{?dist} +Release: 3%{?gitdate:.%{gitdate}}%{?dist} URL: http://www.x.org License: MIT Group: User Interface/X @@ -97,9 +97,15 @@ Patch12: 0001-link-with-z-now.patch Patch14: 0001-xfree86-Don-t-autoconfigure-vesa-or-fbdev.patch Patch15: 0001-xfree86-LeaveVT-from-xf86CrtcCloseScreen.patch Patch16: 0001-xfree86-try-harder-to-span-on-multihead.patch -Patch17: 0001-xwayland-Disable-Present-support.patch Patch18: 0001-mustard-Work-around-broken-fbdev-headers.patch +# Xwayland / Present leak fixes from +# https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/459 +Patch20: 0001-present-wnmd-Keep-pixmap-pointer-in-present_wnmd_cle.patch +Patch21: 0002-present-wnmd-Free-flip_queue-entries-in-present_wnmd.patch +Patch22: 0003-xwayland-Always-use-xwl_present_free_event-for-freei.patch +Patch23: 0004-xwayland-Free-all-remaining-events-in-xwl_present_cl.patch + # fix to be upstreamed Patch100: 0001-linux-Make-platform-device-probe-less-fragile.patch Patch102: 0001-xfree86-ensure-the-readlink-buffer-is-null-terminate.patch @@ -107,6 +113,7 @@ Patch102: 0001-xfree86-ensure-the-readlink-buffer-is-null-terminate.patch # fix already upstream Patch200: 0001-Fix-segfault-on-probing-a-non-PCI-platform-device-on.patch Patch201: 0001-linux-Fix-platform-device-PCI-detection-for-complex-.patch +Patch202: 0001-modesetting-Reduce-glamor-initialization-failed-mess.patch BuildRequires: systemtap-sdt-devel BuildRequires: git @@ -550,6 +557,16 @@ find %{inst_srcdir}/hw/xfree86 -name \*.c -delete %changelog +* Fri Jun 26 2020 Michel Dänzer - 1.20.8-3 +- Downgrade modesetting "glamor initialization failed" X_ERROR → X_INFO + Resolves: #1724573 +- Xwayland / Present leak fixes for #1728684 + +* Wed Jun 10 2020 Michel Dänzer - 1.20.8-2 +- Re-enable Xwayland Present support + Resolves: #1728684, #1715676 +- Remove unused patch + * Tue May 26 2020 Adam Jackson - 1.20.8-1 - xserver 1.20.8