Mesa (staging/22.1): zink: unify actual map calls in buffer mapping

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jun 17 16:05:10 UTC 2022


Module: Mesa
Branch: staging/22.1
Commit: c92f4bfffd91df44613bbd2aa71412349f9bf5a2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c92f4bfffd91df44613bbd2aa71412349f9bf5a2

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Thu Jun 16 14:32:46 2022 -0400

zink: unify actual map calls in buffer mapping

make this a bit easier to debug by moving the calls to one place

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17095>
(cherry picked from commit 2645430b06dd19222468b09f874099754786ad54)

---

 .pick_status.json                        | 2 +-
 src/gallium/drivers/zink/zink_resource.c | 9 ++++-----
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 9598c371698..4572920a812 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -112,7 +112,7 @@
         "description": "zink: unify actual map calls in buffer mapping",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c
index 963fd4cbef9..269efbe4d6c 100644
--- a/src/gallium/drivers/zink/zink_resource.c
+++ b/src/gallium/drivers/zink/zink_resource.c
@@ -1572,6 +1572,7 @@ zink_buffer_map(struct pipe_context *pctx,
       }
    }
 
+   unsigned map_offset = box->x;
    if (usage & PIPE_MAP_DISCARD_RANGE &&
         (!res->obj->host_visible ||
         !(usage & (PIPE_MAP_UNSYNCHRONIZED | PIPE_MAP_PERSISTENT)))) {
@@ -1623,8 +1624,7 @@ zink_buffer_map(struct pipe_context *pctx,
          zink_copy_buffer(ctx, staging_res, res, trans->offset, box->x, box->width);
          res = staging_res;
          usage &= ~PIPE_MAP_UNSYNCHRONIZED;
-         ptr = map_resource(screen, res);
-         ptr = ((uint8_t *)ptr) + trans->offset;
+         map_offset = trans->offset;
       }
    } else if ((usage & PIPE_MAP_UNSYNCHRONIZED) && !res->obj->host_visible) {
       trans->offset = box->x % screen->info.props.limits.minMemoryMapAlignment;
@@ -1633,8 +1633,7 @@ zink_buffer_map(struct pipe_context *pctx,
          goto fail;
       struct zink_resource *staging_res = zink_resource(trans->staging_res);
       res = staging_res;
-      ptr = map_resource(screen, res);
-      ptr = ((uint8_t *)ptr) + trans->offset;
+      map_offset = trans->offset;
    }
 
    if (!(usage & PIPE_MAP_UNSYNCHRONIZED)) {
@@ -1656,7 +1655,7 @@ zink_buffer_map(struct pipe_context *pctx,
       ptr = map_resource(screen, res);
       if (!ptr)
          goto fail;
-      ptr = ((uint8_t *)ptr) + box->x;
+      ptr = ((uint8_t *)ptr) + map_offset;
    }
 
    if (!res->obj->coherent



More information about the mesa-commit mailing list