]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
V4L/DVB (6252): Adapt drivers to use the newer videobuf modules
authorMauro Carvalho Chehab <mchehab@infradead.org>
Thu, 23 Aug 2007 19:37:49 +0000 (16:37 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Wed, 10 Oct 2007 01:14:55 +0000 (22:14 -0300)
PCI-dependent videobuf_foo methods were renamed as videobuf_pci_foo.

Also, videobuf_dmabuf is now part of videobuf-dma-sg private struct.
So, to access it, a subroutine call is needed.

This patch renames all occurences of those function calls to be
consistent with the video-buf split.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
http://thread.gmane.org/gmane.comp.video.video4linux/34978/focus=34981
Reviewed-by: Ricardo Cerqueira <v4l@cerqueira.org>
34 files changed:
Documentation/dvb/faq.txt
drivers/media/Kconfig
drivers/media/common/Kconfig
drivers/media/common/saa7146_core.c
drivers/media/common/saa7146_fops.c
drivers/media/common/saa7146_vbi.c
drivers/media/common/saa7146_video.c
drivers/media/video/Kconfig
drivers/media/video/Makefile
drivers/media/video/bt8xx/Kconfig
drivers/media/video/bt8xx/bttv-driver.c
drivers/media/video/bt8xx/bttv-risc.c
drivers/media/video/bt8xx/bttv-vbi.c
drivers/media/video/bt8xx/bttvp.h
drivers/media/video/cafe_ccic.c
drivers/media/video/cx88/Kconfig
drivers/media/video/cx88/cx88-alsa.c
drivers/media/video/cx88/cx88-blackbird.c
drivers/media/video/cx88/cx88-core.c
drivers/media/video/cx88/cx88-dvb.c
drivers/media/video/cx88/cx88-mpeg.c
drivers/media/video/cx88/cx88-vbi.c
drivers/media/video/cx88/cx88-video.c
drivers/media/video/cx88/cx88.h
drivers/media/video/saa7134/Kconfig
drivers/media/video/saa7134/saa7134-core.c
drivers/media/video/saa7134/saa7134-dvb.c
drivers/media/video/saa7134/saa7134-empress.c
drivers/media/video/saa7134/saa7134-ts.c
drivers/media/video/saa7134/saa7134-vbi.c
drivers/media/video/saa7134/saa7134-video.c
drivers/media/video/saa7134/saa7134.h
drivers/media/video/video-buf-dvb.c
include/media/saa7146_vv.h

index dbcedf5833eea25ce641caec237aae6ddd5cbd09..2511a335abd66a3ef4742592aa4212361bf7ea1f 100644 (file)
@@ -150,7 +150,7 @@ Some very frequently asked questions about linuxtv-dvb
        - saa7146_vv: SAA7146 video and vbi functions. These are only needed
          for full-featured cards.
 
-       - video-buf: capture helper module for the saa7146_vv driver. This
+       - videobuf-dma-sg: capture helper module for the saa7146_vv driver. This
          one is responsible to handle capture buffers.
 
        - dvb-ttpci: The main driver for AV7110 based, full-featured
index 3f8cfa873de526ee9877b2fb33ffbcc89aa21042..28ee65c53917db49527a05af2a56a03a807eb14f 100644 (file)
@@ -126,8 +126,12 @@ config TUNER_SIMPLE
 
 endif # VIDEO_TUNER_CUSTOMIZE
 
-config VIDEO_BUF
+config VIDEOBUF_GEN
+       tristate
+
+config VIDEOBUF_DMA_SG
        depends on PCI
+       select VIDEOBUF_GEN
        tristate
 
 config VIDEO_BUF_DVB
index 5c63c8e24ee74babe23ec1dcdd2434a8e45b30dd..c5092ef1082f1436d4fe6f4ef8f5e8bc7d8f6791 100644 (file)
@@ -5,5 +5,5 @@ config VIDEO_SAA7146
 config VIDEO_SAA7146_VV
        tristate
        depends on VIDEO_DEV
-       select VIDEO_BUF
+       select VIDEOBUF_DMA_SG
        select VIDEO_SAA7146
index 1c962a2b44df3f0a2d6e78fbd67ecee8f433fc47..365a22118a0914c3eb3102af30463694e7cdb6c1 100644 (file)
@@ -100,7 +100,7 @@ int saa7146_wait_for_debi_done(struct saa7146_dev *dev, int nobusyloop)
  * general helper functions
  ****************************************************************************/
 
-/* this is videobuf_vmalloc_to_sg() from video-buf.c
+/* this is videobuf_vmalloc_to_sg() from videobuf-dma-sg.c
    make sure virt has been allocated with vmalloc_32(), otherwise the BUG()
    may be triggered on highmem machines */
 static struct scatterlist* vmalloc_to_sg(unsigned char *virt, int nr_pages)
index b4770aecc01db56afd363b9fcedbdfe49be90a20..67d1b1b1b25420245ca5e28de9e45cf4dd65e95b 100644 (file)
@@ -53,13 +53,14 @@ void saa7146_res_free(struct saa7146_fh *fh, unsigned int bits)
 void saa7146_dma_free(struct saa7146_dev *dev,struct videobuf_queue *q,
                                                struct saa7146_buf *buf)
 {
+       struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb);
        DEB_EE(("dev:%p, buf:%p\n",dev,buf));
 
        BUG_ON(in_interrupt());
 
        videobuf_waiton(&buf->vb,0,0);
-       videobuf_dma_unmap(q, &buf->vb.dma);
-       videobuf_dma_free(&buf->vb.dma);
+       videobuf_dma_unmap(q, dma);
+       videobuf_dma_free(dma);
        buf->vb.state = STATE_NEEDS_INIT;
 }
 
index 063608462ebe19222923c2a57ae010257eaca55e..6103484e4442bb4564809ddb33be6a3a838e2c2c 100644 (file)
@@ -165,7 +165,7 @@ static void saa7146_set_vbi_capture(struct saa7146_dev *dev, struct saa7146_buf
        /* we don't wait here for the first field anymore. this is different from the video
           capture and might cause that the first buffer is only half filled (with only
           one field). but since this is some sort of streaming data, this is not that negative.
-          but by doing this, we can use the whole engine from video-buf.c... */
+          but by doing this, we can use the whole engine from videobuf-dma-sg.c... */
 
 /*
        WRITE_RPS1(CMD_PAUSE | CMD_OAN | CMD_SIG1 | e_wait);
@@ -239,6 +239,8 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,e
                saa7146_dma_free(dev,q,buf);
 
        if (STATE_NEEDS_INIT == buf->vb.state) {
+               struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb);
+
                buf->vb.width  = llength;
                buf->vb.height = lines;
                buf->vb.size   = size;
@@ -250,7 +252,8 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,e
                err = videobuf_iolock(q,&buf->vb, NULL);
                if (err)
                        goto oops;
-               err = saa7146_pgtable_build_single(dev->pci, &buf->pt[2], buf->vb.dma.sglist, buf->vb.dma.sglen);
+               err = saa7146_pgtable_build_single(dev->pci, &buf->pt[2],
+                                                dma->sglist, dma->sglen);
                if (0 != err)
                        return err;
        }
@@ -404,7 +407,7 @@ static int vbi_open(struct saa7146_dev *dev, struct file *file)
        fh->vbi_fmt.start[1] = 312;
        fh->vbi_fmt.count[1] = 16;
 
-       videobuf_queue_init(&fh->vbi_q, &vbi_qops,
+       videobuf_queue_pci_init(&fh->vbi_q, &vbi_qops,
                            dev->pci, &dev->slock,
                            V4L2_BUF_TYPE_VBI_CAPTURE,
                            V4L2_FIELD_SEQ_TB, // FIXME: does this really work?
index 664280c78ff299ef6bfd1c9425c8a0a63a1b7e4f..29dbc602a484fead61cb76a89fa9accbf46bf291 100644 (file)
@@ -594,8 +594,9 @@ static int set_control(struct saa7146_fh *fh, struct v4l2_control *c)
 static int saa7146_pgtable_build(struct saa7146_dev *dev, struct saa7146_buf *buf)
 {
        struct pci_dev *pci = dev->pci;
-       struct scatterlist *list = buf->vb.dma.sglist;
-       int length = buf->vb.dma.sglen;
+       struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb);
+       struct scatterlist *list = dma->sglist;
+       int length = dma->sglen;
        struct saa7146_format *sfmt = format_by_fourcc(dev,buf->fmt->pixelformat);
 
        DEB_EE(("dev:%p, buf:%p, sg_len:%d\n",dev,buf,length));
@@ -655,7 +656,7 @@ static int saa7146_pgtable_build(struct saa7146_dev *dev, struct saa7146_buf *bu
 
                /* if we have a user buffer, the first page may not be
                   aligned to a page boundary. */
-               pt1->offset = buf->vb.dma.sglist->offset;
+               pt1->offset = list->offset;
                pt2->offset = pt1->offset+o1;
                pt3->offset = pt1->offset+o2;
 
@@ -1411,7 +1412,7 @@ static int video_open(struct saa7146_dev *dev, struct file *file)
        sfmt = format_by_fourcc(dev,fh->video_fmt.pixelformat);
        fh->video_fmt.sizeimage = (fh->video_fmt.width * fh->video_fmt.height * sfmt->depth)/8;
 
-       videobuf_queue_init(&fh->video_q, &video_qops,
+       videobuf_queue_pci_init(&fh->video_q, &video_qops,
                            dev->pci, &dev->slock,
                            V4L2_BUF_TYPE_VIDEO_CAPTURE,
                            V4L2_FIELD_INTERLACED,
index 5d74925748c0d996864e59494f968f9eec7c4611..c4f424422f700eac0d307706da89ebbb51718604 100644 (file)
@@ -364,7 +364,7 @@ endmenu # encoder / decoder chips
 config VIDEO_VIVI
        tristate "Virtual Video Driver"
        depends on VIDEO_V4L2 && !SPARC32 && !SPARC64 && PCI
-       select VIDEO_BUF
+       select VIDEOBUF_DMA_SG
        default n
        ---help---
          Enables a virtual video driver. This device shows a color bar
index 9e99d2e1c1bd7876db468155eb258ccaa1c39066..cb300241eb8991f8b700b60a7bf095b9d617a4f9 100644 (file)
@@ -87,7 +87,8 @@ obj-$(CONFIG_TUNER_TDA8290) += tda8290.o
 obj-$(CONFIG_TUNER_TEA5767) += tea5767.o
 obj-$(CONFIG_TUNER_TEA5761) += tea5761.o
 
-obj-$(CONFIG_VIDEO_BUF)   += video-buf.o
+obj-$(CONFIG_VIDEOBUF_GEN) += videobuf-core.o
+obj-$(CONFIG_VIDEOBUF_DMA_SG) += videobuf-dma-sg.o
 obj-$(CONFIG_VIDEO_BUF_DVB) += video-buf-dvb.o
 obj-$(CONFIG_VIDEO_BTCX)  += btcx-risc.o
 obj-$(CONFIG_VIDEO_TVEEPROM) += tveeprom.o
index 58eae887a62992c4a542193a219a81c4f4061f8d..2ca162b390a219fe7b7cb8501ab99eb18f06f048 100644 (file)
@@ -4,7 +4,7 @@ config VIDEO_BT848
        select I2C_ALGOBIT
        select FW_LOADER
        select VIDEO_BTCX
-       select VIDEO_BUF
+       select VIDEOBUF_DMA_SG
        select VIDEO_IR
        select VIDEO_TUNER
        select VIDEO_TVEEPROM
index 0711c9507843f2afe4222dae483536d432f8dc63..4ab4e14b5c645261e041812940c60bd6cbf83276 100644 (file)
@@ -2582,7 +2582,7 @@ static int setup_window(struct bttv_fh *fh, struct bttv *btv,
        if (check_btres(fh, RESOURCE_OVERLAY)) {
                struct bttv_buffer *new;
 
-               new = videobuf_alloc(sizeof(*new));
+               new = videobuf_pci_alloc(sizeof(*new));
                new->crop = btv->crop[!!fh->do_crop].rect;
                bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new);
                retval = bttv_switch_overlay(btv,fh,new);
@@ -3048,7 +3048,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
                mutex_lock(&fh->cap.lock);
                if (*on) {
                        fh->ov.tvnorm = btv->tvnorm;
-                       new = videobuf_alloc(sizeof(*new));
+                       new = videobuf_pci_alloc(sizeof(*new));
                        new->crop = btv->crop[!!fh->do_crop].rect;
                        bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new);
                } else {
@@ -3141,9 +3141,12 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
                        retval = -EIO;
                        /* fall through */
                case STATE_DONE:
-                       videobuf_dma_sync(&fh->cap,&buf->vb.dma);
+               {
+                       struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb);
+                       videobuf_dma_sync(&fh->cap,dma);
                        bttv_dma_free(&fh->cap,btv,buf);
                        break;
+               }
                default:
                        retval = -EINVAL;
                        break;
@@ -3337,7 +3340,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
                        if (check_btres(fh, RESOURCE_OVERLAY)) {
                                struct bttv_buffer *new;
 
-                               new = videobuf_alloc(sizeof(*new));
+                               new = videobuf_pci_alloc(sizeof(*new));
                                new->crop = btv->crop[!!fh->do_crop].rect;
                                bttv_overlay_risc(btv,&fh->ov,fh->ovfmt,new);
                                retval = bttv_switch_overlay(btv,fh,new);
@@ -3696,7 +3699,7 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait)
                                mutex_unlock(&fh->cap.lock);
                                return POLLERR;
                        }
-                       fh->cap.read_buf = videobuf_alloc(fh->cap.msize);
+                       fh->cap.read_buf = videobuf_pci_alloc(fh->cap.msize);
                        if (NULL == fh->cap.read_buf) {
                                mutex_unlock(&fh->cap.lock);
                                return POLLERR;
@@ -3763,13 +3766,13 @@ static int bttv_open(struct inode *inode, struct file *file)
        fh->ov.setup_ok = 0;
        v4l2_prio_open(&btv->prio,&fh->prio);
 
-       videobuf_queue_init(&fh->cap, &bttv_video_qops,
+       videobuf_queue_pci_init(&fh->cap, &bttv_video_qops,
                            btv->c.pci, &btv->s_lock,
                            V4L2_BUF_TYPE_VIDEO_CAPTURE,
                            V4L2_FIELD_INTERLACED,
                            sizeof(struct bttv_buffer),
                            fh);
-       videobuf_queue_init(&fh->vbi, &bttv_vbi_qops,
+       videobuf_queue_pci_init(&fh->vbi, &bttv_vbi_qops,
                            btv->c.pci, &btv->s_lock,
                            V4L2_BUF_TYPE_VBI_CAPTURE,
                            V4L2_FIELD_SEQ_TB,
index e7104d9cb4bd14d14da412c4ac644e09cd6ab167..58986f1a5f1a492d93e11780df80d747a18ab974 100644 (file)
@@ -574,10 +574,12 @@ bttv_risc_hook(struct bttv *btv, int slot, struct btcx_riscmem *risc,
 void
 bttv_dma_free(struct videobuf_queue *q,struct bttv *btv, struct bttv_buffer *buf)
 {
+       struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb);
+
        BUG_ON(in_interrupt());
        videobuf_waiton(&buf->vb,0,0);
-       videobuf_dma_unmap(q, &buf->vb.dma);
-       videobuf_dma_free(&buf->vb.dma);
+       videobuf_dma_unmap(q, dma);
+       videobuf_dma_free(dma);
        btcx_riscmem_free(btv->c.pci,&buf->bottom);
        btcx_riscmem_free(btv->c.pci,&buf->top);
        buf->vb.state = STATE_NEEDS_INIT;
@@ -699,6 +701,7 @@ int
 bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf)
 {
        const struct bttv_tvnorm *tvnorm = bttv_tvnorms + buf->tvnorm;
+       struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb);
 
        dprintk(KERN_DEBUG
                "bttv%d: buffer field: %s  format: %s  size: %dx%d\n",
@@ -716,25 +719,25 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf)
 
                switch (buf->vb.field) {
                case V4L2_FIELD_TOP:
-                       bttv_risc_packed(btv,&buf->top,buf->vb.dma.sglist,
+                       bttv_risc_packed(btv,&buf->top,dma->sglist,
                                         /* offset */ 0,bpl,
                                         /* padding */ 0,/* skip_lines */ 0,
                                         buf->vb.height);
                        break;
                case V4L2_FIELD_BOTTOM:
-                       bttv_risc_packed(btv,&buf->bottom,buf->vb.dma.sglist,
+                       bttv_risc_packed(btv,&buf->bottom,dma->sglist,
                                         0,bpl,0,0,buf->vb.height);
                        break;
                case V4L2_FIELD_INTERLACED:
-                       bttv_risc_packed(btv,&buf->top,buf->vb.dma.sglist,
+                       bttv_risc_packed(btv,&buf->top,dma->sglist,
                                         0,bpl,bpl,0,buf->vb.height >> 1);
-                       bttv_risc_packed(btv,&buf->bottom,buf->vb.dma.sglist,
+                       bttv_risc_packed(btv,&buf->bottom,dma->sglist,
                                         bpl,bpl,bpl,0,buf->vb.height >> 1);
                        break;
                case V4L2_FIELD_SEQ_TB:
-                       bttv_risc_packed(btv,&buf->top,buf->vb.dma.sglist,
+                       bttv_risc_packed(btv,&buf->top,dma->sglist,
                                         0,bpl,0,0,buf->vb.height >> 1);
-                       bttv_risc_packed(btv,&buf->bottom,buf->vb.dma.sglist,
+                       bttv_risc_packed(btv,&buf->bottom,dma->sglist,
                                         bpf,bpl,0,0,buf->vb.height >> 1);
                        break;
                default:
@@ -767,7 +770,7 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf)
                        bttv_calc_geo(btv,&buf->geo,buf->vb.width,
                                      buf->vb.height,/* both_fields */ 0,
                                      tvnorm,&buf->crop);
-                       bttv_risc_planar(btv, &buf->top, buf->vb.dma.sglist,
+                       bttv_risc_planar(btv, &buf->top, dma->sglist,
                                         0,buf->vb.width,0,buf->vb.height,
                                         uoffset,voffset,buf->fmt->hshift,
                                         buf->fmt->vshift,0);
@@ -776,7 +779,7 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf)
                        bttv_calc_geo(btv,&buf->geo,buf->vb.width,
                                      buf->vb.height,0,
                                      tvnorm,&buf->crop);
-                       bttv_risc_planar(btv, &buf->bottom, buf->vb.dma.sglist,
+                       bttv_risc_planar(btv, &buf->bottom, dma->sglist,
                                         0,buf->vb.width,0,buf->vb.height,
                                         uoffset,voffset,buf->fmt->hshift,
                                         buf->fmt->vshift,0);
@@ -789,14 +792,14 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf)
                        ypadding = buf->vb.width;
                        cpadding = buf->vb.width >> buf->fmt->hshift;
                        bttv_risc_planar(btv,&buf->top,
-                                        buf->vb.dma.sglist,
+                                        dma->sglist,
                                         0,buf->vb.width,ypadding,lines,
                                         uoffset,voffset,
                                         buf->fmt->hshift,
                                         buf->fmt->vshift,
                                         cpadding);
                        bttv_risc_planar(btv,&buf->bottom,
-                                        buf->vb.dma.sglist,
+                                        dma->sglist,
                                         ypadding,buf->vb.width,ypadding,lines,
                                         uoffset+cpadding,
                                         voffset+cpadding,
@@ -812,7 +815,7 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf)
                        ypadding = buf->vb.width;
                        cpadding = buf->vb.width >> buf->fmt->hshift;
                        bttv_risc_planar(btv,&buf->top,
-                                        buf->vb.dma.sglist,
+                                        dma->sglist,
                                         0,buf->vb.width,0,lines,
                                         uoffset >> 1,
                                         voffset >> 1,
@@ -820,7 +823,7 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf)
                                         buf->fmt->vshift,
                                         0);
                        bttv_risc_planar(btv,&buf->bottom,
-                                        buf->vb.dma.sglist,
+                                        dma->sglist,
                                         lines * ypadding,buf->vb.width,0,lines,
                                         lines * ypadding + (uoffset >> 1),
                                         lines * ypadding + (voffset >> 1),
@@ -839,10 +842,10 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf)
                buf->vb.field = V4L2_FIELD_SEQ_TB;
                bttv_calc_geo(btv,&buf->geo,tvnorm->swidth,tvnorm->sheight,
                              1,tvnorm,&buf->crop);
-               bttv_risc_packed(btv, &buf->top,  buf->vb.dma.sglist,
+               bttv_risc_packed(btv, &buf->top,  dma->sglist,
                                 /* offset */ 0, RAW_BPL, /* padding */ 0,
                                 /* skip_lines */ 0, RAW_LINES);
-               bttv_risc_packed(btv, &buf->bottom, buf->vb.dma.sglist,
+               bttv_risc_packed(btv, &buf->bottom, dma->sglist,
                                 buf->vb.size/2 , RAW_BPL, 0, 0, RAW_LINES);
        }
 
index 007485aa4f01abb49b758f9f9ff7caf742a2c2ba..346ce019bdcbd76c52379f9c7581d8171432c8c5 100644 (file)
@@ -150,13 +150,14 @@ static int vbi_buffer_prepare(struct videobuf_queue *q,
 
        if (redo_dma_risc) {
                unsigned int bpl, padding, offset;
+               struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb);
 
                bpl = 2044; /* max. vbipack */
                padding = VBI_BPL - bpl;
 
                if (fh->vbi_fmt.fmt.count[0] > 0) {
                        rc = bttv_risc_packed(btv, &buf->top,
-                                             buf->vb.dma.sglist,
+                                             dma->sglist,
                                              /* offset */ 0, bpl,
                                              padding, skip_lines0,
                                              fh->vbi_fmt.fmt.count[0]);
@@ -168,7 +169,7 @@ static int vbi_buffer_prepare(struct videobuf_queue *q,
                        offset = fh->vbi_fmt.fmt.count[0] * VBI_BPL;
 
                        rc = bttv_risc_packed(btv, &buf->bottom,
-                                             buf->vb.dma.sglist,
+                                             dma->sglist,
                                              offset, bpl,
                                              padding, skip_lines1,
                                              fh->vbi_fmt.fmt.count[1]);
index 5b25faca150411f7b227622b8e9327d77d2bfc89..0b92c35a8435cd86a8abbd9b7df5cf2fa5218cb7 100644 (file)
@@ -41,7 +41,7 @@
 #include <media/v4l2-common.h>
 
 #include <linux/device.h>
-#include <media/video-buf.h>
+#include <media/videobuf-dma-sg.h>
 #include <media/tuner.h>
 #include <media/tveeprom.h>
 #include <media/ir-common.h>
index ccb37006bb180a3abf82e337897623b12554ccc2..b63cab33692072a6163463211aaace9fb29619e1 100644 (file)
@@ -1197,7 +1197,7 @@ static int cafe_setup_siobuf(struct cafe_camera *cam, int index)
        buf->v4lbuf.field = V4L2_FIELD_NONE;
        buf->v4lbuf.memory = V4L2_MEMORY_MMAP;
        /*
-        * Offset: must be 32-bit even on a 64-bit system.  video-buf
+        * Offset: must be 32-bit even on a 64-bit system.  videobuf-dma-sg
         * just uses the length times the index, but the spec warns
         * against doing just that - vma merging problems.  So we
         * leave a gap between each pair of buffers.
index f750a543c96145c30fba197ccbc4b130dc93d0ea..c68ba74d44eccf81f7c79317decec5a4bb78b87c 100644 (file)
@@ -4,7 +4,7 @@ config VIDEO_CX88
        select I2C_ALGOBIT
        select FW_LOADER
        select VIDEO_BTCX
-       select VIDEO_BUF
+       select VIDEOBUF_DMA_SG
        select VIDEO_TUNER
        select VIDEO_TVEEPROM
        select VIDEO_IR
index f4abed454fd4a6655dabab8a55b0954307b6fb50..90c36c5705c368bfdb98525af9faf3c7e62d15f9 100644 (file)
@@ -72,7 +72,7 @@ struct cx88_audio_dev {
        unsigned int               period_size;
        unsigned int               num_periods;
 
-       struct videobuf_dmabuf     dma_risc;
+       struct videobuf_dmabuf     *dma_risc;
 
        struct cx88_buffer         *buf;
 
@@ -282,11 +282,12 @@ static int dsp_buffer_free(snd_cx88_card_t *chip)
        BUG_ON(!chip->dma_size);
 
        dprintk(2,"Freeing buffer\n");
-       videobuf_pci_dma_unmap(chip->pci, &chip->dma_risc);
-       videobuf_dma_free(&chip->dma_risc);
+       videobuf_pci_dma_unmap(chip->pci, chip->dma_risc);
+       videobuf_dma_free(chip->dma_risc);
        btcx_riscmem_free(chip->pci,&chip->buf->risc);
        kfree(chip->buf);
 
+       chip->dma_risc = NULL;
        chip->dma_size = 0;
 
        return 0;
@@ -366,6 +367,8 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream,
                              struct snd_pcm_hw_params * hw_params)
 {
        snd_cx88_card_t *chip = snd_pcm_substream_chip(substream);
+       struct videobuf_dmabuf *dma;
+
        struct cx88_buffer *buf;
        int ret;
 
@@ -381,7 +384,7 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream,
        BUG_ON(!chip->dma_size);
        BUG_ON(chip->num_periods & (chip->num_periods-1));
 
-       buf = kzalloc(sizeof(*buf), GFP_KERNEL);
+       buf = videobuf_pci_alloc(sizeof(*buf));
        if (NULL == buf)
                return -ENOMEM;
 
@@ -392,17 +395,18 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream,
        buf->vb.height = chip->num_periods;
        buf->vb.size   = chip->dma_size;
 
-       videobuf_dma_init(&buf->vb.dma);
-       ret = videobuf_dma_init_kernel(&buf->vb.dma, PCI_DMA_FROMDEVICE,
+       dma=videobuf_to_dma(&buf->vb);
+       videobuf_dma_init(dma);
+       ret = videobuf_dma_init_kernel(dma, PCI_DMA_FROMDEVICE,
                        (PAGE_ALIGN(buf->vb.size) >> PAGE_SHIFT));
        if (ret < 0)
                goto error;
 
-       ret = videobuf_pci_dma_map(chip->pci,&buf->vb.dma);
+       ret = videobuf_pci_dma_map(chip->pci,dma);
        if (ret < 0)
                goto error;
 
-       ret = cx88_risc_databuffer(chip->pci, &buf->risc, buf->vb.dma.sglist,
+       ret = cx88_risc_databuffer(chip->pci, &buf->risc, dma->sglist,
                                   buf->vb.width, buf->vb.height, 1);
        if (ret < 0)
                goto error;
@@ -414,9 +418,9 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream,
        buf->vb.state = STATE_PREPARED;
 
        chip->buf = buf;
-       chip->dma_risc = buf->vb.dma;
+       chip->dma_risc = dma;
 
-       substream->runtime->dma_area = chip->dma_risc.vmalloc;
+       substream->runtime->dma_area = chip->dma_risc->vmalloc;
        substream->runtime->dma_bytes = chip->dma_size;
        substream->runtime->dma_addr = 0;
        return 0;
index fcaf4f51293f058e490b98b9cfc81749ff78041d..6d6f5048d7627a1d3f0923f763caafa0a06ac88e 100644 (file)
@@ -1111,7 +1111,7 @@ static int mpeg_open(struct inode *inode, struct file *file)
        file->private_data = fh;
        fh->dev      = dev;
 
-       videobuf_queue_init(&fh->mpegq, &blackbird_qops,
+       videobuf_queue_pci_init(&fh->mpegq, &blackbird_qops,
                            dev->pci, &dev->slock,
                            V4L2_BUF_TYPE_VIDEO_CAPTURE,
                            V4L2_FIELD_INTERLACED,
index 716154828ff0b2b3b3cbae5c2eee06271d952314..85609b41f86ee8ccce7366584a34d97198363630 100644 (file)
@@ -213,10 +213,12 @@ int cx88_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc,
 void
 cx88_free_buffer(struct videobuf_queue *q, struct cx88_buffer *buf)
 {
+       struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb);
+
        BUG_ON(in_interrupt());
        videobuf_waiton(&buf->vb,0,0);
-       videobuf_dma_unmap(q, &buf->vb.dma);
-       videobuf_dma_free(&buf->vb.dma);
+       videobuf_dma_unmap(q, dma);
+       videobuf_dma_free(dma);
        btcx_riscmem_free((struct pci_dev *)q->dev, &buf->risc);
        buf->vb.state = STATE_NEEDS_INIT;
 }
index 00d0e43785a0d8544d1e9a21cee76f4fe70fa66d..d16e5c6d21c07c325b3da0895f0550b5d4723f0f 100644 (file)
@@ -710,7 +710,7 @@ static int cx8802_dvb_probe(struct cx8802_driver *drv)
 
        /* dvb stuff */
        printk(KERN_INFO "%s/2: cx2388x based DVB/ATSC card\n", core->name);
-       videobuf_queue_init(&dev->dvb.dvbq, &dvb_qops,
+       videobuf_queue_pci_init(&dev->dvb.dvbq, &dvb_qops,
                            dev->pci, &dev->slock,
                            V4L2_BUF_TYPE_VIDEO_CAPTURE,
                            V4L2_FIELD_TOP,
index d302793fcfb9f5173584140eb58803438f274663..a652f294d23d8dd8e6a135eab458395ddb8928f6 100644 (file)
@@ -237,6 +237,7 @@ int cx8802_buf_prepare(struct videobuf_queue *q, struct cx8802_dev *dev,
                        struct cx88_buffer *buf, enum v4l2_field field)
 {
        int size = dev->ts_packet_size * dev->ts_packet_count;
+       struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb);
        int rc;
 
        dprintk(1, "%s: %p\n", __FUNCTION__, buf);
@@ -252,7 +253,7 @@ int cx8802_buf_prepare(struct videobuf_queue *q, struct cx8802_dev *dev,
                if (0 != (rc = videobuf_iolock(q,&buf->vb,NULL)))
                        goto fail;
                cx88_risc_databuffer(dev->pci, &buf->risc,
-                                    buf->vb.dma.sglist,
+                                    dma->sglist,
                                     buf->vb.width, buf->vb.height, 0);
        }
        buf->vb.state = STATE_PREPARED;
index 72c1d19fa79fb63d3f4a6c05ab70deb6ee8f40ac..aa40505c4b3a2300a62fee0cd62d90a4d1cf0b85 100644 (file)
@@ -172,6 +172,7 @@ vbi_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
                return -EINVAL;
 
        if (STATE_NEEDS_INIT == buf->vb.state) {
+               struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb);
                buf->vb.width  = VBI_LINE_LENGTH;
                buf->vb.height = VBI_LINE_COUNT;
                buf->vb.size   = size;
@@ -180,7 +181,7 @@ vbi_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
                if (0 != (rc = videobuf_iolock(q,&buf->vb,NULL)))
                        goto fail;
                cx88_risc_buffer(dev->pci, &buf->risc,
-                                buf->vb.dma.sglist,
+                                dma->sglist,
                                 0, buf->vb.width * buf->vb.height,
                                 buf->vb.width, 0,
                                 buf->vb.height);
index 705c29b002ea0979c8d589c7f571df5ed7fec186..1439b72685326f815cdacab0b653f159297ac9f5 100644 (file)
@@ -534,6 +534,7 @@ buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
        struct cx8800_dev  *dev = fh->dev;
        struct cx88_core *core = dev->core;
        struct cx88_buffer *buf = container_of(vb,struct cx88_buffer,vb);
+       struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb);
        int rc, init_buffer = 0;
 
        BUG_ON(NULL == fh->fmt);
@@ -566,30 +567,30 @@ buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
                switch (buf->vb.field) {
                case V4L2_FIELD_TOP:
                        cx88_risc_buffer(dev->pci, &buf->risc,
-                                        buf->vb.dma.sglist, 0, UNSET,
+                                        dma->sglist, 0, UNSET,
                                         buf->bpl, 0, buf->vb.height);
                        break;
                case V4L2_FIELD_BOTTOM:
                        cx88_risc_buffer(dev->pci, &buf->risc,
-                                        buf->vb.dma.sglist, UNSET, 0,
+                                        dma->sglist, UNSET, 0,
                                         buf->bpl, 0, buf->vb.height);
                        break;
                case V4L2_FIELD_INTERLACED:
                        cx88_risc_buffer(dev->pci, &buf->risc,
-                                        buf->vb.dma.sglist, 0, buf->bpl,
+                                        dma->sglist, 0, buf->bpl,
                                         buf->bpl, buf->bpl,
                                         buf->vb.height >> 1);
                        break;
                case V4L2_FIELD_SEQ_TB:
                        cx88_risc_buffer(dev->pci, &buf->risc,
-                                        buf->vb.dma.sglist,
+                                        dma->sglist,
                                         0, buf->bpl * (buf->vb.height >> 1),
                                         buf->bpl, 0,
                                         buf->vb.height >> 1);
                        break;
                case V4L2_FIELD_SEQ_BT:
                        cx88_risc_buffer(dev->pci, &buf->risc,
-                                        buf->vb.dma.sglist,
+                                        dma->sglist,
                                         buf->bpl * (buf->vb.height >> 1), 0,
                                         buf->bpl, 0,
                                         buf->vb.height >> 1);
@@ -752,13 +753,13 @@ static int video_open(struct inode *inode, struct file *file)
        fh->height   = 240;
        fh->fmt      = format_by_fourcc(V4L2_PIX_FMT_BGR24);
 
-       videobuf_queue_init(&fh->vidq, &cx8800_video_qops,
+       videobuf_queue_pci_init(&fh->vidq, &cx8800_video_qops,
                            dev->pci, &dev->slock,
                            V4L2_BUF_TYPE_VIDEO_CAPTURE,
                            V4L2_FIELD_INTERLACED,
                            sizeof(struct cx88_buffer),
                            fh);
-       videobuf_queue_init(&fh->vbiq, &cx8800_vbi_qops,
+       videobuf_queue_pci_init(&fh->vbiq, &cx8800_vbi_qops,
                            dev->pci, &dev->slock,
                            V4L2_BUF_TYPE_VBI_CAPTURE,
                            V4L2_FIELD_SEQ_TB,
@@ -1104,28 +1105,9 @@ static int vidioc_enum_fmt_cap (struct file *file, void  *priv,
 #ifdef CONFIG_VIDEO_V4L1_COMPAT
 static int vidiocgmbuf (struct file *file, void *priv, struct video_mbuf *mbuf)
 {
-       struct cx8800_fh           *fh   = priv;
-       struct videobuf_queue      *q;
-       struct v4l2_requestbuffers req;
-       unsigned int i;
-       int err;
+       struct cx8800_fh           *fh  = priv;
 
-       q = get_queue(fh);
-       memset(&req,0,sizeof(req));
-       req.type   = q->type;
-       req.count  = 8;
-       req.memory = V4L2_MEMORY_MMAP;
-       err = videobuf_reqbufs(q,&req);
-       if (err < 0)
-               return err;
-
-       mbuf->frames = req.count;
-       mbuf->size   = 0;
-       for (i = 0; i < mbuf->frames; i++) {
-               mbuf->offsets[i]  = q->bufs[i]->boff;
-               mbuf->size       += q->bufs[i]->bsize;
-       }
-       return 0;
+       return videobuf_cgmbuf (get_queue(fh), mbuf, 8);
 }
 #endif
 
index 0e4f8e2786713e777d36e7e5cdd1b03ef37e765a..875a9abab2a2d0432de54ef07b061fce557189c2 100644 (file)
@@ -28,7 +28,7 @@
 #include <media/v4l2-common.h>
 #include <media/tuner.h>
 #include <media/tveeprom.h>
-#include <media/video-buf.h>
+#include <media/videobuf-dma-sg.h>
 #include <media/cx2341x.h>
 #include <media/audiochip.h>
 #if defined(CONFIG_VIDEO_BUF_DVB) || defined(CONFIG_VIDEO_BUF_DVB_MODULE)
index 9f1417a4f7d2f49143a30f5bb8b788b4a7caf44f..82bc4ef414ac7118c41b1ee09e8c9b5c0a7bec29 100644 (file)
@@ -1,7 +1,7 @@
 config VIDEO_SAA7134
        tristate "Philips SAA7134 support"
        depends on VIDEO_DEV && PCI && I2C
-       select VIDEO_BUF
+       select VIDEOBUF_DMA_SG
        select VIDEO_IR
        select VIDEO_TUNER
        select CRC32
index 80108ddf48346639ab07c315abc006d733e75d21..a1d986e01a30b422d9cc83637388c24928ae627a 100644 (file)
@@ -236,9 +236,10 @@ int saa7134_buffer_startpage(struct saa7134_buf *buf)
 unsigned long saa7134_buffer_base(struct saa7134_buf *buf)
 {
        unsigned long base;
+       struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb);
 
        base  = saa7134_buffer_startpage(buf) * 4096;
-       base += buf->vb.dma.sglist[0].offset;
+       base += dma->sglist[0].offset;
        return base;
 }
 
@@ -286,11 +287,12 @@ void saa7134_pgtable_free(struct pci_dev *pci, struct saa7134_pgtable *pt)
 
 void saa7134_dma_free(struct videobuf_queue *q,struct saa7134_buf *buf)
 {
+       struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb);
        BUG_ON(in_interrupt());
 
        videobuf_waiton(&buf->vb,0,0);
-       videobuf_dma_unmap(q, &buf->vb.dma);
-       videobuf_dma_free(&buf->vb.dma);
+       videobuf_dma_unmap(q, dma);
+       videobuf_dma_free(dma);
        buf->vb.state = STATE_NEEDS_INIT;
 }
 
index bbab252cbeee347643f90fdd9c74473e7f0fc2c8..38d87332cc5dcd312fd815bece3d40709ee38c42 100644 (file)
@@ -850,7 +850,7 @@ static int dvb_init(struct saa7134_dev *dev)
        dev->ts.nr_bufs    = 32;
        dev->ts.nr_packets = 32*4;
        dev->dvb.name = dev->name;
-       videobuf_queue_init(&dev->dvb.dvbq, &saa7134_ts_qops,
+       videobuf_queue_pci_init(&dev->dvb.dvbq, &saa7134_ts_qops,
                            dev->pci, &dev->slock,
                            V4L2_BUF_TYPE_VIDEO_CAPTURE,
                            V4L2_FIELD_ALTERNATE,
index 7ed4eaf05e131112bc64bcb7bbf57b4ef3df45a0..a16df57af63a09f73c892ee07bfed31cd366e551 100644 (file)
@@ -400,7 +400,7 @@ static int empress_init(struct saa7134_dev *dev)
        printk(KERN_INFO "%s: registered device video%d [mpeg]\n",
               dev->name,dev->empress_dev->minor & 0x1f);
 
-       videobuf_queue_init(&dev->empress_tsq, &saa7134_ts_qops,
+       videobuf_queue_pci_init(&dev->empress_tsq, &saa7134_ts_qops,
                            dev->pci, &dev->slock,
                            V4L2_BUF_TYPE_VIDEO_CAPTURE,
                            V4L2_FIELD_ALTERNATE,
index 7780b2cce80db6e4977dcfd159e20d79b8602a94..5b1d1dafb5a5de54bfdd9345e29e2d0a47000fa3 100644 (file)
@@ -92,6 +92,8 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
        }
 
        if (STATE_NEEDS_INIT == buf->vb.state) {
+               struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb);
+
                buf->vb.width  = llength;
                buf->vb.height = lines;
                buf->vb.size   = size;
@@ -101,8 +103,8 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
                if (err)
                        goto oops;
                err = saa7134_pgtable_build(dev->pci,buf->pt,
-                                           buf->vb.dma.sglist,
-                                           buf->vb.dma.sglen,
+                                           dma->sglist,
+                                           dma->sglen,
                                            saa7134_buffer_startpage(buf));
                if (err)
                        goto oops;
index 0044079f5da226d6667f08618e37d06956e1ec76..81a2aedeff5c4d6218fdb94baece6850edac2ddb 100644 (file)
@@ -137,6 +137,8 @@ static int buffer_prepare(struct videobuf_queue *q,
                saa7134_dma_free(q,buf);
 
        if (STATE_NEEDS_INIT == buf->vb.state) {
+               struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb);
+
                buf->vb.width  = llength;
                buf->vb.height = lines;
                buf->vb.size   = size;
@@ -146,8 +148,8 @@ static int buffer_prepare(struct videobuf_queue *q,
                if (err)
                        goto oops;
                err = saa7134_pgtable_build(dev->pci,buf->pt,
-                                           buf->vb.dma.sglist,
-                                           buf->vb.dma.sglen,
+                                           dma->sglist,
+                                           dma->sglen,
                                            saa7134_buffer_startpage(buf));
                if (err)
                        goto oops;
index 9c317ed6b210af29db192eef46249a3858df60fd..cf40a9690a500a0d3f7317d67604b8b94f262a3f 100644 (file)
@@ -1037,6 +1037,8 @@ static int buffer_prepare(struct videobuf_queue *q,
        }
 
        if (STATE_NEEDS_INIT == buf->vb.state) {
+               struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb);
+
                buf->vb.width  = fh->width;
                buf->vb.height = fh->height;
                buf->vb.size   = size;
@@ -1048,8 +1050,8 @@ static int buffer_prepare(struct videobuf_queue *q,
                if (err)
                        goto oops;
                err = saa7134_pgtable_build(dev->pci,buf->pt,
-                                           buf->vb.dma.sglist,
-                                           buf->vb.dma.sglen,
+                                           dma->sglist,
+                                           dma->sglen,
                                            saa7134_buffer_startpage(buf));
                if (err)
                        goto oops;
@@ -1309,13 +1311,13 @@ static int video_open(struct inode *inode, struct file *file)
        fh->height   = 576;
        v4l2_prio_open(&dev->prio,&fh->prio);
 
-       videobuf_queue_init(&fh->cap, &video_qops,
+       videobuf_queue_pci_init(&fh->cap, &video_qops,
                            dev->pci, &dev->slock,
                            V4L2_BUF_TYPE_VIDEO_CAPTURE,
                            V4L2_FIELD_INTERLACED,
                            sizeof(struct saa7134_buf),
                            fh);
-       videobuf_queue_init(&fh->vbi, &saa7134_vbi_qops,
+       videobuf_queue_pci_init(&fh->vbi, &saa7134_vbi_qops,
                            dev->pci, &dev->slock,
                            V4L2_BUF_TYPE_VBI_CAPTURE,
                            V4L2_FIELD_SEQ_TB,
@@ -2137,29 +2139,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
        }
 #ifdef CONFIG_VIDEO_V4L1_COMPAT
        case VIDIOCGMBUF:
-       {
-               struct video_mbuf *mbuf = arg;
-               struct videobuf_queue *q;
-               struct v4l2_requestbuffers req;
-               unsigned int i;
-
-               q = saa7134_queue(fh);
-               memset(&req,0,sizeof(req));
-               req.type   = q->type;
-               req.count  = gbuffers;
-               req.memory = V4L2_MEMORY_MMAP;
-               err = videobuf_reqbufs(q,&req);
-               if (err < 0)
-                       return err;
-               memset(mbuf,0,sizeof(*mbuf));
-               mbuf->frames = req.count;
-               mbuf->size   = 0;
-               for (i = 0; i < mbuf->frames; i++) {
-                       mbuf->offsets[i]  = q->bufs[i]->boff;
-                       mbuf->size       += q->bufs[i]->bsize;
-               }
-               return 0;
-       }
+               return videobuf_cgmbuf(saa7134_queue(fh), arg, gbuffers);
 #endif
        case VIDIOC_REQBUFS:
                return videobuf_reqbufs(saa7134_queue(fh),arg);
index fd12942b3a108aa00a36939a790f4a4428b780c1..dae608f9bf3b72a8a485d5e29145bb6b6090466a 100644 (file)
@@ -37,7 +37,7 @@
 #include <media/tuner.h>
 #include <media/ir-common.h>
 #include <media/ir-kbd-i2c.h>
-#include <media/video-buf.h>
+#include <media/videobuf-dma-sg.h>
 #include <sound/driver.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
index d2af82dc8faf3689bc479fdee5b9cf1e08e2a367..9631ead297ee52d9bcbfcaa65bc66b836f1ebfd7 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/file.h>
 #include <linux/freezer.h>
 
-#include <media/video-buf.h>
+#include <media/videobuf-dma-sg.h>
 #include <media/video-buf-dvb.h>
 
 /* ------------------------------------------------------------------ */
@@ -45,6 +45,7 @@ static int videobuf_dvb_thread(void *data)
        struct videobuf_buffer *buf;
        unsigned long flags;
        int err;
+       struct videobuf_dmabuf *dma;
 
        dprintk("dvb thread started\n");
        set_freezable();
@@ -65,8 +66,9 @@ static int videobuf_dvb_thread(void *data)
                try_to_freeze();
 
                /* feed buffer data to demux */
+               dma=videobuf_to_dma(buf);
                if (buf->state == STATE_DONE)
-                       dvb_dmx_swfilter(&dvb->demux, buf->dma.vmalloc,
+                       dvb_dmx_swfilter(&dvb->demux, dma->vmalloc,
                                         buf->size);
 
                /* requeue buffer */
index cce20ed5cf6c221ab61360f05436fd399067d698..e49f7e156061c8dd699060a5b6c1e3edd4c3c268 100644 (file)
@@ -4,7 +4,7 @@
 #include <linux/videodev.h>
 #include <media/v4l2-common.h>
 #include <media/saa7146.h>
-#include <media/video-buf.h>
+#include <media/videobuf-dma-sg.h>
 
 #define MAX_SAA7146_CAPTURE_BUFFERS    32      /* arbitrary */
 #define BUFFER_TIMEOUT     (HZ/2)  /* 0.5 seconds */