Commit 4a1ccbff authored by Hans de Goede's avatar Hans de Goede Committed by Greg Kroah-Hartman

saa7134: Fix bytesperline not being set correctly for planar formats

commit 3e71da19 upstream.

bytesperline should be the bytesperline for the first plane for planar
formats, not that of all planes combined.

This fixes a crash in xawtv caused by the wrong bpl.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1305389Reported-and-tested-by: default avatarStas Sergeev <stsp@list.ru>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ef431b61
...@@ -1342,10 +1342,13 @@ static int saa7134_g_fmt_vid_cap(struct file *file, void *priv, ...@@ -1342,10 +1342,13 @@ static int saa7134_g_fmt_vid_cap(struct file *file, void *priv,
f->fmt.pix.height = dev->height; f->fmt.pix.height = dev->height;
f->fmt.pix.field = dev->cap.field; f->fmt.pix.field = dev->cap.field;
f->fmt.pix.pixelformat = dev->fmt->fourcc; f->fmt.pix.pixelformat = dev->fmt->fourcc;
f->fmt.pix.bytesperline = if (dev->fmt->planar)
(f->fmt.pix.width * dev->fmt->depth) >> 3; f->fmt.pix.bytesperline = f->fmt.pix.width;
else
f->fmt.pix.bytesperline =
(f->fmt.pix.width * dev->fmt->depth) / 8;
f->fmt.pix.sizeimage = f->fmt.pix.sizeimage =
f->fmt.pix.height * f->fmt.pix.bytesperline; (f->fmt.pix.height * f->fmt.pix.width * dev->fmt->depth) / 8;
f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
f->fmt.pix.priv = 0; f->fmt.pix.priv = 0;
return 0; return 0;
...@@ -1424,10 +1427,13 @@ static int saa7134_try_fmt_vid_cap(struct file *file, void *priv, ...@@ -1424,10 +1427,13 @@ static int saa7134_try_fmt_vid_cap(struct file *file, void *priv,
if (f->fmt.pix.height > maxh) if (f->fmt.pix.height > maxh)
f->fmt.pix.height = maxh; f->fmt.pix.height = maxh;
f->fmt.pix.width &= ~0x03; f->fmt.pix.width &= ~0x03;
f->fmt.pix.bytesperline = if (fmt->planar)
(f->fmt.pix.width * fmt->depth) >> 3; f->fmt.pix.bytesperline = f->fmt.pix.width;
else
f->fmt.pix.bytesperline =
(f->fmt.pix.width * fmt->depth) / 8;
f->fmt.pix.sizeimage = f->fmt.pix.sizeimage =
f->fmt.pix.height * f->fmt.pix.bytesperline; (f->fmt.pix.height * f->fmt.pix.width * fmt->depth) / 8;
f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
f->fmt.pix.priv = 0; f->fmt.pix.priv = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment