arg.handle = bo_exynos->gem;
if (drmCommandWriteRead(bo_exynos->fd, DRM_EXYNOS_GEM_MAP, &arg,
sizeof(arg))) {
- TBM_ERR("Cannot map_dumb gem=%d\n", bo_exynos->gem);
+ TBM_ERR("Cannot map_exynos gem=%d\n", bo_exynos->gem);
return (tbm_bo_handle) NULL;
}
return NULL;
}
- if (tbm_backend_bufmgr_query_display_server(bufmgr, &err)) {
- bufmgr_exynos->fd = tbm_drm_helper_get_master_fd();
+ /* check the master_fd which already had opened */
+ bufmgr_exynos->fd = tbm_drm_helper_get_master_fd();
+ if (bufmgr_exynos->fd < 0) {
+ bufmgr_exynos->fd = _tbm_exynos_open_drm();
if (bufmgr_exynos->fd < 0) {
- bufmgr_exynos->fd = _tbm_exynos_open_drm();
- if (bufmgr_exynos->fd < 0) {
- 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(bufmgr_exynos->fd);
-
- bufmgr_exynos->device_name = drmGetDeviceNameFromFd(bufmgr_exynos->fd);
- if (!bufmgr_exynos->device_name) {
- TBM_ERR("fail to get device name!\n");
- tbm_drm_helper_unset_tbm_master_fd();
+ TBM_ERR("fail to open drm!\n");
if (error)
*error = TBM_ERROR_INVALID_OPERATION;
- goto fail_get_device_name;
+ goto fail_open_drm;
}
- } else {
+
+ if (drmIsMaster(bufmgr_exynos->fd)) {
+ tbm_drm_helper_set_tbm_master_fd(bufmgr_exynos->fd);
+
+ bufmgr_exynos->device_name = drmGetDeviceNameFromFd(bufmgr_exynos->fd);
+ if (!bufmgr_exynos->device_name) {
+ TBM_ERR("fail to get device name!\n");
+ tbm_drm_helper_unset_tbm_master_fd();
+ if (error)
+ *error = TBM_ERROR_INVALID_OPERATION;
+ goto fail_get_device_name;
+ }
+ TBM_INFO("This is Master FD(%d) from open_drm.", bufmgr_exynos->fd);
+ } else {
+ /* close the fd and get the authenticated fd from the master fd */
+ close(bufmgr_exynos->fd);
#ifdef USE_RENDER_NODE
- bufmgr_exynos->fd = _get_render_node(0);
+ bufmgr_exynos->fd = _get_render_node(0);
#else
- bufmgr_exynos->fd = -1;
+ bufmgr_exynos->fd = -1;
#endif
- if (bufmgr_exynos->fd < 0) {
+ /* get the authenticated drm fd from the master fd */
if (!tbm_drm_helper_get_auth_info(&(bufmgr_exynos->fd), &(bufmgr_exynos->device_name), NULL)) {
TBM_ERR("fail to get auth drm info!\n");
if (error)
*error = TBM_ERROR_INVALID_OPERATION;
goto fail_get_auth_info;
}
- tbm_drm_helper_set_fd(bufmgr_exynos->fd);
+ TBM_INFO("This is Authenticated FD(%d)", bufmgr_exynos->fd);
+ }
+ } else {
+ bufmgr_exynos->device_name = drmGetDeviceNameFromFd(bufmgr_exynos->fd);
+ if (!bufmgr_exynos->device_name) {
+ TBM_ERR("fail to get device name!\n");
+ tbm_drm_helper_unset_tbm_master_fd();
+ if (error)
+ *error = TBM_ERROR_INVALID_OPERATION;
+ goto fail_get_device_name;
}
+ TBM_INFO("This is Master FD from tbm_drm_helper_get_master_fd(%d)", bufmgr_exynos->fd);
}
+ tbm_drm_helper_set_fd(bufmgr_exynos->fd);
//Check if the tbm manager supports dma fence or not.
fp = open("/sys/module/dmabuf_sync/parameters/enabled", O_RDONLY);
if (bufmgr_exynos->hashBos)
drmHashDestroy(bufmgr_exynos->hashBos);
fail_init_cache_state:
- if (tbm_backend_bufmgr_query_display_server(bufmgr, &err))
+ if (tbm_drm_helper_get_master_fd() >= 0)
tbm_drm_helper_unset_tbm_master_fd();
else
tbm_drm_helper_unset_fd();