Re: [PATCH v3 1/5] media: qcom: iris: Improve format alignment for encoder

From: Wangao Wang

Date: Wed Nov 05 2025 - 21:44:33 EST


On 2025/11/5 20:29, Vikash Garodia wrote:
@@ -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);

For capture plane, offset can be calculated from inst->fmt_dst- >fmt.pix_mp.width - inst->enc_raw_width.

This is to ensure that it is consistent with what we do while setting in iris_hfi_gen2_set_bitstream_resolution.


For downscale case, enc_raw_width > fmt_dst->fmt.pix_mp.width, the offset becomes negative, so I think it should be kept this way.

--
Best Regards,
Wangao