[cairo-commit] glitzinfo Makefile.egl, NONE, 1.1 glitzinfo.c, 1.10, 1.11

Jon Smirl commit at pdx.freedesktop.org
Thu May 19 10:47:34 PDT 2005


Committed by: jonsmirl

Update of /cvs/cairo/glitzinfo
In directory gabe:/tmp/cvs-serv6578

Modified Files:
	glitzinfo.c 
Added Files:
	Makefile.egl 
Log Message:
egl implementation of glitzinfo


--- NEW FILE: Makefile.egl ---
CFLAGS=-g -Wall `pkg-config --cflags glitz-egl` -DGLITZ_EGL_BACKEND
LDFLAGS=`pkg-config --libs glitz-egl` $(EGL_LIB_PATH) -lEGL

PROGS=glitzinfo

all: $(PROGS)

clean:
	rm -f $(PROGS) *.o


Index: glitzinfo.c
===================================================================
RCS file: /cvs/cairo/glitzinfo/glitzinfo.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- glitzinfo.c	25 Jan 2005 19:54:11 -0000	1.10
+++ glitzinfo.c	19 May 2005 17:47:32 -0000	1.11
@@ -30,6 +30,12 @@
 #include <glitz-glx.h>
 #endif
 
+#ifdef GLITZ_EGL_BACKEND
+#include <stdlib.h>
+#include <assert.h>
+#include <glitz-egl.h>
+#endif
+
 #ifdef GLITZ_AGL_BACKEND
 #include <glitz-agl.h>
 #endif
@@ -136,6 +142,58 @@
   printf ("name of display: %s\n\n", DisplayString (display));
 #endif
   
+#ifdef GLITZ_EGL_BACKEND
+
+  EGLDisplay display;
+  EGLScreenMESA screen;
+  EGLModeMESA mode;
+  EGLSurface screen_surf;
+  int maj, min, count;
+  const EGLint screenAttribs[] = {
+    EGL_WIDTH, 1024,
+    EGL_HEIGHT, 768,
+    EGL_NONE
+  };
+  
+  display = eglGetDisplay("!fb_dri");
+  assert(display);
+  
+  if (!eglInitialize(display, &maj, &min)) {
+    printf("demo: eglInitialize failed\n");
+    exit(1);
+  }
+  
+  eglGetScreensMESA(display, &screen, 1, &count);
+  eglGetModesMESA(display, screen, &mode, 1, &count);
+
+  glitz_egl_init (NULL);
+
+  templ.types.window = 1;
+  mask = GLITZ_FORMAT_WINDOW_MASK;
+  
+  dformats = glitz_egl_find_config (display, screen, mask, &templ, 0);
+  if (!dformats) {
+    fprintf (stderr, "Error: couldn't find drawable format\n");
+    return 1;
+  }
+
+  screen_surf = eglCreateScreenSurfaceMESA(display, dformats->id, screenAttribs);
+  if (screen_surf == EGL_NO_SURFACE) {
+    printf("failed to create screen surface\n");
+    return 0;
+  }
+   
+  eglShowSurfaceMESA(display, screen, screen_surf, mode);
+  
+  drawable = glitz_egl_create_surface (display, screen,
+                                                   dformats, screen_surf, 1, 1);
+  if (!drawable) {
+    fprintf (stderr, "Error: couldn't create glitz drawable for window\n");
+    return 1;
+  }
+ 
+#endif
+  
 #ifdef GLITZ_AGL_BACKEND
   WindowRef window;
   Rect bounds;
@@ -223,6 +281,15 @@
   XCloseDisplay (display);
 #endif
 
+#ifdef GLITZ_EGL_BACKEND
+  glitz_egl_fini ();
+
+  eglShowSurfaceMESA(display, screen, EGL_NO_SURFACE, EGL_NO_MODE_MESA);
+  eglDestroySurface(display, screen_surf);
+  eglTerminate(display);
+  
+#endif
+
 #ifdef GLITZ_AGL_BACKEND
   glitz_agl_fini ();
 #endif




More information about the cairo-commit mailing list