[Mesa-dev] [PATCH 2/8] intel: Add functions for checking if objs have hiz enabled
Kenneth Graunke
kenneth at whitecape.org
Tue Apr 9 15:51:55 PDT 2013
From: Chad Versace <chad.versace at linux.intel.com>
On Haswell, HiZ will selectively be enabled on individual miptree slices
to workaround a hardware bug. The two new functions below will permit us
to detect if hiz is enabled for a particular slice.
intel_miptree_slice_has_hiz
intel_renderbuffer_has_hiz
The functions are not yet used.
Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
src/mesa/drivers/dri/intel/intel_fbo.c | 10 ++++++++++
src/mesa/drivers/dri/intel/intel_fbo.h | 3 +++
src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 12 ++++++++++++
src/mesa/drivers/dri/intel/intel_mipmap_tree.h | 11 +++++++++--
4 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c
index 2977568..0e2ded5 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -943,6 +943,16 @@ intel_renderbuffer_set_needs_downsample(struct intel_renderbuffer *irb)
irb->mt->need_downsample = true;
}
+/**
+ * Does the renderbuffer have hiz enabled?
+ */
+bool
+intel_renderbuffer_has_hiz(struct intel_renderbuffer *irb)
+{
+ return irb->mt &&
+ intel_miptree_slice_has_hiz(irb->mt, irb->mt_level, irb->mt_layer);
+}
+
void
intel_renderbuffer_set_needs_hiz_resolve(struct intel_renderbuffer *irb)
{
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.h b/src/mesa/drivers/dri/intel/intel_fbo.h
index 9313c35..19edbe7 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.h
+++ b/src/mesa/drivers/dri/intel/intel_fbo.h
@@ -166,6 +166,9 @@ intel_get_rb_region(struct gl_framebuffer *fb, GLuint attIndex);
void
intel_renderbuffer_set_needs_downsample(struct intel_renderbuffer *irb);
+bool
+intel_renderbuffer_has_hiz(struct intel_renderbuffer *irb);
+
void
intel_renderbuffer_set_needs_hiz_resolve(struct intel_renderbuffer *irb);
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
index 19c9088..fdb6504 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
@@ -1024,6 +1024,18 @@ intel_miptree_alloc_hiz(struct intel_context *intel,
return true;
}
+/**
+ * Does the miptree slice have hiz enabled?
+ */
+bool
+intel_miptree_slice_has_hiz(struct intel_mipmap_tree *mt,
+ uint32_t level,
+ uint32_t layer)
+{
+ intel_miptree_check_level_layer(mt, level, layer);
+ return mt->hiz_mt != NULL;
+}
+
void
intel_miptree_slice_set_needs_hiz_resolve(struct intel_mipmap_tree *mt,
uint32_t level,
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
index 3bdda07..f39ff06 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
@@ -333,9 +333,11 @@ struct intel_mipmap_tree
/**
* \brief HiZ miptree
*
- * This is non-null only if HiZ is enabled for this miptree.
+ * The hiz miptree contains the miptree's hiz buffer. To allocate the hiz
+ * miptree, use intel_miptree_alloc_hiz().
*
- * \see intel_miptree_alloc_hiz()
+ * To determine if hiz is enabled, do not check this pointer. Instead, use
+ * intel_miptree_slice_has_hiz().
*/
struct intel_mipmap_tree *hiz_mt;
@@ -532,6 +534,11 @@ intel_miptree_alloc_hiz(struct intel_context *intel,
struct intel_mipmap_tree *mt,
GLuint num_samples);
+bool
+intel_miptree_slice_has_hiz(struct intel_mipmap_tree *mt,
+ uint32_t level,
+ uint32_t layer);
+
void
intel_miptree_slice_set_needs_hiz_resolve(struct intel_mipmap_tree *mt,
uint32_t level,
--
1.8.2.1
More information about the mesa-dev
mailing list