summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmil Velikov <[email protected]>2017-05-11 17:18:13 +0100
committerEmil Velikov <[email protected]>2017-05-29 16:49:55 +0100
commit898d7858f835eb8e027ba2451d27564959f373b5 (patch)
tree927ff995915e11f10f08a30ec3ece92c79184027
parent3e73c0245b2e24b9d593179d26b4bed80e1ac078 (diff)
egl/android: make use of dri2_display_destroy() helper
v2: disp -> dpy (Tapani) Cc: Tomasz Figa <[email protected]> Cc: Tapani Pälli <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Tested-by: Rob Herring <[email protected]>
-rw-r--r--src/egl/drivers/dri2/platform_android.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
index de24a8f5c49..42820c9793a 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -1112,11 +1112,12 @@ dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *dpy)
if (!dri2_dpy)
return _eglError(EGL_BAD_ALLOC, "eglInitialize");
+ dri2_dpy->fd = -1;
ret = hw_get_module(GRALLOC_HARDWARE_MODULE_ID,
(const hw_module_t **)&dri2_dpy->gralloc);
if (ret) {
err = "DRI2: failed to get gralloc module";
- goto cleanup_display;
+ goto cleanup;
}
dpy->DriverData = (void *) dri2_dpy;
@@ -1124,18 +1125,18 @@ dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *dpy)
dri2_dpy->fd = droid_open_device(dri2_dpy);
if (dri2_dpy->fd < 0) {
err = "DRI2: failed to open device";
- goto cleanup_display;
+ goto cleanup;
}
dri2_dpy->driver_name = loader_get_driver_for_fd(dri2_dpy->fd);
if (dri2_dpy->driver_name == NULL) {
err = "DRI2: failed to get driver name";
- goto cleanup_device;
+ goto cleanup;
}
if (!dri2_load_driver(dpy)) {
err = "DRI2: failed to load driver";
- goto cleanup_driver_name;
+ goto cleanup;
}
dri2_dpy->is_render_node = drmGetNodeTypeFromFd(dri2_dpy->fd) == DRM_NODE_RENDER;
@@ -1149,12 +1150,12 @@ dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *dpy)
if (!dri2_create_screen(dpy)) {
err = "DRI2: failed to create screen";
- goto cleanup_driver;
+ goto cleanup;
}
if (!droid_add_configs_for_visuals(drv, dpy)) {
err = "DRI2: failed to add configs";
- goto cleanup_screen;
+ goto cleanup;
}
dpy->Extensions.ANDROID_framebuffer_target = EGL_TRUE;
@@ -1169,17 +1170,7 @@ dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *dpy)
return EGL_TRUE;
-cleanup_screen:
- dri2_dpy->core->destroyScreen(dri2_dpy->dri_screen);
-cleanup_driver:
- dlclose(dri2_dpy->driver);
-cleanup_driver_name:
- free(dri2_dpy->driver_name);
-cleanup_device:
- close(dri2_dpy->fd);
-cleanup_display:
- free(dri2_dpy);
- dpy->DriverData = NULL;
-
+cleanup:
+ dri2_display_destroy(dpy);
return _eglError(EGL_NOT_INITIALIZED, err);
}