Implement the platform hook of waffle_display_info_json() so it can pick up egl-specific information.
Signed-off-by: Frank Henigman <fjhenig...@google.com> --- src/waffle/egl/wegl_display.c | 32 ++++++++++++++++++++++++++++++-- src/waffle/egl/wegl_display.h | 4 ++++ src/waffle/egl/wegl_platform.h | 3 +++ 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/waffle/egl/wegl_display.c b/src/waffle/egl/wegl_display.c index 88fce7a..dcfe934 100644 --- a/src/waffle/egl/wegl_display.c +++ b/src/waffle/egl/wegl_display.c @@ -25,6 +25,8 @@ #include <assert.h> +#include "json.h" + #include "wcore_error.h" #include "wcore_platform.h" @@ -63,7 +65,6 @@ wegl_display_init(struct wegl_display *dpy, { struct wegl_platform *plat = wegl_platform(wc_plat); bool ok; - EGLint major, minor; ok = wcore_display_init(&dpy->wcore, wc_plat); if (!ok) @@ -75,7 +76,7 @@ wegl_display_init(struct wegl_display *dpy, goto fail; } - ok = plat->eglInitialize(dpy->egl, &major, &minor); + ok = plat->eglInitialize(dpy->egl, &plat->major, &plat->minor); if (!ok) { wegl_emit_error(plat, "eglInitialize"); goto fail; @@ -139,3 +140,30 @@ wegl_display_supports_context_api(struct wcore_display *wc_dpy, return wc_plat->vtbl->dl_can_open(wc_plat, waffle_dl); } + +void +wegl_display_info_json(struct wcore_display *wc_dpy, struct json *jj) +{ + struct wegl_display *dpy = wegl_display(wc_dpy); + struct wegl_platform *plat = wegl_platform(dpy->wcore.platform); + + const char *version = plat->eglQueryString(dpy->egl, EGL_VERSION); + const char *vendor = plat->eglQueryString(dpy->egl, EGL_VENDOR); +#ifdef EGL_VERSION_1_2 + const char *apis = plat->eglQueryString(dpy->egl, EGL_CLIENT_APIS); +#endif + const char *ext = plat->eglQueryString(dpy->egl, EGL_EXTENSIONS); + + json_appendv(jj, + "version", "{", + "major", json_num(plat->major), + "minor", json_num(plat->minor), + "string", json_str(version), + "}", + "vendor", json_str(vendor), +#ifdef EGL_VERSION_1_2 + "client_apis", "[", json_split(apis, " "), "]", +#endif + "extensions", "[", json_split(ext, " "), "]", + ""); +} diff --git a/src/waffle/egl/wegl_display.h b/src/waffle/egl/wegl_display.h index 43b83ef..20a3de8 100644 --- a/src/waffle/egl/wegl_display.h +++ b/src/waffle/egl/wegl_display.h @@ -32,6 +32,7 @@ #include "wcore_display.h" +struct json; struct wcore_display; struct wegl_display { @@ -56,3 +57,6 @@ wegl_display_teardown(struct wegl_display *dpy); bool wegl_display_supports_context_api(struct wcore_display *wc_dpy, int32_t waffle_context_api); + +void +wegl_display_info_json(struct wcore_display *wc_self, struct json *); diff --git a/src/waffle/egl/wegl_platform.h b/src/waffle/egl/wegl_platform.h index 7ae0490..c171b0a 100644 --- a/src/waffle/egl/wegl_platform.h +++ b/src/waffle/egl/wegl_platform.h @@ -34,6 +34,9 @@ struct wegl_platform { struct wcore_platform wcore; + // EGL version from eglInitialize + EGLint major, minor; + // EGL function pointers void *eglHandle; -- 2.6.0.rc2.230.g3dd15c0 _______________________________________________ waffle mailing list waffle@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/waffle