[PATCH 3/3] Enable Request API for Capture Buffers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



- Removed restrictions from V4l2 Framework to allow
  request APIs on Capture buffers.

Change-Id: I9ba37e948eed027344ba2ceb7eb1ff117793ae31
Signed-off-by: Dikshita Agarwal <dikshita@xxxxxxxxxxxxxx>
---
 drivers/media/common/videobuf2/videobuf2-v4l2.c |  4 +---
 drivers/media/platform/qcom/venus/helpers.c     |  2 +-
 drivers/media/platform/qcom/venus/venc.c        |  6 ++++--
 drivers/media/v4l2-core/v4l2-mem2mem.c          | 17 +++++++++++------
 4 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/drivers/media/common/videobuf2/videobuf2-v4l2.c b/drivers/media/common/videobuf2/videobuf2-v4l2.c
index 5a9ba38..00f6970 100644
--- a/drivers/media/common/videobuf2/videobuf2-v4l2.c
+++ b/drivers/media/common/videobuf2/videobuf2-v4l2.c
@@ -424,9 +424,7 @@ static int vb2_queue_or_prepare_buf(struct vb2_queue *q, struct media_device *md
 	 * It's easy to forget this callback, but is it important to correctly
 	 * validate the 'field' value at QBUF time.
 	 */
-	if (WARN_ON((q->type == V4L2_BUF_TYPE_VIDEO_OUTPUT ||
-		     q->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) &&
-		    !q->ops->buf_out_validate))
+	if (WARN_ON(!q->ops->buf_out_validate))
 		return -EINVAL;
 
 	if (b->request_fd < 0) {
diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c
index c966c24..a27e9bf 100644
--- a/drivers/media/platform/qcom/venus/helpers.c
+++ b/drivers/media/platform/qcom/venus/helpers.c
@@ -609,7 +609,7 @@ void venus_helper_get_ts_metadata(struct venus_inst *inst, u64 timestamp_us,
 		fdata.filled_len = 0;
 		fdata.offset = 0;
 	}
-	if(req && type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
+	if(req)
 	{
 		ret = v4l2_ctrl_request_setup(req, &inst->ctrl_handler);
 		if (ret)
diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c
index 599cfae..10a07bc 100644
--- a/drivers/media/platform/qcom/venus/venc.c
+++ b/drivers/media/platform/qcom/venus/venc.c
@@ -1085,8 +1085,8 @@ static void venc_buf_done(struct venus_inst *inst, unsigned int buf_type,
 	} else {
 		vbuf->sequence = inst->sequence_out++;
 	}
-	if (buf_type == HFI_BUFFER_INPUT)
-		v4l2_ctrl_request_complete(vbuf->vb2_buf.req_obj.req, &inst->ctrl_handler);
+	//if (buf_type == HFI_BUFFER_INPUT)
+	v4l2_ctrl_request_complete(vbuf->vb2_buf.req_obj.req, &inst->ctrl_handler);
 	v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_DONE);
 }
 
@@ -1146,6 +1146,8 @@ static int m2m_queue_init(void *priv, struct vb2_queue *src_vq,
 	dst_vq->allow_zero_bytesused = 1;
 	dst_vq->min_buffers_needed = 1;
 	dst_vq->dev = inst->core->dev;
+	dst_vq->supports_requests = 1;
+	dst_vq->requires_requests = 1;
 	dst_vq->lock = src_vq->lock;
 	ret = vb2_queue_init(dst_vq);
 	if (ret) {
diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c
index 19937dd..ffacb29 100644
--- a/drivers/media/v4l2-core/v4l2-mem2mem.c
+++ b/drivers/media/v4l2-core/v4l2-mem2mem.c
@@ -493,12 +493,12 @@ int v4l2_m2m_qbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
 	int ret;
 
 	vq = v4l2_m2m_get_vq(m2m_ctx, buf->type);
-	if (!V4L2_TYPE_IS_OUTPUT(vq->type) &&
+	/*if (!V4L2_TYPE_IS_OUTPUT(vq->type) &&
 	    (buf->flags & V4L2_BUF_FLAG_REQUEST_FD)) {
 		dprintk("%s: requests cannot be used with capture buffers\n",
 			__func__);
 		return -EPERM;
-	}
+	}*/
 	ret = vb2_qbuf(vq, vdev->v4l2_dev->mdev, buf);
 	if (!ret && !(buf->flags & V4L2_BUF_FLAG_IN_REQUEST))
 		v4l2_m2m_try_schedule(m2m_ctx);
@@ -1019,10 +1019,15 @@ void v4l2_m2m_request_queue(struct media_request *req)
 		if (vb2_request_object_is_buffer(obj)) {
 			/* Sanity checks */
 			vb = container_of(obj, struct vb2_buffer, req_obj);
-			WARN_ON(!V4L2_TYPE_IS_OUTPUT(vb->vb2_queue->type));
-			m2m_ctx_obj = container_of(vb->vb2_queue,
-						   struct v4l2_m2m_ctx,
-						   out_q_ctx.q);
+			//WARN_ON(!V4L2_TYPE_IS_OUTPUT(vb->vb2_queue->type));
+			if (V4L2_TYPE_IS_OUTPUT(vb->vb2_queue->type))
+				m2m_ctx_obj = container_of(vb->vb2_queue,
+						struct v4l2_m2m_ctx,
+						out_q_ctx.q);
+			else
+				m2m_ctx_obj = container_of(vb->vb2_queue,
+						struct v4l2_m2m_ctx,
+						cap_q_ctx.q);
 			WARN_ON(m2m_ctx && m2m_ctx_obj != m2m_ctx);
 			m2m_ctx = m2m_ctx_obj;
 		}
-- 
1.9.1




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux