summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorKatsuya Matsubara <matsu@igel.co.jp>2013-04-23 10:51:37 (GMT)
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-06-09 00:50:45 (GMT)
commit697a6d2387692c7f9c94f3bfb3dac474aa840f02 (patch)
tree592e39902a026c0426a2c58ea6cf02fa011404f5 /drivers/media
parent6abb3cf2c34554590791b7486e0e32b291feacc4 (diff)
downloadlinux-697a6d2387692c7f9c94f3bfb3dac474aa840f02.tar.xz
[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 <matsu@igel.co.jp> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/platform/sh_veu.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/media/platform/sh_veu.c b/drivers/media/platform/sh_veu.c
index ebf90bf..59a9dee 100644
--- a/drivers/media/platform/sh_veu.c
+++ b/drivers/media/platform/sh_veu.c
@@ -905,11 +905,11 @@ static int sh_veu_queue_setup(struct vb2_queue *vq,
if (ftmp.fmt.pix.width != pix->width ||
ftmp.fmt.pix.height != pix->height)
return -EINVAL;
- size = pix->bytesperline ? pix->bytesperline * pix->height :
- pix->width * pix->height * fmt->depth >> 3;
+ size = pix->bytesperline ? pix->bytesperline * pix->height * fmt->depth / fmt->ydepth :
+ pix->width * pix->height * fmt->depth / fmt->ydepth;
} else {
vfmt = sh_veu_get_vfmt(veu, vq->type);
- size = vfmt->bytesperline * vfmt->frame.height;
+ size = vfmt->bytesperline * vfmt->frame.height * vfmt->fmt->depth / vfmt->fmt->ydepth;
}
if (count < 2)