diff options
author | Chad Versace <[email protected]> | 2016-01-04 17:09:11 -0800 |
---|---|---|
committer | Chad Versace <[email protected]> | 2016-01-05 09:52:07 -0800 |
commit | a1d64ae56123db2bf302ce5ffe3a965075df7ead (patch) | |
tree | 439b403ac8053c5c2f255d43d085ef72d82275e0 /src/isl | |
parent | 2172f0e9bb54671dc0bd8970b1e06a7818b83c47 (diff) |
isl: Align isl_surf::phys_level0_sa to the format's compression block
Diffstat (limited to 'src/isl')
-rw-r--r-- | src/isl/isl.c | 24 | ||||
-rw-r--r-- | src/isl/isl.h | 2 |
2 files changed, 18 insertions, 8 deletions
diff --git a/src/isl/isl.c b/src/isl/isl.c index eee612826ce..f6b392cfe72 100644 --- a/src/isl/isl.c +++ b/src/isl/isl.c @@ -383,7 +383,7 @@ isl_surf_choose_dim_layout(const struct isl_device *dev, /** * 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, @@ -393,6 +393,8 @@ 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__); @@ -401,6 +403,7 @@ isl_calc_phys_level0_extent_sa(const struct isl_device *dev, 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: @@ -434,8 +437,8 @@ isl_calc_phys_level0_extent_sa(const struct isl_device *dev, 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, }; @@ -477,6 +480,11 @@ isl_calc_phys_level0_extent_sa(const struct isl_device *dev, 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"); @@ -485,8 +493,8 @@ isl_calc_phys_level0_extent_sa(const struct isl_device *dev, 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, }; @@ -495,8 +503,8 @@ isl_calc_phys_level0_extent_sa(const struct isl_device *dev, 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, }; @@ -998,6 +1006,8 @@ isl_surf_init_s(const struct isl_device *dev, 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); diff --git a/src/isl/isl.h b/src/isl/isl.h index 02b92703c27..0faf671af2b 100644 --- a/src/isl/isl.h +++ b/src/isl/isl.h @@ -728,7 +728,7 @@ struct isl_surf { /** * Physical extent of the surface's base level, in units of physical - * surface samples. + * surface samples and aligned to the format's compression block. * * Consider isl_dim_layout as an operator that transforms a logical surface * layout to a physical surface layout. Then |