summaryrefslogtreecommitdiffstats
path: root/src/egl/main
diff options
context:
space:
mode:
authorEric Engestrom <[email protected]>2017-09-25 22:35:24 +0100
committerEric Engestrom <[email protected]>2017-10-18 17:25:41 +0100
commit8cb84c8477a57ed05d703669fee1770f31b76ae6 (patch)
treec178c86f08560531d35da8740e7023baadd97c2a /src/egl/main
parent4893673b155b9ff2e0fc0730b214ba3bcbe75a89 (diff)
egl: move alloc & init out of _eglBuiltInDriver{DRI2,Haiku}
Note: dropping the EGL_BAD_ALLOC in egl_haiku because it's overwritten by the EGL_NOT_INITIALIZED in eglInitialize(). Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/egl/main')
-rw-r--r--src/egl/main/README.txt9
-rw-r--r--src/egl/main/egldriver.c8
-rw-r--r--src/egl/main/egldriver.h4
3 files changed, 12 insertions, 9 deletions
diff --git a/src/egl/main/README.txt b/src/egl/main/README.txt
index 1af99599729..9b5fd410618 100644
--- a/src/egl/main/README.txt
+++ b/src/egl/main/README.txt
@@ -19,13 +19,12 @@ Bootstrapping:
When the apps calls eglInitialize() a device driver is selected and loaded
(look for _eglAddDrivers() and _eglLoadModule() in egldriver.c).
-The built-in driver's entry point function is then called. This driver function
-allocates, initializes and returns a new _EGLDriver object (usually a
-subclass of that type).
+The built-in driver's entry point function is then called and given
+a freshly allocated and initialised _EGLDriver, with default fallback
+entrypoints set.
As part of initialization, the dispatch table in _EGLDriver->API must be
-populated with all the EGL entrypoints. Typically, _eglInitDriverFallbacks()
-can be used to plug in default/fallback functions. Some functions like
+populated with all the EGL entrypoints. Some functions like
driver->API.Initialize and driver->API.Terminate _must_ be implemented
with driver-specific code (no default/fallback function is possible).
diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c
index 5d5b7daa418..92ea6450944 100644
--- a/src/egl/main/egldriver.c
+++ b/src/egl/main/egldriver.c
@@ -52,8 +52,12 @@ _eglGetDriver(void)
{
mtx_lock(&_eglModuleMutex);
- if (!_eglDriver)
- _eglDriver = _eglBuiltInDriver();
+ if (!_eglDriver) {
+ _eglDriver = calloc(1, sizeof(*_eglDriver));
+ if (!_eglDriver)
+ return NULL;
+ _eglInitDriver(_eglDriver);
+ }
mtx_unlock(&_eglModuleMutex);
diff --git a/src/egl/main/egldriver.h b/src/egl/main/egldriver.h
index d28ffe0214c..a3f9b991284 100644
--- a/src/egl/main/egldriver.h
+++ b/src/egl/main/egldriver.h
@@ -81,8 +81,8 @@ struct _egl_driver
};
-extern _EGLDriver*
-_eglBuiltInDriver(void);
+extern void
+_eglInitDriver(_EGLDriver *driver);
extern _EGLDriver *