[PATCH xserver 1/2] glx: Enable GLX_ARB_create_context_no_error (v2)

Adam Jackson ajax at redhat.com
Tue Feb 20 16:03:45 UTC 2018


This is mostly for the client library's convenience, if this extension
is listed then it can know the attribute won't be rejected. Note that we
don't honor this attribute for indirect contexts. That's fine, we don't
want to introduce undefined behavior into a potentially privileged
process.

v2: Remember to ignore the attribute (Eric Anholt)

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 glx/createcontext.c    | 4 ++++
 glx/extension_string.c | 1 +
 glx/extension_string.h | 1 +
 glx/glxdri2.c          | 7 ++++++-
 glx/glxdriswrast.c     | 2 ++
 glx/glxserver.h        | 4 ++++
 6 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/glx/createcontext.c b/glx/createcontext.c
index 00c23fcddf..7d09c3a1c7 100644
--- a/glx/createcontext.c
+++ b/glx/createcontext.c
@@ -218,6 +218,10 @@ __glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc)
                 return BadValue;
             break;
 
+        case GLX_CONTEXT_OPENGL_NO_ERROR_ARB:
+            /* ignore */
+            break;
+
         default:
             if (!req->isDirect)
                 return BadValue;
diff --git a/glx/extension_string.c b/glx/extension_string.c
index 102f9dd42b..354ce06f71 100644
--- a/glx/extension_string.c
+++ b/glx/extension_string.c
@@ -74,6 +74,7 @@ static const struct extension_info known_glx_extensions[] = {
     /* *INDENT-OFF* */
     { GLX(ARB_context_flush_control),   VER(0,0), N, },
     { GLX(ARB_create_context),          VER(0,0), N, },
+    { GLX(ARB_create_context_no_error), VER(0,0), N, },
     { GLX(ARB_create_context_profile),  VER(0,0), N, },
     { GLX(ARB_create_context_robustness), VER(0,0), N, },
     { GLX(ARB_fbconfig_float),          VER(0,0), N, },
diff --git a/glx/extension_string.h b/glx/extension_string.h
index f049f58400..eab385a3c7 100644
--- a/glx/extension_string.h
+++ b/glx/extension_string.h
@@ -38,6 +38,7 @@ enum {
 /*   GLX_ARB_get_proc_address is implemented on the client. */
     ARB_context_flush_control_bit = 0,
     ARB_create_context_bit,
+    ARB_create_context_no_error_bit,
     ARB_create_context_profile_bit,
     ARB_create_context_robustness_bit,
     ARB_fbconfig_float_bit,
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index 6887e199c8..25ee9acf92 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -42,10 +42,10 @@
 #include <xf86.h>
 #include <dri2.h>
 
+#include <GL/glxtokens.h>
 #include "glxserver.h"
 #include "glxutil.h"
 #include "glxdricommon.h"
-#include <GL/glxtokens.h>
 
 #include "extension_string.h"
 
@@ -402,6 +402,9 @@ dri2_convert_glx_attribs(__GLXDRIscreen *screen, unsigned num_attribs,
                 return FALSE;
             }
             break;
+        case GLX_CONTEXT_OPENGL_NO_ERROR_ARB:
+            /* ignore */
+            break;
         default:
             /* If an unknown attribute is received, fail.
              */
@@ -832,6 +835,8 @@ initializeExtensions(__GLXscreen * screen)
     if (dri->dri2->base.version >= 3) {
         __glXEnableExtension(screen->glx_enable_bits,
                              "GLX_ARB_create_context");
+        __glXEnableExtension(screen->glx_enable_bits,
+                             "GLX_ARB_create_context_no_error");
         __glXEnableExtension(screen->glx_enable_bits,
                              "GLX_ARB_create_context_profile");
         __glXEnableExtension(screen->glx_enable_bits,
diff --git a/glx/glxdriswrast.c b/glx/glxdriswrast.c
index caad9a1fe7..2858312de7 100644
--- a/glx/glxdriswrast.c
+++ b/glx/glxdriswrast.c
@@ -356,6 +356,8 @@ initializeExtensions(__GLXscreen * screen)
     if (dri->swrast->base.version >= 3) {
         __glXEnableExtension(screen->glx_enable_bits,
                              "GLX_ARB_create_context");
+        __glXEnableExtension(screen->glx_enable_bits,
+                             "GLX_ARB_create_context_no_error");
         __glXEnableExtension(screen->glx_enable_bits,
                              "GLX_ARB_create_context_profile");
         __glXEnableExtension(screen->glx_enable_bits,
diff --git a/glx/glxserver.h b/glx/glxserver.h
index 60bdeb00d9..79f4944d05 100644
--- a/glx/glxserver.h
+++ b/glx/glxserver.h
@@ -50,6 +50,10 @@
 #include <GL/glext.h>
 #include <GL/glxproto.h>
 
+#ifndef GLX_CONTEXT_OPENGL_NO_ERROR_ARB
+#define GLX_CONTEXT_OPENGL_NO_ERROR_ARB 0x31B3
+#endif
+
 /*
 ** GLX resources.
 */
-- 
2.14.3



More information about the xorg-devel mailing list