]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/blob
a2621ce732f7355270ce95115035f23de0d8a827
[thirdparty/openembedded/openembedded-core-contrib.git] /
1 commit 74443c6ee79f3251f643ea05e94df58183e37d0d
2 Author: Matt Turner <mattst88@gmail.com>
3 Date: Fri Aug 28 15:57:38 2015 -0700
4
5 egl: Remove demos using EGL_MESA_screen_surface.
6
7 The remnants of the extension were removed from Mesa in commit 7a58262e.
8
9 Reviewed-by: Andreas Boll <andreas.boll.dev@gmail.com>
10 Tested-by: Andreas Boll <andreas.boll.dev@gmail.com>
11 Reviewed-by: Marek Olšák <marek.olsak@amd.com>
12
13 Upstream-Status: Backport
14
15 diff --git a/src/egl/eglut/Makefile.am b/src/egl/eglut/Makefile.am
16 index 2d2f2af..b765069 100644
17 --- a/src/egl/eglut/Makefile.am
18 +++ b/src/egl/eglut/Makefile.am
19 @@ -33,17 +33,12 @@ if HAVE_WAYLAND
20 eglut_wayland = libeglut_wayland.la
21 endif
22
23 -noinst_LTLIBRARIES = libeglut_screen.la $(eglut_x11) $(eglut_wayland)
24 +noinst_LTLIBRARIES = $(eglut_x11) $(eglut_wayland)
25 endif
26
27 -libeglut_screen_la_SOURCES = \
28 - eglut.c \
29 - eglut.h \
30 - eglutint.h \
31 - eglut_screen.c
32 -
33 libeglut_x11_la_SOURCES = \
34 eglut.c \
35 + eglut.h \
36 eglutint.h \
37 eglut_x11.c
38 libeglut_x11_la_CFLAGS = $(X11_CFLAGS) $(EGL_CFLAGS)
39 @@ -52,6 +47,7 @@ libeglut_x11_la_LIBADD = $(X11_LIBS) $(EGL_LIBS)
40
41 libeglut_wayland_la_SOURCES = \
42 eglut.c \
43 + eglut.h \
44 eglutint.h \
45 eglut_wayland.c
46
47 diff --git a/src/egl/eglut/eglut.c b/src/egl/eglut/eglut.c
48 index f6a2ad4..58b354a 100644
49 --- a/src/egl/eglut/eglut.c
50 +++ b/src/egl/eglut/eglut.c
51 @@ -176,9 +176,6 @@ _eglutCreateWindow(const char *title, int x, int y, int w, int h)
52 win->config, win->native.u.pixmap, NULL);
53 break;
54 case EGL_PBUFFER_BIT:
55 -#ifdef EGL_MESA_screen_surface
56 - case EGL_SCREEN_BIT_MESA:
57 -#endif
58 win->surface = win->native.u.surface;
59 break;
60 default:
61 @@ -292,11 +289,7 @@ eglutDestroyWindow(int win)
62 if (window->index != win)
63 return;
64
65 -#ifdef EGL_MESA_screen_surface
66 - /* XXX it causes some bug in st/egl KMS backend */
67 - if ( _eglut->surface_type != EGL_SCREEN_BIT_MESA)
68 -#endif
69 - eglMakeCurrent(_eglut->dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
70 + eglMakeCurrent(_eglut->dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
71
72 _eglutDestroyWindow(_eglut->current);
73 }
74 diff --git a/src/egl/eglut/eglut_screen.c b/src/egl/eglut/eglut_screen.c
75 deleted file mode 100644
76 index 094a4e2..0000000
77 --- a/src/egl/eglut/eglut_screen.c
78 +++ /dev/null
79 @@ -1,194 +0,0 @@
80 -/*
81 - * Copyright (C) 2010 LunarG Inc.
82 - *
83 - * Permission is hereby granted, free of charge, to any person obtaining a
84 - * copy of this software and associated documentation files (the "Software"),
85 - * to deal in the Software without restriction, including without limitation
86 - * the rights to use, copy, modify, merge, publish, distribute, sublicense,
87 - * and/or sell copies of the Software, and to permit persons to whom the
88 - * Software is furnished to do so, subject to the following conditions:
89 - *
90 - * The above copyright notice and this permission notice shall be included
91 - * in all copies or substantial portions of the Software.
92 - *
93 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
94 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
95 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
96 - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
97 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
98 - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
99 - * DEALINGS IN THE SOFTWARE.
100 - *
101 - * Authors:
102 - * Chia-I Wu <olv@lunarg.com>
103 - */
104 -
105 -#include <stdio.h>
106 -#include <string.h>
107 -#include <sys/time.h>
108 -
109 -#define EGL_EGLEXT_PROTOTYPES
110 -#include "EGL/egl.h"
111 -#include "EGL/eglext.h"
112 -
113 -#include "eglutint.h"
114 -
115 -#define MAX_MODES 100
116 -
117 -#ifdef EGL_MESA_screen_surface
118 -static EGLScreenMESA kms_screen;
119 -static EGLModeMESA kms_mode;
120 -static EGLint kms_width, kms_height;
121 -#endif
122 -
123 -void
124 -_eglutNativeInitDisplay(void)
125 -{
126 -#ifdef EGL_MESA_screen_surface
127 - _eglut->native_dpy = EGL_DEFAULT_DISPLAY;
128 - _eglut->surface_type = EGL_SCREEN_BIT_MESA;
129 -#endif
130 -}
131 -
132 -void
133 -_eglutNativeFiniDisplay(void)
134 -{
135 -#ifdef EGL_MESA_screen_surface
136 - kms_screen = 0;
137 - kms_mode = 0;
138 - kms_width = 0;
139 - kms_height = 0;
140 -#endif
141 -}
142 -
143 -#ifdef EGL_MESA_screen_surface
144 -static void
145 -init_kms(void)
146 -{
147 - EGLModeMESA modes[MAX_MODES];
148 - EGLint num_screens, num_modes;
149 - EGLint width, height, best_mode;
150 - EGLint i;
151 -
152 - if (!eglGetScreensMESA(_eglut->dpy, &kms_screen, 1, &num_screens) ||
153 - !num_screens)
154 - _eglutFatal("eglGetScreensMESA failed\n");
155 -
156 - if (!eglGetModesMESA(_eglut->dpy, kms_screen,
157 - modes, MAX_MODES, &num_modes) || !num_modes)
158 - _eglutFatal("eglGetModesMESA failed!\n");
159 -
160 - printf("Found %d modes:\n", num_modes);
161 -
162 - best_mode = 0;
163 - width = 0;
164 - height = 0;
165 - for (i = 0; i < num_modes; i++) {
166 - EGLint w, h;
167 - eglGetModeAttribMESA(_eglut->dpy, modes[i], EGL_WIDTH, &w);
168 - eglGetModeAttribMESA(_eglut->dpy, modes[i], EGL_HEIGHT, &h);
169 - printf("%3d: %d x %d\n", i, w, h);
170 - if (w > width && h > height) {
171 - width = w;
172 - height = h;
173 - best_mode = i;
174 - }
175 - }
176 -
177 - printf("Will use screen size: %d x %d\n", width, height);
178 -
179 - kms_mode = modes[best_mode];
180 - kms_width = width;
181 - kms_height = height;
182 -}
183 -#endif
184 -
185 -void
186 -_eglutNativeInitWindow(struct eglut_window *win, const char *title,
187 - int x, int y, int w, int h)
188 -{
189 -#ifdef EGL_MESA_screen_surface
190 - EGLint surf_attribs[16];
191 - EGLint i;
192 -#endif
193 - const char *exts;
194 -
195 - exts = eglQueryString(_eglut->dpy, EGL_EXTENSIONS);
196 - if (!exts || !strstr(exts, "EGL_MESA_screen_surface"))
197 - _eglutFatal("EGL_MESA_screen_surface is not supported\n");
198 -
199 -#ifdef EGL_MESA_screen_surface
200 - init_kms();
201 -
202 - i = 0;
203 - surf_attribs[i++] = EGL_WIDTH;
204 - surf_attribs[i++] = kms_width;
205 - surf_attribs[i++] = EGL_HEIGHT;
206 - surf_attribs[i++] = kms_height;
207 - surf_attribs[i++] = EGL_NONE;
208 -
209 - /* create surface */
210 - win->native.u.surface = eglCreateScreenSurfaceMESA(_eglut->dpy,
211 - win->config, surf_attribs);
212 - if (win->native.u.surface == EGL_NO_SURFACE)
213 - _eglutFatal("eglCreateScreenSurfaceMESA failed\n");
214 -
215 - if (!eglShowScreenSurfaceMESA(_eglut->dpy, kms_screen,
216 - win->native.u.surface, kms_mode))
217 - _eglutFatal("eglShowScreenSurfaceMESA failed\n");
218 -
219 - win->native.width = kms_width;
220 - win->native.height = kms_height;
221 -#endif
222 -}
223 -
224 -void
225 -_eglutNativeFiniWindow(struct eglut_window *win)
226 -{
227 -#ifdef EGL_MESA_screen_surface
228 - eglShowScreenSurfaceMESA(_eglut->dpy,
229 - kms_screen, EGL_NO_SURFACE, 0);
230 - eglDestroySurface(_eglut->dpy, win->native.u.surface);
231 -#endif
232 -}
233 -
234 -void
235 -_eglutNativeEventLoop(void)
236 -{
237 - int start = _eglutNow();
238 - int frames = 0;
239 -
240 - _eglut->redisplay = 1;
241 -
242 - while (1) {
243 - struct eglut_window *win = _eglut->current;
244 - int now = _eglutNow();
245 -
246 - if (now - start > 5000) {
247 - double elapsed = (double) (now - start) / 1000.0;
248 -
249 - printf("%d frames in %3.1f seconds = %6.3f FPS\n",
250 - frames, elapsed, frames / elapsed);
251 - fflush(stdout);
252 -
253 - start = now;
254 - frames = 0;
255 -
256 - /* send escape */
257 - if (win->keyboard_cb)
258 - win->keyboard_cb(27);
259 - }
260 -
261 - if (_eglut->idle_cb)
262 - _eglut->idle_cb();
263 -
264 - if (_eglut->redisplay) {
265 - _eglut->redisplay = 0;
266 -
267 - if (win->display_cb)
268 - win->display_cb();
269 - eglSwapBuffers(_eglut->dpy, win->surface);
270 - frames++;
271 - }
272 - }
273 -}
274 diff --git a/src/egl/opengl/Makefile.am b/src/egl/opengl/Makefile.am
275 index 87b2f1a..3e48141 100644
276 --- a/src/egl/opengl/Makefile.am
277 +++ b/src/egl/opengl/Makefile.am
278 @@ -51,20 +51,12 @@ endif
279
280 if HAVE_EGL
281 bin_PROGRAMS = \
282 - demo1 \
283 - demo2 \
284 - demo3 \
285 eglinfo \
286 - eglgears_screen \
287 - egltri_screen \
288 peglgears \
289 $(EGL_DRM_DEMOS) \
290 $(EGL_X11_DEMOS)
291 endif
292
293 -egltri_screen_SOURCES = egltri.c
294 -eglgears_screen_SOURCES = eglgears.c
295 -
296 egltri_x11_SOURCES = egltri.c
297 eglgears_x11_SOURCES = eglgears.c
298
299 @@ -73,9 +65,6 @@ egltri_x11_LDFLAGS = $(AM_LDFLAGS) $(X11_LIBS)
300 xeglgears_LDFLAGS = $(AM_LDFLAGS) $(X11_LIBS)
301 xeglthreads_LDFLAGS = $(AM_LDFLAGS) $(X11_LIBS) -pthread
302
303 -eglgears_screen_LDADD = ../eglut/libeglut_screen.la
304 -egltri_screen_LDADD = ../eglut/libeglut_screen.la
305 -
306 eglgears_x11_LDADD = ../eglut/libeglut_x11.la
307 egltri_x11_LDADD = ../eglut/libeglut_x11.la
308
309 diff --git a/src/egl/opengl/demo1.c b/src/egl/opengl/demo1.c
310 deleted file mode 100644
311 index 06e2138..0000000
312 --- a/src/egl/opengl/demo1.c
313 +++ /dev/null
314 @@ -1,155 +0,0 @@
315 -/*
316 - * Exercise EGL API functions
317 - */
318 -
319 -#define EGL_EGLEXT_PROTOTYPES
320 -
321 -#include <EGL/egl.h>
322 -#include <EGL/eglext.h>
323 -#include <assert.h>
324 -#include <stdio.h>
325 -#include <stdlib.h>
326 -#include <string.h>
327 -
328 -
329 -/**
330 - * Test EGL_MESA_screen_surface functions
331 - */
332 -static void
333 -TestScreens(EGLDisplay dpy)
334 -{
335 -#ifdef EGL_MESA_screen_surface
336 -#define MAX 8
337 - EGLScreenMESA screens[MAX];
338 - EGLint numScreens;
339 - EGLint i;
340 -
341 - eglGetScreensMESA(dpy, screens, MAX, &numScreens);
342 - printf("Found %d screens\n", numScreens);
343 - for (i = 0; i < numScreens; i++) {
344 - printf(" Screen %d handle: %d\n", i, (int) screens[i]);
345 - }
346 -#endif
347 -}
348 -
349 -/**
350 - * Print table of all available configurations.
351 - */
352 -static void
353 -PrintConfigs(EGLDisplay d, EGLConfig *configs, EGLint numConfigs)
354 -{
355 - EGLint i;
356 -
357 - printf("Configurations:\n");
358 - printf(" bf lv d st colorbuffer dp st supported \n");
359 - printf(" id sz l b ro r g b a th cl surfaces \n");
360 - printf("----------------------------------------------\n");
361 - for (i = 0; i < numConfigs; i++) {
362 - EGLint id, size, level;
363 - EGLint red, green, blue, alpha;
364 - EGLint depth, stencil;
365 - EGLint surfaces;
366 - EGLint doubleBuf = 1, stereo = 0;
367 - char surfString[100] = "";
368 -
369 - eglGetConfigAttrib(d, configs[i], EGL_CONFIG_ID, &id);
370 - eglGetConfigAttrib(d, configs[i], EGL_BUFFER_SIZE, &size);
371 - eglGetConfigAttrib(d, configs[i], EGL_LEVEL, &level);
372 -
373 - eglGetConfigAttrib(d, configs[i], EGL_RED_SIZE, &red);
374 - eglGetConfigAttrib(d, configs[i], EGL_GREEN_SIZE, &green);
375 - eglGetConfigAttrib(d, configs[i], EGL_BLUE_SIZE, &blue);
376 - eglGetConfigAttrib(d, configs[i], EGL_ALPHA_SIZE, &alpha);
377 - eglGetConfigAttrib(d, configs[i], EGL_DEPTH_SIZE, &depth);
378 - eglGetConfigAttrib(d, configs[i], EGL_STENCIL_SIZE, &stencil);
379 - eglGetConfigAttrib(d, configs[i], EGL_SURFACE_TYPE, &surfaces);
380 -
381 - if (surfaces & EGL_WINDOW_BIT)
382 - strcat(surfString, "win,");
383 - if (surfaces & EGL_PBUFFER_BIT)
384 - strcat(surfString, "pb,");
385 - if (surfaces & EGL_PIXMAP_BIT)
386 - strcat(surfString, "pix,");
387 - if (strlen(surfString) > 0)
388 - surfString[strlen(surfString) - 1] = 0;
389 -
390 - printf("0x%02x %2d %2d %c %c %2d %2d %2d %2d %2d %2d %-12s\n",
391 - id, size, level,
392 - doubleBuf ? 'y' : '.',
393 - stereo ? 'y' : '.',
394 - red, green, blue, alpha,
395 - depth, stencil, surfString);
396 - }
397 -}
398 -
399 -
400 -
401 -int
402 -main(int argc, char *argv[])
403 -{
404 - int maj, min;
405 - EGLContext ctx;
406 - EGLSurface pbuffer;
407 - EGLConfig *configs;
408 - EGLint numConfigs;
409 - EGLBoolean b;
410 - const EGLint pbufAttribs[] = {
411 - EGL_WIDTH, 500,
412 - EGL_HEIGHT, 500,
413 - EGL_NONE
414 - };
415 -
416 - EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
417 - assert(d);
418 -
419 - if (!eglInitialize(d, &maj, &min)) {
420 - printf("demo: eglInitialize failed\n");
421 - exit(1);
422 - }
423 -
424 - printf("EGL version = %d.%d\n", maj, min);
425 - printf("EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR));
426 -
427 - if (!strstr(eglQueryString(d, EGL_EXTENSIONS),
428 - "EGL_MESA_screen_surface")) {
429 - printf("EGL_MESA_screen_surface is not supported\n");
430 - exit(1);
431 - }
432 -
433 - eglGetConfigs(d, NULL, 0, &numConfigs);
434 - configs = malloc(sizeof(*configs) *numConfigs);
435 - eglGetConfigs(d, configs, numConfigs, &numConfigs);
436 -
437 - PrintConfigs(d, configs, numConfigs);
438 -
439 - eglBindAPI(EGL_OPENGL_API);
440 - ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL);
441 - if (ctx == EGL_NO_CONTEXT) {
442 - printf("failed to create context\n");
443 - return 0;
444 - }
445 -
446 - pbuffer = eglCreatePbufferSurface(d, configs[0], pbufAttribs);
447 - if (pbuffer == EGL_NO_SURFACE) {
448 - printf("failed to create pbuffer\n");
449 - return 0;
450 - }
451 -
452 - free(configs);
453 -
454 - b = eglMakeCurrent(d, pbuffer, pbuffer, ctx);
455 - if (!b) {
456 - printf("make current failed\n");
457 - return 0;
458 - }
459 -
460 - b = eglMakeCurrent(d, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
461 -
462 - TestScreens(d);
463 -
464 - eglDestroySurface(d, pbuffer);
465 - eglDestroyContext(d, ctx);
466 - eglTerminate(d);
467 -
468 - return 0;
469 -}
470 diff --git a/src/egl/opengl/demo2.c b/src/egl/opengl/demo2.c
471 deleted file mode 100644
472 index bfef59e..0000000
473 --- a/src/egl/opengl/demo2.c
474 +++ /dev/null
475 @@ -1,221 +0,0 @@
476 -/*
477 - * Exercise EGL API functions
478 - */
479 -
480 -#define EGL_EGLEXT_PROTOTYPES
481 -
482 -#include <assert.h>
483 -#include <stdio.h>
484 -#include <stdlib.h>
485 -#include <string.h>
486 -#include <unistd.h>
487 -
488 -#include <EGL/egl.h>
489 -#include <EGL/eglext.h>
490 -#include "gl_wrap.h"
491 -
492 -/*#define FRONTBUFFER*/
493 -
494 -#ifdef EGL_MESA_screen_surface
495 -static void _subset_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2,
496 - GLfloat r, GLfloat g, GLfloat b)
497 -{
498 - GLfloat v[4][2], c[4][4];
499 - int i;
500 -
501 - v[0][0] = x1; v[0][1] = y1;
502 - v[1][0] = x2; v[1][1] = y1;
503 - v[2][0] = x2; v[2][1] = y2;
504 - v[3][0] = x1; v[3][1] = y2;
505 -
506 - for (i = 0; i < 4; i++) {
507 - c[i][0] = r;
508 - c[i][1] = g;
509 - c[i][2] = b;
510 - c[i][3] = 1.0;
511 - }
512 -
513 - glVertexPointer(2, GL_FLOAT, 0, v);
514 - glColorPointer(4, GL_FLOAT, 0, c);
515 - glEnableClientState(GL_VERTEX_ARRAY);
516 - glEnableClientState(GL_COLOR_ARRAY);
517 -
518 - glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
519 -
520 - glDisableClientState(GL_VERTEX_ARRAY);
521 - glDisableClientState(GL_COLOR_ARRAY);
522 -}
523 -
524 -
525 -static void redraw(EGLDisplay dpy, EGLSurface surf, int rot)
526 -{
527 - GLfloat r, g, b;
528 -
529 - printf("Redraw event\n");
530 -
531 - glClearColor( rand()/(float)RAND_MAX,
532 - rand()/(float)RAND_MAX,
533 - rand()/(float)RAND_MAX,
534 - 1);
535 -
536 - glClear( GL_COLOR_BUFFER_BIT );
537 -
538 - r = rand()/(float)RAND_MAX;
539 - g = rand()/(float)RAND_MAX;
540 - b = rand()/(float)RAND_MAX;
541 -
542 - glPushMatrix();
543 - glRotatef(rot, 0, 0, 1);
544 - glScalef(.5, .5, .5);
545 - _subset_Rectf( -1, -1, 1, 1, r, g, b );
546 - glPopMatrix();
547 -
548 -#ifdef FRONTBUFFER
549 - glFlush();
550 -#else
551 - eglSwapBuffers( dpy, surf );
552 -#endif
553 - glFinish();
554 -}
555 -
556 -
557 -/**
558 - * Test EGL_MESA_screen_surface functions
559 - */
560 -static void
561 -TestScreens(EGLDisplay dpy)
562 -{
563 -#define MAX 8
564 - EGLScreenMESA screens[MAX];
565 - EGLint numScreens;
566 - EGLint i;
567 -
568 - eglGetScreensMESA(dpy, screens, MAX, &numScreens);
569 - printf("Found %d screens\n", numScreens);
570 - for (i = 0; i < numScreens; i++) {
571 - printf(" Screen %d handle: %d\n", i, (int) screens[i]);
572 - }
573 -}
574 -#endif
575 -
576 -int
577 -main(int argc, char *argv[])
578 -{
579 - int maj, min;
580 -#ifdef EGL_MESA_screen_surface
581 - EGLContext ctx;
582 - EGLSurface pbuffer, screen_surf;
583 - EGLConfig configs[10];
584 - EGLint numConfigs, i;
585 - EGLBoolean b;
586 - const EGLint pbufAttribs[] = {
587 - EGL_WIDTH, 500,
588 - EGL_HEIGHT, 500,
589 - EGL_NONE
590 - };
591 - EGLint screenAttribs[32];
592 - EGLModeMESA mode;
593 - EGLScreenMESA screen;
594 - EGLint count;
595 -#endif
596 -
597 - EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
598 - assert(d);
599 -
600 - if (!eglInitialize(d, &maj, &min)) {
601 - printf("demo: eglInitialize failed\n");
602 - exit(1);
603 - }
604 -
605 - printf("EGL version = %d.%d\n", maj, min);
606 - printf("EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR));
607 - if (!strstr(eglQueryString(d, EGL_EXTENSIONS),
608 - "EGL_MESA_screen_surface")) {
609 - printf("EGL_MESA_screen_surface is not supported\n");
610 - exit(1);
611 - }
612 -
613 -#ifdef EGL_MESA_screen_surface
614 - eglGetConfigs(d, configs, 10, &numConfigs);
615 - printf("Got %d EGL configs:\n", numConfigs);
616 - for (i = 0; i < numConfigs; i++) {
617 - EGLint id, red, depth;
618 - eglGetConfigAttrib(d, configs[i], EGL_CONFIG_ID, &id);
619 - eglGetConfigAttrib(d, configs[i], EGL_RED_SIZE, &red);
620 - eglGetConfigAttrib(d, configs[i], EGL_DEPTH_SIZE, &depth);
621 - printf("%2d: Red Size = %d Depth Size = %d\n", id, red, depth);
622 - }
623 -
624 - eglGetScreensMESA(d, &screen, 1, &count);
625 - eglGetModesMESA(d, screen, &mode, 1, &count);
626 -
627 - eglBindAPI(EGL_OPENGL_API);
628 - ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL);
629 - if (ctx == EGL_NO_CONTEXT) {
630 - printf("failed to create context\n");
631 - return 0;
632 - }
633 -
634 - pbuffer = eglCreatePbufferSurface(d, configs[0], pbufAttribs);
635 - if (pbuffer == EGL_NO_SURFACE) {
636 - printf("failed to create pbuffer\n");
637 - return 0;
638 - }
639 -
640 - b = eglMakeCurrent(d, pbuffer, pbuffer, ctx);
641 - if (!b) {
642 - printf("make current failed\n");
643 - return 0;
644 - }
645 -
646 - b = eglMakeCurrent(d, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
647 -
648 - i = 0;
649 - screenAttribs[i++] = EGL_WIDTH;
650 - eglGetModeAttribMESA(d, mode, EGL_WIDTH, &screenAttribs[i++]);
651 - screenAttribs[i++] = EGL_HEIGHT;
652 - eglGetModeAttribMESA(d, mode, EGL_HEIGHT, &screenAttribs[i++]);
653 - screenAttribs[i] = EGL_NONE;
654 -
655 - screen_surf = eglCreateScreenSurfaceMESA(d, configs[0], screenAttribs);
656 - if (screen_surf == EGL_NO_SURFACE) {
657 - printf("failed to create screen surface\n");
658 - return 0;
659 - }
660 -
661 - eglShowScreenSurfaceMESA(d, screen, screen_surf, mode);
662 -
663 - b = eglMakeCurrent(d, screen_surf, screen_surf, ctx);
664 - if (!b) {
665 - printf("make current failed\n");
666 - return 0;
667 - }
668 -
669 - glViewport(0, 0, 1024, 768);
670 -
671 - glClearColor( 0,
672 - 1.0,
673 - 0,
674 - 1);
675 -
676 - glClear( GL_COLOR_BUFFER_BIT );
677 -
678 -
679 - TestScreens(d);
680 -
681 - glShadeModel( GL_FLAT );
682 -
683 - for (i = 0; i < 6; i++) {
684 - redraw(d, screen_surf, i*10 );
685 -
686 - printf("sleep(1)\n");
687 - sleep(1);
688 - }
689 -
690 - eglDestroySurface(d, pbuffer);
691 - eglDestroyContext(d, ctx);
692 - eglTerminate(d);
693 -#endif
694 -
695 - return 0;
696 -}
697 diff --git a/src/egl/opengl/demo3.c b/src/egl/opengl/demo3.c
698 deleted file mode 100644
699 index 31b5d8b..0000000
700 --- a/src/egl/opengl/demo3.c
701 +++ /dev/null
702 @@ -1,652 +0,0 @@
703 -/*
704 - * Exercise EGL API functions
705 - */
706 -
707 -#define EGL_EGLEXT_PROTOTYPES
708 -
709 -#include <EGL/egl.h>
710 -#include <EGL/eglext.h>
711 -#include "gl_wrap.h"
712 -#include <assert.h>
713 -#include <stdio.h>
714 -#include <stdlib.h>
715 -#include <string.h>
716 -#include <unistd.h>
717 -
718 -
719 -
720 -#define PIXEL_CENTER(x) ((long)(x) + 0.5)
721 -
722 -#define GAP 10
723 -#define ROWS 3
724 -#define COLS 4
725 -
726 -#define OPENGL_WIDTH 48
727 -#define OPENGL_HEIGHT 13
728 -
729 -
730 -GLenum rgb, doubleBuffer, windType;
731 -GLint windW, windH;
732 -
733 -GLenum mode1, mode2;
734 -GLint boxW, boxH;
735 -GLubyte OpenGL_bits[] = {
736 - 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
737 - 0x7f, 0xfb, 0xff, 0xff, 0xff, 0x01,
738 - 0x7f, 0xfb, 0xff, 0xff, 0xff, 0x01,
739 - 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
740 - 0x3e, 0x8f, 0xb7, 0xf9, 0xfc, 0x01,
741 - 0x63, 0xdb, 0xb0, 0x8d, 0x0d, 0x00,
742 - 0x63, 0xdb, 0xb7, 0x8d, 0x0d, 0x00,
743 - 0x63, 0xdb, 0xb6, 0x8d, 0x0d, 0x00,
744 - 0x63, 0x8f, 0xf3, 0xcc, 0x0d, 0x00,
745 - 0x63, 0x00, 0x00, 0x0c, 0x4c, 0x0a,
746 - 0x63, 0x00, 0x00, 0x0c, 0x4c, 0x0e,
747 - 0x63, 0x00, 0x00, 0x8c, 0xed, 0x0e,
748 - 0x3e, 0x00, 0x00, 0xf8, 0x0c, 0x00,
749 -};
750 -
751 -#ifdef EGL_MESA_screen_surface
752 -static void Init(void)
753 -{
754 -
755 - mode1 = GL_TRUE;
756 - mode2 = GL_TRUE;
757 -}
758 -
759 -static void Reshape(int width, int height)
760 -{
761 -
762 - windW = (GLint)width;
763 - windH = (GLint)height;
764 -}
765 -
766 -#if 0
767 -static void RotateColorMask(void)
768 -{
769 - static GLint rotation = 0;
770 -
771 - rotation = (rotation + 1) & 0x3;
772 - switch (rotation) {
773 - case 0:
774 - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
775 - glIndexMask( 0xff );
776 - break;
777 - case 1:
778 - glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_TRUE);
779 - glIndexMask(0xFE);
780 - break;
781 - case 2:
782 - glColorMask(GL_TRUE, GL_FALSE, GL_TRUE, GL_TRUE);
783 - glIndexMask(0xFD);
784 - break;
785 - case 3:
786 - glColorMask(GL_TRUE, GL_TRUE, GL_FALSE, GL_TRUE);
787 - glIndexMask(0xFB);
788 - break;
789 - }
790 -}
791 -#endif
792 -
793 -static void Viewport(GLint row, GLint column)
794 -{
795 - GLint x, y;
796 -
797 - boxW = (windW - (COLS + 1) * GAP) / COLS;
798 - boxH = (windH - (ROWS + 1) * GAP) / ROWS;
799 -
800 - x = GAP + column * (boxW + GAP);
801 - y = GAP + row * (boxH + GAP);
802 -
803 - glViewport(x, y, boxW, boxH);
804 -
805 - glMatrixMode(GL_PROJECTION);
806 - glLoadIdentity();
807 - glOrtho(-boxW/2, boxW/2, -boxH/2, boxH/2, 0.0, 1.0);
808 - glMatrixMode(GL_MODELVIEW);
809 -
810 - glEnable(GL_SCISSOR_TEST);
811 - glScissor(x, y, boxW, boxH);
812 -}
813 -
814 -enum {
815 - COLOR_BLACK = 0,
816 - COLOR_RED,
817 - COLOR_GREEN,
818 - COLOR_YELLOW,
819 - COLOR_BLUE,
820 - COLOR_MAGENTA,
821 - COLOR_CYAN,
822 - COLOR_WHITE
823 -};
824 -
825 -static float RGBMap[9][3] = {
826 - {0, 0, 0},
827 - {1, 0, 0},
828 - {0, 1, 0},
829 - {1, 1, 0},
830 - {0, 0, 1},
831 - {1, 0, 1},
832 - {0, 1, 1},
833 - {1, 1, 1},
834 - {0.5, 0.5, 0.5}
835 -};
836 -
837 -static void SetColor(int c)
838 -{
839 - glColor3fv(RGBMap[c]);
840 -}
841 -
842 -static void Point(void)
843 -{
844 - GLint i;
845 -
846 - glBegin(GL_POINTS);
847 - SetColor(COLOR_WHITE);
848 - glVertex2i(0, 0);
849 - for (i = 1; i < 8; i++) {
850 - GLint j = i * 2;
851 - SetColor(COLOR_BLACK+i);
852 - glVertex2i(-j, -j);
853 - glVertex2i(-j, 0);
854 - glVertex2i(-j, j);
855 - glVertex2i(0, j);
856 - glVertex2i(j, j);
857 - glVertex2i(j, 0);
858 - glVertex2i(j, -j);
859 - glVertex2i(0, -j);
860 - }
861 - glEnd();
862 -}
863 -
864 -static void Lines(void)
865 -{
866 - GLint i;
867 -
868 - glPushMatrix();
869 -
870 - glTranslatef(-12, 0, 0);
871 - for (i = 1; i < 8; i++) {
872 - SetColor(COLOR_BLACK+i);
873 - glBegin(GL_LINES);
874 - glVertex2i(-boxW/4, -boxH/4);
875 - glVertex2i(boxW/4, boxH/4);
876 - glEnd();
877 - glTranslatef(4, 0, 0);
878 - }
879 -
880 - glPopMatrix();
881 -
882 - glBegin(GL_LINES);
883 - glVertex2i(0, 0);
884 - glEnd();
885 -}
886 -
887 -static void LineStrip(void)
888 -{
889 -
890 - glBegin(GL_LINE_STRIP);
891 - SetColor(COLOR_RED);
892 - glVertex2f(PIXEL_CENTER(-boxW/4), PIXEL_CENTER(-boxH/4));
893 - SetColor(COLOR_GREEN);
894 - glVertex2f(PIXEL_CENTER(-boxW/4), PIXEL_CENTER(boxH/4));
895 - SetColor(COLOR_BLUE);
896 - glVertex2f(PIXEL_CENTER(boxW/4), PIXEL_CENTER(boxH/4));
897 - SetColor(COLOR_WHITE);
898 - glVertex2f(PIXEL_CENTER(boxW/4), PIXEL_CENTER(-boxH/4));
899 - glEnd();
900 -
901 - glBegin(GL_LINE_STRIP);
902 - glVertex2i(0, 0);
903 - glEnd();
904 -}
905 -
906 -static void LineLoop(void)
907 -{
908 -
909 - glBegin(GL_LINE_LOOP);
910 - SetColor(COLOR_RED);
911 - glVertex2f(PIXEL_CENTER(-boxW/4), PIXEL_CENTER(-boxH/4));
912 - SetColor(COLOR_GREEN);
913 - glVertex2f(PIXEL_CENTER(-boxW/4), PIXEL_CENTER(boxH/4));
914 - SetColor(COLOR_BLUE);
915 - glVertex2f(PIXEL_CENTER(boxW/4), PIXEL_CENTER(boxH/4));
916 - SetColor(COLOR_WHITE);
917 - glVertex2f(PIXEL_CENTER(boxW/4), PIXEL_CENTER(-boxH/4));
918 - glEnd();
919 -
920 - glEnable(GL_LOGIC_OP);
921 - glLogicOp(GL_XOR);
922 -
923 - glEnable(GL_BLEND);
924 - glBlendFunc(GL_ONE, GL_ONE);
925 -
926 - SetColor(COLOR_MAGENTA);
927 - glBegin(GL_LINE_LOOP);
928 - glVertex2f(PIXEL_CENTER(-boxW/8), PIXEL_CENTER(-boxH/8));
929 - glVertex2f(PIXEL_CENTER(-boxW/8), PIXEL_CENTER(boxH/8));
930 - glEnd();
931 - glBegin(GL_LINE_LOOP);
932 - glVertex2f(PIXEL_CENTER(-boxW/8), PIXEL_CENTER(boxH/8+5));
933 - glVertex2f(PIXEL_CENTER(boxW/8), PIXEL_CENTER(boxH/8+5));
934 - glEnd();
935 - glDisable(GL_LOGIC_OP);
936 - glDisable(GL_BLEND);
937 -
938 - SetColor(COLOR_GREEN);
939 - glBegin(GL_POINTS);
940 - glVertex2i(0, 0);
941 - glEnd();
942 -
943 - glBegin(GL_LINE_LOOP);
944 - glVertex2i(0, 0);
945 - glEnd();
946 -}
947 -
948 -static void Bitmap(void)
949 -{
950 -
951 - glBegin(GL_LINES);
952 - SetColor(COLOR_GREEN);
953 - glVertex2i(-boxW/2, 0);
954 - glVertex2i(boxW/2, 0);
955 - glVertex2i(0, -boxH/2);
956 - glVertex2i(0, boxH/2);
957 - SetColor(COLOR_RED);
958 - glVertex2i(0, -3);
959 - glVertex2i(0, -3+OPENGL_HEIGHT);
960 - SetColor(COLOR_BLUE);
961 - glVertex2i(0, -3);
962 - glVertex2i(OPENGL_WIDTH, -3);
963 - glEnd();
964 -
965 - SetColor(COLOR_GREEN);
966 -
967 - glPixelStorei(GL_UNPACK_LSB_FIRST, GL_TRUE);
968 - glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
969 -
970 - glRasterPos2i(0, 0);
971 - glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, 0, 3, 0.0, 0.0, OpenGL_bits);
972 -}
973 -
974 -static void Triangles(void)
975 -{
976 -
977 - glBegin(GL_TRIANGLES);
978 - SetColor(COLOR_GREEN);
979 - glVertex2i(-boxW/4, -boxH/4);
980 - SetColor(COLOR_RED);
981 - glVertex2i(-boxW/8, -boxH/16);
982 - SetColor(COLOR_BLUE);
983 - glVertex2i(boxW/8, -boxH/16);
984 -
985 - SetColor(COLOR_GREEN);
986 - glVertex2i(-boxW/4, boxH/4);
987 - SetColor(COLOR_RED);
988 - glVertex2i(-boxW/8, boxH/16);
989 - SetColor(COLOR_BLUE);
990 - glVertex2i(boxW/8, boxH/16);
991 - glEnd();
992 -
993 - glBegin(GL_TRIANGLES);
994 - glVertex2i(0, 0);
995 - glVertex2i(-100, 100);
996 - glEnd();
997 -}
998 -
999 -static void TriangleStrip(void)
1000 -{
1001 -
1002 - glBegin(GL_TRIANGLE_STRIP);
1003 - SetColor(COLOR_GREEN);
1004 - glVertex2i(-boxW/4, -boxH/4);
1005 - SetColor(COLOR_RED);
1006 - glVertex2i(-boxW/4, boxH/4);
1007 - SetColor(COLOR_BLUE);
1008 - glVertex2i(0, -boxH/4);
1009 - SetColor(COLOR_WHITE);
1010 - glVertex2i(0, boxH/4);
1011 - SetColor(COLOR_CYAN);
1012 - glVertex2i(boxW/4, -boxH/4);
1013 - SetColor(COLOR_YELLOW);
1014 - glVertex2i(boxW/4, boxH/4);
1015 - glEnd();
1016 -
1017 - glBegin(GL_TRIANGLE_STRIP);
1018 - glVertex2i(0, 0);
1019 - glVertex2i(-100, 100);
1020 - glEnd();
1021 -}
1022 -
1023 -static void TriangleFan(void)
1024 -{
1025 - GLint vx[8][2];
1026 - GLint x0, y0, x1, y1, x2, y2, x3, y3;
1027 - GLint i;
1028 -
1029 - y0 = -boxH/4;
1030 - y1 = y0 + boxH/2/3;
1031 - y2 = y1 + boxH/2/3;
1032 - y3 = boxH/4;
1033 - x0 = -boxW/4;
1034 - x1 = x0 + boxW/2/3;
1035 - x2 = x1 + boxW/2/3;
1036 - x3 = boxW/4;
1037 -
1038 - vx[0][0] = x0; vx[0][1] = y1;
1039 - vx[1][0] = x0; vx[1][1] = y2;
1040 - vx[2][0] = x1; vx[2][1] = y3;
1041 - vx[3][0] = x2; vx[3][1] = y3;
1042 - vx[4][0] = x3; vx[4][1] = y2;
1043 - vx[5][0] = x3; vx[5][1] = y1;
1044 - vx[6][0] = x2; vx[6][1] = y0;
1045 - vx[7][0] = x1; vx[7][1] = y0;
1046 -
1047 - glBegin(GL_TRIANGLE_FAN);
1048 - SetColor(COLOR_WHITE);
1049 - glVertex2i(0, 0);
1050 - for (i = 0; i < 8; i++) {
1051 - SetColor(COLOR_WHITE-i);
1052 - glVertex2iv(vx[i]);
1053 - }
1054 - glEnd();
1055 -
1056 - glBegin(GL_TRIANGLE_FAN);
1057 - glVertex2i(0, 0);
1058 - glVertex2i(-100, 100);
1059 - glEnd();
1060 -}
1061 -
1062 -static void Rect(void)
1063 -{
1064 -
1065 - SetColor(COLOR_GREEN);
1066 - glRecti(-boxW/4, -boxH/4, boxW/4, boxH/4);
1067 -}
1068 -
1069 -static void PolygonFunc(void)
1070 -{
1071 - GLint vx[8][2];
1072 - GLint x0, y0, x1, y1, x2, y2, x3, y3;
1073 - GLint i;
1074 -
1075 - y0 = -boxH/4;
1076 - y1 = y0 + boxH/2/3;
1077 - y2 = y1 + boxH/2/3;
1078 - y3 = boxH/4;
1079 - x0 = -boxW/4;
1080 - x1 = x0 + boxW/2/3;
1081 - x2 = x1 + boxW/2/3;
1082 - x3 = boxW/4;
1083 -
1084 - vx[0][0] = x0; vx[0][1] = y1;
1085 - vx[1][0] = x0; vx[1][1] = y2;
1086 - vx[2][0] = x1; vx[2][1] = y3;
1087 - vx[3][0] = x2; vx[3][1] = y3;
1088 - vx[4][0] = x3; vx[4][1] = y2;
1089 - vx[5][0] = x3; vx[5][1] = y1;
1090 - vx[6][0] = x2; vx[6][1] = y0;
1091 - vx[7][0] = x1; vx[7][1] = y0;
1092 -
1093 - glBegin(GL_POLYGON);
1094 - for (i = 0; i < 8; i++) {
1095 - SetColor(COLOR_WHITE-i);
1096 - glVertex2iv(vx[i]);
1097 - }
1098 - glEnd();
1099 -
1100 - glBegin(GL_POLYGON);
1101 - glVertex2i(0, 0);
1102 - glVertex2i(100, 100);
1103 - glEnd();
1104 -}
1105 -
1106 -static void Quads(void)
1107 -{
1108 -
1109 - glBegin(GL_QUADS);
1110 - SetColor(COLOR_GREEN);
1111 - glVertex2i(-boxW/4, -boxH/4);
1112 - SetColor(COLOR_RED);
1113 - glVertex2i(-boxW/8, -boxH/16);
1114 - SetColor(COLOR_BLUE);
1115 - glVertex2i(boxW/8, -boxH/16);
1116 - SetColor(COLOR_WHITE);
1117 - glVertex2i(boxW/4, -boxH/4);
1118 -
1119 - SetColor(COLOR_GREEN);
1120 - glVertex2i(-boxW/4, boxH/4);
1121 - SetColor(COLOR_RED);
1122 - glVertex2i(-boxW/8, boxH/16);
1123 - SetColor(COLOR_BLUE);
1124 - glVertex2i(boxW/8, boxH/16);
1125 - SetColor(COLOR_WHITE);
1126 - glVertex2i(boxW/4, boxH/4);
1127 - glEnd();
1128 -
1129 - glBegin(GL_QUADS);
1130 - glVertex2i(0, 0);
1131 - glVertex2i(100, 100);
1132 - glVertex2i(-100, 100);
1133 - glEnd();
1134 -}
1135 -
1136 -static void QuadStrip(void)
1137 -{
1138 -
1139 - glBegin(GL_QUAD_STRIP);
1140 - SetColor(COLOR_GREEN);
1141 - glVertex2i(-boxW/4, -boxH/4);
1142 - SetColor(COLOR_RED);
1143 - glVertex2i(-boxW/4, boxH/4);
1144 - SetColor(COLOR_BLUE);
1145 - glVertex2i(0, -boxH/4);
1146 - SetColor(COLOR_WHITE);
1147 - glVertex2i(0, boxH/4);
1148 - SetColor(COLOR_CYAN);
1149 - glVertex2i(boxW/4, -boxH/4);
1150 - SetColor(COLOR_YELLOW);
1151 - glVertex2i(boxW/4, boxH/4);
1152 - glEnd();
1153 -
1154 - glBegin(GL_QUAD_STRIP);
1155 - glVertex2i(0, 0);
1156 - glVertex2i(100, 100);
1157 - glVertex2i(-100, 100);
1158 - glEnd();
1159 -}
1160 -
1161 -static void Draw(EGLDisplay dpy, EGLSurface surf)
1162 -{
1163 -
1164 - glViewport(0, 0, windW, windH);
1165 - glDisable(GL_SCISSOR_TEST);
1166 -
1167 - glPushAttrib(GL_COLOR_BUFFER_BIT);
1168 -
1169 - glColorMask(1, 1, 1, 1);
1170 - glIndexMask(~0);
1171 -
1172 - glClearColor(0.0, 0.0, 0.0, 0.0);
1173 - glClear(GL_COLOR_BUFFER_BIT);
1174 -
1175 - glPopAttrib();
1176 -
1177 - if (mode1) {
1178 - glShadeModel(GL_SMOOTH);
1179 - } else {
1180 - glShadeModel(GL_FLAT);
1181 - }
1182 -
1183 - if (mode2) {
1184 - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
1185 - } else {
1186 - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
1187 - }
1188 -
1189 - Viewport(0, 0); Point();
1190 - Viewport(0, 1); Lines();
1191 - Viewport(0, 2); LineStrip();
1192 - Viewport(0, 3); LineLoop();
1193 -
1194 - Viewport(1, 0); Bitmap();
1195 -
1196 - Viewport(1, 1); TriangleFan();
1197 - Viewport(1, 2); Triangles();
1198 - Viewport(1, 3); TriangleStrip();
1199 -
1200 - Viewport(2, 0); Rect();
1201 - Viewport(2, 1); PolygonFunc();
1202 - Viewport(2, 2); Quads();
1203 - Viewport(2, 3); QuadStrip();
1204 -
1205 - glFlush();
1206 -
1207 - if (doubleBuffer) {
1208 - eglSwapBuffers(dpy, surf);
1209 - }
1210 -}
1211 -
1212 -static void
1213 -write_ppm(const char *filename, const GLubyte *buffer, int width, int height)
1214 -{
1215 - const int binary = 0;
1216 - FILE *f = fopen( filename, "w" );
1217 - if (f) {
1218 - int i, x, y;
1219 - const GLubyte *ptr = buffer;
1220 - if (binary) {
1221 - fprintf(f,"P6\n");
1222 - fprintf(f,"# ppm-file created by osdemo.c\n");
1223 - fprintf(f,"%i %i\n", width,height);
1224 - fprintf(f,"255\n");
1225 - fclose(f);
1226 - f = fopen( filename, "ab" ); /* reopen in binary append mode */
1227 - for (y=height-1; y>=0; y--) {
1228 - for (x=0; x<width; x++) {
1229 - i = (y*width + x) * 4;
1230 - fputc(ptr[i], f); /* write red */
1231 - fputc(ptr[i+1], f); /* write green */
1232 - fputc(ptr[i+2], f); /* write blue */
1233 - }
1234 - }
1235 - }
1236 - else {
1237 - /*ASCII*/
1238 - int counter = 0;
1239 - fprintf(f,"P3\n");
1240 - fprintf(f,"# ascii ppm file created by osdemo.c\n");
1241 - fprintf(f,"%i %i\n", width, height);
1242 - fprintf(f,"255\n");
1243 - for (y=height-1; y>=0; y--) {
1244 - for (x=0; x<width; x++) {
1245 - i = (y*width + x) * 4;
1246 - fprintf(f, " %3d %3d %3d", ptr[i], ptr[i+1], ptr[i+2]);
1247 - counter++;
1248 - if (counter % 5 == 0)
1249 - fprintf(f, "\n");
1250 - }
1251 - }
1252 - }
1253 - fclose(f);
1254 - }
1255 -}
1256 -#endif
1257 -
1258 -int
1259 -main(int argc, char *argv[])
1260 -{
1261 - int maj, min;
1262 -#ifdef EGL_MESA_screen_surface
1263 - EGLContext ctx;
1264 - EGLSurface screen_surf;
1265 - EGLConfig configs[10];
1266 - EGLScreenMESA screen;
1267 - EGLModeMESA mode;
1268 - EGLint numConfigs, count;
1269 - EGLBoolean b;
1270 - const GLubyte *bitmap;
1271 - EGLint screenAttribs[32];
1272 - EGLint i;
1273 -#endif
1274 -
1275 - EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
1276 - assert(d);
1277 -
1278 - if (!eglInitialize(d, &maj, &min)) {
1279 - printf("demo: eglInitialize failed\n");
1280 - exit(1);
1281 - }
1282 -
1283 - printf("EGL version = %d.%d\n", maj, min);
1284 - printf("EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR));
1285 - if (!strstr(eglQueryString(d, EGL_EXTENSIONS),
1286 - "EGL_MESA_screen_surface")) {
1287 - printf("EGL_MESA_screen_surface is not supported\n");
1288 - exit(1);
1289 - }
1290 -
1291 -#ifdef EGL_MESA_screen_surface
1292 - eglGetConfigs(d, configs, 10, &numConfigs);
1293 - eglGetScreensMESA(d, &screen, 1, &count);
1294 - eglGetModesMESA(d, screen, &mode, 1, &count);
1295 -
1296 - eglBindAPI(EGL_OPENGL_API);
1297 - ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL);
1298 - if (ctx == EGL_NO_CONTEXT) {
1299 - printf("failed to create context\n");
1300 - return 0;
1301 - }
1302 -
1303 - i = 0;
1304 - screenAttribs[i++] = EGL_WIDTH;
1305 - eglGetModeAttribMESA(d, mode, EGL_WIDTH, &screenAttribs[i++]);
1306 - screenAttribs[i++] = EGL_HEIGHT;
1307 - eglGetModeAttribMESA(d, mode, EGL_HEIGHT, &screenAttribs[i++]);
1308 - screenAttribs[i] = EGL_NONE;
1309 -
1310 - screen_surf = eglCreateScreenSurfaceMESA(d, configs[0], screenAttribs);
1311 - if (screen_surf == EGL_NO_SURFACE) {
1312 - printf("failed to create screen surface\n");
1313 - return 0;
1314 - }
1315 -
1316 - eglShowScreenSurfaceMESA(d, screen, screen_surf, mode);
1317 -
1318 - b = eglMakeCurrent(d, screen_surf, screen_surf, ctx);
1319 - if (!b) {
1320 - printf("make current failed\n");
1321 - return 0;
1322 - }
1323 - glViewport(0, 0, 1024, 768);
1324 -
1325 -
1326 - Init();
1327 - Reshape(1024, 768);
1328 -
1329 - /* some drivers crash when rendering to front buffer */
1330 -#if 0
1331 - glDrawBuffer( GL_FRONT );
1332 - glClearColor( 0, 1.0, 0, 1);
1333 -
1334 - glClear( GL_COLOR_BUFFER_BIT );
1335 -#endif
1336 -
1337 - doubleBuffer = 1;
1338 - glDrawBuffer( GL_BACK );
1339 -
1340 - Draw(d, screen_surf);
1341 - sleep(2);
1342 -
1343 - /* TODO EGL_KHR_lock_surface */
1344 - bitmap = NULL;
1345 - if (bitmap)
1346 - write_ppm("dump.ppm", bitmap, 1024, 768);
1347 -
1348 - eglDestroySurface(d, screen_surf);
1349 - eglDestroyContext(d, ctx);
1350 - eglTerminate(d);
1351 -#endif
1352 -
1353 - return 0;
1354 -}
1355 diff --git a/src/egl/opengl/eglinfo.c b/src/egl/opengl/eglinfo.c
1356 index 8e82e73..1f79fef 100644
1357 --- a/src/egl/opengl/eglinfo.c
1358 +++ b/src/egl/opengl/eglinfo.c
1359 @@ -93,10 +93,6 @@ PrintConfigs(EGLDisplay d)
1360 strcat(surfString, "pb,");
1361 if (surfaces & EGL_PIXMAP_BIT)
1362 strcat(surfString, "pix,");
1363 -#ifdef EGL_MESA_screen_surface
1364 - if (surfaces & EGL_SCREEN_BIT_MESA)
1365 - strcat(surfString, "scrn,");
1366 -#endif
1367 if (strlen(surfString) > 0)
1368 surfString[strlen(surfString) - 1] = 0;
1369
1370 @@ -117,45 +113,6 @@ PrintConfigs(EGLDisplay d)
1371 }
1372
1373
1374 -/**
1375 - * Print table of all available configurations.
1376 - */
1377 -static void
1378 -PrintModes(EGLDisplay d)
1379 -{
1380 -#ifdef EGL_MESA_screen_surface
1381 - const char *extensions = eglQueryString(d, EGL_EXTENSIONS);
1382 - if (strstr(extensions, "EGL_MESA_screen_surface")) {
1383 - EGLScreenMESA screens[MAX_SCREENS];
1384 - EGLint numScreens = 1, scrn;
1385 - EGLModeMESA modes[MAX_MODES];
1386 -
1387 - eglGetScreensMESA(d, screens, MAX_SCREENS, &numScreens);
1388 - printf("Number of Screens: %d\n\n", numScreens);
1389 -
1390 - for (scrn = 0; scrn < numScreens; scrn++) {
1391 - EGLint numModes, i;
1392 -
1393 - eglGetModesMESA(d, screens[scrn], modes, MAX_MODES, &numModes);
1394 -
1395 - printf("Screen %d Modes:\n", scrn);
1396 - printf(" id width height refresh name\n");
1397 - printf("-----------------------------------------\n");
1398 - for (i = 0; i < numModes; i++) {
1399 - EGLint id, w, h, r;
1400 - const char *str;
1401 - eglGetModeAttribMESA(d, modes[i], EGL_MODE_ID_MESA, &id);
1402 - eglGetModeAttribMESA(d, modes[i], EGL_WIDTH, &w);
1403 - eglGetModeAttribMESA(d, modes[i], EGL_HEIGHT, &h);
1404 - eglGetModeAttribMESA(d, modes[i], EGL_REFRESH_RATE_MESA, &r);
1405 - str = eglQueryModeStringMESA(d, modes[i]);
1406 - printf("0x%02x %5d %5d %.3f %s\n", id, w, h, r / 1000.0, str);
1407 - }
1408 - }
1409 - }
1410 -#endif
1411 -}
1412 -
1413 static void
1414 PrintExtensions(EGLDisplay d)
1415 {
1416 @@ -215,8 +172,6 @@ main(int argc, char *argv[])
1417
1418 PrintConfigs(d);
1419
1420 - PrintModes(d);
1421 -
1422 eglTerminate(d);
1423
1424 return 0;
1425 diff --git a/src/egl/opengles1/Makefile.am b/src/egl/opengles1/Makefile.am
1426 index 516e516..1cc2e1f 100644
1427 --- a/src/egl/opengles1/Makefile.am
1428 +++ b/src/egl/opengles1/Makefile.am
1429 @@ -38,24 +38,6 @@ AM_LDFLAGS = \
1430
1431 bin_PROGRAMS =
1432
1433 -if HAVE_EGL
1434 -if HAVE_GLESV1
1435 -bin_PROGRAMS += \
1436 - drawtex_screen \
1437 - gears_screen \
1438 - torus_screen \
1439 - tri_screen
1440 -
1441 -drawtex_screen_SOURCES = drawtex.c
1442 -gears_screen_SOURCES = gears.c
1443 -torus_screen_SOURCES = torus.c
1444 -tri_screen_SOURCES = tri.c
1445 -
1446 -drawtex_screen_LDADD = ../eglut/libeglut_screen.la
1447 -gears_screen_LDADD = ../eglut/libeglut_screen.la
1448 -torus_screen_LDADD = ../eglut/libeglut_screen.la
1449 -tri_screen_LDADD = ../eglut/libeglut_screen.la
1450 -
1451 if HAVE_X11
1452 bin_PROGRAMS += \
1453 clear \
1454 @@ -94,5 +76,3 @@ gears_x11_LDADD = ../eglut/libeglut_x11.la
1455 torus_x11_LDADD = ../eglut/libeglut_x11.la
1456 tri_x11_LDADD = ../eglut/libeglut_x11.la
1457 endif
1458 -endif
1459 -endif
1460 diff --git a/src/egl/opengles2/Makefile.am b/src/egl/opengles2/Makefile.am
1461 index 74af460..422cb03 100644
1462 --- a/src/egl/opengles2/Makefile.am
1463 +++ b/src/egl/opengles2/Makefile.am
1464 @@ -33,13 +33,7 @@ AM_LDFLAGS = \
1465 $(EGL_LIBS) \
1466 -lm
1467
1468 -if HAVE_EGL
1469 -if HAVE_GLESV2
1470 -bin_PROGRAMS = \
1471 - es2gears_screen
1472 -
1473 -es2gears_screen_SOURCES = es2gears.c
1474 -es2gears_screen_LDADD = ../eglut/libeglut_screen.la
1475 +bin_PROGRAMS =
1476
1477 if HAVE_WAYLAND
1478 bin_PROGRAMS += es2gears_wayland
1479 @@ -59,6 +53,4 @@ es2gears_x11_SOURCES = es2gears.c
1480 es2gears_x11_LDADD = ../eglut/libeglut_x11.la
1481 es2tri_LDADD = $(X11_LIBS)
1482 endif
1483 -endif
1484 -endif
1485
1486 diff --git a/src/egl/openvg/Makefile.am b/src/egl/openvg/Makefile.am
1487 index b545225..5fd1cf8 100644
1488 --- a/src/egl/openvg/Makefile.am
1489 +++ b/src/egl/openvg/Makefile.am
1490 @@ -50,21 +50,13 @@ endif
1491 if HAVE_EGL
1492 if HAVE_VG
1493 bin_PROGRAMS = \
1494 - lion_screen \
1495 - sp_screen \
1496 $(EGL_X11_DEMOS)
1497 endif
1498 endif
1499
1500 -lion_screen_SOURCES = lion.c lion-render.c lion-render.h
1501 -sp_screen_SOURCES = sp.c
1502 -
1503 lion_x11_SOURCES = lion.c lion-render.c lion-render.h
1504 sp_x11_SOURCES = sp.c
1505
1506 -lion_screen_LDADD = ../eglut/libeglut_screen.la
1507 -sp_screen_LDADD = ../eglut/libeglut_screen.la
1508 -
1509 lion_x11_LDADD = ../eglut/libeglut_x11.la
1510 sp_x11_LDADD = ../eglut/libeglut_x11.la
1511
1512 diff --git a/src/egl/openvg/Makefile.in b/src/egl/openvg/Makefile.in
1513 index 99e9288..3652fbb 100644
1514 --- a/src/egl/openvg/Makefile.in
1515 +++ b/src/egl/openvg/Makefile.in
1516 @@ -108,8 +108,6 @@ host_triplet = @host@
1517 @HAVE_FREETYPE2_TRUE@@HAVE_X11_TRUE@am__append_1 = \
1518 @HAVE_FREETYPE2_TRUE@@HAVE_X11_TRUE@ text
1519
1520 -@HAVE_EGL_TRUE@@HAVE_VG_TRUE@noinst_PROGRAMS = lion_screen$(EXEEXT) \
1521 -@HAVE_EGL_TRUE@@HAVE_VG_TRUE@ sp_screen$(EXEEXT) \
1522 @HAVE_EGL_TRUE@@HAVE_VG_TRUE@ $(am__EXEEXT_2)
1523 subdir = src/egl/openvg
1524 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
1525 @@ -128,9 +126,6 @@ CONFIG_CLEAN_VPATH_FILES =
1526 @HAVE_X11_TRUE@am__EXEEXT_2 = lion_x11$(EXEEXT) sp_x11$(EXEEXT) \
1527 @HAVE_X11_TRUE@ $(am__EXEEXT_1)
1528 PROGRAMS = $(noinst_PROGRAMS)
1529 -am_lion_screen_OBJECTS = lion.$(OBJEXT) lion-render.$(OBJEXT)
1530 -lion_screen_OBJECTS = $(am_lion_screen_OBJECTS)
1531 -lion_screen_DEPENDENCIES = ../eglut/libeglut_screen.la
1532 AM_V_lt = $(am__v_lt_@AM_V@)
1533 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
1534 am__v_lt_0 = --silent
1535 @@ -138,9 +133,6 @@ am__v_lt_1 =
1536 am_lion_x11_OBJECTS = lion.$(OBJEXT) lion-render.$(OBJEXT)
1537 lion_x11_OBJECTS = $(am_lion_x11_OBJECTS)
1538 lion_x11_DEPENDENCIES = ../eglut/libeglut_x11.la
1539 -am_sp_screen_OBJECTS = sp.$(OBJEXT)
1540 -sp_screen_OBJECTS = $(am_sp_screen_OBJECTS)
1541 -sp_screen_DEPENDENCIES = ../eglut/libeglut_screen.la
1542 am_sp_x11_OBJECTS = sp.$(OBJEXT)
1543 sp_x11_OBJECTS = $(am_sp_x11_OBJECTS)
1544 sp_x11_DEPENDENCIES = ../eglut/libeglut_x11.la
1545 @@ -184,10 +176,10 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@)
1546 am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
1547 am__v_CCLD_0 = @echo " CCLD " $@;
1548 am__v_CCLD_1 =
1549 -SOURCES = $(lion_screen_SOURCES) $(lion_x11_SOURCES) \
1550 - $(sp_screen_SOURCES) $(sp_x11_SOURCES) $(text_SOURCES)
1551 -DIST_SOURCES = $(lion_screen_SOURCES) $(lion_x11_SOURCES) \
1552 - $(sp_screen_SOURCES) $(sp_x11_SOURCES) $(text_SOURCES)
1553 +SOURCES = $(lion_x11_SOURCES) \
1554 + $(sp_x11_SOURCES) $(text_SOURCES)
1555 +DIST_SOURCES = $(lion_x11_SOURCES) \
1556 + $(sp_x11_SOURCES) $(text_SOURCES)
1557 RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
1558 ctags-recursive dvi-recursive html-recursive info-recursive \
1559 install-data-recursive install-dvi-recursive \
1560 @@ -423,12 +415,8 @@ AM_LDFLAGS = \
1561 -lm
1562
1563 @HAVE_X11_TRUE@EGL_X11_DEMOS = lion_x11 sp_x11 $(am__append_1)
1564 -lion_screen_SOURCES = lion.c lion-render.c lion-render.h
1565 -sp_screen_SOURCES = sp.c
1566 lion_x11_SOURCES = lion.c lion-render.c lion-render.h
1567 sp_x11_SOURCES = sp.c
1568 -lion_screen_LDADD = ../eglut/libeglut_screen.la
1569 -sp_screen_LDADD = ../eglut/libeglut_screen.la
1570 lion_x11_LDADD = ../eglut/libeglut_x11.la
1571 sp_x11_LDADD = ../eglut/libeglut_x11.la
1572 text_SOURCES = text.c
1573 @@ -481,18 +469,10 @@ clean-noinstPROGRAMS:
1574 echo " rm -f" $$list; \
1575 rm -f $$list
1576
1577 -lion_screen$(EXEEXT): $(lion_screen_OBJECTS) $(lion_screen_DEPENDENCIES) $(EXTRA_lion_screen_DEPENDENCIES)
1578 - @rm -f lion_screen$(EXEEXT)
1579 - $(AM_V_CCLD)$(LINK) $(lion_screen_OBJECTS) $(lion_screen_LDADD) $(LIBS)
1580 -
1581 lion_x11$(EXEEXT): $(lion_x11_OBJECTS) $(lion_x11_DEPENDENCIES) $(EXTRA_lion_x11_DEPENDENCIES)
1582 @rm -f lion_x11$(EXEEXT)
1583 $(AM_V_CCLD)$(LINK) $(lion_x11_OBJECTS) $(lion_x11_LDADD) $(LIBS)
1584
1585 -sp_screen$(EXEEXT): $(sp_screen_OBJECTS) $(sp_screen_DEPENDENCIES) $(EXTRA_sp_screen_DEPENDENCIES)
1586 - @rm -f sp_screen$(EXEEXT)
1587 - $(AM_V_CCLD)$(LINK) $(sp_screen_OBJECTS) $(sp_screen_LDADD) $(LIBS)
1588 -
1589 sp_x11$(EXEEXT): $(sp_x11_OBJECTS) $(sp_x11_DEPENDENCIES) $(EXTRA_sp_x11_DEPENDENCIES)
1590 @rm -f sp_x11$(EXEEXT)
1591 $(AM_V_CCLD)$(LINK) $(sp_x11_OBJECTS) $(sp_x11_LDADD) $(LIBS)
1592