linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stanimir Varbanov <stanimir.varbanov@linaro.org>
To: Aniket Masule <amasule@codeaurora.org>,
	linux-media@vger.kernel.org, stanimir.varbanov@linaro.org
Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	vgarodia@codeaurora.org
Subject: Re: [PATCH 2/5] media: venus: Initialize codec data
Date: Mon, 17 Jun 2019 11:37:22 +0300	[thread overview]
Message-ID: <43e8022f-d231-8c36-0db8-9710a1adaabc@linaro.org> (raw)
In-Reply-To: <1560233130-27264-3-git-send-email-amasule@codeaurora.org>

Hi Aniket,

On 6/11/19 9:05 AM, Aniket Masule wrote:
> Initialize the codec data with core resources.

Please squash this patch in 1/5 patch.

> 
> Signed-off-by: Aniket Masule <amasule@codeaurora.org>
> ---
>  drivers/media/platform/qcom/venus/helpers.c | 30 +++++++++++++++++++++++++++++
>  drivers/media/platform/qcom/venus/helpers.h |  1 +
>  drivers/media/platform/qcom/venus/vdec.c    |  4 ++++
>  drivers/media/platform/qcom/venus/venc.c    |  4 ++++
>  4 files changed, 39 insertions(+)
> 
> diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c
> index 5cad601..f7f724b 100644
> --- a/drivers/media/platform/qcom/venus/helpers.c
> +++ b/drivers/media/platform/qcom/venus/helpers.c
> @@ -715,6 +715,36 @@ int venus_helper_set_core_usage(struct venus_inst *inst, u32 usage)
>  }
>  EXPORT_SYMBOL_GPL(venus_helper_set_core_usage);
>  
> +int venus_helper_init_codec_data(struct venus_inst *inst)
> +{
> +	const struct codec_data *codec_data;
> +	unsigned int i, codec_data_size;
> +	u32 pixfmt;
> +	int ret = 0;
> +
> +	if (!IS_V4(inst->core))
> +		return 0;
> +
> +	codec_data = inst->core->res->codec_data;
> +	codec_data_size = inst->core->res->codec_data_size;
> +	pixfmt = inst->session_type == VIDC_SESSION_TYPE_DEC ?
> +			inst->fmt_out->pixfmt : inst->fmt_cap->pixfmt;
> +
> +	for (i = 0; i < codec_data_size; i++) {
> +		if (codec_data[i].pixfmt == pixfmt &&
> +		    codec_data[i].session_type == inst->session_type) {
> +			inst->clk_data.codec_data = &codec_data[i];
> +			break;
> +		}
> +	}
> +
> +	if (!inst->clk_data.codec_data)
> +		ret = -EINVAL;

just return -EINVAL

> +
> +	return ret;

return 0 is enough, and that will avoid ret variable.

> +}
> +EXPORT_SYMBOL_GPL(venus_helper_init_codec_data);
> +
>  int venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int input_bufs,
>  			      unsigned int output_bufs,
>  			      unsigned int output2_bufs)
> diff --git a/drivers/media/platform/qcom/venus/helpers.h b/drivers/media/platform/qcom/venus/helpers.h
> index 2475f284..f9360a8 100644
> --- a/drivers/media/platform/qcom/venus/helpers.h
> +++ b/drivers/media/platform/qcom/venus/helpers.h
> @@ -41,6 +41,7 @@ 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_init_codec_data(struct venus_inst *inst);
>  int venus_helper_set_core_usage(struct venus_inst *inst, u32 usage);
>  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 282de21..51795fd 100644
> --- a/drivers/media/platform/qcom/venus/vdec.c
> +++ b/drivers/media/platform/qcom/venus/vdec.c
> @@ -660,6 +660,10 @@ static int vdec_init_session(struct venus_inst *inst)
>  	if (ret)
>  		goto deinit;
>  
> +	ret = venus_helper_init_codec_data(inst);
> +	if (ret)
> +		goto deinit;
> +
>  	return 0;
>  deinit:
>  	hfi_session_deinit(inst);
> diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c
> index 32cff29..792cdce 100644
> --- a/drivers/media/platform/qcom/venus/venc.c
> +++ b/drivers/media/platform/qcom/venus/venc.c
> @@ -847,6 +847,10 @@ static int venc_init_session(struct venus_inst *inst)
>  	if (ret)
>  		goto deinit;
>  
> +	ret = venus_helper_init_codec_data(inst);
> +	if (ret)
> +		goto deinit;
> +
>  	ret = venc_set_properties(inst);
>  	if (ret)
>  		goto deinit;
> 

-- 
regards,
Stan

  reply	other threads:[~2019-06-17  8:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-11  6:05 [PATCH v2 0/5] media: venus: Update clock scaling and core selection Aniket Masule
2019-06-11  6:05 ` [PATCH 1/5] media: venus: Add codec data table Aniket Masule
2019-06-17  8:37   ` Stanimir Varbanov
2019-06-20  8:11     ` amasule
2019-06-11  6:05 ` [PATCH 2/5] media: venus: Initialize codec data Aniket Masule
2019-06-17  8:37   ` Stanimir Varbanov [this message]
2019-06-20  8:13     ` amasule
2019-06-11  6:05 ` [PATCH 3/5] media: venus: Update clock scaling Aniket Masule
2019-06-17  8:58   ` Stanimir Varbanov
2019-06-20  8:28     ` amasule
2019-06-11  6:05 ` [PATCH 4/5] media: venus: Add interface for load per core Aniket Masule
2019-06-17  9:05   ` Stanimir Varbanov
2019-06-11  6:05 ` [PATCH 5/5] media: venus: Update core selection Aniket Masule
2019-06-17  9:07   ` Stanimir Varbanov
2019-06-20 10:59     ` amasule
  -- strict thread matches above, loose matches on Subject: below --
2019-05-30 13:58 [PATCH 0/5] media: venus: Update clock scaling and " Aniket Masule
2019-05-30 13:58 ` [PATCH 2/5] media: venus: Initialize codec data Aniket Masule

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=43e8022f-d231-8c36-0db8-9710a1adaabc@linaro.org \
    --to=stanimir.varbanov@linaro.org \
    --cc=amasule@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.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).