Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 473313d1 authored by Meera Gande's avatar Meera Gande Committed by Gerrit - the friendly Code Review server
Browse files

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: default avatarMeera Gande <mgande@codeaurora.org>
parent 7eaa9dab
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -3101,12 +3101,18 @@ static int msm_isp_start_axi_stream(struct vfe_device *vfe_dev_ioctl,
		return -EINVAL;

	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++) {
		if (stream_cfg_cmd->stream_handle[i] == 0)
			continue;
		stream_info = msm_isp_get_stream_common_data(vfe_dev_ioctl,
			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)
			src_state = axi_data->src_info[
				SRC_TO_INTF(stream_info->stream_src)].active;
@@ -3114,6 +3120,7 @@ static int msm_isp_start_axi_stream(struct vfe_device *vfe_dev_ioctl,
		else {
			ISP_DBG("%s: invalid src info index\n", __func__);
			rc = -EINVAL;
			mutex_unlock(&vfe_dev_ioctl->buf_mgr->lock);
			goto error;
		}
		spin_lock_irqsave(&stream_info->lock, flags);
@@ -3125,6 +3132,7 @@ static int msm_isp_start_axi_stream(struct vfe_device *vfe_dev_ioctl,
		}
		if (rc) {
			spin_unlock_irqrestore(&stream_info->lock, flags);
			mutex_unlock(&vfe_dev_ioctl->buf_mgr->lock);
			goto error;
		}

@@ -3147,6 +3155,7 @@ static int msm_isp_start_axi_stream(struct vfe_device *vfe_dev_ioctl,
				HANDLE_TO_IDX(
				stream_cfg_cmd->stream_handle[i]));
			spin_unlock_irqrestore(&stream_info->lock, flags);
			mutex_unlock(&vfe_dev_ioctl->buf_mgr->lock);
			goto error;
		}
		for (k = 0; k < stream_info->num_isp; k++) {
@@ -3205,6 +3214,7 @@ static int msm_isp_start_axi_stream(struct vfe_device *vfe_dev_ioctl,
		spin_unlock_irqrestore(&stream_info->lock, flags);
		streams[num_streams++] = stream_info;
	}
	mutex_unlock(&vfe_dev_ioctl->buf_mgr->lock);

	for (i = 0; i < MAX_VFE; i++) {
		vfe_dev = update_vfes[i];
+4 −0
Original line number Diff line number Diff line
@@ -1102,6 +1102,7 @@ static int msm_isp_start_stats_stream(struct vfe_device *vfe_dev_ioctl,
	struct vfe_device *vfe_dev;

	msm_isp_get_timestamp(&timestamp, vfe_dev_ioctl);
	mutex_lock(&vfe_dev_ioctl->buf_mgr->lock);

	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) {
			spin_unlock_irqrestore(&stream_info->lock, flags);
			mutex_unlock(&vfe_dev_ioctl->buf_mgr->lock);
			goto error;
		}
		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) {
			spin_unlock_irqrestore(&stream_info->lock, flags);
			pr_err("%s: No buffer for stream%d\n", __func__, idx);
			mutex_unlock(&vfe_dev_ioctl->buf_mgr->lock);
			return rc;
		}
		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);
		streams[num_stream++] = stream_info;
	}
	mutex_unlock(&vfe_dev_ioctl->buf_mgr->lock);

	for (k = 0; k < MAX_VFE; k++) {
		if (!update_vfes[k] || num_active_streams[k])
+0 −4
Original line number Diff line number Diff line
@@ -895,9 +895,7 @@ static long msm_isp_ioctl_unlocked(struct v4l2_subdev *sd,
	case VIDIOC_MSM_ISP_CFG_STREAM:
		mutex_lock(&vfe_dev->core_mutex);
		MSM_ISP_DUAL_VFE_MUTEX_LOCK(vfe_dev);
		mutex_lock(&vfe_dev->buf_mgr->lock);
		rc = msm_isp_cfg_axi_stream(vfe_dev, arg);
		mutex_unlock(&vfe_dev->buf_mgr->lock);
		MSM_ISP_DUAL_VFE_MUTEX_UNLOCK(vfe_dev);
		mutex_unlock(&vfe_dev->core_mutex);
		break;
@@ -1014,9 +1012,7 @@ static long msm_isp_ioctl_unlocked(struct v4l2_subdev *sd,
	case VIDIOC_MSM_ISP_CFG_STATS_STREAM:
		mutex_lock(&vfe_dev->core_mutex);
		MSM_ISP_DUAL_VFE_MUTEX_LOCK(vfe_dev);
		mutex_lock(&vfe_dev->buf_mgr->lock);
		rc = msm_isp_cfg_stats_stream(vfe_dev, arg);
		mutex_unlock(&vfe_dev->buf_mgr->lock);
		MSM_ISP_DUAL_VFE_MUTEX_UNLOCK(vfe_dev);
		mutex_unlock(&vfe_dev->core_mutex);
		break;