Skip to content

pisp_be: Stride alignment. #6985

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion drivers/media/platform/raspberrypi/pisp_be/pisp_be.c
Original file line number Diff line number Diff line change
Expand Up @@ -1104,9 +1104,16 @@ static void pispbe_set_plane_params(struct v4l2_format *f,
for (unsigned int i = 0; i < nplanes; i++) {
struct v4l2_plane_pix_format *p = &f->fmt.pix_mp.plane_fmt[i];
unsigned int bpl, plane_size;
/*
* If a stride has been provided, ensure it meets the minimal
* alignment constraints. If not provided, use an optimal stride
* alignment for efficiency.
*/
const unsigned int align =
p->bytesperline ? fmt->min_align : fmt->opt_align;

bpl = (f->fmt.pix_mp.width * fmt->bit_depth) >> 3;
bpl = ALIGN(max(p->bytesperline, bpl), fmt->align);
bpl = ALIGN(max(p->bytesperline, bpl), align);

plane_size = bpl * f->fmt.pix_mp.height *
(nplanes > 1 ? fmt->plane_factor[i] : total_plane_factor);
Expand Down
Loading