Mesa (master): mesa: Implement proper tracking logic for glGetGraphicsResetStatusARB

Ian Romanick idr at kemper.freedesktop.org
Fri Nov 8 00:41:51 UTC 2013


Module: Mesa
Branch: master
Commit: 916bc4491a2a7607bf2bd22aa1a5a537285c89c9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=916bc4491a2a7607bf2bd22aa1a5a537285c89c9

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Wed Sep  5 22:31:59 2012 -0700

mesa: Implement proper tracking logic for glGetGraphicsResetStatusARB

Drivers still have to implement dd_function_table::GetGraphicsResetStatus.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Brian Paul <brianp at vmware.com>

---

 src/mesa/main/getstring.c |   47 +++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 43 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c
index 23f1e09..d818911 100644
--- a/src/mesa/main/getstring.c
+++ b/src/mesa/main/getstring.c
@@ -23,7 +23,7 @@
  */
 
 
-
+#include <stdbool.h>
 #include "glheader.h"
 #include "context.h"
 #include "get.h"
@@ -307,9 +307,48 @@ _mesa_GetGraphicsResetStatusARB( void )
    GET_CURRENT_CONTEXT(ctx);
    GLenum status = GL_NO_ERROR;
 
-   if (MESA_VERBOSE & VERBOSE_API)
-      _mesa_debug(ctx, "glGetGraphicsResetStatusARB"
-                       "(always returns GL_NO_ERROR)\n");
+   /* The ARB_robustness specification says:
+    *
+    *     "If the reset notification behavior is NO_RESET_NOTIFICATION_ARB,
+    *     then the implementation will never deliver notification of reset
+    *     events, and GetGraphicsResetStatusARB will always return NO_ERROR."
+    */
+   if (ctx->Const.ResetStrategy == GL_NO_RESET_NOTIFICATION_ARB) {
+      if (MESA_VERBOSE & VERBOSE_API)
+         _mesa_debug(ctx,
+                     "glGetGraphicsResetStatusARB always returns GL_NO_ERROR "
+                     "because reset notifictation was not requested at context "
+                     "creation.\n");
+
+      return GL_NO_ERROR;
+   }
+
+   if (ctx->Driver.GetGraphicsResetStatus) {
+      /* Query the reset status of this context from the driver core.
+       */
+      status = ctx->Driver.GetGraphicsResetStatus(ctx);
+
+      _glthread_LOCK_MUTEX(ctx->Shared->Mutex);
+
+      /* If this context has not been affected by a GPU reset, check to see if
+       * some other context in the share group has been affected by a reset.
+       * If another context saw a reset but this context did not, assume that
+       * this context was not guilty.
+       */
+      if (status != GL_NO_ERROR) {
+         ctx->Shared->ShareGroupReset = true;
+      } else if (ctx->Shared->ShareGroupReset && !ctx->ShareGroupReset) {
+         status = GL_INNOCENT_CONTEXT_RESET_ARB;
+      }
+
+      ctx->ShareGroupReset = ctx->Shared->ShareGroupReset;
+      _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
+   }
+
+   if (!ctx->Driver.GetGraphicsResetStatus && (MESA_VERBOSE & VERBOSE_API))
+      _mesa_debug(ctx,
+                  "glGetGraphicsResetStatusARB always returns GL_NO_ERROR "
+                  "because the driver doesn't track reset status.\n");
 
    return status;
 }




More information about the mesa-commit mailing list