[Mesa-dev] [PATCH v2 15/32] intel/isl: Support Yf/Ys in isl_surf_get_image_offset_sa
Jason Ekstrand
jason at jlekstrand.net
Fri Oct 12 18:46:45 UTC 2018
All that's really needed here is to handle the array offsetting by using
an Z or array offset instead of the Y offset.
Reviewed-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
src/intel/isl/isl.c | 45 ++++++++++++++++++++++++++++++++++-----------
1 file changed, 34 insertions(+), 11 deletions(-)
diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c
index 3ea2a4f8247..a118da56c17 100644
--- a/src/intel/isl/isl.c
+++ b/src/intel/isl/isl.c
@@ -2009,7 +2009,9 @@ static void
get_image_offset_sa_gen4_2d(const struct isl_surf *surf,
uint32_t level, uint32_t logical_array_layer,
uint32_t *x_offset_sa,
- uint32_t *y_offset_sa)
+ uint32_t *y_offset_sa,
+ uint32_t *z_offset_sa,
+ uint32_t *array_offset)
{
assert(level < surf->levels);
if (surf->dim == ISL_SURF_DIM_3D)
@@ -2026,8 +2028,21 @@ get_image_offset_sa_gen4_2d(const struct isl_surf *surf,
const uint32_t phys_layer = logical_array_layer *
(surf->msaa_layout == ISL_MSAA_LAYOUT_ARRAY ? surf->samples : 1);
- uint32_t x = 0;
- uint32_t y = phys_layer * isl_surf_get_array_pitch_sa_rows(surf);
+ uint32_t x = 0, y;
+ if (isl_tiling_is_std_y(surf->tiling)) {
+ y = 0;
+ if (surf->dim == ISL_SURF_DIM_3D) {
+ *z_offset_sa = logical_array_layer;
+ *array_offset = 0;
+ } else {
+ *z_offset_sa = 0;
+ *array_offset = phys_layer;
+ }
+ } else {
+ y = phys_layer * isl_surf_get_array_pitch_sa_rows(surf);
+ *z_offset_sa = 0;
+ *array_offset = 0;
+ }
for (uint32_t l = 0; l < level; ++l) {
if (l == 1) {
@@ -2167,7 +2182,9 @@ static void
get_image_offset_sa_gen9_1d(const struct isl_surf *surf,
uint32_t level, uint32_t layer,
uint32_t *x_offset_sa,
- uint32_t *y_offset_sa)
+ uint32_t *y_offset_sa,
+ uint32_t *z_offset_sa,
+ uint32_t *array_offset)
{
assert(level < surf->levels);
assert(layer < surf->phys_level0_sa.array_len);
@@ -2189,7 +2206,15 @@ get_image_offset_sa_gen9_1d(const struct isl_surf *surf,
}
*x_offset_sa = x;
- *y_offset_sa = layer * isl_surf_get_array_pitch_sa_rows(surf);
+ *z_offset_sa = 0;
+ if (surf->tiling == ISL_TILING_LINEAR) {
+ *y_offset_sa = layer * isl_surf_get_array_pitch_sa_rows(surf);
+ *array_offset = 0;
+ } else {
+ assert(isl_tiling_is_std_y(surf->tiling));
+ *y_offset_sa = 0;
+ *array_offset = layer;
+ }
}
/**
@@ -2218,16 +2243,14 @@ isl_surf_get_image_offset_sa(const struct isl_surf *surf,
switch (surf->dim_layout) {
case ISL_DIM_LAYOUT_GEN9_1D:
get_image_offset_sa_gen9_1d(surf, level, logical_array_layer,
- x_offset_sa, y_offset_sa);
- *z_offset_sa = 0;
- *array_offset = 0;
+ x_offset_sa, y_offset_sa,
+ z_offset_sa, array_offset);
break;
case ISL_DIM_LAYOUT_GEN4_2D:
get_image_offset_sa_gen4_2d(surf, level, logical_array_layer
+ logical_z_offset_px,
- x_offset_sa, y_offset_sa);
- *z_offset_sa = 0;
- *array_offset = 0;
+ x_offset_sa, y_offset_sa,
+ z_offset_sa, array_offset);
break;
case ISL_DIM_LAYOUT_GEN4_3D:
get_image_offset_sa_gen4_3d(surf, level, logical_array_layer +
--
2.19.1
More information about the mesa-dev
mailing list