From 87efb9c3b33660804c123c7db7e8e51edde95bb2 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Thu, 22 Feb 2018 14:53:59 -0800 Subject: [PATCH] intel/isl: Support Yf/Ys/Tile-64 in isl_surf_get_image_offset_sa All that's really needed here is to handle the array offsetting by using an Z or array offset instead of the Y offset. This patch originally changed get_image_offset_sa_gfx9_1d(), but since we only use linear with the 1d case, it was dropped. Rework: * Jordan: Include ISL_TILING_64 as well * Jordan: Drop change to get_image_offset_sa_gfx9_1d as recommended by Nanley Reviewed-by: Topi Pohjolainen Reviewed-by: Nanley Chery Part-of: --- src/intel/isl/isl.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c index 4d09800cd1b..c47abdcbf64 100644 --- a/src/intel/isl/isl.c +++ b/src/intel/isl/isl.c @@ -2440,7 +2440,9 @@ static void get_image_offset_sa_gfx4_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) @@ -2457,8 +2459,21 @@ get_image_offset_sa_gfx4_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) || surf->tiling == ISL_TILING_64) { + 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) { @@ -2656,9 +2671,8 @@ isl_surf_get_image_offset_sa(const struct isl_surf *surf, case ISL_DIM_LAYOUT_GFX4_2D: get_image_offset_sa_gfx4_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_GFX4_3D: get_image_offset_sa_gfx4_3d(surf, level, logical_array_layer +