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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30487>
This commit is contained in:
Mike Blumenkrantz 2024-08-02 09:34:29 -04:00 committed by Marge Bot
parent cf9588bae6
commit a6d97b0afe

View file

@ -406,12 +406,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.
*/
@ -461,7 +455,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++) {