summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i915
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2013-09-26 12:01:56 -0700
committerEric Anholt <[email protected]>2013-10-10 16:34:30 -0700
commit083f66fdd6451648fe355b64b02b29a6a4389f0d (patch)
tree7965c2cd9f5b2f96ea1268ef6640d6e39ed55bff /src/mesa/drivers/dri/i915
parentd81632fb1e809a0b1ee9310ae3a4733a1c0651b7 (diff)
dri: Move API version validation into dri/common.
i965, i915, radeon, r200, swrast, and nouveau were mostly trying to do the same logic, except where they failed to. Notably, swrast had code that appeared to try to enable GLES1/2 but forgot to set api_mask (thus preventing any gles context from being created), and the non-intel drivers didn't support MESA_GL_VERSION_OVERRIDE. nouveau still relies on _mesa_compute_version(), because I don't know what its limits actually are, and gallium drivers don't declare limits up front at all. I think I've heard talk about doing so, though. v2: Compat max version should be 30 (noted by Ken) Drop r100's custom max version check, too (noted by Emil Velikov) Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i915')
-rw-r--r--src/mesa/drivers/dri/i915/intel_context.c44
-rw-r--r--src/mesa/drivers/dri/i915/intel_screen.c36
-rw-r--r--src/mesa/drivers/dri/i915/intel_screen.h5
3 files changed, 9 insertions, 76 deletions
diff --git a/src/mesa/drivers/dri/i915/intel_context.c b/src/mesa/drivers/dri/i915/intel_context.c
index f27e3d084ab..aff51e82540 100644
--- a/src/mesa/drivers/dri/i915/intel_context.c
+++ b/src/mesa/drivers/dri/i915/intel_context.c
@@ -367,45 +367,6 @@ intelInitDriverFunctions(struct dd_function_table *functions)
intel_init_syncobj_functions(functions);
}
-static bool
-validate_context_version(struct intel_screen *screen,
- int mesa_api,
- unsigned major_version,
- unsigned minor_version,
- unsigned *dri_ctx_error)
-{
- unsigned req_version = 10 * major_version + minor_version;
- unsigned max_version = 0;
-
- switch (mesa_api) {
- case API_OPENGL_COMPAT:
- max_version = screen->max_gl_compat_version;
- break;
- case API_OPENGL_CORE:
- max_version = screen->max_gl_core_version;
- break;
- case API_OPENGLES:
- max_version = screen->max_gl_es1_version;
- break;
- case API_OPENGLES2:
- max_version = screen->max_gl_es2_version;
- break;
- default:
- max_version = 0;
- break;
- }
-
- if (max_version == 0) {
- *dri_ctx_error = __DRI_CTX_ERROR_BAD_API;
- return false;
- } else if (req_version > max_version) {
- *dri_ctx_error = __DRI_CTX_ERROR_BAD_VERSION;
- return false;
- }
-
- return true;
-}
-
bool
intelInitContext(struct intel_context *intel,
int api,
@@ -430,11 +391,6 @@ intelInitContext(struct intel_context *intel,
return false;
}
- if (!validate_context_version(intelScreen,
- api, major_version, minor_version,
- dri_ctx_error))
- return false;
-
/* Can't rely on invalidate events, fall back to glViewport hack */
if (!driContextPriv->driScreenPriv->dri2.useInvalidate) {
intel->saved_viewport = functions->Viewport;
diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c
index e3e6ac28bef..4f8c342e8e2 100644
--- a/src/mesa/drivers/dri/i915/intel_screen.c
+++ b/src/mesa/drivers/dri/i915/intel_screen.c
@@ -1062,33 +1062,25 @@ intel_screen_make_configs(__DRIscreen *dri_screen)
static void
set_max_gl_versions(struct intel_screen *screen)
{
- int gl_version_override = _mesa_get_gl_version_override();
+ __DRIscreen *psp = screen->driScrnPriv;
switch (screen->gen) {
case 3:
- screen->max_gl_core_version = 0;
- screen->max_gl_es1_version = 11;
- screen->max_gl_compat_version = 21;
- screen->max_gl_es2_version = 20;
+ psp->max_gl_core_version = 0;
+ psp->max_gl_es1_version = 11;
+ psp->max_gl_compat_version = 21;
+ psp->max_gl_es2_version = 20;
break;
case 2:
- screen->max_gl_core_version = 0;
- screen->max_gl_compat_version = 13;
- screen->max_gl_es1_version = 11;
- screen->max_gl_es2_version = 0;
+ psp->max_gl_core_version = 0;
+ psp->max_gl_compat_version = 13;
+ psp->max_gl_es1_version = 11;
+ psp->max_gl_es2_version = 0;
break;
default:
assert(!"unrecognized intel_screen::gen");
break;
}
-
- if (gl_version_override >= 31) {
- screen->max_gl_core_version = MAX2(screen->max_gl_core_version,
- gl_version_override);
- } else {
- screen->max_gl_compat_version = MAX2(screen->max_gl_compat_version,
- gl_version_override);
- }
}
/**
@@ -1137,16 +1129,6 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
set_max_gl_versions(intelScreen);
- psp->api_mask = (1 << __DRI_API_OPENGL);
- if (intelScreen->max_gl_core_version > 0)
- psp->api_mask |= (1 << __DRI_API_OPENGL_CORE);
- if (intelScreen->max_gl_es1_version > 0)
- psp->api_mask |= (1 << __DRI_API_GLES);
- if (intelScreen->max_gl_es2_version > 0)
- psp->api_mask |= (1 << __DRI_API_GLES2);
- if (intelScreen->max_gl_es2_version >= 30)
- psp->api_mask |= (1 << __DRI_API_GLES3);
-
psp->extensions = intelScreenExtensions;
return (const __DRIconfig**) intel_screen_make_configs(psp);
diff --git a/src/mesa/drivers/dri/i915/intel_screen.h b/src/mesa/drivers/dri/i915/intel_screen.h
index a0ff0e07445..331ce90f7aa 100644
--- a/src/mesa/drivers/dri/i915/intel_screen.h
+++ b/src/mesa/drivers/dri/i915/intel_screen.h
@@ -40,11 +40,6 @@ struct intel_screen
int deviceID;
int gen;
- int max_gl_core_version;
- int max_gl_compat_version;
- int max_gl_es1_version;
- int max_gl_es2_version;
-
__DRIscreen *driScrnPriv;
bool no_hw;