Lines 35-60
Link Here
|
35 |
|
35 |
|
36 |
#define MAX_MODES 100 |
36 |
#define MAX_MODES 100 |
37 |
|
37 |
|
|
|
38 |
#ifdef EGL_MESA_screen_surface |
38 |
static EGLScreenMESA kms_screen; |
39 |
static EGLScreenMESA kms_screen; |
39 |
static EGLModeMESA kms_mode; |
40 |
static EGLModeMESA kms_mode; |
40 |
static EGLint kms_width, kms_height; |
41 |
static EGLint kms_width, kms_height; |
|
|
42 |
#endif |
41 |
|
43 |
|
42 |
void |
44 |
void |
43 |
_eglutNativeInitDisplay(void) |
45 |
_eglutNativeInitDisplay(void) |
44 |
{ |
46 |
{ |
|
|
47 |
#ifdef EGL_MESA_screen_surface |
45 |
_eglut->native_dpy = EGL_DEFAULT_DISPLAY; |
48 |
_eglut->native_dpy = EGL_DEFAULT_DISPLAY; |
46 |
_eglut->surface_type = EGL_SCREEN_BIT_MESA; |
49 |
_eglut->surface_type = EGL_SCREEN_BIT_MESA; |
|
|
50 |
#endif |
47 |
} |
51 |
} |
48 |
|
52 |
|
49 |
void |
53 |
void |
50 |
_eglutNativeFiniDisplay(void) |
54 |
_eglutNativeFiniDisplay(void) |
51 |
{ |
55 |
{ |
|
|
56 |
#ifdef EGL_MESA_screen_surface |
52 |
kms_screen = 0; |
57 |
kms_screen = 0; |
53 |
kms_mode = 0; |
58 |
kms_mode = 0; |
54 |
kms_width = 0; |
59 |
kms_width = 0; |
55 |
kms_height = 0; |
60 |
kms_height = 0; |
|
|
61 |
#endif |
56 |
} |
62 |
} |
57 |
|
63 |
|
|
|
64 |
#ifdef EGL_MESA_screen_surface |
58 |
static void |
65 |
static void |
59 |
init_kms(void) |
66 |
init_kms(void) |
60 |
{ |
67 |
{ |
Lines 94-112
init_kms(void)
Link Here
|
94 |
kms_width = width; |
101 |
kms_width = width; |
95 |
kms_height = height; |
102 |
kms_height = height; |
96 |
} |
103 |
} |
|
|
104 |
#endif |
97 |
|
105 |
|
98 |
void |
106 |
void |
99 |
_eglutNativeInitWindow(struct eglut_window *win, const char *title, |
107 |
_eglutNativeInitWindow(struct eglut_window *win, const char *title, |
100 |
int x, int y, int w, int h) |
108 |
int x, int y, int w, int h) |
101 |
{ |
109 |
{ |
|
|
110 |
#ifdef EGL_MESA_screen_surface |
102 |
EGLint surf_attribs[16]; |
111 |
EGLint surf_attribs[16]; |
103 |
EGLint i; |
112 |
EGLint i; |
|
|
113 |
#endif |
104 |
const char *exts; |
114 |
const char *exts; |
105 |
|
115 |
|
106 |
exts = eglQueryString(_eglut->dpy, EGL_EXTENSIONS); |
116 |
exts = eglQueryString(_eglut->dpy, EGL_EXTENSIONS); |
107 |
if (!exts || !strstr(exts, "EGL_MESA_screen_surface")) |
117 |
if (!exts || !strstr(exts, "EGL_MESA_screen_surface")) |
108 |
_eglutFatal("EGL_MESA_screen_surface is not supported\n"); |
118 |
_eglutFatal("EGL_MESA_screen_surface is not supported\n"); |
109 |
|
119 |
|
|
|
120 |
#ifdef EGL_MESA_screen_surface |
110 |
init_kms(); |
121 |
init_kms(); |
111 |
|
122 |
|
112 |
i = 0; |
123 |
i = 0; |
Lines 128-141
_eglutNativeInitWindow(struct eglut_window *win, const char *title,
Link Here
|
128 |
|
139 |
|
129 |
win->native.width = kms_width; |
140 |
win->native.width = kms_width; |
130 |
win->native.height = kms_height; |
141 |
win->native.height = kms_height; |
|
|
142 |
#endif |
131 |
} |
143 |
} |
132 |
|
144 |
|
133 |
void |
145 |
void |
134 |
_eglutNativeFiniWindow(struct eglut_window *win) |
146 |
_eglutNativeFiniWindow(struct eglut_window *win) |
135 |
{ |
147 |
{ |
|
|
148 |
#ifdef EGL_MESA_screen_surface |
136 |
eglShowScreenSurfaceMESA(_eglut->dpy, |
149 |
eglShowScreenSurfaceMESA(_eglut->dpy, |
137 |
kms_screen, EGL_NO_SURFACE, 0); |
150 |
kms_screen, EGL_NO_SURFACE, 0); |
138 |
eglDestroySurface(_eglut->dpy, win->native.u.surface); |
151 |
eglDestroySurface(_eglut->dpy, win->native.u.surface); |
|
|
152 |
#endif |
139 |
} |
153 |
} |
140 |
|
154 |
|
141 |
void |
155 |
void |