mesa/dri: Add basic plumbing for GLX_ARB_robustness reset notification strategy
authorIan Romanick <ian.d.romanick@intel.com>
Mon, 10 Sep 2012 14:11:33 +0000 (17:11 +0300)
committerIan Romanick <ian.d.romanick@intel.com>
Fri, 8 Nov 2013 01:31:16 +0000 (17:31 -0800)
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@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
12 files changed:
src/gallium/state_trackers/dri/common/dri_context.c
src/mesa/drivers/dri/common/dri_util.c
src/mesa/drivers/dri/common/dri_util.h
src/mesa/drivers/dri/i915/intel_screen.c
src/mesa/drivers/dri/i965/brw_context.c
src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/nouveau/nouveau_context.c
src/mesa/drivers/dri/nouveau/nouveau_context.h
src/mesa/drivers/dri/r200/r200_context.c
src/mesa/drivers/dri/r200/r200_context.h
src/mesa/drivers/dri/radeon/radeon_context.c
src/mesa/drivers/dri/radeon/radeon_context.h

index ee3c8be860b020ce7830cea7be495f5275d7c648..5cfd1edfc81a66bc44d0b07a79665e526368569d 100644 (file)
@@ -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;
    }
index c28b0fc417495568878944e39302244321341687..8eb2de20853174869635635e69ae9379018c3423 100644 (file)
@@ -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;
     }
index 5b56061e29919df4cea9cbde14d429c9efc55005..b3c216516113efc86f4e92acb4cf3f1d54b0c952 100644 (file)
@@ -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);
 
index 3f5475245140885f0457dc968c00aca846ad768e..a4b40b74dbbf0777ee0897cfc03be347a72d3e76 100644 (file)
@@ -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,
index 776d8b303e5f507e42e5bb02f55a6ec5d975949c..01fb988042262df3dd673f7c5d8e67575e9e1af4 100644 (file)
@@ -569,6 +569,7 @@ brwCreateContext(gl_api api,
                  unsigned major_version,
                  unsigned minor_version,
                  uint32_t flags,
+                 bool notify_reset,
                  unsigned *dri_ctx_error,
                 void *sharedContextPrivate)
 {
@@ -579,6 +580,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__);
index 12dfb8eac09b736a278a837969e14962d1bb1d7b..45225bcce1ca2bf0655700b347b7bea1de1287bd 100644 (file)
@@ -1473,6 +1473,7 @@ GLboolean brwCreateContext(gl_api api,
                       unsigned major_version,
                       unsigned minor_version,
                       uint32_t flags,
+                      bool notify_reset,
                       unsigned *error,
                      void *sharedContextPrivate);
 
index 0b648acb46fdb0330541c7afa508266ea922823c..a7f14b518d1bd7bc48c251bc01b75ea5b8b7d6b1 100644 (file)
@@ -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;
index 2bcc1e12782f9799a1a9fabfac98469e87ca3e71..07d9605b8866e19b689721ed317bee82df1207cb 100644 (file)
@@ -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,
index 8ed2c0c2de6fc35688b2cb314473ed0fe49678b4..58c300c3d60bdda415b212f46f671730bce0c49a 100644 (file)
@@ -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);
index fb25dceb9925f58a30ece79a74f76bb831f20d71..fed5d29dc7d690feeb9088301309e66dadb02b80 100644 (file)
@@ -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,
index a9f29d7bebfa6250f459774466f570d70fb0d136..c2200d70e45050cf3045052b21da278505bf0332 100644 (file)
@@ -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);
index 6ad1d4d48ad631a6d08d7b49011626212a6732c3..847baef388f3fd54e77e2c74c1b59b13b5fefb45 100644 (file)
@@ -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);