diff options
author | SooChan Lim <sc1.lim@samsung.com> | 2020-05-27 19:29:23 +0900 |
---|---|---|
committer | SooChan Lim <sc1.lim@samsung.com> | 2020-05-28 15:12:04 +0900 |
commit | f7459b3f69dc9bf81e217dea71bc4140e19d1d87 (patch) | |
tree | 290e7c24639b99f9e7562ddf415edfd1aa8daeaf | |
parent | 1bf81a10a20317840818e080408e1104e79ee54c (diff) | |
download | libtbm-vigs-f7459b3f69dc9bf81e217dea71bc4140e19d1d87.tar.gz libtbm-vigs-f7459b3f69dc9bf81e217dea71bc4140e19d1d87.tar.bz2 libtbm-vigs-f7459b3f69dc9bf81e217dea71bc4140e19d1d87.zip |
remove the uset of tbm_backend_bufmgr_query_display_server
The backend has to use the drmIsMaster() to check if the drm_fd
is the master fd instead of tbm_backend_bufmgr_query_display_server().
Change-Id: I9eee3239ad5fe2a6fc7514ae156f7eff191f402c
-rwxr-xr-x | src/tbm_bufmgr_vigs.c | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/src/tbm_bufmgr_vigs.c b/src/tbm_bufmgr_vigs.c index e7ab5c9..7cc4957 100755 --- a/src/tbm_bufmgr_vigs.c +++ b/src/tbm_bufmgr_vigs.c @@ -822,28 +822,38 @@ tbm_vigs_init(tbm_bufmgr bufmgr, tbm_error_e *error) 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) { @@ -923,7 +933,7 @@ fail_register_bufmgr_func: 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); |