Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1796832imu; Thu, 24 Jan 2019 02:00:10 -0800 (PST) X-Google-Smtp-Source: ALg8bN7kpLAZLbS9KCa9xQXWSYurs2L3wuQMmgvHxnWJA9YAIMJBhww0pvAQat3VXL2+pQXT/jmV X-Received: by 2002:a63:ec13:: with SMTP id j19mr5313354pgh.6.1548324009963; Thu, 24 Jan 2019 02:00:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548324009; cv=none; d=google.com; s=arc-20160816; b=NU7Ujw73T0AjWyJQs4SUhlbxm8Jb+SML8P/xUO+iHqfhYr+EnnXZg8Ar5UhisCpH/h UmSCAk3AH0mOyujgMmSLQr+9u6keLrHkSuT3UawM16vyou1300j+Jg7FGDxXmBO5+hOc aMrpgxnICA1g5358DGi5/IRvh5aQDyTW7hRn6H7u/R6fO2VlmdCGmx0ACZYBy0TJ3IHK IuX1OLjmpFxYes6oiQbCdla+laeYI3kiSOv2oG+Ja8onRaYIfwU0PEWb+a+lh7AaO/IR +8sCa7EDxLHxAV/GDsbjzbxRK6j/Y+Ep8Uo5v05ts/wSVNjtCneoglDSgcfn6qzifsGE Yx6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=iRSEopFd+AHR1Xrk3tr3l3cIpLaGxkm3eJb/szQtbWI=; b=CzKPTHvwlZkc6gtUa1X8oyD0wbnQGuGWEldA2N4HjOXwji6itku66VXb0bpZuTm4Wi 2nG91AzU1N6CJYlceFks8p6lZG49/B1cWebaT74zYJfgUtdt45BF+tFwWXrKaqU3dzpR gmwdi66ieOW9/r20eAyR1py1iVR319ICF+uQmhp0D2Fr4RnFPssSS9hXNplPpfH0iU7A 56VJmsWAFmxFu/vf7FtM07NxwKGRSGbC0BdsBFeFOPLssPKdfKT/Li4rsicoI9qRCb5G dsWwKIORLirHGia0TRvv976A1nOj24wp/VrtbAkgK3uQKG/keZLVwGZ99dBEhRTwXsd3 Jgfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PboRJuOZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 f189si6435313pfg.123.2019.01.24.01.59.54; Thu, 24 Jan 2019 02:00:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=PboRJuOZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S1726199AbfAXJ7K (ORCPT + 99 others); Thu, 24 Jan 2019 04:59:10 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:37300 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727513AbfAXJ7G (ORCPT ); Thu, 24 Jan 2019 04:59:06 -0500 Received: by mail-wr1-f67.google.com with SMTP id s12so5747773wrt.4 for ; Thu, 24 Jan 2019 01:59:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=iRSEopFd+AHR1Xrk3tr3l3cIpLaGxkm3eJb/szQtbWI=; b=PboRJuOZ7vQb7QTOTDCTpv+pdmQBiIvhFX69bWZQASbvtwPj+0Cgp5+Bkzr+QIigOz GeDM62Ic9Yq0OHjy38jFXIyFVOIfqLxzSOQ1RpIoswzCtoH0zaDdxCarGgCXbZj6D9jo +Nvj0uwqZcz3og7JbEYsnbPmMlcdpIcm2XSAQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=iRSEopFd+AHR1Xrk3tr3l3cIpLaGxkm3eJb/szQtbWI=; b=VVBlmuKQx/Z6uwIJihtRWoSXjvxMgUE3dVdeaAkoWdgHVQfXnpAK1TEBzmQnhEjvDg c9VFht9l7SxTUv132FubE3c1usXUD6vYTK270qoKZXabagBjsaFsdqqOnUF8IA3rESjH gaSf4mpPBDcMf1dXSs30MfMQFoVwVnpysagjaWv5oNs3IyjDalet/KUccPYqGTpmrvn+ kfJBvWx3ui/lZ3zfoKsu1kFB4wxvDQX3AkOIjH2QXW4gUJtJiAPbR+kXtW76FSKY+G1f VQrl6jUQix+k857ZZ+BZJZKkzkkQzIqpgAHeCDKgVD5MZfKW8CKSibh5sKfg3TfuF4Er W7Lg== X-Gm-Message-State: AJcUukc+FkKJ7quUFz8YcH2DJjnC6TbslCzyk1gDJbyQefr6Mtu72XC6 KQJSCQ01GCHgHaKy7+T3LafAEA== X-Received: by 2002:adf:b6a1:: with SMTP id j33mr6456628wre.55.1548323944084; Thu, 24 Jan 2019 01:59:04 -0800 (PST) Received: from [192.168.27.209] ([37.157.136.206]) by smtp.googlemail.com with ESMTPSA id x3sm97679856wrd.19.2019.01.24.01.59.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Jan 2019 01:59:03 -0800 (PST) Subject: Re: [PATCH 08/10] venus: vdec_ctrls: get real minimum buffers for capture To: Alexandre Courbot Cc: Linux Media Mailing List , Mauro Carvalho Chehab , Hans Verkuil , LKML , linux-arm-msm@vger.kernel.org, Vikash Garodia , Tomasz Figa , Malathi Gottam References: <20190117162008.25217-1-stanimir.varbanov@linaro.org> <20190117162008.25217-9-stanimir.varbanov@linaro.org> From: Stanimir Varbanov Message-ID: Date: Thu, 24 Jan 2019 11:59:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Alex, Thanks for the comments! On 1/24/19 10:43 AM, Alexandre Courbot wrote: > On Fri, Jan 18, 2019 at 1:21 AM Stanimir Varbanov > wrote: >> >> 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(-) >> >> 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); > > What happens if venus_helper_get_bufreq() returns an error? It seems > that we just happily continue with whatever the previous value of > ctrl->val was. It seems like we do the same with other controls as > well. I agree that this is wrong, I think no-one userspace client used that g_ctrls controls :) > > I think you can fix this globally by initializing ret to 0 at the > beginning of the function, and then returning ret instead of 0 at the > end. That way all errors would be propagated. Of course please check > that this is relevant for other controls following this scheme before > doing so. :) > yes, I will do! -- regards, Stan