glx: Hack around versions of XCB that lack GLX_ARB_create_context support
authorIan Romanick <ian.d.romanick@intel.com>
Tue, 3 Jan 2012 01:44:31 +0000 (17:44 -0800)
committerDave Airlie <airlied@redhat.com>
Tue, 3 Jan 2012 10:24:10 +0000 (10:24 +0000)
A lot of tests in 'make check' will fail under these circumstances,
but at least the build should work.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/glx/create_context.c
src/glx/glxextensions.c

index 41f08057a8dc1c80bcfdadc98d36b51016ea7351..11f9340a2e8b3da2837a9cd4b2df3144fa85a793 100644 (file)
@@ -94,6 +94,7 @@ glXCreateContextAttribsARB(Display *dpy, GLXFBConfig config,
     * the protocol error and handle it.  Part of handling the error is freeing
     * the possibly non-NULL value returned by this function.
     */
+#ifdef XCB_GLX_CREATE_CONTEXT_ATTRIBS_ARB
    cookie =
       xcb_glx_create_context_attribs_arb_checked(c,
                                                 gc->xid,
@@ -105,6 +106,19 @@ glXCreateContextAttribsARB(Display *dpy, GLXFBConfig config,
                                                 (const uint32_t *)
                                                 attrib_list);
    err = xcb_request_check(c, cookie);
+#else
+   /* This is a hugely ugly hack to make things compile on systems that lack
+    * the proper XCB version.
+    */
+   memset(&cookie, 0, sizeof(cookie));
+
+   err = calloc(1, sizeof(*err));
+   err->error_code = BadRequest;
+   err->sequence = dpy->request;
+   err->resource_id = gc->xid;
+   err->minor_code = gc->majorOpcode;
+   err->major_code = 34;
+#endif
    if (err != NULL) {
       gc->vtable->destroy(gc);
       gc = NULL;
index 73b84dc7fe9718ed75e6ad882f1b94f12ba26837..0fcd8a9e8b5db066a757016371b3d46be1278f7a 100644 (file)
@@ -71,8 +71,13 @@ struct extension_info
 
 /* *INDENT-OFF* */
 static const struct extension_info known_glx_extensions[] = {
+#ifdef XCB_GLX_CREATE_CONTEXT_ATTRIBS_ARB
    { GLX(ARB_create_context),          VER(0,0), Y, N, N, N },
    { GLX(ARB_create_context_profile),  VER(0,0), Y, N, N, N },
+#else
+   { GLX(ARB_create_context),          VER(0,0), N, N, N, N },
+   { GLX(ARB_create_context_profile),  VER(0,0), N, N, N, N },
+#endif
    { GLX(ARB_get_proc_address),        VER(1,4), Y, N, Y, N },
    { GLX(ARB_multisample),             VER(1,4), Y, Y, N, N },
    { GLX(ATI_pixel_format_float),      VER(0,0), N, N, N, N },
@@ -80,7 +85,11 @@ static const struct extension_info known_glx_extensions[] = {
    { GLX(EXT_visual_info),             VER(0,0), Y, Y, N, N },
    { GLX(EXT_visual_rating),           VER(0,0), Y, Y, N, N },
    { GLX(EXT_framebuffer_sRGB),        VER(0,0), Y, Y, N, N },
+#ifdef XCB_GLX_CREATE_CONTEXT_ATTRIBS_ARB
    { GLX(EXT_create_context_es2_profile), VER(0,0), Y, N, N, Y },
+#else
+   { GLX(EXT_create_context_es2_profile), VER(0,0), N, N, N, N },
+#endif
    { GLX(MESA_copy_sub_buffer),        VER(0,0), Y, N, N, N },
    { GLX(MESA_multithread_makecurrent),VER(0,0), Y, N, Y, N },
    { GLX(MESA_swap_control),           VER(0,0), Y, N, N, Y },