Mesa (staging/21.2): crocus/gen45: fix mapping compressed textures

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Aug 2 20:34:15 UTC 2021


Module: Mesa
Branch: staging/21.2
Commit: 5b99334ba3cc19faa449f9c40e08f2aef8e72811
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5b99334ba3cc19faa449f9c40e08f2aef8e72811

Author: Dave Airlie <airlied at gmail.com>
Date:   Mon Aug  2 02:26:46 2021 -0400

crocus/gen45: fix mapping compressed textures

I don't think iris ever hits this path, but probably has the same bug if
it did.

Fixes texsubimage on gfx4 + gfx4.5

Fixes: 5bf6ec31ccf6 ("crocus/gen4: restrict memcpy mapping to gen5")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12164>
(cherry picked from commit c12444ab8894e7d755401eb26523bb0e2ae63697)

---

 .pick_status.json                            | 2 +-
 src/gallium/drivers/crocus/crocus_resource.c | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index b14aa0ba8bd..c3738d48647 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -22,7 +22,7 @@
         "description": "crocus/gen45: fix mapping compressed textures",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "5bf6ec31ccf6c24a407df9443a534f8036d26861"
     },
diff --git a/src/gallium/drivers/crocus/crocus_resource.c b/src/gallium/drivers/crocus/crocus_resource.c
index f189f1a4f99..5adca55233f 100644
--- a/src/gallium/drivers/crocus/crocus_resource.c
+++ b/src/gallium/drivers/crocus/crocus_resource.c
@@ -1542,12 +1542,17 @@ crocus_map_direct(struct crocus_transfer *map)
       const unsigned cpp = fmtl->bpb / 8;
       unsigned x0_el, y0_el;
 
+      assert(box->x % fmtl->bw == 0);
+      assert(box->y % fmtl->bh == 0);
       get_image_offset_el(surf, xfer->level, box->z, &x0_el, &y0_el);
 
+      x0_el += box->x / fmtl->bw;
+      y0_el += box->y / fmtl->bh;
+
       xfer->stride = isl_surf_get_row_pitch_B(surf);
       xfer->layer_stride = isl_surf_get_array_pitch(surf);
 
-      map->ptr = ptr + (y0_el + box->y) * xfer->stride + (x0_el + box->x) * cpp;
+      map->ptr = ptr + y0_el * xfer->stride + x0_el * cpp;
    }
 }
 



More information about the mesa-commit mailing list