aboutsummaryrefslogtreecommitdiffhomepage
path: root/video/out/opengl/egl_helpers.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/opengl/egl_helpers.c')
-rw-r--r--video/out/opengl/egl_helpers.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/video/out/opengl/egl_helpers.c b/video/out/opengl/egl_helpers.c
index 3594f72022..0169ab264e 100644
--- a/video/out/opengl/egl_helpers.c
+++ b/video/out/opengl/egl_helpers.c
@@ -72,15 +72,27 @@ static bool create_context(EGLDisplay display, struct mp_log *log, bool probing,
};
EGLint config_count;
- EGLConfig config;
+ EGLConfig *configs = NULL;
- eglChooseConfig(display, attributes, &config, 1, &config_count);
+ eglChooseConfig(display, attributes, NULL, 0, &config_count);
+
+ if (config_count) {
+ configs = talloc_array(NULL, EGLConfig, config_count);
+ eglChooseConfig(display, attributes, configs, config_count, &config_count);
+ }
if (!config_count) {
mp_msg(log, msgl, "Could not find EGL configuration!\n");
return false;
}
+ int chosen = 0;
+ if (opts->refine_config)
+ chosen = opts->refine_config(opts->user_data, configs, config_count);
+ EGLConfig config = configs[chosen];
+
+ talloc_free(configs);
+
EGLContext *ctx = NULL;
if (es_version) {