[Mesa-dev] [PATCH 02/14] intel: Override intel_context.has_hiz with env var INTEL_HIZ

chad at chad-versace.us chad at chad-versace.us
Wed May 4 13:33:46 PDT 2011


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

Valid values for INTEL_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 |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index b1907f5..d91a300 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->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_context *intel)
+{
+   const char *s = getenv("INTEL_HIZ");
+   if (!s) {
+      return;
+   } else if (!strncmp("0", s, 2)) {
+      intel->has_hiz = false;
+   } else if (!strncmp("1", s, 2)) {
+      intel->has_hiz = true;
+   } else {
+      _mesa_warning(&intel->ctx,
+                    "env variable INTEL_HIZ=\"%s\" has invalid value and "
+                    "is ignored", s);
+   }
+}
+
 
 GLboolean
 intelInitContext(struct intel_context *intel,
@@ -677,6 +700,8 @@ intelInitContext(struct intel_context *intel,
       }
    }
 
+   intel_override_hiz(intel);
+
    memset(&ctx->TextureFormatSupported, 0,
 	  sizeof(ctx->TextureFormatSupported));
    ctx->TextureFormatSupported[MESA_FORMAT_ARGB8888] = GL_TRUE;
-- 
1.7.5



More information about the mesa-dev mailing list