summaryrefslogtreecommitdiffstats
path: root/src/egl/main/eglapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/egl/main/eglapi.c')
-rw-r--r--src/egl/main/eglapi.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 647be652207..f57dda88833 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -272,13 +272,15 @@ eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
if (!drv) {
_eglPreloadDrivers();
drv = _eglMatchDriver(disp);
- if (!drv)
- RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE);
+ /* Initialize the particular display now */
+ if (drv && !drv->API.Initialize(drv, disp, &major_int, &minor_int))
+ RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE);
}
-
- /* Initialize the particular display now */
- if (!drv->API.Initialize(drv, disp, &major_int, &minor_int))
- RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE);
+ if (!drv)
+ /* Load and initialize the first default driver that works */
+ drv = _eglLoadDefaultDriver(disp, &major_int, &minor_int);
+ if (!drv)
+ RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE);
disp->APImajor = major_int;
disp->APIminor = minor_int;