[Mesa-dev] [PATCH 02/12] intel: Override intel_context.use_hiz with env var INTEL_USE_HIZ

chad at chad-versace.us chad at chad-versace.us
Fri Apr 29 18:04:52 PDT 2011


From: Chad Versace <chad.versace at intel.com>

Valid values for INTEL_USE_HIZ are "0" or "1".
Overriding HiZ is useful for performance profiling and testing.

Signed-off-by: Chad Versace <chad.versace at intel.com>
---
 src/mesa/drivers/dri/intel/intel_context.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index 07ce8de..940478a 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -609,6 +609,29 @@ intelInitDriverFunctions(struct dd_function_table *functions)
    intel_init_syncobj_functions(functions);
 }
 
+/**
+ * \brief Override intel->use_hiz with environment variable INTEL_USE_HIZ.
+ *
+ * Valid values for INTEL_USE_HIZ are "0" and "1". If an invalid valid value
+ * is encountered, an error is emitted and INTEL_USE_HIZ is ignored.
+ */
+static void
+intel_override_hiz(struct intel_context *intel)
+{
+   const char *s = getenv("INTEL_USE_HIZ");
+   if (!s) {
+      return;
+   } else if (!strcmp("0", s)) {
+      intel->use_hiz = false;
+   } else if (!strcmp("1", s)) {
+      intel->use_hiz = true;
+   } else {
+      _mesa_warning(&intel->ctx,
+                    "env variable INTEL_USE_HIZ=\"%s\" has invalid value and "
+                    "is ignored", s);
+   }
+}
+
 
 GLboolean
 intelInitContext(struct intel_context *intel,
@@ -677,6 +700,7 @@ intelInitContext(struct intel_context *intel,
 
    /* FINISHME: When HiZ implementation is complete, enable it for Gen >= 5. */
    intel->use_hiz = false;
+   intel_override_hiz(intel);
 
    memset(&ctx->TextureFormatSupported, 0,
 	  sizeof(ctx->TextureFormatSupported));
-- 
1.7.4.2



More information about the mesa-dev mailing list