mirror of
https://github.com/mpv-player/mpv
synced 2025-03-09 23:58:06 +00:00
egl_helpers: log certain EGL attributes
Might be helpful with broken EGL implementations.
This commit is contained in:
parent
4fc5c1fa13
commit
67ce9813d6
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user