[Mesa-dev] [PATCH demos] egl: Remove demos using EGL_MESA_screen_surface.

Andreas Boll andreas.boll.dev at gmail.com
Tue Sep 1 09:42:57 PDT 2015


Hi Matt,

2015-08-29 1:09 GMT+02:00 Matt Turner <mattst88 at gmail.com>:
> The remnants of the extension were removed from Mesa in commit 7a58262e.
>
> Bugzilla: https://bugs.gentoo.org/show_bug.cgi?id=555186
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91020
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91643

Bugzilla: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=796373

Unfortunately this patch isn't enough to fix the build on Debian:

eglut.c: In function '_eglutDestroyWindow':
eglut.c:80:32: error: 'EGL_SCREEN_BIT_MESA' undeclared (first use in
this function)
        _eglut->surface_type != EGL_SCREEN_BIT_MESA)
                                ^
eglut.c:80:32: note: each undeclared identifier is reported only once
for each function it appears in
eglut.c: In function '_eglutCreateWindow':
eglut.c:178:9: error: 'EGL_SCREEN_BIT_MESA' undeclared (first use in
this function)
    case EGL_SCREEN_BIT_MESA:
         ^
eglut.c: In function 'eglutDestroyWindow':
eglut.c:293:33: error: 'EGL_SCREEN_BIT_MESA' undeclared (first use in
this function)
    if ( _eglut->surface_type != EGL_SCREEN_BIT_MESA)
                                 ^

git grep EGL_SCREEN_BIT_MESA
src/egl/eglut/eglut.c:       _eglut->surface_type != EGL_SCREEN_BIT_MESA)
src/egl/eglut/eglut.c:   case EGL_SCREEN_BIT_MESA:
src/egl/eglut/eglut.c:   if ( _eglut->surface_type != EGL_SCREEN_BIT_MESA)


Thanks,
Andreas.

