[Mesa-dev] [PATCH 10/12] i965: Drop a layer of indirection in doing HiZ resolves.

Eric Anholt eric at anholt.net
Tue May 22 10:21:51 PDT 2012


---
 src/mesa/drivers/dri/i965/brw_vtbl.c           |   12 ----------
 src/mesa/drivers/dri/i965/gen6_blorp.cpp       |   21 ------------------
 src/mesa/drivers/dri/i965/gen6_blorp.h         |   12 ----------
 src/mesa/drivers/dri/i965/gen7_blorp.cpp       |   22 -------------------
 src/mesa/drivers/dri/i965/gen7_blorp.h         |   14 ------------
 src/mesa/drivers/dri/intel/intel_context.h     |   20 -----------------
 src/mesa/drivers/dri/intel/intel_mipmap_tree.c |   28 ++++++++----------------
 7 files changed, 9 insertions(+), 120 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c b/src/mesa/drivers/dri/i965/brw_vtbl.c
index 7331934..587c07d 100644
--- a/src/mesa/drivers/dri/i965/brw_vtbl.c
+++ b/src/mesa/drivers/dri/i965/brw_vtbl.c
@@ -237,18 +237,6 @@ void brwInitVtbl( struct brw_context *brw )
    brw->intel.vtbl.render_target_supported = brw_render_target_supported;
    brw->intel.vtbl.is_hiz_depth_format = brw_is_hiz_depth_format;
 
-   if (brw->intel.has_hiz) {
-      if (brw->intel.gen == 7) {
-         brw->intel.vtbl.resolve_depth_slice = gen7_resolve_depth_slice;
-         brw->intel.vtbl.resolve_hiz_slice = gen7_resolve_hiz_slice;
-      } else if (brw->intel.gen == 6) {
-         brw->intel.vtbl.resolve_depth_slice = gen6_resolve_depth_slice;
-         brw->intel.vtbl.resolve_hiz_slice = gen6_resolve_hiz_slice;
-      } else {
-         assert(0);
-      }
-   }
-
    if (brw->intel.gen >= 7) {
       gen7_init_vtable_surface_functions(brw);
    } else if (brw->intel.gen >= 4) {
diff --git a/src/mesa/drivers/dri/i965/gen6_blorp.cpp b/src/mesa/drivers/dri/i965/gen6_blorp.cpp
index 6db8f40..49a433b 100644
--- a/src/mesa/drivers/dri/i965/gen6_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/gen6_blorp.cpp
@@ -1062,24 +1062,3 @@ gen6_blorp_exec(struct intel_context *intel,
    brw->state.dirty.cache = ~0;
 }
 
-/** \see intel_context::vtbl::resolve_hiz_slice */
-void
-gen6_resolve_hiz_slice(struct intel_context *intel,
-                       struct intel_mipmap_tree *mt,
-                       uint32_t level,
-                       uint32_t layer)
-{
-   brw_hiz_op_params params(mt, level, layer, GEN6_HIZ_OP_HIZ_RESOLVE);
-   gen6_blorp_exec(intel, &params);
-}
-
-/** \see intel_context::vtbl::resolve_depth_slice */
-void
-gen6_resolve_depth_slice(struct intel_context *intel,
-                         struct intel_mipmap_tree *mt,
-                         uint32_t level,
-                         uint32_t layer)
-{
-   brw_hiz_op_params params(mt, level, layer, GEN6_HIZ_OP_DEPTH_RESOLVE);
-   gen6_blorp_exec(intel, &params);
-}
diff --git a/src/mesa/drivers/dri/i965/gen6_blorp.h b/src/mesa/drivers/dri/i965/gen6_blorp.h
index 8096148..969ead1 100644
--- a/src/mesa/drivers/dri/i965/gen6_blorp.h
+++ b/src/mesa/drivers/dri/i965/gen6_blorp.h
@@ -32,18 +32,6 @@ extern "C" {
 struct intel_context;
 struct intel_mipmap_tree;
 
-void
-gen6_resolve_hiz_slice(struct intel_context *intel,
-                       struct intel_mipmap_tree *mt,
-                       uint32_t level,
-                       uint32_t layer);
-
-void
-gen6_resolve_depth_slice(struct intel_context *intel,
-                         struct intel_mipmap_tree *mt,
-                         uint32_t level,
-                         uint32_t layer);
-
 #ifdef __cplusplus
 }
 
diff --git a/src/mesa/drivers/dri/i965/gen7_blorp.cpp b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
index fbb94df..7ef0d36 100644
--- a/src/mesa/drivers/dri/i965/gen7_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
@@ -783,25 +783,3 @@ gen7_blorp_exec(struct intel_context *intel,
    brw->state.dirty.brw = ~0;
    brw->state.dirty.cache = ~0;
 }
-
-/** \copydoc gen6_resolve_hiz_slice() */
-void
-gen7_resolve_hiz_slice(struct intel_context *intel,
-                       struct intel_mipmap_tree *mt,
-                       uint32_t level,
-                       uint32_t layer)
-{
-   brw_hiz_op_params params(mt, level, layer, GEN6_HIZ_OP_HIZ_RESOLVE);
-   gen7_blorp_exec(intel, &params);
-}
-
-/** \copydoc gen6_resolve_depth_slice() */
-void
-gen7_resolve_depth_slice(struct intel_context *intel,
-                         struct intel_mipmap_tree *mt,
-                         uint32_t level,
-                         uint32_t layer)
-{
-   brw_hiz_op_params params(mt, level, layer, GEN6_HIZ_OP_DEPTH_RESOLVE);
-   gen7_blorp_exec(intel, &params);
-}
diff --git a/src/mesa/drivers/dri/i965/gen7_blorp.h b/src/mesa/drivers/dri/i965/gen7_blorp.h
index 43e4a10..caf5640 100644
--- a/src/mesa/drivers/dri/i965/gen7_blorp.h
+++ b/src/mesa/drivers/dri/i965/gen7_blorp.h
@@ -32,20 +32,6 @@ extern "C" {
 struct intel_context;
 struct intel_mipmap_tree;
 
-/** \copydoc gen6_resolve_hiz_slice() */
-void
-gen7_resolve_hiz_slice(struct intel_context *intel,
-                       struct intel_mipmap_tree *mt,
-                       uint32_t level,
-                       uint32_t layer);
-
-/** \copydoc gen6_resolve_depth_slice() */
-void
-gen7_resolve_depth_slice(struct intel_context *intel,
-                         struct intel_mipmap_tree *mt,
-                         uint32_t level,
-                         uint32_t layer);
-
 #ifdef __cplusplus
 }
 
diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h
index 065f1d6..9a140da 100644
--- a/src/mesa/drivers/dri/intel/intel_context.h
+++ b/src/mesa/drivers/dri/intel/intel_context.h
@@ -185,26 +185,6 @@ struct intel_context
 	                          gl_format format);
 
       /**
-       * \name HiZ operations
-       *
-       * See the following sections of the Sandy Bridge PRM, Volume 1, Part2:
-       *   - 7.5.3.1 Depth Buffer Clear
-       *   - 7.5.3.2 Depth Buffer Resolve
-       *   - 7.5.3.3 Hierarchical Depth Buffer Resolve
-       * \{
-       */
-      void (*resolve_hiz_slice)(struct intel_context *intel,
-				struct intel_mipmap_tree *mt,
-				uint32_t level,
-				uint32_t layer);
-
-      void (*resolve_depth_slice)(struct intel_context *intel,
-				  struct intel_mipmap_tree *mt,
-				  uint32_t level,
-				  uint32_t layer);
-      /** \} */
-
-      /**
        * Surface state operations (i965+ only)
        * \{
        */
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
index 2042afd..40cd3d0 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
@@ -608,18 +608,12 @@ intel_miptree_slice_set_needs_depth_resolve(struct intel_mipmap_tree *mt,
 			 level, layer, GEN6_HIZ_OP_DEPTH_RESOLVE);
 }
 
