summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/intel
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2011-12-01 14:06:58 -0800
committerIan Romanick <[email protected]>2012-01-02 12:41:45 -0800
commite532b6288f01b63d8d8ba8c8dc08292967e65490 (patch)
tree03a7f53f966be06796251869d964cb341fa9a213 /src/mesa/drivers/dri/intel
parent296fe21ae5be838268e51fdd9a4a3009ab961265 (diff)
dri2: Add plumbing to get context version requirements and flags to drivers
This adds support for DRI_DRI2 version 3 to all of the DRI2 drivers. Signed-off-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/intel')
-rw-r--r--src/mesa/drivers/dri/intel/intel_screen.c37
1 files changed, 31 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
index e4cc5b0864e..76b231b80b1 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -516,27 +516,52 @@ static GLboolean
intelCreateContext(gl_api api,
const struct gl_config * mesaVis,
__DRIcontext * driContextPriv,
+ unsigned major_version,
+ unsigned minor_version,
+ uint32_t flags,
+ unsigned *error,
void *sharedContextPrivate)
{
__DRIscreen *sPriv = driContextPriv->driScreenPriv;
struct intel_screen *intelScreen = sPriv->driverPrivate;
+ bool success;
#ifdef I915
if (IS_9XX(intelScreen->deviceID)) {
if (!IS_965(intelScreen->deviceID)) {
- return i915CreateContext(api, mesaVis, driContextPriv,
- sharedContextPrivate);
+ success = i915CreateContext(api, mesaVis, driContextPriv,
+ sharedContextPrivate);
}
} else {
intelScreen->no_vbo = true;
- return i830CreateContext(mesaVis, driContextPriv, sharedContextPrivate);
+ success = i830CreateContext(mesaVis, driContextPriv,
+ sharedContextPrivate);
}
#else
if (IS_965(intelScreen->deviceID))
- return brwCreateContext(api, mesaVis,
- driContextPriv, sharedContextPrivate);
+ success = brwCreateContext(api, mesaVis,
+ driContextPriv,
+ sharedContextPrivate);
#endif
- fprintf(stderr, "Unrecognized deviceID 0x%x\n", intelScreen->deviceID);
+
+ if (success) {
+ struct gl_context *ctx =
+ (struct gl_context *) driContextPriv->driverPrivate;
+
+ _mesa_compute_version(ctx);
+ if (ctx->VersionMajor > major_version
+ || (ctx->VersionMajor == major_version
+ && ctx->VersionMinor >= minor_version)) {
+ *error = __DRI_CTX_ERROR_BAD_VERSION;
+ return true;
+ }
+
+ intelDestroyContext(driContextPriv);
+ } else {
+ *error = __DRI_CTX_ERROR_NO_MEMORY;
+ fprintf(stderr, "Unrecognized deviceID 0x%x\n", intelScreen->deviceID);
+ }
+
return false;
}