diff options
-rwxr-xr-x | src/egl/drivers/dri2/platform_tizen.c | 47 |
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; |