From 76ed2255ef8da963b1d4a9a121e24a094dfead20 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sat, 9 Jan 2021 11:37:21 +0100 Subject: render/egl: remove support for EGL_NATIVE_VISUAL_ID Nobody uses it anymore. --- render/egl.c | 47 +++++++++-------------------------------------- render/wlr_renderer.c | 2 +- 2 files changed, 10 insertions(+), 39 deletions(-) (limited to 'render') diff --git a/render/egl.c b/render/egl.c index 8914801b..22feade3 100644 --- a/render/egl.c +++ b/render/egl.c @@ -10,41 +10,6 @@ #include #include -static bool egl_get_config(EGLDisplay disp, const EGLint *attribs, - EGLConfig *out, EGLint visual_id) { - EGLint count = 0, matched = 0, ret; - - ret = eglGetConfigs(disp, NULL, 0, &count); - if (ret == EGL_FALSE || count == 0) { - wlr_log(WLR_ERROR, "eglGetConfigs returned no configs"); - return false; - } - - EGLConfig configs[count]; - - ret = eglChooseConfig(disp, attribs, configs, count, &matched); - if (ret == EGL_FALSE) { - wlr_log(WLR_ERROR, "eglChooseConfig failed"); - return false; - } - - for (int i = 0; i < matched; ++i) { - EGLint visual; - if (!eglGetConfigAttrib(disp, configs[i], - EGL_NATIVE_VISUAL_ID, &visual)) { - continue; - } - - if (!visual_id || visual == visual_id) { - *out = configs[i]; - return true; - } - } - - wlr_log(WLR_ERROR, "no valid egl config found"); - return false; -} - static enum wlr_log_importance egl_log_importance_to_wlr(EGLint type) { switch (type) { case EGL_DEBUG_MSG_CRITICAL_KHR: return WLR_ERROR; @@ -185,7 +150,7 @@ out: } bool wlr_egl_init(struct wlr_egl *egl, EGLenum platform, void *remote_display, - const EGLint *config_attribs, EGLint visual_id) { + const EGLint *config_attribs) { const char *client_exts_str = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS); if (client_exts_str == NULL) { if (eglGetError() == EGL_BAD_DISPLAY) { @@ -321,8 +286,14 @@ bool wlr_egl_init(struct wlr_egl *egl, EGLenum platform, void *remote_display, } if (config_attribs != NULL) { - if (!egl_get_config(egl->display, config_attribs, &egl->config, visual_id)) { - wlr_log(WLR_ERROR, "Failed to get EGL config"); + EGLint matched = 0; + if (!eglChooseConfig(egl->display, config_attribs, &egl->config, 1, + &matched)) { + wlr_log(WLR_ERROR, "eglChooseConfig failed"); + goto error; + } + if (matched == 0) { + wlr_log(WLR_ERROR, "Failed to match an EGL config"); goto error; } } else { diff --git a/render/wlr_renderer.c b/render/wlr_renderer.c index 69cc0363..b721036f 100644 --- a/render/wlr_renderer.c +++ b/render/wlr_renderer.c @@ -255,7 +255,7 @@ struct wlr_renderer *wlr_renderer_autocreate(EGLenum platform, return NULL; } - if (!wlr_egl_init(egl, platform, remote_display, NULL, 0)) { + if (!wlr_egl_init(egl, platform, remote_display, NULL)) { wlr_log(WLR_ERROR, "Could not initialize EGL"); return NULL; } -- cgit v1.2.3