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

Commit 482f1cf5 authored by Iliya Varadzhakov's avatar Iliya Varadzhakov
Browse files

msm: cpp: Create buffer queue only if it is missing



When CPP kernel driver receives IOCTL command
VIDIOC_MSM_CPP_ENQUEUE_STREAM_BUFF_INFO it crates new
queue for the current stream. If such command is received
more than once, CPP driver will create more than one queue.
To avoid this, it will check first, whether the queue is
not already created and allocate it if necessary.

Change-Id: I1eebb32cecb9a0a9a9d4e821ea946df6803ec5a0
Signed-off-by: default avatarIliya Varadzhakov <ivarad@codeaurora.org>
parent 5eb34949
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -1775,6 +1775,7 @@ long msm_cpp_subdev_ioctl(struct v4l2_subdev *sd,
	case VIDIOC_MSM_CPP_ENQUEUE_STREAM_BUFF_INFO: {
		struct msm_cpp_stream_buff_info_t *u_stream_buff_info;
		struct msm_cpp_stream_buff_info_t k_stream_buff_info;
		struct msm_cpp_buff_queue_info_t *buff_queue_info;
		CPP_DBG("VIDIOC_MSM_CPP_ENQUEUE_STREAM_BUFF_INFO\n");
		if (sizeof(struct msm_cpp_stream_buff_info_t) !=
			ioctl_ptr->len) {
@@ -1848,7 +1849,11 @@ long msm_cpp_subdev_ioctl(struct v4l2_subdev *sd,
			return -EINVAL;
		}

		if (cmd != VIDIOC_MSM_CPP_APPEND_STREAM_BUFF_INFO) {
		buff_queue_info = msm_cpp_get_buff_queue_entry(cpp_dev,
				(k_stream_buff_info.identity >> 16) & 0xFFFF,
				k_stream_buff_info.identity & 0xFFFF);

		if (buff_queue_info == NULL) {
			rc = msm_cpp_add_buff_queue_entry(cpp_dev,
				((k_stream_buff_info.identity >> 16) & 0xFFFF),
				(k_stream_buff_info.identity & 0xFFFF));
@@ -1866,7 +1871,7 @@ long msm_cpp_subdev_ioctl(struct v4l2_subdev *sd,
			msm_cpp_clean_queue(cpp_dev);
		}

		if (cmd != VIDIOC_MSM_CPP_APPEND_STREAM_BUFF_INFO) {
		if (buff_queue_info == NULL) {
			cpp_dev->stream_cnt++;
			CPP_DBG("stream_cnt:%d\n", cpp_dev->stream_cnt);
		}