linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stanimir Varbanov <stanimir.varbanov@linaro.org>
To: Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
	stanimir.varbanov@linaro.org, agross@kernel.org,
	bjorn.andersson@linaro.org, mchehab@kernel.org,
	linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org
Cc: dikshita@codeaurora.org, jonathan@marek.ca, vgarodia@codeaurora.org
Subject: Re: [PATCH v2 24/25] media: venus: helper: Decide work mode
Date: Mon, 22 Mar 2021 15:12:23 +0200	[thread overview]
Message-ID: <c38da904-28da-f713-ba92-f6bc42603a3c@linaro.org> (raw)
In-Reply-To: <20210312173039.1387617-25-bryan.odonoghue@linaro.org>

Hi,

On 3/12/21 7:30 PM, Bryan O'Donoghue wrote:
> From: Dikshita Agarwal <dikshita@codeaurora.org>
> 
> Decide work mode for encoder and decoder based on different
> use-cases.
> 
> Signed-off-by: Dikshita Agarwal <dikshita@codeaurora.org>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> ---
>  drivers/media/platform/qcom/venus/helpers.c | 31 ++++++++++++++++++++-
>  drivers/media/platform/qcom/venus/helpers.h |  2 +-
>  drivers/media/platform/qcom/venus/vdec.c    |  2 +-
>  drivers/media/platform/qcom/venus/venc.c    |  2 +-
>  4 files changed, 33 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c
> index 77ffb8fbb47f..dc8ef13d0c95 100644
> --- a/drivers/media/platform/qcom/venus/helpers.c
> +++ b/drivers/media/platform/qcom/venus/helpers.c
> @@ -18,6 +18,9 @@
>  #include "hfi_platform.h"
>  #include "hfi_parser.h"
>  
> +#define NUM_MBS_720P	(((1280 + 15) >> 4) * ((720 + 15) >> 4))
> +#define NUM_MBS_4K	(((4096 + 15) >> 4) * ((2304 + 15) >> 4))
> +
>  struct intbuf {
>  	struct list_head list;
>  	u32 type;
> @@ -1090,14 +1093,40 @@ int venus_helper_set_output_resolution(struct venus_inst *inst,
>  }
>  EXPORT_SYMBOL_GPL(venus_helper_set_output_resolution);
>  
> -int venus_helper_set_work_mode(struct venus_inst *inst, u32 mode)
> +static u32 venus_helper_get_work_mode(struct venus_inst *inst)
> +{
> +	u32 mode;
> +	u32 num_mbs;
> +
> +	mode = VIDC_WORK_MODE_2;
> +	if (IS_V6(inst->core)) {

Dikshita, I think the decisions made here are valid for v4 too? If so
this IS_V6 check is not needed.

> +		if (inst->session_type == VIDC_SESSION_TYPE_DEC) {
> +			num_mbs = (ALIGN(inst->height, 16) * ALIGN(inst->width, 16)) / 256;
> +			if (inst->hfi_codec == HFI_VIDEO_CODEC_MPEG2 ||
> +			    inst->pic_struct != HFI_INTERLACE_FRAME_PROGRESSIVE ||
> +			    num_mbs <= NUM_MBS_720P)
> +				mode = VIDC_WORK_MODE_1;
> +		} else {
> +			num_mbs = (ALIGN(inst->out_height, 16) * ALIGN(inst->out_width, 16)) / 256;
> +			if (inst->hfi_codec == HFI_VIDEO_CODEC_VP8 &&
> +			    num_mbs <= NUM_MBS_4K)
> +				mode = VIDC_WORK_MODE_1;
> +		}
> +	}
> +
> +	return mode;
> +}
> +
> +int venus_helper_set_work_mode(struct venus_inst *inst)
>  {
>  	const u32 ptype = HFI_PROPERTY_PARAM_WORK_MODE;
>  	struct hfi_video_work_mode wm;
> +	u32 mode;
>  
>  	if (!IS_V4(inst->core) && !IS_V6(inst->core))
>  		return 0;
>  
> +	mode = venus_helper_get_work_mode(inst);
>  	wm.video_work_mode = mode;
>  	return hfi_session_set_property(inst, ptype, &wm);
>  }
> diff --git a/drivers/media/platform/qcom/venus/helpers.h b/drivers/media/platform/qcom/venus/helpers.h
> index 98106e6eee85..e6269b4be3af 100644
> --- a/drivers/media/platform/qcom/venus/helpers.h
> +++ b/drivers/media/platform/qcom/venus/helpers.h
> @@ -32,7 +32,7 @@ int venus_helper_set_input_resolution(struct venus_inst *inst,
>  int venus_helper_set_output_resolution(struct venus_inst *inst,
>  				       unsigned int width, unsigned int height,
>  				       u32 buftype);
> -int venus_helper_set_work_mode(struct venus_inst *inst, u32 mode);
> +int venus_helper_set_work_mode(struct venus_inst *inst);
>  int venus_helper_set_format_constraints(struct venus_inst *inst);
>  int venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int input_bufs,
>  			      unsigned int output_bufs,
> diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c
> index fdc9984acb70..0fe4863371e2 100644
> --- a/drivers/media/platform/qcom/venus/vdec.c
> +++ b/drivers/media/platform/qcom/venus/vdec.c
> @@ -655,7 +655,7 @@ static int vdec_output_conf(struct venus_inst *inst)
>  	u32 ptype;
>  	int ret;
>  
> -	ret = venus_helper_set_work_mode(inst, VIDC_WORK_MODE_2);
> +	ret = venus_helper_set_work_mode(inst);
>  	if (ret)
>  		return ret;
>  
> diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c
> index 505d092dc433..83425fa8df2d 100644
> --- a/drivers/media/platform/qcom/venus/venc.c
> +++ b/drivers/media/platform/qcom/venus/venc.c
> @@ -550,7 +550,7 @@ static int venc_set_properties(struct venus_inst *inst)
>  	u32 profile, level;
>  	int ret;
>  
> -	ret = venus_helper_set_work_mode(inst, VIDC_WORK_MODE_2);
> +	ret = venus_helper_set_work_mode(inst);
>  	if (ret)
>  		return ret;
>  
> 

-- 
regards,
Stan

  reply	other threads:[~2021-03-22 13:15 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-12 17:30 [PATCH v2 00/25] media: venus: Enable 6xx support Bryan O'Donoghue
2021-03-12 17:30 ` [PATCH v2 01/25] media: venus: Update v6 buffer descriptors Bryan O'Donoghue
2021-03-12 17:30 ` [PATCH v2 02/25] media: venus: core,pm: Add handling for resets Bryan O'Donoghue
2021-03-12 17:30 ` [PATCH v2 03/25] media: venus: core: add sm8250 DT compatible and resource data Bryan O'Donoghue
2021-03-12 17:30 ` [PATCH v2 04/25] media: venus: core: Add io base variables for each block Bryan O'Donoghue
2021-03-12 17:30 ` [PATCH v2 05/25] media: venus: hfi,pm,firmware: Convert to block relative addressing Bryan O'Donoghue
2021-03-12 17:30 ` [PATCH v2 06/25] media: venus: hfi: Define block offsets for V6 hardware Bryan O'Donoghue
2021-03-12 17:30 ` [PATCH v2 07/25] media: venus: hfi: Define additional 6xx registers Bryan O'Donoghue
2021-03-12 17:30 ` [PATCH v2 08/25] media: venus: core: Add differentiator IS_V6(core) Bryan O'Donoghue
2021-03-12 17:30 ` [PATCH v2 09/25] media: venus: core: Add an io base for TZ wrapper regs Bryan O'Donoghue
2021-03-12 17:30 ` [PATCH v2 10/25] media: venus: core: Add an io base for AON regs Bryan O'Donoghue
2021-03-12 17:30 ` [PATCH v2 11/25] media: venus: core: Hook to V6 base registers when appropriate Bryan O'Donoghue
2021-03-12 17:30 ` [PATCH v2 12/25] media: venus: hfi: Add a 6xx boot logic Bryan O'Donoghue
2021-03-12 17:30 ` [PATCH v2 13/25] media: venus: hfi: Add 6xx interrupt support Bryan O'Donoghue
2021-03-12 17:30 ` [PATCH v2 14/25] media: venus: hfi: Read WRAPPER_TZ_CPU_STATUS_V6 on 6xx Bryan O'Donoghue
2021-03-12 17:30 ` [PATCH v2 15/25] media: venus: hfi, vdec: v6 Add IS_V6() to existing IS_V4() if locations Bryan O'Donoghue
2021-03-12 17:30 ` [PATCH v2 16/25] media: venus: pm: Hook 6xx pm ops into 4xx pm ops Bryan O'Donoghue
2021-03-12 17:30 ` [PATCH v2 17/25] media: venus: core,pm: Vote for min clk freq during venus boot Bryan O'Donoghue
2021-03-12 17:30 ` [PATCH v2 18/25] media: venus: hfi: Add 6xx AXI halt logic Bryan O'Donoghue
2021-03-12 17:30 ` [PATCH v2 19/25] media: venus: pm: Toggle 6xx wrapper power in vcodec_control Bryan O'Donoghue
2021-03-12 17:30 ` [PATCH v2 20/25] media: venus: firmware: Do not toggle WRAPPER_A9SS_SW_RESET on 6xx Bryan O'Donoghue
2021-03-12 17:30 ` [PATCH v2 21/25] media: venus: helpers: Add internal buffer list for v6 Bryan O'Donoghue
2021-03-17  9:59   ` dikshita
2021-03-12 17:30 ` [PATCH v2 22/25] media: venus: helpers, hfi, vdec: Set actual plane constraints to FW Bryan O'Donoghue
2021-03-12 17:30 ` [PATCH v2 23/25] media: venus: hfi: Increase plat_buf_v6 o/p buffer count Bryan O'Donoghue
2021-03-12 17:30 ` [PATCH v2 24/25] media: venus: helper: Decide work mode Bryan O'Donoghue
2021-03-22 13:12   ` Stanimir Varbanov [this message]
2021-03-12 17:30 ` [PATCH v2 25/25] media: venus: vdec: Fix decoder cmd STOP issue Bryan O'Donoghue
2021-03-23 12:20 ` [PATCH v2 00/25] media: venus: Enable 6xx support Stanimir Varbanov
2021-03-23 14:07   ` Bryan O'Donoghue

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=c38da904-28da-f713-ba92-f6bc42603a3c@linaro.org \
    --to=stanimir.varbanov@linaro.org \
    --cc=agross@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=bryan.odonoghue@linaro.org \
    --cc=dikshita@codeaurora.org \
    --cc=jonathan@marek.ca \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=vgarodia@codeaurora.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;
as well as URLs for NNTP newsgroup(s).