isl: fix layout for comparing surf and view properties
authorTapani Pälli <tapani.palli@intel.com>
Thu, 4 May 2023 10:39:41 +0000 (13:39 +0300)
committerMarge Bot <emma+marge@anholt.net>
Fri, 5 May 2023 08:48:53 +0000 (08:48 +0000)
These asserts were checking isl_format_layout against itself, change
to compare surface format layout against view format layout.

Fixes: 628bfaf1c6f ("intel/isl: Add some sanity checks for compressed surfaces")
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22790>

src/intel/isl/isl_surface_state.c

index 221e759..72f433b 100644 (file)
@@ -206,10 +206,17 @@ isl_genX(surf_fill_state_s)(const struct isl_device *dev, void *state,
       ASSERTED const struct isl_format_layout *surf_fmtl =
          isl_format_get_layout(info->surf->format);
       ASSERTED const struct isl_format_layout *view_fmtl =
-         isl_format_get_layout(info->surf->format);
+         isl_format_get_layout(info->view->format);
+
       assert(surf_fmtl->bpb == view_fmtl->bpb);
-      assert(surf_fmtl->bw == view_fmtl->bw);
-      assert(surf_fmtl->bh == view_fmtl->bh);
+
+      /* We could be attempting to upload blocks of compressed data via an
+       * uncompressed view, blocksize will not match there.
+       */
+      if (isl_format_is_compressed(info->view->format)) {
+         assert(surf_fmtl->bw == view_fmtl->bw);
+         assert(surf_fmtl->bh == view_fmtl->bh);
+      }
    }
 
    s.SurfaceFormat = info->view->format;