// else if (plane_idx == 1)
{
_offset = _size;
- _pitch = SIZE_ALIGN(width , TBM_SURFACE_ALIGNMENT_PITCH_YUV / 2);
+ _pitch = SIZE_ALIGN(width , TBM_SURFACE_ALIGNMENT_PITCH_YUV);
_align_height = SIZE_ALIGN(height / 2, TBM_SURFACE_ALIGNMENT_PITCH_YUV);
_size = SIZE_ALIGN(_pitch * _align_height, TBM_SURFACE_ALIGNMENT_PLANE);
_bo_idx = 0;
//else if( plane_idx ==1 )
{
_offset += _size;
- _pitch = SIZE_ALIGN(width, TBM_SURFACE_ALIGNMENT_PITCH_YUV / 2);
+ _pitch = SIZE_ALIGN(width, TBM_SURFACE_ALIGNMENT_PITCH_YUV);
_size = SIZE_ALIGN(_pitch * height, TBM_SURFACE_ALIGNMENT_PLANE);
_bo_idx = 0;
}
tbm_backend_bo_func *bo_func = NULL;
int fp;
tbm_error_e err;
+ int set_master = 0;
if (!bufmgr) {
TBM_ERR("bufmgr is null.\n");
return NULL;
}
- if (tbm_backend_bufmgr_query_display_server(bufmgr, &err)) {
- bufmgr_sprd->fd = tbm_drm_helper_get_master_fd();
+ /* check the master_fd which already had opened */
+ bufmgr_sprd->fd = tbm_drm_helper_get_master_fd();
+ if (bufmgr_sprd->fd < 0) {
+ bufmgr_sprd->fd = _tbm_sprd_open_drm();
if (bufmgr_sprd->fd < 0) {
- bufmgr_sprd->fd = _tbm_sprd_open_drm();
- if (bufmgr_sprd->fd < 0) {
- TBM_ERR("fail to open drm!\n");
+ TBM_ERR("fail to open drm!\n");
+ if (error)
+ *error = TBM_ERROR_INVALID_OPERATION;
+ goto fail_open_drm;
+ }
+
+ if (drmIsMaster(bufmgr_sprd->fd)) {
+ tbm_drm_helper_set_tbm_master_fd(bufmgr_sprd->fd);
+ set_master = 1;
+
+ bufmgr_sprd->device_name = drmGetDeviceNameFromFd(bufmgr_sprd->fd);
+ if (!bufmgr_sprd->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_sprd->fd);
+ } else {
+ /* close the fd and get the authenticated fd from the master fd */
+ close(bufmgr_sprd->fd);
+ bufmgr_sprd->fd = -1;
+
+ /* get the authenticated drm fd from the master fd */
+ if (!tbm_drm_helper_get_auth_info(&(bufmgr_sprd->fd), &(bufmgr_sprd->device_name), NULL)) {
+ TBM_ERR("fail to get auth drm info!\n");
if (error)
*error = TBM_ERROR_INVALID_OPERATION;
- goto fail_open_drm;
+ goto fail_get_auth_info;
}
+ TBM_INFO("This is Authenticated FD(%d)", bufmgr_sprd->fd);
}
-
- tbm_drm_helper_set_tbm_master_fd(bufmgr_sprd->fd);
-
+ } else {
bufmgr_sprd->device_name = drmGetDeviceNameFromFd(bufmgr_sprd->fd);
if (!bufmgr_sprd->device_name) {
TBM_ERR("fail to get device name!\n");
*error = TBM_ERROR_INVALID_OPERATION;
goto fail_get_device_name;
}
- } else {
- if (!tbm_drm_helper_get_auth_info(&(bufmgr_sprd->fd), &(bufmgr_sprd->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_INFO("This is Master FD from tbm_drm_helper_get_master_fd(%d)", bufmgr_sprd->fd);
}
tbm_drm_helper_set_fd(bufmgr_sprd->fd);
if (bufmgr_sprd->hashBos)
drmHashDestroy(bufmgr_sprd->hashBos);
fail_init_cache_state:
- if (tbm_backend_bufmgr_query_display_server(bufmgr, &err))
+ if (set_master)
tbm_drm_helper_unset_tbm_master_fd();
tbm_drm_helper_unset_fd();
if (bufmgr_sprd->device_name)
tbm_backend_module tbm_backend_module_data = {
"sprd",
"Samsung",
- TBM_BACKEND_ABI_VERSION_2_0,
+ TBM_BACKEND_ABI_VERSION_3_0,
tbm_sprd_init,
tbm_sprd_deinit
};