[Mesa-dev] [v3 05/19] i965/gen6: Add back-to-back surface minify
Topi Pohjolainen
topi.pohjolainen at gmail.com
Mon May 15 12:07:55 UTC 2017
Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
src/mesa/drivers/dri/i965/brw_tex_layout.c | 25 +++++++++++++++++++++++++
src/mesa/drivers/dri/i965/intel_mipmap_tree.h | 3 +++
2 files changed, 28 insertions(+)
diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c b/src/mesa/drivers/dri/i965/brw_tex_layout.c
index bfa8afa..6f65334 100644
--- a/src/mesa/drivers/dri/i965/brw_tex_layout.c
+++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c
@@ -36,6 +36,7 @@
#include "brw_context.h"
#include "main/macros.h"
#include "main/glformats.h"
+#include "isl/isl_priv.h"
#define FILE_DEBUG_FLAG DEBUG_MIPTREE
@@ -662,3 +663,27 @@ brw_miptree_layout(struct brw_context *brw,
return true;
}
+/* Provide surface representing selected single level. */
+struct isl_surf
+gen6_back_to_back_minify(const struct isl_surf *surf, unsigned levels)
+{
+ struct isl_surf s = *surf;
+
+ s.logical_level0_px = isl_extent4d_minify(&surf->logical_level0_px,
+ surf->dim, levels);
+ s.phys_level0_sa = isl_extent4d_minify(&surf->phys_level0_sa,
+ surf->dim, levels);
+ s.levels = 1;
+
+ const struct isl_extent3d image_align_sa =
+ isl_surf_get_image_alignment_sa(surf);
+ const unsigned d = s.dim == ISL_SURF_DIM_3D ?
+ s.phys_level0_sa.depth : s.phys_level0_sa.array_len;
+ const unsigned aligned_h =
+ isl_align_npot(s.phys_level0_sa.height, image_align_sa.h);
+
+ const uint32_t tile_align_h = surf->tiling == ISL_TILING_W ? 64 : 32;
+ s.size = ALIGN(d * aligned_h, tile_align_h) * s.row_pitch;
+
+ return s;
+}
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
index 4bc30a2..d004820 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
@@ -1005,6 +1005,9 @@ bool
intel_miptree_sample_with_hiz(struct brw_context *brw,
struct intel_mipmap_tree *mt);
+struct isl_surf
+gen6_back_to_back_minify(const struct isl_surf *surf, unsigned levels);
+
#ifdef __cplusplus
}
#endif
--
2.9.3
More information about the mesa-dev
mailing list