[Mesa-dev] [PATCH demos 3/4] eglinfo: Factor out a "probe one display" function

Adam Jackson ajax at redhat.com
Wed Apr 20 20:10:03 UTC 2016


Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 src/egl/opengl/eglinfo.c | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/src/egl/opengl/eglinfo.c b/src/egl/opengl/eglinfo.c
index b044eaa..875e407 100644
--- a/src/egl/opengl/eglinfo.c
+++ b/src/egl/opengl/eglinfo.c
@@ -155,19 +155,15 @@ PrintExtensions(EGLDisplay d)
       printf("\n");
 }
 
-int
-main(int argc, char *argv[])
+static int
+doOneDisplay(EGLDisplay d, const char *name)
 {
    int maj, min;
-   EGLDisplay d;
-
-   PrintExtensions(EGL_NO_DISPLAY);
-
-   d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
 
+   printf("%s:\n", name);
    if (!eglInitialize(d, &maj, &min)) {
       printf("eglinfo: eglInitialize failed\n");
-      exit(1);
+      return 1;
    }
 
    printf("EGL API version: %d.%d\n", maj, min);
@@ -180,8 +176,19 @@ main(int argc, char *argv[])
    PrintExtensions(d);
 
    PrintConfigs(d);
-
-   eglTerminate(d);
-
+   printf("\n");
    return 0;
 }
+
+int
+main(int argc, char *argv[])
+{
+   int ret;
+
+   PrintExtensions(EGL_NO_DISPLAY);
+   printf("\n");
+
+   ret = doOneDisplay(eglGetDisplay(EGL_DEFAULT_DISPLAY), "Default display");
+
+   return ret;
+}
-- 
2.7.3



More information about the mesa-dev mailing list