[Mesa-dev] [PATCH 05/10] mesa/dri: Add basic plumbing for GLX_ARB_robustness reset notification strategy

Ian Romanick idr at freedesktop.org
Wed Oct 30 02:07:03 CET 2013


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

No drivers advertise the DRI2 extension yet, so no driver should ever
see a value other than false for notify_reset.

The changes in nouveau use tabs because nouveau seems to have it's own
indentation rules.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/gallium/state_trackers/dri/common/dri_context.c | 6 ++++++
 src/mesa/drivers/dri/common/dri_util.c              | 7 ++++++-
 src/mesa/drivers/dri/common/dri_util.h              | 2 ++
 src/mesa/drivers/dri/i915/intel_screen.c            | 6 ++++++
 src/mesa/drivers/dri/i965/brw_context.c             | 6 ++++++
 src/mesa/drivers/dri/i965/brw_context.h             | 1 +
 src/mesa/drivers/dri/nouveau/nouveau_context.c      | 6 ++++++
 src/mesa/drivers/dri/nouveau/nouveau_context.h      | 3 ++-
 src/mesa/drivers/dri/r200/r200_context.c            | 6 ++++++
 src/mesa/drivers/dri/r200/r200_context.h            | 1 +
 src/mesa/drivers/dri/radeon/radeon_context.c        | 6 ++++++
 src/mesa/drivers/dri/radeon/radeon_context.h        | 1 +
 12 files changed, 49 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/dri/common/dri_context.c b/src/gallium/state_trackers/dri/common/dri_context.c
index ee3c8be..5cfd1ed 100644
--- a/src/gallium/state_trackers/dri/common/dri_context.c
+++ b/src/gallium/state_trackers/dri/common/dri_context.c
@@ -63,6 +63,7 @@ dri_create_context(gl_api api, const struct gl_config * visual,
 		   unsigned major_version,
 		   unsigned minor_version,
 		   uint32_t flags,
+                   bool notify_reset,
 		   unsigned *error,
 		   void *sharedContextPrivate)
 {
@@ -100,6 +101,11 @@ dri_create_context(gl_api api, const struct gl_config * visual,
       goto fail;
    }
 
+   if (notify_reset) {
+      *error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
+      goto fail;
+   }
+
    if (sharedContextPrivate) {
       st_share = ((struct dri_context *)sharedContextPrivate)->st;
    }
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index c28b0fc..8eb2de2 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -306,6 +306,7 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api,
     unsigned major_version = 1;
     unsigned minor_version = 0;
     uint32_t flags = 0;
+    bool notify_reset = false;
 
     assert((num_attribs == 0) || (attribs != NULL));
 
@@ -344,6 +345,10 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api,
 	case __DRI_CTX_ATTRIB_FLAGS:
 	    flags = attribs[i * 2 + 1];
 	    break;
+        case __DRI_CTX_ATTRIB_RESET_STRATEGY:
+            notify_reset = (attribs[i * 2 + 1]
+                            != __DRI_CTX_RESET_NO_NOTIFICATION);
+            break;
 	default:
 	    /* We can't create a context that satisfies the requirements of an
 	     * attribute that we don't understand.  Return failure.
@@ -424,7 +429,7 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api,
 
     if (!screen->driver->CreateContext(mesa_api, modes, context,
                                        major_version, minor_version,
-                                       flags, error, shareCtx) ) {
+                                       flags, notify_reset, error, shareCtx)) {
         free(context);
         return NULL;
     }
diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h
index 5b56061..b3c2165 100644
--- a/src/mesa/drivers/dri/common/dri_util.h
+++ b/src/mesa/drivers/dri/common/dri_util.h
@@ -57,6 +57,7 @@
 #include <GL/internal/dri_interface.h>
 #include "main/mtypes.h"
 #include "xmlconfig.h"
+#include <stdbool.h>
 
 /**
  * Extensions.
@@ -87,6 +88,7 @@ struct __DriverAPIRec {
 			       unsigned major_version,
 			       unsigned minor_version,
 			       uint32_t flags,
+                               bool notify_reset,
 			       unsigned *error,
                                void *sharedContextPrivate);
 
diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c
index 3f54752..a4b40b7 100644
--- a/src/mesa/drivers/dri/i915/intel_screen.c
+++ b/src/mesa/drivers/dri/i915/intel_screen.c
@@ -908,6 +908,7 @@ intelCreateContext(gl_api api,
 		   unsigned major_version,
 		   unsigned minor_version,
 		   uint32_t flags,
+                   bool notify_reset,
 		   unsigned *error,
                    void *sharedContextPrivate)
 {
@@ -916,6 +917,11 @@ intelCreateContext(gl_api api,
    __DRIscreen *sPriv = driContextPriv->driScreenPriv;
    struct intel_screen *intelScreen = sPriv->driverPrivate;
 
+   if (notify_reset) {
+      *error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
+      return false;
+   }
+
    if (IS_9XX(intelScreen->deviceID)) {
       success = i915CreateContext(api, mesaVis, driContextPriv,
                                   major_version, minor_version, error,
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 8420c65..474c1ee 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -505,6 +505,7 @@ brwCreateContext(gl_api api,
                  unsigned major_version,
                  unsigned minor_version,
                  uint32_t flags,
+                 bool notify_reset,
                  unsigned *dri_ctx_error,
 	         void *sharedContextPrivate)
 {
@@ -515,6 +516,11 @@ brwCreateContext(gl_api api,
    struct dd_function_table functions;
    struct gl_config visual;
 
+   if (notify_reset) {
+      *dri_ctx_error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
+      return false;
+   }
+
    struct brw_context *brw = rzalloc(NULL, struct brw_context);
    if (!brw) {
       printf("%s: failed to alloc context\n", __FUNCTION__);
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 7aacf4f..c439493 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1452,6 +1452,7 @@ bool brwCreateContext(gl_api api,
                       unsigned major_version,
                       unsigned minor_version,
                       uint32_t flags,
+                      bool notify_reset,
                       unsigned *error,
 		      void *sharedContextPrivate);
 
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index 0b648ac..a7f14b5 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -53,6 +53,7 @@ nouveau_context_create(gl_api api,
 		       unsigned major_version,
 		       unsigned minor_version,
 		       uint32_t flags,
+		       bool notify_reset,
 		       unsigned *error,
 		       void *share_ctx)
 {
@@ -65,6 +66,11 @@ nouveau_context_create(gl_api api,
 	 */
 	(void) flags;
 
+	if (notify_reset) {
+		*error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
+		return false;
+	}
+
 	ctx = screen->driver->context_create(screen, visual, share_ctx);
 	if (!ctx) {
 		*error = __DRI_CTX_ERROR_NO_MEMORY;
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.h b/src/mesa/drivers/dri/nouveau/nouveau_context.h
index 2bcc1e1..07d9605 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.h
@@ -111,7 +111,8 @@ GLboolean
 nouveau_context_create(gl_api api,
 		       const struct gl_config *visual, __DRIcontext *dri_ctx,
 		       unsigned major_version, unsigned minor_version,
-		       uint32_t flags, unsigned *error, void *share_ctx);
+		       uint32_t flags, bool notify_reset, unsigned *error,
+		       void *share_ctx);
 
 GLboolean
 nouveau_context_init(struct gl_context *ctx, struct nouveau_screen *screen,
diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c
index 8ed2c0c..58c300c 100644
--- a/src/mesa/drivers/dri/r200/r200_context.c
+++ b/src/mesa/drivers/dri/r200/r200_context.c
@@ -201,6 +201,7 @@ GLboolean r200CreateContext( gl_api api,
 			     unsigned major_version,
 			     unsigned minor_version,
 			     uint32_t flags,
+                             bool notify_reset,
 			     unsigned *error,
 			     void *sharedContextPrivate)
 {
@@ -216,6 +217,11 @@ GLboolean r200CreateContext( gl_api api,
     */
    (void) flags;
 
+   if (notify_reset) {
+      *error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
+      return false;
+   }
+
    assert(glVisual);
    assert(driContextPriv);
    assert(screen);
diff --git a/src/mesa/drivers/dri/r200/r200_context.h b/src/mesa/drivers/dri/r200/r200_context.h
index fb25dce..fed5d29 100644
--- a/src/mesa/drivers/dri/r200/r200_context.h
+++ b/src/mesa/drivers/dri/r200/r200_context.h
@@ -638,6 +638,7 @@ extern GLboolean r200CreateContext( gl_api api,
 				    unsigned major_version,
 				    unsigned minor_version,
 				    uint32_t flags,
+                                    bool notify_reset,
 				    unsigned *error,
 				    void *sharedContextPrivate);
 extern GLboolean r200MakeCurrent( __DRIcontext *driContextPriv,
diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c
index a9f29d7..c2200d7 100644
--- a/src/mesa/drivers/dri/radeon/radeon_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_context.c
@@ -168,6 +168,7 @@ r100CreateContext( gl_api api,
 		   unsigned major_version,
 		   unsigned minor_version,
 		   uint32_t flags,
+                   bool notify_reset,
 		   unsigned *error,
 		   void *sharedContextPrivate)
 {
@@ -183,6 +184,11 @@ r100CreateContext( gl_api api,
     */
    (void) flags;
 
+   if (notify_reset) {
+      *error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
+      return false;
+   }
+
    assert(glVisual);
    assert(driContextPriv);
    assert(screen);
diff --git a/src/mesa/drivers/dri/radeon/radeon_context.h b/src/mesa/drivers/dri/radeon/radeon_context.h
index 6ad1d4d..847baef 100644
--- a/src/mesa/drivers/dri/radeon/radeon_context.h
+++ b/src/mesa/drivers/dri/radeon/radeon_context.h
@@ -458,6 +458,7 @@ extern GLboolean r100CreateContext( gl_api api,
 				    unsigned major_version,
 				    unsigned minor_version,
 				    uint32_t flags,
+                                    bool notify_reset,
 				    unsigned *error,
 				    void *sharedContextPrivate);
 
-- 
1.8.1.4



More information about the mesa-dev mailing list