mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dikshita Agarwal <quic_dikshita@quicinc.com>
To: Konrad Dybcio <konrad.dybcio@linaro.org>,
	Stanimir Varbanov <stanimir.k.varbanov@gmail.com>,
	Vikash Garodia <quic_vgarodia@quicinc.com>,
	Andy Gross <agross@kernel.org>,
	Bjorn Andersson <andersson@kernel.org>,
	"Mauro Carvalho Chehab" <mchehab@kernel.org>,
	Dikshita Agarwal <dikshita@qti.qualcomm.com>,
	Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
	Mansur Alisha Shaik <mansur@codeaurora.org>,
	Jonathan Marek <jonathan@marek.ca>,
	Hans Verkuil <hans.verkuil@cisco.com>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
	Stanimir Varbanov <stanimir.varbanov@linaro.org>,
	<linux-media@vger.kernel.org>, <linux-arm-msm@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	"Marijn Suijten" <marijn.suijten@somainline.org>
Subject: Re: [PATCH v3 16/17] media: venus: Use newly-introduced hfi_buffer_requirements accessors
Date: Fri, 26 May 2023 12:45:43 +0530	[thread overview]
Message-ID: <26940075-e49c-3d45-0fda-3de5c79663a5@quicinc.com> (raw)
In-Reply-To: <20230228-topic-venus-v3-16-6092ae43b58f@linaro.org>



On 5/18/2023 2:44 AM, Konrad Dybcio wrote:
> Now that we have a way which is independent of the HFI version to set
> the correct fields in hfi_buffer_requirements, use it!
> 
> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
> ---
>  drivers/media/platform/qcom/venus/helpers.c        |  5 +++--
>  .../media/platform/qcom/venus/hfi_plat_bufs_v6.c   | 22 +++++++++++-----------
>  2 files changed, 14 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c
> index 1ce2624abc12..0268129ab9ac 100644
> --- a/drivers/media/platform/qcom/venus/helpers.c
> +++ b/drivers/media/platform/qcom/venus/helpers.c
> @@ -667,6 +667,7 @@ int venus_helper_get_bufreq(struct venus_inst *inst, u32 type,
>  			    struct hfi_buffer_requirements *req)
>  {
>  	u32 ptype = HFI_PROPERTY_CONFIG_BUFFER_REQUIREMENTS;
> +	enum hfi_version ver = inst->core->res->hfi_version;
>  	union hfi_get_property hprop;
>  	unsigned int i;
>  	int ret;
> @@ -674,12 +675,12 @@ int venus_helper_get_bufreq(struct venus_inst *inst, u32 type,
>  	memset(req, 0, sizeof(*req));
>  
>  	if (type == HFI_BUFFER_OUTPUT || type == HFI_BUFFER_OUTPUT2)
> -		req->count_min = inst->fw_min_cnt;
> +		hfi_bufreq_set_count_min(req, ver, inst->fw_min_cnt);
>  
>  	ret = platform_get_bufreq(inst, type, req);
>  	if (!ret) {
>  		if (type == HFI_BUFFER_OUTPUT || type == HFI_BUFFER_OUTPUT2)
> -			inst->fw_min_cnt = req->count_min;
> +			inst->fw_min_cnt = hfi_bufreq_get_count_min(req, ver);
>  		return 0;
>  	}
>  
> diff --git a/drivers/media/platform/qcom/venus/hfi_plat_bufs_v6.c b/drivers/media/platform/qcom/venus/hfi_plat_bufs_v6.c
> index a9be31ec6927..5eb4032bc551 100644
> --- a/drivers/media/platform/qcom/venus/hfi_plat_bufs_v6.c
> +++ b/drivers/media/platform/qcom/venus/hfi_plat_bufs_v6.c
> @@ -1214,25 +1214,25 @@ static int bufreq_dec(struct hfi_plat_buffers_params *params, u32 buftype,
>  
>  	out_min_count = output_buffer_count(VIDC_SESSION_TYPE_DEC, codec);
>  	/* Max of driver and FW count */
> -	out_min_count = max(out_min_count, bufreq->count_min);
> +	out_min_count = max(out_min_count, hfi_bufreq_get_count_min(bufreq, version));
>  
>  	bufreq->type = buftype;
>  	bufreq->region_size = 0;
> -	bufreq->count_min = 1;
>  	bufreq->count_actual = 1;
> -	bufreq->hold_count = 1;
to set hold_count for non V4 targets, hfi_bufreq_set_hold_count() should be
called as well.
> +	hfi_bufreq_set_count_min(bufreq, version, 1);
> +	hfi_bufreq_set_count_min_host(bufreq, version, 1);
>  	bufreq->contiguous = 1;
>  	bufreq->alignment = 256;
>  
>  	if (buftype == HFI_BUFFER_INPUT) {
> -		bufreq->count_min = MIN_INPUT_BUFFERS;
> +		hfi_bufreq_set_count_min(bufreq, version, MIN_INPUT_BUFFERS);
>  		bufreq->size =
>  			calculate_dec_input_frame_size(width, height, codec,
>  						       max_mbs_per_frame,
>  						       buffer_size_limit);
>  	} else if (buftype == HFI_BUFFER_OUTPUT ||
>  		   buftype == HFI_BUFFER_OUTPUT2) {
> -		bufreq->count_min = out_min_count;
> +		hfi_bufreq_set_count_min(bufreq, version, out_min_count);
>  		bufreq->size =
>  			venus_helper_get_framesz_raw(params->hfi_color_fmt,
>  						     width, height);
> @@ -1264,7 +1264,7 @@ static int bufreq_enc(struct hfi_plat_buffers_params *params, u32 buftype,
>  	u32 work_mode = params->enc.work_mode;
>  	u32 rc_type = params->enc.rc_type;
>  	u32 num_vpp_pipes = params->num_vpp_pipes;
> -	u32 num_ref;
> +	u32 num_ref, count_min;
>  
>  	switch (codec) {
>  	case V4L2_PIX_FMT_H264:
> @@ -1284,21 +1284,21 @@ static int bufreq_enc(struct hfi_plat_buffers_params *params, u32 buftype,
>  
>  	bufreq->type = buftype;
>  	bufreq->region_size = 0;
> -	bufreq->count_min = 1;
>  	bufreq->count_actual = 1;
> -	bufreq->hold_count = 1;
same comment here.

- Dikshita
> +	hfi_bufreq_set_count_min(bufreq, version, 1);
> +	hfi_bufreq_set_count_min_host(bufreq, version, 1);
>  	bufreq->contiguous = 1;
>  	bufreq->alignment = 256;
>  
>  	if (buftype == HFI_BUFFER_INPUT) {
> -		bufreq->count_min = MIN_INPUT_BUFFERS;
> +		hfi_bufreq_set_count_min(bufreq, version, MIN_INPUT_BUFFERS);
>  		bufreq->size =
>  			venus_helper_get_framesz_raw(params->hfi_color_fmt,
>  						     width, height);
>  	} else if (buftype == HFI_BUFFER_OUTPUT ||
>  		   buftype == HFI_BUFFER_OUTPUT2) {
> -		bufreq->count_min =
> -			output_buffer_count(VIDC_SESSION_TYPE_ENC, codec);
> +		count_min = output_buffer_count(VIDC_SESSION_TYPE_ENC, codec);
> +		hfi_bufreq_set_count_min(bufreq, version, count_min);
>  		bufreq->size = calculate_enc_output_frame_size(width, height,
>  							       rc_type);
>  	} else if (buftype == HFI_BUFFER_INTERNAL_SCRATCH(version)) {
> 

  reply	other threads:[~2023-05-26  7:16 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-17 21:14 [PATCH v3 00/17] Venus QoL / maintainability fixes Konrad Dybcio
2023-05-17 21:14 ` [PATCH v3 01/17] media: venus: hfi_venus: Only consider sys_idle_indicator on V1 Konrad Dybcio
2023-05-17 21:14 ` [PATCH v3 02/17] media: venus: hfi_venus: Write to VIDC_CTRL_INIT after unmasking interrupts Konrad Dybcio
2023-05-17 21:14 ` [PATCH v3 03/17] media: venus: Introduce VPU version distinction Konrad Dybcio
2023-05-17 21:14 ` [PATCH v3 04/17] media: venus: Add vpu_version to most SoCs Konrad Dybcio
2023-05-17 21:14 ` [PATCH v3 05/17] media: venus: firmware: Leave a clue about obtaining CP VARs Konrad Dybcio
2023-05-17 21:14 ` [PATCH v3 06/17] media: venus: hfi_venus: Sanitize venus_boot_core() per-VPU-version Konrad Dybcio
2023-05-26  6:18   ` Dikshita Agarwal
2023-05-17 21:14 ` [PATCH v3 07/17] media: venus: core: Assign registers based on VPU version Konrad Dybcio
2023-05-26  6:28   ` Dikshita Agarwal
2023-05-17 21:14 ` [PATCH v3 08/17] media: venus: hfi_venus: Sanitize venus_halt_axi() per-VPU-version Konrad Dybcio
2023-05-17 21:14 ` [PATCH v3 09/17] media: venus: hfi_venus: Sanitize venus_isr() per-VPU-version Konrad Dybcio
2023-05-17 21:14 ` [PATCH v3 10/17] media: venus: hfi_venus: Sanitize venus_cpu_and_video_core_idle() per-VPU-version Konrad Dybcio
2023-05-17 21:14 ` [PATCH v3 11/17] media: venus: hfi_venus: Sanitize venus_cpu_idle_and_pc_ready() per-VPU-version Konrad Dybcio
2023-05-17 21:14 ` [PATCH v3 12/17] media: venus: firmware: Correct IS_V6() checks Konrad Dybcio
2023-05-26  7:03   ` Dikshita Agarwal
2023-05-26  7:45     ` Vikash Garodia
2023-05-27 16:48     ` Konrad Dybcio
2023-05-17 21:14 ` [PATCH v3 13/17] media: venus: hfi_platform: Check vpu_version instead of device compatible Konrad Dybcio
2023-05-17 21:14 ` [PATCH v3 14/17] media: venus: vdec: Sanitize vdec_set_work_route() per-VPU-version Konrad Dybcio
2023-05-17 21:14 ` [PATCH v3 15/17] media: venus: Introduce accessors for remapped hfi_buffer_reqs members Konrad Dybcio
2023-05-17 21:14 ` [PATCH v3 16/17] media: venus: Use newly-introduced hfi_buffer_requirements accessors Konrad Dybcio
2023-05-26  7:15   ` Dikshita Agarwal [this message]
2023-05-17 21:14 ` [PATCH v3 17/17] media: venus: hfi_venus: Restrict writing SCIACMDARG3 to Venus V1/V2 Konrad Dybcio
2023-05-25 23:02 ` [PATCH v3 00/17] Venus QoL / maintainability fixes Stanimir Varbanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=26940075-e49c-3d45-0fda-3de5c79663a5@quicinc.com \
    --to=quic_dikshita@quicinc.com \
    --cc=agross@kernel.org \
    --cc=andersson@kernel.org \
    --cc=bryan.odonoghue@linaro.org \
    --cc=dikshita@qti.qualcomm.com \
    --cc=hans.verkuil@cisco.com \
    --cc=jonathan@marek.ca \
    --cc=konrad.dybcio@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mansur@codeaurora.org \
    --cc=marijn.suijten@somainline.org \
    --cc=mchehab+huawei@kernel.org \
    --cc=mchehab@kernel.org \
    --cc=quic_vgarodia@quicinc.com \
    --cc=stanimir.k.varbanov@gmail.com \
    --cc=stanimir.varbanov@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®