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);
}
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";
if(dri2_dpy->fd != tbm_bufmgr_fd) {
close(dri2_dpy->fd);
}
+ close(tbm_bufmgr_fd);
tbm_bufmgr_fd = -1;
dri2_dpy->fd = -1;