Mesa (main): zink: no-op read access buffer barriers if existing access exists for earlier stage

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jun 4 14:02:41 UTC 2021


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Wed Mar  3 13:00:55 2021 -0500

zink: no-op read access buffer barriers if existing access exists for earlier stage

only the earliest stage should be applied for these barriers, so we can skip
ones where the existing access is earlier

Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11131>

---

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

diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 1f1cfa8d569..c9406e85db7 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -2202,9 +2202,10 @@ zink_resource_buffer_needs_barrier(struct zink_resource *res, VkAccessFlags flag
       return true;
    if (!pipeline)
       pipeline = pipeline_access_stage(flags);
-   return (res->access_stage & pipeline) != pipeline || (res->access & flags) != flags ||
-          zink_resource_access_is_write(res->access) ||
-          zink_resource_access_is_write(flags);
+   return zink_resource_access_is_write(res->access) ||
+          zink_resource_access_is_write(flags) ||
+          ((res->access_stage & pipeline) != pipeline && !(res->access_stage & (pipeline - 1))) ||
+          (res->access & flags) != flags;
 }
 
 ALWAYS_INLINE static bool



More information about the mesa-commit mailing list