zink: utilize copy box tracking to avoid barrier emission for buf2img copies
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Fri, 17 Feb 2023 22:09:50 +0000 (17:09 -0500)
committerMarge Bot <emma+marge@anholt.net>
Fri, 24 Feb 2023 05:27:31 +0000 (05:27 +0000)
this should reduce synchronization during e.g., miplevel population

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21397>

src/gallium/drivers/zink/zink_context.c

index a1fe7ee..767abae 100644 (file)
@@ -4544,7 +4544,11 @@ zink_copy_image_buffer(struct zink_context *ctx, struct zink_resource *dst, stru
          if (!zink_kopper_acquire(ctx, img, UINT64_MAX))
             return;
       }
-      zink_screen(ctx->base.screen)->image_barrier(ctx, img, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 0, 0);
+      struct pipe_box box = *src_box;
+      box.x = dstx;
+      box.y = dsty;
+      box.z = dstz;
+      zink_resource_image_transfer_dst_barrier(ctx, img, dst_level, &box);
       zink_screen(ctx->base.screen)->buffer_barrier(ctx, buf, VK_ACCESS_TRANSFER_READ_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT);
    } else {
       if (zink_is_swapchain(img))