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 <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
This commit is contained in:
Eric Engestrom
2017-09-25 22:35:24 +01:00
committed by Eric Engestrom
parent 4893673b15
commit 8cb84c8477
5 changed files with 18 additions and 31 deletions

View File

@@ -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;
}