diff --git a/0001-glamor-Make-pixmap-exportable-from-gbm_bo_from_pixma.patch b/0001-glamor-Make-pixmap-exportable-from-gbm_bo_from_pixma.patch new file mode 100644 index 0000000..ea31a81 --- /dev/null +++ b/0001-glamor-Make-pixmap-exportable-from-gbm_bo_from_pixma.patch @@ -0,0 +1,89 @@ +From 6e199e4613e149cd5d5ce69cdd6a259744b6cb44 Mon Sep 17 00:00:00 2001 +From: Olivier Fourdan +Date: Fri, 26 Apr 2019 13:37:09 +0200 +Subject: [PATCH xserver] glamor: Make pixmap exportable from + `gbm_bo_from_pixmap()` + +If a pixmap is not exportable, `glamor_gbm_bo_from_pixmap()` would fail +and the modesettings driver would consequently fail to do its page flip, +which both prevents Present from working and also fill up the logs with +error messages such as: + + (EE) modeset(0): Failed to get GBM bo for flip to new front. + (EE) modeset(0): present flip failed + +Refactor the code so that `glamor_gbm_bo_from_pixmap()` takes care of +making the pixmap exportable. + +Signed-off-by: Olivier Fourdan +Signed-off-by: Yuxuan Shui yshui@hadean.com +See-also: https://gitlab.freedesktop.org/xorg/xserver/merge_requests/131 +Closes: https://gitlab.freedesktop.org/xorg/xserver/issues/68 +Fixes: 86b2d8740a "glamor: Reallocate pixmap storage without modifiers + if necessary" +(cherry picked from commit 26fe29f4fa53cbb7d51892e2cf397c084093812f) +--- + glamor/glamor_egl.c | 19 ++++++++++++++----- + 1 file changed, 14 insertions(+), 5 deletions(-) + +diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c +index d3c678d6b..9a619a133 100644 +--- a/glamor/glamor_egl.c ++++ b/glamor/glamor_egl.c +@@ -355,8 +355,8 @@ glamor_make_pixmap_exportable(PixmapPtr pixmap, Bool modifiers_ok) + return TRUE; + } + +-struct gbm_bo * +-glamor_gbm_bo_from_pixmap(ScreenPtr screen, PixmapPtr pixmap) ++static struct gbm_bo * ++glamor_gbm_bo_from_pixmap_internal(ScreenPtr screen, PixmapPtr pixmap) + { + struct glamor_egl_screen_private *glamor_egl = + glamor_egl_get_screen_private(xf86ScreenToScrn(screen)); +@@ -370,6 +370,15 @@ glamor_gbm_bo_from_pixmap(ScreenPtr screen, PixmapPtr pixmap) + pixmap_priv->image, 0); + } + ++struct gbm_bo * ++glamor_gbm_bo_from_pixmap(ScreenPtr screen, PixmapPtr pixmap) ++{ ++ if (!glamor_make_pixmap_exportable(pixmap, TRUE)) ++ return NULL; ++ ++ return glamor_gbm_bo_from_pixmap_internal(screen, pixmap); ++} ++ + int + glamor_egl_fds_from_pixmap(ScreenPtr screen, PixmapPtr pixmap, int *fds, + uint32_t *strides, uint32_t *offsets, +@@ -385,7 +394,7 @@ glamor_egl_fds_from_pixmap(ScreenPtr screen, PixmapPtr pixmap, int *fds, + if (!glamor_make_pixmap_exportable(pixmap, TRUE)) + return 0; + +- bo = glamor_gbm_bo_from_pixmap(screen, pixmap); ++ bo = glamor_gbm_bo_from_pixmap_internal(screen, pixmap); + if (!bo) + return 0; + +@@ -423,7 +432,7 @@ glamor_egl_fd_from_pixmap(ScreenPtr screen, PixmapPtr pixmap, + if (!glamor_make_pixmap_exportable(pixmap, FALSE)) + return -1; + +- bo = glamor_gbm_bo_from_pixmap(screen, pixmap); ++ bo = glamor_gbm_bo_from_pixmap_internal(screen, pixmap); + if (!bo) + return -1; + +@@ -452,7 +461,7 @@ glamor_egl_fd_name_from_pixmap(ScreenPtr screen, + if (!glamor_make_pixmap_exportable(pixmap, FALSE)) + goto failure; + +- bo = glamor_gbm_bo_from_pixmap(screen, pixmap); ++ bo = glamor_gbm_bo_from_pixmap_internal(screen, pixmap); + if (!bo) + goto failure; + +-- +2.21.0 + diff --git a/0001-xwayland-Avoid-a-crash-on-pointer-enter-with-a-grab.patch b/0001-xwayland-Avoid-a-crash-on-pointer-enter-with-a-grab.patch new file mode 100644 index 0000000..7983893 --- /dev/null +++ b/0001-xwayland-Avoid-a-crash-on-pointer-enter-with-a-grab.patch @@ -0,0 +1,53 @@ +From 6711b5c6fdf0581c77150306fff909d7bc63b8a4 Mon Sep 17 00:00:00 2001 +From: Olivier Fourdan +Date: Thu, 9 May 2019 10:36:19 +0200 +Subject: [PATCH xserver] xwayland: Avoid a crash on pointer enter with a grab + +On pointer enter notification, Xwayland checks for an existing pointer +warp with a `NULL` sprite. + +In turn, `xwl_pointer_warp_emulator_maybe_lock()` checks for an existing +grab and the destination window using `XYToWindow()` which does not +check for the actual sprite not being `NULL`. + +So, in some cases, when the pointer enters the surface and there is an +existing X11 grab which is not an ownerEvents grab, Xwayland would crash +trying to dereference the `NULL` sprite pointer: + + #0 __GI_raise () + #1 __GI_abort () at abort.c:79 + #2 OsAbort () at utils.c:1351 + #3 AbortServer () at log.c:879 + #4 FatalError () at log.c:1017 + #5 OsSigHandler () at osinit.c:156 + #6 OsSigHandler () at osinit.c:110 + #7 + #8 XYToWindow (pSprite=0x0, x=0, y=0) at events.c:2880 + #9 xwl_pointer_warp_emulator_maybe_lock () at xwayland-input.c:2673 + #10 pointer_handle_enter () at xwayland-input.c:434 + +Avoid the crash by simply checking for the sprite being not `NULL` in +`xwl_pointer_warp_emulator_maybe_lock()` + +Signed-off-by: Olivier Fourdan +Bugzilla: https://bugzilla.redhat.com/1708119 +(cherry picked from commit 0a07446318f248b65fcbc8ab8a73ead51153f09e) +--- + hw/xwayland/xwayland-input.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c +index fbbcb39cc..fa46ac3e7 100644 +--- a/hw/xwayland/xwayland-input.c ++++ b/hw/xwayland/xwayland-input.c +@@ -2667,6 +2667,7 @@ xwl_pointer_warp_emulator_maybe_lock(struct xwl_pointer_warp_emulator *warp_emul + */ + if (pointer_grab && + !pointer_grab->ownerEvents && ++ sprite && + XYToWindow(sprite, x, y) != xwl_seat->focus_window->window) + return; + +-- +2.21.0 + diff --git a/0001-xwayland-Check-status-in-GBM-pixmap-creation.patch b/0001-xwayland-Check-status-in-GBM-pixmap-creation.patch new file mode 100644 index 0000000..bdbfdda --- /dev/null +++ b/0001-xwayland-Check-status-in-GBM-pixmap-creation.patch @@ -0,0 +1,137 @@ +From 34ad57e570f96dfe4bc493f14726b7a0ae6d45f9 Mon Sep 17 00:00:00 2001 +From: Olivier Fourdan +Date: Tue, 12 Mar 2019 15:38:03 +0100 +Subject: [PATCH xserver] xwayland: Check status in GBM pixmap creation + +The current code in `xwl_glamor_gbm_create_pixmap_for_bo()` may fail in +several cases that are not checked for: + + - `eglCreateImageKHR()` may have failed to create the image, + - `glEGLImageTargetTexture2DOES()` may fail and set an error, + - `glamor_set_pixmap_texture()` may fail for very large pixmaps + because the corresponding FBO could not be created. + +Trying to upload content to a pixmap with no texture will crash Mesa, +glamor and Xwayland, e.g.: + + XXX fail to create fbo. + (EE) + (EE) Backtrace: + (EE) 0: Xwayland (OsSigHandler+0x29) + (EE) 1: libpthread.so.0 (funlockfile+0x50) + (EE) 2: libc.so.6 (__memmove_avx_unaligned_erms+0x215) + (EE) 3: dri/i965_dri.so (_mesa_format_convert+0xab3) + (EE) 4: dri/i965_dri.so (_mesa_texstore+0x205) + (EE) 5: dri/i965_dri.so (store_texsubimage+0x28c) + (EE) 6: dri/i965_dri.so (intel_upload_tex+0x13b) + (EE) 7: dri/i965_dri.so (texture_sub_image+0x134) + (EE) 8: dri/i965_dri.so (texsubimage_err+0x150) + (EE) 9: dri/i965_dri.so (_mesa_TexSubImage2D+0x48) + (EE) 10: Xwayland (glamor_upload_boxes+0x246) + (EE) 11: Xwayland (glamor_copy+0x4d1) + (EE) 12: Xwayland (miCopyRegion+0x96) + (EE) 13: Xwayland (miDoCopy+0x43c) + (EE) 14: Xwayland (glamor_copy_area+0x24) + (EE) 15: Xwayland (damageCopyArea+0xba) + (EE) 16: Xwayland (compCopyWindow+0x31c) + (EE) 17: Xwayland (damageCopyWindow+0xd3) + (EE) 18: Xwayland (miResizeWindow+0x7b7) + (EE) 19: Xwayland (compResizeWindow+0x3a) + (EE) 20: Xwayland (ConfigureWindow+0xa96) + (EE) 21: Xwayland (ProcConfigureWindow+0x7d) + (EE) 22: Xwayland (Dispatch+0x320) + (EE) 23: Xwayland (dix_main+0x366) + (EE) 24: libc.so.6 (__libc_start_main+0xf3) + (EE) 25: Xwayland (_start+0x2e) + (EE) + Fatal server error: + (EE) Caught signal 11 (Segmentation fault). Server aborting + (EE) + +Check for the possible cases of failure above and fallback to the +regular glamor pixmap creation when an error is detected. + +Signed-off-by: Olivier Fourdan +Closes: https://gitlab.freedesktop.org/xorg/xserver/issues/661 +(cherry picked from commit fc6380a11be4c6202ed72f241dd9ee8c7c24671d) +--- + hw/xwayland/xwayland-glamor-gbm.c | 34 +++++++++++++++++++++++++++---- + 1 file changed, 30 insertions(+), 4 deletions(-) + +diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c +index a211e0915..80146ab6e 100644 +--- a/hw/xwayland/xwayland-glamor-gbm.c ++++ b/hw/xwayland/xwayland-glamor-gbm.c +@@ -169,6 +169,8 @@ xwl_glamor_gbm_create_pixmap_for_bo(ScreenPtr screen, struct gbm_bo *bo, + xwl_screen->egl_context, + EGL_NATIVE_PIXMAP_KHR, + xwl_pixmap->bo, NULL); ++ if (xwl_pixmap->image == EGL_NO_IMAGE_KHR) ++ goto error; + + glGenTextures(1, &xwl_pixmap->texture); + glBindTexture(GL_TEXTURE_2D, xwl_pixmap->texture); +@@ -176,14 +178,31 @@ xwl_glamor_gbm_create_pixmap_for_bo(ScreenPtr screen, struct gbm_bo *bo, + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + + glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, xwl_pixmap->image); +- glBindTexture(GL_TEXTURE_2D, 0); ++ if (eglGetError() != EGL_SUCCESS) ++ goto error; + +- xwl_pixmap_set_private(pixmap, xwl_pixmap); ++ glBindTexture(GL_TEXTURE_2D, 0); + + glamor_set_pixmap_texture(pixmap, xwl_pixmap->texture); ++ /* `set_pixmap_texture()` may fail silently if the FBO creation failed, ++ * so we check again the texture to be sure it worked. ++ */ ++ if (!glamor_get_pixmap_texture(pixmap)) ++ goto error; ++ + glamor_set_pixmap_type(pixmap, GLAMOR_TEXTURE_DRM); ++ xwl_pixmap_set_private(pixmap, xwl_pixmap); + + return pixmap; ++ ++error: ++ if (xwl_pixmap->image != EGL_NO_IMAGE_KHR) ++ eglDestroyImageKHR(xwl_screen->egl_display, xwl_pixmap->image); ++ if (pixmap) ++ glamor_destroy_pixmap(pixmap); ++ free(xwl_pixmap); ++ ++ return NULL; + } + + static PixmapPtr +@@ -194,6 +213,7 @@ xwl_glamor_gbm_create_pixmap(ScreenPtr screen, + struct xwl_screen *xwl_screen = xwl_screen_get(screen); + struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen); + struct gbm_bo *bo; ++ PixmapPtr pixmap = NULL; + + if (width > 0 && height > 0 && depth >= 15 && + (hint == 0 || +@@ -219,10 +239,16 @@ xwl_glamor_gbm_create_pixmap(ScreenPtr screen, + } + + if (bo) +- return xwl_glamor_gbm_create_pixmap_for_bo(screen, bo, depth); ++ pixmap = xwl_glamor_gbm_create_pixmap_for_bo(screen, bo, depth); ++ ++ if (!pixmap) ++ gbm_bo_destroy(bo); + } + +- return glamor_create_pixmap(screen, width, height, depth, hint); ++ if (!pixmap) ++ pixmap = glamor_create_pixmap(screen, width, height, depth, hint); ++ ++ return pixmap; + } + + static Bool +-- +2.21.0 + diff --git a/0001-xwayland-Reset-scheduled-frames-after-hiding-tablet-.patch b/0001-xwayland-Reset-scheduled-frames-after-hiding-tablet-.patch new file mode 100644 index 0000000..93cf411 --- /dev/null +++ b/0001-xwayland-Reset-scheduled-frames-after-hiding-tablet-.patch @@ -0,0 +1,38 @@ +From c86222d4bd94892f3bf3c5947c19793ca18bd9e2 Mon Sep 17 00:00:00 2001 +From: Carlos Garnacho +Date: Wed, 22 May 2019 17:51:04 +0200 +Subject: [PATCH xserver] xwayland: Reset scheduled frames after hiding tablet + cursor + +Hiding the tablet tool cursor results in it being hidden forever after. +This is due to the stale frame callback that will neither be disposed +or replaced. This can be reproduced in krita (X11) as the pointer +cursor is hidden while over the canvas. + +Clearing the frame callback ensures the correct behavior in future +xwl_tablet_tool_set_cursor() calls (i.e. a new cursor surface being +displayed, and a new frame callback created), and is 1:1 +with xwl_seat_set_cursor() for pointers. + +Signed-off-by: Carlos Garnacho +(cherry picked from commit dea4a74621294391ce5901bb3339e1b8e7151efc) +--- + hw/xwayland/xwayland-cursor.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/hw/xwayland/xwayland-cursor.c b/hw/xwayland/xwayland-cursor.c +index cf8395f1d..66720bcc0 100644 +--- a/hw/xwayland/xwayland-cursor.c ++++ b/hw/xwayland/xwayland-cursor.c +@@ -188,6 +188,8 @@ xwl_tablet_tool_set_cursor(struct xwl_tablet_tool *xwl_tablet_tool) + zwp_tablet_tool_v2_set_cursor(xwl_tablet_tool->tool, + xwl_tablet_tool->proximity_in_serial, + NULL, 0, 0); ++ clear_cursor_frame_callback(xwl_cursor); ++ xwl_cursor->needs_update = FALSE; + return; + } + +-- +2.21.0 + diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec index 049b269..2784b14 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.5 -Release: 2%{?gitdate:.%{gitdate}}%{?dist} +Release: 3%{?gitdate:.%{gitdate}}%{?dist} URL: http://www.x.org License: MIT @@ -96,14 +96,24 @@ Patch6: 0001-Fedora-hack-Make-the-suid-root-wrapper-always-start-.patch # test for https://bugzilla.redhat.com/show_bug.cgi?id=1697591 # see also https://gitlab.freedesktop.org/xorg/xserver/merge_requests/36 +# ofourdan> Disabling those for now, causing regressions (#1714981, #1723715) #Patch21: 0001-modesetting-Weaksauce-atomic-property-debugging.patch -Patch22: 0002-modesetting-Propagate-more-failure-in-drmmode_set_mo.patch -Patch23: 0003-modesetting-Factor-out-drmmode_target_output.patch -Patch24: 0004-modesetting-Use-atomic-instead-of-per-crtc-walks-whe.patch +#Patch22: 0002-modesetting-Propagate-more-failure-in-drmmode_set_mo.patch +#Patch23: 0003-modesetting-Factor-out-drmmode_target_output.patch +#Patch24: 0004-modesetting-Use-atomic-instead-of-per-crtc-walks-whe.patch # https://bugzilla.redhat.com/show_bug.cgi?id=1697804 Patch25: 0001-Xi-return-AlreadyGrabbed-for-key-grabs-255.patch +# From current server-1.20-branch: +# https://bugzilla.redhat.com/1708119 +Patch26: 0001-xwayland-Avoid-a-crash-on-pointer-enter-with-a-grab.patch +# https://bugzilla.redhat.com/1691745 +Patch27: 0001-xwayland-Check-status-in-GBM-pixmap-creation.patch +# https://bugzilla.redhat.com/1645553 +Patch28: 0001-glamor-Make-pixmap-exportable-from-gbm_bo_from_pixma.patch +Patch29: 0001-xwayland-Reset-scheduled-frames-after-hiding-tablet-.patch + BuildRequires: systemtap-sdt-devel BuildRequires: git BuildRequires: automake autoconf libtool pkgconfig @@ -528,6 +538,12 @@ find %{inst_srcdir}/hw/xfree86 -name \*.c -delete %changelog +* Fri Jun 28 2019 Olivier Fourdan 1.20.5-3 +- Remove atomic downstream patches causing regressions (#1714981, #1723715) +- Xwayland crashes (#1708119, #1691745) +- Cursor issue with tablet on Xwayland +- Xorg/modesetting issue with flipping pixmaps with Present (#1645553) + * Thu Jun 06 2019 Peter Hutterer 1.20.5-2 - Return AlreadyGrabbed for keycodes > 255 (#1697804)