summaryrefslogtreecommitdiffstats
path: root/src/egl/main/eglx.c
blob: 085da33e7dc2bc5be570d987142f8cc545ed847b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

/**
 * X-specific EGL code.
 *
 * Any glue code needed to make EGL work with X is placed in this file.
 */


#include <assert.h>
#include <stdio.h>
#include <X11/Xlib.h>
#include "eglx.h"


static const char *DefaultXDriver = "softpipe_egl";


/**
 * Given an X Display ptr (at dpy->Xdpy) try to determine the appropriate
 * device driver.  Return its name.
 */
const char *
_xeglChooseDriver(_EGLDisplay *dpy)
{
#ifdef _EGL_PLATFORM_X
   _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 DefaultXDriver; /* XXX temporary */
#else
   return NULL;
#endif
}