From 69570d69c9dc04e38bf7750b920dc2550a7672fa Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 26 Apr 2022 11:47:42 -0400 Subject: [PATCH] kopper: if swapchain updating fails, generate an xerror generally any errors triggered here should be caught and handled by (vulkan) wsi, but nvidia's wsi is abnormally permissive and doesn't kill processes even when they no longer have a window to solve this, generate a BadWindow error that will definitely take down any wsi, no matter how "robust" it might think it is --- src/gallium/frontends/dri/kopper.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/gallium/frontends/dri/kopper.c b/src/gallium/frontends/dri/kopper.c index 6fa8e70c4577..ac5331808912 100644 --- a/src/gallium/frontends/dri/kopper.c +++ b/src/gallium/frontends/dri/kopper.c @@ -25,6 +25,7 @@ #include "util/u_memory.h" #include "util/u_inlines.h" #include "util/u_box.h" +#include "util/log.h" #include "pipe/p_context.h" #include "pipe-loader/pipe_loader.h" #include "state_tracker/st_context.h" @@ -367,10 +368,23 @@ kopper_update_drawable_info(struct dri_drawable *drawable) drawable->textures[ST_ATTACHMENT_BACK_LEFT] : drawable->textures[ST_ATTACHMENT_FRONT_LEFT]; - if (is_window && ptex && kscreen->base.fd == -1) - zink_kopper_update(screen, ptex, &dPriv->w, &dPriv->h); - else + if (!is_window || !ptex || kscreen->base.fd != -1) { get_drawable_info(dPriv, &x, &y, &dPriv->w, &dPriv->h); + return; + } + if (zink_kopper_update(screen, ptex, &dPriv->w, &dPriv->h)) + return; + /* if this is nvidia, normal x errors won't be enough to kill wsi. + * we're gonna need a bigger boat. + */ + assert(cdraw->info.bos.sType == VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR); +#ifdef VK_USE_PLATFORM_XCB_KHR + mesa_loge("Kopper: generating BadWindow error from X_CreateWindow to kill zombie X connection\n"); + xcb_connection_t *conn = cdraw->info.xcb.connection; + xcb_screen_t *xscreen = xcb_setup_roots_iterator(xcb_get_setup(conn)).data; + xcb_create_window(conn, XCB_COPY_FROM_PARENT, xcb_generate_id(conn), xcb_generate_id(conn), + 0, 0, 1, 1, 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, xscreen->root_visual, 0, NULL); +#endif } static inline void -- GitLab