summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2013-12-07 22:02:11 -0800
committerCarl Worth <cworth@cworth.org>2014-01-02 15:57:40 -0800
commitdb0dc5c008f3f4a475de1c6471f99f45f7c5b7d6 (patch)
tree1ff455287724aac9a80169b40eda74c41d16052a /src/mesa
parentc2940d11d0b6b299676897ad7ef45e11fc8b6cfe (diff)
dri_util: Don't assume __DRIcontext->driverPrivate is a gl_context
The driverPrivate pointer is opaque to the driver and we can't assume it's a struct gl_context in dri_util.c. Instead provide a helper function to set the struct gl_context flags from the incoming DRI context flags. v2 (idr): Modify the other classic drivers to also use driContextSetFlags. I ran all the piglit GLX_ARB_create_context tests with i965 and classic swrast without regressions. Signed-off-by: Kristian Høgsberg <krh@bitplanet.net> Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> [v1] Reviewed-by: Eric Anholt <eric@anholt.net> Tested-by: Ilia Mirkin <imirkin@alum.mit.edu> [v1 on Gallium nouveau] Cc: "10.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit 38366c0c6e715314367b15680702e382d5c46a4a)
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/common/dri_util.c11
-rw-r--r--src/mesa/drivers/dri/common/dri_util.h3
-rw-r--r--src/mesa/drivers/dri/i915/i830_context.c3
-rw-r--r--src/mesa/drivers/dri/i915/i830_context.h1
-rw-r--r--src/mesa/drivers/dri/i915/i915_context.c3
-rw-r--r--src/mesa/drivers/dri/i915/i915_context.h1
-rw-r--r--src/mesa/drivers/dri/i915/intel_context.c1
-rw-r--r--src/mesa/drivers/dri/i915/intel_context.h1
-rw-r--r--src/mesa/drivers/dri/i915/intel_screen.c10
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c2
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_context.c2
-rw-r--r--src/mesa/drivers/dri/r200/r200_context.c2
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_context.c2
-rw-r--r--src/mesa/drivers/dri/swrast/swrast.c2
14 files changed, 34 insertions, 10 deletions
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index 0bce77ea9c7..9134a947591 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -438,16 +438,19 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
return NULL;
}
- struct gl_context *ctx = context->driverPrivate;
+ *error = __DRI_CTX_ERROR_SUCCESS;
+ return context;
+}
+
+void
+driContextSetFlags(struct gl_context *ctx, uint32_t flags)
+{
if ((flags & __DRI_CTX_FLAG_FORWARD_COMPATIBLE) != 0)
ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT;
if ((flags & __DRI_CTX_FLAG_DEBUG) != 0) {
ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_DEBUG_BIT;
ctx->Debug.DebugOutput = GL_TRUE;
}
-
- *error = __DRI_CTX_ERROR_SUCCESS;
- return context;
}
static __DRIcontext *
diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h
index 79a8564ad51..35f674e054b 100644
--- a/src/mesa/drivers/dri/common/dri_util.h
+++ b/src/mesa/drivers/dri/common/dri_util.h
@@ -289,6 +289,9 @@ dri2InvalidateDrawable(__DRIdrawable *drawable);
extern void
driUpdateFramebufferSize(struct gl_context *ctx, const __DRIdrawable *dPriv);
+extern void
+driContextSetFlags(struct gl_context *ctx, uint32_t flags);
+
extern const __DRIimageDriverExtension driImageDriverExtension;
#endif /* _DRI_UTIL_H_ */
diff --git a/src/mesa/drivers/dri/i915/i830_context.c b/src/mesa/drivers/dri/i915/i830_context.c
index b7553d87fdc..87d1a496ecc 100644
--- a/src/mesa/drivers/dri/i915/i830_context.c
+++ b/src/mesa/drivers/dri/i915/i830_context.c
@@ -56,6 +56,7 @@ i830CreateContext(int api,
__DRIcontext * driContextPriv,
unsigned major_version,
unsigned minor_version,
+ uint32_t flags,
unsigned *error,
void *sharedContextPrivate)
{
@@ -73,7 +74,7 @@ i830CreateContext(int api,
i830InitDriverFunctions(&functions);
if (!intelInitContext(intel, __DRI_API_OPENGL,
- major_version, minor_version,
+ major_version, minor_version, flags,
mesaVis, driContextPriv,
sharedContextPrivate, &functions,
error)) {
diff --git a/src/mesa/drivers/dri/i915/i830_context.h b/src/mesa/drivers/dri/i915/i830_context.h
index ab6222b56f0..4088480e644 100644
--- a/src/mesa/drivers/dri/i915/i830_context.h
+++ b/src/mesa/drivers/dri/i915/i830_context.h
@@ -183,6 +183,7 @@ i830CreateContext(int api,
__DRIcontext * driContextPriv,
unsigned major_version,
unsigned minor_version,
+ uint32_t flags,
unsigned *error,
void *sharedContextPrivate);
diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c
index 5907e32b756..23890439ca5 100644
--- a/src/mesa/drivers/dri/i915/i915_context.c
+++ b/src/mesa/drivers/dri/i915/i915_context.c
@@ -151,6 +151,7 @@ i915CreateContext(int api,
__DRIcontext * driContextPriv,
unsigned major_version,
unsigned minor_version,
+ uint32_t flags,
unsigned *error,
void *sharedContextPrivate)
{
@@ -168,7 +169,7 @@ i915CreateContext(int api,
i915InitDriverFunctions(&functions);
- if (!intelInitContext(intel, api, major_version, minor_version,
+ if (!intelInitContext(intel, api, major_version, minor_version, flags,
mesaVis, driContextPriv,
sharedContextPrivate, &functions,
error)) {
diff --git a/src/mesa/drivers/dri/i915/i915_context.h b/src/mesa/drivers/dri/i915/i915_context.h
index f5c15960dd0..7789ac28ee4 100644
--- a/src/mesa/drivers/dri/i915/i915_context.h
+++ b/src/mesa/drivers/dri/i915/i915_context.h
@@ -324,6 +324,7 @@ extern bool i915CreateContext(int api,
__DRIcontext * driContextPriv,
unsigned major_version,
unsigned minor_version,
+ uint32_t flags,
unsigned *error,
void *sharedContextPrivate);
diff --git a/src/mesa/drivers/dri/i915/intel_context.c b/src/mesa/drivers/dri/i915/intel_context.c
index 36188934fca..ac5d4ff240b 100644
--- a/src/mesa/drivers/dri/i915/intel_context.c
+++ b/src/mesa/drivers/dri/i915/intel_context.c
@@ -409,6 +409,7 @@ intelInitContext(struct intel_context *intel,
int api,
unsigned major_version,
unsigned minor_version,
+ uint32_t flags,
const struct gl_config * mesaVis,
__DRIcontext * driContextPriv,
void *sharedContextPrivate,
diff --git a/src/mesa/drivers/dri/i915/intel_context.h b/src/mesa/drivers/dri/i915/intel_context.h
index e488ed1a677..c3dad9c291f 100644
--- a/src/mesa/drivers/dri/i915/intel_context.h
+++ b/src/mesa/drivers/dri/i915/intel_context.h
@@ -401,6 +401,7 @@ extern bool intelInitContext(struct intel_context *intel,
int api,
unsigned major_version,
unsigned minor_version,
+ uint32_t flags,
const struct gl_config * mesaVis,
__DRIcontext * driContextPriv,
void *sharedContextPrivate,
diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c
index 87f53e79ff8..3c46a2696ab 100644
--- a/src/mesa/drivers/dri/i915/intel_screen.c
+++ b/src/mesa/drivers/dri/i915/intel_screen.c
@@ -930,6 +930,7 @@ i830CreateContext(int api,
__DRIcontext *driContextPriv,
unsigned major_version,
unsigned minor_version,
+ uint32_t flags,
unsigned *error,
void *sharedContextPrivate);
@@ -939,6 +940,7 @@ i915CreateContext(int api,
__DRIcontext *driContextPriv,
unsigned major_version,
unsigned minor_version,
+ uint32_t flags,
unsigned *error,
void *sharedContextPrivate);
@@ -970,13 +972,13 @@ intelCreateContext(gl_api api,
if (IS_9XX(intelScreen->deviceID)) {
success = i915CreateContext(api, mesaVis, driContextPriv,
- major_version, minor_version, error,
- sharedContextPrivate);
+ major_version, minor_version, flags,
+ error, sharedContextPrivate);
} else {
intelScreen->no_vbo = true;
success = i830CreateContext(api, mesaVis, driContextPriv,
- major_version, minor_version, error,
- sharedContextPrivate);
+ major_version, minor_version, flags,
+ error, sharedContextPrivate);
}
if (success)
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 3facf785968..4fc83dfdb36 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -662,6 +662,8 @@ brwCreateContext(gl_api api,
return false;
}
+ driContextSetFlags(ctx, flags);
+
/* Initialize the software rasterizer and helper modules.
*
* As of GL 3.1 core, the gen4+ driver doesn't need the swrast context for
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index d44864ca9a9..18c6e776f2b 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -78,6 +78,8 @@ nouveau_context_create(gl_api api,
return GL_FALSE;
}
+ driContextSetFlags(ctx, flags);
+
nctx = to_nouveau_context(ctx);
nctx->dri_context = dri_ctx;
dri_ctx->driverPrivate = ctx;
diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c
index d4e9ca8caca..dadbd7778c6 100644
--- a/src/mesa/drivers/dri/r200/r200_context.c
+++ b/src/mesa/drivers/dri/r200/r200_context.c
@@ -279,6 +279,8 @@ GLboolean r200CreateContext( gl_api api,
return GL_FALSE;
}
+ driContextSetFlags(ctx, flags);
+
rmesa->radeon.swtcl.RenderIndex = ~0;
rmesa->radeon.hw.all_dirty = 1;
diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c
index 76bfe55c0eb..c8b997bcf05 100644
--- a/src/mesa/drivers/dri/radeon/radeon_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_context.c
@@ -242,6 +242,8 @@ r100CreateContext( gl_api api,
return GL_FALSE;
}
+ driContextSetFlags(ctx, flags);
+
rmesa->radeon.swtcl.RenderIndex = ~0;
rmesa->radeon.hw.all_dirty = GL_TRUE;
diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c
index 0e1c530b39d..8088a6ba332 100644
--- a/src/mesa/drivers/dri/swrast/swrast.c
+++ b/src/mesa/drivers/dri/swrast/swrast.c
@@ -705,6 +705,8 @@ dri_create_context(gl_api api,
goto context_fail;
}
+ driContextSetFlags(ctx, flags);
+
/* do bounds checking to prevent segfaults and server crashes! */
mesaCtx->Const.CheckArrayBounds = GL_TRUE;