summaryrefslogtreecommitdiffstats
path: root/src/intel/isl
diff options
context:
space:
mode:
authorNanley Chery <[email protected]>2019-05-23 13:44:52 -0700
committerNanley Chery <[email protected]>2019-06-27 23:38:37 +0000
commitfb1350c76f1525e6bd320cef62d55aff19ec3f05 (patch)
treecf27fcd8a5ba2df254d30278c72c1ecab331e5aa /src/intel/isl
parent0ba0c0c15c633a5a3b7a4651a743f800f30bcbf6 (diff)
intel: Add and use helpers for level0 extent
Prepare for a bug fix by adding and using helpers which convert isl_surf::logical_level0_px and isl_surf::phys_level0_sa to units of surface elements. v2: - Update iris (Ken). - Update anv. Cc: <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/intel/isl')
-rw-r--r--src/intel/isl/isl.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h
index 0218f05d175..162301e4bf6 100644
--- a/src/intel/isl/isl.h
+++ b/src/intel/isl/isl.h
@@ -1886,6 +1886,38 @@ isl_surf_get_image_alignment_sa(const struct isl_surf *surf)
}
/**
+ * Logical extent of level 0 in units of surface elements.
+ */
+static inline struct isl_extent4d
+isl_surf_get_logical_level0_el(const struct isl_surf *surf)
+{
+ const struct isl_format_layout *fmtl = isl_format_get_layout(surf->format);
+
+ return isl_extent4d(DIV_ROUND_UP(surf->logical_level0_px.w, fmtl->bw),
+ DIV_ROUND_UP(surf->logical_level0_px.h, fmtl->bh),
+ DIV_ROUND_UP(surf->logical_level0_px.d, fmtl->bd),
+ surf->logical_level0_px.a);
+}
+
+/**
+ * Physical extent of level 0 in units of surface elements.
+ */
+static inline struct isl_extent4d
+isl_surf_get_phys_level0_el(const struct isl_surf *surf)
+{
+ const struct isl_format_layout *fmtl = isl_format_get_layout(surf->format);
+
+ assert(surf->phys_level0_sa.w % fmtl->bw == 0);
+ assert(surf->phys_level0_sa.h % fmtl->bh == 0);
+ assert(surf->phys_level0_sa.d % fmtl->bd == 0);
+
+ return isl_extent4d(surf->phys_level0_sa.w / fmtl->bw,
+ surf->phys_level0_sa.h / fmtl->bh,
+ surf->phys_level0_sa.d / fmtl->bd,
+ surf->phys_level0_sa.a);
+}
+
+/**
* Pitch between vertically adjacent surface elements, in bytes.
*/
static inline uint32_t