Skip to content
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