tpl_backend_type_t tpl_backend = TPL_BACKEND_UNKNOWN;
const char *err;
int tbm_bufmgr_fd = -1;
+ int master_fd = -1;
char *tbm_bufmgr_device_name = NULL;
int hw_accel = (getenv("LIBGL_ALWAYS_SOFTWARE") == NULL);
/* Get tbm_bufmgr's fd */
tbm_bufmgr_fd = tbm_drm_helper_get_fd();
-
if (tbm_bufmgr_fd == -1) {
err = "DRI2: failed to get tbm_bufmgr fd";
goto cleanup_device;
}
drmFreeDevices(devices, num_devices);
#endif
-
+
if (drmGetNodeTypeFromFd(tbm_bufmgr_fd) == DRM_NODE_RENDER) {
tbm_bufmgr_device_name = loader_get_device_name_for_fd(tbm_bufmgr_fd);
}
dri2_dpy->fd = loader_open_device(tbm_bufmgr_device_name);
- } else if (tbm_drm_helper_get_master_fd() >= 0) {
+ } else if ((master_fd = tbm_drm_helper_get_master_fd()) >= 0) {
+ close(master_fd);
// display server always has master_fd,
// so tbm_bufmgr_fd is the master_fd if it can get the tbm_master_fd.
tbm_bufmgr_device_name = loader_get_device_name_for_fd(tbm_bufmgr_fd);