diff --git a/gfx/drivers_context/androidegl_ctx.c b/gfx/drivers_context/androidegl_ctx.c index f93e8fde81..1264c74bbd 100644 --- a/gfx/drivers_context/androidegl_ctx.c +++ b/gfx/drivers_context/androidegl_ctx.c @@ -60,7 +60,10 @@ static bool android_gfx_ctx_init(void *data) if (!egl_init_context(EGL_DEFAULT_DISPLAY, &major, &minor, &n, attribs)) + { + egl_report_error(); goto error; + } var = eglGetConfigAttrib(g_egl_dpy, g_egl_config, EGL_NATIVE_VISUAL_ID, &format); diff --git a/gfx/drivers_context/drm_egl_ctx.c b/gfx/drivers_context/drm_egl_ctx.c index 325e9a9dbd..50ef011f3e 100644 --- a/gfx/drivers_context/drm_egl_ctx.c +++ b/gfx/drivers_context/drm_egl_ctx.c @@ -724,7 +724,10 @@ static bool gfx_ctx_drm_egl_set_video_mode(void *data, if (!egl_init_context((EGLNativeDisplayType)drm->g_gbm_dev, &major, &minor, &n, attrib_ptr)) + { + egl_report_error(); goto error; + } attr = egl_fill_attribs(egl_attribs); diff --git a/gfx/drivers_context/xegl_ctx.c b/gfx/drivers_context/xegl_ctx.c index 9b436ad656..4c660bec49 100644 --- a/gfx/drivers_context/xegl_ctx.c +++ b/gfx/drivers_context/xegl_ctx.c @@ -91,9 +91,8 @@ static bool gfx_ctx_xegl_init(void *data) }; const EGLint *attrib_ptr; - - EGLint egl_major, egl_minor; - EGLint num_configs; + EGLint major, minor; + EGLint n; if (g_inited) return false; @@ -123,30 +122,14 @@ static bool gfx_ctx_xegl_init(void *data) if (!x11_connect()) goto error; - g_egl_dpy = eglGetDisplay((EGLNativeDisplayType)g_x11_dpy); - if (g_egl_dpy == EGL_NO_DISPLAY) + if (!egl_init_context((EGLNativeDisplayType)g_x11_dpy, + &major, &minor, &n, attrib_ptr)) { - RARCH_ERR("[X/EGL]: EGL display not available.\n"); egl_report_error(); goto error; } - if (!eglInitialize(g_egl_dpy, &egl_major, &egl_minor)) - { - RARCH_ERR("[X/EGL]: Unable to initialize EGL.\n"); - egl_report_error(); - goto error; - } - - RARCH_LOG("[X/EGL]: EGL version: %d.%d\n", egl_major, egl_minor); - - if (!eglChooseConfig(g_egl_dpy, attrib_ptr, &g_egl_config, 1, &num_configs)) - { - RARCH_ERR("[X/EGL]: eglChooseConfig failed with 0x%x.\n", eglGetError()); - goto error; - } - - if (num_configs == 0 || !g_egl_config) + if (n == 0 || !g_egl_config) { RARCH_ERR("[X/EGL]: No EGL configurations available.\n"); goto error;