uint32_t flags;
unsigned api;
int reset;
- uint32_t ctx_attribs[2 * 5];
+ int release;
+ uint32_t ctx_attribs[2 * 6];
unsigned num_ctx_attribs = 0;
if (psc->dri2->base.version < 3) {
*/
if (!dri2_convert_glx_attribs(num_attribs, attribs,
&major_ver, &minor_ver, &renderType, &flags,
- &api, &reset, error))
+ &api, &reset, &release, error))
goto error_exit;
/* Check the renderType value */
ctx_attribs[num_ctx_attribs++] = reset;
}
+ if (release != __DRI_CTX_RELEASE_BEHAVIOR_FLUSH) {
+ ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_RELEASE_BEHAVIOR;
+ ctx_attribs[num_ctx_attribs++] = release;
+ }
+
if (flags != 0) {
ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_FLAGS;
if (strcmp(extensions[i]->name, __DRI2_INTEROP) == 0)
psc->interop = (__DRI2interopExtension*)extensions[i];
+
+ /* DRI2 version 3 is also required because
+ * GLX_ARB_control_flush_control requires GLX_ARB_create_context.
+ */
+ if (psc->dri2->base.version >= 3
+ && strcmp(extensions[i]->name, __DRI2_FLUSH_CONTROL) == 0)
+ __glXEnableDirectExtension(&psc->base,
+ "GLX_ARB_context_flush_control");
}
}
uint32_t flags = 0;
unsigned api;
int reset = __DRI_CTX_RESET_NO_NOTIFICATION;
- uint32_t ctx_attribs[2 * 5];
+ int release = __DRI_CTX_RELEASE_BEHAVIOR_FLUSH;
+ uint32_t ctx_attribs[2 * 6];
unsigned num_ctx_attribs = 0;
uint32_t render_type;
if (!dri2_convert_glx_attribs(num_attribs, attribs,
&major_ver, &minor_ver,
&render_type, &flags, &api,
- &reset, error))
+ &reset, &release, error))
goto error_exit;
/* Check the renderType value */
ctx_attribs[num_ctx_attribs++] = reset;
}
+ if (release != __DRI_CTX_RELEASE_BEHAVIOR_FLUSH) {
+ ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_RELEASE_BEHAVIOR;
+ ctx_attribs[num_ctx_attribs++] = release;
+ }
+
if (flags != 0) {
ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_FLAGS;
if (strcmp(extensions[i]->name, __DRI2_INTEROP) == 0)
psc->interop = (__DRI2interopExtension*)extensions[i];
+
+ if (strcmp(extensions[i]->name, __DRI2_FLUSH_CONTROL) == 0)
+ __glXEnableDirectExtension(&psc->base,
+ "GLX_ARB_context_flush_control");
}
}
dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
unsigned *major_ver, unsigned *minor_ver,
uint32_t *render_type, uint32_t *flags, unsigned *api,
- int *reset, unsigned *error)
+ int *reset, int *release, unsigned *error)
{
unsigned i;
bool got_profile = false;
*minor_ver = 0;
*render_type = GLX_RGBA_TYPE;
*reset = __DRI_CTX_RESET_NO_NOTIFICATION;
+ *release = __DRI_CTX_RELEASE_BEHAVIOR_FLUSH;
*flags = 0;
*api = __DRI_API_OPENGL;
return false;
}
break;
+ case GLX_CONTEXT_RELEASE_BEHAVIOR_ARB:
+ switch (attribs[i * 2 + 1]) {
+ case GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB:
+ *release = __DRI_CTX_RELEASE_BEHAVIOR_NONE;
+ break;
+ case GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB:
+ *release = __DRI_CTX_RELEASE_BEHAVIOR_FLUSH;
+ break;
+ default:
+ *error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
+ return false;
+ }
+ break;
default:
/* If an unknown attribute is received, fail.
*/
dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
unsigned *major_ver, unsigned *minor_ver,
uint32_t *render_type, uint32_t *flags, unsigned *api,
- int *reset, unsigned *error);
+ int *reset, int *release, unsigned *error);
#endif /* _DRI_COMMON_H */
uint32_t flags;
unsigned api;
int reset;
- uint32_t ctx_attribs[2 * 4];
+ int release;
+ uint32_t ctx_attribs[2 * 5];
unsigned num_ctx_attribs = 0;
if (!psc->base.driScreen)
*/
if (!dri2_convert_glx_attribs(num_attribs, attribs,
&major_ver, &minor_ver, &renderType, &flags,
- &api, &reset, error))
+ &api, &reset, &release, error))
return NULL;
/* Check the renderType value */
if (reset != __DRI_CTX_RESET_NO_NOTIFICATION)
return NULL;
+ if (release != __DRI_CTX_RELEASE_BEHAVIOR_FLUSH &&
+ release != __DRI_CTX_RELEASE_BEHAVIOR_NONE)
+ return NULL;
+
if (shareList) {
pcp_shared = (struct drisw_context *) shareList;
shared = pcp_shared->driContext;
ctx_attribs[num_ctx_attribs++] = major_ver;
ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_MINOR_VERSION;
ctx_attribs[num_ctx_attribs++] = minor_ver;
+ if (release != __DRI_CTX_RELEASE_BEHAVIOR_FLUSH) {
+ ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_RELEASE_BEHAVIOR;
+ ctx_attribs[num_ctx_attribs++] = release;
+ }
if (flags != 0) {
ctx_attribs[num_ctx_attribs++] = __DRI_CTX_ATTRIB_FLAGS;
psc->rendererQuery = (__DRI2rendererQueryExtension *) extensions[i];
__glXEnableDirectExtension(&psc->base, "GLX_MESA_query_renderer");
}
+ if (strcmp(extensions[i]->name, __DRI2_FLUSH_CONTROL) == 0) {
+ __glXEnableDirectExtension(&psc->base,
+ "GLX_ARB_context_flush_control");
+ }
}
}
/* *INDENT-OFF* */
static const struct extension_info known_glx_extensions[] = {
+ { GLX(ARB_context_flush_control), VER(0,0), Y, N, N, N },
{ GLX(ARB_create_context), VER(0,0), Y, N, N, N },
{ GLX(ARB_create_context_profile), VER(0,0), Y, N, N, N },
{ GLX(ARB_create_context_robustness), VER(0,0), Y, N, N, N },
enum
{
- ARB_create_context_bit = 0,
+ ARB_context_flush_control_bit = 0,
+ ARB_create_context_bit,
ARB_create_context_profile_bit,
ARB_create_context_robustness_bit,
ARB_fbconfig_float_bit,