intel/isl: Add some sanity checks for compressed surfaces

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
This commit is contained in:
Jason Ekstrand 2017-07-11 16:08:54 -07:00
parent 5de4209f91
commit 628bfaf1c6

View File

@ -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