Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:X0F:HSF
Mesa-demo
mesa-demos_PR5.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File mesa-demos_PR5.patch of Package Mesa-demo
From f30cb428a3b7bcc3baa3388fc641447db7939a64 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan <ofourdan@redhat.com> Date: Wed, 18 Sep 2019 09:36:44 +0200 Subject: [PATCH 1/4] configure.ac: Add check for epoxy Add a check for epoxy support (optional) so that we can use it instead of libGL in eglinfo to create GLES contexts. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> --- configure.ac | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure.ac b/configure.ac index 0b5e9a764..f1b804278 100644 --- a/configure.ac +++ b/configure.ac @@ -119,6 +119,7 @@ AC_ARG_ENABLE([egl], [egl_enabled=auto]) if test "x$egl_enabled" != "xno"; then PKG_CHECK_MODULES(EGL, [egl], [egl_enabled=yes], [egl_enabled=no]) + PKG_CHECK_MODULES(EPOXY, [epoxy >= 1.4], [AC_DEFINE(HAVE_EPOXY) epoxy_enabled=yes], [epoxy_enabled=no]) fi AC_ARG_ENABLE([gles1], [AS_HELP_STRING([--enable-gles1], @@ -316,6 +317,7 @@ AM_CONDITIONAL(HAVE_DRM, test "x$drm_enabled" = "xyes") AM_CONDITIONAL(HAVE_MESA_SOURCE, test "x$mesa_source_enabled" = "xyes") AM_CONDITIONAL(HAVE_WAYLAND, test "x$wayland_enabled" = "xyes") AM_CONDITIONAL(HAVE_RBUG, test "x$rbug_enabled" = "xyes") +AM_CONDITIONAL(HAVE_EPOXY, test "x$epoxy_enabled" = "xyes") AC_OUTPUT([ Makefile -- GitLab From 8c316462d21a3825fad029b7be84244c1148efa7 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan <ofourdan@redhat.com> Date: Wed, 18 Sep 2019 16:10:04 +0200 Subject: [PATCH 2/4] eglinfo: Use epoxy if available If epoxy is available, use it instead of EGL directly. The benefit if epoxy is that it will dlopen the EGL libs for us automatically, which will come handy when we'll need to create contexts. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> --- src/egl/opengl/Makefile.am | 2 ++ src/egl/opengl/eglinfo.c | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/egl/opengl/Makefile.am b/src/egl/opengl/Makefile.am index 6d184ff65..2a35147d9 100644 --- a/src/egl/opengl/Makefile.am +++ b/src/egl/opengl/Makefile.am @@ -58,6 +58,8 @@ endif if HAVE_EGL bin_PROGRAMS = \ eglinfo +eglinfo_CFLAGS = $(AM_CFLAGS) $(EPOXY_CFLAGS) +eglinfo_LDADD = $(AM_LDFLAGS) $(EPOXY_LIBS) noinst_PROGRAMS = \ peglgears \ $(EGL_DRM_DEMOS) \ diff --git a/src/egl/opengl/eglinfo.c b/src/egl/opengl/eglinfo.c index a9991dad9..1d61f08a0 100644 --- a/src/egl/opengl/eglinfo.c +++ b/src/egl/opengl/eglinfo.c @@ -26,8 +26,13 @@ #define EGL_EGLEXT_PROTOTYPES +#ifdef HAVE_EPOXY +#include <epoxy/egl.h> +#else #include <EGL/egl.h> #include <EGL/eglext.h> +#endif + #include <assert.h> #include <stdio.h> #include <stdlib.h> @@ -217,6 +222,13 @@ main(int argc, char *argv[]) int ret = 0; const char *clientext; +#ifdef HAVE_EPOXY + if (!epoxy_has_egl()) { + printf ("Missing EGL support in epoxy\n"); + return -1; + } +#endif + clientext = PrintExtensions(EGL_NO_DISPLAY); printf("\n"); -- GitLab From 6efdb141de53e62d0f1b8e4ccdf8ca41ef89f587 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan <ofourdan@redhat.com> Date: Wed, 18 Sep 2019 16:23:29 +0200 Subject: [PATCH 3/4] eglinfo: Report the renderer string for each API For each supported rendering API, bind to the API, create a context and report the GL renderer string. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> --- src/egl/opengl/eglinfo.c | 64 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/src/egl/opengl/eglinfo.c b/src/egl/opengl/eglinfo.c index 1d61f08a0..4bb179229 100644 --- a/src/egl/opengl/eglinfo.c +++ b/src/egl/opengl/eglinfo.c @@ -190,6 +190,68 @@ PrintExtensions(EGLDisplay d) return extensions; } +#ifdef EGL_VERSION_1_2 +static void +PrintRenderer(EGLDisplay d, const char* api_name) +{ + EGLContext context; + struct { + const char *api_name; + EGLenum api_enum; + } egl_api_list[] = { +#ifdef EGL_VERSION_1_4 + { "OpenGL", EGL_OPENGL_API }, +#endif + { "OpenGL_ES", EGL_OPENGL_ES_API }, + { "OpenVG", EGL_OPENVG_API }, + { NULL, EGL_NONE }, + }; + + int i; + + for (i = 0; egl_api_list[i].api_name; i++) { + if (!strcmp(egl_api_list[i].api_name, api_name)) { + if (!eglBindAPI(egl_api_list[i].api_enum)) + return; + break; + } + } + + if (egl_api_list[i].api_enum == EGL_NONE) + return; + + context = eglCreateContext(d, NULL, EGL_NO_CONTEXT, NULL); + if (context == EGL_NO_CONTEXT) + return; + + if (!eglMakeCurrent(d, EGL_NO_SURFACE, EGL_NO_SURFACE, context)) { + eglDestroyContext (d, context); + return; + } + + printf("%s renderer: %s\n", api_name, glGetString(GL_RENDERER)); + + eglMakeCurrent(d, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + eglDestroyContext (d, context); +} + +static void +printClientAPIs(EGLDisplay d) +{ + const char *egl_clients_apis; + char *api_name; + + egl_clients_apis = eglQueryString(d, EGL_CLIENT_APIS); + printf("EGL client APIs: %s\n", egl_clients_apis); + + api_name = strtok((char *)egl_clients_apis, " "); + while (api_name) { + PrintRenderer(d, api_name); + api_name = strtok(NULL, " "); + } +} +#endif + static int doOneDisplay(EGLDisplay d, const char *name) { @@ -205,7 +267,7 @@ doOneDisplay(EGLDisplay d, const char *name) printf("EGL vendor string: %s\n", eglQueryString(d, EGL_VENDOR)); printf("EGL version string: %s\n", eglQueryString(d, EGL_VERSION)); #ifdef EGL_VERSION_1_2 - printf("EGL client APIs: %s\n", eglQueryString(d, EGL_CLIENT_APIS)); + printClientAPIs(d); #endif PrintExtensions(d); -- GitLab From edd95601c822b8851a7b1a67a6e9473ce303b007 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan <ofourdan@redhat.com> Date: Thu, 19 Sep 2019 13:30:03 +0200 Subject: [PATCH 4/4] eglinfo: Add command line options Add command line options to select the API and platform to query. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> --- src/egl/opengl/eglinfo.c | 207 ++++++++++++++++++++++++++++++++------- 1 file changed, 170 insertions(+), 37 deletions(-) diff --git a/src/egl/opengl/eglinfo.c b/src/egl/opengl/eglinfo.c index 4bb179229..17022b483 100644 --- a/src/egl/opengl/eglinfo.c +++ b/src/egl/opengl/eglinfo.c @@ -46,6 +46,131 @@ * something not X, they probably don't make sense. */ static const char *vnames[] = { "SG", "GS", "SC", "PC", "TC", "DC" }; +typedef enum +{ + All, + Nodisplay, + Android, + GBM, + Wayland, + X11, + Device, + Surfaceless, +} Platform; + +struct options +{ + EGLenum api_enum; + Platform platform_enum; + GLboolean client_ext_only; +}; + +#ifdef EGL_VERSION_1_2 +static struct { + const char *api; + const char *api_name; + EGLenum api_enum; +} apis[] = { +#ifdef EGL_VERSION_1_4 + { "glcore", "OpenGL", EGL_OPENGL_API }, +#endif + { "gles", "OpenGL_ES", EGL_OPENGL_ES_API }, + { "vg", "OpenVG", EGL_OPENVG_API }, + /* default */ + { NULL, NULL, EGL_NONE }, +}; +#endif + +static struct { + const char *platform; + Platform platform_enum; +} platforms[] = { + { "android", Android }, + { "gbm", GBM }, + { "wayland", Wayland }, + { "x11", X11 }, + { "surfaceless", Surfaceless }, + { "device", Device }, + { "none", Nodisplay }, + /* default */ + { NULL, All }, +}; + +static void +usage(void) +{ + int i; + + printf("Usage: elginfo [-h] [-c]"); +#ifdef EGL_VERSION_1_2 + printf(" [-a <api>]"); +#endif + printf(" [-p <platform>]\n"); + printf("\t -h: This message\n"); +#ifdef EGL_VERSION_1_2 + printf("\t -a <api>: Prints renderer for an API if supported.\n"); + printf("\t ("); + for (i = 0; apis[i].api; i++) + printf("%s\"%s\"", (i > 0) ? ", " : "", apis[i].api); + printf(")\n"); +#endif + printf("\t -p <platform>: Prints information for a platform if supported.\n"); + printf("\t ("); + for (i = 0; platforms[i].platform; i++) + printf("%s\"%s\"", (i > 0) ? ", " : "", platforms[i].platform); + printf(")\n"); + + exit (0); +} + +static void +parse_args(int argc, char *argv[], struct options *options) +{ + int i, j; + + options->api_enum = EGL_NONE; + options->platform_enum = All; + + for (i = 1; i < argc; i++) { +#ifdef EGL_VERSION_1_2 + if (strcmp(argv[i], "-a") == 0 && i + 1 < argc) { + i++; + for (j = 0; apis[j].api; j++) { + if (strcmp(apis[j].api, argv[i]) == 0) { + options->api_enum = apis[j].api_enum; + break; + } + } + if (apis[j].api == NULL) { + printf("Unknown API `%s'\n", argv[i]); + usage(); + } + } + else +#endif + if (strcmp(argv[i], "-p") == 0 && i + 1 < argc) { + i++; + for (j = 0; platforms[j].platform; j++) { + if (strcmp(platforms[j].platform, argv[i]) == 0) { + options->platform_enum = platforms[j].platform_enum; + break; + } + } + if (platforms[j].platform == NULL) { + printf("Unknown platform `%s'\n", argv[i]); + usage(); + } + } + else if (strcmp(argv[i], "-h") == 0) { + usage(); + } + else { + printf("Unknown option `%s'\n", argv[i]); + usage(); + } + } +} + /** * Print table of all available configurations. */ @@ -192,32 +317,23 @@ PrintExtensions(EGLDisplay d) #ifdef EGL_VERSION_1_2 static void -PrintRenderer(EGLDisplay d, const char* api_name) +PrintRenderer(EGLDisplay d, const char* api_name, struct options *opts) { EGLContext context; - struct { - const char *api_name; - EGLenum api_enum; - } egl_api_list[] = { -#ifdef EGL_VERSION_1_4 - { "OpenGL", EGL_OPENGL_API }, -#endif - { "OpenGL_ES", EGL_OPENGL_ES_API }, - { "OpenVG", EGL_OPENVG_API }, - { NULL, EGL_NONE }, - }; - int i; - for (i = 0; egl_api_list[i].api_name; i++) { - if (!strcmp(egl_api_list[i].api_name, api_name)) { - if (!eglBindAPI(egl_api_list[i].api_enum)) + for (i = 0; apis[i].api_name; i++) { + if (!strcmp(apis[i].api_name, api_name)) { + if (!eglBindAPI(apis[i].api_enum)) return; break; } } - if (egl_api_list[i].api_enum == EGL_NONE) + if (apis[i].api_enum == EGL_NONE) + return; + + if (opts->api_enum != EGL_NONE && opts->api_enum != apis[i].api_enum) return; context = eglCreateContext(d, NULL, EGL_NO_CONTEXT, NULL); @@ -236,7 +352,7 @@ PrintRenderer(EGLDisplay d, const char* api_name) } static void -printClientAPIs(EGLDisplay d) +printClientAPIs(EGLDisplay d, struct options *opts) { const char *egl_clients_apis; char *api_name; @@ -246,14 +362,14 @@ printClientAPIs(EGLDisplay d) api_name = strtok((char *)egl_clients_apis, " "); while (api_name) { - PrintRenderer(d, api_name); + PrintRenderer(d, api_name, opts); api_name = strtok(NULL, " "); } } #endif static int -doOneDisplay(EGLDisplay d, const char *name) +doOneDisplay(EGLDisplay d, const char *name, struct options *opts) { int maj, min; @@ -267,7 +383,7 @@ doOneDisplay(EGLDisplay d, const char *name) printf("EGL vendor string: %s\n", eglQueryString(d, EGL_VENDOR)); printf("EGL version string: %s\n", eglQueryString(d, EGL_VERSION)); #ifdef EGL_VERSION_1_2 - printClientAPIs(d); + printClientAPIs(d, opts); #endif PrintExtensions(d); @@ -283,6 +399,7 @@ main(int argc, char *argv[]) { int ret = 0; const char *clientext; + struct options opts; #ifdef HAVE_EPOXY if (!epoxy_has_egl()) { @@ -290,44 +407,60 @@ main(int argc, char *argv[]) return -1; } #endif + parse_args(argc, argv, &opts); clientext = PrintExtensions(EGL_NO_DISPLAY); printf("\n"); + if (opts.platform_enum == Nodisplay) + return ret; + if (strstr(clientext, "EGL_EXT_platform_base")) { PFNEGLGETPLATFORMDISPLAYEXTPROC getPlatformDisplay = (PFNEGLGETPLATFORMDISPLAYEXTPROC) eglGetProcAddress("eglGetPlatformDisplayEXT"); - if (strstr(clientext, "EGL_KHR_platform_android")) + if ((opts.platform_enum == All || opts.platform_enum == Android) && + 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")) + NULL), + "Android platform", &opts); + if ((opts.platform_enum == All || opts.platform_enum == GBM) && + (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")) + NULL), + "GBM platform", &opts); + if ((opts.platform_enum == All || opts.platform_enum == Wayland) && + (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")) + NULL), + "Wayland platform", &opts); + if ((opts.platform_enum == All || opts.platform_enum == X11) && + (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"); - if (strstr(clientext, "EGL_MESA_platform_surfaceless")) + NULL), + "X11 platform", &opts); + if ((opts.platform_enum == All || opts.platform_enum == Surfaceless) && + strstr(clientext, "EGL_MESA_platform_surfaceless")) ret += doOneDisplay(getPlatformDisplay(EGL_PLATFORM_SURFACELESS_MESA, EGL_DEFAULT_DISPLAY, - NULL), "Surfaceless platform"); - if (strstr(clientext, "EGL_EXT_platform_device")) + NULL), + "Surfaceless platform", &opts); + if ((opts.platform_enum == All || opts.platform_enum == Device) && + strstr(clientext, "EGL_EXT_platform_device")) ret += doOneDisplay(getPlatformDisplay(EGL_PLATFORM_DEVICE_EXT, EGL_DEFAULT_DISPLAY, - NULL), "Device platform"); + NULL), + "Device platform", &opts); } else { - ret = doOneDisplay(eglGetDisplay(EGL_DEFAULT_DISPLAY), "Default display"); + ret = doOneDisplay(eglGetDisplay(EGL_DEFAULT_DISPLAY), "Default display", &opts); } return ret; -- GitLab
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor