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

Commit 26fb0dc9 authored by Rajakumar Govindaram's avatar Rajakumar Govindaram Committed by Shuzhen Wang
Browse files

msm: camera2: cpp: Support zero buffer streamon



The streamon can be used without any buffer with support
for deferred buffer allocation.

Change-Id: I9692d912f8748572a048811e04e610c89489447e
Signed-off-by: default avatarRajakumar Govindaram <rajakuma@codeaurora.org>
Signed-off-by: default avatarShuzhen Wang <shuzhenw@codeaurora.org>
parent 8ae65e26
Loading
Loading
Loading
Loading
+24 −25
Original line number Diff line number Diff line
@@ -2824,9 +2824,11 @@ long msm_cpp_subdev_ioctl(struct v4l2_subdev *sd,
	case VIDIOC_MSM_CPP_APPEND_STREAM_BUFF_INFO:
	case VIDIOC_MSM_CPP_ENQUEUE_STREAM_BUFF_INFO: {
		uint32_t j;
		struct msm_cpp_stream_buff_info_t *u_stream_buff_info;
		struct msm_cpp_stream_buff_info_t *u_stream_buff_info = NULL;
		struct msm_cpp_stream_buff_info_t k_stream_buff_info;
		struct msm_cpp_buff_queue_info_t *buff_queue_info;
		struct msm_cpp_buff_queue_info_t *buff_queue_info = NULL;

		memset(&k_stream_buff_info, 0, sizeof(k_stream_buff_info));
		CPP_DBG("VIDIOC_MSM_CPP_ENQUEUE_STREAM_BUFF_INFO\n");
		if (sizeof(struct msm_cpp_stream_buff_info_t) !=
			ioctl_ptr->len) {
@@ -2849,13 +2851,6 @@ long msm_cpp_subdev_ioctl(struct v4l2_subdev *sd,
			mutex_unlock(&cpp_dev->mutex);
			return -EINVAL;
		}
		if (u_stream_buff_info->num_buffs == 0) {
			pr_err("%s:%d: Invalid number of buffers\n", __func__,
				__LINE__);
			kfree(u_stream_buff_info);
			mutex_unlock(&cpp_dev->mutex);
			return -EINVAL;
		}
		k_stream_buff_info.num_buffs = u_stream_buff_info->num_buffs;
		k_stream_buff_info.identity = u_stream_buff_info->identity;

@@ -2867,11 +2862,14 @@ long msm_cpp_subdev_ioctl(struct v4l2_subdev *sd,
			return -EINVAL;
		}

		if (u_stream_buff_info->num_buffs != 0) {
			k_stream_buff_info.buffer_info =
				kzalloc(k_stream_buff_info.num_buffs *
			sizeof(struct msm_cpp_buffer_info_t), GFP_KERNEL);
				sizeof(struct msm_cpp_buffer_info_t),
				GFP_KERNEL);
			if (ZERO_OR_NULL_PTR(k_stream_buff_info.buffer_info)) {
			pr_err("%s:%d: malloc error\n", __func__, __LINE__);
				pr_err("%s:%d: malloc error\n",
					__func__, __LINE__);
				kfree(u_stream_buff_info);
				mutex_unlock(&cpp_dev->mutex);
				return -EINVAL;
@@ -2889,6 +2887,7 @@ long msm_cpp_subdev_ioctl(struct v4l2_subdev *sd,
				mutex_unlock(&cpp_dev->mutex);
				return -EINVAL;
			}
		}

		buff_queue_info = msm_cpp_get_buff_queue_entry(cpp_dev,
				(k_stream_buff_info.identity >> 16) & 0xFFFF,