glx/dri: Collect the GLX context attributes in a struct

dri2_convert_glx_attribs had way too many arguments, let's fix that.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12456>
This commit is contained in:
Adam Jackson
2021-08-06 16:32:56 -04:00
committed by Marge Bot
parent 2cd0991def
commit a521b502b9
5 changed files with 109 additions and 147 deletions

View File

@@ -190,29 +190,20 @@ dri2_create_context_attribs(struct glx_screen *base,
__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) config_base; __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) config_base;
__DRIcontext *shared = NULL; __DRIcontext *shared = NULL;
uint32_t minor_ver; struct dri_ctx_attribs dca;
uint32_t major_ver;
uint32_t renderType;
uint32_t flags;
unsigned api;
int reset;
int release;
uint32_t ctx_attribs[2 * 6]; uint32_t ctx_attribs[2 * 6];
unsigned num_ctx_attribs = 0; unsigned num_ctx_attribs = 0;
/* Remap the GLX tokens to DRI2 tokens. *error = dri_convert_glx_attribs(num_attribs, attribs, &dca);
*/ if (*error != __DRI_CTX_ERROR_SUCCESS)
if (!dri2_convert_glx_attribs(num_attribs, attribs,
&major_ver, &minor_ver, &renderType, &flags,
&api, &reset, &release, error))
goto error_exit; goto error_exit;
if (!dri2_check_no_error(flags, shareList, major_ver, error)) { if (!dri2_check_no_error(dca.flags, shareList, dca.major_ver, error)) {
goto error_exit; goto error_exit;
} }
/* Check the renderType value */ /* Check the renderType value */
if (!validate_renderType_against_config(config_base, renderType)) if (!validate_renderType_against_config(config_base, dca.render_type))
goto error_exit; goto error_exit;
if (shareList) { if (shareList) {
@@ -234,44 +225,44 @@ dri2_create_context_attribs(struct glx_screen *base,
goto error_exit; goto error_exit;
ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_MAJOR_VERSION; ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_MAJOR_VERSION;
ctx_attribs[num_ctx_attribs++] = major_ver; ctx_attribs[num_ctx_attribs++] = dca.major_ver;
ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_MINOR_VERSION; ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_MINOR_VERSION;
ctx_attribs[num_ctx_attribs++] = minor_ver; ctx_attribs[num_ctx_attribs++] = dca.minor_ver;
/* Only send a value when the non-default value is requested. By doing /* Only send a value when the non-default value is requested. By doing
* this we don't have to check the driver's DRI2 version before sending the * this we don't have to check the driver's DRI2 version before sending the
* default value. * default value.
*/ */
if (reset != __DRI_CTX_RESET_NO_NOTIFICATION) { if (dca.reset != __DRI_CTX_RESET_NO_NOTIFICATION) {
ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_RESET_STRATEGY; ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_RESET_STRATEGY;
ctx_attribs[num_ctx_attribs++] = reset; ctx_attribs[num_ctx_attribs++] = dca.reset;
} }
if (release != __DRI_CTX_RELEASE_BEHAVIOR_FLUSH) { if (dca.release != __DRI_CTX_RELEASE_BEHAVIOR_FLUSH) {
ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_RELEASE_BEHAVIOR; ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_RELEASE_BEHAVIOR;
ctx_attribs[num_ctx_attribs++] = release; ctx_attribs[num_ctx_attribs++] = dca.release;
} }
if (flags != 0) { if (dca.flags != 0) {
ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_FLAGS; ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_FLAGS;
/* The current __DRI_CTX_FLAG_* values are identical to the /* The current __DRI_CTX_FLAG_* values are identical to the
* GLX_CONTEXT_*_BIT values. * GLX_CONTEXT_*_BIT values.
*/ */
ctx_attribs[num_ctx_attribs++] = flags; ctx_attribs[num_ctx_attribs++] = dca.flags;
} }
/* The renderType is retrieved from attribs, or set to default /* The renderType is retrieved from attribs, or set to default
* of GLX_RGBA_TYPE. * of GLX_RGBA_TYPE.
*/ */
pcp->base.renderType = renderType; pcp->base.renderType = dca.render_type;
if (flags & __DRI_CTX_FLAG_NO_ERROR) if (dca.flags & __DRI_CTX_FLAG_NO_ERROR)
pcp->base.noError = GL_TRUE; pcp->base.noError = GL_TRUE;
pcp->driContext = pcp->driContext =
(*psc->dri2->createContextAttribs) (psc->driScreen, (*psc->dri2->createContextAttribs) (psc->driScreen,
api, dca.api,
config ? config->driConfig : NULL, config ? config->driConfig : NULL,
shared, shared,
num_ctx_attribs / 2, num_ctx_attribs / 2,

View File

@@ -241,30 +241,20 @@ dri3_create_context_attribs(struct glx_screen *base,
__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) config_base; __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) config_base;
__DRIcontext *shared = NULL; __DRIcontext *shared = NULL;
uint32_t minor_ver = 1; struct dri_ctx_attribs dca;
uint32_t major_ver = 2;
uint32_t flags = 0;
unsigned api;
int reset = __DRI_CTX_RESET_NO_NOTIFICATION;
int release = __DRI_CTX_RELEASE_BEHAVIOR_FLUSH;
uint32_t ctx_attribs[2 * 6]; uint32_t ctx_attribs[2 * 6];
unsigned num_ctx_attribs = 0; unsigned num_ctx_attribs = 0;
uint32_t render_type;
/* Remap the GLX tokens to DRI2 tokens. *error = dri_convert_glx_attribs(num_attribs, attribs, &dca);
*/ if (*error != __DRI_CTX_ERROR_SUCCESS)
if (!dri2_convert_glx_attribs(num_attribs, attribs,
&major_ver, &minor_ver,
&render_type, &flags, &api,
&reset, &release, error))
goto error_exit; goto error_exit;
if (!dri2_check_no_error(flags, shareList, major_ver, error)) { if (!dri2_check_no_error(dca.flags, shareList, dca.major_ver, error)) {
goto error_exit; goto error_exit;
} }
/* Check the renderType value */ /* Check the renderType value */
if (!validate_renderType_against_config(config_base, render_type)) if (!validate_renderType_against_config(config_base, dca.render_type))
goto error_exit; goto error_exit;
if (shareList) { if (shareList) {
@@ -286,39 +276,39 @@ dri3_create_context_attribs(struct glx_screen *base,
goto error_exit; goto error_exit;
ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_MAJOR_VERSION; ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_MAJOR_VERSION;
ctx_attribs[num_ctx_attribs++] = major_ver; ctx_attribs[num_ctx_attribs++] = dca.major_ver;
ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_MINOR_VERSION; ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_MINOR_VERSION;
ctx_attribs[num_ctx_attribs++] = minor_ver; ctx_attribs[num_ctx_attribs++] = dca.minor_ver;
/* Only send a value when the non-default value is requested. By doing /* Only send a value when the non-default value is requested. By doing
* this we don't have to check the driver's DRI3 version before sending the * this we don't have to check the driver's DRI3 version before sending the
* default value. * default value.
*/ */
if (reset != __DRI_CTX_RESET_NO_NOTIFICATION) { if (dca.reset != __DRI_CTX_RESET_NO_NOTIFICATION) {
ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_RESET_STRATEGY; ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_RESET_STRATEGY;
ctx_attribs[num_ctx_attribs++] = reset; ctx_attribs[num_ctx_attribs++] = dca.reset;
} }
if (release != __DRI_CTX_RELEASE_BEHAVIOR_FLUSH) { if (dca.release != __DRI_CTX_RELEASE_BEHAVIOR_FLUSH) {
ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_RELEASE_BEHAVIOR; ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_RELEASE_BEHAVIOR;
ctx_attribs[num_ctx_attribs++] = release; ctx_attribs[num_ctx_attribs++] = dca.release;
} }
if (flags != 0) { if (dca.flags != 0) {
ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_FLAGS; ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_FLAGS;
/* The current __DRI_CTX_FLAG_* values are identical to the /* The current __DRI_CTX_FLAG_* values are identical to the
* GLX_CONTEXT_*_BIT values. * GLX_CONTEXT_*_BIT values.
*/ */
ctx_attribs[num_ctx_attribs++] = flags; ctx_attribs[num_ctx_attribs++] = dca.flags;
if (flags & __DRI_CTX_FLAG_NO_ERROR) if (dca.flags & __DRI_CTX_FLAG_NO_ERROR)
pcp->base.noError = GL_TRUE; pcp->base.noError = GL_TRUE;
} }
pcp->driContext = pcp->driContext =
(*psc->image_driver->createContextAttribs) (psc->driScreen, (*psc->image_driver->createContextAttribs) (psc->driScreen,
api, dca.api,
config ? config->driConfig config ? config->driConfig
: NULL, : NULL,
shared, shared,

View File

@@ -418,46 +418,40 @@ driReleaseDrawables(struct glx_context *gc)
} }
_X_HIDDEN bool _X_HIDDEN int
dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs, dri_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
unsigned *major_ver, unsigned *minor_ver, struct dri_ctx_attribs *dca)
uint32_t *render_type, uint32_t *flags, unsigned *api,
int *reset, int *release, unsigned *error)
{ {
unsigned i; unsigned i;
bool got_profile = false; bool got_profile = false;
int no_error = 0; int no_error = 0;
uint32_t profile; uint32_t profile;
*major_ver = 1; dca->major_ver = 1;
*minor_ver = 0; dca->minor_ver = 0;
*render_type = GLX_RGBA_TYPE; dca->render_type = GLX_RGBA_TYPE;
*reset = __DRI_CTX_RESET_NO_NOTIFICATION; dca->reset = __DRI_CTX_RESET_NO_NOTIFICATION;
*release = __DRI_CTX_RELEASE_BEHAVIOR_FLUSH; dca->release = __DRI_CTX_RELEASE_BEHAVIOR_FLUSH;
*flags = 0; dca->flags = 0;
*api = __DRI_API_OPENGL; dca->api = __DRI_API_OPENGL;
if (num_attribs == 0) { if (num_attribs == 0)
return true; return __DRI_CTX_ERROR_SUCCESS;
}
/* This is actually an internal error, but what the heck. /* This is actually an internal error, but what the heck. */
*/ if (attribs == NULL)
if (attribs == NULL) { return __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
*error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
return false;
}
for (i = 0; i < num_attribs; i++) { for (i = 0; i < num_attribs; i++) {
switch (attribs[i * 2]) { switch (attribs[i * 2]) {
case GLX_CONTEXT_MAJOR_VERSION_ARB: case GLX_CONTEXT_MAJOR_VERSION_ARB:
*major_ver = attribs[i * 2 + 1]; dca->major_ver = attribs[i * 2 + 1];
break; break;
case GLX_CONTEXT_MINOR_VERSION_ARB: case GLX_CONTEXT_MINOR_VERSION_ARB:
*minor_ver = attribs[i * 2 + 1]; dca->minor_ver = attribs[i * 2 + 1];
break; break;
case GLX_CONTEXT_FLAGS_ARB: case GLX_CONTEXT_FLAGS_ARB:
*flags = attribs[i * 2 + 1]; dca->flags = attribs[i * 2 + 1];
break; break;
case GLX_CONTEXT_OPENGL_NO_ERROR_ARB: case GLX_CONTEXT_OPENGL_NO_ERROR_ARB:
no_error = attribs[i * 2 + 1]; no_error = attribs[i * 2 + 1];
@@ -467,53 +461,50 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
got_profile = true; got_profile = true;
break; break;
case GLX_RENDER_TYPE: case GLX_RENDER_TYPE:
*render_type = attribs[i * 2 + 1]; dca->render_type = attribs[i * 2 + 1];
break; break;
case GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB: case GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB:
switch (attribs[i * 2 + 1]) { switch (attribs[i * 2 + 1]) {
case GLX_NO_RESET_NOTIFICATION_ARB: case GLX_NO_RESET_NOTIFICATION_ARB:
*reset = __DRI_CTX_RESET_NO_NOTIFICATION; dca->reset = __DRI_CTX_RESET_NO_NOTIFICATION;
break; break;
case GLX_LOSE_CONTEXT_ON_RESET_ARB: case GLX_LOSE_CONTEXT_ON_RESET_ARB:
*reset = __DRI_CTX_RESET_LOSE_CONTEXT; dca->reset = __DRI_CTX_RESET_LOSE_CONTEXT;
break; break;
default: default:
*error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE; return __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
return false;
} }
break; break;
case GLX_CONTEXT_RELEASE_BEHAVIOR_ARB: case GLX_CONTEXT_RELEASE_BEHAVIOR_ARB:
switch (attribs[i * 2 + 1]) { switch (attribs[i * 2 + 1]) {
case GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB: case GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB:
*release = __DRI_CTX_RELEASE_BEHAVIOR_NONE; dca->release = __DRI_CTX_RELEASE_BEHAVIOR_NONE;
break; break;
case GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB: case GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB:
*release = __DRI_CTX_RELEASE_BEHAVIOR_FLUSH; dca->release = __DRI_CTX_RELEASE_BEHAVIOR_FLUSH;
break; break;
default: default:
*error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE; return __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
return false;
} }
break; break;
case GLX_SCREEN: case GLX_SCREEN:
/* Implies GLX_EXT_no_config_context */ /* Implies GLX_EXT_no_config_context */
*render_type = GLX_DONT_CARE; dca->render_type = GLX_DONT_CARE;
break; break;
default: default:
/* If an unknown attribute is received, fail. /* If an unknown attribute is received, fail.
*/ */
*error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE; return __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
return false;
} }
} }
if (no_error) { if (no_error) {
*flags |= __DRI_CTX_FLAG_NO_ERROR; dca->flags |= __DRI_CTX_FLAG_NO_ERROR;
} }
if (!got_profile) { if (!got_profile) {
if (*major_ver > 3 || (*major_ver == 3 && *minor_ver >= 2)) if (dca->major_ver > 3 || (dca->major_ver == 3 && dca->minor_ver >= 2))
*api = __DRI_API_OPENGL_CORE; dca->api = __DRI_API_OPENGL_CORE;
} else { } else {
switch (profile) { switch (profile) {
case GLX_CONTEXT_CORE_PROFILE_BIT_ARB: case GLX_CONTEXT_CORE_PROFILE_BIT_ARB:
@@ -524,38 +515,34 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
* GLX_CONTEXT_PROFILE_MASK_ARB is ignored and the functionality * GLX_CONTEXT_PROFILE_MASK_ARB is ignored and the functionality
* of the context is determined solely by the requested version." * of the context is determined solely by the requested version."
*/ */
*api = (*major_ver > 3 || (*major_ver == 3 && *minor_ver >= 2)) dca->api = (dca->major_ver > 3 || (dca->major_ver == 3 && dca->minor_ver >= 2))
? __DRI_API_OPENGL_CORE : __DRI_API_OPENGL; ? __DRI_API_OPENGL_CORE : __DRI_API_OPENGL;
break; break;
case GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB: case GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB:
*api = __DRI_API_OPENGL; dca->api = __DRI_API_OPENGL;
break; break;
case GLX_CONTEXT_ES_PROFILE_BIT_EXT: case GLX_CONTEXT_ES_PROFILE_BIT_EXT:
if (*major_ver >= 3) if (dca->major_ver >= 3)
*api = __DRI_API_GLES3; dca->api = __DRI_API_GLES3;
else if (*major_ver == 2 && *minor_ver == 0) else if (dca->major_ver == 2 && dca->minor_ver == 0)
*api = __DRI_API_GLES2; dca->api = __DRI_API_GLES2;
else if (*major_ver == 1 && *minor_ver < 2) else if (dca->major_ver == 1 && dca->minor_ver < 2)
*api = __DRI_API_GLES; dca->api = __DRI_API_GLES;
else { else {
*error = __DRI_CTX_ERROR_BAD_API; return __DRI_CTX_ERROR_BAD_API;
return false;
} }
break; break;
default: default:
*error = __DRI_CTX_ERROR_BAD_API; return __DRI_CTX_ERROR_BAD_API;
return false;
} }
} }
/* Unknown flag value. /* Unknown flag value */
*/ if (dca->flags & ~(__DRI_CTX_FLAG_DEBUG |
if (*flags & ~(__DRI_CTX_FLAG_DEBUG | __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))
*error = __DRI_CTX_ERROR_UNKNOWN_FLAG; return __DRI_CTX_ERROR_UNKNOWN_FLAG;
return false;
}
/* There are no forward-compatible contexts before OpenGL 3.0. The /* There are no forward-compatible contexts before OpenGL 3.0. The
* GLX_ARB_create_context spec says: * GLX_ARB_create_context spec says:
@@ -563,18 +550,13 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
* "Forward-compatible contexts are defined only for OpenGL versions * "Forward-compatible contexts are defined only for OpenGL versions
* 3.0 and later." * 3.0 and later."
*/ */
if (*major_ver < 3 && (*flags & __DRI_CTX_FLAG_FORWARD_COMPATIBLE) != 0) { if (dca->major_ver < 3 && (dca->flags & __DRI_CTX_FLAG_FORWARD_COMPATIBLE) != 0)
*error = __DRI_CTX_ERROR_BAD_FLAG; return __DRI_CTX_ERROR_BAD_FLAG;
return false;
}
if (*major_ver >= 3 && *render_type == GLX_COLOR_INDEX_TYPE) { if (dca->major_ver >= 3 && dca->render_type == GLX_COLOR_INDEX_TYPE)
*error = __DRI_CTX_ERROR_BAD_FLAG; return __DRI_CTX_ERROR_BAD_FLAG;
return false;
}
*error = __DRI_CTX_ERROR_SUCCESS; return __DRI_CTX_ERROR_SUCCESS;
return true;
} }
_X_HIDDEN bool _X_HIDDEN bool

View File

@@ -66,11 +66,19 @@ driReleaseDrawables(struct glx_context *gc);
extern const __DRIextension **driOpenDriver(const char *driverName, extern const __DRIextension **driOpenDriver(const char *driverName,
void **out_driver_handle); void **out_driver_handle);
extern bool struct dri_ctx_attribs {
dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs, unsigned major_ver;
unsigned *major_ver, unsigned *minor_ver, unsigned minor_ver;
uint32_t *render_type, uint32_t *flags, unsigned *api, uint32_t render_type;
int *reset, int *release, unsigned *error); uint32_t flags;
unsigned api;
int reset;
int release;
};
extern int
dri_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
struct dri_ctx_attribs *dca);
extern bool extern bool
dri2_check_no_error(uint32_t flags, struct glx_context *share_context, dri2_check_no_error(uint32_t flags, struct glx_context *share_context,

View File

@@ -509,13 +509,7 @@ drisw_create_context_attribs(struct glx_screen *base,
struct drisw_screen *psc = (struct drisw_screen *) base; struct drisw_screen *psc = (struct drisw_screen *) base;
__DRIcontext *shared = NULL; __DRIcontext *shared = NULL;
uint32_t minor_ver; struct dri_ctx_attribs dca;
uint32_t major_ver;
uint32_t renderType;
uint32_t flags;
unsigned api;
int reset;
int release;
uint32_t ctx_attribs[2 * 5]; uint32_t ctx_attribs[2 * 5];
unsigned num_ctx_attribs = 0; unsigned num_ctx_attribs = 0;
@@ -525,18 +519,15 @@ drisw_create_context_attribs(struct glx_screen *base,
if (psc->swrast->base.version < 3) if (psc->swrast->base.version < 3)
return NULL; return NULL;
/* Remap the GLX tokens to DRI2 tokens. *error = dri_convert_glx_attribs(num_attribs, attribs, &dca);
*/ if (*error != __DRI_CTX_ERROR_SUCCESS)
if (!dri2_convert_glx_attribs(num_attribs, attribs,
&major_ver, &minor_ver, &renderType, &flags,
&api, &reset, &release, error))
return NULL; return NULL;
if (!dri2_check_no_error(flags, shareList, major_ver, error)) if (!dri2_check_no_error(dca.flags, shareList, dca.major_ver, error))
return NULL; return NULL;
/* Check the renderType value */ /* Check the renderType value */
if (!validate_renderType_against_config(config_base, renderType)) { if (!validate_renderType_against_config(config_base, dca.render_type)) {
return NULL; return NULL;
} }
@@ -559,31 +550,31 @@ drisw_create_context_attribs(struct glx_screen *base,
} }
ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_MAJOR_VERSION; ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_MAJOR_VERSION;
ctx_attribs[num_ctx_attribs++] = major_ver; ctx_attribs[num_ctx_attribs++] = dca.major_ver;
ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_MINOR_VERSION; ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_MINOR_VERSION;
ctx_attribs[num_ctx_attribs++] = minor_ver; ctx_attribs[num_ctx_attribs++] = dca.minor_ver;
if (release != __DRI_CTX_RELEASE_BEHAVIOR_FLUSH) { if (dca.release != __DRI_CTX_RELEASE_BEHAVIOR_FLUSH) {
ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_RELEASE_BEHAVIOR; ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_RELEASE_BEHAVIOR;
ctx_attribs[num_ctx_attribs++] = release; ctx_attribs[num_ctx_attribs++] = dca.release;
} }
if (flags != 0) { if (dca.flags != 0) {
ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_FLAGS; ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_FLAGS;
/* The current __DRI_CTX_FLAG_* values are identical to the /* The current __DRI_CTX_FLAG_* values are identical to the
* GLX_CONTEXT_*_BIT values. * GLX_CONTEXT_*_BIT values.
*/ */
ctx_attribs[num_ctx_attribs++] = flags; ctx_attribs[num_ctx_attribs++] = dca.flags;
if (flags & __DRI_CTX_FLAG_NO_ERROR) if (dca.flags & __DRI_CTX_FLAG_NO_ERROR)
pcp->base.noError = GL_TRUE; pcp->base.noError = GL_TRUE;
} }
pcp->base.renderType = renderType; pcp->base.renderType = dca.render_type;
pcp->driContext = pcp->driContext =
(*psc->swrast->createContextAttribs) (psc->driScreen, (*psc->swrast->createContextAttribs) (psc->driScreen,
api, dca.api,
config ? config->driConfig : 0, config ? config->driConfig : 0,
shared, shared,
num_ctx_attribs / 2, num_ctx_attribs / 2,