-typedef void (*resolve_func_t)(struct intel_context *intel,
-			       struct intel_mipmap_tree *mt,
-			       uint32_t level,
-			       uint32_t layer);
-
 static bool
 intel_miptree_slice_resolve(struct intel_context *intel,
 			    struct intel_mipmap_tree *mt,
 			    uint32_t level,
 			    uint32_t layer,
-			    enum gen6_hiz_op need,
-			    resolve_func_t func)
+			    enum gen6_hiz_op need)
 {
    intel_miptree_check_level_layer(mt, level, layer);
 
@@ -629,7 +623,7 @@ intel_miptree_slice_resolve(struct intel_context *intel,
    if (!item || item->need != need)
       return false;
 
-   func(intel, mt, level, layer);
+   intel_hiz_exec(intel, mt, level, layer, need);
    intel_resolve_map_remove(item);
    return true;
 }
@@ -641,8 +635,7 @@ intel_miptree_slice_resolve_hiz(struct intel_context *intel,
 				uint32_t layer)
 {
    return intel_miptree_slice_resolve(intel, mt, level, layer,
-				      GEN6_HIZ_OP_HIZ_RESOLVE,
-				      intel->vtbl.resolve_hiz_slice);
+				      GEN6_HIZ_OP_HIZ_RESOLVE);
 }
 
 bool
@@ -652,15 +645,13 @@ intel_miptree_slice_resolve_depth(struct intel_context *intel,
 				  uint32_t layer)
 {
    return intel_miptree_slice_resolve(intel, mt, level, layer,
-				      GEN6_HIZ_OP_DEPTH_RESOLVE,
-				      intel->vtbl.resolve_depth_slice);
+				      GEN6_HIZ_OP_DEPTH_RESOLVE);
 }
 
 static bool
 intel_miptree_all_slices_resolve(struct intel_context *intel,
 				 struct intel_mipmap_tree *mt,
-				 enum gen6_hiz_op need,
-				 resolve_func_t func)
+				 enum gen6_hiz_op need)
 {
    bool did_resolve = false;
    struct intel_resolve_map *i, *next;
@@ -669,7 +660,8 @@ intel_miptree_all_slices_resolve(struct intel_context *intel,
       next = i->next;
       if (i->need != need)
 	 continue;
-      func(intel, mt, i->level, i->layer);
+
+      intel_hiz_exec(intel, mt, i->level, i->layer, need);
       intel_resolve_map_remove(i);
       did_resolve = true;
    }
@@ -682,8 +674,7 @@ intel_miptree_all_slices_resolve_hiz(struct intel_context *intel,
 				     struct intel_mipmap_tree *mt)
 {
    return intel_miptree_all_slices_resolve(intel, mt,
-					   GEN6_HIZ_OP_HIZ_RESOLVE,
-					   intel->vtbl.resolve_hiz_slice);
+					   GEN6_HIZ_OP_HIZ_RESOLVE);
 }
 
 bool
@@ -691,8 +682,7 @@ intel_miptree_all_slices_resolve_depth(struct intel_context *intel,
 				       struct intel_mipmap_tree *mt)
 {
    return intel_miptree_all_slices_resolve(intel, mt,
-					   GEN6_HIZ_OP_DEPTH_RESOLVE,
-					   intel->vtbl.resolve_depth_slice);
+					   GEN6_HIZ_OP_DEPTH_RESOLVE);
 }
 
 static void
-- 
1.7.10



More information about the mesa-dev mailing list