From 681fd73f1e95d43425b946a250b241bfdb0ce1c8 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Thu, 13 May 2010 16:06:29 -0400 Subject: egl: Allow a prioritized list of default drivers When there is no user driver or any matching display drivers we fall back to the default driver. This patch lets us have a list of default drivers instead of just one. The drivers are loaded in turn and we attempt to initialize the display. If it fails we unload the driver and move on to the next one. Compared to the display driver mechanism, this avoids loading a number of drivers and then only using one. Also, we call Initialize to see if the driver will work instead of relying on Probe. To know for sure that a driver will work, Probe really have to do a full Initialize, so we will just use Initialize directly. --- src/egl/main/eglapi.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/egl/main/eglapi.c') diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 647be65220..f57dda8883 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; -- cgit v1.2.3