diff options
Diffstat (limited to 'glx')
-rw-r--r-- | glx/createcontext.c | 15 | ||||
-rw-r--r-- | glx/extension_string.c | 1 | ||||
-rw-r--r-- | glx/extension_string.h | 3 | ||||
-rw-r--r-- | glx/glxcmds.c | 20 | ||||
-rw-r--r-- | glx/glxcontext.h | 5 | ||||
-rw-r--r-- | glx/glxdri2.c | 7 | ||||
-rw-r--r-- | glx/glxdriswrast.c | 8 |
7 files changed, 57 insertions, 2 deletions
diff --git a/glx/createcontext.c b/glx/createcontext.c index cbeddec26..d06bc1f7f 100644 --- a/glx/createcontext.c +++ b/glx/createcontext.c @@ -87,6 +87,9 @@ __glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc) int minor_version = 0; uint32_t flags = 0; uint32_t render_type = GLX_RGBA_TYPE; +#ifdef GLX_CONTEXT_RELEASE_BEHAVIOR_ARB + uint32_t flush = GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB; +#endif __GLXcontext *ctx = NULL; __GLXcontext *shareCtx = NULL; __GLXscreen *glxScreen; @@ -194,6 +197,15 @@ __glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc) break; +#ifdef GLX_CONTEXT_RELEASE_BEHAVIOR_ARB + case GLX_CONTEXT_RELEASE_BEHAVIOR_ARB: + flush = attribs[2 * i + 1]; + if (flush != GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB + && flush != GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB) + return BadValue; + break; +#endif + default: return BadValue; } @@ -333,6 +345,9 @@ __glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc) ctx->drawPriv = NULL; ctx->readPriv = NULL; ctx->resetNotificationStrategy = reset; +#ifdef GLX_CONTEXT_RELEASE_BEHAVIOR_ARB + ctx->releaseBehavior = flush; +#endif /* Add the new context to the various global tables of GLX contexts. */ diff --git a/glx/extension_string.c b/glx/extension_string.c index 4bef96f0b..e881d2109 100644 --- a/glx/extension_string.c +++ b/glx/extension_string.c @@ -72,6 +72,7 @@ struct extension_info { static const struct extension_info known_glx_extensions[] = { /* GLX_ARB_get_proc_address is implemented on the client. */ /* *INDENT-OFF* */ + { GLX(ARB_context_flush_control), VER(0,0), N, }, { GLX(ARB_create_context), VER(0,0), N, }, { GLX(ARB_create_context_profile), VER(0,0), N, }, { GLX(ARB_create_context_robustness), VER(0,0), N, }, diff --git a/glx/extension_string.h b/glx/extension_string.h index e7d393297..bac7b0624 100644 --- a/glx/extension_string.h +++ b/glx/extension_string.h @@ -36,7 +36,8 @@ enum { /* GLX_ARB_get_proc_address is implemented on the client. */ - 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, diff --git a/glx/glxcmds.c b/glx/glxcmds.c index f5f2babb8..cbd4ede39 100644 --- a/glx/glxcmds.c +++ b/glx/glxcmds.c @@ -334,6 +334,19 @@ DoCreateContext(__GLXclientState * cl, GLXContextID gcId, */ glxc->resetNotificationStrategy = GLX_NO_RESET_NOTIFICATION_ARB; +#ifdef GLX_CONTEXT_RELEASE_BEHAVIOR_ARB + /* The GLX_ARB_context_flush_control spec says: + * + * "The default value [for GLX_CONTEXT_RELEASE_BEHAVIOR] is + * CONTEXT_RELEASE_BEHAVIOR_FLUSH, and may in some cases be changed + * using platform-specific context creation extensions." + * + * Without using glXCreateContextAttribsARB, there is no way to specify a + * non-default release behavior. + */ + glxc->releaseBehavior = GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB; +#endif + /* Add the new context to the various global tables of GLX contexts. */ if (!__glXAddContext(glxc)) { @@ -626,7 +639,12 @@ DoMakeCurrent(__GLXclientState * cl, /* ** Flush the previous context if needed. */ - if (prevglxc->hasUnflushedCommands) { + Bool need_flush = GL_TRUE; +#ifdef GLX_CONTEXT_RELEASE_BEHAVIOR_ARB + if (prevglxc->releaseBehavior == GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB) + need_flush = GL_FALSE; +#endif + if (prevglxc->hasUnflushedCommands && need_flush) { if (__glXForceCurrent(cl, tag, (int *) &error)) { glFlush(); prevglxc->hasUnflushedCommands = GL_FALSE; diff --git a/glx/glxcontext.h b/glx/glxcontext.h index 677898a67..0733281d7 100644 --- a/glx/glxcontext.h +++ b/glx/glxcontext.h @@ -108,6 +108,11 @@ struct __GLXcontext { */ GLenum resetNotificationStrategy; + /** + * Context release behavior + */ + GLenum releaseBehavior; + /* ** Buffers for feedback and selection. */ diff --git a/glx/glxdri2.c b/glx/glxdri2.c index bcd57a4a3..6fb3d9278 100644 --- a/glx/glxdri2.c +++ b/glx/glxdri2.c @@ -921,6 +921,13 @@ initializeExtensions(__GLXDRIscreen * screen) "AIGLX: enabled GLX_ARB_create_context_robustness\n"); } +#ifdef __DRI2_FLUSH_CONTROL + if (strcmp(extensions[i]->name, __DRI2_FLUSH_CONTROL) == 0) { + __glXEnableExtension(screen->glx_enable_bits, + "GLX_ARB_context_flush_control\n"); + } +#endif + /* Ignore unknown extensions */ } } diff --git a/glx/glxdriswrast.c b/glx/glxdriswrast.c index e25ca4768..9add2a13f 100644 --- a/glx/glxdriswrast.c +++ b/glx/glxdriswrast.c @@ -424,6 +424,14 @@ initializeExtensions(__GLXDRIscreen * screen) screen->texBuffer = (const __DRItexBufferExtension *) extensions[i]; /* GLX_EXT_texture_from_pixmap is always enabled. */ } + +#ifdef __DRI2_FLUSH_CONTROL + if (strcmp(extensions[i]->name, __DRI2_FLUSH_CONTROL) == 0) { + __glXEnableExtension(screen->glx_enable_bits, + "GLX_ARB_context_flush_control\n"); + } +#endif + } } |