summaryrefslogtreecommitdiff
path: root/progs/egl
diff options
context:
space:
mode:
Diffstat (limited to 'progs/egl')
-rw-r--r--progs/egl/demo1.c24
-rw-r--r--progs/egl/demo2.c9
-rw-r--r--progs/egl/demo3.c28
-rw-r--r--progs/egl/eglgears.c2
-rw-r--r--progs/egl/eglinfo.c3
-rw-r--r--progs/egl/eglscreen.c2
-rw-r--r--progs/egl/egltri.c6
-rw-r--r--progs/egl/peglgears.c2
8 files changed, 38 insertions, 38 deletions
diff --git a/progs/egl/demo1.c b/progs/egl/demo1.c
index 49b6624538..34a516e72f 100644
--- a/progs/egl/demo1.c
+++ b/progs/egl/demo1.c
@@ -34,14 +34,9 @@ TestScreens(EGLDisplay dpy)
* Print table of all available configurations.
*/
static void
-PrintConfigs(EGLDisplay d)
+PrintConfigs(EGLDisplay d, EGLConfig *configs, EGLint numConfigs)
{
- EGLConfig *configs;
- EGLint numConfigs, i;
-
- eglGetConfigs(d, NULL, 0, &numConfigs);
- configs = malloc(sizeof(*configs) *numConfigs);
- eglGetConfigs(d, configs, numConfigs, &numConfigs);
+ EGLint i;
printf("Configurations:\n");
printf(" bf lv d st colorbuffer dp st supported \n");
@@ -83,7 +78,6 @@ PrintConfigs(EGLDisplay d)
red, green, blue, alpha,
depth, stencil, surfString);
}
- free(configs);
}
@@ -94,7 +88,8 @@ main(int argc, char *argv[])
int maj, min;
EGLContext ctx;
EGLSurface pbuffer;
- EGLConfig configs[10];
+ EGLConfig *configs;
+ EGLint numConfigs;
EGLBoolean b;
const EGLint pbufAttribs[] = {
EGL_WIDTH, 500,
@@ -102,10 +97,7 @@ main(int argc, char *argv[])
EGL_NONE
};
- /*
EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- */
- EGLDisplay d = eglGetDisplay((EGLNativeDisplayType) "!EGL_i915");
assert(d);
if (!eglInitialize(d, &maj, &min)) {
@@ -116,7 +108,11 @@ main(int argc, char *argv[])
printf("EGL version = %d.%d\n", maj, min);
printf("EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR));
- PrintConfigs(d);
+ eglGetConfigs(d, NULL, 0, &numConfigs);
+ configs = malloc(sizeof(*configs) *numConfigs);
+ eglGetConfigs(d, configs, numConfigs, &numConfigs);
+
+ PrintConfigs(d, configs, numConfigs);
ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL);
if (ctx == EGL_NO_CONTEXT) {
@@ -130,6 +126,8 @@ main(int argc, char *argv[])
return 0;
}
+ free(configs);
+
b = eglMakeCurrent(d, pbuffer, pbuffer, ctx);
if (!b) {
printf("make current failed\n");
diff --git a/progs/egl/demo2.c b/progs/egl/demo2.c
index d7283e13bd..3994656721 100644
--- a/progs/egl/demo2.c
+++ b/progs/egl/demo2.c
@@ -7,6 +7,7 @@
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
#include <EGL/egl.h>
@@ -119,10 +120,7 @@ main(int argc, char *argv[])
EGLScreenMESA screen;
EGLint count;
- /*
EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- */
- EGLDisplay d = eglGetDisplay((EGLNativeDisplayType) "!EGL_i915");
assert(d);
if (!eglInitialize(d, &maj, &min)) {
@@ -132,6 +130,11 @@ main(int argc, char *argv[])
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);
diff --git a/progs/egl/demo3.c b/progs/egl/demo3.c
index daab62d173..0665fd0516 100644
--- a/progs/egl/demo3.c
+++ b/progs/egl/demo3.c
@@ -11,6 +11,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
@@ -551,15 +552,6 @@ write_ppm(const char *filename, const GLubyte *buffer, int width, int height)
}
}
-#include "../../src/egl/main/egldisplay.h"
-
-typedef struct fb_display
-{
- _EGLDisplay Base; /* base class/object */
- void *pFB;
-} fbDisplay;
-
-
int
main(int argc, char *argv[])
{
@@ -571,16 +563,14 @@ main(int argc, char *argv[])
EGLModeMESA mode;
EGLint numConfigs, count;
EGLBoolean b;
+ const GLubyte *bitmap;
const EGLint screenAttribs[] = {
EGL_WIDTH, 1024,
EGL_HEIGHT, 768,
EGL_NONE
};
- /*
EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- */
- EGLDisplay d = eglGetDisplay("!EGL_i915");
assert(d);
if (!eglInitialize(d, &maj, &min)) {
@@ -590,6 +580,11 @@ main(int argc, char *argv[])
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);
@@ -620,17 +615,24 @@ main(int argc, char *argv[])
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);
- write_ppm("dump.ppm", ((struct fb_display *)_eglLookupDisplay(d))->pFB, 1024, 768);
+ /* TODO EGL_KHR_lock_surface */
+ bitmap = NULL;
+ if (bitmap)
+ write_ppm("dump.ppm", bitmap, 1024, 768);
eglDestroySurface(d, screen_surf);
eglDestroyContext(d, ctx);
diff --git a/progs/egl/eglgears.c b/progs/egl/eglgears.c
index 31346d9523..0eee9ecf4d 100644
--- a/progs/egl/eglgears.c
+++ b/progs/egl/eglgears.c
@@ -388,7 +388,7 @@ main(int argc, char *argv[])
}
/* DBR : Create EGL context/surface etc */
- d = eglGetDisplay((EGLNativeDisplayType)"!EGL_i915");
+ d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
assert(d);
if (!eglInitialize(d, &maj, &min)) {
diff --git a/progs/egl/eglinfo.c b/progs/egl/eglinfo.c
index feae954b75..4486916e95 100644
--- a/progs/egl/eglinfo.c
+++ b/progs/egl/eglinfo.c
@@ -147,8 +147,7 @@ int
main(int argc, char *argv[])
{
int maj, min;
- //EGLDisplay d = eglGetDisplay((EGLNativeDisplayType)"!EGL_i915");
- EGLDisplay d = eglGetDisplay((EGLNativeDisplayType)"!EGL_i915");
+ EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
if (!eglInitialize(d, &maj, &min)) {
printf("eglinfo: eglInitialize failed\n");
diff --git a/progs/egl/eglscreen.c b/progs/egl/eglscreen.c
index c0b5a210a4..47b3ce3366 100644
--- a/progs/egl/eglscreen.c
+++ b/progs/egl/eglscreen.c
@@ -55,7 +55,7 @@ main(int argc, char *argv[])
EGLint count, chosenMode;
EGLint width = 0, height = 0;
- d = eglGetDisplay((EGLNativeDisplayType)"!EGL_i915");
+ d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
assert(d);
if (!eglInitialize(d, &maj, &min)) {
diff --git a/progs/egl/egltri.c b/progs/egl/egltri.c
index 44096d94a2..79f6702007 100644
--- a/progs/egl/egltri.c
+++ b/progs/egl/egltri.c
@@ -130,9 +130,7 @@ static void run(EGLDisplay dpy, EGLSurface surf, int ttr)
while (ct - st < ttr)
{
- double tt = current_time();
- double dt = tt - ct;
- ct = tt;
+ ct = current_time();
draw();
@@ -174,7 +172,7 @@ int main(int argc, char *argv[])
}
/* DBR : Create EGL context/surface etc */
- d = eglGetDisplay((EGLNativeDisplayType)"!EGL_i915");
+ d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
assert(d);
if (!eglInitialize(d, &maj, &min)) {
diff --git a/progs/egl/peglgears.c b/progs/egl/peglgears.c
index bac16453c1..1ddb691677 100644
--- a/progs/egl/peglgears.c
+++ b/progs/egl/peglgears.c
@@ -385,7 +385,7 @@ main(int argc, char *argv[])
}
/* DBR : Create EGL context/surface etc */
- d = eglGetDisplay((EGLNativeDisplayType)"!EGL_i915");
+ d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
assert(d);
if (!eglInitialize(d, &major, &minor)) {