summaryrefslogtreecommitdiffstats
path: root/src/intel/isl
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-07-11 16:08:54 -0700
committerJason Ekstrand <[email protected]>2017-07-22 21:41:12 -0700
commit628bfaf1c6f207ee01c59e236cef3fae942d6c55 (patch)
tree5bd5e71b72dd65d93b9978f9e11c59f46af3c0ea /src/intel/isl
parent5de4209f91c466af6a28fee9c80c398a8ed9b95d (diff)
intel/isl: Add some sanity checks for compressed surfaces
Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/intel/isl')
-rw-r--r--src/intel/isl/isl_surface_state.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/intel/isl/isl_surface_state.c b/src/intel/isl/isl_surface_state.c
index 1620c93cef1..e8bdb659620 100644
--- a/src/intel/isl/isl_surface_state.c
+++ b/src/intel/isl/isl_surface_state.c
@@ -254,6 +254,24 @@ isl_genX(surf_fill_state_s)(const struct isl_device *dev, void *state,
if (info->surf->dim == ISL_SURF_DIM_1D)
assert(!isl_format_is_compressed(info->view->format));
+ if (isl_format_is_compressed(info->surf->format)) {
+ /* You're not allowed to make a view of a compressed format with any
+ * format other than the surface format. None of the userspace APIs
+ * allow for this directly and doing so would mess up a number of
+ * surface parameters such as Width, Height, and alignments. Ideally,
+ * we'd like to assert that the two formats match. However, we have an
+ * S3TC workaround that requires us to do reinterpretation. So assert
+ * that they're at least the same bpb and block size.
+ */
+ MAYBE_UNUSED const struct isl_format_layout *surf_fmtl =
+ isl_format_get_layout(info->surf->format);
+ MAYBE_UNUSED const struct isl_format_layout *view_fmtl =
+ isl_format_get_layout(info->surf->format);
+ assert(surf_fmtl->bpb == view_fmtl->bpb);
+ assert(surf_fmtl->bw == view_fmtl->bw);
+ assert(surf_fmtl->bh == view_fmtl->bh);
+ }
+
s.SurfaceFormat = info->view->format;
#if GEN_GEN <= 5