/**
* Calculate the physical extent of the surface's first level, in units of
- * surface samples.
+ * surface samples. The result is aligned to the format's compression block.
*/
static void
isl_calc_phys_level0_extent_sa(const struct isl_device *dev,
enum isl_msaa_layout msaa_layout,
struct isl_extent4d *phys_level0_sa)
{
+ const struct isl_format_layout *fmtl = isl_format_get_layout(info->format);
+
if (isl_format_is_yuv(info->format))
isl_finishme("%s:%s: YUV format", __FILE__, __func__);
assert(info->height == 1);
assert(info->depth == 1);
assert(info->samples == 1);
+ assert(!isl_format_is_compressed(info->format));
switch (dim_layout) {
case ISL_DIM_LAYOUT_GEN4_3D:
assert(info->samples == 1);
*phys_level0_sa = (struct isl_extent4d) {
- .w = info->width,
- .h = info->height,
+ .w = isl_align(info->width, fmtl->bw),
+ .h = isl_align(info->height, fmtl->bh),
.d = 1,
.a = info->array_len,
};
assert(info->array_len == 1);
assert(info->samples == 1);
+ if (fmtl->bd > 1) {
+ isl_finishme("%s:%s: compression block with depth > 1",
+ __FILE__, __func__);
+ }
+
switch (dim_layout) {
case ISL_DIM_LAYOUT_GEN9_1D:
unreachable("bad isl_dim_layout");
assert(ISL_DEV_GEN(dev) >= 9);
*phys_level0_sa = (struct isl_extent4d) {
- .w = info->width,
- .h = info->height,
+ .w = isl_align(info->width, fmtl->bw),
+ .h = isl_align(info->height, fmtl->bh),
.d = 1,
.a = info->depth,
};
case ISL_DIM_LAYOUT_GEN4_3D:
assert(ISL_DEV_GEN(dev) < 9);
*phys_level0_sa = (struct isl_extent4d) {
- .w = info->width,
- .h = info->height,
+ .w = isl_align(info->width, fmtl->bw),
+ .h = isl_align(info->height, fmtl->bh),
.d = info->depth,
.a = 1,
};
struct isl_extent4d phys_level0_sa;
isl_calc_phys_level0_extent_sa(dev, info, dim_layout, tiling, msaa_layout,
&phys_level0_sa);
+ assert(phys_level0_sa.w % fmtl->bw == 0);
+ assert(phys_level0_sa.h % fmtl->bh == 0);
enum isl_array_pitch_span array_pitch_span =
isl_choose_array_pitch_span(dev, info, dim_layout, &phys_level0_sa);