[PATCH 5/5] glx: Implement GLX_ARB_robustness_isolation

Adam Jackson ajax at redhat.com
Tue Jun 2 10:41:08 PDT 2015


This is speculative, pending Mesa growing something like:

http://patchwork.freedesktop.org/patch/49733/

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 glx/createcontext.c    | 13 ++++++++++---
 glx/extension_string.c |  1 +
 glx/extension_string.h |  1 +
 glx/glxdri2.c          | 11 +++++++++++
 glx/glxdriswrast.c     | 11 +++++++++++
 5 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/glx/createcontext.c b/glx/createcontext.c
index d06bc1f..10eaaef 100644
--- a/glx/createcontext.c
+++ b/glx/createcontext.c
@@ -29,9 +29,16 @@
 #include "glxext.h"
 #include "indirect_dispatch.h"
 
-#define ALL_VALID_FLAGS \
-    (GLX_CONTEXT_DEBUG_BIT_ARB | GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB \
-     | GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB)
+#ifndef GLX_CONTEXT_RESET_ISOLATION_BIT_ARB
+#define GLX_CONTEXT_RESET_ISOLATION_BIT_ARB 0x8
+#endif
+
+#define ALL_VALID_FLAGS (\
+    GLX_CONTEXT_DEBUG_BIT_ARB | \
+    GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB | \
+    GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB | \
+    GLX_CONTEXT_RESET_ISOLATION_BIT_ARB | \
+    0)
 
 static Bool
 validate_GL_version(int major_version, int minor_version)
diff --git a/glx/extension_string.c b/glx/extension_string.c
index b0f53cf..bbab850 100644
--- a/glx/extension_string.c
+++ b/glx/extension_string.c
@@ -79,6 +79,7 @@ static const struct extension_info known_glx_extensions[] = {
     { GLX(ARB_fbconfig_float),          VER(0,0), N, },
     { GLX(ARB_framebuffer_sRGB),        VER(0,0), N, },
     { GLX(ARB_multisample),             VER(1,4), Y, },
+    { GLX(ARB_robustness_isolation),    VER(0,0), N, },
 
     { GLX(EXT_create_context_es2_profile), VER(0,0), N, },
     { GLX(EXT_framebuffer_sRGB),        VER(0,0), N, },
diff --git a/glx/extension_string.h b/glx/extension_string.h
index ce10918..0c7bbdf 100644
--- a/glx/extension_string.h
+++ b/glx/extension_string.h
@@ -43,6 +43,7 @@ enum {
     ARB_fbconfig_float_bit,
     ARB_framebuffer_sRGB_bit,
     ARB_multisample_bit,
+    ARB_robustness_isolation_bit,
     EXT_create_context_es2_profile_bit,
     EXT_import_context_bit,
     EXT_stereo_tree_bit,
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index d5f47ab..ebcf218 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -848,6 +848,7 @@ initializeExtensions(__GLXDRIscreen * screen)
 {
     ScreenPtr pScreen = screen->base.pScreen;
     const __DRIextension **extensions;
+    uint32_t context_flags = 0;
     int i;
 
     extensions = screen->core->getExtensions(screen->driScreen);
@@ -868,6 +869,16 @@ initializeExtensions(__GLXDRIscreen * screen)
                    "AIGLX: enabled GLX_EXT_create_context_es2_profile\n");
     }
 
+#if __DRI_DRI2_VERSION > 5
+    if (screen->dri2->base.version >= 5) {
+        context_flags = screen->dri2->contextFlags(screen->driScreen);
+    }
+#endif
+
+    if (context_flags & __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS)
+        __glXEnableExtension(screen->glx_enable_bits,
+                             "GLX_ARB_robustness_isolation");
+
     if (DRI2HasSwapControl(pScreen)) {
         __glXEnableExtension(screen->glx_enable_bits, "GLX_INTEL_swap_event");
         __glXEnableExtension(screen->glx_enable_bits, "GLX_SGI_swap_control");
diff --git a/glx/glxdriswrast.c b/glx/glxdriswrast.c
index 9add2a1..a3e7a06 100644
--- a/glx/glxdriswrast.c
+++ b/glx/glxdriswrast.c
@@ -394,6 +394,7 @@ static void
 initializeExtensions(__GLXDRIscreen * screen)
 {
     const __DRIextension **extensions;
+    uint32_t context_flags = 0;
     int i;
 
     if (screen->swrast->base.version >= 3) {
@@ -405,6 +406,16 @@ initializeExtensions(__GLXDRIscreen * screen)
                              "GLX_EXT_create_context_es2_profile");
     }
 
+#if __DRI_SWRAST_VERSION > 5
+    if (screen->swrast->base.version >= 5) {
+        context_flags = screen->swrast->contextFlags(screen->driScreen);
+    }
+#endif
+
+    if (context_flags & __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS)
+        __glXEnableExtension(screen->glx_enable_bits,
+                             "GLX_ARB_robustness_isolation");
+
     /* these are harmless to enable unconditionally */
     __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_framebuffer_sRGB");
     __glXEnableExtension(screen->glx_enable_bits, "GLX_ARB_fbconfig_float");
-- 
2.4.1



More information about the xorg-devel mailing list