Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1666871

[PATCH v11 17/19] media: venus: vdec: add support for min buffers for capture

From Stanimir Varbanov <stanimir.varbanov@linaro.org>
Newsgroups linux.kernel
Subject [PATCH v11 17/19] media: venus: vdec: add support for min buffers for capture
Date 2017-06-15 18:40 +0200
Message-ID <tSFYn-4Nd-61@gated-at.bofh.it> (permalink)
References <tSFYl-4Nd-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


This adds support for V4L2_CID_MIN_BUFFERS_FOR_CAPTURE get control
in venus decoder, it is usable in case when the userspace wants
to know minimum capture buffers before calling request_buf for
capture queue in mem2mem drivers. Also this will fix an issue
found gstreamer v4l2videodec element, i.e. the video decoder
element cannot continue because the buffers are insufficient.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
---
 drivers/media/platform/qcom/venus/vdec.c       |  7 +++++++
 drivers/media/platform/qcom/venus/vdec_ctrls.c | 10 +++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c
index 594315b55b1f..eb0c1c51cfef 100644
--- a/drivers/media/platform/qcom/venus/vdec.c
+++ b/drivers/media/platform/qcom/venus/vdec.c
@@ -627,6 +627,12 @@ static int vdec_queue_setup(struct vb2_queue *q,
 						    inst->out_height);
 		inst->input_buf_size = sizes[0];
 		inst->num_input_bufs = *num_buffers;
+
+		ret = vdec_cap_num_buffers(inst, &num);
+		if (ret)
+			break;
+
+		inst->num_output_bufs = num;
 		break;
 	case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
 		*num_planes = inst->fmt_cap->num_planes;
@@ -951,6 +957,7 @@ static int vdec_open(struct file *file)
 
 	inst->core = core;
 	inst->session_type = VIDC_SESSION_TYPE_DEC;
+	inst->num_output_bufs = 1;
 
 	venus_helper_init_instance(inst);
 
diff --git a/drivers/media/platform/qcom/venus/vdec_ctrls.c b/drivers/media/platform/qcom/venus/vdec_ctrls.c
index 1045fc5b4925..032839bbc967 100644
--- a/drivers/media/platform/qcom/venus/vdec_ctrls.c
+++ b/drivers/media/platform/qcom/venus/vdec_ctrls.c
@@ -70,6 +70,9 @@ static int vdec_op_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
 	case V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER:
 		ctrl->val = ctr->post_loop_deb_mode;
 		break;
+	case V4L2_CID_MIN_BUFFERS_FOR_CAPTURE:
+		ctrl->val = inst->num_output_bufs;
+		break;
 	default:
 		return -EINVAL;
 	};
@@ -87,7 +90,7 @@ int vdec_ctrl_init(struct venus_inst *inst)
 	struct v4l2_ctrl *ctrl;
 	int ret;
 
-	ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 6);
+	ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 7);
 	if (ret)
 		return ret;
 
@@ -135,6 +138,11 @@ int vdec_ctrl_init(struct venus_inst *inst)
 	v4l2_ctrl_new_std(&inst->ctrl_handler, &vdec_ctrl_ops,
 		V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER, 0, 1, 1, 0);
 
+	ctrl = v4l2_ctrl_new_std(&inst->ctrl_handler, &vdec_ctrl_ops,
+		V4L2_CID_MIN_BUFFERS_FOR_CAPTURE, 1, 32, 1, 1);
+	if (ctrl)
+		ctrl->flags |= V4L2_CTRL_FLAG_VOLATILE;
+
 	ret = inst->ctrl_handler.error;
 	if (ret) {
 		v4l2_ctrl_handler_free(&inst->ctrl_handler);
-- 
2.7.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v11 00/19] Qualcomm video decoder/encoder driver Stanimir Varbanov <stanimir.varbanov@linaro.org> - 2017-06-15 18:40 +0200
  [PATCH v11 19/19] media: venus: enable building with COMPILE_TEST Stanimir Varbanov <stanimir.varbanov@linaro.org> - 2017-06-15 18:40 +0200
  [PATCH v11 05/19] media: venus: vdec: add video decoder files Stanimir Varbanov <stanimir.varbanov@linaro.org> - 2017-06-15 18:40 +0200
  [PATCH v11 17/19] media: venus: vdec: add support for min buffers for capture Stanimir Varbanov <stanimir.varbanov@linaro.org> - 2017-06-15 18:40 +0200
  [PATCH v11 14/19] media: venus: hfi_msgs: fix set but not used variables Stanimir Varbanov <stanimir.varbanov@linaro.org> - 2017-06-15 18:40 +0200
  [PATCH v11 15/19] media: venus: vdec: fix compile error in vdec_close Stanimir Varbanov <stanimir.varbanov@linaro.org> - 2017-06-15 18:40 +0200
  [PATCH v11 09/19] media: venus: enable building of Venus video driver Stanimir Varbanov <stanimir.varbanov@linaro.org> - 2017-06-15 18:40 +0200
  [PATCH v11 13/19] media: venus: hfi_venus: fix variable dereferenced before check Stanimir Varbanov <stanimir.varbanov@linaro.org> - 2017-06-15 18:40 +0200
  [PATCH v11 01/19] media: v4l2-mem2mem: extend m2m APIs for more accurate buffer management Stanimir Varbanov <stanimir.varbanov@linaro.org> - 2017-06-15 18:40 +0200
  [PATCH v11 18/19] media: venus: update firmware path with linux-firmware place Stanimir Varbanov <stanimir.varbanov@linaro.org> - 2017-06-15 18:40 +0200
  [PATCH v11 11/19] media: venus: hfi_cmds: fix variable dereferenced before check Stanimir Varbanov <stanimir.varbanov@linaro.org> - 2017-06-15 18:40 +0200
  [PATCH v11 02/19] doc: DT: venus: binding document for Qualcomm video driver Stanimir Varbanov <stanimir.varbanov@linaro.org> - 2017-06-15 18:50 +0200

csiph-web