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

[media] v4l: soc-camera: Store negotiated buffer settings

This fixes the problem in which a host driver
sets a personalized sizeimage or bytesperline field,
and gets ignored when doing G_FMT.

Signed-off-by: Sergio Aguirre <saaguirre@ti.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

authored by

Sergio Aguirre and committed by
Mauro Carvalho Chehab
0e4c180d 4be22b6a

+6 -5
+4 -5
drivers/media/video/soc_camera.c
··· 389 389 390 390 icd->user_width = pix->width; 391 391 icd->user_height = pix->height; 392 + icd->bytesperline = pix->bytesperline; 393 + icd->sizeimage = pix->sizeimage; 392 394 icd->colorspace = pix->colorspace; 393 395 icd->field = pix->field; 394 396 if (ici->ops->init_videobuf) ··· 663 661 664 662 pix->width = icd->user_width; 665 663 pix->height = icd->user_height; 664 + pix->bytesperline = icd->bytesperline; 665 + pix->sizeimage = icd->sizeimage; 666 666 pix->field = icd->field; 667 667 pix->pixelformat = icd->current_fmt->host_fmt->fourcc; 668 - pix->bytesperline = soc_mbus_bytes_per_line(pix->width, 669 - icd->current_fmt->host_fmt); 670 668 pix->colorspace = icd->colorspace; 671 - if (pix->bytesperline < 0) 672 - return pix->bytesperline; 673 - pix->sizeimage = pix->height * pix->bytesperline; 674 669 dev_dbg(&icd->dev, "current_fmt->fourcc: 0x%08x\n", 675 670 icd->current_fmt->host_fmt->fourcc); 676 671 return 0;
+2
include/media/soc_camera.h
··· 30 30 struct device *pdev; /* Platform device */ 31 31 s32 user_width; 32 32 s32 user_height; 33 + u32 bytesperline; /* for padding, zero if unused */ 34 + u32 sizeimage; 33 35 enum v4l2_colorspace colorspace; 34 36 unsigned char iface; /* Host number */ 35 37 unsigned char devnum; /* Device number per host */