aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2012-05-11 09:45:18 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-07-06 17:11:31 -0400
commitc5a861449fcd4f50d30376986ebdb0692f0bf1f1 (patch)
tree9c27aceca89b9849e557a152bdfb4745365c81b4 /drivers/media
parentedbd138ed0cae5abe469b61e368d2629815d4c37 (diff)
[media] cx88: move fmt, width and height to cx8800_dev
These are global properties and do not belong in the filehandle struct. Note: the overlay related fields were just removed: they weren't used at all. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/cx88/cx88-video.c49
-rw-r--r--drivers/media/video/cx88/cx88.h9
2 files changed, 29 insertions, 29 deletions
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index e5e551090d1c..bd1f52f6e264 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -519,8 +519,9 @@ static int
519buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size) 519buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size)
520{ 520{
521 struct cx8800_fh *fh = q->priv_data; 521 struct cx8800_fh *fh = q->priv_data;
522 struct cx8800_dev *dev = fh->dev;
522 523
523 *size = fh->fmt->depth*fh->width*fh->height >> 3; 524 *size = dev->fmt->depth * dev->width * dev->height >> 3;
524 if (0 == *count) 525 if (0 == *count)
525 *count = 32; 526 *count = 32;
526 if (*size * *count > vid_limit * 1024 * 1024) 527 if (*size * *count > vid_limit * 1024 * 1024)
@@ -539,21 +540,21 @@ buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
539 struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb); 540 struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb);
540 int rc, init_buffer = 0; 541 int rc, init_buffer = 0;
541 542
542 BUG_ON(NULL == fh->fmt); 543 BUG_ON(NULL == dev->fmt);
543 if (fh->width < 48 || fh->width > norm_maxw(core->tvnorm) || 544 if (dev->width < 48 || dev->width > norm_maxw(core->tvnorm) ||
544 fh->height < 32 || fh->height > norm_maxh(core->tvnorm)) 545 dev->height < 32 || dev->height > norm_maxh(core->tvnorm))
545 return -EINVAL; 546 return -EINVAL;
546 buf->vb.size = (fh->width * fh->height * fh->fmt->depth) >> 3; 547 buf->vb.size = (dev->width * dev->height * dev->fmt->depth) >> 3;
547 if (0 != buf->vb.baddr && buf->vb.bsize < buf->vb.size) 548 if (0 != buf->vb.baddr && buf->vb.bsize < buf->vb.size)
548 return -EINVAL; 549 return -EINVAL;
549 550
550 if (buf->fmt != fh->fmt || 551 if (buf->fmt != dev->fmt ||
551 buf->vb.width != fh->width || 552 buf->vb.width != dev->width ||
552 buf->vb.height != fh->height || 553 buf->vb.height != dev->height ||
553 buf->vb.field != field) { 554 buf->vb.field != field) {
554 buf->fmt = fh->fmt; 555 buf->fmt = dev->fmt;
555 buf->vb.width = fh->width; 556 buf->vb.width = dev->width;
556 buf->vb.height = fh->height; 557 buf->vb.height = dev->height;
557 buf->vb.field = field; 558 buf->vb.field = field;
558 init_buffer = 1; 559 init_buffer = 1;
559 } 560 }
@@ -603,7 +604,7 @@ buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
603 } 604 }
604 dprintk(2,"[%p/%d] buffer_prepare - %dx%d %dbpp \"%s\" - dma=0x%08lx\n", 605 dprintk(2,"[%p/%d] buffer_prepare - %dx%d %dbpp \"%s\" - dma=0x%08lx\n",
605 buf, buf->vb.i, 606 buf, buf->vb.i,
606 fh->width, fh->height, fh->fmt->depth, fh->fmt->name, 607 dev->width, dev->height, dev->fmt->depth, dev->fmt->name,
607 (unsigned long)buf->risc.dma); 608 (unsigned long)buf->risc.dma);
608 609
609 buf->vb.state = VIDEOBUF_PREPARED; 610 buf->vb.state = VIDEOBUF_PREPARED;
@@ -745,9 +746,6 @@ static int video_open(struct file *file)
745 746
746 file->private_data = fh; 747 file->private_data = fh;
747 fh->dev = dev; 748 fh->dev = dev;
748 fh->width = 320;
749 fh->height = 240;
750 fh->fmt = format_by_fourcc(V4L2_PIX_FMT_BGR24);
751 749
752 mutex_lock(&core->lock); 750 mutex_lock(&core->lock);
753 751
@@ -1005,15 +1003,17 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
1005 struct v4l2_format *f) 1003 struct v4l2_format *f)
1006{ 1004{
1007 struct cx8800_fh *fh = priv; 1005 struct cx8800_fh *fh = priv;
1006 struct cx8800_dev *dev = fh->dev;
1008 1007
1009 f->fmt.pix.width = fh->width; 1008 f->fmt.pix.width = dev->width;
1010 f->fmt.pix.height = fh->height; 1009 f->fmt.pix.height = dev->height;
1011 f->fmt.pix.field = fh->vidq.field; 1010 f->fmt.pix.field = fh->vidq.field;
1012 f->fmt.pix.pixelformat = fh->fmt->fourcc; 1011 f->fmt.pix.pixelformat = dev->fmt->fourcc;
1013 f->fmt.pix.bytesperline = 1012 f->fmt.pix.bytesperline =
1014 (f->fmt.pix.width * fh->fmt->depth) >> 3; 1013 (f->fmt.pix.width * dev->fmt->depth) >> 3;
1015 f->fmt.pix.sizeimage = 1014 f->fmt.pix.sizeimage =
1016 f->fmt.pix.height * f->fmt.pix.bytesperline; 1015 f->fmt.pix.height * f->fmt.pix.bytesperline;
1016 f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
1017 return 0; 1017 return 0;
1018} 1018}
1019 1019
@@ -1065,13 +1065,14 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
1065 struct v4l2_format *f) 1065 struct v4l2_format *f)
1066{ 1066{
1067 struct cx8800_fh *fh = priv; 1067 struct cx8800_fh *fh = priv;
1068 struct cx8800_dev *dev = fh->dev;
1068 int err = vidioc_try_fmt_vid_cap (file,priv,f); 1069 int err = vidioc_try_fmt_vid_cap (file,priv,f);
1069 1070
1070 if (0 != err) 1071 if (0 != err)
1071 return err; 1072 return err;
1072 fh->fmt = format_by_fourcc(f->fmt.pix.pixelformat); 1073 dev->fmt = format_by_fourcc(f->fmt.pix.pixelformat);
1073 fh->width = f->fmt.pix.width; 1074 dev->width = f->fmt.pix.width;
1074 fh->height = f->fmt.pix.height; 1075 dev->height = f->fmt.pix.height;
1075 fh->vidq.field = f->fmt.pix.field; 1076 fh->vidq.field = f->fmt.pix.field;
1076 return 0; 1077 return 0;
1077} 1078}
@@ -1787,6 +1788,10 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
1787 /* Sets device info at pci_dev */ 1788 /* Sets device info at pci_dev */
1788 pci_set_drvdata(pci_dev, dev); 1789 pci_set_drvdata(pci_dev, dev);
1789 1790
1791 dev->width = 320;
1792 dev->height = 240;
1793 dev->fmt = format_by_fourcc(V4L2_PIX_FMT_BGR24);
1794
1790 /* initial device configuration */ 1795 /* initial device configuration */
1791 mutex_lock(&core->lock); 1796 mutex_lock(&core->lock);
1792 cx88_set_tvnorm(core, core->tvnorm); 1797 cx88_set_tvnorm(core, core->tvnorm);
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index 1426993079b0..94af48e91b52 100644
--- a/drivers/media/video/cx88/cx88.h
+++ b/drivers/media/video/cx88/cx88.h
@@ -457,14 +457,7 @@ struct cx8800_fh {
457 struct cx8800_dev *dev; 457 struct cx8800_dev *dev;
458 unsigned int resources; 458 unsigned int resources;
459 459
460 /* video overlay */
461 struct v4l2_window win;
462 struct v4l2_clip *clips;
463 unsigned int nclips;
464
465 /* video capture */ 460 /* video capture */
466 const struct cx8800_fmt *fmt;
467 unsigned int width,height;
468 struct videobuf_queue vidq; 461 struct videobuf_queue vidq;
469 462
470 /* vbi capture */ 463 /* vbi capture */
@@ -489,6 +482,8 @@ struct cx8800_dev {
489 struct pci_dev *pci; 482 struct pci_dev *pci;
490 unsigned char pci_rev,pci_lat; 483 unsigned char pci_rev,pci_lat;
491 484
485 const struct cx8800_fmt *fmt;
486 unsigned int width, height;
492 487
493 /* capture queues */ 488 /* capture queues */
494 struct cx88_dmaqueue vidq; 489 struct cx88_dmaqueue vidq;