Commit 6d87500f authored by Neil Roberts's avatar Neil Roberts Committed by Adam Jackson

dri: Change __DriverApiRec::CreateContext to take a struct for attribs

Previously the CreateContext method of __DriverApiRec took a set of
arguments to describe the attribute values from the window system API's
CreateContextAttribs function. As more attributes get added this could
quickly get unworkable and every new attribute needs a modification for
every driver.

To fix that, pass the attribute values in a struct instead.  The struct
has a bitmask to specify which members are used. The first three members
(two for the GL version and one for the flags) are always set. If the
bit is not set in the attribute mask then it can be assumed the
attribute has the default value. Drivers will error if unknown bits in
the mask are set.
Reviewed-by: Adam Jackson's avatarAdam Jackson <ajax@redhat.com>
Reviewed-by: default avatarNicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: default avatarEmil Velikov <emil.velikov@collabora.com>
Signed-off-by: default avatarNeil Roberts <neil@linux.intel.com>
parent 8c0729fd
...@@ -42,14 +42,10 @@ ...@@ -42,14 +42,10 @@
GLboolean GLboolean
dri_create_context(gl_api api, const struct gl_config * visual, dri_create_context(gl_api api, const struct gl_config * visual,
__DRIcontext * cPriv, __DRIcontext * cPriv,
unsigned major_version, const struct __DriverContextConfig *ctx_config,
unsigned minor_version, unsigned *error,
uint32_t flags, void *sharedContextPrivate)
bool notify_reset,
unsigned priority,
unsigned *error,
void *sharedContextPrivate)
{ {
__DRIscreen *sPriv = cPriv->driScreenPriv; __DRIscreen *sPriv = cPriv->driScreenPriv;
struct dri_screen *screen = dri_screen(sPriv); struct dri_screen *screen = dri_screen(sPriv);
...@@ -61,18 +57,21 @@ dri_create_context(gl_api api, const struct gl_config * visual, ...@@ -61,18 +57,21 @@ dri_create_context(gl_api api, const struct gl_config * visual,
unsigned allowed_flags = __DRI_CTX_FLAG_DEBUG | unsigned allowed_flags = __DRI_CTX_FLAG_DEBUG |
__DRI_CTX_FLAG_FORWARD_COMPATIBLE | __DRI_CTX_FLAG_FORWARD_COMPATIBLE |
__DRI_CTX_FLAG_NO_ERROR; __DRI_CTX_FLAG_NO_ERROR;
unsigned allowed_attribs = 0;
const __DRIbackgroundCallableExtension *backgroundCallable = const __DRIbackgroundCallableExtension *backgroundCallable =
screen->sPriv->dri2.backgroundCallable; screen->sPriv->dri2.backgroundCallable;
if (screen->has_reset_status_query) if (screen->has_reset_status_query) {
allowed_flags |= __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS; allowed_flags |= __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS;
allowed_attribs |= __DRIVER_CONTEXT_ATTRIB_RESET_STRATEGY;
}
if (flags & ~allowed_flags) { if (ctx_config->flags & ~allowed_flags) {
*error = __DRI_CTX_ERROR_UNKNOWN_FLAG; *error = __DRI_CTX_ERROR_UNKNOWN_FLAG;
goto fail; goto fail;
} }
if (!screen->has_reset_status_query && notify_reset) { if (ctx_config->attribute_mask & ~allowed_attribs) {
*error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE; *error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
goto fail; goto fail;
} }
...@@ -89,10 +88,10 @@ dri_create_context(gl_api api, const struct gl_config * visual, ...@@ -89,10 +88,10 @@ dri_create_context(gl_api api, const struct gl_config * visual,
case API_OPENGL_CORE: case API_OPENGL_CORE:
attribs.profile = api == API_OPENGL_COMPAT ? ST_PROFILE_DEFAULT attribs.profile = api == API_OPENGL_COMPAT ? ST_PROFILE_DEFAULT
: ST_PROFILE_OPENGL_CORE; : ST_PROFILE_OPENGL_CORE;
attribs.major = major_version; attribs.major = ctx_config->major_version;
attribs.minor = minor_version; attribs.minor = ctx_config->minor_version;
if ((flags & __DRI_CTX_FLAG_FORWARD_COMPATIBLE) != 0) if ((ctx_config->flags & __DRI_CTX_FLAG_FORWARD_COMPATIBLE) != 0)
attribs.flags |= ST_CONTEXT_FLAG_FORWARD_COMPATIBLE; attribs.flags |= ST_CONTEXT_FLAG_FORWARD_COMPATIBLE;
break; break;
default: default:
...@@ -100,16 +99,17 @@ dri_create_context(gl_api api, const struct gl_config * visual, ...@@ -100,16 +99,17 @@ dri_create_context(gl_api api, const struct gl_config * visual,
goto fail; goto fail;
} }
if ((flags & __DRI_CTX_FLAG_DEBUG) != 0) if ((ctx_config->flags & __DRI_CTX_FLAG_DEBUG) != 0)
attribs.flags |= ST_CONTEXT_FLAG_DEBUG; attribs.flags |= ST_CONTEXT_FLAG_DEBUG;
if (flags & __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS) if (ctx_config->flags & __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS)
attribs.flags |= ST_CONTEXT_FLAG_ROBUST_ACCESS; attribs.flags |= ST_CONTEXT_FLAG_ROBUST_ACCESS;
if (notify_reset) if (ctx_config->attribute_mask & __DRIVER_CONTEXT_ATTRIB_RESET_STRATEGY)
attribs.flags |= ST_CONTEXT_FLAG_RESET_NOTIFICATION_ENABLED; if (ctx_config->reset_strategy != __DRI_CTX_RESET_NO_NOTIFICATION)
attribs.flags |= ST_CONTEXT_FLAG_RESET_NOTIFICATION_ENABLED;
if (flags & __DRI_CTX_FLAG_NO_ERROR) if (ctx_config->flags & __DRI_CTX_FLAG_NO_ERROR)
attribs.flags |= ST_CONTEXT_FLAG_NO_ERROR; attribs.flags |= ST_CONTEXT_FLAG_NO_ERROR;
if (sharedContextPrivate) { if (sharedContextPrivate) {
......
...@@ -84,15 +84,11 @@ dri_get_current(__DRIscreen * driScreenPriv); ...@@ -84,15 +84,11 @@ dri_get_current(__DRIscreen * driScreenPriv);
boolean boolean
dri_create_context(gl_api api, dri_create_context(gl_api api,
const struct gl_config * visual, const struct gl_config * visual,
__DRIcontext * driContextPriv, __DRIcontext * driContextPriv,
unsigned major_version, const struct __DriverContextConfig *ctx_config,
unsigned minor_version, unsigned *error,
uint32_t flags, void *sharedContextPrivate);
bool notify_reset,
unsigned priority,
unsigned *error,
void *sharedContextPrivate);
#endif #endif
......
...@@ -302,11 +302,13 @@ driCreateContextAttribs(__DRIscreen *screen, int api, ...@@ -302,11 +302,13 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
const struct gl_config *modes = (config != NULL) ? &config->modes : NULL; const struct gl_config *modes = (config != NULL) ? &config->modes : NULL;
void *shareCtx = (shared != NULL) ? shared->driverPrivate : NULL; void *shareCtx = (shared != NULL) ? shared->driverPrivate : NULL;
gl_api mesa_api; gl_api mesa_api;
unsigned major_version = 1; struct __DriverContextConfig ctx_config;
unsigned minor_version = 0;
uint32_t flags = 0; ctx_config.major_version = 1;
bool notify_reset = false; ctx_config.minor_version = 0;
unsigned priority = __DRI_CTX_PRIORITY_MEDIUM; ctx_config.flags = 0;
ctx_config.attribute_mask = 0;
ctx_config.priority = __DRI_CTX_PRIORITY_MEDIUM;
assert((num_attribs == 0) || (attribs != NULL)); assert((num_attribs == 0) || (attribs != NULL));
...@@ -337,20 +339,27 @@ driCreateContextAttribs(__DRIscreen *screen, int api, ...@@ -337,20 +339,27 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
for (unsigned i = 0; i < num_attribs; i++) { for (unsigned i = 0; i < num_attribs; i++) {
switch (attribs[i * 2]) { switch (attribs[i * 2]) {
case __DRI_CTX_ATTRIB_MAJOR_VERSION: case __DRI_CTX_ATTRIB_MAJOR_VERSION:
major_version = attribs[i * 2 + 1]; ctx_config.major_version = attribs[i * 2 + 1];
break; break;
case __DRI_CTX_ATTRIB_MINOR_VERSION: case __DRI_CTX_ATTRIB_MINOR_VERSION:
minor_version = attribs[i * 2 + 1]; ctx_config.minor_version = attribs[i * 2 + 1];
break; break;
case __DRI_CTX_ATTRIB_FLAGS: case __DRI_CTX_ATTRIB_FLAGS:
flags = attribs[i * 2 + 1]; ctx_config.flags = attribs[i * 2 + 1];
break; break;
case __DRI_CTX_ATTRIB_RESET_STRATEGY: case __DRI_CTX_ATTRIB_RESET_STRATEGY:
notify_reset = (attribs[i * 2 + 1] if (attribs[i * 2 + 1] != __DRI_CTX_RESET_NO_NOTIFICATION) {
!= __DRI_CTX_RESET_NO_NOTIFICATION); ctx_config.attribute_mask |=
__DRIVER_CONTEXT_ATTRIB_RESET_STRATEGY;
ctx_config.reset_strategy = attribs[i * 2 + 1];
} else {
ctx_config.attribute_mask &=
~__DRIVER_CONTEXT_ATTRIB_RESET_STRATEGY;
}
break; break;
case __DRI_CTX_ATTRIB_PRIORITY: case __DRI_CTX_ATTRIB_PRIORITY:
priority = attribs[i * 2 + 1]; ctx_config.attribute_mask |= __DRIVER_CONTEXT_ATTRIB_PRIORITY;
ctx_config.priority = attribs[i * 2 + 1];
break; break;
default: default:
/* We can't create a context that satisfies the requirements of an /* We can't create a context that satisfies the requirements of an
...@@ -366,12 +375,14 @@ driCreateContextAttribs(__DRIscreen *screen, int api, ...@@ -366,12 +375,14 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
* compatibility profile. This means that we treat a API_OPENGL_COMPAT 3.1 as * compatibility profile. This means that we treat a API_OPENGL_COMPAT 3.1 as
* API_OPENGL_CORE and reject API_OPENGL_COMPAT 3.2+. * API_OPENGL_CORE and reject API_OPENGL_COMPAT 3.2+.
*/ */
if (mesa_api == API_OPENGL_COMPAT && major_version == 3 && minor_version == 1) if (mesa_api == API_OPENGL_COMPAT &&
ctx_config.major_version == 3 && ctx_config.minor_version == 1)
mesa_api = API_OPENGL_CORE; mesa_api = API_OPENGL_CORE;
if (mesa_api == API_OPENGL_COMPAT if (mesa_api == API_OPENGL_COMPAT
&& ((major_version > 3) && ((ctx_config.major_version > 3)
|| (major_version == 3 && minor_version >= 2))) { || (ctx_config.major_version == 3 &&
ctx_config.minor_version >= 2))) {
*error = __DRI_CTX_ERROR_BAD_API; *error = __DRI_CTX_ERROR_BAD_API;
return NULL; return NULL;
} }
...@@ -406,9 +417,9 @@ driCreateContextAttribs(__DRIscreen *screen, int api, ...@@ -406,9 +417,9 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
*/ */
if (mesa_api != API_OPENGL_COMPAT if (mesa_api != API_OPENGL_COMPAT
&& mesa_api != API_OPENGL_CORE && mesa_api != API_OPENGL_CORE
&& (flags & ~(__DRI_CTX_FLAG_DEBUG | && (ctx_config.flags & ~(__DRI_CTX_FLAG_DEBUG |
__DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS | __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS |
__DRI_CTX_FLAG_NO_ERROR))) { __DRI_CTX_FLAG_NO_ERROR))) {
*error = __DRI_CTX_ERROR_BAD_FLAG; *error = __DRI_CTX_ERROR_BAD_FLAG;
return NULL; return NULL;
} }
...@@ -424,7 +435,7 @@ driCreateContextAttribs(__DRIscreen *screen, int api, ...@@ -424,7 +435,7 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
* *
* In Mesa, a debug context is the same as a regular context. * In Mesa, a debug context is the same as a regular context.
*/ */
if ((flags & __DRI_CTX_FLAG_FORWARD_COMPATIBLE) != 0) { if ((ctx_config.flags & __DRI_CTX_FLAG_FORWARD_COMPATIBLE) != 0) {
mesa_api = API_OPENGL_CORE; mesa_api = API_OPENGL_CORE;
} }
...@@ -432,13 +443,15 @@ driCreateContextAttribs(__DRIscreen *screen, int api, ...@@ -432,13 +443,15 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
| __DRI_CTX_FLAG_FORWARD_COMPATIBLE | __DRI_CTX_FLAG_FORWARD_COMPATIBLE
| __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS | __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS
| __DRI_CTX_FLAG_NO_ERROR); | __DRI_CTX_FLAG_NO_ERROR);
if (flags & ~allowed_flags) { if (ctx_config.flags & ~allowed_flags) {
*error = __DRI_CTX_ERROR_UNKNOWN_FLAG; *error = __DRI_CTX_ERROR_UNKNOWN_FLAG;
return NULL; return NULL;
} }
if (!validate_context_version(screen, mesa_api, if (!validate_context_version(screen, mesa_api,
major_version, minor_version, error)) ctx_config.major_version,
ctx_config.minor_version,
error))
return NULL; return NULL;
context = calloc(1, sizeof *context); context = calloc(1, sizeof *context);
...@@ -454,9 +467,7 @@ driCreateContextAttribs(__DRIscreen *screen, int api, ...@@ -454,9 +467,7 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
context->driReadablePriv = NULL; context->driReadablePriv = NULL;
if (!screen->driver->CreateContext(mesa_api, modes, context, if (!screen->driver->CreateContext(mesa_api, modes, context,
major_version, minor_version, &ctx_config, error, shareCtx)) {
flags, notify_reset, priority,
error, shareCtx)) {
free(context); free(context);
return NULL; return NULL;
} }
......
...@@ -67,6 +67,37 @@ extern const __DRIswrastExtension driSWRastExtension; ...@@ -67,6 +67,37 @@ extern const __DRIswrastExtension driSWRastExtension;
extern const __DRIdri2Extension driDRI2Extension; extern const __DRIdri2Extension driDRI2Extension;
extern const __DRI2configQueryExtension dri2ConfigQueryExtension; extern const __DRI2configQueryExtension dri2ConfigQueryExtension;
extern const __DRIcopySubBufferExtension driCopySubBufferExtension; extern const __DRIcopySubBufferExtension driCopySubBufferExtension;
/**
* Description of the attributes used to create a config.
*
* This is passed as the context_config parameter to CreateContext. The idea
* with this struct is that it can be extended without having to modify all of
* the drivers. The first three members (major/minor_version and flags) are
* always valid, but the remaining members are only valid if the corresponding
* flag is set for the attribute. If the flag is not set then the default
* value should be assumed. That way the driver can quickly check if any
* attributes were set that it doesn't understand and report an error.
*/
struct __DriverContextConfig {
/* These members are always valid */
unsigned major_version;
unsigned minor_version;
uint32_t flags;
/* Flags describing which of the remaining members are valid */
uint32_t attribute_mask;
/* Only valid if __DRIVER_CONTEXT_ATTRIB_RESET_STRATEGY is set */
int reset_strategy;
/* Only valid if __DRIVER_CONTEXT_PRIORITY is set */
unsigned priority;
};
#define __DRIVER_CONTEXT_ATTRIB_RESET_STRATEGY (1 << 0)
#define __DRIVER_CONTEXT_ATTRIB_PRIORITY (1 << 1)
/** /**
* Driver callback functions. * Driver callback functions.
* *
...@@ -85,11 +116,7 @@ struct __DriverAPIRec { ...@@ -85,11 +116,7 @@ struct __DriverAPIRec {
GLboolean (*CreateContext)(gl_api api, GLboolean (*CreateContext)(gl_api api,
const struct gl_config *glVis, const struct gl_config *glVis,
__DRIcontext *driContextPriv, __DRIcontext *driContextPriv,
unsigned major_version, const struct __DriverContextConfig *ctx_config,
unsigned minor_version,
uint32_t flags,
bool notify_reset,
unsigned priority,
unsigned *error, unsigned *error,
void *sharedContextPrivate); void *sharedContextPrivate);
......
...@@ -958,11 +958,7 @@ static GLboolean ...@@ -958,11 +958,7 @@ static GLboolean
intelCreateContext(gl_api api, intelCreateContext(gl_api api,
const struct gl_config * mesaVis, const struct gl_config * mesaVis,
__DRIcontext * driContextPriv, __DRIcontext * driContextPriv,
unsigned major_version, const struct __DriverContextConfig *ctx_config,
unsigned minor_version,
uint32_t flags,
bool notify_reset,
unsigned priority,
unsigned *error, unsigned *error,
void *sharedContextPrivate) void *sharedContextPrivate)
{ {
...@@ -971,24 +967,28 @@ intelCreateContext(gl_api api, ...@@ -971,24 +967,28 @@ intelCreateContext(gl_api api,
__DRIscreen *sPriv = driContextPriv->driScreenPriv; __DRIscreen *sPriv = driContextPriv->driScreenPriv;
struct intel_screen *intelScreen = sPriv->driverPrivate; struct intel_screen *intelScreen = sPriv->driverPrivate;
if (flags & ~(__DRI_CTX_FLAG_DEBUG | __DRI_CTX_FLAG_NO_ERROR)) { if (ctx_config->flags & ~(__DRI_CTX_FLAG_DEBUG | __DRI_CTX_FLAG_NO_ERROR)) {
*error = __DRI_CTX_ERROR_UNKNOWN_FLAG; *error = __DRI_CTX_ERROR_UNKNOWN_FLAG;
return false; return false;
} }
if (notify_reset) { if (ctx_config->attribute_mask) {
*error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE; *error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
return false; return false;
} }
if (IS_GEN3(intelScreen->deviceID)) { if (IS_GEN3(intelScreen->deviceID)) {
success = i915CreateContext(api, mesaVis, driContextPriv, success = i915CreateContext(api, mesaVis, driContextPriv,
major_version, minor_version, flags, ctx_config->major_version,
ctx_config->minor_version,
ctx_config->flags,
error, sharedContextPrivate); error, sharedContextPrivate);
} else { } else {
intelScreen->no_vbo = true; intelScreen->no_vbo = true;
success = i830CreateContext(api, mesaVis, driContextPriv, success = i830CreateContext(api, mesaVis, driContextPriv,
major_version, minor_version, flags, ctx_config->major_version,
ctx_config->minor_version,
ctx_config->flags,
error, sharedContextPrivate); error, sharedContextPrivate);
} }
......
...@@ -826,11 +826,7 @@ GLboolean ...@@ -826,11 +826,7 @@ GLboolean
brwCreateContext(gl_api api, brwCreateContext(gl_api api,
const struct gl_config *mesaVis, const struct gl_config *mesaVis,
__DRIcontext *driContextPriv, __DRIcontext *driContextPriv,
unsigned major_version, const struct __DriverContextConfig *ctx_config,
unsigned minor_version,
uint32_t flags,
bool notify_reset,
unsigned priority,
unsigned *dri_ctx_error, unsigned *dri_ctx_error,
void *sharedContextPrivate) void *sharedContextPrivate)
{ {
...@@ -849,11 +845,20 @@ brwCreateContext(gl_api api, ...@@ -849,11 +845,20 @@ brwCreateContext(gl_api api,
if (screen->has_context_reset_notification) if (screen->has_context_reset_notification)
allowed_flags |= __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS; allowed_flags |= __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS;
if (flags & ~allowed_flags) { if (ctx_config->flags & ~allowed_flags) {
*dri_ctx_error = __DRI_CTX_ERROR_UNKNOWN_FLAG; *dri_ctx_error = __DRI_CTX_ERROR_UNKNOWN_FLAG;
return false; return false;
} }
if (ctx_config->attribute_mask & ~__DRIVER_CONTEXT_ATTRIB_RESET_STRATEGY) {
*dri_ctx_error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
return false;
}
bool notify_reset =
((ctx_config->attribute_mask & __DRIVER_CONTEXT_ATTRIB_RESET_STRATEGY) &&
ctx_config->reset_strategy != __DRI_CTX_RESET_NO_NOTIFICATION);
struct brw_context *brw = rzalloc(NULL, struct brw_context); struct brw_context *brw = rzalloc(NULL, struct brw_context);
if (!brw) { if (!brw) {
fprintf(stderr, "%s: failed to alloc context\n", __func__); fprintf(stderr, "%s: failed to alloc context\n", __func__);
...@@ -902,7 +907,7 @@ brwCreateContext(gl_api api, ...@@ -902,7 +907,7 @@ brwCreateContext(gl_api api,
return false; return false;
} }
driContextSetFlags(ctx, flags); driContextSetFlags(ctx, ctx_config->flags);
/* Initialize the software rasterizer and helper modules. /* Initialize the software rasterizer and helper modules.
* *
...@@ -962,19 +967,21 @@ brwCreateContext(gl_api api, ...@@ -962,19 +967,21 @@ brwCreateContext(gl_api api,
} }
int hw_priority = BRW_CONTEXT_MEDIUM_PRIORITY; int hw_priority = BRW_CONTEXT_MEDIUM_PRIORITY;
switch (priority) { if (ctx_config->attribute_mask & __DRIVER_CONTEXT_ATTRIB_PRIORITY) {
case __DRI_CTX_PRIORITY_LOW: switch (ctx_config->priority) {
hw_priority = BRW_CONTEXT_LOW_PRIORITY; case __DRI_CTX_PRIORITY_LOW:
break; hw_priority = BRW_CONTEXT_LOW_PRIORITY;
case __DRI_CTX_PRIORITY_HIGH: break;
hw_priority = BRW_CONTEXT_HIGH_PRIORITY; case __DRI_CTX_PRIORITY_HIGH:
break; hw_priority = BRW_CONTEXT_HIGH_PRIORITY;
break;
}
} }
if (hw_priority != I915_CONTEXT_DEFAULT_PRIORITY && if (hw_priority != I915_CONTEXT_DEFAULT_PRIORITY &&
brw_hw_context_set_priority(brw->bufmgr, brw->hw_ctx, hw_priority)) { brw_hw_context_set_priority(brw->bufmgr, brw->hw_ctx, hw_priority)) {
fprintf(stderr, fprintf(stderr,
"Failed to set priority [%d:%d] for hardware context.\n", "Failed to set priority [%d:%d] for hardware context.\n",
priority, hw_priority); ctx_config->priority, hw_priority);
intelDestroyContext(driContextPriv); intelDestroyContext(driContextPriv);
return false; return false;
} }
...@@ -1013,12 +1020,12 @@ brwCreateContext(gl_api api, ...@@ -1013,12 +1020,12 @@ brwCreateContext(gl_api api,
brw_draw_init( brw ); brw_draw_init( brw );
if ((flags & __DRI_CTX_FLAG_DEBUG) != 0) { if ((ctx_config->flags & __DRI_CTX_FLAG_DEBUG) != 0) {
/* Turn on some extra GL_ARB_debug_output generation. */ /* Turn on some extra GL_ARB_debug_output generation. */
brw->perf_debug = true; brw->perf_debug = true;
} }
if ((flags & __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS) != 0) { if ((ctx_config->flags & __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS) != 0) {
ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB; ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB;
ctx->Const.RobustAccess = GL_TRUE; ctx->Const.RobustAccess = GL_TRUE;
} }
......
...@@ -1258,11 +1258,7 @@ void intel_resolve_for_dri2_flush(struct brw_context *brw, ...@@ -1258,11 +1258,7 @@ void intel_resolve_for_dri2_flush(struct brw_context *brw,
GLboolean brwCreateContext(gl_api api, GLboolean brwCreateContext(gl_api api,
const struct gl_config *mesaVis, const struct gl_config *mesaVis,
__DRIcontext *driContextPriv, __DRIcontext *driContextPriv,
unsigned major_version, const struct __DriverContextConfig *ctx_config,
unsigned minor_version,
uint32_t flags,
bool notify_reset,
unsigned priority,
unsigned *error, unsigned *error,
void *sharedContextPrivate); void *sharedContextPrivate);
......
...@@ -51,11 +51,7 @@ ...@@ -51,11 +51,7 @@
GLboolean GLboolean
nouveau_context_create(gl_api api, nouveau_context_create(gl_api api,
const struct gl_config *visual, __DRIcontext *dri_ctx, const struct gl_config *visual, __DRIcontext *dri_ctx,
unsigned major_version, const struct __DriverContextConfig *ctx_config,
unsigned minor_version,
uint32_t flags,
bool notify_reset,
unsigned priority,
unsigned *error, unsigned *error,
void *share_ctx) void *share_ctx)
{ {
...@@ -64,12 +60,12 @@ nouveau_context_create(gl_api api, ...@@ -64,12 +60,12 @@ nouveau_context_create(gl_api api,
struct nouveau_context *nctx; struct nouveau_context *nctx;
struct gl_context *ctx; struct gl_context *ctx;
if (flags & ~(__DRI_CTX_FLAG_DEBUG | __DRI_CTX_FLAG_NO_ERROR)) { if (ctx_config->flags & ~(__DRI_CTX_FLAG_DEBUG | __DRI_CTX_FLAG_NO_ERROR)) {
*error = __DRI_CTX_ERROR_UNKNOWN_FLAG; *error = __DRI_CTX_ERROR_UNKNOWN_FLAG;
return false; return false;
} }
if (notify_reset) { if (ctx_config->attribute_mask) {
*error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE; *error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
return false; return false;
} }
...@@ -80,14 +76,15 @@ nouveau_context_create(gl_api api, ...@@ -80,14 +76,15 @@ nouveau_context_create(gl_api api,
return GL_FALSE; return GL_FALSE;
} }
driContextSetFlags(ctx, flags); driContextSetFlags(ctx, ctx_config->flags);
nctx = to_nouveau_context(ctx); nctx = to_nouveau_context(ctx);
nctx->dri_context = dri_ctx; nctx->dri_context = dri_ctx;
dri_ctx->driverPrivate = ctx; dri_ctx->driverPrivate = ctx;
_mesa_compute_version(ctx); _mesa_compute_version(ctx);
if (ctx->Version < major_version * 10 + minor_version) { if (ctx->Version < (ctx_config->major_version * 10 +
ctx_config->minor_version)) {
nouveau_context_destroy(dri_ctx); nouveau_context_destroy(dri_ctx);
*error = __DRI_CTX_ERROR_BAD_VERSION; *error = __DRI_CTX_ERROR_BAD_VERSION;
return GL_FALSE; return GL_FALSE;
......
...@@ -110,8 +110,7 @@ struct nouveau_context { ...@@ -110,8 +110,7 @@ struct nouveau_context {
GLboolean GLboolean
nouveau_context_create(gl_api api, nouveau_context_create(gl_api api,
const struct gl_config *visual, __DRIcontext *dri_ctx, const struct gl_config *visual, __DRIcontext *dri_ctx,
unsigned major_version, unsigned minor_version, const struct __DriverContextConfig *ctx_config,
uint32_t flags, bool notify_reset, unsigned priority,
unsigned *error, void *share_ctx); unsigned *error, void *share_ctx);
GLboolean GLboolean
......
...@@ -174,11 +174,7 @@ static void r200_init_vtbl(radeonContextPtr radeon) ...@@ -174,11 +174,7 @@ static void r200_init_vtbl(radeonContextPtr radeon)
GLboolean r200CreateContext( gl_api api, GLboolean r200CreateContext( gl_api api,
const struct gl_config *glVisual, const struct gl_config *glVisual,
__DRIcontext *driContextPriv, __DRIcontext *driContextPriv,
unsigned major_version, const struct __DriverContextConfig *ctx_config,
unsigned minor_version,
uint32_t flags,
bool notify_reset,
unsigned priority,
unsigned *error, unsigned *error,
void *sharedContextPrivate) void *sharedContextPrivate)
{ {
...@@ -190,12 +186,12 @@ GLboolean r200CreateContext( gl_api api, ...@@ -190,12 +186,12 @@ GLboolean r200CreateContext( gl_api api,
int i; int i;
int tcl_mode; int tcl_mode;