[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0735f540-8085-440c-9c0f-7ac23b52b838@kernel.org>
Date: Tue, 4 Nov 2025 10:39:50 +0000
From: Bryan O'Donoghue <bod@...nel.org>
To: Wangao Wang <wangao.wang@....qualcomm.com>,
Vikash Garodia <vikash.garodia@....qualcomm.com>,
Dikshita Agarwal <dikshita.agarwal@....qualcomm.com>,
Abhinav Kumar <abhinav.kumar@...ux.dev>,
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 v3 1/5] media: qcom: iris: Improve format alignment for
encoder
On 04/11/2025 08:11, Wangao Wang wrote:
> Add members enc_raw_width, enc_raw_height to the struct iris_inst to
> support codec alignment requirements.
>
> HFI_PROP_CROP_OFFSETS is used to inform the firmware of the region
> of interest, rather than indicating that the codec supports crop.
> Therefore, the crop handling has been corrected accordingly.
>
> Tested-by: Neil Armstrong <neil.armstrong@...aro.org> # on SM8650-HDK
> Signed-off-by: Wangao Wang <wangao.wang@....qualcomm.com>
> ---
> .../platform/qcom/iris/iris_hfi_gen2_command.c | 23 ++++++++++++++++------
> drivers/media/platform/qcom/iris/iris_instance.h | 4 ++++
> drivers/media/platform/qcom/iris/iris_venc.c | 10 ++++++++--
> 3 files changed, 29 insertions(+), 8 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 4ce71a14250832440099e4cf3835b4aedfb749e8..2469e027706fb6c9c0b95be11109c3cd0f8d70ce 100644
> --- a/drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c
> +++ b/drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c
> @@ -168,8 +168,7 @@ static int iris_hfi_gen2_session_set_property(struct iris_inst *inst, u32 packet
>
> static int iris_hfi_gen2_set_raw_resolution(struct iris_inst *inst, u32 plane)
> {
> - u32 resolution = inst->fmt_src->fmt.pix_mp.width << 16 |
> - inst->fmt_src->fmt.pix_mp.height;
> + u32 resolution = inst->enc_raw_width << 16 | inst->enc_raw_height;
> u32 port = iris_hfi_gen2_get_port(inst, plane);
>
> return iris_hfi_gen2_session_set_property(inst,
> @@ -216,8 +215,11 @@ 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 codec_align;
> u32 payload[2];
>
> + codec_align = inst->codec == V4L2_PIX_FMT_HEVC ? 32 : 16;
> +
> if (inst->domain == DECODER) {
> if (V4L2_TYPE_IS_OUTPUT(plane)) {
> bottom_offset = (inst->fmt_src->fmt.pix_mp.height - inst->crop.height);
> @@ -231,10 +233,19 @@ 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;
> + 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->enc_raw_height, codec_align) -
> + inst->enc_raw_height);
> + right_offset = (ALIGN(inst->enc_raw_width, codec_align) -
> + inst->enc_raw_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_instance.h b/drivers/media/platform/qcom/iris/iris_instance.h
> index 5982d7adefeab80905478b32cddba7bd4651a691..fbae1662947df73bb3d10b7892839fa1076b7e61 100644
> --- a/drivers/media/platform/qcom/iris/iris_instance.h
> +++ b/drivers/media/platform/qcom/iris/iris_instance.h
> @@ -64,6 +64,8 @@ struct iris_fmt {
> * @frame_rate: frame rate of current instance
> * @operating_rate: operating rate of current instance
> * @hfi_rc_type: rate control type
> + * @enc_raw_width: raw image width for encoder instance
> + * @enc_raw_height: raw image height for encoder instance
> */
>
> struct iris_inst {
> @@ -102,6 +104,8 @@ struct iris_inst {
> u32 frame_rate;
> u32 operating_rate;
> u32 hfi_rc_type;
> + u32 enc_raw_width;
> + u32 enc_raw_height;
> };
>
> #endif
> diff --git a/drivers/media/platform/qcom/iris/iris_venc.c b/drivers/media/platform/qcom/iris/iris_venc.c
> index 099bd5ed4ae0294725860305254c4cad1ec88d7e..7ad747d2272f029e69a56572a188a032f898a3fb 100644
> --- a/drivers/media/platform/qcom/iris/iris_venc.c
> +++ b/drivers/media/platform/qcom/iris/iris_venc.c
> @@ -62,12 +62,15 @@ 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;
>
> + inst->enc_raw_width = DEFAULT_WIDTH;
> + inst->enc_raw_height = DEFAULT_HEIGHT;
> +
> memcpy(&inst->fw_caps[0], &core->inst_fw_caps_enc[0],
> INST_FW_CAP_MAX * sizeof(struct platform_inst_fw_cap));
>
> @@ -249,6 +252,9 @@ static int iris_venc_s_fmt_input(struct iris_inst *inst, struct v4l2_format *f)
> inst->buffers[BUF_INPUT].min_count = iris_vpu_buf_count(inst, BUF_INPUT);
> inst->buffers[BUF_INPUT].size = fmt->fmt.pix_mp.plane_fmt[0].sizeimage;
>
> + inst->enc_raw_width = f->fmt.pix_mp.width;
> + inst->enc_raw_height = f->fmt.pix_mp.height;
> +
> if (f->fmt.pix_mp.width != inst->crop.width ||
> f->fmt.pix_mp.height != inst->crop.height) {
> inst->crop.top = 0;
>
> --
> 2.43.0
>
To me reading this patch you seem to have three or four different
alignment changed bunched into one.
I would prefer to see more granular and specific patches for each change.
Please break this up into more bite size chunks.
---
bod
Powered by blists - more mailing lists