Mesa (master): zink: use undefined layout for first scanout obj transition

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Apr 21 00:16:55 UTC 2021


Module: Mesa
Branch: master
Commit: 7c2c0813c56baf522f39584150046c613a18931f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7c2c0813c56baf522f39584150046c613a18931f

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Tue Apr 13 09:14:15 2021 -0400

zink: use undefined layout for first scanout obj transition

doesn't really matter, but technically an error

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

---

 src/gallium/drivers/zink/zink_context.c  | 4 +++-
 src/gallium/drivers/zink/zink_resource.h | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 0c694038799..d45f749cf71 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -1789,7 +1789,7 @@ copy_scanout(struct zink_context *ctx, struct zink_resource *res)
       NULL,
       0,
       VK_ACCESS_TRANSFER_WRITE_BIT,
-      VK_IMAGE_LAYOUT_PRESENT_SRC_KHR,
+      res->scanout_obj_init ? VK_IMAGE_LAYOUT_PRESENT_SRC_KHR : VK_IMAGE_LAYOUT_UNDEFINED,
       VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
       VK_QUEUE_FAMILY_IGNORED,
       VK_QUEUE_FAMILY_IGNORED,
@@ -1822,6 +1822,8 @@ copy_scanout(struct zink_context *ctx, struct zink_resource *res)
       0, NULL,
       1, &imb
    );
+   /* separate flag to avoid annoying validation errors for new scanout objs */
+   res->scanout_obj_init = true;
 }
 
 static void
diff --git a/src/gallium/drivers/zink/zink_resource.h b/src/gallium/drivers/zink/zink_resource.h
index 1bf959916ef..c298c8fe3d2 100644
--- a/src/gallium/drivers/zink/zink_resource.h
+++ b/src/gallium/drivers/zink/zink_resource.h
@@ -89,6 +89,7 @@ struct zink_resource {
 
    struct zink_resource_object *obj;
    struct zink_resource_object *scanout_obj; //TODO: remove for wsi
+   bool scanout_obj_init;
    union {
       struct util_range valid_buffer_range;
       struct {



More information about the mesa-commit mailing list