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: 105674 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp889693qgd; Thu, 15 Jun 2017 09:36:32 -0700 (PDT) X-Received: by 10.84.142.129 with SMTP id 1mr7098646plx.84.1497544592359; Thu, 15 Jun 2017 09:36:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497544592; cv=none; d=google.com; s=arc-20160816; b=IIB4DisvgIuBzfUYZE8wzaCTgmWb+/e14JgovhnufhwpGYOzPtTV7VEGsNN8WN+RFS V+8gzCjWaQDaN7bE21o3oo77B4Ht3V0T37nYVbzTh5moxysQh5NPKseElcB9/DW4q/RY T3Vy0td7LSyE8rafPxgfbvpE+fCCgeNQuKv3gcCLkxU+qAFmDXyV1JBtSMyiAOdYuXJL LOaOsaL3itKdubAIWj/ek3+AsMkYcWnH4zj9zD0jaqXwb2CT+7YuA4wj0MSVzBNuZ3/C SMUEPE2SbpEFletZedlcb8TeNyUYQ0Gfp3DLa04WhK6a8HC5VB6r3xMzdupntr4qeUpw Ea8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=xGjG4s7f9q81WO34hY9cUv5xD2E6LJWqeseOjZYopZU=; b=GMsPOLoGzyMjQKto8kt5mlzulUNX25oq/a/JLd7fVOZQf5YlE1plxNfJ56qUhYXOzs kwOtaKfoIRk8yjXl5unF5W4zcZMNuWpUC2z0HC1ltV0fiGS6lSx2OxF+kZM+x+1zcYnv v5+5Y6MORJOMl2jxVcZGZUoCmk17tiM2wovgH1iABnNWZ8GRHat5cGIbfrGJ0S1pZMAj LXrQES4GfNHuOBBD/yw9Zr/BjNaWi7iLUOVDgaAl65mg4IxtV1Bh+KAreyR8jgLab9KJ R2XicWU1x5ZQHEoZ06gaOSK9E2xdGH0cOWrTdMgHBF+QbnJile5lKPElCQWMu5sl5ahU tfRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=Jw7NsJUQ; spf=pass (google.com: best guess record for domain of linux-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-media-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b34si374211plc.583.2017.06.15.09.36.32; Thu, 15 Jun 2017 09:36:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=Jw7NsJUQ; spf=pass (google.com: best guess record for domain of linux-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-media-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752624AbdFOQd0 (ORCPT + 4 others); 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 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(-) -- 2.7.4 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);