egl: inline _eglInitializeDisplay() into eglInitialize()
authorEric Engestrom <eric@engestrom.ch>
Mon, 3 Aug 2020 21:43:33 +0000 (23:43 +0200)
committerMarge Bot <eric+marge@anholt.net>
Sun, 16 Aug 2020 13:49:18 +0000 (13:49 +0000)
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6241>

src/egl/main/eglapi.c
src/egl/main/egldriver.c
src/egl/main/egldriver.h

index dc32b249f15e243e0c97d27c22dacc7f3823bc3b..0a40770583a63975d1cfdbbea385700ec59a1cc8 100644 (file)
 #define PUBLIC
 #endif
 
+#include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include "c99_compat.h"
 #include "c11/threads.h"
+#include "util/debug.h"
 #include "util/macros.h"
 
 #include "egldefines.h"
 #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;
index 981ca6a79d325f255aaf5cf9a2cdb5550f8a2930..08186621bd17581f1177164fe60e1161ef5821aa 100644 (file)
  */
 
 
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
 #include <stdlib.h>
-#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;
-}
index 9cb6323a2e39427e1d1bc1a047f33817832bc579..2d1ac8706934ff65bb64c96f23e4430d901c61e5 100644 (file)
@@ -195,10 +195,6 @@ struct _egl_driver
 };
 
 
-extern bool
-_eglInitializeDisplay(_EGLDisplay *disp);
-
-
 #ifdef __cplusplus
 }
 #endif