diff --git a/0001-Xi-Use-current-device-active-grab-to-deliver-touch-e.patch b/0001-Xi-Use-current-device-active-grab-to-deliver-touch-e.patch new file mode 100644 index 0000000..3253151 --- /dev/null +++ b/0001-Xi-Use-current-device-active-grab-to-deliver-touch-e.patch @@ -0,0 +1,76 @@ +From 98e3db2ac43d4a3f13475cb160c8ce0155ac7d61 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= +Date: Fri, 26 Oct 2018 19:52:49 +0200 +Subject: [PATCH xserver 01/15] Xi: Use current device active grab to deliver + touch events if any + +When Retrieving touch delivery data we need to check if we have an active +grab on such device, and in that case use it to delivery events. +If we don't do this, when rejecting the touch events in DeactivatePointerGrab, +we will end-up in creating an implicit grab that will change the device +deviceGrab's state, causing a recursion during TouchEndTouch. + +Fixes #7 + +https://bugs.freedesktop.org/show_bug.cgi?id=96536 +(cherry picked from commit 35e5a76cc1d02801fadd49d12e60664b02e4bebc) +--- + Xi/exevents.c | 21 ++++++++------------- + 1 file changed, 8 insertions(+), 13 deletions(-) + +diff --git a/Xi/exevents.c b/Xi/exevents.c +index 17d751e31..659816a46 100644 +--- a/Xi/exevents.c ++++ b/Xi/exevents.c +@@ -1293,14 +1293,21 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti, + int rc; + InputClients *iclients = NULL; + *mask = NULL; ++ *grab = NULL; + + if (listener->type == LISTENER_GRAB || + listener->type == LISTENER_POINTER_GRAB) { +- + *grab = listener->grab; + + BUG_RETURN_VAL(!*grab, FALSE); ++ } ++ else if (ti->emulate_pointer && dev->deviceGrab.grab && ++ !dev->deviceGrab.fromPassiveGrab) { ++ /* There may be an active pointer grab on the device */ ++ *grab = dev->deviceGrab.grab; ++ } + ++ if (*grab) { + *client = rClient(*grab); + *win = (*grab)->window; + *mask = (*grab)->xi2mask; +@@ -1357,8 +1364,6 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti, + /* if owner selected, oclients is NULL */ + *client = oclients ? rClient(oclients) : wClient(*win); + } +- +- *grab = NULL; + } + + return TRUE; +@@ -1498,16 +1503,6 @@ DeliverEmulatedMotionEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, + &mask)) + return; + +- /* There may be a pointer grab on the device */ +- if (!grab) { +- grab = dev->deviceGrab.grab; +- if (grab) { +- win = grab->window; +- mask = grab->xi2mask; +- client = rClient(grab); +- } +- } +- + DeliverTouchEmulatedEvent(dev, ti, (InternalEvent*)&motion, &ti->listeners[0], client, + win, grab, mask); + } +-- +2.21.0 + diff --git a/0002-dri2-Sync-i965_pci_ids.h-from-mesa.patch b/0002-dri2-Sync-i965_pci_ids.h-from-mesa.patch new file mode 100644 index 0000000..c861390 --- /dev/null +++ b/0002-dri2-Sync-i965_pci_ids.h-from-mesa.patch @@ -0,0 +1,136 @@ +From 1804e7327113d128ac9a759da55fd3de0b9f8c35 Mon Sep 17 00:00:00 2001 +From: Matt Roper +Date: Wed, 26 Jun 2019 09:34:46 -0700 +Subject: [PATCH xserver 02/15] dri2: Sync i965_pci_ids.h from mesa + +Copied from Mesa with no modifications. + +This update brings in a significant number of new platform ID's. + +Syncs with mesa up to commit e334a595e ("intel/icl: Add new ICL +PCI-IDs"). + +Signed-off-by: Matt Roper +(cherry picked from commit a8d9ebeb43583e8d8ef182ac15adbdce256d4867) +--- + hw/xfree86/dri2/pci_ids/i965_pci_ids.h | 53 +++++++++++++++++++++----- + 1 file changed, 43 insertions(+), 10 deletions(-) + +diff --git a/hw/xfree86/dri2/pci_ids/i965_pci_ids.h b/hw/xfree86/dri2/pci_ids/i965_pci_ids.h +index 1ef1a0edf..646df447b 100644 +--- a/hw/xfree86/dri2/pci_ids/i965_pci_ids.h ++++ b/hw/xfree86/dri2/pci_ids/i965_pci_ids.h +@@ -1,3 +1,4 @@ ++#ifndef IRIS + CHIPSET(0x29A2, i965, "Intel(R) 965G") + CHIPSET(0x2992, i965, "Intel(R) 965Q") + CHIPSET(0x2982, i965, "Intel(R) 965G") +@@ -91,6 +92,11 @@ CHIPSET(0x0F32, byt, "Intel(R) Bay Trail") + CHIPSET(0x0F33, byt, "Intel(R) Bay Trail") + CHIPSET(0x0157, byt, "Intel(R) Bay Trail") + CHIPSET(0x0155, byt, "Intel(R) Bay Trail") ++CHIPSET(0x22B0, chv, "Intel(R) HD Graphics (Cherrytrail)") ++CHIPSET(0x22B1, chv, "Intel(R) HD Graphics XXX (Braswell)") /* Overridden in brw_get_renderer_string */ ++CHIPSET(0x22B2, chv, "Intel(R) HD Graphics (Cherryview)") ++CHIPSET(0x22B3, chv, "Intel(R) HD Graphics (Cherryview)") ++#endif + CHIPSET(0x1602, bdw_gt1, "Intel(R) Broadwell GT1") + CHIPSET(0x1606, bdw_gt1, "Intel(R) Broadwell GT1") + CHIPSET(0x160A, bdw_gt1, "Intel(R) Broadwell GT1") +@@ -109,10 +115,6 @@ CHIPSET(0x162A, bdw_gt3, "Intel(R) Iris Pro P6300 (Broadwell GT3e)") + CHIPSET(0x162B, bdw_gt3, "Intel(R) Iris 6100 (Broadwell GT3)") + CHIPSET(0x162D, bdw_gt3, "Intel(R) Broadwell GT3") + CHIPSET(0x162E, bdw_gt3, "Intel(R) Broadwell GT3") +-CHIPSET(0x22B0, chv, "Intel(R) HD Graphics (Cherrytrail)") +-CHIPSET(0x22B1, chv, "Intel(R) HD Graphics XXX (Braswell)") /* Overridden in brw_get_renderer_string */ +-CHIPSET(0x22B2, chv, "Intel(R) HD Graphics (Cherryview)") +-CHIPSET(0x22B3, chv, "Intel(R) HD Graphics (Cherryview)") + CHIPSET(0x1902, skl_gt1, "Intel(R) HD Graphics 510 (Skylake GT1)") + CHIPSET(0x1906, skl_gt1, "Intel(R) HD Graphics 510 (Skylake GT1)") + CHIPSET(0x190A, skl_gt1, "Intel(R) Skylake GT1") +@@ -156,7 +158,6 @@ CHIPSET(0x5912, kbl_gt2, "Intel(R) HD Graphics 630 (Kaby Lake GT2)") + CHIPSET(0x5916, kbl_gt2, "Intel(R) HD Graphics 620 (Kaby Lake GT2)") + CHIPSET(0x591A, kbl_gt2, "Intel(R) HD Graphics P630 (Kaby Lake GT2)") + CHIPSET(0x591B, kbl_gt2, "Intel(R) HD Graphics 630 (Kaby Lake GT2)") +-CHIPSET(0x591C, kbl_gt2, "Intel(R) Kaby Lake GT2") + CHIPSET(0x591D, kbl_gt2, "Intel(R) HD Graphics P630 (Kaby Lake GT2)") + CHIPSET(0x591E, kbl_gt2, "Intel(R) HD Graphics 615 (Kaby Lake GT2)") + CHIPSET(0x5921, kbl_gt2, "Intel(R) Kabylake GT2F") +@@ -164,13 +165,15 @@ CHIPSET(0x5923, kbl_gt3, "Intel(R) Kabylake GT3") + CHIPSET(0x5926, kbl_gt3, "Intel(R) Iris Plus Graphics 640 (Kaby Lake GT3e)") + CHIPSET(0x5927, kbl_gt3, "Intel(R) Iris Plus Graphics 650 (Kaby Lake GT3e)") + CHIPSET(0x593B, kbl_gt4, "Intel(R) Kabylake GT4") ++CHIPSET(0x591C, kbl_gt2, "Intel(R) Amber Lake (Kabylake) GT2") ++CHIPSET(0x87C0, kbl_gt2, "Intel(R) Amber Lake (Kabylake) GT2") ++CHIPSET(0x87CA, cfl_gt2, "Intel(R) Amber Lake (Coffeelake) GT2") + CHIPSET(0x3184, glk, "Intel(R) UHD Graphics 605 (Geminilake)") + CHIPSET(0x3185, glk_2x6, "Intel(R) UHD Graphics 600 (Geminilake 2x6)") + CHIPSET(0x3E90, cfl_gt1, "Intel(R) UHD Graphics 610 (Coffeelake 2x6 GT1)") + CHIPSET(0x3E93, cfl_gt1, "Intel(R) UHD Graphics 610 (Coffeelake 2x6 GT1)") + CHIPSET(0x3E99, cfl_gt1, "Intel(R) HD Graphics (Coffeelake 2x6 GT1)") +-CHIPSET(0x3EA1, cfl_gt1, "Intel(R) HD Graphics (Coffeelake 2x6 GT1)") +-CHIPSET(0x3EA4, cfl_gt1, "Intel(R) HD Graphics (Coffeelake 2x6 GT1)") ++CHIPSET(0x3E9C, cfl_gt1, "Intel(R) HD Graphics (Coffeelake 2x6 GT1)") + CHIPSET(0x3E91, cfl_gt2, "Intel(R) UHD Graphics 630 (Coffeelake 3x8 GT2)") + CHIPSET(0x3E92, cfl_gt2, "Intel(R) UHD Graphics 630 (Coffeelake 3x8 GT2)") + CHIPSET(0x3E96, cfl_gt2, "Intel(R) HD Graphics (Coffeelake 3x8 GT2)") +@@ -178,14 +181,34 @@ CHIPSET(0x3E98, cfl_gt2, "Intel(R) UHD Graphics 630 (Coffeelake 3x8 GT2)") + CHIPSET(0x3E9A, cfl_gt2, "Intel(R) HD Graphics (Coffeelake 3x8 GT2)") + CHIPSET(0x3E9B, cfl_gt2, "Intel(R) UHD Graphics 630 (Coffeelake 3x8 GT2)") + CHIPSET(0x3E94, cfl_gt2, "Intel(R) HD Graphics (Coffeelake 3x8 GT2)") +-CHIPSET(0x3EA0, cfl_gt2, "Intel(R) HD Graphics (Coffeelake 3x8 GT2)") +-CHIPSET(0x3EA3, cfl_gt2, "Intel(R) HD Graphics (Coffeelake 3x8 GT2)") + CHIPSET(0x3EA9, cfl_gt2, "Intel(R) HD Graphics (Coffeelake 3x8 GT2)") +-CHIPSET(0x3EA2, cfl_gt3, "Intel(R) HD Graphics (Coffeelake 3x8 GT3)") + CHIPSET(0x3EA5, cfl_gt3, "Intel(R) HD Graphics (Coffeelake 3x8 GT3)") + CHIPSET(0x3EA6, cfl_gt3, "Intel(R) HD Graphics (Coffeelake 3x8 GT3)") + CHIPSET(0x3EA7, cfl_gt3, "Intel(R) HD Graphics (Coffeelake 3x8 GT3)") + CHIPSET(0x3EA8, cfl_gt3, "Intel(R) HD Graphics (Coffeelake 3x8 GT3)") ++CHIPSET(0x3EA1, cfl_gt1, "Intel(R) HD Graphics (Whiskey Lake 2x6 GT1)") ++CHIPSET(0x3EA4, cfl_gt1, "Intel(R) HD Graphics (Whiskey Lake 3x8 GT1)") ++CHIPSET(0x3EA0, cfl_gt2, "Intel(R) HD Graphics (Whiskey Lake 3x8 GT2)") ++CHIPSET(0x3EA3, cfl_gt2, "Intel(R) HD Graphics (Whiskey Lake 3x8 GT2)") ++CHIPSET(0x3EA2, cfl_gt3, "Intel(R) HD Graphics (Whiskey Lake 3x8 GT3)") ++CHIPSET(0x9B21, cfl_gt1, "Intel(R) HD Graphics (Comet Lake 2x6 GT1)") ++CHIPSET(0x9BA0, cfl_gt1, "Intel(R) HD Graphics (Comet Lake 2x6 GT1)") ++CHIPSET(0x9BA2, cfl_gt1, "Intel(R) HD Graphics (Comet Lake 2x6 GT1)") ++CHIPSET(0x9BA4, cfl_gt1, "Intel(R) HD Graphics (Comet Lake 2x6 GT1)") ++CHIPSET(0x9BA5, cfl_gt1, "Intel(R) HD Graphics (Comet Lake 2x6 GT1)") ++CHIPSET(0x9BA8, cfl_gt1, "Intel(R) HD Graphics (Comet Lake 2x6 GT1)") ++CHIPSET(0x9BAA, cfl_gt1, "Intel(R) HD Graphics (Comet Lake 2x6 GT1)") ++CHIPSET(0x9BAB, cfl_gt1, "Intel(R) HD Graphics (Comet Lake 2x6 GT1)") ++CHIPSET(0x9BAC, cfl_gt1, "Intel(R) HD Graphics (Comet Lake 2x6 GT1)") ++CHIPSET(0x9B41, cfl_gt2, "Intel(R) HD Graphics (Comet Lake 3x8 GT2)") ++CHIPSET(0x9BC0, cfl_gt2, "Intel(R) HD Graphics (Comet Lake 3x8 GT2)") ++CHIPSET(0x9BC2, cfl_gt2, "Intel(R) HD Graphics (Comet Lake 3x8 GT2)") ++CHIPSET(0x9BC4, cfl_gt2, "Intel(R) HD Graphics (Comet Lake 3x8 GT2)") ++CHIPSET(0x9BC5, cfl_gt2, "Intel(R) HD Graphics (Comet Lake 3x8 GT2)") ++CHIPSET(0x9BC8, cfl_gt2, "Intel(R) HD Graphics (Comet Lake 3x8 GT2)") ++CHIPSET(0x9BCA, cfl_gt2, "Intel(R) HD Graphics (Comet Lake 3x8 GT2)") ++CHIPSET(0x9BCB, cfl_gt2, "Intel(R) HD Graphics (Comet Lake 3x8 GT2)") ++CHIPSET(0x9BCC, cfl_gt2, "Intel(R) HD Graphics (Comet Lake 3x8 GT2)") + CHIPSET(0x5A49, cnl_2x8, "Intel(R) HD Graphics (Cannonlake 2x8 GT0.5)") + CHIPSET(0x5A4A, cnl_2x8, "Intel(R) HD Graphics (Cannonlake 2x8 GT0.5)") + CHIPSET(0x5A41, cnl_3x8, "Intel(R) HD Graphics (Cannonlake 3x8 GT1)") +@@ -201,8 +224,18 @@ CHIPSET(0x5A54, cnl_5x8, "Intel(R) HD Graphics (Cannonlake 5x8 GT2)") + CHIPSET(0x8A50, icl_8x8, "Intel(R) HD Graphics (Ice Lake 8x8 GT2)") + CHIPSET(0x8A51, icl_8x8, "Intel(R) HD Graphics (Ice Lake 8x8 GT2)") + CHIPSET(0x8A52, icl_8x8, "Intel(R) HD Graphics (Ice Lake 8x8 GT2)") ++CHIPSET(0x8A53, icl_8x8, "Intel(R) HD Graphics (Ice Lake 8x8 GT2)") ++CHIPSET(0x8A54, icl_6x8, "Intel(R) HD Graphics (Ice Lake 6x8 GT1.5)") ++CHIPSET(0x8A56, icl_4x8, "Intel(R) HD Graphics (Ice Lake 4x8 GT1)") ++CHIPSET(0x8A57, icl_6x8, "Intel(R) HD Graphics (Ice Lake 6x8 GT1.5)") ++CHIPSET(0x8A58, icl_4x8, "Intel(R) HD Graphics (Ice Lake 4x8 GT1)") ++CHIPSET(0x8A59, icl_6x8, "Intel(R) HD Graphics (Ice Lake 6x8 GT1.5)") + CHIPSET(0x8A5A, icl_6x8, "Intel(R) HD Graphics (Ice Lake 6x8 GT1.5)") + CHIPSET(0x8A5B, icl_4x8, "Intel(R) HD Graphics (Ice Lake 4x8 GT1)") + CHIPSET(0x8A5C, icl_6x8, "Intel(R) HD Graphics (Ice Lake 6x8 GT1.5)") + CHIPSET(0x8A5D, icl_4x8, "Intel(R) HD Graphics (Ice Lake 4x8 GT1)") + CHIPSET(0x8A71, icl_1x8, "Intel(R) HD Graphics (Ice Lake 1x8 GT0.5)") ++CHIPSET(0x4500, ehl_4x8, "Intel(R) HD Graphics (Elkhart Lake 4x8)") ++CHIPSET(0x4571, ehl_4x8, "Intel(R) HD Graphics (Elkhart Lake 4x8)") ++CHIPSET(0x4551, ehl_4x4, "Intel(R) HD Graphics (Elkhart Lake 4x4)") ++CHIPSET(0x4541, ehl_2x4, "Intel(R) HD Graphics (Elkhart Lake 2x4)") +-- +2.21.0 + diff --git a/0003-xwayland-Update-screen-pixmap-on-output-resize.patch b/0003-xwayland-Update-screen-pixmap-on-output-resize.patch new file mode 100644 index 0000000..7aac779 --- /dev/null +++ b/0003-xwayland-Update-screen-pixmap-on-output-resize.patch @@ -0,0 +1,80 @@ +From 44c693f45d6abd6f7f3bd2f756d35811db143af7 Mon Sep 17 00:00:00 2001 +From: Olivier Fourdan +Date: Fri, 28 Jun 2019 16:55:11 +0200 +Subject: [PATCH xserver 03/15] xwayland: Update screen pixmap on output resize +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Running Xwayland non-rootless and resizing the output would lead to a +crash while trying to update the larger areas of the root window. + +Make sure we resize the backing pixmap according to the new output size +to avoid the crash. + +Signed-off-by: Olivier Fourdan +Closes: https://gitlab.freedesktop.org/xorg/xserver/issues/834 +Reviewed-by: Michel Dänzer +(cherry picked from commit ce9455b5ee389b100a9b7da76b79690d97211b7a) +--- + hw/xwayland/xwayland-output.c | 37 +++++++++++++++++++++++++++++++++++ + 1 file changed, 37 insertions(+) + +diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c +index cc68f0340..9d33ed862 100644 +--- a/hw/xwayland/xwayland-output.c ++++ b/hw/xwayland/xwayland-output.c +@@ -171,6 +171,40 @@ approximate_mmpd(struct xwl_screen *xwl_screen) + return 25.4 / DEFAULT_DPI; + } + ++static int ++xwl_set_pixmap_visit_window(WindowPtr window, void *data) ++{ ++ ScreenPtr screen = window->drawable.pScreen; ++ ++ if (screen->GetWindowPixmap(window) == data) { ++ screen->SetWindowPixmap(window, screen->GetScreenPixmap(screen)); ++ return WT_WALKCHILDREN; ++ } ++ ++ return WT_DONTWALKCHILDREN; ++} ++ ++static void ++update_backing_pixmaps(struct xwl_screen *xwl_screen, int width, int height) ++{ ++ ScreenPtr pScreen = xwl_screen->screen; ++ WindowPtr pRoot = pScreen->root; ++ PixmapPtr old_pixmap, new_pixmap; ++ ++ old_pixmap = pScreen->GetScreenPixmap(pScreen); ++ new_pixmap = pScreen->CreatePixmap(pScreen, width, height, ++ pScreen->rootDepth, ++ CREATE_PIXMAP_USAGE_BACKING_PIXMAP); ++ pScreen->SetScreenPixmap(new_pixmap); ++ ++ if (old_pixmap) { ++ TraverseTree(pRoot, xwl_set_pixmap_visit_window, old_pixmap); ++ pScreen->DestroyPixmap(old_pixmap); ++ } ++ ++ pScreen->ResizeWindow(pRoot, 0, 0, width, height, NULL); ++} ++ + static void + update_screen_size(struct xwl_output *xwl_output, int width, int height) + { +@@ -180,6 +214,9 @@ update_screen_size(struct xwl_output *xwl_output, int width, int height) + if (xwl_screen->root_clip_mode == ROOT_CLIP_FULL) + SetRootClip(xwl_screen->screen, ROOT_CLIP_NONE); + ++ if (!xwl_screen->rootless && xwl_screen->screen->root) ++ update_backing_pixmaps (xwl_screen, width, height); ++ + xwl_screen->width = width; + xwl_screen->height = height; + xwl_screen->screen->width = width; +-- +2.21.0 + diff --git a/0004-xwayland-Expand-the-RANDR-screen-size-limits.patch b/0004-xwayland-Expand-the-RANDR-screen-size-limits.patch new file mode 100644 index 0000000..066eb45 --- /dev/null +++ b/0004-xwayland-Expand-the-RANDR-screen-size-limits.patch @@ -0,0 +1,36 @@ +From df7ee10d9812897b297c67fde29f0b134ffba3ec Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Mon, 15 Jul 2019 11:38:44 -0400 +Subject: [PATCH xserver 04/15] xwayland: Expand the RANDR screen size limits +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +There's not really a good way to query this from the wayland server, so +just set the maximum to the X11 protocol limits. While we're at it, +lower the minimum screen size to something implausibly small too, just +in case. + +Fixes: xorg/xserver#850 +Reviewed-by: Michel Dänzer +(cherry picked from commit d0850241c6218f61127c45c2f95d6e791c3fea44) +--- + hw/xwayland/xwayland-output.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c +index 9d33ed862..aa6f37864 100644 +--- a/hw/xwayland/xwayland-output.c ++++ b/hw/xwayland/xwayland-output.c +@@ -476,7 +476,7 @@ xwl_screen_init_output(struct xwl_screen *xwl_screen) + if (!RRScreenInit(xwl_screen->screen)) + return FALSE; + +- RRScreenSetSizeRange(xwl_screen->screen, 320, 200, 8192, 8192); ++ RRScreenSetSizeRange(xwl_screen->screen, 16, 16, 32767, 32767); + + rp = rrGetScrPriv(xwl_screen->screen); + rp->rrGetInfo = xwl_randr_get_info; +-- +2.21.0 + diff --git a/0005-xwayland-Do-not-free-a-NULL-GBM-bo.patch b/0005-xwayland-Do-not-free-a-NULL-GBM-bo.patch new file mode 100644 index 0000000..fd50a63 --- /dev/null +++ b/0005-xwayland-Do-not-free-a-NULL-GBM-bo.patch @@ -0,0 +1,56 @@ +From dfd51be3ca2a244bbca27a95310b60e0c14940df Mon Sep 17 00:00:00 2001 +From: Olivier Fourdan +Date: Tue, 23 Jul 2019 11:01:47 +0200 +Subject: [PATCH xserver 05/15] xwayland: Do not free a NULL GBM bo +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Both `gbm_bo_create()` and `gbm_bo_create_with_modifiers()` can fail and +return `NULL`. + +If that occurs, `xwl_glamor_gbm_create_pixmap()` will not create a +pixmap for the (NULL) GBM bo, but would still try to free the bo which +leads to a crash in mesa: + + [...] + #7 + #8 in gbm_bo_destroy (bo=0x0) at ../src/gbm/main/gbm.c:439 + #9 in xwl_glamor_gbm_create_pixmap () at xwayland-glamor-gbm.c:245 + #10 in ProcCreatePixmap () at dispatch.c:1440 + #11 in Dispatch () at dispatch.c:478 + #12 in dix_main () at main.c:276 + +To avoid the crash, only free the GBM bo if not `NULL`. + +Signed-off-by: Olivier Fourdan +Reviewed-by: Michel Dänzer +Bugzilla: https://bugzilla.redhat.com/1729925 +(cherry picked from commit d9ec525059dbe96fc893c73c0362be2a6dd73e85) +--- + hw/xwayland/xwayland-glamor-gbm.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c +index 80146ab6e..291e060cf 100644 +--- a/hw/xwayland/xwayland-glamor-gbm.c ++++ b/hw/xwayland/xwayland-glamor-gbm.c +@@ -238,11 +238,12 @@ xwl_glamor_gbm_create_pixmap(ScreenPtr screen, + GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); + } + +- if (bo) ++ if (bo) { + pixmap = xwl_glamor_gbm_create_pixmap_for_bo(screen, bo, depth); + +- if (!pixmap) +- gbm_bo_destroy(bo); ++ if (!pixmap) ++ gbm_bo_destroy(bo); ++ } + } + + if (!pixmap) +-- +2.21.0 + diff --git a/0006-xsync-Add-resource-inside-of-SyncCreate-export-SyncC.patch b/0006-xsync-Add-resource-inside-of-SyncCreate-export-SyncC.patch new file mode 100644 index 0000000..0e21998 --- /dev/null +++ b/0006-xsync-Add-resource-inside-of-SyncCreate-export-SyncC.patch @@ -0,0 +1,244 @@ +From 82f01ad7869e3f2be51e41a8246dab5982bbc36a Mon Sep 17 00:00:00 2001 +From: Alex Goins +Date: Wed, 10 Apr 2019 13:48:02 -0500 +Subject: [PATCH xserver 06/15] xsync: Add resource inside of SyncCreate, + export SyncCreate + +As shown by DRI3 adding the SyncCreateFenceFromFD() function, extensions may +want to create a fence, then initialize it in their own way. This currently +can't be done without adding a function directly to Xext/sync.c due to the fact +that the RTFence resource type is private and there is no external interface to +add to it. + +To facilitate other X extensions creating fences and initializing them, this +change exports SyncCreate() and adds the resource directly within it. Callers no +longer need to call AddResource() after SyncCreate(), they only need to +initialize the SyncObject. + +To prevent FreeFence() and FreeCounter() from segfaulting if the call to +AddResource() fails before the sync object is initialized, this adds a new +'initialized' parameter to SyncObject that, when FALSE, causes FreeFence() and +FreeCounter() to skip de-initialization and simply free the object. +Initialization after adding the resource shouldn't otherwise be a problem due to +the single-threaded nature of X. + +Signed-off-by: Alex Goins +Reviewed-by: James Jones +Signed-off-by: Aaron Plattner +(cherry picked from commit 7f962c70b6d9c346477f23f6c15211e749110078) +--- + Xext/sync.c | 50 +++++++++++++++++++++++------------------- + Xext/syncsdk.h | 3 +++ + miext/sync/misync.c | 27 +++++++++++++---------- + miext/sync/misync.h | 1 + + miext/sync/misyncstr.h | 5 +++-- + 5 files changed, 51 insertions(+), 35 deletions(-) + +diff --git a/Xext/sync.c b/Xext/sync.c +index 8f22a865b..fd2ceb042 100644 +--- a/Xext/sync.c ++++ b/Xext/sync.c +@@ -881,18 +881,21 @@ SyncChangeAlarmAttributes(ClientPtr client, SyncAlarm * pAlarm, Mask mask, + return Success; + } + +-static SyncObject * ++SyncObject * + SyncCreate(ClientPtr client, XID id, unsigned char type) + { + SyncObject *pSync; ++ RESTYPE resType; + + switch (type) { + case SYNC_COUNTER: + pSync = malloc(sizeof(SyncCounter)); ++ resType = RTCounter; + break; + case SYNC_FENCE: + pSync = (SyncObject *) dixAllocateObjectWithPrivates(SyncFence, + PRIVATE_SYNC_FENCE); ++ resType = RTFence; + break; + default: + return NULL; +@@ -901,6 +904,11 @@ SyncCreate(ClientPtr client, XID id, unsigned char type) + if (!pSync) + return NULL; + ++ pSync->initialized = FALSE; ++ ++ if (!AddResource(id, resType, (void *) pSync)) ++ return NULL; ++ + pSync->client = client; + pSync->id = id; + pSync->pTriglist = NULL; +@@ -923,13 +931,10 @@ SyncCreateFenceFromFD(ClientPtr client, DrawablePtr pDraw, XID id, int fd, BOOL + + status = miSyncInitFenceFromFD(pDraw, pFence, fd, initially_triggered); + if (status != Success) { +- dixFreeObjectWithPrivates(pFence, PRIVATE_SYNC_FENCE); ++ FreeResource(pFence->sync.id, RT_NONE); + return status; + } + +- if (!AddResource(id, RTFence, (void *) pFence)) +- return BadAlloc; +- + return Success; + #else + return BadImplementation; +@@ -957,8 +962,7 @@ SyncCreateCounter(ClientPtr client, XSyncCounter id, int64_t initialvalue) + pCounter->value = initialvalue; + pCounter->pSysCounterInfo = NULL; + +- if (!AddResource(id, RTCounter, (void *) pCounter)) +- return NULL; ++ pCounter->sync.initialized = TRUE; + + return pCounter; + } +@@ -1137,21 +1141,26 @@ static int + FreeCounter(void *env, XID id) + { + SyncCounter *pCounter = (SyncCounter *) env; +- SyncTriggerList *ptl, *pnext; + + pCounter->sync.beingDestroyed = TRUE; +- /* tell all the counter's triggers that the counter has been destroyed */ +- for (ptl = pCounter->sync.pTriglist; ptl; ptl = pnext) { +- (*ptl->pTrigger->CounterDestroyed) (ptl->pTrigger); +- pnext = ptl->next; +- free(ptl); /* destroy the trigger list as we go */ +- } +- if (IsSystemCounter(pCounter)) { +- xorg_list_del(&pCounter->pSysCounterInfo->entry); +- free(pCounter->pSysCounterInfo->name); +- free(pCounter->pSysCounterInfo->private); +- free(pCounter->pSysCounterInfo); ++ ++ if (pCounter->sync.initialized) { ++ SyncTriggerList *ptl, *pnext; ++ ++ /* tell all the counter's triggers that counter has been destroyed */ ++ for (ptl = pCounter->sync.pTriglist; ptl; ptl = pnext) { ++ (*ptl->pTrigger->CounterDestroyed) (ptl->pTrigger); ++ pnext = ptl->next; ++ free(ptl); /* destroy the trigger list as we go */ ++ } ++ if (IsSystemCounter(pCounter)) { ++ xorg_list_del(&pCounter->pSysCounterInfo->entry); ++ free(pCounter->pSysCounterInfo->name); ++ free(pCounter->pSysCounterInfo->private); ++ free(pCounter->pSysCounterInfo); ++ } + } ++ + free(pCounter); + return Success; + } +@@ -1889,9 +1898,6 @@ ProcSyncCreateFence(ClientPtr client) + + miSyncInitFence(pDraw->pScreen, pFence, stuff->initially_triggered); + +- if (!AddResource(stuff->fid, RTFence, (void *) pFence)) +- return BadAlloc; +- + return Success; + } + +diff --git a/Xext/syncsdk.h b/Xext/syncsdk.h +index f1b99d010..c88285cb1 100644 +--- a/Xext/syncsdk.h ++++ b/Xext/syncsdk.h +@@ -29,6 +29,9 @@ + extern _X_EXPORT int + SyncVerifyFence(SyncFence ** ppFence, XID fid, ClientPtr client, Mask mode); + ++extern _X_EXPORT SyncObject* ++ SyncCreate(ClientPtr client, XID id, unsigned char type); ++ + #define VERIFY_SYNC_FENCE(pFence, fid, client, mode) \ + do { \ + int rc; \ +diff --git a/miext/sync/misync.c b/miext/sync/misync.c +index 490fa0b17..0931803f6 100644 +--- a/miext/sync/misync.c ++++ b/miext/sync/misync.c +@@ -101,24 +101,29 @@ miSyncInitFence(ScreenPtr pScreen, SyncFence * pFence, Bool initially_triggered) + pFence->funcs = miSyncFenceFuncs; + + pScreenPriv->funcs.CreateFence(pScreen, pFence, initially_triggered); ++ ++ pFence->sync.initialized = TRUE; + } + + void + miSyncDestroyFence(SyncFence * pFence) + { +- ScreenPtr pScreen = pFence->pScreen; +- SyncScreenPrivPtr pScreenPriv = SYNC_SCREEN_PRIV(pScreen); +- SyncTriggerList *ptl, *pNext; +- + pFence->sync.beingDestroyed = TRUE; +- /* tell all the fence's triggers that the counter has been destroyed */ +- for (ptl = pFence->sync.pTriglist; ptl; ptl = pNext) { +- (*ptl->pTrigger->CounterDestroyed) (ptl->pTrigger); +- pNext = ptl->next; +- free(ptl); /* destroy the trigger list as we go */ +- } + +- pScreenPriv->funcs.DestroyFence(pScreen, pFence); ++ if (pFence->sync.initialized) { ++ ScreenPtr pScreen = pFence->pScreen; ++ SyncScreenPrivPtr pScreenPriv = SYNC_SCREEN_PRIV(pScreen); ++ SyncTriggerList *ptl, *pNext; ++ ++ /* tell all the fence's triggers that the counter has been destroyed */ ++ for (ptl = pFence->sync.pTriglist; ptl; ptl = pNext) { ++ (*ptl->pTrigger->CounterDestroyed) (ptl->pTrigger); ++ pNext = ptl->next; ++ free(ptl); /* destroy the trigger list as we go */ ++ } ++ ++ pScreenPriv->funcs.DestroyFence(pScreen, pFence); ++ } + + dixFreeObjectWithPrivates(pFence, PRIVATE_SYNC_FENCE); + } +diff --git a/miext/sync/misync.h b/miext/sync/misync.h +index dc78c5fdb..f7082d5ea 100644 +--- a/miext/sync/misync.h ++++ b/miext/sync/misync.h +@@ -28,6 +28,7 @@ + #ifndef _MISYNC_H_ + #define _MISYNC_H_ + ++typedef struct _SyncObject SyncObject; + typedef struct _SyncFence SyncFence; + typedef struct _SyncTrigger SyncTrigger; + +diff --git a/miext/sync/misyncstr.h b/miext/sync/misyncstr.h +index 2eab2aa57..2a6e84a96 100644 +--- a/miext/sync/misyncstr.h ++++ b/miext/sync/misyncstr.h +@@ -38,13 +38,14 @@ + #define SYNC_COUNTER 0 + #define SYNC_FENCE 1 + +-typedef struct _SyncObject { ++struct _SyncObject { + ClientPtr client; /* Owning client. 0 for system counters */ + struct _SyncTriggerList *pTriglist; /* list of triggers */ + XID id; /* resource ID */ + unsigned char type; /* SYNC_* */ ++ Bool initialized; /* FALSE if created but not initialized */ + Bool beingDestroyed; /* in process of going away */ +-} SyncObject; ++}; + + typedef struct _SyncCounter { + SyncObject sync; /* Common sync object data */ +-- +2.21.0 + diff --git a/0007-GLX-Add-a-per-client-vendor-mapping.patch b/0007-GLX-Add-a-per-client-vendor-mapping.patch new file mode 100644 index 0000000..47bf2f1 --- /dev/null +++ b/0007-GLX-Add-a-per-client-vendor-mapping.patch @@ -0,0 +1,92 @@ +From 1fdb7cbce538f0b37304a3cfc9fae4ff2fe9ece9 Mon Sep 17 00:00:00 2001 +From: Kyle Brenneman +Date: Thu, 19 Oct 2017 15:14:51 -0600 +Subject: [PATCH xserver 07/15] GLX: Add a per-client vendor mapping. + +Each client now has its own (screen, vendor) mapping. + +Currently, it's just a copy of the global mapping, but later changes will allow +it to change. + +Signed-off-by: Aaron Plattner +Reviewed-by: Aaron Plattner +Reviewed-by: Adam Jackson +(cherry picked from commit 37a36a6b5b887d5c5a17a6931ceba8ad5d1bb6d5) +--- + glx/vndext.c | 11 ++++++++++- + glx/vndserver.h | 5 +++++ + glx/vndservermapping.c | 19 +++++++++++++++---- + 3 files changed, 30 insertions(+), 5 deletions(-) + +diff --git a/glx/vndext.c b/glx/vndext.c +index d7936467b..20c0648cc 100644 +--- a/glx/vndext.c ++++ b/glx/vndext.c +@@ -139,8 +139,17 @@ GlxGetClientData(ClientPtr client) + { + GlxClientPriv *cl = xglvGetClientPrivate(client); + if (cl == NULL) { +- cl = calloc(1, sizeof(GlxClientPriv)); ++ cl = calloc(1, sizeof(GlxClientPriv) ++ + screenInfo.numScreens * sizeof(GlxServerVendor *)); + if (cl != NULL) { ++ int i; ++ ++ cl->vendors = (GlxServerVendor **) (cl + 1); ++ for (i=0; ivendors[i] = GlxGetVendorForScreen(NULL, screenInfo.screens[i]); ++ } ++ + xglvSetClientPrivate(client, cl); + } + } +diff --git a/glx/vndserver.h b/glx/vndserver.h +index a175656ae..78246d212 100644 +--- a/glx/vndserver.h ++++ b/glx/vndserver.h +@@ -57,6 +57,11 @@ typedef struct GlxContextTagInfoRec { + typedef struct GlxClientPrivRec { + GlxContextTagInfo *contextTags; + unsigned int contextTagCount; ++ ++ /** ++ * The vendor handles for each screen. ++ */ ++ GlxServerVendor **vendors; + } GlxClientPriv; + + extern int GlxErrorBase; +diff --git a/glx/vndservermapping.c b/glx/vndservermapping.c +index fd3be92d9..778656bb6 100644 +--- a/glx/vndservermapping.c ++++ b/glx/vndservermapping.c +@@ -187,10 +187,21 @@ Bool GlxSetScreenVendor(ScreenPtr screen, GlxServerVendor *vendor) + + GlxServerVendor *GlxGetVendorForScreen(ClientPtr client, ScreenPtr screen) + { +- GlxScreenPriv *priv = GlxGetScreen(screen); +- if (priv != NULL) { +- return priv->vendor; ++ // Note that the client won't be sending GPU screen numbers, so we don't ++ // need per-client mappings for them. ++ if (client != NULL && !screen->isGPU) { ++ GlxClientPriv *cl = GlxGetClientData(client); ++ if (cl != NULL) { ++ return cl->vendors[screen->myNum]; ++ } else { ++ return NULL; ++ } + } else { +- return NULL; ++ GlxScreenPriv *priv = GlxGetScreen(screen); ++ if (priv != NULL) { ++ return priv->vendor; ++ } else { ++ return NULL; ++ } + } + } +-- +2.21.0 + diff --git a/0008-GLX-Use-the-sending-client-for-looking-up-XID-s.patch b/0008-GLX-Use-the-sending-client-for-looking-up-XID-s.patch new file mode 100644 index 0000000..5daa350 --- /dev/null +++ b/0008-GLX-Use-the-sending-client-for-looking-up-XID-s.patch @@ -0,0 +1,114 @@ +From abeae4a6d356653d50026707ecc2afceac83631e Mon Sep 17 00:00:00 2001 +From: Kyle Brenneman +Date: Wed, 8 May 2019 08:44:54 -0600 +Subject: [PATCH xserver 08/15] GLX: Use the sending client for looking up + XID's + +When GlxGetXIDMap looks up an unknown XID, it will now look up a vendor based +on the screen number for the XID and the client that sent the current request. + +In GlxGetXIDMap, if the XID is for a regular X window, then it won't be in the +(XID -> vendor) mapping, so we have to look up a vendor by screen number. + +With this change, GlxGetXIDMap will use the (screen -> vendor) map for +whichever client sent the current request, instead of using the global +(screen -> vendor) map. + +Since GlxGetXIDMap doesn't take a ClientPtr argument, GlxDispatchRequest will +store the client for the current request in a global variable. That way, the +ABI for GLXVND doesn't need to change. + +v2: Fix an error check in GlxDispatchRequest. + +Signed-off-by: Aaron Plattner +Reviewed-by: Aaron Plattner +Reviewed-by: Adam Jackson +(cherry picked from commit 8b67ec7cc6fda243480a5a8ca118b66242f3eb2c) +--- + glx/vndcmds.c | 13 +++++++++++-- + glx/vndserver.h | 7 +++++++ + glx/vndservermapping.c | 12 ++++++++---- + 3 files changed, 26 insertions(+), 6 deletions(-) + +diff --git a/glx/vndcmds.c b/glx/vndcmds.c +index f0779d14a..21c6fef9e 100644 +--- a/glx/vndcmds.c ++++ b/glx/vndcmds.c +@@ -468,15 +468,24 @@ void GlxDispatchReset(void) + int GlxDispatchRequest(ClientPtr client) + { + REQUEST(xReq); ++ int result; ++ + if (GlxExtensionEntry->base == 0) + return BadRequest; ++ ++ GlxSetRequestClient(client); ++ + if (stuff->data < OPCODE_ARRAY_LEN) { + if (dispatchFuncs[stuff->data] == NULL) { + // Try to find a dispatch stub. + dispatchFuncs[stuff->data] = GetVendorDispatchFunc(stuff->data, 0); + } +- return dispatchFuncs[stuff->data](client); ++ result = dispatchFuncs[stuff->data](client); + } else { +- return dispatch_GLXSingle(client); ++ result = dispatch_GLXSingle(client); + } ++ ++ GlxSetRequestClient(NULL); ++ ++ return result; + } +diff --git a/glx/vndserver.h b/glx/vndserver.h +index 78246d212..613fef0fe 100644 +--- a/glx/vndserver.h ++++ b/glx/vndserver.h +@@ -95,6 +95,13 @@ Bool GlxAddXIDMap(XID id, GlxServerVendor *vendor); + GlxServerVendor * GlxGetXIDMap(XID id); + void GlxRemoveXIDMap(XID id); + ++/** ++ * Records the client that sent the current request. This is needed in ++ * GlxGetXIDMap to know which client's (screen -> vendor) mapping to use for a ++ * regular X window. ++ */ ++void GlxSetRequestClient(ClientPtr client); ++ + GlxContextTagInfo *GlxAllocContextTag(ClientPtr client, GlxServerVendor *vendor); + GlxContextTagInfo *GlxLookupContextTag(ClientPtr client, GLXContextTag tag); + void GlxFreeContextTag(GlxContextTagInfo *tagInfo); +diff --git a/glx/vndservermapping.c b/glx/vndservermapping.c +index 778656bb6..4efab8b81 100644 +--- a/glx/vndservermapping.c ++++ b/glx/vndservermapping.c +@@ -33,6 +33,13 @@ + + #include "vndservervendor.h" + ++static ClientPtr requestClient = NULL; ++ ++void GlxSetRequestClient(ClientPtr client) ++{ ++ requestClient = client; ++} ++ + static GlxServerVendor *LookupXIDMapResource(XID id) + { + void *ptr = NULL; +@@ -59,10 +66,7 @@ GlxServerVendor *GlxGetXIDMap(XID id) + DixGetAttrAccess); + if (rv == Success && ptr != NULL) { + DrawablePtr draw = (DrawablePtr) ptr; +- GlxScreenPriv *screenPriv = GlxGetScreen(draw->pScreen); +- if (screenPriv != NULL) { +- vendor = screenPriv->vendor; +- } ++ vendor = GlxGetVendorForScreen(requestClient, draw->pScreen); + } + } + return vendor; +-- +2.21.0 + diff --git a/0009-GLX-Add-a-function-to-change-a-clients-vendor-list.patch b/0009-GLX-Add-a-function-to-change-a-clients-vendor-list.patch new file mode 100644 index 0000000..961ac10 --- /dev/null +++ b/0009-GLX-Add-a-function-to-change-a-clients-vendor-list.patch @@ -0,0 +1,114 @@ +From d3034ef2f5121d85ae766a73fda4e523399043a9 Mon Sep 17 00:00:00 2001 +From: Kyle Brenneman +Date: Thu, 2 May 2019 07:17:21 -0600 +Subject: [PATCH xserver 09/15] GLX: Add a function to change a clients vendor + list. + +Add a new function, GlxServerExports::setClientScreenVendor, which will change +the vendor that handles GLX requests for a screen, but only for requests from +a specific client. + +v2: Increment the GLXVND minor version number. +v3: Note the GLXVND version requirement for setClientScreenVendor. + +Signed-off-by: Aaron Plattner +Reviewed-by: Aaron Plattner +Reviewed-by: Adam Jackson +(cherry picked from commit 56c0a71fdd94a008e5d746261f70a713c4767f93) +--- + glx/vndext.c | 1 + + glx/vndserver.h | 1 + + glx/vndservermapping.c | 21 +++++++++++++++++++++ + include/glxvndabi.h | 13 ++++++++++++- + 4 files changed, 35 insertions(+), 1 deletion(-) + +diff --git a/glx/vndext.c b/glx/vndext.c +index 20c0648cc..582e60b6e 100644 +--- a/glx/vndext.c ++++ b/glx/vndext.c +@@ -324,6 +324,7 @@ _X_EXPORT const GlxServerExports glxServer = { + .getContextTagPrivate = GlxGetContextTagPrivate, + .getVendorForScreen = GlxGetVendorForScreen, + .forwardRequest = GlxForwardRequest, ++ .setClientScreenVendor = GlxSetClientScreenVendor, + }; + + const GlxServerExports * +diff --git a/glx/vndserver.h b/glx/vndserver.h +index 613fef0fe..772b458a1 100644 +--- a/glx/vndserver.h ++++ b/glx/vndserver.h +@@ -107,6 +107,7 @@ GlxContextTagInfo *GlxLookupContextTag(ClientPtr client, GLXContextTag tag); + void GlxFreeContextTag(GlxContextTagInfo *tagInfo); + + Bool GlxSetScreenVendor(ScreenPtr screen, GlxServerVendor *vendor); ++Bool GlxSetClientScreenVendor(ClientPtr client, ScreenPtr screen, GlxServerVendor *vendor); + GlxScreenPriv *GlxGetScreen(ScreenPtr pScreen); + GlxServerVendor *GlxGetVendorForScreen(ClientPtr client, ScreenPtr screen); + +diff --git a/glx/vndservermapping.c b/glx/vndservermapping.c +index 4efab8b81..04788ffbd 100644 +--- a/glx/vndservermapping.c ++++ b/glx/vndservermapping.c +@@ -189,6 +189,27 @@ Bool GlxSetScreenVendor(ScreenPtr screen, GlxServerVendor *vendor) + return TRUE; + } + ++Bool GlxSetClientScreenVendor(ClientPtr client, ScreenPtr screen, GlxServerVendor *vendor) ++{ ++ GlxClientPriv *cl; ++ ++ if (screen == NULL || screen->isGPU) { ++ return FALSE; ++ } ++ ++ cl = GlxGetClientData(client); ++ if (cl == NULL) { ++ return FALSE; ++ } ++ ++ if (vendor != NULL) { ++ cl->vendors[screen->myNum] = vendor; ++ } else { ++ cl->vendors[screen->myNum] = GlxGetVendorForScreen(NULL, screen); ++ } ++ return TRUE; ++} ++ + GlxServerVendor *GlxGetVendorForScreen(ClientPtr client, ScreenPtr screen) + { + // Note that the client won't be sending GPU screen numbers, so we don't +diff --git a/include/glxvndabi.h b/include/glxvndabi.h +index b78306d23..71f36e722 100644 +--- a/include/glxvndabi.h ++++ b/include/glxvndabi.h +@@ -75,7 +75,7 @@ + * will still work. + */ + #define GLXSERVER_VENDOR_ABI_MAJOR_VERSION 0 +-#define GLXSERVER_VENDOR_ABI_MINOR_VERSION 0 ++#define GLXSERVER_VENDOR_ABI_MINOR_VERSION 1 + + #if defined(__cplusplus) + extern "C" { +@@ -236,6 +236,17 @@ typedef struct GlxServerExportsRec { + * \param client The client. + */ + int (* forwardRequest) (GlxServerVendor *vendor, ClientPtr client); ++ ++ /** ++ * Sets the vendor library to use for a screen for a specific client. ++ * ++ * This function changes which vendor should handle GLX requests for a ++ * screen. Unlike \c setScreenVendor, this function can be called at any ++ * time, and only applies to requests from a single client. ++ * ++ * This function is available in GLXVND version 0.1 or later. ++ */ ++ Bool (* setClientScreenVendor) (ClientPtr client, ScreenPtr screen, GlxServerVendor *vendor); + } GlxServerExports; + + extern _X_EXPORT const GlxServerExports glxServer; +-- +2.21.0 + diff --git a/0010-GLX-Set-GlxServerExports-major-minor-Version.patch b/0010-GLX-Set-GlxServerExports-major-minor-Version.patch new file mode 100644 index 0000000..036950a --- /dev/null +++ b/0010-GLX-Set-GlxServerExports-major-minor-Version.patch @@ -0,0 +1,35 @@ +From 39b3005c329bc63676df72c43529d641bf305bcd Mon Sep 17 00:00:00 2001 +From: Aaron Plattner +Date: Tue, 21 May 2019 10:50:42 -0700 +Subject: [PATCH xserver 10/15] GLX: Set GlxServerExports::{major,minor}Version + +Commit 56c0a71fdd94a008e5d746261f70a713c4767f93 incremented the +GLXSERVER_VENDOR_ABI_MINOR_VERSION define, but this define was not actually +being used to set glxServer.minorVersion. + +Update the initializer for glxServer to use the correct version numbers. + +Signed-off-by: Aaron Plattner +(cherry picked from commit b4231d69028adc8123801a7552b40a15ea928d1b) +--- + glx/vndext.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/glx/vndext.c b/glx/vndext.c +index 582e60b6e..0513733b6 100644 +--- a/glx/vndext.c ++++ b/glx/vndext.c +@@ -304,8 +304,8 @@ GlxFreeServerImports(GlxServerImports *imports) + } + + _X_EXPORT const GlxServerExports glxServer = { +- .majorVersion = 0, +- .minorVersion = 0, ++ .majorVersion = GLXSERVER_VENDOR_ABI_MAJOR_VERSION, ++ .minorVersion = GLXSERVER_VENDOR_ABI_MINOR_VERSION, + + .extensionInitCallback = &vndInitCallbackListPtr, + +-- +2.21.0 + diff --git a/0011-miext-sync-Fix-needless-ABI-change.patch b/0011-miext-sync-Fix-needless-ABI-change.patch new file mode 100644 index 0000000..855dd6a --- /dev/null +++ b/0011-miext-sync-Fix-needless-ABI-change.patch @@ -0,0 +1,39 @@ +From 8449c8623d6208b77e76596e8b10250817d3e8ab Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Mon, 19 Aug 2019 14:27:54 -0400 +Subject: [PATCH xserver 11/15] miext/sync: Fix needless ABI change + +The initialized field was added in: + + commit 82f01ad7869e3f2be51e41a8246dab5982bbc36a + Author: Alex Goins + Date: Wed Apr 10 13:48:02 2019 -0500 + + xsync: Add resource inside of SyncCreate, export SyncCreate + +But it added this field not at the end of SyncObject. It may not have +been _usefully_ possible to create those from another extension prior to +that commit, but that's still an ABI-incompatible change. + +(cherry picked from commit 194ba38728b34a76885275dae153057c8afaf72e) +--- + miext/sync/misyncstr.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/miext/sync/misyncstr.h b/miext/sync/misyncstr.h +index 2a6e84a96..ea48a4519 100644 +--- a/miext/sync/misyncstr.h ++++ b/miext/sync/misyncstr.h +@@ -43,8 +43,8 @@ struct _SyncObject { + struct _SyncTriggerList *pTriglist; /* list of triggers */ + XID id; /* resource ID */ + unsigned char type; /* SYNC_* */ +- Bool initialized; /* FALSE if created but not initialized */ + Bool beingDestroyed; /* in process of going away */ ++ Bool initialized; /* FALSE if created but not initialized */ + }; + + typedef struct _SyncCounter { +-- +2.21.0 + diff --git a/0012-glx-Fix-previous-context-validation-in-xorgGlxMakeCu.patch b/0012-glx-Fix-previous-context-validation-in-xorgGlxMakeCu.patch new file mode 100644 index 0000000..08eae5f --- /dev/null +++ b/0012-glx-Fix-previous-context-validation-in-xorgGlxMakeCu.patch @@ -0,0 +1,40 @@ +From 045add84927051a33569ed701097e1fd514bf0ca Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Fri, 16 Aug 2019 14:56:19 -0400 +Subject: [PATCH xserver 12/15] glx: Fix previous context validation in + xorgGlxMakeCurrent + +vnd has already verified that the context tag is valid before this gets +called, and we only set the context tag private data to non-null for +indirect clients. Mesa happens to be buggy and doesn't send MakeCurrent +requests nearly as much as it should for direct contexts, but if you fix +that, then unbinding a direct context would fail here with +GLXBadContextTag. + +Sadly Mesa will still need to carry a workaround here for broken +servers, but we should still fix the server. + +(cherry picked from commit 95dcc81cb122e5a4c5b38e84ef46eb872b2e1431) +--- + glx/glxcmds.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/glx/glxcmds.c b/glx/glxcmds.c +index 54d452e58..75e42823c 100644 +--- a/glx/glxcmds.c ++++ b/glx/glxcmds.c +@@ -574,10 +574,8 @@ xorgGlxMakeCurrent(ClientPtr client, GLXContextTag tag, XID drawId, XID readId, + /* Look up old context. If we have one, it must be in a usable state. */ + if (tag != 0) { + prevglxc = glxServer.getContextTagPrivate(client, tag); +- if (!prevglxc) +- return __glXError(GLXBadContextTag); + +- if (prevglxc->renderMode != GL_RENDER) { ++ if (prevglxc && prevglxc->renderMode != GL_RENDER) { + /* Oops. Not in render mode render. */ + client->errorValue = prevglxc->id; + return __glXError(GLXBadContextState); +-- +2.21.0 + diff --git a/0013-xwayland-Separate-DamagePtr-into-separate-window-dat.patch b/0013-xwayland-Separate-DamagePtr-into-separate-window-dat.patch new file mode 100644 index 0000000..bc1e76d --- /dev/null +++ b/0013-xwayland-Separate-DamagePtr-into-separate-window-dat.patch @@ -0,0 +1,173 @@ +From e0af09061f9e8397ca564ec3bbedea51974455d4 Mon Sep 17 00:00:00 2001 +From: Carlos Garnacho +Date: Mon, 7 Jan 2019 15:20:05 +0100 +Subject: [PATCH xserver 13/15] xwayland: Separate DamagePtr into separate + window data + +This will be dissociated in future commits to handle the cases +where windows are being realized before there is a compositor +handling redirection. + +In that case, we still want the DamagePtr to be registered upfront +on RealizeWindowProc before a corresponding xwl_window might be +created. Most notably, it cannot be lazily created on +SetWindowPixmapProc as damage accounting gets broken. + +Signed-off-by: Carlos Garnacho +(cherry picked from commit 4e50440ae20c537d6a4edf356cda67dd33d4e5a8) +--- + hw/xwayland/xwayland.c | 74 +++++++++++++++++++++++++++++++++--------- + hw/xwayland/xwayland.h | 1 - + 2 files changed, 58 insertions(+), 17 deletions(-) + +diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c +index 7e6e0ab25..1efebd061 100644 +--- a/hw/xwayland/xwayland.c ++++ b/hw/xwayland/xwayland.c +@@ -125,6 +125,7 @@ ddxProcessArgument(int argc, char *argv[], int i) + static DevPrivateKeyRec xwl_window_private_key; + static DevPrivateKeyRec xwl_screen_private_key; + static DevPrivateKeyRec xwl_pixmap_private_key; ++static DevPrivateKeyRec xwl_damage_private_key; + + static struct xwl_window * + xwl_window_get(WindowPtr window) +@@ -367,8 +368,14 @@ xwl_cursor_confined_to(DeviceIntPtr device, + static void + damage_report(DamagePtr pDamage, RegionPtr pRegion, void *data) + { +- struct xwl_window *xwl_window = data; +- struct xwl_screen *xwl_screen = xwl_window->xwl_screen; ++ WindowPtr window = data; ++ struct xwl_window *xwl_window = xwl_window_get(window); ++ struct xwl_screen *xwl_screen; ++ ++ if (!xwl_window) ++ return; ++ ++ xwl_screen = xwl_window->xwl_screen; + + #ifdef GLAMOR_HAS_GBM + if (xwl_window->present_flipped) { +@@ -390,6 +397,47 @@ damage_destroy(DamagePtr pDamage, void *data) + { + } + ++static Bool ++register_damage(WindowPtr window) ++{ ++ DamagePtr damage; ++ ++ damage = DamageCreate(damage_report, damage_destroy, DamageReportNonEmpty, ++ FALSE, window->drawable.pScreen, window); ++ if (damage == NULL) { ++ ErrorF("Failed creating damage\n"); ++ return FALSE; ++ } ++ ++ DamageRegister(&window->drawable, damage); ++ DamageSetReportAfterOp(damage, TRUE); ++ ++ dixSetPrivate(&window->devPrivates, &xwl_damage_private_key, damage); ++ ++ return TRUE; ++} ++ ++static void ++unregister_damage(WindowPtr window) ++{ ++ DamagePtr damage; ++ ++ damage = dixLookupPrivate(&window->devPrivates, &xwl_damage_private_key); ++ if (!damage) ++ return; ++ ++ DamageUnregister(damage); ++ DamageDestroy(damage); ++ ++ dixSetPrivate(&window->devPrivates, &xwl_damage_private_key, NULL); ++} ++ ++static DamagePtr ++window_get_damage(WindowPtr window) ++{ ++ return dixLookupPrivate(&window->devPrivates, &xwl_damage_private_key); ++} ++ + static void + shell_surface_ping(void *data, + struct wl_shell_surface *shell_surface, uint32_t serial) +@@ -545,18 +593,10 @@ xwl_realize_window(WindowPtr window) + + wl_surface_set_user_data(xwl_window->surface, xwl_window); + +- xwl_window->damage = +- DamageCreate(damage_report, damage_destroy, DamageReportNonEmpty, +- FALSE, screen, xwl_window); +- if (xwl_window->damage == NULL) { +- ErrorF("Failed creating damage\n"); +- goto err_surf; +- } +- + compRedirectWindow(serverClient, window, CompositeRedirectManual); + +- DamageRegister(&window->drawable, xwl_window->damage); +- DamageSetReportAfterOp(xwl_window->damage, TRUE); ++ if (!register_damage(window)) ++ goto err_surf; + + dixSetPrivate(&window->devPrivates, &xwl_window_private_key, xwl_window); + xorg_list_init(&xwl_window->link_damage); +@@ -620,8 +660,8 @@ xwl_unrealize_window(WindowPtr window) + + wl_surface_destroy(xwl_window->surface); + xorg_list_del(&xwl_window->link_damage); +- DamageUnregister(xwl_window->damage); +- DamageDestroy(xwl_window->damage); ++ unregister_damage(window); ++ + if (xwl_window->frame_callback) + wl_callback_destroy(xwl_window->frame_callback); + +@@ -689,7 +729,7 @@ xwl_window_post_damage(struct xwl_window *xwl_window) + + assert(!xwl_window->frame_callback); + +- region = DamageRegion(xwl_window->damage); ++ region = DamageRegion(window_get_damage(xwl_window->window)); + pixmap = (*xwl_screen->screen->GetWindowPixmap) (xwl_window->window); + + #ifdef XWL_HAS_GLAMOR +@@ -726,7 +766,7 @@ xwl_window_post_damage(struct xwl_window *xwl_window) + wl_callback_add_listener(xwl_window->frame_callback, &frame_listener, xwl_window); + + wl_surface_commit(xwl_window->surface); +- DamageEmpty(xwl_window->damage); ++ DamageEmpty(window_get_damage(xwl_window->window)); + + xorg_list_del(&xwl_window->link_damage); + } +@@ -962,6 +1002,8 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv) + return FALSE; + if (!dixRegisterPrivateKey(&xwl_pixmap_private_key, PRIVATE_PIXMAP, 0)) + return FALSE; ++ if (!dixRegisterPrivateKey(&xwl_damage_private_key, PRIVATE_WINDOW, 0)) ++ return FALSE; + + dixSetPrivate(&pScreen->devPrivates, &xwl_screen_private_key, xwl_screen); + xwl_screen->screen = pScreen; +diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h +index 463622669..dfa3b37c3 100644 +--- a/hw/xwayland/xwayland.h ++++ b/hw/xwayland/xwayland.h +@@ -178,7 +178,6 @@ struct xwl_window { + struct wl_surface *surface; + struct wl_shell_surface *shell_surface; + WindowPtr window; +- DamagePtr damage; + struct xorg_list link_damage; + struct wl_callback *frame_callback; + Bool allow_commits; +-- +2.21.0 + diff --git a/0014-xwayland-Refactor-surface-creation-into-a-separate-f.patch b/0014-xwayland-Refactor-surface-creation-into-a-separate-f.patch new file mode 100644 index 0000000..f8fff3f --- /dev/null +++ b/0014-xwayland-Refactor-surface-creation-into-a-separate-f.patch @@ -0,0 +1,125 @@ +From 12db645c7fc0539752a881df7ac2bcd09e3cb17b Mon Sep 17 00:00:00 2001 +From: Carlos Garnacho +Date: Mon, 7 Jan 2019 15:33:31 +0100 +Subject: [PATCH xserver 14/15] xwayland: Refactor surface creation into a + separate function + +This is just called from xwl_window_realize() ATM, but will be useful in +future commits. + +Signed-off-by: Carlos Garnacho +(cherry picked from commit c2e8ae964052944312c5023ca7ea5c41a92990e5) +--- + hw/xwayland/xwayland.c | 64 ++++++++++++++++++++++++++++-------------- + 1 file changed, 43 insertions(+), 21 deletions(-) + +diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c +index 1efebd061..9a4b52fa9 100644 +--- a/hw/xwayland/xwayland.c ++++ b/hw/xwayland/xwayland.c +@@ -518,36 +518,25 @@ send_surface_id_event(struct xwl_window *xwl_window) + } + + static Bool +-xwl_realize_window(WindowPtr window) ++ensure_surface_for_window(WindowPtr window) + { + ScreenPtr screen = window->drawable.pScreen; + struct xwl_screen *xwl_screen; + struct xwl_window *xwl_window; + struct wl_region *region; +- Bool ret; +- +- xwl_screen = xwl_screen_get(screen); +- +- screen->RealizeWindow = xwl_screen->RealizeWindow; +- ret = (*screen->RealizeWindow) (window); +- xwl_screen->RealizeWindow = screen->RealizeWindow; +- screen->RealizeWindow = xwl_realize_window; + +- if (xwl_screen->rootless && !window->parent) { +- BoxRec box = { 0, 0, xwl_screen->width, xwl_screen->height }; ++ if (xwl_window_get(window)) ++ return TRUE; + +- RegionReset(&window->winSize, &box); +- RegionNull(&window->clipList); +- RegionNull(&window->borderClip); +- } ++ xwl_screen = xwl_screen_get(screen); + + if (xwl_screen->rootless) { + if (window->redirectDraw != RedirectDrawManual) +- return ret; ++ return TRUE; + } + else { + if (window->parent) +- return ret; ++ return TRUE; + } + + xwl_window = calloc(1, sizeof *xwl_window); +@@ -595,15 +584,12 @@ xwl_realize_window(WindowPtr window) + + compRedirectWindow(serverClient, window, CompositeRedirectManual); + +- if (!register_damage(window)) +- goto err_surf; +- + dixSetPrivate(&window->devPrivates, &xwl_window_private_key, xwl_window); + xorg_list_init(&xwl_window->link_damage); + + xwl_window_init_allow_commits(xwl_window); + +- return ret; ++ return TRUE; + + err_surf: + if (xwl_window->shell_surface) +@@ -614,6 +600,42 @@ err: + return FALSE; + } + ++static Bool ++xwl_realize_window(WindowPtr window) ++{ ++ ScreenPtr screen = window->drawable.pScreen; ++ struct xwl_screen *xwl_screen; ++ Bool ret; ++ ++ xwl_screen = xwl_screen_get(screen); ++ ++ screen->RealizeWindow = xwl_screen->RealizeWindow; ++ ret = (*screen->RealizeWindow) (window); ++ xwl_screen->RealizeWindow = screen->RealizeWindow; ++ screen->RealizeWindow = xwl_realize_window; ++ ++ if (!ret) ++ return FALSE; ++ ++ if (xwl_screen->rootless && !window->parent) { ++ BoxRec box = { 0, 0, xwl_screen->width, xwl_screen->height }; ++ ++ RegionReset(&window->winSize, &box); ++ RegionNull(&window->clipList); ++ RegionNull(&window->borderClip); ++ } ++ ++ if (xwl_screen->rootless ? ++ (window->drawable.class == InputOutput && ++ window->parent == window->drawable.pScreen->root) : ++ !window->parent) { ++ if (!register_damage(window)) ++ return FALSE; ++ } ++ ++ return ensure_surface_for_window(window); ++} ++ + static Bool + xwl_unrealize_window(WindowPtr window) + { +-- +2.21.0 + diff --git a/0015-xwayland-Handle-the-case-of-windows-being-realized-b.patch b/0015-xwayland-Handle-the-case-of-windows-being-realized-b.patch new file mode 100644 index 0000000..86d427c --- /dev/null +++ b/0015-xwayland-Handle-the-case-of-windows-being-realized-b.patch @@ -0,0 +1,91 @@ +From 63346c74393e1df4555f84367529802a67578ef6 Mon Sep 17 00:00:00 2001 +From: Carlos Garnacho +Date: Mon, 7 Jan 2019 15:33:35 +0100 +Subject: [PATCH xserver 15/15] xwayland: Handle the case of windows being + realized before redirection +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +If Xwayland gets to realize a window meant for composition before the +compositor redirected windows (i.e. redirect mode is not RedirectDrawManual +yet), the window would stay "invisible" as we wouldn't create a +wl_surface/wl_shell_surface for it at any later point. + +This scenario may happen if the wayland compositor sets up a X11 socket +upfront, but waits to raise Xwayland until there are X11 clients. In this +case the first data on the socket is the client's, the compositor can hardly +beat that in order to redirect subwindows before the client realizes a +Window. + +In order to jump across this hurdle, allow the late creation of a matching +(shell) surface for the WindowPtr on SetWindowPixmapProc, so it is ensured +to be created after the compositor set up redirection. + +Signed-off-by: Carlos Garnacho +Reviewed-by: Michel Dänzer +Reviewed-by: Olivier Fourdan +(cherry picked from commit 78cc8b6f9613fc71f6ecc7e8848d54364a250634) +--- + hw/xwayland/xwayland.c | 25 +++++++++++++++++++++++++ + hw/xwayland/xwayland.h | 1 + + 2 files changed, 26 insertions(+) + +diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c +index 9a4b52fa9..baa08d87b 100644 +--- a/hw/xwayland/xwayland.c ++++ b/hw/xwayland/xwayland.c +@@ -699,6 +699,26 @@ xwl_save_screen(ScreenPtr pScreen, int on) + return TRUE; + } + ++static void ++xwl_set_window_pixmap(WindowPtr window, ++ PixmapPtr pixmap) ++{ ++ ScreenPtr screen = window->drawable.pScreen; ++ struct xwl_screen *xwl_screen; ++ ++ xwl_screen = xwl_screen_get(screen); ++ ++ screen->SetWindowPixmap = xwl_screen->SetWindowPixmap; ++ (*screen->SetWindowPixmap) (window, pixmap); ++ xwl_screen->SetWindowPixmap = screen->SetWindowPixmap; ++ screen->SetWindowPixmap = xwl_set_window_pixmap; ++ ++ if (!RegionNotEmpty(&window->winSize)) ++ return; ++ ++ ensure_surface_for_window(window); ++} ++ + static void + frame_callback(void *data, + struct wl_callback *callback, +@@ -1185,6 +1205,11 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv) + xwl_screen->CloseScreen = pScreen->CloseScreen; + pScreen->CloseScreen = xwl_close_screen; + ++ if (xwl_screen->rootless) { ++ xwl_screen->SetWindowPixmap = pScreen->SetWindowPixmap; ++ pScreen->SetWindowPixmap = xwl_set_window_pixmap; ++ } ++ + pScreen->CursorWarpedTo = xwl_cursor_warped_to; + pScreen->CursorConfinedTo = xwl_cursor_confined_to; + +diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h +index dfa3b37c3..0854df456 100644 +--- a/hw/xwayland/xwayland.h ++++ b/hw/xwayland/xwayland.h +@@ -133,6 +133,7 @@ struct xwl_screen { + UnrealizeWindowProcPtr UnrealizeWindow; + DestroyWindowProcPtr DestroyWindow; + XYToWindowProcPtr XYToWindow; ++ SetWindowPixmapProcPtr SetWindowPixmap; + + struct xorg_list output_list; + struct xorg_list seat_list; +-- +2.21.0 + diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec index 72b77a0..c850ed6 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: 6%{?gitdate:.%{gitdate}}%{?dist} +Release: 7%{?gitdate:.%{gitdate}}%{?dist} URL: http://www.x.org License: MIT @@ -120,6 +120,23 @@ Patch30: 0001-Revert-present-scmd-Check-that-the-flip-and-screen-p.patch # https://gitlab.freedesktop.org/xorg/xserver/issues/840 Patch31: 0001-compiler.h-Do-not-include-sys-io.h-on-ARM-with-glibc.patch +Patch32: 0001-Xi-Use-current-device-active-grab-to-deliver-touch-e.patch +Patch33: 0002-dri2-Sync-i965_pci_ids.h-from-mesa.patch +Patch34: 0003-xwayland-Update-screen-pixmap-on-output-resize.patch +Patch35: 0004-xwayland-Expand-the-RANDR-screen-size-limits.patch +# https://bugzilla.redhat.com/1729925 +Patch36: 0005-xwayland-Do-not-free-a-NULL-GBM-bo.patch +Patch37: 0006-xsync-Add-resource-inside-of-SyncCreate-export-SyncC.patch +Patch38: 0007-GLX-Add-a-per-client-vendor-mapping.patch +Patch39: 0008-GLX-Use-the-sending-client-for-looking-up-XID-s.patch +Patch40: 0009-GLX-Add-a-function-to-change-a-clients-vendor-list.patch +Patch41: 0010-GLX-Set-GlxServerExports-major-minor-Version.patch +Patch42: 0011-miext-sync-Fix-needless-ABI-change.patch +Patch43: 0012-glx-Fix-previous-context-validation-in-xorgGlxMakeCu.patch +Patch44: 0013-xwayland-Separate-DamagePtr-into-separate-window-dat.patch +Patch45: 0014-xwayland-Refactor-surface-creation-into-a-separate-f.patch +Patch46: 0015-xwayland-Handle-the-case-of-windows-being-realized-b.patch + BuildRequires: systemtap-sdt-devel BuildRequires: git BuildRequires: automake autoconf libtool pkgconfig @@ -544,6 +561,9 @@ find %{inst_srcdir}/hw/xfree86 -name \*.c -delete %changelog +* Thu Aug 29 2019 Olivier Fourdan 1.20.5-7 +- Pick latest fixes from xserver stable branch upstream (rhbz#1729925) + * Sat Jul 27 2019 Fedora Release Engineering - 1.20.5-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild