+ if (hal_tbm_backend_has_drm_device(hal_backend, &ret)) {
+ auth_drm_fd = hal_tbm_backend_get_master_drm_fd(hal_backend, &ret);
+ if (auth_drm_fd < 0) {
+ TBM_INFO("tbm_backend has no master drm_fd.");
+
+ auth_drm_fd = tbm_drm_helper_get_master_fd();
+ if (auth_drm_fd < 0) {
+ TBM_INFO("libtbm requests an authenticated drm_fd to a process(display server).");
+ if (!tbm_drm_helper_get_auth_info(&auth_drm_fd, NULL, NULL)) {
+ TBM_ERR("get auth drm_fd fail");
+ goto get_backend_fail;
+ }
+ } else {
+ TBM_INFO("libtbm gets a master drm_fd from libtdm via tbm_drm_helper.");
+ }
+
+ TBM_INFO("libtbm sends a master drm_fd as an authentiated drm_fd to tbm_backend.");
+ ret = hal_tbm_backend_set_authenticated_drm_fd(hal_backend, auth_drm_fd);
+ if (ret != HAL_TBM_ERROR_NONE) {
+ TBM_ERR("hal_tbm_backend_set_authenticated_drm_fd failed.");
+ goto get_backend_fail;
+ }
+ } else {
+ TBM_INFO("tbm_backend has a master drm_fd.");
+
+ tbm_drm_helper_set_tbm_master_fd(auth_drm_fd);
+ }
+ tbm_drm_helper_set_fd(auth_drm_fd);
+ }
+