Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] cx18: Fix bytes_per_line

Current GStreamer userspace respects the bytes_per_line from the driver. Set
it to something reasonable for the format chosen.

Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

authored by

Simon Farnsworth and committed by
Mauro Carvalho Chehab
48ab45ad ac0b2b30

+7 -3
+1
drivers/media/pci/cx18/cx18-driver.h
··· 409 409 /* Videobuf for YUV video */ 410 410 u32 pixelformat; 411 411 u32 vb_bytes_per_frame; 412 + u32 vb_bytes_per_line; 412 413 struct list_head vb_capture; /* video capture queue */ 413 414 spinlock_t vb_lock; 414 415 struct timer_list vb_timeout;
+6 -3
drivers/media/pci/cx18/cx18-ioctl.c
··· 159 159 if (id->type == CX18_ENC_STREAM_TYPE_YUV) { 160 160 pixfmt->pixelformat = s->pixelformat; 161 161 pixfmt->sizeimage = s->vb_bytes_per_frame; 162 - pixfmt->bytesperline = 720; 162 + pixfmt->bytesperline = s->vb_bytes_per_line; 163 163 } else { 164 164 pixfmt->pixelformat = V4L2_PIX_FMT_MPEG; 165 165 pixfmt->sizeimage = 128 * 1024; ··· 287 287 s->pixelformat = fmt->fmt.pix.pixelformat; 288 288 /* HM12 YUV size is (Y=(h*720) + UV=(h*(720/2))) 289 289 UYUV YUV size is (Y=(h*720) + UV=(h*(720))) */ 290 - if (s->pixelformat == V4L2_PIX_FMT_HM12) 290 + if (s->pixelformat == V4L2_PIX_FMT_HM12) { 291 291 s->vb_bytes_per_frame = h * 720 * 3 / 2; 292 - else 292 + s->vb_bytes_per_line = 720; /* First plane */ 293 + } else { 293 294 s->vb_bytes_per_frame = h * 720 * 2; 295 + s->vb_bytes_per_line = 1440; /* Packed */ 296 + } 294 297 295 298 mbus_fmt.width = cx->cxhdl.width = w; 296 299 mbus_fmt.height = cx->cxhdl.height = h;