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

Commit ebebc593 authored by Stanimir Varbanov's avatar Stanimir Varbanov Committed by Mauro Carvalho Chehab
Browse files

[media] media: venus: vdec: add support for min buffers for capture



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: default avatarStanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent c3eb9e51
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -627,6 +627,12 @@ static int vdec_queue_setup(struct vb2_queue *q,
						    inst->out_height);
						    inst->out_height);
		inst->input_buf_size = sizes[0];
		inst->input_buf_size = sizes[0];
		inst->num_input_bufs = *num_buffers;
		inst->num_input_bufs = *num_buffers;

		ret = vdec_cap_num_buffers(inst, &num);
		if (ret)
			break;

		inst->num_output_bufs = num;
		break;
		break;
	case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
	case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
		*num_planes = inst->fmt_cap->num_planes;
		*num_planes = inst->fmt_cap->num_planes;
@@ -951,6 +957,7 @@ static int vdec_open(struct file *file)


	inst->core = core;
	inst->core = core;
	inst->session_type = VIDC_SESSION_TYPE_DEC;
	inst->session_type = VIDC_SESSION_TYPE_DEC;
	inst->num_output_bufs = 1;


	venus_helper_init_instance(inst);
	venus_helper_init_instance(inst);


+9 −1
Original line number Original line Diff line number Diff line
@@ -70,6 +70,9 @@ static int vdec_op_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
	case V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER:
	case V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER:
		ctrl->val = ctr->post_loop_deb_mode;
		ctrl->val = ctr->post_loop_deb_mode;
		break;
		break;
	case V4L2_CID_MIN_BUFFERS_FOR_CAPTURE:
		ctrl->val = inst->num_output_bufs;
		break;
	default:
	default:
		return -EINVAL;
		return -EINVAL;
	};
	};
@@ -87,7 +90,7 @@ int vdec_ctrl_init(struct venus_inst *inst)
	struct v4l2_ctrl *ctrl;
	struct v4l2_ctrl *ctrl;
	int ret;
	int ret;


	ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 6);
	ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 7);
	if (ret)
	if (ret)
		return 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_ctrl_new_std(&inst->ctrl_handler, &vdec_ctrl_ops,
		V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER, 0, 1, 1, 0);
		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;
	ret = inst->ctrl_handler.error;
	if (ret) {
	if (ret) {
		v4l2_ctrl_handler_free(&inst->ctrl_handler);
		v4l2_ctrl_handler_free(&inst->ctrl_handler);