Mesa (main): intel/isl: Add a isl_surf_get_image_offset_B_tile_el helper
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Jun 11 21:12:18 UTC 2021
Module: Mesa
Branch: main
Commit: 0eb3d0a8df0775914ad617be4a9e9daceca25e8c
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0eb3d0a8df0775914ad617be4a9e9daceca25e8c
Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date: Wed Feb 21 02:22:41 2018 -0800
intel/isl: Add a isl_surf_get_image_offset_B_tile_el helper
Reviewed-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11330>
---
src/intel/isl/isl.c | 45 ++++++++++++++++++++++++++++++++-------------
src/intel/isl/isl.h | 20 ++++++++++++++++++++
2 files changed, 52 insertions(+), 13 deletions(-)
diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c
index 44b9aad7623..8e502be963e 100644
--- a/src/intel/isl/isl.c
+++ b/src/intel/isl/isl.c
@@ -2593,20 +2593,13 @@ isl_surf_get_image_offset_B_tile_sa(const struct isl_surf *surf,
{
const struct isl_format_layout *fmtl = isl_format_get_layout(surf->format);
- uint32_t total_x_offset_el, total_y_offset_el;
- isl_surf_get_image_offset_el(surf, level, logical_array_layer,
- logical_z_offset_px,
- &total_x_offset_el,
- &total_y_offset_el);
-
uint32_t x_offset_el, y_offset_el;
- isl_tiling_get_intratile_offset_el(surf->tiling, fmtl->bpb,
- surf->row_pitch_B,
- total_x_offset_el,
- total_y_offset_el,
- offset_B,
- &x_offset_el,
- &y_offset_el);
+ isl_surf_get_image_offset_B_tile_el(surf, level,
+ logical_array_layer,
+ logical_z_offset_px,
+ offset_B,
+ &x_offset_el,
+ &y_offset_el);
if (x_offset_sa) {
*x_offset_sa = x_offset_el * fmtl->bw;
@@ -2621,6 +2614,32 @@ isl_surf_get_image_offset_B_tile_sa(const struct isl_surf *surf,
}
}
+void
+isl_surf_get_image_offset_B_tile_el(const struct isl_surf *surf,
+ uint32_t level,
+ uint32_t logical_array_layer,
+ uint32_t logical_z_offset_px,
+ uint32_t *offset_B,
+ uint32_t *x_offset_el,
+ uint32_t *y_offset_el)
+{
+ const struct isl_format_layout *fmtl = isl_format_get_layout(surf->format);
+
+ uint32_t total_x_offset_el, total_y_offset_el;
+ isl_surf_get_image_offset_el(surf, level, logical_array_layer,
+ logical_z_offset_px,
+ &total_x_offset_el,
+ &total_y_offset_el);
+
+ isl_tiling_get_intratile_offset_el(surf->tiling, fmtl->bpb,
+ surf->row_pitch_B,
+ total_x_offset_el,
+ total_y_offset_el,
+ offset_B,
+ x_offset_el,
+ y_offset_el);
+}
+
void
isl_surf_get_image_range_B_tile(const struct isl_surf *surf,
uint32_t level,
diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h
index d6bf23f961d..937ea553733 100644
--- a/src/intel/isl/isl.h
+++ b/src/intel/isl/isl.h
@@ -2288,6 +2288,26 @@ isl_surf_get_image_offset_B_tile_sa(const struct isl_surf *surf,
uint32_t *x_offset_sa,
uint32_t *y_offset_sa);
+/**
+ * Calculate the offset, in bytes and intratile surface elements, to a
+ * subimage in the surface.
+ *
+ * This is equivalent to calling isl_surf_get_image_offset_el, passing the
+ * result to isl_tiling_get_intratile_offset_el.
+ *
+ * @invariant level < surface levels
+ * @invariant logical_array_layer < logical array length of surface
+ * @invariant logical_z_offset_px < logical depth of surface at level
+ */
+void
+isl_surf_get_image_offset_B_tile_el(const struct isl_surf *surf,
+ uint32_t level,
+ uint32_t logical_array_layer,
+ uint32_t logical_z_offset_px,
+ uint32_t *offset_B,
+ uint32_t *x_offset_el,
+ uint32_t *y_offset_el);
+
/**
* Calculate the range in bytes occupied by a subimage, to the nearest tile.
*
More information about the mesa-commit
mailing list