summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
Diffstat (limited to 'linux')
-rw-r--r--linux/drivers/media/common/saa7146_core.c3
-rw-r--r--linux/drivers/media/common/saa7146_video.c26
2 files changed, 14 insertions, 15 deletions
diff --git a/linux/drivers/media/common/saa7146_core.c b/linux/drivers/media/common/saa7146_core.c
index b44ef24f4..574b785be 100644
--- a/linux/drivers/media/common/saa7146_core.c
+++ b/linux/drivers/media/common/saa7146_core.c
@@ -172,7 +172,8 @@ void saa7146_pgtable_build_single(struct pci_dev *pci, struct saa7146_pgtable *p
/*
ptr = pt->cpu;
- for(i=0;i<60;i++) {
+ printk("offset: %d\n",pt->offset);
+ for(i=0;i<5;i++) {
printk("ptr1 %d: 0x%08x\n",i,ptr[i]);
}
*/
diff --git a/linux/drivers/media/common/saa7146_video.c b/linux/drivers/media/common/saa7146_video.c
index af13891b9..e0bf38f16 100644
--- a/linux/drivers/media/common/saa7146_video.c
+++ b/linux/drivers/media/common/saa7146_video.c
@@ -169,7 +169,8 @@ static int try_fmt(struct saa7146_fh *fh, struct v4l2_format *f)
struct saa7146_format *fmt;
enum v4l2_field field;
int maxw, maxh;
-
+ int calc_bpl;
+
DEB_EE(("V4L2_BUF_TYPE_VIDEO_CAPTURE: dev:%p, fh:%p\n",dev,fh));
fmt = format_by_fourcc(dev,f->fmt.pix.pixelformat);
@@ -212,19 +213,16 @@ static int try_fmt(struct saa7146_fh *fh, struct v4l2_format *f)
if (f->fmt.pix.height > maxh)
f->fmt.pix.height = maxh;
- if (f->fmt.pix.bytesperline == 0) {
- f->fmt.pix.sizeimage = (f->fmt.pix.width * f->fmt.pix.height * fmt->depth)/8;
- } else {
- DEB_D(("bytesperline: %d\n",f->fmt.pix.bytesperline));
- if (f->fmt.pix.bytesperline < (f->fmt.pix.width * fmt->depth)/8)
- f->fmt.pix.bytesperline = f->fmt.pix.width;
- DEB_D(("bytesperline: %d\n",f->fmt.pix.bytesperline));
- if (f->fmt.pix.bytesperline > (2*PAGE_SIZE* fmt->depth)/8)
- f->fmt.pix.bytesperline = f->fmt.pix.width;
- f->fmt.pix.sizeimage = (f->fmt.pix.width * f->fmt.pix.bytesperline);
- }
-
- DEB_D(("bytesperline: %d\n",f->fmt.pix.bytesperline));
+ calc_bpl = (f->fmt.pix.width * fmt->depth)/8;
+
+ if (f->fmt.pix.bytesperline < calc_bpl)
+ f->fmt.pix.bytesperline = calc_bpl;
+
+ if (f->fmt.pix.bytesperline > (2*PAGE_SIZE * fmt->depth)/8) /* arbitrary constraint */
+ f->fmt.pix.bytesperline = calc_bpl;
+
+ f->fmt.pix.sizeimage = f->fmt.pix.bytesperline * f->fmt.pix.height;
+ DEB_D(("w:%d, h:%d, bytesperline:%d, sizeimage:%d\n",f->fmt.pix.width,f->fmt.pix.height,f->fmt.pix.bytesperline,f->fmt.pix.sizeimage));
return 0;
}