summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2024-04-24 12:42:11 -0400
committerEric Engestrom <eric@engestrom.ch>2024-04-30 14:22:35 +0200
commit56a8bde81d067bc0b6b7c9f0c517837f3ae2e2d6 (patch)
tree8ccadc1d0b922e5a53ec6ddf599ac886901db348
parent235d807e93952346bae6ea810dc20413ea54ef86 (diff)
kopper: fix bufferage/swapinterval handling for non-window swapchains
if swapchain creation fails (e.g., insane cts swapchain configs), the swapchain gets demoted to a non-window image that is still accessed by the frontend. this image should not ever hit corresponding zink entrypoints for swapchain-only images, which requires a flag to test swapchain-edness cc: mesa-stable Acked-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28904> (cherry picked from commit a50c17802ab1f60d2fc707f05552f73f4b2d284a)
-rw-r--r--.pick_status.json2
-rw-r--r--src/gallium/frontends/dri/dri_drawable.h1
-rw-r--r--src/gallium/frontends/dri/kopper.c8
3 files changed, 10 insertions, 1 deletions
diff --git a/.pick_status.json b/.pick_status.json
index 60576a79403..f715bedea70 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -264,7 +264,7 @@
"description": "kopper: fix bufferage/swapinterval handling for non-window swapchains",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null
diff --git a/src/gallium/frontends/dri/dri_drawable.h b/src/gallium/frontends/dri/dri_drawable.h
index cac2602fdb6..c8241d6c2ed 100644
--- a/src/gallium/frontends/dri/dri_drawable.h
+++ b/src/gallium/frontends/dri/dri_drawable.h
@@ -91,6 +91,7 @@ struct dri_drawable
struct kopper_loader_info info;
__DRIimage *image; //texture_from_pixmap
bool is_window;
+ bool window_valid;
bool has_modifiers;
/* hooks filled in by dri2 & drisw */
diff --git a/src/gallium/frontends/dri/kopper.c b/src/gallium/frontends/dri/kopper.c
index bc7fe59be26..b43658d6a75 100644
--- a/src/gallium/frontends/dri/kopper.c
+++ b/src/gallium/frontends/dri/kopper.c
@@ -555,6 +555,7 @@ XXX do this once swapinterval is hooked up
assert(data);
drawable->textures[statts[i]] =
screen->base.screen->resource_create_drawable(screen->base.screen, &templ, data);
+ drawable->window_valid = !!drawable->textures[statts[i]];
}
#ifdef VK_USE_PLATFORM_XCB_KHR
else if (is_pixmap && statts[i] == ST_ATTACHMENT_FRONT_LEFT && !screen->is_sw) {
@@ -904,6 +905,9 @@ kopperSetSwapInterval(__DRIdrawable *dPriv, int interval)
drawable->textures[ST_ATTACHMENT_BACK_LEFT] :
drawable->textures[ST_ATTACHMENT_FRONT_LEFT];
+ /* can't set swap interval on non-windows */
+ if (!drawable->window_valid)
+ return;
/* the conditional is because we can be called before buffer allocation. If
* we're before allocation, then the initial_swap_interval will be used when
* the swapchain is eventually created.
@@ -922,6 +926,10 @@ kopperQueryBufferAge(__DRIdrawable *dPriv)
drawable->textures[ST_ATTACHMENT_BACK_LEFT] :
drawable->textures[ST_ATTACHMENT_FRONT_LEFT];
+ /* can't get buffer age from non-window swapchain */
+ if (!drawable->window_valid)
+ return 0;
+
/* Wait for glthread to finish because we can't use pipe_context from
* multiple threads.
*/