Mesa (main): zink: handle deferred swapchain resource flushing

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 7 19:52:02 UTC 2022


Module: Mesa
Branch: main
Commit: 127d7aeb6c2fe543d348c72a3c9e9414ed6fa402
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=127d7aeb6c2fe543d348c72a3c9e9414ed6fa402

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Wed Apr  6 16:49:03 2022 -0400

zink: handle deferred swapchain resource flushing

if the swapchain image hasn't been acquired yet, flag it as a deferred
present so it can be picked up on flush

Reviewed-by: Adam Jackson <ajax at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15784>

---

 src/gallium/drivers/zink/zink_context.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index afdc7acacc2..bfce532ce59 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -3544,9 +3544,13 @@ zink_flush_resource(struct pipe_context *pctx,
 {
    struct zink_context *ctx = zink_context(pctx);
    struct zink_resource *res = zink_resource(pres);
-   if (pres->bind & PIPE_BIND_DISPLAY_TARGET && res->obj->acquire) {
-      zink_resource_image_barrier(ctx, res, VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, 0, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT);
-      zink_batch_reference_resource_rw(&ctx->batch, res, true);
+   if (pres->bind & PIPE_BIND_DISPLAY_TARGET) {
+      if (res->obj->acquire) {
+         zink_resource_image_barrier(ctx, res, VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, 0, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT);
+         zink_batch_reference_resource_rw(&ctx->batch, res, true);
+      } else {
+         ctx->needs_present = res;
+      }
       ctx->batch.swapchain = res;
    }
 }



More information about the mesa-commit mailing list