diff options
author | wm4 <wm4@nowhere> | 2018-04-26 19:10:56 +0200 |
---|---|---|
committer | Jan Ekström <jeebjp@gmail.com> | 2018-04-29 02:21:32 +0300 |
commit | 67ce9813d69dfbad7faf5e3ec8dfab0ee5e5e388 (patch) | |
tree | 6a5f5cb3e8789f975a82385824634a03245e88c7 /video/out | |
parent | 4fc5c1fa134d36472fdbdfa4880fd74af750c8c5 (diff) | |
download | mpv-67ce9813d69dfbad7faf5e3ec8dfab0ee5e5e388.tar.bz2 mpv-67ce9813d69dfbad7faf5e3ec8dfab0ee5e5e388.tar.xz |
egl_helpers: log certain EGL attributes
Might be helpful with broken EGL implementations.
Diffstat (limited to 'video/out')
-rw-r--r-- | video/out/opengl/egl_helpers.c | 38 |
1 files changed, 38 insertions, 0 deletions
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=<error>\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) { |