085da33e7dc2bc5be570d987142f8cc545ed847b
[mesa.git] / src / egl / main / eglx.c
1
2 /**
3 * X-specific EGL code.
4 *
5 * Any glue code needed to make EGL work with X is placed in this file.
6 */
7
8
9 #include <assert.h>
10 #include <stdio.h>
11 #include <X11/Xlib.h>
12 #include "eglx.h"
13
14
15 static const char *DefaultXDriver = "softpipe_egl";
16
17
18 /**
19 * Given an X Display ptr (at dpy->Xdpy) try to determine the appropriate
20 * device driver. Return its name.
21 */
22 const char *
23 _xeglChooseDriver(_EGLDisplay *dpy)
24 {
25 #ifdef _EGL_PLATFORM_X
26 _XPrivDisplay xdpy;
27
28 assert(dpy);
29
30 if (!dpy->Xdpy) {
31 dpy->Xdpy = XOpenDisplay(NULL);
32 if (!dpy->Xdpy) {
33 /* can't open X display -> can't use X-based driver */
34 return NULL;
35 }
36 }
37 xdpy = (_XPrivDisplay) dpy->Xdpy;
38
39 assert(dpy->Xdpy);
40
41 printf("%s\n", xdpy->display_name);
42
43 return DefaultXDriver; /* XXX temporary */
44 #else
45 return NULL;
46 #endif
47 }
48
49