From ca46312b8762b02fbe434c1885c0cb4d5cdf48e7 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 2 Aug 2024 09:34:29 -0400 Subject: [PATCH] kopper: check swapchain size after possible loader image resize previously the size was checked at the top of the function, but this ignored cases where the loader might end up resizing the drawable, resulting in an attempted 0x0 swapchain creation based on stale geometry cc: mesa-stable Part-of: (cherry picked from commit a6d97b0afed27a37b0edaed0e6360ae1c7f181e9) --- .pick_status.json | 2 +- src/gallium/frontends/dri/kopper.c | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 0ee0b226856..20246491748 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -5514,7 +5514,7 @@ "description": "kopper: check swapchain size after possible loader image resize", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/gallium/frontends/dri/kopper.c b/src/gallium/frontends/dri/kopper.c index 7c3cba81e9c..6518dc59254 100644 --- a/src/gallium/frontends/dri/kopper.c +++ b/src/gallium/frontends/dri/kopper.c @@ -425,12 +425,6 @@ kopper_allocate_textures(struct dri_context *ctx, bool is_window = drawable->is_window; bool is_pixmap = !is_window && drawable->info.bos.sType == VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR; - width = drawable->w; - height = drawable->h; - - resized = (drawable->old_w != width || - drawable->old_h != height); - /* Wait for glthread to finish because we can't use pipe_context from * multiple threads. */ @@ -480,7 +474,16 @@ kopper_allocate_textures(struct dri_context *ctx, } else { ctx->is_shared_buffer_bound = false; } - } else { + } + + /* check size after possible loader image resize */ + width = drawable->w; + height = drawable->h; + + resized = (drawable->old_w != width || + drawable->old_h != height); + + if (!image) { /* remove outdated textures */ if (resized) { for (i = 0; i < ST_ATTACHMENT_COUNT; i++) {