[Mesa-dev] [PATCH 1/4] intel/isl: Improve the get_row_pitch helpers
Jason Ekstrand
jason at jlekstrand.net
Sat Nov 26 06:30:43 UTC 2016
We add units to isl_surf_get_row_pitch, add a version that gets the pitch
in tiles, and assert that row and array pitch helpers that work in units of
surface elements only work on linear surfaces.
---
src/intel/isl/isl.h | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h
index 07368f9..930420c 100644
--- a/src/intel/isl/isl.h
+++ b/src/intel/isl/isl.h
@@ -1336,7 +1336,7 @@ isl_surf_get_image_alignment_sa(const struct isl_surf *surf)
* Pitch between vertically adjacent surface elements, in bytes.
*/
static inline uint32_t
-isl_surf_get_row_pitch(const struct isl_surf *surf)
+isl_surf_get_row_pitch_B(const struct isl_surf *surf)
{
return surf->row_pitch;
}
@@ -1347,13 +1347,27 @@ isl_surf_get_row_pitch(const struct isl_surf *surf)
static inline uint32_t
isl_surf_get_row_pitch_el(const struct isl_surf *surf)
{
+ /* This only makes sense for linear surfaces */
+ assert(surf->tiling == ISL_TILING_LINEAR);
const struct isl_format_layout *fmtl = isl_format_get_layout(surf->format);
-
assert(surf->row_pitch % (fmtl->bpb / 8) == 0);
return surf->row_pitch / (fmtl->bpb / 8);
}
/**
+ * Pitch between vertically adjacent tiles, in units of tiles.
+ */
+static inline uint32_t
+isl_surf_get_row_pitch_tl(const struct isl_device *dev,
+ const struct isl_surf *surf)
+{
+ assert(surf->tiling != ISL_TILING_LINEAR);
+ struct isl_tile_info tile_info;
+ isl_surf_get_tile_info(dev, surf, &tile_info);
+ return surf->row_pitch / tile_info.phys_extent_B.width;
+}
+
+/**
* Pitch between physical array slices, in rows of surface elements.
*/
static inline uint32_t
@@ -1368,6 +1382,8 @@ isl_surf_get_array_pitch_el_rows(const struct isl_surf *surf)
static inline uint32_t
isl_surf_get_array_pitch_el(const struct isl_surf *surf)
{
+ /* This only makes sense for linear surfaces */
+ assert(surf->tiling == ISL_TILING_LINEAR);
return isl_surf_get_array_pitch_el_rows(surf) *
isl_surf_get_row_pitch_el(surf);
}
--
2.5.0.400.gff86faf
More information about the mesa-dev
mailing list