mm-camera2:isp2: Release buffer lock after use

At start axi stream, we are acquiring the
buffer lock and releasing after completing
the stream configuration operations. In case
of live snapshot,this is causing the buffer
operations to halt and leading to sof freeze.

Change-Id: I2a3d05742e0cc8921787516c6d444937047c1fef
CRs-Fixed: 2149998
Signed-off-by: Meera Gande <mgande@codeaurora.org>
Signed-off-by: Vijay Kumar TM <vtmuni@codeaurora.org>
Signed-off-by: Darshan Kumsi Srinivasa <darssr@codeaurora.org>
This commit is contained in:
VijayaKumar T M 2018-04-24 12:44:13 +05:30 committed by syphyr
parent d6f20078ac
commit 8b050f4d00
3 changed files with 15 additions and 5 deletions

View File

@ -2399,9 +2399,11 @@ static int msm_isp_start_axi_stream(struct vfe_device *vfe_dev,
vfe_dev->axi_data.src_info[VFE_PIX_0].frame_id = 0;
}
mutex_lock(&vfe_dev->buf_mgr->lock);
for (i = 0; i < stream_cfg_cmd->num_streams; i++) {
if (HANDLE_TO_IDX(stream_cfg_cmd->stream_handle[i]) >=
VFE_AXI_SRC_MAX) {
mutex_unlock(&vfe_dev->buf_mgr->lock);
return -EINVAL;
}
stream_info = &axi_data->stream_info[
@ -2411,6 +2413,7 @@ static int msm_isp_start_axi_stream(struct vfe_device *vfe_dev,
SRC_TO_INTF(stream_info->stream_src)].active;
else {
ISP_DBG("%s: invalid src info index\n", __func__);
mutex_unlock(&vfe_dev->buf_mgr->lock);
return -EINVAL;
}
@ -2422,6 +2425,7 @@ static int msm_isp_start_axi_stream(struct vfe_device *vfe_dev,
pr_err("%s: No buffer for stream%d\n", __func__,
HANDLE_TO_IDX(
stream_cfg_cmd->stream_handle[i]));
mutex_unlock(&vfe_dev->buf_mgr->lock);
return rc;
}
@ -2468,6 +2472,7 @@ static int msm_isp_start_axi_stream(struct vfe_device *vfe_dev,
}
}
}
mutex_unlock(&vfe_dev->buf_mgr->lock);
msm_isp_update_stream_bandwidth(vfe_dev);
vfe_dev->hw_info->vfe_ops.axi_ops.reload_wm(vfe_dev,
vfe_dev->vfe_base, wm_reload_mask);

View File

@ -643,17 +643,23 @@ static int msm_isp_start_stats_stream(struct vfe_device *vfe_dev,
return -EINVAL;
}
mutex_lock(&vfe_dev->buf_mgr->lock);
num_stats_comp_mask =
vfe_dev->hw_info->stats_hw_info->num_stats_comp_mask;
rc = vfe_dev->hw_info->vfe_ops.stats_ops.check_streams(
stats_data->stream_info);
if (rc < 0)
if (rc < 0) {
pr_err("%s invalid streams\n", __func__);
mutex_unlock(&vfe_dev->buf_mgr->lock);
return rc;
}
for (i = 0; i < stream_cfg_cmd->num_streams; i++) {
idx = STATS_IDX(stream_cfg_cmd->stream_handle[i]);
if (idx >= vfe_dev->hw_info->stats_hw_info->num_stats_type) {
pr_err("%s Invalid stats index %d", __func__, idx);
mutex_unlock(&vfe_dev->buf_mgr->lock);
return -EINVAL;
}
@ -669,11 +675,13 @@ static int msm_isp_start_stats_stream(struct vfe_device *vfe_dev,
pr_err("%s: comp grp %d exceed max %d\n",
__func__, stream_info->composite_flag,
num_stats_comp_mask);
mutex_unlock(&vfe_dev->buf_mgr->lock);
return -EINVAL;
}
rc = msm_isp_init_stats_ping_pong_reg(vfe_dev, stream_info);
if (rc < 0) {
pr_err("%s: No buffer for stream%d\n", __func__, idx);
mutex_unlock(&vfe_dev->buf_mgr->lock);
return rc;
}
@ -695,6 +703,7 @@ static int msm_isp_start_stats_stream(struct vfe_device *vfe_dev,
stats_data->num_active_stream);
}
mutex_unlock(&vfe_dev->buf_mgr->lock);
if (vfe_dev->axi_data.src_info[VFE_PIX_0].active) {
rc = msm_isp_stats_wait_for_cfg_done(vfe_dev);

View File

@ -1055,9 +1055,7 @@ static long msm_isp_ioctl_unlocked(struct v4l2_subdev *sd,
break;
case VIDIOC_MSM_ISP_CFG_STREAM:
mutex_lock(&vfe_dev->core_mutex);
mutex_lock(&vfe_dev->buf_mgr->lock);
rc = msm_isp_cfg_axi_stream(vfe_dev, arg);
mutex_unlock(&vfe_dev->buf_mgr->lock);
mutex_unlock(&vfe_dev->core_mutex);
break;
case VIDIOC_MSM_ISP_AXI_HALT:
@ -1137,9 +1135,7 @@ static long msm_isp_ioctl_unlocked(struct v4l2_subdev *sd,
break;
case VIDIOC_MSM_ISP_CFG_STATS_STREAM:
mutex_lock(&vfe_dev->core_mutex);
mutex_lock(&vfe_dev->buf_mgr->lock);
rc = msm_isp_cfg_stats_stream(vfe_dev, arg);
mutex_unlock(&vfe_dev->buf_mgr->lock);
mutex_unlock(&vfe_dev->core_mutex);
break;
case VIDIOC_MSM_ISP_UPDATE_STATS_STREAM: