Mesa (master): egl: inline _eglMatchAndInitialize() and refactor _eglMatchDriver()
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Jul 30 23:44:57 UTC 2020
Module: Mesa
Branch: master
Commit: 6d6b82a159cdc03587b18d6acec0c2e00f066677
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6d6b82a159cdc03587b18d6acec0c2e00f066677
Author: Eric Engestrom <eric at engestrom.ch>
Date: Wed Jul 22 01:13:13 2020 +0200
egl: inline _eglMatchAndInitialize() and refactor _eglMatchDriver()
Signed-off-by: Eric Engestrom <eric at engestrom.ch>
Reviewed-by: Marcin Ślusarz <marcin.slusarz at intel.com>
Reviewed-by: Emil Velikov <emil.velikov at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6037>
---
src/egl/main/egldriver.c | 33 +++++++++++++--------------------
1 file changed, 13 insertions(+), 20 deletions(-)
diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c
index e6d50984727..f58b00e1a3c 100644
--- a/src/egl/main/egldriver.c
+++ b/src/egl/main/egldriver.c
@@ -48,15 +48,6 @@
extern _EGLDriver _eglDriver;
-static _EGLDriver *
-_eglMatchAndInitialize(_EGLDisplay *disp)
-{
- if (_eglDriver.Initialize(&_eglDriver, disp))
- return &_eglDriver;
-
- return NULL;
-}
-
/**
* Match a display to a driver. The matching is done by finding the first
* driver that can initialize the display.
@@ -64,8 +55,6 @@ _eglMatchAndInitialize(_EGLDisplay *disp)
bool
_eglMatchDriver(_EGLDisplay *disp)
{
- _EGLDriver *best_drv;
-
assert(!disp->Initialized);
/* set options */
@@ -74,18 +63,22 @@ _eglMatchDriver(_EGLDisplay *disp)
if (disp->Options.ForceSoftware)
_eglLog(_EGL_DEBUG, "Found 'LIBGL_ALWAYS_SOFTWARE' set, will use a CPU renderer");
- best_drv = _eglMatchAndInitialize(disp);
- if (!best_drv && !disp->Options.ForceSoftware) {
- disp->Options.ForceSoftware = EGL_TRUE;
- best_drv = _eglMatchAndInitialize(disp);
- }
-
- if (best_drv) {
- disp->Driver = best_drv;
+ if (_eglDriver.Initialize(&_eglDriver, disp)) {
+ disp->Driver = &_eglDriver;
disp->Initialized = EGL_TRUE;
+ return true;
}
- return best_drv != NULL;
+ if (disp->Options.ForceSoftware)
+ return false;
+
+ disp->Options.ForceSoftware = EGL_TRUE;
+ if (!_eglDriver.Initialize(&_eglDriver, disp))
+ return false;
+
+ disp->Driver = &_eglDriver;
+ disp->Initialized = EGL_TRUE;
+ return true;
}
__eglMustCastToProperFunctionPointerType
More information about the mesa-commit
mailing list