Mesa (staging/20.2): zink: really fix direct image mapping offset (I mean it this time)

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Dec 14 17:33:38 UTC 2020


Module: Mesa
Branch: staging/20.2
Commit: 2ac5dec4f1b3a58187f9afc63cda3d0edba3c9cd
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2ac5dec4f1b3a58187f9afc63cda3d0edba3c9cd

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Sat Dec 12 11:59:40 2020 -0500

zink: really fix direct image mapping offset (I mean it this time)

I got confused and:
* used the vkformat instead of the pipe format for getting format description
* incorrectly calculated bpp

but this time it's definitely 100% fixed I promise

Fixes: 456b57802ea ("zink: fix direct image mapping offset")

Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8074>
(cherry picked from commit dfd0f042e0d8faa374629ea0a67422edff6d48c3)

---

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

diff --git a/.pick_status.json b/.pick_status.json
index abf0f14556b..c2b359156e8 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -166,7 +166,7 @@
         "description": "zink: really fix direct image mapping offset (I mean it this time)",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "456b57802eaf95d36e7b950bdb5ffd86a1c0dc63"
     },
diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c
index 5eb1012da48..0afd0e7144d 100644
--- a/src/gallium/drivers/zink/zink_resource.c
+++ b/src/gallium/drivers/zink/zink_resource.c
@@ -523,11 +523,11 @@ zink_transfer_map(struct pipe_context *pctx,
          vkGetImageSubresourceLayout(screen->dev, res->image, &isr, &srl);
          trans->base.stride = srl.rowPitch;
          trans->base.layer_stride = srl.arrayPitch;
-         const struct util_format_description *desc = util_format_description(res->format);
+         const struct util_format_description *desc = util_format_description(res->base.format);
          unsigned offset = srl.offset +
                            box->z * srl.depthPitch +
                            (box->y / desc->block.height) * srl.rowPitch +
-                           (box->x / desc->block.width) * (util_format_get_blocksize(res->format) / desc->nr_channels);
+                           (box->x / desc->block.width) * (desc->block.bits / 8);
          ptr = ((uint8_t *)ptr) + offset;
       }
    }



More information about the mesa-commit mailing list