From: Eric Engestrom Date: Mon, 3 Aug 2020 21:43:33 +0000 (+0200) Subject: egl: inline _eglInitializeDisplay() into eglInitialize() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=890d0334c156ac830c1f329ac52e5c1cf8bb7e54;p=mesa.git egl: inline _eglInitializeDisplay() into eglInitialize() Signed-off-by: Eric Engestrom Reviewed-by: Marek Olšák Part-of: --- diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index dc32b249f15..0a40770583a 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -89,11 +89,13 @@ #define PUBLIC #endif +#include #include #include #include #include "c99_compat.h" #include "c11/threads.h" +#include "util/debug.h" #include "util/macros.h" #include "egldefines.h" @@ -108,6 +110,7 @@ #include "eglconfig.h" #include "eglimage.h" #include "eglsync.h" +#include "egllog.h" #include "GL/mesa_glinterop.h" @@ -613,8 +616,28 @@ eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) RETURN_EGL_ERROR(NULL, EGL_BAD_DISPLAY, EGL_FALSE); if (!disp->Initialized) { - if (!_eglInitializeDisplay(disp)) - RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE); + /* set options */ + disp->Options.ForceSoftware = + env_var_as_boolean("LIBGL_ALWAYS_SOFTWARE", false); + if (disp->Options.ForceSoftware) + _eglLog(_EGL_DEBUG, "Found 'LIBGL_ALWAYS_SOFTWARE' set, will use a CPU renderer"); + + /** + * Initialize the display using the driver's function. + * If the initialisation fails, try again using only software rendering. + */ + if (!_eglDriver.Initialize(disp)) { + if (disp->Options.ForceSoftware) + RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE); + else { + disp->Options.ForceSoftware = EGL_TRUE; + if (!_eglDriver.Initialize(disp)) + RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE); + } + } + + disp->Initialized = EGL_TRUE; + disp->Driver = &_eglDriver; /* limit to APIs supported by core */ disp->ClientAPIs &= _EGL_API_ALL_BITS; diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c index 981ca6a79d3..08186621bd1 100644 --- a/src/egl/main/egldriver.c +++ b/src/egl/main/egldriver.c @@ -33,50 +33,9 @@ */ -#include -#include -#include #include -#include "c11/threads.h" #include "egldefines.h" #include "egldisplay.h" #include "egldriver.h" -#include "egllog.h" -#include "util/debug.h" - -extern const _EGLDriver _eglDriver; - -/** - * Initialize the display using the driver's function. - * If the initialisation fails, try again using only software rendering. - */ -bool -_eglInitializeDisplay(_EGLDisplay *disp) -{ - assert(!disp->Initialized); - - /* set options */ - disp->Options.ForceSoftware = - env_var_as_boolean("LIBGL_ALWAYS_SOFTWARE", false); - if (disp->Options.ForceSoftware) - _eglLog(_EGL_DEBUG, "Found 'LIBGL_ALWAYS_SOFTWARE' set, will use a CPU renderer"); - - if (_eglDriver.Initialize(disp)) { - disp->Driver = &_eglDriver; - disp->Initialized = EGL_TRUE; - return true; - } - - if (disp->Options.ForceSoftware) - return false; - - disp->Options.ForceSoftware = EGL_TRUE; - if (!_eglDriver.Initialize(disp)) - return false; - - disp->Driver = &_eglDriver; - disp->Initialized = EGL_TRUE; - return true; -} diff --git a/src/egl/main/egldriver.h b/src/egl/main/egldriver.h index 9cb6323a2e3..2d1ac870693 100644 --- a/src/egl/main/egldriver.h +++ b/src/egl/main/egldriver.h @@ -195,10 +195,6 @@ struct _egl_driver }; -extern bool -_eglInitializeDisplay(_EGLDisplay *disp); - - #ifdef __cplusplus } #endif