From 67ce9813d69dfbad7faf5e3ec8dfab0ee5e5e388 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 26 Apr 2018 19:10:56 +0200 Subject: egl_helpers: log certain EGL attributes Might be helpful with broken EGL implementations. --- video/out/opengl/egl_helpers.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/video/out/opengl/egl_helpers.c b/video/out/opengl/egl_helpers.c index 8f8a7fee3b..a3b9c65059 100644 --- a/video/out/opengl/egl_helpers.c +++ b/video/out/opengl/egl_helpers.c @@ -44,6 +44,38 @@ #define EGL_OPENGL_ES3_BIT 0x00000040 #endif +struct mp_egl_config_attr { + int attrib; + const char *name; +}; + +#define MP_EGL_ATTRIB(id) {id, # id} + +static const struct mp_egl_config_attr mp_egl_attribs[] = { + MP_EGL_ATTRIB(EGL_CONFIG_ID), + MP_EGL_ATTRIB(EGL_RED_SIZE), + MP_EGL_ATTRIB(EGL_GREEN_SIZE), + MP_EGL_ATTRIB(EGL_BLUE_SIZE), + MP_EGL_ATTRIB(EGL_ALPHA_SIZE), + MP_EGL_ATTRIB(EGL_COLOR_BUFFER_TYPE), + MP_EGL_ATTRIB(EGL_CONFIG_CAVEAT), + MP_EGL_ATTRIB(EGL_CONFORMANT), +}; + +static void dump_egl_config(struct mp_log *log, int msgl, EGLDisplay display, + EGLConfig config) +{ + for (int n = 0; n < MP_ARRAY_SIZE(mp_egl_attribs); n++) { + const char *name = mp_egl_attribs[n].name; + EGLint v = -1; + if (eglGetConfigAttrib(display, config, mp_egl_attribs[n].attrib, &v)) { + mp_msg(log, msgl, " %s=%d\n", name, v); + } else { + mp_msg(log, msgl, " %s=\n", name); + } + } +} + // es_version: 0 (core), 2 or 3 static bool create_context(struct ra_ctx *ctx, EGLDisplay display, int es_version, struct mpegl_cb cb, @@ -105,6 +137,9 @@ static bool create_context(struct ra_ctx *ctx, EGLDisplay display, return false; } + for (int n = 0; n < num_configs; n++) + dump_egl_config(ctx->log, MSGL_TRACE, display, configs[n]); + int chosen = 0; if (cb.refine_config) chosen = cb.refine_config(cb.user_data, configs, num_configs); @@ -117,6 +152,9 @@ static bool create_context(struct ra_ctx *ctx, EGLDisplay display, talloc_free(configs); + MP_DBG(ctx, "Chosen EGLConfig:\n"); + dump_egl_config(ctx->log, MSGL_DEBUG, display, config); + EGLContext *egl_ctx = NULL; if (es_version) { -- cgit v1.2.3