egl: use softpipe_egl driver by default
authorBrian Paul <brian.paul@tungstengraphics.com>
Thu, 29 May 2008 23:01:19 +0000 (17:01 -0600)
committerBrian Paul <brian.paul@tungstengraphics.com>
Thu, 29 May 2008 23:04:24 +0000 (17:04 -0600)
src/egl/main/eglx.c

index 4b33080f1a65ea79220bb888d5f94c1c3f90bd3b..085da33e7dc2bc5be570d987142f8cc545ed847b 100644 (file)
@@ -12,6 +12,8 @@
 #include "eglx.h"
 
 
+static const char *DefaultXDriver = "softpipe_egl";
+
 
 /**
  * Given an X Display ptr (at dpy->Xdpy) try to determine the appropriate
@@ -21,14 +23,24 @@ const char *
 _xeglChooseDriver(_EGLDisplay *dpy)
 {
 #ifdef _EGL_PLATFORM_X
-   _XPrivDisplay xdpy = (_XPrivDisplay) dpy->Xdpy;
+   _XPrivDisplay xdpy;
 
    assert(dpy);
+
+   if (!dpy->Xdpy) {
+      dpy->Xdpy = XOpenDisplay(NULL);
+      if (!dpy->Xdpy) {
+         /* can't open X display -> can't use X-based driver */
+         return NULL;
+      }
+   }
+   xdpy = (_XPrivDisplay) dpy->Xdpy;
+
    assert(dpy->Xdpy);
 
    printf("%s\n", xdpy->display_name);
 
-   return "foo"; /* XXX todo */
+   return DefaultXDriver; /* XXX temporary */
 #else
    return NULL;
 #endif