summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorChad Versace <[email protected]>2011-05-26 15:24:48 -0700
committerChad Versace <[email protected]>2011-06-08 10:06:40 -0700
commit6b2bf272ee173bd8ee6c731500861de21fa01b5f (patch)
treed7a63475e341b52a4434f3c949c5fd9b892eb8f5 /src/mesa
parentdf9f533c67e06713ae1b7f759c3644ca610058fd (diff)
intel: Add flags to intel_screen for hiz and separate stencil
Add the fields below to intel_screen. The expression in parens is the value to which intelInitScreen2() currently sets the field. GLboolean hw_has_separate_stencil (true iff gen >= 7) GLboolean hw_must_use_separate_stencil (true iff gen >= 7) GLboolean hw_has_hiz (always false) enum intel_dri2_has_hiz dri2_has_hiz (INTEL_DRI2_HAS_HIZ_UNKNOWN) The analogous fields in intel_context now inherit their values from intel_screen. When hiz and separate stencil become completely implemented for a given chipset, then the respective fields need to be enabled. CC: Ian Romanick <[email protected]> CC: Kristian Høgsberg <[email protected]> Acked-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Signed-off-by: Chad Versace <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/intel/intel_context.c10
-rw-r--r--src/mesa/drivers/dri/intel/intel_screen.c60
-rw-r--r--src/mesa/drivers/dri/intel/intel_screen.h10
3 files changed, 73 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index b6a017a876c..22704a30e1c 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -704,14 +704,9 @@ intelInitContext(struct intel_context *intel,
if (IS_GEN7(intel->intelScreen->deviceID)) {
intel->needs_ff_sync = GL_TRUE;
intel->has_luminance_srgb = GL_TRUE;
- /* FINISHME: Enable intel->has_separate_stencil on Gen7. */
- /* FINISHME: Enable intel->must_use_separate_stencil on Gen7. */
- /* FINISHME: Enable intel->has_hiz on Gen7. */
} else if (IS_GEN6(intel->intelScreen->deviceID)) {
intel->needs_ff_sync = GL_TRUE;
intel->has_luminance_srgb = GL_TRUE;
- /* FINISHME: Enable intel->has_separate_stencil on Gen6. */
- /* FINISHME: Enable intel->has_hiz on Gen6. */
} else if (IS_GEN5(intel->intelScreen->deviceID)) {
intel->needs_ff_sync = GL_TRUE;
intel->has_luminance_srgb = GL_TRUE;
@@ -731,8 +726,9 @@ intelInitContext(struct intel_context *intel,
}
}
- intel_override_hiz(intel);
- intel_override_separate_stencil(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;
memset(&ctx->TextureFormatSupported, 0,
sizeof(ctx->TextureFormatSupported));
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
index deca11d8c34..646b96051d9 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -507,6 +507,54 @@ 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.
+ *
+ * Valid values for INTEL_SEPARATE_STENCIL are "0" and "1". If an invalid
+ * valid value is encountered, a warning is emitted and INTEL_SEPARATE_STENCIL
+ * is ignored.
+ */
+static void
+intel_override_separate_stencil(struct intel_screen *screen)
+{
+ const char *s = getenv("INTEL_SEPARATE_STENCIL");
+ if (!s) {
+ return;
+ } else if (!strncmp("0", s, 2)) {
+ screen->hw_has_separate_stencil = false;
+ } else if (!strncmp("1", s, 2)) {
+ screen->hw_has_separate_stencil = true;
+ } else {
+ fprintf(stderr,
+ "warning: env variable INTEL_SEPARATE_STENCIL=\"%s\" has "
+ "invalid value and is ignored", s);
+ }
+}
+
+/**
* This is the driver specific part of the createNewScreen entry point.
* Called when using DRI2.
*
@@ -570,6 +618,18 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
intelScreen->gen = 2;
}
+ /*
+ * FIXME: The hiz and separate stencil fields need updating once the
+ * FIXME: features are completely implemented for a given chipset.
+ */
+ intelScreen->hw_has_separate_stencil = intelScreen->gen >= 7;
+ intelScreen->hw_must_use_separate_stencil = intelScreen->gen >= 7;
+ intelScreen->hw_has_hiz = false;
+ intelScreen->dri2_has_hiz = INTEL_DRI2_HAS_HIZ_UNKNOWN;
+
+ intel_override_hiz(intelScreen);
+ intel_override_separate_stencil(intelScreen);
+
api_mask = (1 << __DRI_API_OPENGL);
#if FEATURE_ES1
api_mask |= (1 << __DRI_API_GLES);
diff --git a/src/mesa/drivers/dri/intel/intel_screen.h b/src/mesa/drivers/dri/intel/intel_screen.h
index 5d13dfba612..b4afae9d62f 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.h
+++ b/src/mesa/drivers/dri/intel/intel_screen.h
@@ -102,6 +102,16 @@ struct intel_screen
GLboolean no_hw;
GLuint relaxed_relocations;
+ /*
+ * The hardware hiz and separate stencil fields are needed in intel_screen,
+ * rather than solely in intel_context, because glXCreatePbuffer and
+ * glXCreatePixmap are not passed a GLXContext.
+ */
+ GLboolean hw_has_separate_stencil;
+ GLboolean hw_must_use_separate_stencil;
+ GLboolean hw_has_hiz;
+ enum intel_dri2_has_hiz dri2_has_hiz;
+
GLboolean no_vbo;
dri_bufmgr *bufmgr;
struct _mesa_HashTable *named_regions;