mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
To: Fritz Koenig <frkoenig@chromium.org>,
	Stanimir Varbanov <stanimir.k.varbanov@gmail.com>,
	Vikash Garodia <quic_vgarodia@quicinc.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Dikshita Agarwal <quic_dikshita@quicinc.com>
Cc: Nathan Hebert <nhebert@chromium.org>,
	linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/2] media: venus: Helper function for dynamically updating bitrate
Date: Wed, 16 Oct 2024 00:12:55 +0100	[thread overview]
Message-ID: <079045ac-27e7-43f4-a4a4-bc9d03de61c8@linaro.org> (raw)
In-Reply-To: <20240814-submit-v3-1-f7d05e3e8560@chromium.org>

On 14/08/2024 23:14, Fritz Koenig wrote:
> Move the dynamic bitrate updating functionality to a separate function
> so that it can be shared.
> 
> No functionality changes.
> 
> Signed-off-by: Fritz Koenig <frkoenig@chromium.org>
> ---
>   drivers/media/platform/qcom/venus/venc_ctrls.c | 34 +++++++++++++++-----------
>   1 file changed, 20 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/media/platform/qcom/venus/venc_ctrls.c b/drivers/media/platform/qcom/venus/venc_ctrls.c
> index d9d2a293f3ef..3e1f6f26eddf 100644
> --- a/drivers/media/platform/qcom/venus/venc_ctrls.c
> +++ b/drivers/media/platform/qcom/venus/venc_ctrls.c
> @@ -67,12 +67,28 @@ static int venc_calc_bpframes(u32 gop_size, u32 conseq_b, u32 *bf, u32 *pf)
>   	return 0;
>   }
>   
> +static int dynamic_bitrate_update(struct venus_inst *inst, u32 bitrate,
> +				  u32 layer_id)
> +{
> +	int ret = 0;
> +
> +	mutex_lock(&inst->lock);
> +	if (inst->streamon_out && inst->streamon_cap) {
> +		u32 ptype = HFI_PROPERTY_CONFIG_VENC_TARGET_BITRATE;
> +		struct hfi_bitrate brate = { .bitrate = bitrate, .layer_id = layer_id };
> +
> +		ret = hfi_session_set_property(inst, ptype, &brate);
> +	}
> +	mutex_unlock(&inst->lock);
> +
> +	return ret;
> +}
> +
>   static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl)
>   {
>   	struct venus_inst *inst = ctrl_to_inst(ctrl);
>   	struct venc_controls *ctr = &inst->controls.enc;
>   	struct hfi_enable en = { .enable = 1 };
> -	struct hfi_bitrate brate;
>   	struct hfi_ltr_use ltr_use;
>   	struct hfi_ltr_mark ltr_mark;
>   	u32 bframes;
> @@ -85,19 +101,9 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl)
>   		break;
>   	case V4L2_CID_MPEG_VIDEO_BITRATE:
>   		ctr->bitrate = ctrl->val;
> -		mutex_lock(&inst->lock);
> -		if (inst->streamon_out && inst->streamon_cap) {
> -			ptype = HFI_PROPERTY_CONFIG_VENC_TARGET_BITRATE;
> -			brate.bitrate = ctr->bitrate;
> -			brate.layer_id = 0;
> -
> -			ret = hfi_session_set_property(inst, ptype, &brate);
> -			if (ret) {
> -				mutex_unlock(&inst->lock);
> -				return ret;
> -			}
> -		}
> -		mutex_unlock(&inst->lock);
> +		ret = dynamic_bitrate_update(inst, ctr->bitrate, 0);
> +		if (ret)
> +			return ret;
>   		break;
>   	case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK:
>   		ctr->bitrate_peak = ctrl->val;
> 

Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>

  reply	other threads:[~2024-10-15 23:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-14 22:14 [PATCH v3 0/2] media: venus: Add hierarchical h.264 controls Fritz Koenig
2024-08-14 22:14 ` [PATCH v3 1/2] media: venus: Helper function for dynamically updating bitrate Fritz Koenig
2024-10-15 23:12   ` Bryan O'Donoghue [this message]
2024-08-14 22:14 ` [PATCH v3 2/2] media: venus: Enable h.264 hierarchical coding Fritz Koenig
2024-09-03  7:05   ` Dikshita Agarwal
2024-10-15 22:48     ` Fritz Koenig

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=079045ac-27e7-43f4-a4a4-bc9d03de61c8@linaro.org \
    --to=bryan.odonoghue@linaro.org \
    --cc=frkoenig@chromium.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=nhebert@chromium.org \
    --cc=quic_dikshita@quicinc.com \
    --cc=quic_vgarodia@quicinc.com \
    --cc=stanimir.k.varbanov@gmail.com \
    /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®