Mesa (main): iris: Take offsets into account when mapping resources

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Apr 6 23:41:19 UTC 2022


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

Author: Jason Ekstrand <jason.ekstrand at collabora.com>
Date:   Wed Apr  6 15:07:10 2022 -0500

iris: Take offsets into account when mapping resources

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15779>

---

 src/gallium/drivers/iris/iris_resource.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c
index a072190f37f..9a111b9391d 100644
--- a/src/gallium/drivers/iris/iris_resource.c
+++ b/src/gallium/drivers/iris/iris_resource.c
@@ -1902,6 +1902,7 @@ iris_map_copy_region(struct iris_transfer *map)
    if (iris_batch_references(map->batch, staging_bo))
       iris_batch_flush(map->batch);
 
+   assert(((struct iris_resource *)map->staging)->offset == 0);
    map->ptr =
       iris_bo_map(map->dbg, staging_bo, xfer->usage & MAP_FLAGS) + extra;
 
@@ -1978,7 +1979,7 @@ iris_unmap_s8(struct iris_transfer *map)
 
    if (xfer->usage & PIPE_MAP_WRITE) {
       uint8_t *untiled_s8_map = map->ptr;
-      uint8_t *tiled_s8_map =
+      uint8_t *tiled_s8_map = res->offset +
          iris_bo_map(map->dbg, res->bo, (xfer->usage | MAP_RAW) & MAP_FLAGS);
 
       for (int s = 0; s < box->depth; s++) {
@@ -2025,7 +2026,7 @@ iris_map_s8(struct iris_transfer *map)
     */
    if (!(xfer->usage & PIPE_MAP_DISCARD_RANGE)) {
       uint8_t *untiled_s8_map = map->ptr;
-      uint8_t *tiled_s8_map =
+      uint8_t *tiled_s8_map = res->offset +
          iris_bo_map(map->dbg, res->bo, (xfer->usage | MAP_RAW) & MAP_FLAGS);
 
       for (int s = 0; s < box->depth; s++) {
@@ -2083,7 +2084,7 @@ iris_unmap_tiled_memcpy(struct iris_transfer *map)
    const bool has_swizzling = false;
 
    if (xfer->usage & PIPE_MAP_WRITE) {
-      char *dst =
+      char *dst = res->offset +
          iris_bo_map(map->dbg, res->bo, (xfer->usage | MAP_RAW) & MAP_FLAGS);
 
       for (int s = 0; s < box->depth; s++) {
@@ -2127,7 +2128,7 @@ iris_map_tiled_memcpy(struct iris_transfer *map)
    const bool has_swizzling = false;
 
    if (!(xfer->usage & PIPE_MAP_DISCARD_RANGE)) {
-      char *src =
+      char *src = res->offset +
          iris_bo_map(map->dbg, res->bo, (xfer->usage | MAP_RAW) & MAP_FLAGS);
 
       for (int s = 0; s < box->depth; s++) {
@@ -2153,7 +2154,8 @@ iris_map_direct(struct iris_transfer *map)
    struct pipe_box *box = &xfer->box;
    struct iris_resource *res = (struct iris_resource *) xfer->resource;
 
-   void *ptr = iris_bo_map(map->dbg, res->bo, xfer->usage & MAP_FLAGS);
+   void *ptr = res->offset +
+      iris_bo_map(map->dbg, res->bo, xfer->usage & MAP_FLAGS);
 
    if (res->base.b.target == PIPE_BUFFER) {
       xfer->stride = 0;



More information about the mesa-commit mailing list