aboutsummaryrefslogtreecommitdiffstats
path: root/src/glx/dri_common.c
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2012-07-03 11:32:59 -0700
committerIan Romanick <[email protected]>2012-07-11 08:54:50 -0700
commita8724d85f8cb2f0fb73b9c6c1f268f9084c6d473 (patch)
tree875c9e37edfdbbf1746746e2b322f1597f54ace8 /src/glx/dri_common.c
parentde9ed5152533c87c21d27b71211a834b4c9767bc (diff)
glx/dri2: Add support for GLX_ARB_create_context_robustness
Add the infrastructure required for this extension. There is no xserver support and no driver support yet. Drivers can enable this be advertising DRI2 version 4 and accepting the __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS flag and the __DRI_CTX_ATTRIB_RESET_STRATEGY attribute in create context. Some additional Mesa infrastructure is needed before drivers can do this. The GL_ARB_robustness spec, which all Mesa drivers already advertise, requires: "If the behavior is LOSE_CONTEXT_ON_RESET_ARB, a graphics reset will result in the loss of all context state, requiring the recreation of all associated objects." It is necessary to land this infrastructure now so that the related infrastructure can land in the xserver. The xserver has very long release schedules, and the remaining Mesa parts should land long, long before the next xserver merge window opens. v2: Expose robustness as a DRI2 extension rather than bumping __DRI_DRI2_VERSION. v3: Add a comment explaining why dri2->base.version >= 3 is also required for GLX_ARB_create_context_robustness. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/glx/dri_common.c')
-rw-r--r--src/glx/dri_common.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
index 07fd0154e1b..d170aa6f7e2 100644
--- a/src/glx/dri_common.c
+++ b/src/glx/dri_common.c
@@ -457,7 +457,8 @@ driReleaseDrawables(struct glx_context *gc)
_X_HIDDEN bool
dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
unsigned *major_ver, unsigned *minor_ver,
- uint32_t *flags, unsigned *api, unsigned *error)
+ uint32_t *flags, unsigned *api, int *reset,
+ unsigned *error)
{
unsigned i;
bool got_profile = false;
@@ -478,6 +479,7 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
*major_ver = 1;
*minor_ver = 0;
+ *reset = __DRI_CTX_RESET_NO_NOTIFICATION;
for (i = 0; i < num_attribs; i++) {
switch (attribs[i * 2]) {
@@ -497,6 +499,19 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
case GLX_RENDER_TYPE:
render_type = attribs[i * 2 + 1];
break;
+ case GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB:
+ switch (attribs[i * 2 + 1]) {
+ case GLX_NO_RESET_NOTIFICATION_ARB:
+ *reset = __DRI_CTX_RESET_NO_NOTIFICATION;
+ break;
+ case GLX_LOSE_CONTEXT_ON_RESET_ARB:
+ *reset = __DRI_CTX_RESET_LOSE_CONTEXT;
+ break;
+ default:
+ *error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
+ return false;
+ }
+ break;
default:
/* If an unknown attribute is received, fail.
*/
@@ -536,7 +551,8 @@ dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
/* Unknown flag value.
*/
- if (*flags & ~(__DRI_CTX_FLAG_DEBUG | __DRI_CTX_FLAG_FORWARD_COMPATIBLE)) {
+ if (*flags & ~(__DRI_CTX_FLAG_DEBUG | __DRI_CTX_FLAG_FORWARD_COMPATIBLE
+ | __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS)) {
*error = __DRI_CTX_ERROR_UNKNOWN_FLAG;
return false;
}