blob: 6840adff21ef281e89e2ebc86d2fd6b66e54e156 (
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
50
51
52
53
54
55
|
#include "yagl_x11_platform.h"
#include "yagl_x11_display.h"
#include "yagl_native_platform.h"
#include "yagl_log.h"
#include "EGL/egl.h"
#include <X11/Xlib.h>
static int yagl_x11_platform_probe(yagl_os_display os_dpy)
{
/*
* Can't probe for X11, so assume probe passed.
*/
return 1;
}
static struct yagl_native_display
*yagl_x11_wrap_display(yagl_os_display os_dpy,
int enable_drm)
{
struct yagl_native_display *dpy;
YAGL_LOG_FUNC_SET(eglGetDisplay);
if (os_dpy == (yagl_os_display)EGL_DEFAULT_DISPLAY) {
Display *x_dpy = XOpenDisplay(0);
if (!x_dpy) {
YAGL_LOG_ERROR("unable to open display 0");
return NULL;
}
dpy = yagl_x11_display_create(&yagl_x11_platform,
(yagl_os_display)x_dpy,
1,
enable_drm);
if (!dpy) {
XCloseDisplay(x_dpy);
}
} else {
dpy = yagl_x11_display_create(&yagl_x11_platform,
os_dpy,
0,
enable_drm);
}
return dpy;
}
struct yagl_native_platform yagl_x11_platform =
{
.probe = yagl_x11_platform_probe,
.wrap_display = yagl_x11_wrap_display
};
|