Re: [PATCH 4/5] media: iris: fix VPU4x encoder line buffer size calculations

From: Bryan O'Donoghue

Date: Mon Sep 14 2026 - 15:52:36 EST


On 14/09/2026 14:00, Wangao Wang wrote:
size_vpss_line_buf_vpu33() expects (num_pipes, height, width) but was
called with width and height swapped, miscalculating VPSS line buffer
size for non-square resolutions.

iris_vpu4x_enc_line_size was reading resolutions directly from
inst->fmt_dst. Use iris_vpu_enc_get_bitstream_{width,height}() which
account for the 90/270-degree rotation case.

Fixes: df816dce1b01 ("media: iris: Introduce buffer size calculations for vpu4")

Signed-off-by: Wangao Wang <wangao.wang@xxxxxxxxxxxxxxxx>
---
drivers/media/platform/qcom/iris/iris_vpu_buffer.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/media/platform/qcom/iris/iris_vpu_buffer.c b/drivers/media/platform/qcom/iris/iris_vpu_buffer.c
index 55996fd0d14c385ee63d2577b3e6d71b51d9e541..c4922a25b4501a851e31fcc85bc13735803be366 100644
--- a/drivers/media/platform/qcom/iris/iris_vpu_buffer.c
+++ b/drivers/media/platform/qcom/iris/iris_vpu_buffer.c
@@ -2059,8 +2059,8 @@ static u32 hfi_vpu4x_buffer_line_enc(u32 frame_width, u32 frame_height,
u32 dma_opb_lb_size = size_dma_opb_lb(num_vpp_pipes_enc, frame_width_coded,
frame_height_coded);
u32 dse_lb_size = ALIGN((256 + (16 * (frame_width_coded >> 4))), DMA_ALIGNMENT);
- u32 size_vpss_lb_enc = size_vpss_line_buf_vpu33(num_vpp_pipes_enc, frame_width_coded,
- frame_height_coded);
+ u32 size_vpss_lb_enc = size_vpss_line_buf_vpu33(num_vpp_pipes_enc, frame_height_coded,
+ frame_width_coded);

Only this much belongs in this patch - the fix.


return se_lb_size + te_lb_size + fe_lb_size + md_lb_size + dma_opb_lb_size +
dse_lb_size + size_vpss_lb_enc;
@@ -2070,9 +2070,8 @@ static u32 iris_vpu4x_enc_line_size(struct iris_inst *inst)
{
u32 num_vpp_pipes = inst->core->iris_platform_data->num_vpp_pipe;
u32 lcu_size = inst->codec == V4L2_PIX_FMT_HEVC ? 32 : 16;
- struct v4l2_format *f = inst->fmt_dst;
- u32 height = f->fmt.pix_mp.height;
- u32 width = f->fmt.pix_mp.width;
+ u32 height = iris_vpu_enc_get_bitstream_height(inst);
+ u32 width = iris_vpu_enc_get_bitstream_width(inst);

return hfi_vpu4x_buffer_line_enc(width, height, 0, num_vpp_pipes,
lcu_size, inst->codec);

--
2.43.0


This change should go into its own patch since the original here doesn't swap height and width, so if that is a fix, it should go into its own fixes patch.

Best practice is to stack your fixes at the start of your series so that you can be sure your fixes don't depend on whatever functionality you are enabling.

---
bod