From patchwork Thu Jan 17 16:20:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 155844 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2159161jaa; Thu, 17 Jan 2019 08:21:34 -0800 (PST) X-Google-Smtp-Source: ALg8bN50B1LY5nkjQvmqLXj2yCwStPxM/93C3085+CZmRbrNTIvudfVVr3Nk3NciP9o588lra7K2 X-Received: by 2002:a17:902:7588:: with SMTP id j8mr15782614pll.215.1547742094227; Thu, 17 Jan 2019 08:21:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547742094; cv=none; d=google.com; s=arc-20160816; b=xE3JVs/oLwaTrmhu6qjJHYVTbk8Cqbs8WimRWGNH1mXygNgXANh1s1V/hrxL06kArd Lb7VH03nTtRWzcP6g6+1wyX5ULxSpHlN36xd6XoZwPnk/Db9YfL8g/rvZOTk7visrA9r 0jl5nBO9OOaodxYz5+A27JqST2IlgG9GIBVt0kAUsHRD3oRDVaqXfYC+9SVdhZgDmobj NCbR9a1n8RUk+wIm/W5mVKMw+G2XU5C9ewNVGmxvbDmyrTbTW4d4qKZEu6jKfWxcj3wf GFcJMmowPK6829SdR2fJQzuJMnYuv5CC4icmtlfLs9gTZPLw2JvrUa8v2JD0+YDGTNY1 CBXA== 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; bh=SNb+6XKLjhFXr1Fd19oZUt5CC0wXzn1Vgn9kxNRJIs0=; b=RkQqk+R5smr5AUGP5hyMGvq051TDXMKuA7BuuUI8VO1JqlNKmlEZ7XR1swqKN85rnD 7pBp22CQTfpbOW18otxCWBXPf8Vo1fcN5Jqih/H4uMoFAhN8QqQsuO6MzNz/yKP1Cp/5 OA8elBv05c2y9tIX6KJKeFIyTsf5w8+eIB14dRfBoXhUuKpiNGwY8E7IweJN9DEMBvXD JblHo/htTcXBlcCi44JP+1rggALvaHgyDJm4KxNDP68I3n19OgpSSYRBfSRwWRT0li3k M4jm9RLlvOPcFMNYMT6UqdMCYt3aH67FlNyEJdTEmnBY63J7DnDNPSqPNvS/70oc4zCa y8oA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gSQu0bn7; 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 w27si1598547pge.182.2019.01.17.08.21.34; Thu, 17 Jan 2019 08:21:34 -0800 (PST) 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.s=google header.b=gSQu0bn7; 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 S1729083AbfAQQVd (ORCPT + 4 others); Thu, 17 Jan 2019 11:21:33 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:46573 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729135AbfAQQVN (ORCPT ); Thu, 17 Jan 2019 11:21:13 -0500 Received: by mail-wr1-f66.google.com with SMTP id l9so11617304wrt.13 for ; Thu, 17 Jan 2019 08:21:11 -0800 (PST) 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=SNb+6XKLjhFXr1Fd19oZUt5CC0wXzn1Vgn9kxNRJIs0=; b=gSQu0bn7+O02Yk6QIAPNDwgLFN9/1QiHD7Y7r9xiwfiK2A8k6xb2SBc3Ut5JWrx3Bl p/ZdugOLdtFScafh51vgS+65J/yoxM64/2HBwL6fmXbJBxCpWlYWKIW1V1zN8s0r/JbI XckqEWMvXNs6n7Zx5LE0LUDxztKeZWJ+SHmD4= 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=SNb+6XKLjhFXr1Fd19oZUt5CC0wXzn1Vgn9kxNRJIs0=; b=mal+11OXW5r6QggalykaN9RUwUYKzNLOCrwUCIIBs1woSZId88F5Qz9MPdP1KmZx6k Hxgki2w0EOgtDxIp9AwgizGtKEvU7cZAin94BF8T3QWdhvCy6zTXYFz2yRzyUerKV52u lX/bjcC1Qbu5xVlK6+gjZ51eUhvviprzSuxUVgbtAaMUvlbiw2drXXxCHHBjF3o7Nwui X/bEcOXeg4MnVnLeFfxrOmgBUsWWuKZq/rtZvxhyc2maDcWibCSpCUgHpCfGSF3GYOY/ K8ZC1jT9SQbZ8kLWwUufvWmK8GjiU1CZlvqXVEJ1n7E4Fp+3AraUZKQufd/ScOiT9kms syWQ== X-Gm-Message-State: AJcUukcuhZqxUi3Gq30mv4SYH4UW+7P5kaCLCL3F2qXIGWtNpDxnExaS yBxh9R39m9/p07tVkEP9E2Tv5ITf954= X-Received: by 2002:adf:b6a1:: with SMTP id j33mr12641852wre.55.1547742071200; Thu, 17 Jan 2019 08:21:11 -0800 (PST) Received: from localhost.localdomain ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id v133sm31124734wmf.19.2019.01.17.08.21.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Jan 2019 08:21:10 -0800 (PST) From: Stanimir Varbanov To: linux-media@vger.kernel.org Cc: Mauro Carvalho Chehab , Hans Verkuil , linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Tomasz Figa , Alexandre Courbot , Malathi Gottam , Stanimir Varbanov Subject: [PATCH 08/10] venus: vdec_ctrls: get real minimum buffers for capture Date: Thu, 17 Jan 2019 18:20:06 +0200 Message-Id: <20190117162008.25217-9-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190117162008.25217-1-stanimir.varbanov@linaro.org> References: <20190117162008.25217-1-stanimir.varbanov@linaro.org> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Until now we returned num_output_bufs set during reqbuf but that could be wrong when we implement stateful Codec API. So get the minimum buffers for capture from HFI. This is supposed to be called after stream header parsing, i.e. after dequeue v4l2 event for change resolution. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/vdec_ctrls.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/media/platform/qcom/venus/vdec_ctrls.c b/drivers/media/platform/qcom/venus/vdec_ctrls.c index f4604b0cd57e..e1da87bf52bc 100644 --- a/drivers/media/platform/qcom/venus/vdec_ctrls.c +++ b/drivers/media/platform/qcom/venus/vdec_ctrls.c @@ -16,6 +16,7 @@ #include #include "core.h" +#include "helpers.h" #include "vdec.h" static int vdec_op_s_ctrl(struct v4l2_ctrl *ctrl) @@ -47,7 +48,9 @@ static int vdec_op_g_volatile_ctrl(struct v4l2_ctrl *ctrl) { struct venus_inst *inst = ctrl_to_inst(ctrl); struct vdec_controls *ctr = &inst->controls.dec; + struct hfi_buffer_requirements bufreq; union hfi_get_property hprop; + enum hfi_version ver = inst->core->res->hfi_version; u32 ptype = HFI_PROPERTY_PARAM_PROFILE_LEVEL_CURRENT; int ret; @@ -71,7 +74,9 @@ static int vdec_op_g_volatile_ctrl(struct v4l2_ctrl *ctrl) ctrl->val = ctr->post_loop_deb_mode; break; case V4L2_CID_MIN_BUFFERS_FOR_CAPTURE: - ctrl->val = inst->num_output_bufs; + ret = venus_helper_get_bufreq(inst, HFI_BUFFER_OUTPUT, &bufreq); + if (!ret) + ctrl->val = HFI_BUFREQ_COUNT_MIN(&bufreq, ver); break; default: return -EINVAL;