summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2016-04-19 16:40:03 -0400
committerAdam Jackson <ajax@redhat.com>2016-04-20 16:47:38 -0400
commit7a0f0310a9b5129465a2e8ab6f2c4ea1a8e98f40 (patch)
treea08348f5f13b247c28a75c3b909a881f892df145
parentf091f8a2c98a87f9681e802c72ba692b927eb9e7 (diff)
downloadmesa-demos-7a0f0310a9b5129465a2e8ab6f2c4ea1a8e98f40.zip
mesa-demos-7a0f0310a9b5129465a2e8ab6f2c4ea1a8e98f40.tar.xz
eglinfo: Add EXT_platform_* awareness
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
-rw-r--r--src/egl/opengl/eglinfo.c41
1 files changed, 35 insertions, 6 deletions
diff --git a/src/egl/opengl/eglinfo.c b/src/egl/opengl/eglinfo.c
index 875e407..75d9fe5 100644
--- a/src/egl/opengl/eglinfo.c
+++ b/src/egl/opengl/eglinfo.c
@@ -115,7 +115,7 @@ PrintConfigs(EGLDisplay d)
}
-static void
+static const char *
PrintExtensions(EGLDisplay d)
{
const char *extensions, *p, *end, *next;
@@ -126,7 +126,7 @@ PrintExtensions(EGLDisplay d)
extensions = eglQueryString(d, EGL_EXTENSIONS);
if (!extensions)
- return;
+ return NULL;
column = 0;
end = extensions + strlen(extensions);
@@ -153,6 +153,8 @@ PrintExtensions(EGLDisplay d)
if (column > 0)
printf("\n");
+
+ return extensions;
}
static int
@@ -162,7 +164,7 @@ doOneDisplay(EGLDisplay d, const char *name)
printf("%s:\n", name);
if (!eglInitialize(d, &maj, &min)) {
- printf("eglinfo: eglInitialize failed\n");
+ printf("eglinfo: eglInitialize failed\n\n");
return 1;
}
@@ -183,12 +185,39 @@ doOneDisplay(EGLDisplay d, const char *name)
int
main(int argc, char *argv[])
{
- int ret;
+ int ret = 0;
+ const char *clientext;
- PrintExtensions(EGL_NO_DISPLAY);
+ clientext = PrintExtensions(EGL_NO_DISPLAY);
printf("\n");
- ret = doOneDisplay(eglGetDisplay(EGL_DEFAULT_DISPLAY), "Default display");
+ if (strstr(clientext, "EGL_EXT_platform_base")) {
+ PFNEGLGETPLATFORMDISPLAYEXTPROC getPlatformDisplay =
+ (PFNEGLGETPLATFORMDISPLAYEXTPROC)
+ eglGetProcAddress("eglGetPlatformDisplayEXT");
+ if (strstr(clientext, "EGL_KHR_platform_android"))
+ ret += doOneDisplay(getPlatformDisplay(EGL_PLATFORM_ANDROID_KHR,
+ EGL_DEFAULT_DISPLAY,
+ NULL), "Android platform");
+ if (strstr(clientext, "EGL_MESA_platform_gbm") ||
+ strstr(clientext, "EGL_KHR_platform_gbm"))
+ ret += doOneDisplay(getPlatformDisplay(EGL_PLATFORM_GBM_MESA,
+ EGL_DEFAULT_DISPLAY,
+ NULL), "GBM platform");
+ if (strstr(clientext, "EGL_EXT_platform_wayland") ||
+ strstr(clientext, "EGL_KHR_platform_wayland"))
+ ret += doOneDisplay(getPlatformDisplay(EGL_PLATFORM_WAYLAND_EXT,
+ EGL_DEFAULT_DISPLAY,
+ NULL), "Wayland platform");
+ if (strstr(clientext, "EGL_EXT_platform_x11") ||
+ strstr(clientext, "EGL_KHR_platform_x11"))
+ ret += doOneDisplay(getPlatformDisplay(EGL_PLATFORM_X11_EXT,
+ EGL_DEFAULT_DISPLAY,
+ NULL), "X11 platform");
+ }
+ else {
+ ret = doOneDisplay(eglGetDisplay(EGL_DEFAULT_DISPLAY), "Default display");
+ }
return ret;
}