Skip to content

Commit 697a6d2

Browse files
Katsuya MatsubaraMauro Carvalho Chehab
authored andcommitted
[media] sh_veu: fix the buffer size calculation
The 'bytesperline' value only indicates the stride of the Y plane if the color format is planar, such as NV12. When calculating the total plane size, the size of CbCr plane must also be considered. Signed-off-by: Katsuya Matsubara <[email protected]> Signed-off-by: Guennadi Liakhovetski <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 6abb3cf commit 697a6d2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/media/platform/sh_veu.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -905,11 +905,11 @@ static int sh_veu_queue_setup(struct vb2_queue *vq,
905905
if (ftmp.fmt.pix.width != pix->width ||
906906
ftmp.fmt.pix.height != pix->height)
907907
return -EINVAL;
908-
size = pix->bytesperline ? pix->bytesperline * pix->height :
909-
pix->width * pix->height * fmt->depth >> 3;
908+
size = pix->bytesperline ? pix->bytesperline * pix->height * fmt->depth / fmt->ydepth :
909+
pix->width * pix->height * fmt->depth / fmt->ydepth;
910910
} else {
911911
vfmt = sh_veu_get_vfmt(veu, vq->type);
912-
size = vfmt->bytesperline * vfmt->frame.height;
912+
size = vfmt->bytesperline * vfmt->frame.height * vfmt->fmt->depth / vfmt->fmt->ydepth;
913913
}
914914

915915
if (count < 2)

0 commit comments

Comments
 (0)