[Mesa-dev] [PATCH 9/9] hacks: Enable testing this series on slightly older userspace

Adam Jackson ajax at redhat.com
Tue May 12 08:54:50 PDT 2015


This hides the flush control attribute from the CreateContextAttribs
request.  Older X servers don't know about it and will throw an error,
and at least for purposes of testing it's not something that matters.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 src/glx/create_context.c | 19 ++++++++++++++++++-
 src/glx/glxextensions.c  |  2 +-
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/src/glx/create_context.c b/src/glx/create_context.c
index 38e949a..e9b8c6f 100644
--- a/src/glx/create_context.c
+++ b/src/glx/create_context.c
@@ -48,6 +48,8 @@ glXCreateContextAttribsARB(Display *dpy, GLXFBConfig config,
    xcb_void_cookie_t cookie;
    unsigned dummy_err = 0;
 
+   int attribs[64];
+
 
    if (dpy == NULL || cfg == NULL)
       return NULL;
@@ -93,6 +95,21 @@ glXCreateContextAttribsARB(Display *dpy, GLXFBConfig config,
    gc->xid = xcb_generate_id(c);
    gc->share_xid = (share != NULL) ? share->xid : 0;
 
+   /* hide flush from xserver */
+   memset(attribs, 0, sizeof(attribs));
+   if (num_attribs) {
+       int i, len = (num_attribs * 2 + 1) * sizeof(int);
+       memcpy(attribs, attrib_list, len);
+
+       for (i = 0; attrib_list[i]; i += 2) {
+	   if (attrib_list[i] == GLX_CONTEXT_RELEASE_BEHAVIOR_ARB) {
+	       memcpy(&(attribs[i]), &(attrib_list[i+1]), len - (i*sizeof(int)));
+	       num_attribs--;
+	       break;
+	   }
+       }
+   }
+
    /* The manual pages for glXCreateContext and glXCreateNewContext say:
     *
     *     "NULL is returned if execution fails on the client side."
@@ -110,7 +127,7 @@ glXCreateContextAttribsARB(Display *dpy, GLXFBConfig config,
 						 gc->isDirect,
 						 num_attribs,
 						 (const uint32_t *)
-						 attrib_list);
+						 num_attribs ? attribs : NULL);
    err = xcb_request_check(c, cookie);
    if (err != NULL) {
       gc->vtable->destroy(gc);
diff --git a/src/glx/glxextensions.c b/src/glx/glxextensions.c
index 4be3c11..fd289d1 100644
--- a/src/glx/glxextensions.c
+++ b/src/glx/glxextensions.c
@@ -165,7 +165,7 @@ static const struct extension_info known_glx_extensions[] = {
    { GLX(EXT_texture_from_pixmap),     VER(0,0), Y, N, N, N },
    { GLX(INTEL_swap_event),            VER(0,0), Y, N, N, N },
    { GLX(EXT_buffer_age),              VER(0,0), Y, N, N, Y },
-   { GLX(ARB_context_flush_control),   VER(0,0), Y, N, N, N },
+   { GLX(ARB_context_flush_control),   VER(0,0), Y, N, Y, N },
    { NULL }
 };
 
-- 
2.4.0



More information about the mesa-dev mailing list