summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXuelian Bai <xuelian.bai@samsung.com>2024-02-27 16:38:41 +0800
committerXuelian Bai <xuelian.bai@samsung.com>2024-02-27 16:42:45 +0800
commitd79e47c3a485da1fa61f4a59fcae6db45fdfd4f5 (patch)
treeb0d7cb2a5d04ceada00336a3db70a0a8dd2e3a31
parentca66fc55b4ee5ae1afa84246d56a3e216bf49cb6 (diff)
downloadmesa-accepted/tizen/unified/toolchain/20240311.070035.tar.gz
mesa-accepted/tizen/unified/toolchain/20240311.070035.tar.bz2
mesa-accepted/tizen/unified/toolchain/20240311.070035.zip
Set fd_render_gpu as -1 when init, avoid 0 value, or it will be released by dri2_display_destroy. Change-Id: I193a49e5fd03520a42aaea964dbf6762b5e60ddb Signed-off-by: Xuelian Bai <xuelian.bai@samsung.com>
-rwxr-xr-xsrc/egl/drivers/dri2/platform_tizen.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/egl/drivers/dri2/platform_tizen.c b/src/egl/drivers/dri2/platform_tizen.c
index b0e9cd09070..290a35f866d 100755
--- a/src/egl/drivers/dri2/platform_tizen.c
+++ b/src/egl/drivers/dri2/platform_tizen.c
@@ -1554,7 +1554,7 @@ dri2_initialize_tizen(_EGLDisplay *disp)
loader_set_logger(_eglLog);
- dri2_dpy = calloc(1, sizeof *dri2_dpy);
+ dri2_dpy = dri2_display_create();
if (!dri2_dpy)
return _eglError(EGL_BAD_ALLOC, "eglInitialize");
@@ -1677,6 +1677,8 @@ dri2_initialize_tizen(_EGLDisplay *disp)
dri2_dpy->loader_extensions = tizen_swrast_loader_extensions;
}
+ dri2_dpy->fd_display_gpu = dri2_dpy->fd_render_gpu;
+
if (!dri2_create_screen(disp)) {
err = "DRI2: failed to create screen";
goto cleanup_driver;
@@ -1687,12 +1689,10 @@ dri2_initialize_tizen(_EGLDisplay *disp)
goto cleanup_driver;
}
- if(dri2_dpy->fd_render_gpu != tbm_bufmgr_fd) {
- close(dri2_dpy->fd_render_gpu);
+ if (dri2_dpy->fd_render_gpu != tbm_bufmgr_fd) {
+ close(tbm_bufmgr_fd);
+ tbm_bufmgr_fd = -1;
}
- close(tbm_bufmgr_fd);
- tbm_bufmgr_fd = -1;
- dri2_dpy->fd_render_gpu = -1;
if (!dri2_setup_extensions(disp)) {
err = "DRI2: failed to find required DRI extensions";
@@ -1747,6 +1747,14 @@ cleanup_display:
wl_display_disconnect(disp->PlatformDisplay);
disp->PlatformDisplay = NULL;
}
+ if (tbm_bufmgr_fd != -1) {
+ if (dri2_dpy->fd_render_gpu != -1 && dri2_dpy->fd_render_gpu != tbm_bufmgr_fd) {
+ close(dri2_dpy->fd_render_gpu);
+ dri2_dpy->fd_display_gpu = dri2_dpy->fd_render_gpu = -1;
+ }
+ close(tbm_bufmgr_fd);
+ tbm_bufmgr_fd = -1;
+ }
free(dri2_dpy);
disp->DriverData = NULL;