[PATCH 7/9] glx: Track the reset notification strategy for a context

Ian Romanick idr at freedesktop.org
Wed Jul 4 15:21:07 PDT 2012


From: Ian Romanick <ian.d.romanick at intel.com>

Also require that the reset notification for a new context and the other
context in the share group match.  There isn't yet any way to specify a
non-default reset notification strategy, but that will come.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 glx/createcontext.c |   16 ++++++++++++++++
 glx/glxcmds.c       |   10 ++++++++++
 glx/glxcontext.h    |    5 +++++
 3 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/glx/createcontext.c b/glx/createcontext.c
index 205a919..7d653e9 100644
--- a/glx/createcontext.c
+++ b/glx/createcontext.c
@@ -90,6 +90,13 @@ __glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc)
     __GLXconfig *config;
     int err;
 
+    /* The GLX_ARB_create_context_robustness spec says:
+     *
+     *     "The default value for GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB
+     *     is GLX_NO_RESET_NOTIFICATION_ARB."
+     */
+    int reset = GLX_NO_RESET_NOTIFICATION_ARB;
+
     /* The GLX_ARB_create_context_profile spec says:
      *
      *     "The default value for GLX_CONTEXT_PROFILE_MASK_ARB is
@@ -259,6 +266,14 @@ __glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc)
         return __glXError(GLXBadProfileARB);
     }
 
+    /* The GLX_ARB_create_context_robustness spec says:
+     *
+     *     "* If the reset notification behavior of <share_context> and the
+     *        newly created context are different, BadMatch is generated."
+     */
+    if (shareCtx != NULL && shareCtx->resetNotificationStrategy != reset)
+        return BadMatch;
+
     /* There is no GLX protocol for desktop OpenGL versions after 1.4.  There
      * is no GLX protocol for any version of OpenGL ES.  If the application is
      * requested an indirect rendering context for a version that cannot be
@@ -306,6 +321,7 @@ __glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc)
     ctx->selectBufSize = 0;
     ctx->drawPriv = NULL;
     ctx->readPriv = NULL;
+    ctx->resetNotificationStrategy = reset;
 
     /* Add the new context to the various global tables of GLX contexts.
      */
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index d483bbf..d054219 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -308,6 +308,16 @@ DoCreateContext(__GLXclientState * cl, GLXContextID gcId,
     glxc->drawPriv = NULL;
     glxc->readPriv = NULL;
 
+    /* The GLX_ARB_create_context_robustness spec says:
+     *
+     *     "The default value for GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB
+     *     is GLX_NO_RESET_NOTIFICATION_ARB."
+     *
+     * Without using glXCreateContextAttribsARB, there is no way to specify a
+     * non-default reset notification strategy.
+     */
+    glxc->resetNotificationStrategy = GLX_NO_RESET_NOTIFICATION_ARB;
+
     /* Add the new context to the various global tables of GLX contexts.
      */
     if (!__glXAddContext(glxc)) {
diff --git a/glx/glxcontext.h b/glx/glxcontext.h
index b803a7f..4764e56 100644
--- a/glx/glxcontext.h
+++ b/glx/glxcontext.h
@@ -104,6 +104,11 @@ struct __GLXcontext {
      */
     GLenum renderMode;
 
+    /**
+     * Reset notification strategy used when a GPU reset occurs.
+     */
+    GLenum resetNotificationStrategy;
+
     /*
      ** Buffers for feedback and selection.
      */
-- 
1.7.6.5



More information about the xorg-devel mailing list