[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a9aadabe-6e69-b3d5-fddb-259c46620172@oss.qualcomm.com>
Date: Thu, 13 Nov 2025 11:12:40 +0530
From: Dikshita Agarwal <dikshita.agarwal@....qualcomm.com>
To: Wangao Wang <wangao.wang@....qualcomm.com>,
Vikash Garodia <vikash.garodia@....qualcomm.com>,
Abhinav Kumar <abhinav.kumar@...ux.dev>,
Bryan O'Donoghue <bod@...nel.org>,
Mauro Carvalho Chehab <mchehab@...nel.org>
Cc: linux-media@...r.kernel.org, linux-arm-msm@...r.kernel.org,
linux-kernel@...r.kernel.org,
Neil Armstrong <neil.armstrong@...aro.org>, quic_qiweil@...cinc.com,
quic_renjiang@...cinc.com
Subject: Re: [PATCH v5 2/6] media: qcom: iris: Improve crop_offset handling
for encoder
On 11/10/2025 3:53 PM, Wangao Wang wrote:
> The setting of HFI_PROP_CROP_OFFSETS for the OUTPUT port is correct,
> but on the CAPTURE port it is used to inform the firmware about the
> ROI, so crop_offset needs to be handled accordingly.
>
> Signed-off-by: Wangao Wang <wangao.wang@....qualcomm.com>
> ---
> .../media/platform/qcom/iris/iris_hfi_gen2_command.c | 20 +++++++++++++++-----
> drivers/media/platform/qcom/iris/iris_venc.c | 4 ++--
> 2 files changed, 17 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c b/drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c
> index 48962d2e4962935bbc24244edfbbdcd42dab151f..30c0cbe22d1d34b5bbbc6bdbd3881dd43a6ff647 100644
> --- a/drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c
> +++ b/drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c
> @@ -215,7 +215,7 @@ static int iris_hfi_gen2_set_crop_offsets(struct iris_inst *inst, u32 plane)
> u32 port = iris_hfi_gen2_get_port(inst, plane);
> u32 bottom_offset, right_offset;
> u32 left_offset, top_offset;
> - u32 payload[2];
> + u32 payload[2], codec_align;
>
> if (inst->domain == DECODER) {
> if (V4L2_TYPE_IS_OUTPUT(plane)) {
> @@ -230,10 +230,20 @@ static int iris_hfi_gen2_set_crop_offsets(struct iris_inst *inst, u32 plane)
> top_offset = inst->compose.top;
> }
> } else {
> - bottom_offset = (inst->fmt_src->fmt.pix_mp.height - inst->crop.height);
> - right_offset = (inst->fmt_src->fmt.pix_mp.width - inst->crop.width);
> - left_offset = inst->crop.left;
> - top_offset = inst->crop.top;
> + codec_align = inst->codec == V4L2_PIX_FMT_HEVC ? 32 : 16;
> + if (V4L2_TYPE_IS_OUTPUT(plane)) {
> + bottom_offset = (inst->enc_raw_height - inst->crop.height);
> + right_offset = (inst->enc_raw_width - inst->crop.width);
> + left_offset = inst->crop.left;
> + top_offset = inst->crop.top;
> + } else {
> + bottom_offset = (ALIGN(inst->fmt_dst->fmt.pix_mp.height, codec_align) -
> + inst->fmt_dst->fmt.pix_mp.height);
> + right_offset = (ALIGN(inst->fmt_dst->fmt.pix_mp.width, codec_align) -
> + inst->fmt_dst->fmt.pix_mp.width);
> + left_offset = 0;
> + top_offset = 0;
> + }
> }
>
> payload[0] = FIELD_PREP(GENMASK(31, 16), left_offset) | top_offset;
> diff --git a/drivers/media/platform/qcom/iris/iris_venc.c b/drivers/media/platform/qcom/iris/iris_venc.c
> index 50a3eb975a2523abf1c2df128a66a762a1ed35c6..7ad747d2272f029e69a56572a188a032f898a3fb 100644
> --- a/drivers/media/platform/qcom/iris/iris_venc.c
> +++ b/drivers/media/platform/qcom/iris/iris_venc.c
> @@ -62,8 +62,8 @@ int iris_venc_inst_init(struct iris_inst *inst)
>
> inst->crop.left = 0;
> inst->crop.top = 0;
> - inst->crop.width = f->fmt.pix_mp.width;
> - inst->crop.height = f->fmt.pix_mp.height;
> + inst->crop.width = DEFAULT_WIDTH;
> + inst->crop.height = DEFAULT_HEIGHT;
>
> inst->operating_rate = DEFAULT_FPS;
> inst->frame_rate = DEFAULT_FPS;
>
Reviewed-by: Dikshita Agarwal <dikshita.agarwal@....qualcomm.com>
Thanks,
Dikshita
Powered by blists - more mailing lists