diff --git a/patches/x11.patch b/patches/x11.patch new file mode 100644 index 0000000..9bc7be1 --- /dev/null +++ b/patches/x11.patch @@ -0,0 +1,41 @@ +From a61053e91940c1cf1256763681cdc76f269e305e Mon Sep 17 00:00:00 2001 +From: Dave Airlie +Date: Tue, 18 Feb 2025 17:00:42 +1000 +Subject: [PATCH] vulkan/wsi/x11: fix use of uninitialised xfixes region. + +If you are in the sw + no mit-shm support, we don't create the xfixes region, +so don't try and use it in the same scenario. + +We are seeing some gtk4 apps crash with BadRegion reports due to this. + +Fixes: bbdf7e45b15f ("wsi/x11: Hook up KHR_incremental_present") +--- + src/vulkan/wsi/wsi_common_x11.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c +index 8c364cd94dd..e8ebe4fb041 100644 +--- a/src/vulkan/wsi/wsi_common_x11.c ++++ b/src/vulkan/wsi/wsi_common_x11.c +@@ -1804,13 +1804,17 @@ x11_queue_present(struct wsi_swapchain *anv_chain, + { + struct x11_swapchain *chain = (struct x11_swapchain *)anv_chain; + xcb_xfixes_region_t update_area = 0; ++ bool set_damage = damage ? true : false; + + /* If the swapchain is in an error state, don't go any further. */ + VkResult status = x11_swapchain_read_status_atomic(chain); + if (status < 0) + return status; + +- if (damage && damage->pRectangles && damage->rectangleCount > 0 && ++ if (chain->base.wsi->sw && !chain->has_mit_shm) ++ set_damage = false; ++ ++ if (set_damage && damage->pRectangles && damage->rectangleCount > 0 && + damage->rectangleCount <= MAX_DAMAGE_RECTS) { + xcb_rectangle_t *rects = chain->images[image_index].rects; + +-- +2.48.1 +