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: I7f57c8befc85c105a5690ac71e0276f42b9f1929
Signed-off-by: Meera Gande <mgande@codeaurora.org>
This commit is contained in:
Meera Gande 2018-04-13 16:19:34 +05:30
parent 1920040bec
commit bf3dafc5ed
3 changed files with 15 additions and 5 deletions

View file

@ -3095,12 +3095,18 @@ static int msm_isp_start_axi_stream(struct vfe_device *vfe_dev_ioctl,
return -EINVAL; return -EINVAL;
msm_isp_get_timestamp(&timestamp, vfe_dev_ioctl); msm_isp_get_timestamp(&timestamp, vfe_dev_ioctl);
mutex_lock(&vfe_dev_ioctl->buf_mgr->lock);
for (i = 0; i < stream_cfg_cmd->num_streams; i++) { for (i = 0; i < stream_cfg_cmd->num_streams; i++) {
if (stream_cfg_cmd->stream_handle[i] == 0) if (stream_cfg_cmd->stream_handle[i] == 0)
continue; continue;
stream_info = msm_isp_get_stream_common_data(vfe_dev_ioctl, stream_info = msm_isp_get_stream_common_data(vfe_dev_ioctl,
HANDLE_TO_IDX(stream_cfg_cmd->stream_handle[i])); HANDLE_TO_IDX(stream_cfg_cmd->stream_handle[i]));
if (!stream_info) {
pr_err("%s: stream_info is NULL", __func__);
mutex_unlock(&vfe_dev_ioctl->buf_mgr->lock);
return -EINVAL;
}
if (SRC_TO_INTF(stream_info->stream_src) < VFE_SRC_MAX) if (SRC_TO_INTF(stream_info->stream_src) < VFE_SRC_MAX)
src_state = axi_data->src_info[ src_state = axi_data->src_info[
SRC_TO_INTF(stream_info->stream_src)].active; SRC_TO_INTF(stream_info->stream_src)].active;
@ -3108,6 +3114,7 @@ static int msm_isp_start_axi_stream(struct vfe_device *vfe_dev_ioctl,
else { else {
ISP_DBG("%s: invalid src info index\n", __func__); ISP_DBG("%s: invalid src info index\n", __func__);
rc = -EINVAL; rc = -EINVAL;
mutex_unlock(&vfe_dev_ioctl->buf_mgr->lock);
goto error; goto error;
} }
spin_lock_irqsave(&stream_info->lock, flags); spin_lock_irqsave(&stream_info->lock, flags);
@ -3119,6 +3126,7 @@ static int msm_isp_start_axi_stream(struct vfe_device *vfe_dev_ioctl,
} }
if (rc) { if (rc) {
spin_unlock_irqrestore(&stream_info->lock, flags); spin_unlock_irqrestore(&stream_info->lock, flags);
mutex_unlock(&vfe_dev_ioctl->buf_mgr->lock);
goto error; goto error;
} }
@ -3141,6 +3149,7 @@ static int msm_isp_start_axi_stream(struct vfe_device *vfe_dev_ioctl,
HANDLE_TO_IDX( HANDLE_TO_IDX(
stream_cfg_cmd->stream_handle[i])); stream_cfg_cmd->stream_handle[i]));
spin_unlock_irqrestore(&stream_info->lock, flags); spin_unlock_irqrestore(&stream_info->lock, flags);
mutex_unlock(&vfe_dev_ioctl->buf_mgr->lock);
goto error; goto error;
} }
for (k = 0; k < stream_info->num_isp; k++) { for (k = 0; k < stream_info->num_isp; k++) {
@ -3199,6 +3208,7 @@ static int msm_isp_start_axi_stream(struct vfe_device *vfe_dev_ioctl,
spin_unlock_irqrestore(&stream_info->lock, flags); spin_unlock_irqrestore(&stream_info->lock, flags);
streams[num_streams++] = stream_info; streams[num_streams++] = stream_info;
} }
mutex_unlock(&vfe_dev_ioctl->buf_mgr->lock);
for (i = 0; i < MAX_VFE; i++) { for (i = 0; i < MAX_VFE; i++) {
vfe_dev = update_vfes[i]; vfe_dev = update_vfes[i];

View file

@ -1102,6 +1102,7 @@ static int msm_isp_start_stats_stream(struct vfe_device *vfe_dev_ioctl,
struct vfe_device *vfe_dev; struct vfe_device *vfe_dev;
msm_isp_get_timestamp(&timestamp, vfe_dev_ioctl); msm_isp_get_timestamp(&timestamp, vfe_dev_ioctl);
mutex_lock(&vfe_dev_ioctl->buf_mgr->lock);
num_stats_comp_mask = num_stats_comp_mask =
vfe_dev_ioctl->hw_info->stats_hw_info->num_stats_comp_mask; vfe_dev_ioctl->hw_info->stats_hw_info->num_stats_comp_mask;
@ -1120,6 +1121,7 @@ static int msm_isp_start_stats_stream(struct vfe_device *vfe_dev_ioctl,
} }
if (rc) { if (rc) {
spin_unlock_irqrestore(&stream_info->lock, flags); spin_unlock_irqrestore(&stream_info->lock, flags);
mutex_unlock(&vfe_dev_ioctl->buf_mgr->lock);
goto error; goto error;
} }
rc = msm_isp_init_stats_ping_pong_reg( rc = msm_isp_init_stats_ping_pong_reg(
@ -1127,6 +1129,7 @@ static int msm_isp_start_stats_stream(struct vfe_device *vfe_dev_ioctl,
if (rc < 0) { if (rc < 0) {
spin_unlock_irqrestore(&stream_info->lock, flags); spin_unlock_irqrestore(&stream_info->lock, flags);
pr_err("%s: No buffer for stream%d\n", __func__, idx); pr_err("%s: No buffer for stream%d\n", __func__, idx);
mutex_unlock(&vfe_dev_ioctl->buf_mgr->lock);
return rc; return rc;
} }
init_completion(&stream_info->active_comp); init_completion(&stream_info->active_comp);
@ -1161,6 +1164,7 @@ static int msm_isp_start_stats_stream(struct vfe_device *vfe_dev_ioctl,
stats_data->num_active_stream); stats_data->num_active_stream);
streams[num_stream++] = stream_info; streams[num_stream++] = stream_info;
} }
mutex_unlock(&vfe_dev_ioctl->buf_mgr->lock);
for (k = 0; k < MAX_VFE; k++) { for (k = 0; k < MAX_VFE; k++) {
if (!update_vfes[k] || num_active_streams[k]) if (!update_vfes[k] || num_active_streams[k])

View file

@ -897,9 +897,7 @@ static long msm_isp_ioctl_unlocked(struct v4l2_subdev *sd,
case VIDIOC_MSM_ISP_CFG_STREAM: case VIDIOC_MSM_ISP_CFG_STREAM:
mutex_lock(&vfe_dev->core_mutex); mutex_lock(&vfe_dev->core_mutex);
MSM_ISP_DUAL_VFE_MUTEX_LOCK(vfe_dev); MSM_ISP_DUAL_VFE_MUTEX_LOCK(vfe_dev);
mutex_lock(&vfe_dev->buf_mgr->lock);
rc = msm_isp_cfg_axi_stream(vfe_dev, arg); rc = msm_isp_cfg_axi_stream(vfe_dev, arg);
mutex_unlock(&vfe_dev->buf_mgr->lock);
MSM_ISP_DUAL_VFE_MUTEX_UNLOCK(vfe_dev); MSM_ISP_DUAL_VFE_MUTEX_UNLOCK(vfe_dev);
mutex_unlock(&vfe_dev->core_mutex); mutex_unlock(&vfe_dev->core_mutex);
break; break;
@ -1016,9 +1014,7 @@ static long msm_isp_ioctl_unlocked(struct v4l2_subdev *sd,
case VIDIOC_MSM_ISP_CFG_STATS_STREAM: case VIDIOC_MSM_ISP_CFG_STATS_STREAM:
mutex_lock(&vfe_dev->core_mutex); mutex_lock(&vfe_dev->core_mutex);
MSM_ISP_DUAL_VFE_MUTEX_LOCK(vfe_dev); MSM_ISP_DUAL_VFE_MUTEX_LOCK(vfe_dev);
mutex_lock(&vfe_dev->buf_mgr->lock);
rc = msm_isp_cfg_stats_stream(vfe_dev, arg); rc = msm_isp_cfg_stats_stream(vfe_dev, arg);
mutex_unlock(&vfe_dev->buf_mgr->lock);
MSM_ISP_DUAL_VFE_MUTEX_UNLOCK(vfe_dev); MSM_ISP_DUAL_VFE_MUTEX_UNLOCK(vfe_dev);
mutex_unlock(&vfe_dev->core_mutex); mutex_unlock(&vfe_dev->core_mutex);
break; break;