summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXuelian <xuelian.bai@samsung.com>2020-03-05 00:35:24 +0800
committerXuelian Bai <xuelian.bai@samsung.com>2024-01-18 09:29:10 +0800
commit06a8e08469f7502bc84b6fe307823b1a662ec5a9 (patch)
treefad70d68d4172b35d8339e13a865b77157daad60
parentfccace389a6faa9bd94ed270d6c0ceec3ec528b2 (diff)
downloadmesa-06a8e08469f7502bc84b6fe307823b1a662ec5a9.tar.gz
mesa-06a8e08469f7502bc84b6fe307823b1a662ec5a9.tar.bz2
mesa-06a8e08469f7502bc84b6fe307823b1a662ec5a9.zip
Fix "close object **" error in vc4_bo_free on RPI3
When running case dEQP-GLES2.functional.prerequisite.read_pixels for deqp-gles2, there will be an error "close object **". This error is caused by invalid fd, so we call tbm_drm_helper_get_auth_info in dri2_initialize_tizen. Change-Id: I959b404daa33c629ea72c38bfe7838e643eb603d Signed-Off-by: Xuelian Bai <xuelian.bai@samsung.com>
-rwxr-xr-xsrc/egl/drivers/dri2/platform_tizen.c47
1 files changed, 35 insertions, 12 deletions
diff --git a/src/egl/drivers/dri2/platform_tizen.c b/src/egl/drivers/dri2/platform_tizen.c
index b313f13e79c..9e54a85647f 100755
--- a/src/egl/drivers/dri2/platform_tizen.c
+++ b/src/egl/drivers/dri2/platform_tizen.c
@@ -1425,6 +1425,7 @@ dri2_initialize_tizen(_EGLDisplay *disp)
tpl_display_t *tpl_display = NULL;
const char *err;
int tbm_bufmgr_fd = -1;
+ char *tbm_bufmgr_device_name = NULL;
int hw_accel = (getenv("LIBGL_ALWAYS_SOFTWARE") == NULL);
loader_set_logger(_eglLog);
@@ -1486,18 +1487,39 @@ dri2_initialize_tizen(_EGLDisplay *disp)
}
drmFreeDevices(devices, num_devices);
#endif
- dri2_dpy->fd = loader_get_user_preferred_fd(tbm_bufmgr_fd,
- &dri2_dpy->is_different_gpu);
- //dri2_dpy->is_different_gpu = (dri2_dpy->fd == tbm_bufmgr_fd);
-
- if (dri2_dpy->is_different_gpu) {
- free(dri2_dpy->device_name);
- dri2_dpy->device_name = loader_get_device_name_for_fd(dri2_dpy->fd);
- if (!dri2_dpy->device_name) {
- err = "DRI2: failed to get device name for requested GPU";
- goto cleanup_device;
- }
- }
+
+ if (drmGetNodeTypeFromFd(tbm_bufmgr_fd) == DRM_NODE_RENDER) {
+
+ tbm_bufmgr_device_name = loader_get_device_name_for_fd(tbm_bufmgr_fd);
+ if (tbm_bufmgr_device_name == NULL) {
+ err = "DRI2: failed to get tbm_bufmgr device name";
+ goto cleanup_device;
+ }
+ dri2_dpy->fd = loader_open_device(tbm_bufmgr_device_name);
+
+ } else {
+ if (!tbm_drm_helper_get_auth_info(&dri2_dpy->fd, NULL, NULL)) {
+
+ /* FIXME: tbm_drm_helper_get_auth_info() does not support the case of
+ * display server for now. this code is fallback routine for
+ * that Enlightenment Server fails on tbm_drm_helper_get_auth_info.
+ * When tbm_drm_helper_get_auth_info() supports display server
+ * case, then remove below routine.
+ */
+#if 1
+ tbm_bufmgr_device_name = loader_get_device_name_for_fd(tbm_bufmgr_fd);
+ if (tbm_bufmgr_device_name == NULL) {
+ err = "DRI2: failed to get tbm_bufmgr device name";
+ goto cleanup_device;
+ }
+ dri2_dpy->fd = loader_open_device(tbm_bufmgr_device_name);
+#else
+ err = "DRI2: failed to get fd from tbm_drm_helper_get_auth_info()";
+ goto cleanup_device;
+#endif
+ }
+ }
+
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";
@@ -1548,6 +1570,7 @@ dri2_initialize_tizen(_EGLDisplay *disp)
if(dri2_dpy->fd != tbm_bufmgr_fd) {
close(dri2_dpy->fd);
}
+ close(tbm_bufmgr_fd);
tbm_bufmgr_fd = -1;
dri2_dpy->fd = -1;