From patchwork Thu Jun 15 16:31:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 9789181 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9DD5960384 for ; Thu, 15 Jun 2017 16:36:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8DFF7285B3 for ; Thu, 15 Jun 2017 16:36:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7F9A1286AE; Thu, 15 Jun 2017 16:36:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F2C38285B3 for ; Thu, 15 Jun 2017 16:36:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752624AbdFOQd0 (ORCPT ); Thu, 15 Jun 2017 12:33:26 -0400 Received: from mail-wr0-f177.google.com ([209.85.128.177]:34151 "EHLO mail-wr0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752574AbdFOQdU (ORCPT ); Thu, 15 Jun 2017 12:33:20 -0400 Received: by mail-wr0-f177.google.com with SMTP id 77so25380253wrb.1 for ; Thu, 15 Jun 2017 09:33:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xGjG4s7f9q81WO34hY9cUv5xD2E6LJWqeseOjZYopZU=; b=Jw7NsJUQFkxk0she2BrtOfl+SrGniwXPWf4rCFuIdZ+tBZ9KZZPG7gnrHDiBjaqmZy cVOGDNG3mVZ7l8vv8o6Aq1ABUFaD8vPPkf3iPlmOcLPAiwgSbzyKAqVfQ64+xSyXeiCy 2xLru8sRoUlw8h01VIQzMijlXR+psRZ63n4MU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xGjG4s7f9q81WO34hY9cUv5xD2E6LJWqeseOjZYopZU=; b=tMd7Jq2N6MTeuNx/whtN80MThDNZfKJrf8lxKVvymOlRpQCr6EM+KR1oidcc7o64oK fEG0uO65J8/CHcyT1+IbYPxITzLhUuel62ZBODS2DA85oBG3TmFz05piRi9iumW01K3N LWnVZ30d3MpqGU05tEQEWDk70sxj7dGex5w5Ey12C37LCJXp3ASDa1WsE+AagZkPxEPu 87//zjt1yj0A90Y8sfyyMf9bJ4nAHgtMVJzhB7wRdjcnSlO6Bzm6Mrw4s4SzvDsWnPlJ zp0zz0Ga7vGtdp7WTsx5GcPJIgJQIilHS5UW3a7zZ1APqoDEBvp392LT+F50I9AaIfPr NcgQ== X-Gm-Message-State: AKS2vOwnp7PocIIcMJdQLNHsk3GzCDRhU1WP5sUEMPDdTT1YuBvtb412 BE4F6TcxhS1QmSpc X-Received: by 10.223.128.65 with SMTP id 59mr4651085wrk.0.1497544399556; Thu, 15 Jun 2017 09:33:19 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id m73sm541890wmi.25.2017.06.15.09.33.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 15 Jun 2017 09:33:19 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Stanimir Varbanov Subject: [PATCH v11 17/19] media: venus: vdec: add support for min buffers for capture Date: Thu, 15 Jun 2017 19:31:58 +0300 Message-Id: <1497544320-2269-18-git-send-email-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1497544320-2269-1-git-send-email-stanimir.varbanov@linaro.org> References: <1497544320-2269-1-git-send-email-stanimir.varbanov@linaro.org> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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);