> ---
> demo1 and eglscreen didn't look useful, but maybe demo2 and demo3 are?
> They'd have to be ported to something newer -- EGL_MESA_drm_image?
>
> If someone is interested in porting any of these, I'd be happy to submit
> a smaller patch that simply adds some ifdefs to eglut_screen.c (to make
> it a no-op).
>
>  src/egl/eglut/CMakeLists.txt     |   6 -
>  src/egl/eglut/Makefile.am        |  10 +-
>  src/egl/eglut/eglut_screen.c     | 180 -----------
>  src/egl/opengl/.gitignore        |   6 -
>  src/egl/opengl/CMakeLists.txt    |  17 -
>  src/egl/opengl/Makefile.am       |  11 -
>  src/egl/opengl/demo1.c           | 147 ---------
>  src/egl/opengl/demo2.c           | 216 -------------
>  src/egl/opengl/demo3.c           | 647 ---------------------------------------
>  src/egl/opengl/eglinfo.c         |  45 ---
>  src/egl/opengl/eglscreen.c       | 120 --------
>  src/egl/opengles1/.gitignore     |   4 -
>  src/egl/opengles1/CMakeLists.txt |   4 -
>  src/egl/opengles1/Makefile.am    |  14 -
>  src/egl/opengles2/.gitignore     |   1 -
>  src/egl/opengles2/CMakeLists.txt |   4 -
>  src/egl/opengles2/Makefile.am    |   7 +-
>  src/egl/openvg/.gitignore        |   2 -
>  src/egl/openvg/CMakeLists.txt    |   4 -
>  src/egl/openvg/Makefile.am       |   8 -
>  20 files changed, 4 insertions(+), 1449 deletions(-)
>  delete mode 100644 src/egl/eglut/eglut_screen.c
>  delete mode 100644 src/egl/opengl/demo1.c
>  delete mode 100644 src/egl/opengl/demo2.c
>  delete mode 100644 src/egl/opengl/demo3.c
>  delete mode 100644 src/egl/opengl/eglscreen.c
>
> diff --git a/src/egl/eglut/CMakeLists.txt b/src/egl/eglut/CMakeLists.txt
> index a885977..0417b48 100644
> --- a/src/egl/eglut/CMakeLists.txt
> +++ b/src/egl/eglut/CMakeLists.txt
> @@ -9,9 +9,3 @@ if (X11_FOUND)
>                 install (TARGETS eglut_x11 DESTINATION ${LIBDIR})
>         endif (BUILD_SHARED_LIBS)
>  endif (X11_FOUND)
> -
> -add_library (eglut_screen eglut.h eglut.c eglutint.h eglut_screen.c)
> -target_link_libraries (eglut_screen ${EGL_LIBRARIES})
> -if (BUILD_SHARED_LIBS)
> -       install (TARGETS eglut_screen DESTINATION ${LIBDIR})
> -endif (BUILD_SHARED_LIBS)
> diff --git a/src/egl/eglut/Makefile.am b/src/egl/eglut/Makefile.am
> index 2d2f2af..b765069 100644
> --- a/src/egl/eglut/Makefile.am
> +++ b/src/egl/eglut/Makefile.am
> @@ -33,17 +33,12 @@ if HAVE_WAYLAND
>  eglut_wayland = libeglut_wayland.la
>  endif
>
> -noinst_LTLIBRARIES = libeglut_screen.la $(eglut_x11) $(eglut_wayland)
> +noinst_LTLIBRARIES = $(eglut_x11) $(eglut_wayland)
>  endif
>
> -libeglut_screen_la_SOURCES = \
> -       eglut.c \
> -       eglut.h \
> -       eglutint.h \
> -       eglut_screen.c
> -
>  libeglut_x11_la_SOURCES = \
>         eglut.c \
> +       eglut.h \
>         eglutint.h \
>         eglut_x11.c
>  libeglut_x11_la_CFLAGS = $(X11_CFLAGS) $(EGL_CFLAGS)
> @@ -52,6 +47,7 @@ libeglut_x11_la_LIBADD = $(X11_LIBS) $(EGL_LIBS)
>
>  libeglut_wayland_la_SOURCES = \
>         eglut.c \
> +       eglut.h \
>         eglutint.h \
>         eglut_wayland.c
>
> diff --git a/src/egl/eglut/eglut_screen.c b/src/egl/eglut/eglut_screen.c
> deleted file mode 100644
> index 021a8f1..0000000
> --- a/src/egl/eglut/eglut_screen.c
> +++ /dev/null
> @@ -1,180 +0,0 @@
> -/*
> - * Copyright (C) 2010 LunarG Inc.
> - *
> - * Permission is hereby granted, free of charge, to any person obtaining a
> - * copy of this software and associated documentation files (the "Software"),
> - * to deal in the Software without restriction, including without limitation
> - * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> - * and/or sell copies of the Software, and to permit persons to whom the
> - * Software is furnished to do so, subject to the following conditions:
> - *
> - * The above copyright notice and this permission notice shall be included
> - * in all copies or substantial portions of the Software.
> - *
> - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> - * DEALINGS IN THE SOFTWARE.
> - *
> - * Authors:
> - *    Chia-I Wu <olv at lunarg.com>
> - */
> -
> -#include <stdio.h>
> -#include <string.h>
> -#include <sys/time.h>
> -
> -#define EGL_EGLEXT_PROTOTYPES
> -#include "EGL/egl.h"
> -#include "EGL/eglext.h"
> -
> -#include "eglutint.h"
> -
> -#define MAX_MODES 100
> -
> -static EGLScreenMESA kms_screen;
> -static EGLModeMESA kms_mode;
> -static EGLint kms_width, kms_height;
> -
> -void
> -_eglutNativeInitDisplay(void)
> -{
> -   _eglut->native_dpy = EGL_DEFAULT_DISPLAY;
> -   _eglut->surface_type = EGL_SCREEN_BIT_MESA;
> -}
> -
> -void
> -_eglutNativeFiniDisplay(void)
> -{
> -   kms_screen = 0;
> -   kms_mode = 0;
> -   kms_width = 0;
> -   kms_height = 0;
> -}
> -
> -static void
> -init_kms(void)
> -{
> -   EGLModeMESA modes[MAX_MODES];
> -   EGLint num_screens, num_modes;
> -   EGLint width, height, best_mode;
> -   EGLint i;
> -
> -   if (!eglGetScreensMESA(_eglut->dpy, &kms_screen, 1, &num_screens) ||
> -         !num_screens)
> -      _eglutFatal("eglGetScreensMESA failed\n");
> -
> -   if (!eglGetModesMESA(_eglut->dpy, kms_screen,
> -            modes, MAX_MODES, &num_modes) || !num_modes)
> -      _eglutFatal("eglGetModesMESA failed!\n");
> -
> -   printf("Found %d modes:\n", num_modes);
> -
> -   best_mode = 0;
> -   width = 0;
> -   height = 0;
> -   for (i = 0; i < num_modes; i++) {
> -      EGLint w, h;
> -      eglGetModeAttribMESA(_eglut->dpy, modes[i], EGL_WIDTH, &w);
> -      eglGetModeAttribMESA(_eglut->dpy, modes[i], EGL_HEIGHT, &h);
> -      printf("%3d: %d x %d\n", i, w, h);
> -      if (w > width && h > height) {
> -         width = w;
> -         height = h;
> -         best_mode = i;
> -      }
> -   }
> -
> -   printf("Will use screen size: %d x %d\n", width, height);
> -
> -   kms_mode = modes[best_mode];
> -   kms_width = width;
> -   kms_height = height;
> -}
> -
> -void
> -_eglutNativeInitWindow(struct eglut_window *win, const char *title,
> -                       int x, int y, int w, int h)
> -{
> -   EGLint surf_attribs[16];
> -   EGLint i;
> -   const char *exts;
> -
> -   exts = eglQueryString(_eglut->dpy, EGL_EXTENSIONS);
> -   if (!exts || !strstr(exts, "EGL_MESA_screen_surface"))
> -      _eglutFatal("EGL_MESA_screen_surface is not supported\n");
> -
> -   init_kms();
> -
> -   i = 0;
> -   surf_attribs[i++] = EGL_WIDTH;
> -   surf_attribs[i++] = kms_width;
> -   surf_attribs[i++] = EGL_HEIGHT;
> -   surf_attribs[i++] = kms_height;
> -   surf_attribs[i++] = EGL_NONE;
> -
> -   /* create surface */
> -   win->native.u.surface = eglCreateScreenSurfaceMESA(_eglut->dpy,
> -         win->config, surf_attribs);
> -   if (win->native.u.surface == EGL_NO_SURFACE)
> -      _eglutFatal("eglCreateScreenSurfaceMESA failed\n");
> -
> -   if (!eglShowScreenSurfaceMESA(_eglut->dpy, kms_screen,
> -            win->native.u.surface, kms_mode))
> -      _eglutFatal("eglShowScreenSurfaceMESA failed\n");
> -
> -   win->native.width = kms_width;
> -   win->native.height = kms_height;
> -}
> -
> -void
> -_eglutNativeFiniWindow(struct eglut_window *win)
> -{
> -   eglShowScreenSurfaceMESA(_eglut->dpy,
> -         kms_screen, EGL_NO_SURFACE, 0);
> -   eglDestroySurface(_eglut->dpy, win->native.u.surface);
> -}
> -
> -void
> -_eglutNativeEventLoop(void)
> -{
> -   int start = _eglutNow();
> -   int frames = 0;
> -
> -   _eglut->redisplay = 1;
> -
> -   while (1) {
> -      struct eglut_window *win = _eglut->current;
> -      int now = _eglutNow();
> -
> -      if (now - start > 5000) {
> -         double elapsed = (double) (now - start) / 1000.0;
> -
> -         printf("%d frames in %3.1f seconds = %6.3f FPS\n",
> -               frames, elapsed, frames / elapsed);
> -         fflush(stdout);
> -
> -         start = now;
> -         frames = 0;
> -
> -         /* send escape */
> -         if (win->keyboard_cb)
> -            win->keyboard_cb(27);
> -      }
> -
> -      if (_eglut->idle_cb)
> -         _eglut->idle_cb();
> -
> -      if (_eglut->redisplay) {
> -         _eglut->redisplay = 0;
> -
> -         if (win->display_cb)
> -            win->display_cb();
> -         eglSwapBuffers(_eglut->dpy, win->surface);
> -         frames++;
> -      }
> -   }
> -}
> diff --git a/src/egl/opengl/.gitignore b/src/egl/opengl/.gitignore
> index e2bc4d2..930504c 100644
> --- a/src/egl/opengl/.gitignore
> +++ b/src/egl/opengl/.gitignore
> @@ -1,13 +1,7 @@
> -demo1
> -demo2
> -demo3
>  eglgears_x11
> -eglgears_screen
>  eglinfo
>  eglkms
> -eglscreen
>  egltri_x11
> -egltri_screen
>  peglgears
>  xeglbindtex
>  xeglgears
> diff --git a/src/egl/opengl/CMakeLists.txt b/src/egl/opengl/CMakeLists.txt
> index 04fb6dd..dd726b7 100644
> --- a/src/egl/opengl/CMakeLists.txt
> +++ b/src/egl/opengl/CMakeLists.txt
> @@ -12,19 +12,6 @@ link_libraries (
>
>  set (subdir egl)
>
> -set (targets
> -       demo1
> -       demo2
> -       demo3
> -)
> -
> -foreach (target ${targets})
> -       add_executable (${subdir}_${target} ${target}.c)
> -       set_target_properties (${subdir}_${target} PROPERTIES OUTPUT_NAME ${target})
> -       install (TARGETS ${subdir}_${target} DESTINATION ${subdir})
> -endforeach (target)
> -
> -
>  # Targets that can be built both for fullscreen EGL and X11
>
>  set (targets
> @@ -33,10 +20,6 @@ set (targets
>  )
>
>  foreach (target ${targets})
> -       add_executable (${target}_screen ${target}.c)
> -       target_link_libraries (${target}_screen eglut_screen)
> -       install (TARGETS ${target}_screen DESTINATION ${subdir})
> -
>         if (X11_FOUND)
>                 add_executable (${target}_x11 ${target}.c)
>                 target_link_libraries (${target}_x11 eglut_x11)
> diff --git a/src/egl/opengl/Makefile.am b/src/egl/opengl/Makefile.am
> index 0c7228f..fe7faa9 100644
> --- a/src/egl/opengl/Makefile.am
> +++ b/src/egl/opengl/Makefile.am
> @@ -51,20 +51,12 @@ endif
>
>  if HAVE_EGL
>  noinst_PROGRAMS = \
> -       demo1 \
> -       demo2 \
> -       demo3 \
>         eglinfo \
> -       eglgears_screen \
> -       egltri_screen \
>         peglgears \
>         $(EGL_DRM_DEMOS) \
>         $(EGL_X11_DEMOS)
>  endif
>
> -egltri_screen_SOURCES = egltri.c
> -eglgears_screen_SOURCES = eglgears.c
> -
>  egltri_x11_SOURCES = egltri.c
>  eglgears_x11_SOURCES = eglgears.c
>
> @@ -73,9 +65,6 @@ egltri_x11_LDFLAGS = $(AM_LDFLAGS) $(X11_LIBS)
>  xeglgears_LDFLAGS = $(AM_LDFLAGS) $(X11_LIBS)
>  xeglthreads_LDFLAGS = $(AM_LDFLAGS) $(X11_LIBS) -pthread
>
> -eglgears_screen_LDADD = ../eglut/libeglut_screen.la
> -egltri_screen_LDADD = ../eglut/libeglut_screen.la
> -
>  eglgears_x11_LDADD = ../eglut/libeglut_x11.la
>  egltri_x11_LDADD = ../eglut/libeglut_x11.la
>
> diff --git a/src/egl/opengl/demo1.c b/src/egl/opengl/demo1.c
> deleted file mode 100644
> index d892734..0000000
> --- a/src/egl/opengl/demo1.c
> +++ /dev/null
> @@ -1,147 +0,0 @@
> -/*
> - * Exercise EGL API functions
> - */
> -
> -#define EGL_EGLEXT_PROTOTYPES
> -
> -#include <EGL/egl.h>
> -#include <EGL/eglext.h>
> -#include <assert.h>
> -#include <stdio.h>
> -#include <stdlib.h>
> -#include <string.h>
> -
> -
> -/**
> - * Test EGL_MESA_screen_surface functions
> - */
> -static void
> -TestScreens(EGLDisplay dpy)
> -{
> -#define MAX 8
> -   EGLScreenMESA screens[MAX];
> -   EGLint numScreens;
> -   EGLint i;
> -
> -   eglGetScreensMESA(dpy, screens, MAX, &numScreens);
> -   printf("Found %d screens\n", numScreens);
> -   for (i = 0; i < numScreens; i++) {
> -      printf(" Screen %d handle: %d\n", i, (int) screens[i]);
> -   }
> -}
> -
> -/**
> - * Print table of all available configurations.
> - */
> -static void
> -PrintConfigs(EGLDisplay d, EGLConfig *configs, EGLint numConfigs)
> -{
> -   EGLint i;
> -
> -   printf("Configurations:\n");
> -   printf("     bf lv d st colorbuffer dp st   supported \n");
> -   printf("  id sz  l b ro  r  g  b  a th cl   surfaces  \n");
> -   printf("----------------------------------------------\n");
> -   for (i = 0; i < numConfigs; i++) {
> -      EGLint id, size, level;
> -      EGLint red, green, blue, alpha;
> -      EGLint depth, stencil;
> -      EGLint surfaces;
> -      EGLint doubleBuf = 1, stereo = 0;
> -      char surfString[100] = "";
> -
> -      eglGetConfigAttrib(d, configs[i], EGL_CONFIG_ID, &id);
> -      eglGetConfigAttrib(d, configs[i], EGL_BUFFER_SIZE, &size);
> -      eglGetConfigAttrib(d, configs[i], EGL_LEVEL, &level);
> -
> -      eglGetConfigAttrib(d, configs[i], EGL_RED_SIZE, &red);
> -      eglGetConfigAttrib(d, configs[i], EGL_GREEN_SIZE, &green);
> -      eglGetConfigAttrib(d, configs[i], EGL_BLUE_SIZE, &blue);
> -      eglGetConfigAttrib(d, configs[i], EGL_ALPHA_SIZE, &alpha);
> -      eglGetConfigAttrib(d, configs[i], EGL_DEPTH_SIZE, &depth);
> -      eglGetConfigAttrib(d, configs[i], EGL_STENCIL_SIZE, &stencil);
> -      eglGetConfigAttrib(d, configs[i], EGL_SURFACE_TYPE, &surfaces);
> -
> -      if (surfaces & EGL_WINDOW_BIT)
> -         strcat(surfString, "win,");
> -      if (surfaces & EGL_PBUFFER_BIT)
> -         strcat(surfString, "pb,");
> -      if (surfaces & EGL_PIXMAP_BIT)
> -         strcat(surfString, "pix,");
> -      if (strlen(surfString) > 0)
> -         surfString[strlen(surfString) - 1] = 0;
> -
> -      printf("0x%02x %2d %2d %c  %c %2d %2d %2d %2d %2d %2d   %-12s\n",
> -             id, size, level,
> -             doubleBuf ? 'y' : '.',
> -             stereo ? 'y' : '.',
> -             red, green, blue, alpha,
> -             depth, stencil, surfString);
> -   }
> -}
> -
> -
> -
> -int
> -main(int argc, char *argv[])
> -{
> -   int maj, min;
> -   EGLContext ctx;
> -   EGLSurface pbuffer;
> -   EGLConfig *configs;
> -   EGLint numConfigs;
> -   EGLBoolean b;
> -   const EGLint pbufAttribs[] = {
> -      EGL_WIDTH, 500,
> -      EGL_HEIGHT, 500,
> -      EGL_NONE
> -   };
> -
> -   EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
> -   assert(d);
> -
> -   if (!eglInitialize(d, &maj, &min)) {
> -      printf("demo: eglInitialize failed\n");
> -      exit(1);
> -   }
> -
> -   printf("EGL version = %d.%d\n", maj, min);
> -   printf("EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR));
> -
> -   eglGetConfigs(d, NULL, 0, &numConfigs);
> -   configs = malloc(sizeof(*configs) *numConfigs);
> -   eglGetConfigs(d, configs, numConfigs, &numConfigs);
> -
> -   PrintConfigs(d, configs, numConfigs);
> -
> -   eglBindAPI(EGL_OPENGL_API);
> -   ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL);
> -   if (ctx == EGL_NO_CONTEXT) {
> -      printf("failed to create context\n");
> -      return 0;
> -   }
> -
> -   pbuffer = eglCreatePbufferSurface(d, configs[0], pbufAttribs);
> -   if (pbuffer == EGL_NO_SURFACE) {
> -      printf("failed to create pbuffer\n");
> -      return 0;
> -   }
> -
> -   free(configs);
> -
> -   b = eglMakeCurrent(d, pbuffer, pbuffer, ctx);
> -   if (!b) {
> -      printf("make current failed\n");
> -      return 0;
> -   }
> -
> -   b = eglMakeCurrent(d, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
> -
> -   TestScreens(d);
> -
> -   eglDestroySurface(d, pbuffer);
> -   eglDestroyContext(d, ctx);
> -   eglTerminate(d);
> -
> -   return 0;
> -}
> diff --git a/src/egl/opengl/demo2.c b/src/egl/opengl/demo2.c
> deleted file mode 100644
> index 505b474..0000000
> --- a/src/egl/opengl/demo2.c
> +++ /dev/null
> @@ -1,216 +0,0 @@
> -/*
> - * Exercise EGL API functions
> - */
> -
> -#define EGL_EGLEXT_PROTOTYPES
> -
> -#include <assert.h>
> -#include <stdio.h>
> -#include <stdlib.h>
> -#include <string.h>
> -#include <unistd.h>
> -
> -#include <EGL/egl.h>
> -#include <EGL/eglext.h>
> -#include "gl_wrap.h"
> -
> -/*#define FRONTBUFFER*/
> -
> -static void _subset_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2,
> -                          GLfloat r, GLfloat g, GLfloat b)
> -{
> -   GLfloat v[4][2], c[4][4];
> -   int i;
> -
> -   v[0][0] = x1;   v[0][1] = y1;
> -   v[1][0] = x2;   v[1][1] = y1;
> -   v[2][0] = x2;   v[2][1] = y2;
> -   v[3][0] = x1;   v[3][1] = y2;
> -
> -   for (i = 0; i < 4; i++) {
> -      c[i][0] = r;
> -      c[i][1] = g;
> -      c[i][2] = b;
> -      c[i][3] = 1.0;
> -   }
> -
> -   glVertexPointer(2, GL_FLOAT, 0, v);
> -   glColorPointer(4, GL_FLOAT, 0, c);
> -   glEnableClientState(GL_VERTEX_ARRAY);
> -   glEnableClientState(GL_COLOR_ARRAY);
> -
> -   glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
> -
> -   glDisableClientState(GL_VERTEX_ARRAY);
> -   glDisableClientState(GL_COLOR_ARRAY);
> -}
> -
> -
> -static void redraw(EGLDisplay dpy, EGLSurface surf, int rot)
> -{
> -   GLfloat r, g, b;
> -
> -   printf("Redraw event\n");
> -
> -   glClearColor( rand()/(float)RAND_MAX,
> -                rand()/(float)RAND_MAX,
> -                rand()/(float)RAND_MAX,
> -                1);
> -
> -   glClear( GL_COLOR_BUFFER_BIT );
> -
> -   r = rand()/(float)RAND_MAX;
> -   g = rand()/(float)RAND_MAX;
> -   b = rand()/(float)RAND_MAX;
> -
> -   glPushMatrix();
> -   glRotatef(rot, 0, 0, 1);
> -   glScalef(.5, .5, .5);
> -   _subset_Rectf( -1, -1, 1, 1, r, g, b );
> -   glPopMatrix();
> -
> -#ifdef FRONTBUFFER
> -   glFlush();
> -#else
> -   eglSwapBuffers( dpy, surf );
> -#endif
> -   glFinish();
> -}
> -
> -
> -/**
> - * Test EGL_MESA_screen_surface functions
> - */
> -static void
> -TestScreens(EGLDisplay dpy)
> -{
> -#define MAX 8
> -   EGLScreenMESA screens[MAX];
> -   EGLint numScreens;
> -   EGLint i;
> -
> -   eglGetScreensMESA(dpy, screens, MAX, &numScreens);
> -   printf("Found %d screens\n", numScreens);
> -   for (i = 0; i < numScreens; i++) {
> -      printf(" Screen %d handle: %d\n", i, (int) screens[i]);
> -   }
> -}
> -
> -
> -int
> -main(int argc, char *argv[])
> -{
> -   int maj, min;
> -   EGLContext ctx;
> -   EGLSurface pbuffer, screen_surf;
> -   EGLConfig configs[10];
> -   EGLint numConfigs, i;
> -   EGLBoolean b;
> -   const EGLint pbufAttribs[] = {
> -      EGL_WIDTH, 500,
> -      EGL_HEIGHT, 500,
> -      EGL_NONE
> -   };
> -   EGLint screenAttribs[32];
> -   EGLModeMESA mode;
> -   EGLScreenMESA screen;
> -   EGLint count;
> -
> -   EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
> -   assert(d);
> -
> -   if (!eglInitialize(d, &maj, &min)) {
> -      printf("demo: eglInitialize failed\n");
> -      exit(1);
> -   }
> -
> -   printf("EGL version = %d.%d\n", maj, min);
> -   printf("EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR));
> -   if (!strstr(eglQueryString(d, EGL_EXTENSIONS),
> -               "EGL_MESA_screen_surface")) {
> -      printf("EGL_MESA_screen_surface is not supported\n");
> -      exit(1);
> -   }
> -
> -   eglGetConfigs(d, configs, 10, &numConfigs);
> -   printf("Got %d EGL configs:\n", numConfigs);
> -   for (i = 0; i < numConfigs; i++) {
> -      EGLint id, red, depth;
> -      eglGetConfigAttrib(d, configs[i], EGL_CONFIG_ID, &id);
> -      eglGetConfigAttrib(d, configs[i], EGL_RED_SIZE, &red);
> -      eglGetConfigAttrib(d, configs[i], EGL_DEPTH_SIZE, &depth);
> -      printf("%2d:  Red Size = %d  Depth Size = %d\n", id, red, depth);
> -   }
> -
> -   eglGetScreensMESA(d, &screen, 1, &count);
> -   eglGetModesMESA(d, screen, &mode, 1, &count);
> -
> -   eglBindAPI(EGL_OPENGL_API);
> -   ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL);
> -   if (ctx == EGL_NO_CONTEXT) {
> -      printf("failed to create context\n");
> -      return 0;
> -   }
> -
> -   pbuffer = eglCreatePbufferSurface(d, configs[0], pbufAttribs);
> -   if (pbuffer == EGL_NO_SURFACE) {
> -      printf("failed to create pbuffer\n");
> -      return 0;
> -   }
> -
> -   b = eglMakeCurrent(d, pbuffer, pbuffer, ctx);
> -   if (!b) {
> -      printf("make current failed\n");
> -      return 0;
> -   }
> -
> -   b = eglMakeCurrent(d, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
> -
> -   i = 0;
> -   screenAttribs[i++] = EGL_WIDTH;
> -   eglGetModeAttribMESA(d, mode, EGL_WIDTH, &screenAttribs[i++]);
> -   screenAttribs[i++] = EGL_HEIGHT;
> -   eglGetModeAttribMESA(d, mode, EGL_HEIGHT, &screenAttribs[i++]);
> -   screenAttribs[i] = EGL_NONE;
> -
> -   screen_surf = eglCreateScreenSurfaceMESA(d, configs[0], screenAttribs);
> -   if (screen_surf == EGL_NO_SURFACE) {
> -      printf("failed to create screen surface\n");
> -      return 0;
> -   }
> -
> -   eglShowScreenSurfaceMESA(d, screen, screen_surf, mode);
> -
> -   b = eglMakeCurrent(d, screen_surf, screen_surf, ctx);
> -   if (!b) {
> -      printf("make current failed\n");
> -      return 0;
> -   }
> -
> -   glViewport(0, 0, 1024, 768);
> -
> -   glClearColor( 0,
> -                1.0,
> -                0,
> -                1);
> -
> -   glClear( GL_COLOR_BUFFER_BIT );
> -
> -
> -   TestScreens(d);
> -
> -   glShadeModel( GL_FLAT );
> -
> -   for (i = 0; i < 6; i++) {
> -      redraw(d, screen_surf, i*10 );
> -
> -      printf("sleep(1)\n");
> -      sleep(1);
> -   }
> -
> -   eglDestroySurface(d, pbuffer);
> -   eglDestroyContext(d, ctx);
> -   eglTerminate(d);
> -
> -   return 0;
> -}
> diff --git a/src/egl/opengl/demo3.c b/src/egl/opengl/demo3.c
> deleted file mode 100644
> index f84ca23..0000000
> --- a/src/egl/opengl/demo3.c
> +++ /dev/null
> @@ -1,647 +0,0 @@
> -/*
> - * Exercise EGL API functions
> - */
> -
> -#define EGL_EGLEXT_PROTOTYPES
> -
> -#include <EGL/egl.h>
> -#include <EGL/eglext.h>
> -#include "gl_wrap.h"
> -#include <assert.h>
> -#include <stdio.h>
> -#include <stdlib.h>
> -#include <string.h>
> -#include <unistd.h>
> -
> -
> -
> -#define PIXEL_CENTER(x) ((long)(x) + 0.5)
> -
> -#define GAP 10
> -#define ROWS 3
> -#define COLS 4
> -
> -#define OPENGL_WIDTH 48
> -#define OPENGL_HEIGHT 13
> -
> -
> -GLenum rgb, doubleBuffer, windType;
> -GLint windW, windH;
> -
> -GLenum mode1, mode2;
> -GLint boxW, boxH;
> -GLubyte OpenGL_bits[] = {
> -   0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
> -   0x7f, 0xfb, 0xff, 0xff, 0xff, 0x01,
> -   0x7f, 0xfb, 0xff, 0xff, 0xff, 0x01,
> -   0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
> -   0x3e, 0x8f, 0xb7, 0xf9, 0xfc, 0x01,
> -   0x63, 0xdb, 0xb0, 0x8d, 0x0d, 0x00,
> -   0x63, 0xdb, 0xb7, 0x8d, 0x0d, 0x00,
> -   0x63, 0xdb, 0xb6, 0x8d, 0x0d, 0x00,
> -   0x63, 0x8f, 0xf3, 0xcc, 0x0d, 0x00,
> -   0x63, 0x00, 0x00, 0x0c, 0x4c, 0x0a,
> -   0x63, 0x00, 0x00, 0x0c, 0x4c, 0x0e,
> -   0x63, 0x00, 0x00, 0x8c, 0xed, 0x0e,
> -   0x3e, 0x00, 0x00, 0xf8, 0x0c, 0x00,
> -};
> -
> -
> -static void Init(void)
> -{
> -
> -    mode1 = GL_TRUE;
> -    mode2 = GL_TRUE;
> -}
> -
> -static void Reshape(int width, int height)
> -{
> -
> -    windW = (GLint)width;
> -    windH = (GLint)height;
> -}
> -
> -#if 0
> -static void RotateColorMask(void)
> -{
> -    static GLint rotation = 0;
> -
> -    rotation = (rotation + 1) & 0x3;
> -    switch (rotation) {
> -      case 0:
> -       glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
> -       glIndexMask( 0xff );
> -       break;
> -      case 1:
> -       glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_TRUE);
> -       glIndexMask(0xFE);
> -       break;
> -      case 2:
> -       glColorMask(GL_TRUE, GL_FALSE, GL_TRUE, GL_TRUE);
> -       glIndexMask(0xFD);
> -       break;
> -      case 3:
> -       glColorMask(GL_TRUE, GL_TRUE, GL_FALSE, GL_TRUE);
> -       glIndexMask(0xFB);
> -       break;
> -    }
> -}
> -#endif
> -
> -static void Viewport(GLint row, GLint column)
> -{
> -    GLint x, y;
> -
> -    boxW = (windW - (COLS + 1) * GAP) / COLS;
> -    boxH = (windH - (ROWS + 1) * GAP) / ROWS;
> -
> -    x = GAP + column * (boxW + GAP);
> -    y = GAP + row * (boxH + GAP);
> -
> -    glViewport(x, y, boxW, boxH);
> -
> -    glMatrixMode(GL_PROJECTION);
> -    glLoadIdentity();
> -    glOrtho(-boxW/2, boxW/2, -boxH/2, boxH/2, 0.0, 1.0);
> -    glMatrixMode(GL_MODELVIEW);
> -
> -    glEnable(GL_SCISSOR_TEST);
> -    glScissor(x, y, boxW, boxH);
> -}
> -
> -enum {
> -    COLOR_BLACK = 0,
> -    COLOR_RED,
> -    COLOR_GREEN,
> -    COLOR_YELLOW,
> -    COLOR_BLUE,
> -    COLOR_MAGENTA,
> -    COLOR_CYAN,
> -    COLOR_WHITE
> -};
> -
> -static float RGBMap[9][3] = {
> -    {0, 0, 0},
> -    {1, 0, 0},
> -    {0, 1, 0},
> -    {1, 1, 0},
> -    {0, 0, 1},
> -    {1, 0, 1},
> -    {0, 1, 1},
> -    {1, 1, 1},
> -    {0.5, 0.5, 0.5}
> -};
> -
> -static void SetColor(int c)
> -{
> -     glColor3fv(RGBMap[c]);
> -}
> -
> -static void Point(void)
> -{
> -    GLint i;
> -
> -    glBegin(GL_POINTS);
> -       SetColor(COLOR_WHITE);
> -       glVertex2i(0, 0);
> -       for (i = 1; i < 8; i++) {
> -           GLint j = i * 2;
> -           SetColor(COLOR_BLACK+i);
> -           glVertex2i(-j, -j);
> -           glVertex2i(-j, 0);
> -           glVertex2i(-j, j);
> -           glVertex2i(0, j);
> -           glVertex2i(j, j);
> -           glVertex2i(j, 0);
> -           glVertex2i(j, -j);
> -           glVertex2i(0, -j);
> -       }
> -    glEnd();
> -}
> -
> -static void Lines(void)
> -{
> -    GLint i;
> -
> -    glPushMatrix();
> -
> -    glTranslatef(-12, 0, 0);
> -    for (i = 1; i < 8; i++) {
> -       SetColor(COLOR_BLACK+i);
> -       glBegin(GL_LINES);
> -           glVertex2i(-boxW/4, -boxH/4);
> -           glVertex2i(boxW/4, boxH/4);
> -       glEnd();
> -       glTranslatef(4, 0, 0);
> -    }
> -
> -    glPopMatrix();
> -
> -    glBegin(GL_LINES);
> -       glVertex2i(0, 0);
> -    glEnd();
> -}
> -
> -static void LineStrip(void)
> -{
> -
> -    glBegin(GL_LINE_STRIP);
> -       SetColor(COLOR_RED);
> -       glVertex2f(PIXEL_CENTER(-boxW/4), PIXEL_CENTER(-boxH/4));
> -       SetColor(COLOR_GREEN);
> -       glVertex2f(PIXEL_CENTER(-boxW/4), PIXEL_CENTER(boxH/4));
> -       SetColor(COLOR_BLUE);
> -       glVertex2f(PIXEL_CENTER(boxW/4), PIXEL_CENTER(boxH/4));
> -       SetColor(COLOR_WHITE);
> -       glVertex2f(PIXEL_CENTER(boxW/4), PIXEL_CENTER(-boxH/4));
> -    glEnd();
> -
> -    glBegin(GL_LINE_STRIP);
> -       glVertex2i(0, 0);
> -    glEnd();
> -}
> -
> -static void LineLoop(void)
> -{
> -
> -    glBegin(GL_LINE_LOOP);
> -       SetColor(COLOR_RED);
> -       glVertex2f(PIXEL_CENTER(-boxW/4), PIXEL_CENTER(-boxH/4));
> -       SetColor(COLOR_GREEN);
> -       glVertex2f(PIXEL_CENTER(-boxW/4), PIXEL_CENTER(boxH/4));
> -       SetColor(COLOR_BLUE);
> -       glVertex2f(PIXEL_CENTER(boxW/4), PIXEL_CENTER(boxH/4));
> -       SetColor(COLOR_WHITE);
> -       glVertex2f(PIXEL_CENTER(boxW/4), PIXEL_CENTER(-boxH/4));
> -    glEnd();
> -
> -    glEnable(GL_LOGIC_OP);
> -    glLogicOp(GL_XOR);
> -
> -    glEnable(GL_BLEND);
> -    glBlendFunc(GL_ONE, GL_ONE);
> -
> -    SetColor(COLOR_MAGENTA);
> -    glBegin(GL_LINE_LOOP);
> -       glVertex2f(PIXEL_CENTER(-boxW/8), PIXEL_CENTER(-boxH/8));
> -       glVertex2f(PIXEL_CENTER(-boxW/8), PIXEL_CENTER(boxH/8));
> -    glEnd();
> -    glBegin(GL_LINE_LOOP);
> -       glVertex2f(PIXEL_CENTER(-boxW/8), PIXEL_CENTER(boxH/8+5));
> -       glVertex2f(PIXEL_CENTER(boxW/8), PIXEL_CENTER(boxH/8+5));
> -    glEnd();
> -    glDisable(GL_LOGIC_OP);
> -    glDisable(GL_BLEND);
> -
> -    SetColor(COLOR_GREEN);
> -    glBegin(GL_POINTS);
> -       glVertex2i(0, 0);
> -    glEnd();
> -
> -    glBegin(GL_LINE_LOOP);
> -       glVertex2i(0, 0);
> -    glEnd();
> -}
> -
> -static void Bitmap(void)
> -{
> -
> -    glBegin(GL_LINES);
> -       SetColor(COLOR_GREEN);
> -       glVertex2i(-boxW/2, 0);
> -       glVertex2i(boxW/2, 0);
> -       glVertex2i(0, -boxH/2);
> -       glVertex2i(0, boxH/2);
> -       SetColor(COLOR_RED);
> -       glVertex2i(0, -3);
> -       glVertex2i(0, -3+OPENGL_HEIGHT);
> -       SetColor(COLOR_BLUE);
> -       glVertex2i(0, -3);
> -       glVertex2i(OPENGL_WIDTH, -3);
> -    glEnd();
> -
> -    SetColor(COLOR_GREEN);
> -
> -    glPixelStorei(GL_UNPACK_LSB_FIRST, GL_TRUE);
> -    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
> -
> -    glRasterPos2i(0, 0);
> -    glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, 0, 3, 0.0, 0.0, OpenGL_bits);
> -}
> -
> -static void Triangles(void)
> -{
> -
> -    glBegin(GL_TRIANGLES);
> -       SetColor(COLOR_GREEN);
> -       glVertex2i(-boxW/4, -boxH/4);
> -       SetColor(COLOR_RED);
> -       glVertex2i(-boxW/8, -boxH/16);
> -       SetColor(COLOR_BLUE);
> -       glVertex2i(boxW/8, -boxH/16);
> -
> -       SetColor(COLOR_GREEN);
> -       glVertex2i(-boxW/4, boxH/4);
> -       SetColor(COLOR_RED);
> -       glVertex2i(-boxW/8, boxH/16);
> -       SetColor(COLOR_BLUE);
> -       glVertex2i(boxW/8, boxH/16);
> -    glEnd();
> -
> -    glBegin(GL_TRIANGLES);
> -       glVertex2i(0, 0);
> -       glVertex2i(-100, 100);
> -    glEnd();
> -}
> -
> -static void TriangleStrip(void)
> -{
> -
> -    glBegin(GL_TRIANGLE_STRIP);
> -       SetColor(COLOR_GREEN);
> -       glVertex2i(-boxW/4, -boxH/4);
> -       SetColor(COLOR_RED);
> -       glVertex2i(-boxW/4, boxH/4);
> -       SetColor(COLOR_BLUE);
> -       glVertex2i(0, -boxH/4);
> -       SetColor(COLOR_WHITE);
> -       glVertex2i(0, boxH/4);
> -       SetColor(COLOR_CYAN);
> -       glVertex2i(boxW/4, -boxH/4);
> -       SetColor(COLOR_YELLOW);
> -       glVertex2i(boxW/4, boxH/4);
> -    glEnd();
> -
> -    glBegin(GL_TRIANGLE_STRIP);
> -       glVertex2i(0, 0);
> -       glVertex2i(-100, 100);
> -    glEnd();
> -}
> -
> -static void TriangleFan(void)
> -{
> -    GLint vx[8][2];
> -    GLint x0, y0, x1, y1, x2, y2, x3, y3;
> -    GLint i;
> -
> -    y0 = -boxH/4;
> -    y1 = y0 + boxH/2/3;
> -    y2 = y1 + boxH/2/3;
> -    y3 = boxH/4;
> -    x0 = -boxW/4;
> -    x1 = x0 + boxW/2/3;
> -    x2 = x1 + boxW/2/3;
> -    x3 = boxW/4;
> -
> -    vx[0][0] = x0; vx[0][1] = y1;
> -    vx[1][0] = x0; vx[1][1] = y2;
> -    vx[2][0] = x1; vx[2][1] = y3;
> -    vx[3][0] = x2; vx[3][1] = y3;
> -    vx[4][0] = x3; vx[4][1] = y2;
> -    vx[5][0] = x3; vx[5][1] = y1;
> -    vx[6][0] = x2; vx[6][1] = y0;
> -    vx[7][0] = x1; vx[7][1] = y0;
> -
> -    glBegin(GL_TRIANGLE_FAN);
> -       SetColor(COLOR_WHITE);
> -       glVertex2i(0, 0);
> -       for (i = 0; i < 8; i++) {
> -           SetColor(COLOR_WHITE-i);
> -           glVertex2iv(vx[i]);
> -       }
> -    glEnd();
> -
> -    glBegin(GL_TRIANGLE_FAN);
> -       glVertex2i(0, 0);
> -       glVertex2i(-100, 100);
> -    glEnd();
> -}
> -
> -static void Rect(void)
> -{
> -
> -    SetColor(COLOR_GREEN);
> -    glRecti(-boxW/4, -boxH/4, boxW/4, boxH/4);
> -}
> -
> -static void PolygonFunc(void)
> -{
> -    GLint vx[8][2];
> -    GLint x0, y0, x1, y1, x2, y2, x3, y3;
> -    GLint i;
> -
> -    y0 = -boxH/4;
> -    y1 = y0 + boxH/2/3;
> -    y2 = y1 + boxH/2/3;
> -    y3 = boxH/4;
> -    x0 = -boxW/4;
> -    x1 = x0 + boxW/2/3;
> -    x2 = x1 + boxW/2/3;
> -    x3 = boxW/4;
> -
> -    vx[0][0] = x0; vx[0][1] = y1;
> -    vx[1][0] = x0; vx[1][1] = y2;
> -    vx[2][0] = x1; vx[2][1] = y3;
> -    vx[3][0] = x2; vx[3][1] = y3;
> -    vx[4][0] = x3; vx[4][1] = y2;
> -    vx[5][0] = x3; vx[5][1] = y1;
> -    vx[6][0] = x2; vx[6][1] = y0;
> -    vx[7][0] = x1; vx[7][1] = y0;
> -
> -    glBegin(GL_POLYGON);
> -       for (i = 0; i < 8; i++) {
> -           SetColor(COLOR_WHITE-i);
> -           glVertex2iv(vx[i]);
> -       }
> -    glEnd();
> -
> -    glBegin(GL_POLYGON);
> -       glVertex2i(0, 0);
> -       glVertex2i(100, 100);
> -    glEnd();
> -}
> -
> -static void Quads(void)
> -{
> -
> -    glBegin(GL_QUADS);
> -       SetColor(COLOR_GREEN);
> -       glVertex2i(-boxW/4, -boxH/4);
> -       SetColor(COLOR_RED);
> -       glVertex2i(-boxW/8, -boxH/16);
> -       SetColor(COLOR_BLUE);
> -       glVertex2i(boxW/8, -boxH/16);
> -       SetColor(COLOR_WHITE);
> -       glVertex2i(boxW/4, -boxH/4);
> -
> -       SetColor(COLOR_GREEN);
> -       glVertex2i(-boxW/4, boxH/4);
> -       SetColor(COLOR_RED);
> -       glVertex2i(-boxW/8, boxH/16);
> -       SetColor(COLOR_BLUE);
> -       glVertex2i(boxW/8, boxH/16);
> -       SetColor(COLOR_WHITE);
> -       glVertex2i(boxW/4, boxH/4);
> -    glEnd();
> -
> -    glBegin(GL_QUADS);
> -       glVertex2i(0, 0);
> -       glVertex2i(100, 100);
> -       glVertex2i(-100, 100);
> -    glEnd();
> -}
> -
> -static void QuadStrip(void)
> -{
> -
> -    glBegin(GL_QUAD_STRIP);
> -       SetColor(COLOR_GREEN);
> -       glVertex2i(-boxW/4, -boxH/4);
> -       SetColor(COLOR_RED);
> -       glVertex2i(-boxW/4, boxH/4);
> -       SetColor(COLOR_BLUE);
> -       glVertex2i(0, -boxH/4);
> -       SetColor(COLOR_WHITE);
> -       glVertex2i(0, boxH/4);
> -       SetColor(COLOR_CYAN);
> -       glVertex2i(boxW/4, -boxH/4);
> -       SetColor(COLOR_YELLOW);
> -       glVertex2i(boxW/4, boxH/4);
> -    glEnd();
> -
> -    glBegin(GL_QUAD_STRIP);
> -       glVertex2i(0, 0);
> -       glVertex2i(100, 100);
> -       glVertex2i(-100, 100);
> -    glEnd();
> -}
> -
> -static void Draw(EGLDisplay dpy, EGLSurface surf)
> -{
> -
> -    glViewport(0, 0, windW, windH);
> -    glDisable(GL_SCISSOR_TEST);
> -
> -    glPushAttrib(GL_COLOR_BUFFER_BIT);
> -
> -    glColorMask(1, 1, 1, 1);
> -    glIndexMask(~0);
> -
> -    glClearColor(0.0, 0.0, 0.0, 0.0);
> -    glClear(GL_COLOR_BUFFER_BIT);
> -
> -    glPopAttrib();
> -
> -    if (mode1) {
> -       glShadeModel(GL_SMOOTH);
> -    } else {
> -       glShadeModel(GL_FLAT);
> -    }
> -
> -    if (mode2) {
> -       glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
> -    } else {
> -       glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
> -    }
> -
> -    Viewport(0, 0); Point();
> -    Viewport(0, 1); Lines();
> -    Viewport(0, 2); LineStrip();
> -    Viewport(0, 3); LineLoop();
> -
> -    Viewport(1, 0); Bitmap();
> -
> -    Viewport(1, 1); TriangleFan();
> -    Viewport(1, 2); Triangles();
> -    Viewport(1, 3); TriangleStrip();
> -
> -    Viewport(2, 0); Rect();
> -    Viewport(2, 1); PolygonFunc();
> -    Viewport(2, 2); Quads();
> -    Viewport(2, 3); QuadStrip();
> -
> -    glFlush();
> -
> -    if (doubleBuffer) {
> -       eglSwapBuffers(dpy, surf);
> -    }
> -}
> -
> -static void
> -write_ppm(const char *filename, const GLubyte *buffer, int width, int height)
> -{
> -   const int binary = 0;
> -   FILE *f = fopen( filename, "w" );
> -   if (f) {
> -      int i, x, y;
> -      const GLubyte *ptr = buffer;
> -      if (binary) {
> -         fprintf(f,"P6\n");
> -         fprintf(f,"# ppm-file created by osdemo.c\n");
> -         fprintf(f,"%i %i\n", width,height);
> -         fprintf(f,"255\n");
> -         fclose(f);
> -         f = fopen( filename, "ab" );  /* reopen in binary append mode */
> -         for (y=height-1; y>=0; y--) {
> -            for (x=0; x<width; x++) {
> -               i = (y*width + x) * 4;
> -               fputc(ptr[i], f);   /* write red */
> -               fputc(ptr[i+1], f); /* write green */
> -               fputc(ptr[i+2], f); /* write blue */
> -            }
> -         }
> -      }
> -      else {
> -         /*ASCII*/
> -         int counter = 0;
> -         fprintf(f,"P3\n");
> -         fprintf(f,"# ascii ppm file created by osdemo.c\n");
> -         fprintf(f,"%i %i\n", width, height);
> -         fprintf(f,"255\n");
> -         for (y=height-1; y>=0; y--) {
> -            for (x=0; x<width; x++) {
> -               i = (y*width + x) * 4;
> -               fprintf(f, " %3d %3d %3d", ptr[i], ptr[i+1], ptr[i+2]);
> -               counter++;
> -               if (counter % 5 == 0)
> -                  fprintf(f, "\n");
> -            }
> -         }
> -      }
> -      fclose(f);
> -   }
> -}
> -
> -int
> -main(int argc, char *argv[])
> -{
> -   int maj, min;
> -   EGLContext ctx;
> -   EGLSurface screen_surf;
> -   EGLConfig configs[10];
> -   EGLScreenMESA screen;
> -   EGLModeMESA mode;
> -   EGLint numConfigs, count;
> -   EGLBoolean b;
> -   const GLubyte *bitmap;
> -   EGLint screenAttribs[32];
> -   EGLint i;
> -
> -   EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
> -   assert(d);
> -
> -   if (!eglInitialize(d, &maj, &min)) {
> -      printf("demo: eglInitialize failed\n");
> -      exit(1);
> -   }
> -
> -   printf("EGL version = %d.%d\n", maj, min);
> -   printf("EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR));
> -   if (!strstr(eglQueryString(d, EGL_EXTENSIONS),
> -               "EGL_MESA_screen_surface")) {
> -      printf("EGL_MESA_screen_surface is not supported\n");
> -      exit(1);
> -   }
> -
> -   eglGetConfigs(d, configs, 10, &numConfigs);
> -   eglGetScreensMESA(d, &screen, 1, &count);
> -   eglGetModesMESA(d, screen, &mode, 1, &count);
> -
> -   eglBindAPI(EGL_OPENGL_API);
> -   ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL);
> -   if (ctx == EGL_NO_CONTEXT) {
> -      printf("failed to create context\n");
> -      return 0;
> -   }
> -
> -   i = 0;
> -   screenAttribs[i++] = EGL_WIDTH;
> -   eglGetModeAttribMESA(d, mode, EGL_WIDTH, &screenAttribs[i++]);
> -   screenAttribs[i++] = EGL_HEIGHT;
> -   eglGetModeAttribMESA(d, mode, EGL_HEIGHT, &screenAttribs[i++]);
> -   screenAttribs[i] = EGL_NONE;
> -
> -   screen_surf = eglCreateScreenSurfaceMESA(d, configs[0], screenAttribs);
> -   if (screen_surf == EGL_NO_SURFACE) {
> -      printf("failed to create screen surface\n");
> -      return 0;
> -   }
> -
> -   eglShowScreenSurfaceMESA(d, screen, screen_surf, mode);
> -
> -   b = eglMakeCurrent(d, screen_surf, screen_surf, ctx);
> -   if (!b) {
> -      printf("make current failed\n");
> -      return 0;
> -   }
> -   glViewport(0, 0, 1024, 768);
> -
> -
> -   Init();
> -   Reshape(1024, 768);
> -
> -   /* some drivers crash when rendering to front buffer */
> -#if 0
> -   glDrawBuffer( GL_FRONT );
> -   glClearColor( 0, 1.0, 0, 1);
> -
> -   glClear( GL_COLOR_BUFFER_BIT );
> -#endif
> -
> -   doubleBuffer = 1;
> -   glDrawBuffer( GL_BACK );
> -
> -   Draw(d, screen_surf);
> -   sleep(2);
> -
> -   /* TODO EGL_KHR_lock_surface */
> -   bitmap = NULL;
> -   if (bitmap)
> -      write_ppm("dump.ppm", bitmap, 1024, 768);
> -
> -   eglDestroySurface(d, screen_surf);
> -   eglDestroyContext(d, ctx);
> -   eglTerminate(d);
> -
> -   return 0;
> -}
> diff --git a/src/egl/opengl/eglinfo.c b/src/egl/opengl/eglinfo.c
> index 8e82e73..1f79fef 100644
> --- a/src/egl/opengl/eglinfo.c
> +++ b/src/egl/opengl/eglinfo.c
> @@ -93,10 +93,6 @@ PrintConfigs(EGLDisplay d)
>           strcat(surfString, "pb,");
>        if (surfaces & EGL_PIXMAP_BIT)
>           strcat(surfString, "pix,");
> -#ifdef EGL_MESA_screen_surface
> -      if (surfaces & EGL_SCREEN_BIT_MESA)
> -         strcat(surfString, "scrn,");
> -#endif
>        if (strlen(surfString) > 0)
>           surfString[strlen(surfString) - 1] = 0;
>
> @@ -117,45 +113,6 @@ PrintConfigs(EGLDisplay d)
>  }
>
>
> -/**
> - * Print table of all available configurations.
> - */
> -static void
> -PrintModes(EGLDisplay d)
> -{
> -#ifdef EGL_MESA_screen_surface
> -   const char *extensions = eglQueryString(d, EGL_EXTENSIONS);
> -   if (strstr(extensions, "EGL_MESA_screen_surface")) {
> -      EGLScreenMESA screens[MAX_SCREENS];
> -      EGLint numScreens = 1, scrn;
> -      EGLModeMESA modes[MAX_MODES];
> -
> -      eglGetScreensMESA(d, screens, MAX_SCREENS, &numScreens);
> -      printf("Number of Screens: %d\n\n", numScreens);
> -
> -      for (scrn = 0; scrn < numScreens; scrn++) {
> -         EGLint numModes, i;
> -
> -         eglGetModesMESA(d, screens[scrn], modes, MAX_MODES, &numModes);
> -
> -         printf("Screen %d Modes:\n", scrn);
> -         printf("  id  width height refresh  name\n");
> -         printf("-----------------------------------------\n");
> -         for (i = 0; i < numModes; i++) {
> -            EGLint id, w, h, r;
> -            const char *str;
> -            eglGetModeAttribMESA(d, modes[i], EGL_MODE_ID_MESA, &id);
> -            eglGetModeAttribMESA(d, modes[i], EGL_WIDTH, &w);
> -            eglGetModeAttribMESA(d, modes[i], EGL_HEIGHT, &h);
> -            eglGetModeAttribMESA(d, modes[i], EGL_REFRESH_RATE_MESA, &r);
> -            str = eglQueryModeStringMESA(d, modes[i]);
> -            printf("0x%02x %5d  %5d   %.3f  %s\n", id, w, h, r / 1000.0, str);
> -         }
> -      }
> -   }
> -#endif
> -}
> -
>  static void
>  PrintExtensions(EGLDisplay d)
>  {
> @@ -219,8 +176,6 @@ main(int argc, char *argv[])
>
>     PrintConfigs(d);
>
> -   PrintModes(d);
> -
>     eglTerminate(d);
>
>     return 0;
> diff --git a/src/egl/opengl/eglscreen.c b/src/egl/opengl/eglscreen.c
> deleted file mode 100644
> index ba91087..0000000
> --- a/src/egl/opengl/eglscreen.c
> +++ /dev/null
> @@ -1,120 +0,0 @@
> -/*
> - * Copyright (C) 1999-2001  Brian Paul   All Rights Reserved.
> - *
> - * Permission is hereby granted, free of charge, to any person obtaining a
> - * copy of this software and associated documentation files (the "Software"),
> - * to deal in the Software without restriction, including without limitation
> - * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> - * and/or sell copies of the Software, and to permit persons to whom the
> - * Software is furnished to do so, subject to the following conditions:
> - *
> - * The above copyright notice and this permission notice shall be included
> - * in all copies or substantial portions of the Software.
> - *
> - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
> - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
> - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
> - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
> - */
> -
> -/*
> - * Stolen from eglgears
> - *
> - * Creates a surface and show that on the first screen
> - */
> -
> -#define EGL_EGLEXT_PROTOTYPES
> -
> -#include <assert.h>
> -#include <math.h>
> -#include <stdlib.h>
> -#include <stdio.h>
> -#include <string.h>
> -#include <unistd.h>
> -#include "gl_wrap.h"
> -#include <EGL/egl.h>
> -#include <EGL/eglext.h>
> -
> -#define MAX_CONFIGS 10
> -#define MAX_MODES 100
> -
> -int
> -main(int argc, char *argv[])
> -{
> -       int maj, min;
> -       EGLSurface screen_surf;
> -       EGLConfig configs[MAX_CONFIGS];
> -       EGLint numConfigs, i;
> -       EGLBoolean b;
> -       EGLDisplay d;
> -       EGLint screenAttribs[10];
> -       EGLModeMESA mode[MAX_MODES];
> -       EGLScreenMESA screen;
> -       EGLint count;
> -       EGLint chosenMode = 0;
> -       EGLint width = 0, height = 0;
> -
> -       d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
> -       assert(d);
> -
> -       if (!eglInitialize(d, &maj, &min)) {
> -               printf("eglscreen: eglInitialize failed\n");
> -               exit(1);
> -       }
> -
> -       printf("eglscreen: EGL version = %d.%d\n", maj, min);
> -       printf("eglscreen: EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR));
> -
> -       /* XXX use ChooseConfig */
> -       eglGetConfigs(d, configs, MAX_CONFIGS, &numConfigs);
> -       eglGetScreensMESA(d, &screen, 1, &count);
> -
> -       if (!eglGetModesMESA(d, screen, mode, MAX_MODES, &count) || count == 0) {
> -               printf("eglscreen: eglGetModesMESA failed!\n");
> -               return 0;
> -       }
> -
> -       /* Print list of modes, and find the one to use */
> -       printf("eglscreen: Found %d modes:\n", count);
> -       for (i = 0; i < count; i++) {
> -               EGLint w, h;
> -               eglGetModeAttribMESA(d, mode[i], EGL_WIDTH, &w);
> -               eglGetModeAttribMESA(d, mode[i], EGL_HEIGHT, &h);
> -               printf("%3d: %d x %d\n", i, w, h);
> -               if (w > width && h > height) {
> -                       width = w;
> -                       height = h;
> -                       chosenMode = i;
> -               }
> -       }
> -       printf("eglscreen: Using screen mode/size %d: %d x %d\n", chosenMode, width, height);
> -
> -       /* build up screenAttribs array */
> -       i = 0;
> -       screenAttribs[i++] = EGL_WIDTH;
> -       screenAttribs[i++] = width;
> -       screenAttribs[i++] = EGL_HEIGHT;
> -       screenAttribs[i++] = height;
> -       screenAttribs[i++] = EGL_NONE;
> -
> -       screen_surf = eglCreateScreenSurfaceMESA(d, configs[0], screenAttribs);
> -       if (screen_surf == EGL_NO_SURFACE) {
> -               printf("eglscreen: Failed to create screen surface\n");
> -               return 0;
> -       }
> -
> -       b = eglShowScreenSurfaceMESA(d, screen, screen_surf, mode[chosenMode]);
> -       if (!b) {
> -               printf("eglscreen: Show surface failed\n");
> -               return 0;
> -       }
> -
> -       usleep(5000000);
> -
> -       eglDestroySurface(d, screen_surf);
> -       eglTerminate(d);
> -
> -       return 0;
> -}
> diff --git a/src/egl/opengles1/.gitignore b/src/egl/opengles1/.gitignore
> index 646b639..9269f90 100644
> --- a/src/egl/opengles1/.gitignore
> +++ b/src/egl/opengles1/.gitignore
> @@ -1,17 +1,13 @@
>  bindtex
>  clear
> -drawtex_screen
>  drawtex_x11
>  eglfbdev
>  es1_info
> -gears_screen
>  gears_x11
>  msaa
>  pbuffer
>  render_tex
>  texture_from_pixmap
> -torus_screen
>  torus_x11
> -tri_screen
>  tri_x11
>  two_win
> diff --git a/src/egl/opengles1/CMakeLists.txt b/src/egl/opengles1/CMakeLists.txt
> index 9f9a758..980656e 100644
> --- a/src/egl/opengles1/CMakeLists.txt
> +++ b/src/egl/opengles1/CMakeLists.txt
> @@ -37,10 +37,6 @@ set (targets
>  )
>
>  foreach (target ${targets})
> -       add_executable (${target}_screen ${target}.c)
> -       target_link_libraries (${target}_screen eglut_screen ${GLESV1_LIBRARIES})
> -       install (TARGETS ${target}_screen DESTINATION ${subdir})
> -
>         if (X11_FOUND)
>                 add_executable (${target}_x11 ${target}.c)
>                 target_link_libraries (${target}_x11 eglut_x11 ${GLESV1_LIBRARIES})
> diff --git a/src/egl/opengles1/Makefile.am b/src/egl/opengles1/Makefile.am
> index 7a9828d..fa397c2 100644
> --- a/src/egl/opengles1/Makefile.am
> +++ b/src/egl/opengles1/Makefile.am
> @@ -41,19 +41,15 @@ if HAVE_GLESV1
>  noinst_PROGRAMS = \
>         bindtex \
>         clear \
> -       drawtex_screen \
>         drawtex_x11 \
>         eglfbdev \
>         es1_info \
> -       gears_screen \
>         gears_x11 \
>         msaa \
>         pbuffer\
>         render_tex \
>         texture_from_pixmap \
> -       torus_screen \
>         torus_x11 \
> -       tri_screen \
>         tri_x11 \
>         two_win
>  endif
> @@ -71,21 +67,11 @@ two_win_LDADD = $(X11_LIBS)
>  clear_LDADD = ../eglut/libeglut_x11.la $(EGL_LIBS) $(X11_LIBS)
>  clear_LDFLAGS =
>
> -drawtex_screen_SOURCES = drawtex.c
> -gears_screen_SOURCES = gears.c
> -torus_screen_SOURCES = torus.c
> -tri_screen_SOURCES = tri.c
> -
>  drawtex_x11_SOURCES = drawtex.c
>  gears_x11_SOURCES = gears.c
>  torus_x11_SOURCES = torus.c
>  tri_x11_SOURCES = tri.c
>
> -drawtex_screen_LDADD = ../eglut/libeglut_screen.la
> -gears_screen_LDADD = ../eglut/libeglut_screen.la
> -torus_screen_LDADD = ../eglut/libeglut_screen.la
> -tri_screen_LDADD = ../eglut/libeglut_screen.la
> -
>  drawtex_x11_LDADD = ../eglut/libeglut_x11.la
>  gears_x11_LDADD = ../eglut/libeglut_x11.la
>  torus_x11_LDADD = ../eglut/libeglut_x11.la
> diff --git a/src/egl/opengles2/.gitignore b/src/egl/opengles2/.gitignore
> index fb4c32b..4d0268d 100644
> --- a/src/egl/opengles2/.gitignore
> +++ b/src/egl/opengles2/.gitignore
> @@ -1,5 +1,4 @@
>  es2gears
> -es2gears_screen
>  es2gears_x11
>  es2_info
>  es2tri
> diff --git a/src/egl/opengles2/CMakeLists.txt b/src/egl/opengles2/CMakeLists.txt
> index 227ba66..f9a25fc 100644
> --- a/src/egl/opengles2/CMakeLists.txt
> +++ b/src/egl/opengles2/CMakeLists.txt
> @@ -28,10 +28,6 @@ set (targets
>  )
>
>  foreach (target ${targets})
> -       add_executable (${target}_screen ${target}.c)
> -       target_link_libraries (${target}_screen eglut_screen ${GLESV2_LIBRARIES})
> -       install (TARGETS ${target}_screen DESTINATION ${subdir})
> -
>         if (X11_FOUND)
>                 add_executable (${target}_x11 ${target}.c)
>                 target_link_libraries (${target}_x11 eglut_x11 ${GLESV2_LIBRARIES})
> diff --git a/src/egl/opengles2/Makefile.am b/src/egl/opengles2/Makefile.am
> index 36d6059..b80ba50 100644
> --- a/src/egl/opengles2/Makefile.am
> +++ b/src/egl/opengles2/Makefile.am
> @@ -35,8 +35,7 @@ AM_LDFLAGS = \
>
>  if HAVE_EGL
>  if HAVE_GLESV2
> -bin_PROGRAMS = \
> -       es2gears_screen
> +bin_PROGRAMS =
>  if HAVE_X11
>  bin_PROGRAMS += \
>         es2_info \
> @@ -52,12 +51,8 @@ endif
>  es2_info_LDADD = $(X11_LIBS)
>  es2tri_LDADD = $(X11_LIBS)
>
> -es2gears_screen_SOURCES = es2gears.c
> -
>  es2gears_x11_SOURCES = es2gears.c
>
> -es2gears_screen_LDADD = ../eglut/libeglut_screen.la
> -
>  es2gears_x11_LDADD = ../eglut/libeglut_x11.la
>
>  es2gears_wayland_SOURCES = es2gears.c
> diff --git a/src/egl/openvg/.gitignore b/src/egl/openvg/.gitignore
> index 9bd368a..fc71b88 100644
> --- a/src/egl/openvg/.gitignore
> +++ b/src/egl/openvg/.gitignore
> @@ -1,7 +1,5 @@
>  lion_x11
> -lion_screen
>  sp_x11
> -sp_screen
>  text
>  trivial/arc
>  trivial/blend
> diff --git a/src/egl/openvg/CMakeLists.txt b/src/egl/openvg/CMakeLists.txt
> index adcc755..584ac7d 100644
> --- a/src/egl/openvg/CMakeLists.txt
> +++ b/src/egl/openvg/CMakeLists.txt
> @@ -30,10 +30,6 @@ foreach (target ${targets})
>                 set (sources ${sources} lion-render.c)
>         endif ()
>
> -       add_executable (${target}_screen ${sources})
> -       target_link_libraries (${target}_screen eglut_screen ${VG_LIBRARIES})
> -       install (TARGETS ${target}_screen DESTINATION ${subdir})
> -
>         if (X11_FOUND)
>                 add_executable (${target}_x11 ${sources})
>                 target_link_libraries (${target}_x11 eglut_x11 ${VG_LIBRARIES})
> diff --git a/src/egl/openvg/Makefile.am b/src/egl/openvg/Makefile.am
> index 7318a43..b0f1212 100644
> --- a/src/egl/openvg/Makefile.am
> +++ b/src/egl/openvg/Makefile.am
> @@ -50,21 +50,13 @@ endif
>  if HAVE_EGL
>  if HAVE_VG
>  noinst_PROGRAMS = \
> -       lion_screen \
> -       sp_screen \
>         $(EGL_X11_DEMOS)
>  endif
>  endif
>
> -lion_screen_SOURCES = lion.c lion-render.c lion-render.h
> -sp_screen_SOURCES = sp.c
> -
>  lion_x11_SOURCES = lion.c lion-render.c lion-render.h
>  sp_x11_SOURCES = sp.c
>
> -lion_screen_LDADD = ../eglut/libeglut_screen.la
> -sp_screen_LDADD = ../eglut/libeglut_screen.la
> -
>  lion_x11_LDADD = ../eglut/libeglut_x11.la
>  sp_x11_LDADD = ../eglut/libeglut_x11.la
>
> --
> 2.4.6
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list