Skip to content

media: venus: fix NV12 buffer sizing and incorrect capability alignment#870

Merged
vgarodia merged 3 commits intoqualcomm-linux:tech/mm/videofrom
renjiang-qti:tech/mm/video
Apr 3, 2026
Merged

media: venus: fix NV12 buffer sizing and incorrect capability alignment#870
vgarodia merged 3 commits intoqualcomm-linux:tech/mm/videofrom
renjiang-qti:tech/mm/video

Conversation

@renjiang-qti
Copy link
Copy Markdown

The NV12 frame size calculation adds unnecessary 4K/8K padding, leading
to buffer overallocation. The redundant padding is removed while keeping
final 4K alignment. In addition, HFI platform capabilities advertise an
overly strict 16-pixel alignment for frame and blur dimensions, which
can reject valid userspace configurations. The alignment step is relaxed
to 1 without changing min/max limits.

CRs-Fixed: 4450386 4470055

Renjiang Han added 3 commits April 2, 2026 11:16
…culation

get_framesize_raw_nv12() currently adds SZ_4K to the UV plane size and an
additional SZ_8K to the total buffer size. This inflates the calculated
sizeimage and leads userspace to over-allocate buffers without a clear
requirement.

Remove the extra SZ_4K/SZ_8K padding and compute the NV12 size as the sum
of Y and UV planes, keeping the final ALIGN(size, SZ_4K) intact.

Link: https://lore.kernel.org/linux-arm-msm/20260331-fix_venus_bug_issue-v1-1-e4ae7a1d8db2@oss.qualcomm.com

Fixes: e1cb72d ("media: venus: helpers: move frame size calculations on common place")
Signed-off-by: Renjiang Han <renjiang.han@oss.qualcomm.com>
…s on v4

Encoder HFI capabilities on v4 advertise a 16-pixel step for frame and
blur dimensions. This is overly restrictive and can cause userspace caps
negotiation to fail even for valid resolutions.

Relax the advertised step size to 1 and keep alignment enforcement in
buffer layout and size calculations.

Link: https://lore.kernel.org/linux-arm-msm/20260331-fix_venus_bug_issue-v1-2-e4ae7a1d8db2@oss.qualcomm.com

Fixes: 8b88cab ("media: venus: hfi_plat_v4: Populate codecs and capabilities for v4")
Signed-off-by: Renjiang Han <renjiang.han@oss.qualcomm.com>
Encoder HFI capabilities on v6 enforce a 16-pixel step for frame and blur
dimensions, which does not reflect actual hardware requirements and can
reject valid userspace configurations.

Relax the step size to 1 while leaving min/max limits unchanged.

Link: https://lore.kernel.org/linux-arm-msm/20260331-fix_venus_bug_issue-v1-3-e4ae7a1d8db2@oss.qualcomm.com

Fixes: 869d77e ("media: venus: hfi_plat_v6: Populate capabilities for v6")
Signed-off-by: Renjiang Han <renjiang.han@oss.qualcomm.com>
Copy link
Copy Markdown

@vgarodia vgarodia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be FROMLIST

@vgarodia
Copy link
Copy Markdown

vgarodia commented Apr 2, 2026

It should be FROMLIST

Pls ignore

@vgarodia vgarodia merged commit bb5c223 into qualcomm-linux:tech/mm/video Apr 3, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants