return NULL;
}
- if (tbm_backend_bufmgr_query_display_server(bufmgr, &err)) {
- drm_fd = tbm_drm_helper_get_master_fd();
- if (drm_fd < 0)
- drm_fd = _tbm_vigs_open_drm();
-
+ /* check the master_fd which already had opened */
+ drm_fd = tbm_drm_helper_get_master_fd();
+ if (drm_fd < 0) {
+ drm_fd = _tbm_vigs_open_drm();
if (drm_fd < 0) {
- TBM_ERR("vigs drm device failed");
+ TBM_ERR("fail to open drm!\n");
if (error)
*error = TBM_ERROR_INVALID_OPERATION;
goto fail_open_drm;
}
- tbm_drm_helper_set_tbm_master_fd(drm_fd);
-
- } else {
- if (!tbm_drm_helper_get_auth_info(&drm_fd, NULL, NULL)) {
- TBM_ERR("tbm_drm_helper_get_auth_info failed");
- if (error)
- *error = TBM_ERROR_INVALID_OPERATION;
- goto fail_get_auth_info;
+ if (drmIsMaster(drm_fd)) {
+ tbm_drm_helper_set_tbm_master_fd(drm_fd);
+ TBM_INFO("This is Master FD(%d) from open_drm.", drm_fd);
+ } else {
+ /* close the fd and get the authenticated fd from the master fd */
+ close(drm_fd);
+ drm_fd = -1;
+
+ /* get the authenticated drm fd from the master fd */
+ if (!tbm_drm_helper_get_auth_info(&(drm_fd), NULL, NULL)) {
+ TBM_ERR("fail to get auth drm info!\n");
+ if (error)
+ *error = TBM_ERROR_INVALID_OPERATION;
+ goto fail_get_auth_info;
+ }
+ TBM_INFO("This is Authenticated FD(%d)", drm_fd);
}
+ } else {
+ TBM_INFO("This is Master FD from tbm_drm_helper_get_master_fd(%d)", drm_fd);
}
+ tbm_drm_helper_set_fd(drm_fd);
ret = vigs_drm_device_create(drm_fd, &drm_dev);
if (ret != 0) {
fail_alloc_bufmgr_func:
vigs_drm_device_destroy(drm_dev);
fail_create_vigs_drm_device:
- if (tbm_backend_bufmgr_query_display_server(bufmgr, &err))
+ if (tbm_drm_helper_get_master_fd() >= 0)
tbm_drm_helper_unset_tbm_master_fd();
if (drm_fd >= 0)
close(drm_fd);