egl_dri2: Use createContextAttribs if DRI2 version >= 3
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 18 Jul 2012 21:41:28 +0000 (14:41 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Tue, 14 Aug 2012 22:41:02 +0000 (15:41 -0700)
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/egl/drivers/dri2/egl_dri2.c

index cc37bf029328e795ca0cf32b5d2958ae3355a932..3bf46aa2185048406d84ed894bdab786b07e73aa 100644 (file)
@@ -697,7 +697,23 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
       dri_config = NULL;
 
    if (dri2_dpy->dri2) {
-      {
+      if (dri2_dpy->dri2->base.version >= 3) {
+         unsigned error;
+         const uint32_t ctx_attribs[2] = {
+            __DRI_CTX_ATTRIB_MAJOR_VERSION,
+            dri2_ctx->base.ClientVersion
+         };
+
+        dri2_ctx->dri_context =
+           dri2_dpy->dri2->createContextAttribs(dri2_dpy->dri_screen,
+                                                 api,
+                                                 dri_config,
+                                                 shared,
+                                                 1,
+                                                 ctx_attribs,
+                                                 & error,
+                                                 dri2_ctx);
+      } else {
         dri2_ctx->dri_context =
            dri2_dpy->dri2->createNewContextForAPI(dri2_dpy->dri_screen,
                                                   api,