summaryrefslogtreecommitdiffstats
path: root/src/egl/drivers
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/drivers
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/drivers')
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c13
-rw-r--r--src/egl/drivers/haiku/egl_haiku.cpp15
2 files changed, 6 insertions, 22 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 72e60858a8c..b1df0cb1a91 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -3195,16 +3195,11 @@ dri2_interop_export_object(_EGLDisplay *dpy, _EGLContext *ctx,
/**
* This is the main entrypoint into the driver, called by libEGL.
- * Create a new _EGLDriver object and init its dispatch table.
+ * Gets an _EGLDriver object and init its dispatch table.
*/
-_EGLDriver *
-_eglBuiltInDriver(void)
+void
+_eglInitDriver(_EGLDriver *dri2_drv)
{
- _EGLDriver *dri2_drv = calloc(1, sizeof *dri2_drv);
- if (!dri2_drv)
- return NULL;
-
- _eglInitDriverFallbacks(dri2_drv);
dri2_drv->API.Initialize = dri2_initialize;
dri2_drv->API.Terminate = dri2_terminate;
dri2_drv->API.CreateContext = dri2_create_context;
@@ -3255,6 +3250,4 @@ _eglBuiltInDriver(void)
dri2_drv->API.DupNativeFenceFDANDROID = dri2_dup_native_fence_fd;
dri2_drv->Name = "DRI2";
-
- return dri2_drv;
}
diff --git a/src/egl/drivers/haiku/egl_haiku.cpp b/src/egl/drivers/haiku/egl_haiku.cpp
index 237cebf056e..590e43f00fb 100644
--- a/src/egl/drivers/haiku/egl_haiku.cpp
+++ b/src/egl/drivers/haiku/egl_haiku.cpp
@@ -305,21 +305,14 @@ haiku_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf)
/**
* This is the main entrypoint into the driver, called by libEGL.
- * Create a new _EGLDriver object and init its dispatch table.
+ * Gets an _EGLDriver object and init its dispatch table.
*/
extern "C"
-_EGLDriver*
-_eglBuiltInDriver(void)
+void
+_eglInitDriver(_EGLDriver *driver)
{
CALLED();
- _EGLDriver* driver = calloc(1, sizeof(*driver));
- if (!driver) {
- _eglError(EGL_BAD_ALLOC, "_eglBuiltInDriverHaiku");
- return NULL;
- }
-
- _eglInitDriverFallbacks(driver);
driver->API.Initialize = init_haiku;
driver->API.Terminate = haiku_terminate;
driver->API.CreateContext = haiku_create_context;
@@ -335,6 +328,4 @@ _eglBuiltInDriver(void)
driver->Name = "Haiku";
TRACE("API Calls defined\n");
-
- return driver;
}