diff options
author | Adam Jackson <ajax@redhat.com> | 2015-05-19 11:31:25 -0400 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2015-07-08 16:41:28 -0400 |
commit | 995ff11422eb49160abfe276f471e412b16cab9d (patch) | |
tree | da46f01450af909955e88706032566620075eb31 /glx/createcontext.c | |
parent | 2d7194334a9f84e417ec90e220b2fe476f704612 (diff) |
glx: Implement GLX_ARB_context_flush_control
This extension allows clients to opt out of the implicit glFlush on
context release, which is quite nice for performance for clients using
multiple contexts. The server doesn't really need to be aware of the
client's decision, at least for direct contexts, but it does need to not
reject the context attribute out of hand.
This patch won't do anything unless built against a Mesa that defines
the __DRI2_FLUSH_CONTROL extension (and a new enough glxext.h, but
that's been there since 10.3 at least).
Reviewed-by: James Jones <jajones@nvidia.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'glx/createcontext.c')
-rw-r--r-- | glx/createcontext.c | 15 |
1 files changed, 15 insertions, 0 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. */ |