[Mesa-dev] [PATCH 4/7] i965: Change the hiz-override env var to a driconf option.

Eric Anholt eric at anholt.net
Tue Mar 6 14:57:15 PST 2012


The force-enable option is dropped, now that the hardware we were
concerned about has HiZ on by default.  Now, instead of doing
INTEL_HIZ=0 to test disabling hiz, you can set hiz=false.
---
 src/mesa/drivers/dri/intel/intel_context.c |    5 +++-
 src/mesa/drivers/dri/intel/intel_screen.c  |   31 ++++-----------------------
 src/mesa/drivers/dri/intel/intel_screen.h  |    1 -
 3 files changed, 9 insertions(+), 28 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index 5432fb1..3101ef2 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -627,7 +627,7 @@ intelInitContext(struct intel_context *intel,
 
    intel->has_separate_stencil = intel->intelScreen->hw_has_separate_stencil;
    intel->must_use_separate_stencil = intel->intelScreen->hw_must_use_separate_stencil;
-   intel->has_hiz = intel->intelScreen->hw_has_hiz;
+   intel->has_hiz = intel->gen >= 6;
    intel->has_llc = intel->intelScreen->hw_has_llc;
    intel->has_swizzling = intel->intelScreen->hw_has_swizzling;
 
@@ -740,6 +740,9 @@ intelInitContext(struct intel_context *intel,
 					       "texture_tiling");
    intel->use_early_z = driQueryOptionb(&intel->optionCache, "early_z");
 
+   if (!driQueryOptionb(&intel->optionCache, "hiz"))
+       intel->has_hiz = false;
+
    intel->prim.primitive = ~0;
 
    /* Force all software fallbacks */
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
index 39c9fb4..d477aaf 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -57,6 +57,10 @@ PUBLIC const char __driConfigOptions[] =
 	 DRI_CONF_DESC(en, "Enable texture tiling")
       DRI_CONF_OPT_END
 
+      DRI_CONF_OPT_BEGIN(hiz, bool, true)
+	 DRI_CONF_DESC(en, "Enable Hierarchical Z on gen6+")
+      DRI_CONF_OPT_END
+
       DRI_CONF_OPT_BEGIN(early_z, bool, false)
 	 DRI_CONF_DESC(en, "Enable early Z in classic mode (unstable, 945-only).")
       DRI_CONF_OPT_END
@@ -90,7 +94,7 @@ PUBLIC const char __driConfigOptions[] =
    DRI_CONF_SECTION_END
 DRI_CONF_END;
 
-const GLuint __driNConfigOptions = 14;
+const GLuint __driNConfigOptions = 15;
 
 #include "intel_batchbuffer.h"
 #include "intel_buffers.h"
@@ -624,29 +628,6 @@ intel_init_bufmgr(struct intel_screen *intelScreen)
 }
 
 /**
- * Override intel_screen.hw_has_hiz with environment variable INTEL_HIZ.
- *
- * Valid values for INTEL_HIZ are "0" and "1". If an invalid valid value is
- * encountered, a warning is emitted and INTEL_HIZ is ignored.
- */
-static void
-intel_override_hiz(struct intel_screen *intel)
-{
-   const char *s = getenv("INTEL_HIZ");
-   if (!s) {
-      return;
-   } else if (!strncmp("0", s, 2)) {
-      intel->hw_has_hiz = false;
-   } else if (!strncmp("1", s, 2)) {
-      intel->hw_has_hiz = true;
-   } else {
-      fprintf(stderr,
-	      "warning: env variable INTEL_HIZ=\"%s\" has invalid value "
-	      "and is ignored", s);
-   }
-}
-
-/**
  * Override intel_screen.hw_has_separate_stencil with environment variable
  * INTEL_SEPARATE_STENCIL.
  *
@@ -765,7 +746,6 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
 
    intelScreen->hw_has_separate_stencil = intelScreen->gen >= 6;
    intelScreen->hw_must_use_separate_stencil = intelScreen->gen >= 7;
-   intelScreen->hw_has_hiz = intelScreen->gen >= 6;
    intelScreen->dri2_has_hiz = INTEL_DRI2_HAS_HIZ_UNKNOWN;
 
 #if defined(I915_PARAM_HAS_LLC)
@@ -776,7 +756,6 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
    intelScreen->hw_has_llc = intelScreen->gen >= 6;
 #endif
 
-   intel_override_hiz(intelScreen);
    intel_override_separate_stencil(intelScreen);
 
    api_mask = (1 << __DRI_API_OPENGL);
diff --git a/src/mesa/drivers/dri/intel/intel_screen.h b/src/mesa/drivers/dri/intel/intel_screen.h
index 1998f7e..3f03641 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.h
+++ b/src/mesa/drivers/dri/intel/intel_screen.h
@@ -111,7 +111,6 @@ struct intel_screen
     */
    bool hw_has_separate_stencil;
    bool hw_must_use_separate_stencil;
-   bool hw_has_hiz;
    enum intel_dri2_has_hiz dri2_has_hiz;
 
    bool kernel_has_gen7_sol_reset;
-- 
1.7.9.1



More information about the mesa-dev mailing list