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

Author: Sviatoslav Peleshko <[email protected]>
Date:   Mon Feb  6 12:48:30 2023 +0200

iris: Avoid creating uncompressed view with unaligned tile offsets on BDW

Fixes: 60568d5d ("iris: Use isl_surf_get_uncompressed_surf")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7990
Signed-off-by: Sviatoslav Peleshko <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21147>
(cherry picked from commit 4229d9324f4a8da312e624d2249a10a76992d2cd)

---

 .pick_status.json                     |  2 +-
 src/gallium/drivers/iris/iris_state.c | 15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index 3fc440d9075..8ef17915875 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -31,7 +31,7 @@
         "description": "iris: Avoid creating uncompressed view with unaligned 
tile offsets on BDW",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "60568d5dce988ffb67966d88b6feeb67516c7145"
     },
diff --git a/src/gallium/drivers/iris/iris_state.c 
b/src/gallium/drivers/iris/iris_state.c
index 2fc66a20c9f..0a3bd9ee096 100644
--- a/src/gallium/drivers/iris/iris_state.c
+++ b/src/gallium/drivers/iris/iris_state.c
@@ -2823,6 +2823,21 @@ iris_create_surface(struct pipe_context *ctx,
                                                &res->surf, view,
                                                &isl_surf, view, &offset_B,
                                                &tile_x_el, &tile_y_el);
+
+      /* On Broadwell, HALIGN and VALIGN are specified in pixels and are
+       * hard-coded to align to exactly the block size of the compressed
+       * texture. This means that, when reinterpreted as a non-compressed
+       * texture, the tile offsets may be anything.
+       *
+       * We need them to be multiples of 4 to be usable in 
RENDER_SURFACE_STATE,
+       * so force the state tracker to take fallback paths if they're not.
+       */
+#if GFX_VER == 8
+      if (tile_x_el % 4 != 0 || tile_y_el % 4 != 0) {
+         ok = false;
+      }
+#endif
+
       if (!ok) {
          free(surf);
          return NULL;

Reply via email to