[Mesa-dev] [PATCH v2 13/32] intel/isl: Use the depth field of phys_level0_sa for GEN4_2D 3D surfaces
Jason Ekstrand
jason at jlekstrand.net
Fri Oct 12 18:46:43 UTC 2018
This makes things a tiny bit stickier in isl_calc_phys_total_extent_el
but will be worth it when we enable Yf and Ys.
Reviewed-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
src/intel/isl/isl.c | 18 +++---------------
src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 9 +++------
2 files changed, 6 insertions(+), 21 deletions(-)
diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c
index 58091795a26..970d437f2e7 100644
--- a/src/intel/isl/isl.c
+++ b/src/intel/isl/isl.c
@@ -845,21 +845,10 @@ isl_calc_phys_level0_extent_sa(const struct isl_device *dev,
unreachable("bad isl_dim_layout");
case ISL_DIM_LAYOUT_GEN4_2D:
- assert(ISL_DEV_GEN(dev) >= 9);
-
+ case ISL_DIM_LAYOUT_GEN4_3D:
*phys_level0_sa = (struct isl_extent4d) {
.w = isl_align_npot(info->width, fmtl->bw),
.h = isl_align_npot(info->height, fmtl->bh),
- .d = 1,
- .a = info->depth,
- };
- break;
-
- case ISL_DIM_LAYOUT_GEN4_3D:
- assert(ISL_DEV_GEN(dev) < 9);
- *phys_level0_sa = (struct isl_extent4d) {
- .w = isl_align(info->width, fmtl->bw),
- .h = isl_align(info->height, fmtl->bh),
.d = info->depth,
.a = 1,
};
@@ -986,8 +975,6 @@ isl_calc_phys_slice0_extent_sa_gen4_2d(
{
const struct isl_format_layout *fmtl = isl_format_get_layout(info->format);
- assert(phys_level0_sa->depth == 1);
-
if (info->levels == 1) {
/* Do not pad the surface to the image alignment. Instead, pad it only
* to the pixel format's block alignment.
@@ -1070,9 +1057,10 @@ isl_calc_phys_total_extent_el_gen4_2d(
image_align_sa, phys_level0_sa,
array_pitch_span,
&phys_slice0_sa);
+ uint32_t array_len = MAX(phys_level0_sa->d, phys_level0_sa->a);
*phys_total_el = (struct isl_extent4d) {
.w = isl_assert_div(phys_slice0_sa.w, fmtl->bw),
- .h = *array_pitch_el_rows * (phys_level0_sa->array_len - 1) +
+ .h = *array_pitch_el_rows * (array_len - 1) +
isl_assert_div(phys_slice0_sa.h, fmtl->bh),
.d = 1,
.a = 1,
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 88d28c20807..36d080129fa 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -444,13 +444,10 @@ get_num_phys_layers(const struct isl_surf *surf, unsigned level)
/* In case of physical dimensions one needs to consider also the layout.
* See isl_calc_phys_level0_extent_sa().
*/
- if (surf->dim != ISL_SURF_DIM_3D)
+ if (surf->dim == ISL_SURF_DIM_3D)
+ return minify(surf->phys_level0_sa.depth, level);
+ else
return surf->phys_level0_sa.array_len;
-
- if (surf->dim_layout == ISL_DIM_LAYOUT_GEN4_2D)
- return minify(surf->phys_level0_sa.array_len, level);
-
- return minify(surf->phys_level0_sa.depth, level);
}
/** \brief Assert that the level and layer are valid for the miptree. */
--
2.19.1
More information about the mesa-dev
mailing list