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

Author: Mike Blumenkrantz <[email protected]>
Date:   Sun Apr  4 12:55:34 2021 -0400

zink: minor refactoring of buffer map for read case

make this a little more flexible for the non-DONTBLOCK case

Reviewed-by: Dave Airlie <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10509>

---

 src/gallium/drivers/zink/zink_resource.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_resource.c 
b/src/gallium/drivers/zink/zink_resource.c
index b1906ec2815..f877faed517 100644
--- a/src/gallium/drivers/zink/zink_resource.c
+++ b/src/gallium/drivers/zink/zink_resource.c
@@ -891,14 +891,14 @@ buffer_transfer_map(struct zink_context *ctx, struct 
zink_resource *res, unsigne
    } else if ((usage & PIPE_MAP_READ) && !(usage & PIPE_MAP_PERSISTENT)) {
       assert(!(usage & (TC_TRANSFER_MAP_THREADED_UNSYNC | 
PIPE_MAP_THREAD_SAFE)));
       uint32_t latest_write = get_most_recent_access(res, 
ZINK_RESOURCE_ACCESS_WRITE);
-      if (latest_write) {
-         if (usage & PIPE_MAP_DONTBLOCK) {
-            if (latest_write == ctx->curr_batch ||
-               !zink_check_batch_completion(ctx, latest_write))
-               return NULL;
-         } else
-            zink_wait_on_batch(ctx, latest_write);
+      if (usage & PIPE_MAP_DONTBLOCK) {
+         if (latest_write &&
+             (latest_write == ctx->curr_batch || 
!zink_check_batch_completion(ctx, latest_write)))
+            return NULL;
+         latest_write = 0;
       }
+      if (latest_write)
+         zink_wait_on_batch(ctx, latest_write);
    }
 
    if (!ptr) {

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to