diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/glx/dri2_glx.c | 18 | ||||
-rw-r--r-- | src/glx/dri3_glx.c | 14 | ||||
-rw-r--r-- | src/glx/dri_common.c | 16 | ||||
-rw-r--r-- | src/glx/dri_common.h | 2 | ||||
-rw-r--r-- | src/glx/drisw_glx.c | 17 | ||||
-rw-r--r-- | src/glx/glxextensions.c | 1 | ||||
-rw-r--r-- | src/glx/glxextensions.h | 3 |
7 files changed, 62 insertions, 9 deletions
diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index ae8cb11ef8f..e67a15f9dab 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -247,7 +247,8 @@ dri2_create_context_attribs(struct glx_screen *base, 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) { @@ -259,7 +260,7 @@ dri2_create_context_attribs(struct glx_screen *base, */ 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 */ @@ -294,6 +295,11 @@ dri2_create_context_attribs(struct glx_screen *base, 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; @@ -1170,6 +1176,14 @@ dri2BindExtensions(struct dri2_screen *psc, struct glx_display * priv, 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"); } } diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c index b79fec7335c..d613073994c 100644 --- a/src/glx/dri3_glx.c +++ b/src/glx/dri3_glx.c @@ -235,7 +235,8 @@ dri3_create_context_attribs(struct glx_screen *base, 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; @@ -244,7 +245,7 @@ dri3_create_context_attribs(struct glx_screen *base, 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 */ @@ -279,6 +280,11 @@ dri3_create_context_attribs(struct glx_screen *base, 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; @@ -755,6 +761,10 @@ dri3_bind_extensions(struct dri3_screen *psc, struct glx_display * priv, 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"); } } diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c index e2bbd48d3a5..3b82309fa20 100644 --- a/src/glx/dri_common.c +++ b/src/glx/dri_common.c @@ -475,7 +475,7 @@ _X_HIDDEN bool 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; @@ -485,6 +485,7 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs, *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; @@ -530,6 +531,19 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs, 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. */ diff --git a/src/glx/dri_common.h b/src/glx/dri_common.h index 947d331772f..4d97ff82b4d 100644 --- a/src/glx/dri_common.h +++ b/src/glx/dri_common.h @@ -78,6 +78,6 @@ extern bool 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 */ diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c index 110b7f8d92d..a471856634d 100644 --- a/src/glx/drisw_glx.c +++ b/src/glx/drisw_glx.c @@ -417,7 +417,8 @@ drisw_create_context_attribs(struct glx_screen *base, 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) @@ -430,7 +431,7 @@ drisw_create_context_attribs(struct glx_screen *base, */ 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 */ @@ -441,6 +442,10 @@ drisw_create_context_attribs(struct glx_screen *base, 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; @@ -459,6 +464,10 @@ drisw_create_context_attribs(struct glx_screen *base, 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; @@ -647,6 +656,10 @@ driswBindExtensions(struct drisw_screen *psc, const __DRIextension **extensions) 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"); + } } } diff --git a/src/glx/glxextensions.c b/src/glx/glxextensions.c index 6882e442fe4..af6ffbf6600 100644 --- a/src/glx/glxextensions.c +++ b/src/glx/glxextensions.c @@ -132,6 +132,7 @@ struct extension_info /* *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 }, diff --git a/src/glx/glxextensions.h b/src/glx/glxextensions.h index 6225742da51..d73128bd0ea 100644 --- a/src/glx/glxextensions.h +++ b/src/glx/glxextensions.h @@ -37,7 +37,8 @@ extern "C" { 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, |