[media] media: videobuf2: Restructure vb2_buffer
authorJunghak Sung <jh1009.sung@samsung.com>
Tue, 22 Sep 2015 13:30:30 +0000 (10:30 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Thu, 1 Oct 2015 12:04:43 +0000 (09:04 -0300)
Remove v4l2 stuff - v4l2_buf, v4l2_plane - from struct vb2_buffer.

Add new member variables - bytesused, length, offset, userptr, fd,
data_offset - to struct vb2_plane in order to cover all information
of v4l2_plane.
struct vb2_plane {
        <snip>
        unsigned int            bytesused;
        unsigned int            length;
        union {
                unsigned int    offset;
                unsigned long   userptr;
                int             fd;
        } m;
        unsigned int            data_offset;
}

Replace v4l2_buf with new member variables - index, type, memory - which
are common fields for buffer management.
struct vb2_buffer {
        <snip>
        unsigned int            index;
        unsigned int            type;
        unsigned int            memory;
        unsigned int            num_planes;
        struct vb2_plane        planes[VIDEO_MAX_PLANES];
        <snip>
};

v4l2 specific fields - flags, field, timestamp, timecode,
sequence - are moved to vb2_v4l2_buffer in videobuf2-v4l2.c
struct vb2_v4l2_buffer {
        struct vb2_buffer       vb2_buf;

        __u32                   flags;
        __u32                   field;
        struct timeval          timestamp;
        struct v4l2_timecode    timecode;
        __u32                   sequence;
};

Signed-off-by: Junghak Sung <jh1009.sung@samsung.com>
Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
137 files changed:
drivers/input/touchscreen/sur40.c
drivers/media/dvb-frontends/rtl2832_sdr.c
drivers/media/pci/cobalt/cobalt-driver.h
drivers/media/pci/cobalt/cobalt-irq.c
drivers/media/pci/cobalt/cobalt-v4l2.c
drivers/media/pci/cx23885/cx23885-417.c
drivers/media/pci/cx23885/cx23885-core.c
drivers/media/pci/cx23885/cx23885-dvb.c
drivers/media/pci/cx23885/cx23885-vbi.c
drivers/media/pci/cx23885/cx23885-video.c
drivers/media/pci/cx23885/cx23885.h
drivers/media/pci/cx25821/cx25821-video.c
drivers/media/pci/cx25821/cx25821.h
drivers/media/pci/cx88/cx88-blackbird.c
drivers/media/pci/cx88/cx88-core.c
drivers/media/pci/cx88/cx88-dvb.c
drivers/media/pci/cx88/cx88-mpeg.c
drivers/media/pci/cx88/cx88-vbi.c
drivers/media/pci/cx88/cx88-video.c
drivers/media/pci/cx88/cx88.h
drivers/media/pci/dt3155/dt3155.c
drivers/media/pci/dt3155/dt3155.h
drivers/media/pci/netup_unidvb/netup_unidvb_core.c
drivers/media/pci/saa7134/saa7134-core.c
drivers/media/pci/saa7134/saa7134-ts.c
drivers/media/pci/saa7134/saa7134-vbi.c
drivers/media/pci/saa7134/saa7134-video.c
drivers/media/pci/saa7134/saa7134.h
drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c
drivers/media/pci/solo6x10/solo6x10-v4l2.c
drivers/media/pci/solo6x10/solo6x10.h
drivers/media/pci/sta2x11/sta2x11_vip.c
drivers/media/pci/tw68/tw68-video.c
drivers/media/pci/tw68/tw68.h
drivers/media/platform/am437x/am437x-vpfe.c
drivers/media/platform/am437x/am437x-vpfe.h
drivers/media/platform/blackfin/bfin_capture.c
drivers/media/platform/coda/coda-bit.c
drivers/media/platform/coda/coda-common.c
drivers/media/platform/coda/coda-jpeg.c
drivers/media/platform/coda/coda.h
drivers/media/platform/coda/trace.h
drivers/media/platform/davinci/vpbe_display.c
drivers/media/platform/davinci/vpif_capture.c
drivers/media/platform/davinci/vpif_capture.h
drivers/media/platform/davinci/vpif_display.c
drivers/media/platform/davinci/vpif_display.h
drivers/media/platform/exynos-gsc/gsc-core.h
drivers/media/platform/exynos-gsc/gsc-m2m.c
drivers/media/platform/exynos4-is/fimc-capture.c
drivers/media/platform/exynos4-is/fimc-core.h
drivers/media/platform/exynos4-is/fimc-isp-video.c
drivers/media/platform/exynos4-is/fimc-isp.h
drivers/media/platform/exynos4-is/fimc-lite.c
drivers/media/platform/exynos4-is/fimc-lite.h
drivers/media/platform/exynos4-is/fimc-m2m.c
drivers/media/platform/m2m-deinterlace.c
drivers/media/platform/marvell-ccic/mcam-core.c
drivers/media/platform/mx2_emmaprp.c
drivers/media/platform/omap3isp/ispvideo.c
drivers/media/platform/omap3isp/ispvideo.h
drivers/media/platform/rcar_jpu.c
drivers/media/platform/s3c-camif/camif-capture.c
drivers/media/platform/s3c-camif/camif-core.h
drivers/media/platform/s5p-g2d/g2d.c
drivers/media/platform/s5p-jpeg/jpeg-core.c
drivers/media/platform/s5p-mfc/s5p_mfc.c
drivers/media/platform/s5p-mfc/s5p_mfc_common.h
drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c
drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
drivers/media/platform/s5p-tv/mixer.h
drivers/media/platform/s5p-tv/mixer_grp_layer.c
drivers/media/platform/s5p-tv/mixer_reg.c
drivers/media/platform/s5p-tv/mixer_video.c
drivers/media/platform/s5p-tv/mixer_vp_layer.c
drivers/media/platform/sh_veu.c
drivers/media/platform/sh_vou.c
drivers/media/platform/soc_camera/atmel-isi.c
drivers/media/platform/soc_camera/mx2_camera.c
drivers/media/platform/soc_camera/mx3_camera.c
drivers/media/platform/soc_camera/rcar_vin.c
drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c
drivers/media/platform/sti/bdisp/bdisp-v4l2.c
drivers/media/platform/ti-vpe/vpe.c
drivers/media/platform/vim2m.c
drivers/media/platform/vivid/vivid-core.h
drivers/media/platform/vivid/vivid-kthread-cap.c
drivers/media/platform/vivid/vivid-kthread-out.c
drivers/media/platform/vivid/vivid-sdr-cap.c
drivers/media/platform/vivid/vivid-vbi-cap.c
drivers/media/platform/vivid/vivid-vbi-out.c
drivers/media/platform/vivid/vivid-vid-cap.c
drivers/media/platform/vivid/vivid-vid-out.c
drivers/media/platform/vsp1/vsp1_rpf.c
drivers/media/platform/vsp1/vsp1_video.c
drivers/media/platform/vsp1/vsp1_video.h
drivers/media/platform/vsp1/vsp1_wpf.c
drivers/media/platform/xilinx/xilinx-dma.c
drivers/media/usb/airspy/airspy.c
drivers/media/usb/au0828/au0828-vbi.c
drivers/media/usb/au0828/au0828-video.c
drivers/media/usb/au0828/au0828.h
drivers/media/usb/em28xx/em28xx-vbi.c
drivers/media/usb/em28xx/em28xx-video.c
drivers/media/usb/em28xx/em28xx.h
drivers/media/usb/go7007/go7007-driver.c
drivers/media/usb/go7007/go7007-priv.h
drivers/media/usb/go7007/go7007-v4l2.c
drivers/media/usb/hackrf/hackrf.c
drivers/media/usb/msi2500/msi2500.c
drivers/media/usb/pwc/pwc-if.c
drivers/media/usb/pwc/pwc-uncompress.c
drivers/media/usb/pwc/pwc.h
drivers/media/usb/s2255/s2255drv.c
drivers/media/usb/stk1160/stk1160-v4l.c
drivers/media/usb/stk1160/stk1160-video.c
drivers/media/usb/stk1160/stk1160.h
drivers/media/usb/usbtv/usbtv-video.c
drivers/media/usb/usbtv/usbtv.h
drivers/media/usb/uvc/uvc_queue.c
drivers/media/usb/uvc/uvc_video.c
drivers/media/usb/uvc/uvcvideo.h
drivers/media/v4l2-core/v4l2-mem2mem.c
drivers/media/v4l2-core/videobuf2-core.c
drivers/staging/media/davinci_vpfe/vpfe_video.c
drivers/staging/media/davinci_vpfe/vpfe_video.h
drivers/staging/media/omap4iss/iss_video.c
drivers/staging/media/omap4iss/iss_video.h
drivers/usb/gadget/function/uvc_queue.c
drivers/usb/gadget/function/uvc_queue.h
include/media/davinci/vpbe_display.h
include/media/v4l2-mem2mem.h
include/media/videobuf2-core.h
include/media/videobuf2-v4l2.h
include/trace/events/v4l2.h

index 3f117637e832daf02abac291cae9e5701e5714e1..98d094587e855820a7803e4e76a24dc21f54f913 100644 (file)
@@ -38,6 +38,7 @@
 #include <media/v4l2-device.h>
 #include <media/v4l2-dev.h>
 #include <media/v4l2-ioctl.h>
+#include <media/videobuf2-v4l2.h>
 #include <media/videobuf2-dma-sg.h>
 
 /* read 512 bytes from endpoint 0x86 -> get header + blobs */
@@ -163,7 +164,7 @@ struct sur40_state {
 };
 
 struct sur40_buffer {
-       struct vb2_buffer vb;
+       struct vb2_v4l2_buffer vb;
        struct list_head list;
 };
 
@@ -420,7 +421,7 @@ static void sur40_process_video(struct sur40_state *sur40)
 
        dev_dbg(sur40->dev, "header acquired\n");
 
-       sgt = vb2_dma_sg_plane_desc(&new_buf->vb, 0);
+       sgt = vb2_dma_sg_plane_desc(&new_buf->vb.vb2_buf, 0);
 
        result = usb_sg_init(&sgr, sur40->usbdev,
                usb_rcvbulkpipe(sur40->usbdev, VIDEO_ENDPOINT), 0,
@@ -443,15 +444,15 @@ static void sur40_process_video(struct sur40_state *sur40)
                goto err_poll;
 
        /* mark as finished */
-       v4l2_get_timestamp(&new_buf->vb.v4l2_buf.timestamp);
-       new_buf->vb.v4l2_buf.sequence = sur40->sequence++;
-       new_buf->vb.v4l2_buf.field = V4L2_FIELD_NONE;
-       vb2_buffer_done(&new_buf->vb, VB2_BUF_STATE_DONE);
+       v4l2_get_timestamp(&new_buf->vb.timestamp);
+       new_buf->vb.sequence = sur40->sequence++;
+       new_buf->vb.field = V4L2_FIELD_NONE;
+       vb2_buffer_done(&new_buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
        dev_dbg(sur40->dev, "buffer marked done\n");
        return;
 
 err_poll:
-       vb2_buffer_done(&new_buf->vb, VB2_BUF_STATE_ERROR);
+       vb2_buffer_done(&new_buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
 }
 
 /* Initialize input device parameters. */
@@ -701,7 +702,7 @@ static void return_all_buffers(struct sur40_state *sur40,
 
        spin_lock(&sur40->qlock);
        list_for_each_entry_safe(buf, node, &sur40->buf_list, list) {
-               vb2_buffer_done(&buf->vb, state);
+               vb2_buffer_done(&buf->vb.vb2_buf, state);
                list_del(&buf->list);
        }
        spin_unlock(&sur40->qlock);
index d5b994f176126f6cef2acaff6a4c7b69dffcd0d4..bf306a230eb06367b48e55b12d16d655e596cde3 100644 (file)
@@ -29,6 +29,7 @@
 #include <media/v4l2-ioctl.h>
 #include <media/v4l2-ctrls.h>
 #include <media/v4l2-event.h>
+#include <media/videobuf2-v4l2.h>
 #include <media/videobuf2-vmalloc.h>
 
 #include <linux/platform_device.h>
@@ -107,7 +108,8 @@ static const unsigned int NUM_FORMATS = ARRAY_SIZE(formats);
 
 /* intermediate buffers with raw data from the USB device */
 struct rtl2832_sdr_frame_buf {
-       struct vb2_buffer vb;   /* common v4l buffer stuff -- must be first */
+       /* common v4l buffer stuff -- must be first */
+       struct vb2_v4l2_buffer vb;
        struct list_head list;
 };
 
@@ -304,13 +306,13 @@ static void rtl2832_sdr_urb_complete(struct urb *urb)
                }
 
                /* fill framebuffer */
-               ptr = vb2_plane_vaddr(&fbuf->vb, 0);
+               ptr = vb2_plane_vaddr(&fbuf->vb.vb2_buf, 0);
                len = rtl2832_sdr_convert_stream(dev, ptr, urb->transfer_buffer,
                                urb->actual_length);
-               vb2_set_plane_payload(&fbuf->vb, 0, len);
-               v4l2_get_timestamp(&fbuf->vb.v4l2_buf.timestamp);
-               fbuf->vb.v4l2_buf.sequence = dev->sequence++;
-               vb2_buffer_done(&fbuf->vb, VB2_BUF_STATE_DONE);
+               vb2_set_plane_payload(&fbuf->vb.vb2_buf, 0, len);
+               v4l2_get_timestamp(&fbuf->vb.timestamp);
+               fbuf->vb.sequence = dev->sequence++;
+               vb2_buffer_done(&fbuf->vb.vb2_buf, VB2_BUF_STATE_DONE);
        }
 skip:
        usb_submit_urb(urb, GFP_ATOMIC);
@@ -464,7 +466,7 @@ static void rtl2832_sdr_cleanup_queued_bufs(struct rtl2832_sdr_dev *dev)
                buf = list_entry(dev->queued_bufs.next,
                                struct rtl2832_sdr_frame_buf, list);
                list_del(&buf->list);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
        }
        spin_unlock_irqrestore(&dev->queued_bufs_lock, flags);
 }
@@ -518,14 +520,15 @@ static int rtl2832_sdr_buf_prepare(struct vb2_buffer *vb)
 
 static void rtl2832_sdr_buf_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct rtl2832_sdr_dev *dev = vb2_get_drv_priv(vb->vb2_queue);
        struct rtl2832_sdr_frame_buf *buf =
-                       container_of(vb, struct rtl2832_sdr_frame_buf, vb);
+                       container_of(vbuf, struct rtl2832_sdr_frame_buf, vb);
        unsigned long flags;
 
        /* Check the device has not disconnected between prep and queuing */
        if (!dev->udev) {
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
                return;
        }
 
index c206df93066915f5974d917741d491670f56a6bb..b2f08e4a68bf6e806cc390fd8bb81cc457362b91 100644 (file)
@@ -35,6 +35,7 @@
 #include <media/v4l2-ioctl.h>
 #include <media/v4l2-device.h>
 #include <media/v4l2-fh.h>
+#include <media/videobuf2-v4l2.h>
 #include <media/videobuf2-dma-sg.h>
 
 #include "m00233_video_measure_memmap_package.h"
@@ -206,11 +207,12 @@ struct sg_dma_desc_info {
 #define COBALT_STREAM_FL_ADV_IRQ               1
 
 struct cobalt_buffer {
-       struct vb2_buffer vb;
+       struct vb2_v4l2_buffer vb;
        struct list_head list;
 };
 
-static inline struct cobalt_buffer *to_cobalt_buffer(struct vb2_buffer *vb2)
+static inline
+struct cobalt_buffer *to_cobalt_buffer(struct vb2_v4l2_buffer *vb2)
 {
        return container_of(vb2, struct cobalt_buffer, vb);
 }
index d1f5898d11ba1c046737b2bb2a7ba48fa7547b9d..3de26d0714b57aa16c8495c21d1e05091db697a1 100644 (file)
@@ -134,11 +134,12 @@ done:
                skip = true;
                s->skip_first_frames--;
        }
-       v4l2_get_timestamp(&cb->vb.v4l2_buf.timestamp);
+       v4l2_get_timestamp(&cb->vb.timestamp);
        /* TODO: the sequence number should be read from the FPGA so we
           also know about dropped frames. */
-       cb->vb.v4l2_buf.sequence = s->sequence++;
-       vb2_buffer_done(&cb->vb, (skip || s->unstable_frame) ?
+       cb->vb.sequence = s->sequence++;
+       vb2_buffer_done(&cb->vb.vb2_buf,
+                       (skip || s->unstable_frame) ?
                        VB2_BUF_STATE_REQUEUEING : VB2_BUF_STATE_DONE);
 }
 
index 9756fd3e8af5e78428a7e5ad1c7d8e34418f9653..7d331a4c33a2b15304b5aa1887ff03906966f212 100644 (file)
@@ -75,7 +75,7 @@ static int cobalt_buf_init(struct vb2_buffer *vb)
        const size_t bytes =
                COBALT_MAX_HEIGHT * max_pages_per_line * 0x20;
        const size_t audio_bytes = ((1920 * 4) / PAGE_SIZE + 1) * 0x20;
-       struct sg_dma_desc_info *desc = &s->dma_desc_info[vb->v4l2_buf.index];
+       struct sg_dma_desc_info *desc = &s->dma_desc_info[vb->index];
        struct sg_table *sg_desc = vb2_dma_sg_plane_desc(vb, 0);
        unsigned size;
        int ret;
@@ -105,17 +105,18 @@ static int cobalt_buf_init(struct vb2_buffer *vb)
 static void cobalt_buf_cleanup(struct vb2_buffer *vb)
 {
        struct cobalt_stream *s = vb->vb2_queue->drv_priv;
-       struct sg_dma_desc_info *desc = &s->dma_desc_info[vb->v4l2_buf.index];
+       struct sg_dma_desc_info *desc = &s->dma_desc_info[vb->index];
 
        descriptor_list_free(desc);
 }
 
 static int cobalt_buf_prepare(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cobalt_stream *s = vb->vb2_queue->drv_priv;
 
        vb2_set_plane_payload(vb, 0, s->stride * s->height);
-       vb->v4l2_buf.field = V4L2_FIELD_NONE;
+       vbuf->field = V4L2_FIELD_NONE;
        return 0;
 }
 
@@ -128,7 +129,7 @@ static void chain_all_buffers(struct cobalt_stream *s)
 
        list_for_each(p, &s->bufs) {
                cb = list_entry(p, struct cobalt_buffer, list);
-               desc[i] = &s->dma_desc_info[cb->vb.v4l2_buf.index];
+               desc[i] = &s->dma_desc_info[cb->vb.vb2_buf.index];
                if (i > 0)
                        descriptor_list_chain(desc[i-1], desc[i]);
                i++;
@@ -137,10 +138,11 @@ static void chain_all_buffers(struct cobalt_stream *s)
 
 static void cobalt_buf_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct vb2_queue *q = vb->vb2_queue;
        struct cobalt_stream *s = q->drv_priv;
-       struct cobalt_buffer *cb = to_cobalt_buffer(vb);
-       struct sg_dma_desc_info *desc = &s->dma_desc_info[vb->v4l2_buf.index];
+       struct cobalt_buffer *cb = to_cobalt_buffer(vbuf);
+       struct sg_dma_desc_info *desc = &s->dma_desc_info[vb->index];
        unsigned long flags;
 
        /* Prepare new buffer */
@@ -284,7 +286,7 @@ static void cobalt_dma_start_streaming(struct cobalt_stream *s)
                          &vo->control);
        }
        cb = list_first_entry(&s->bufs, struct cobalt_buffer, list);
-       omni_sg_dma_start(s, &s->dma_desc_info[cb->vb.v4l2_buf.index]);
+       omni_sg_dma_start(s, &s->dma_desc_info[cb->vb.vb2_buf.index]);
        spin_unlock_irqrestore(&s->irqlock, flags);
 }
 
@@ -381,7 +383,7 @@ static void cobalt_dma_stop_streaming(struct cobalt_stream *s)
        spin_lock_irqsave(&s->irqlock, flags);
        list_for_each(p, &s->bufs) {
                cb = list_entry(p, struct cobalt_buffer, list);
-               desc = &s->dma_desc_info[cb->vb.v4l2_buf.index];
+               desc = &s->dma_desc_info[cb->vb.vb2_buf.index];
                /* Stop DMA after this descriptor chain */
                descriptor_list_end_of_chain(desc);
        }
@@ -416,7 +418,7 @@ static void cobalt_stop_streaming(struct vb2_queue *q)
        list_for_each_safe(p, safe, &s->bufs) {
                cb = list_entry(p, struct cobalt_buffer, list);
                list_del(&cb->list);
-               vb2_buffer_done(&cb->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&cb->vb.vb2_buf, VB2_BUF_STATE_ERROR);
        }
        spin_unlock_irqrestore(&s->irqlock, flags);
 
index 63c0ee5d0bf5eca7511df486fe300b3a468301b5..316a32213eff3993460f5e013f330a9356367022 100644 (file)
@@ -1155,17 +1155,19 @@ static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
 
 static int buffer_prepare(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx23885_dev *dev = vb->vb2_queue->drv_priv;
        struct cx23885_buffer *buf =
-               container_of(vb, struct cx23885_buffer, vb);
+               container_of(vbuf, struct cx23885_buffer, vb);
 
        return cx23885_buf_prepare(buf, &dev->ts1);
 }
 
 static void buffer_finish(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx23885_dev *dev = vb->vb2_queue->drv_priv;
-       struct cx23885_buffer *buf = container_of(vb,
+       struct cx23885_buffer *buf = container_of(vbuf,
                struct cx23885_buffer, vb);
 
        cx23885_free_buffer(dev, buf);
@@ -1173,8 +1175,9 @@ static void buffer_finish(struct vb2_buffer *vb)
 
 static void buffer_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx23885_dev *dev = vb->vb2_queue->drv_priv;
-       struct cx23885_buffer   *buf = container_of(vb,
+       struct cx23885_buffer   *buf = container_of(vbuf,
                struct cx23885_buffer, vb);
 
        cx23885_buf_queue(&dev->ts1, buf);
@@ -1201,7 +1204,7 @@ static int cx23885_start_streaming(struct vb2_queue *q, unsigned int count)
                        struct cx23885_buffer, queue);
 
                list_del(&buf->queue);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_QUEUED);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_QUEUED);
        }
        spin_unlock_irqrestore(&dev->slock, flags);
        return ret;
index 7aee76af7a85552526dcf73cf8c70330d1bfd411..bc1c9602f4352a33ddb1797e616bfe212f89d5ad 100644 (file)
@@ -427,12 +427,13 @@ static void cx23885_wakeup(struct cx23885_tsport *port,
        buf = list_entry(q->active.next,
                         struct cx23885_buffer, queue);
 
-       v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp);
-       buf->vb.v4l2_buf.sequence = q->count++;
-       dprintk(1, "[%p/%d] wakeup reg=%d buf=%d\n", buf, buf->vb.v4l2_buf.index,
+       v4l2_get_timestamp(&buf->vb.timestamp);
+       buf->vb.sequence = q->count++;
+       dprintk(1, "[%p/%d] wakeup reg=%d buf=%d\n", buf,
+               buf->vb.vb2_buf.index,
                count, q->count);
        list_del(&buf->queue);
-       vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE);
+       vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
 }
 
 int cx23885_sram_channel_setup(struct cx23885_dev *dev,
@@ -1453,12 +1454,12 @@ int cx23885_buf_prepare(struct cx23885_buffer *buf, struct cx23885_tsport *port)
 {
        struct cx23885_dev *dev = port->dev;
        int size = port->ts_packet_size * port->ts_packet_count;
-       struct sg_table *sgt = vb2_dma_sg_plane_desc(&buf->vb, 0);
+       struct sg_table *sgt = vb2_dma_sg_plane_desc(&buf->vb.vb2_buf, 0);
 
        dprintk(1, "%s: %p\n", __func__, buf);
-       if (vb2_plane_size(&buf->vb, 0) < size)
+       if (vb2_plane_size(&buf->vb.vb2_buf, 0) < size)
                return -EINVAL;
-       vb2_set_plane_payload(&buf->vb, 0, size);
+       vb2_set_plane_payload(&buf->vb.vb2_buf, 0, size);
 
        cx23885_risc_databuffer(dev->pci, &buf->risc,
                                sgt->sgl,
@@ -1503,7 +1504,7 @@ void cx23885_buf_queue(struct cx23885_tsport *port, struct cx23885_buffer *buf)
        if (list_empty(&cx88q->active)) {
                list_add_tail(&buf->queue, &cx88q->active);
                dprintk(1, "[%p/%d] %s - first active\n",
-                       buf, buf->vb.v4l2_buf.index, __func__);
+                       buf, buf->vb.vb2_buf.index, __func__);
        } else {
                buf->risc.cpu[0] |= cpu_to_le32(RISC_IRQ1);
                prev = list_entry(cx88q->active.prev, struct cx23885_buffer,
@@ -1511,7 +1512,7 @@ void cx23885_buf_queue(struct cx23885_tsport *port, struct cx23885_buffer *buf)
                list_add_tail(&buf->queue, &cx88q->active);
                prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
                dprintk(1, "[%p/%d] %s - append to active\n",
-                        buf, buf->vb.v4l2_buf.index, __func__);
+                        buf, buf->vb.vb2_buf.index, __func__);
        }
        spin_unlock_irqrestore(&dev->slock, flags);
 }
@@ -1530,9 +1531,10 @@ static void do_cancel_buffers(struct cx23885_tsport *port, char *reason)
                buf = list_entry(q->active.next, struct cx23885_buffer,
                                 queue);
                list_del(&buf->queue);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
                dprintk(1, "[%p/%d] %s - dma=0x%08lx\n",
-                       buf, buf->vb.v4l2_buf.index, reason, (unsigned long)buf->risc.dma);
+                       buf, buf->vb.vb2_buf.index, reason,
+                       (unsigned long)buf->risc.dma);
        }
        spin_unlock_irqrestore(&port->slock, flags);
 }
index 6e8c24cdb2cd6b7fe2a8365bf8b62cb7bb5e8481..09ad51280295be49d2d5308bb2a4a6c97f19ae79 100644 (file)
@@ -110,18 +110,20 @@ static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
 
 static int buffer_prepare(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx23885_tsport *port = vb->vb2_queue->drv_priv;
        struct cx23885_buffer *buf =
-               container_of(vb, struct cx23885_buffer, vb);
+               container_of(vbuf, struct cx23885_buffer, vb);
 
        return cx23885_buf_prepare(buf, port);
 }
 
 static void buffer_finish(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx23885_tsport *port = vb->vb2_queue->drv_priv;
        struct cx23885_dev *dev = port->dev;
-       struct cx23885_buffer *buf = container_of(vb,
+       struct cx23885_buffer *buf = container_of(vbuf,
                struct cx23885_buffer, vb);
 
        cx23885_free_buffer(dev, buf);
@@ -129,8 +131,9 @@ static void buffer_finish(struct vb2_buffer *vb)
 
 static void buffer_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx23885_tsport *port = vb->vb2_queue->drv_priv;
-       struct cx23885_buffer   *buf = container_of(vb,
+       struct cx23885_buffer   *buf = container_of(vbuf,
                struct cx23885_buffer, vb);
 
        cx23885_buf_queue(port, buf);
index d362d3838c8479e7a5a2ea337bf2762b47b7f1d7..6c9bb0316abaf76c393c5241d43f6692eacc7818 100644 (file)
@@ -138,8 +138,9 @@ static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
 
 static int buffer_prepare(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx23885_dev *dev = vb->vb2_queue->drv_priv;
-       struct cx23885_buffer *buf = container_of(vb,
+       struct cx23885_buffer *buf = container_of(vbuf,
                struct cx23885_buffer, vb);
        struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
        unsigned lines = VBI_PAL_LINE_COUNT;
@@ -161,7 +162,8 @@ static int buffer_prepare(struct vb2_buffer *vb)
 
 static void buffer_finish(struct vb2_buffer *vb)
 {
-       struct cx23885_buffer *buf = container_of(vb,
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
+       struct cx23885_buffer *buf = container_of(vbuf,
                struct cx23885_buffer, vb);
 
        cx23885_free_buffer(vb->vb2_queue->drv_priv, buf);
@@ -190,8 +192,10 @@ static void buffer_finish(struct vb2_buffer *vb)
  */
 static void buffer_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx23885_dev *dev = vb->vb2_queue->drv_priv;
-       struct cx23885_buffer *buf = container_of(vb, struct cx23885_buffer, vb);
+       struct cx23885_buffer *buf = container_of(vbuf,
+                       struct cx23885_buffer, vb);
        struct cx23885_buffer *prev;
        struct cx23885_dmaqueue *q = &dev->vbiq;
        unsigned long flags;
@@ -206,7 +210,7 @@ static void buffer_queue(struct vb2_buffer *vb)
                list_add_tail(&buf->queue, &q->active);
                spin_unlock_irqrestore(&dev->slock, flags);
                dprintk(2, "[%p/%d] vbi_queue - first active\n",
-                       buf, buf->vb.v4l2_buf.index);
+                       buf, buf->vb.vb2_buf.index);
 
        } else {
                buf->risc.cpu[0] |= cpu_to_le32(RISC_IRQ1);
@@ -217,7 +221,7 @@ static void buffer_queue(struct vb2_buffer *vb)
                spin_unlock_irqrestore(&dev->slock, flags);
                prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
                dprintk(2, "[%p/%d] buffer_queue - append to active\n",
-                       buf, buf->vb.v4l2_buf.index);
+                       buf, buf->vb.vb2_buf.index);
        }
 }
 
@@ -245,7 +249,7 @@ static void cx23885_stop_streaming(struct vb2_queue *q)
                        struct cx23885_buffer, queue);
 
                list_del(&buf->queue);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
        }
        spin_unlock_irqrestore(&dev->slock, flags);
 }
index ec76470d12a47b1e092aa59e89748de4c7f81d49..b6a193df618ae9dc4a62ebc657127b7869dc01a1 100644 (file)
@@ -104,12 +104,12 @@ void cx23885_video_wakeup(struct cx23885_dev *dev,
        buf = list_entry(q->active.next,
                        struct cx23885_buffer, queue);
 
-       buf->vb.v4l2_buf.sequence = q->count++;
-       v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp);
-       dprintk(2, "[%p/%d] wakeup reg=%d buf=%d\n", buf, buf->vb.v4l2_buf.index,
-                       count, q->count);
+       buf->vb.sequence = q->count++;
+       v4l2_get_timestamp(&buf->vb.timestamp);
+       dprintk(2, "[%p/%d] wakeup reg=%d buf=%d\n", buf,
+                       buf->vb.vb2_buf.index, count, q->count);
        list_del(&buf->queue);
-       vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE);
+       vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
 }
 
 int cx23885_set_tvnorm(struct cx23885_dev *dev, v4l2_std_id norm)
@@ -329,9 +329,10 @@ static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
 
 static int buffer_prepare(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx23885_dev *dev = vb->vb2_queue->drv_priv;
        struct cx23885_buffer *buf =
-               container_of(vb, struct cx23885_buffer, vb);
+               container_of(vbuf, struct cx23885_buffer, vb);
        u32 line0_offset, line1_offset;
        struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
        int field_tff;
@@ -401,7 +402,7 @@ static int buffer_prepare(struct vb2_buffer *vb)
                BUG();
        }
        dprintk(2, "[%p/%d] buffer_init - %dx%d %dbpp \"%s\" - dma=0x%08lx\n",
-               buf, buf->vb.v4l2_buf.index,
+               buf, buf->vb.vb2_buf.index,
                dev->width, dev->height, dev->fmt->depth, dev->fmt->name,
                (unsigned long)buf->risc.dma);
        return 0;
@@ -409,7 +410,8 @@ static int buffer_prepare(struct vb2_buffer *vb)
 
 static void buffer_finish(struct vb2_buffer *vb)
 {
-       struct cx23885_buffer *buf = container_of(vb,
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
+       struct cx23885_buffer *buf = container_of(vbuf,
                struct cx23885_buffer, vb);
 
        cx23885_free_buffer(vb->vb2_queue->drv_priv, buf);
@@ -438,8 +440,9 @@ static void buffer_finish(struct vb2_buffer *vb)
  */
 static void buffer_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx23885_dev *dev = vb->vb2_queue->drv_priv;
-       struct cx23885_buffer   *buf = container_of(vb,
+       struct cx23885_buffer   *buf = container_of(vbuf,
                struct cx23885_buffer, vb);
        struct cx23885_buffer   *prev;
        struct cx23885_dmaqueue *q    = &dev->vidq;
@@ -455,7 +458,7 @@ static void buffer_queue(struct vb2_buffer *vb)
        if (list_empty(&q->active)) {
                list_add_tail(&buf->queue, &q->active);
                dprintk(2, "[%p/%d] buffer_queue - first active\n",
-                       buf, buf->vb.v4l2_buf.index);
+                       buf, buf->vb.vb2_buf.index);
        } else {
                buf->risc.cpu[0] |= cpu_to_le32(RISC_IRQ1);
                prev = list_entry(q->active.prev, struct cx23885_buffer,
@@ -463,7 +466,7 @@ static void buffer_queue(struct vb2_buffer *vb)
                list_add_tail(&buf->queue, &q->active);
                prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
                dprintk(2, "[%p/%d] buffer_queue - append to active\n",
-                               buf, buf->vb.v4l2_buf.index);
+                               buf, buf->vb.vb2_buf.index);
        }
        spin_unlock_irqrestore(&dev->slock, flags);
 }
@@ -492,7 +495,7 @@ static void cx23885_stop_streaming(struct vb2_queue *q)
                        struct cx23885_buffer, queue);
 
                list_del(&buf->queue);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
        }
        spin_unlock_irqrestore(&dev->slock, flags);
 }
index 027ead438194809f3696af5588604594de944e26..c5ba0833f47a69803ccb51d200738b88d432eb18 100644 (file)
@@ -170,7 +170,7 @@ struct cx23885_riscmem {
 /* buffer for one video frame */
 struct cx23885_buffer {
        /* common v4l buffer stuff -- must be first */
-       struct vb2_buffer vb;
+       struct vb2_v4l2_buffer vb;
        struct list_head queue;
 
        /* cx23885 specific */
index 7bc495e4ece259ddc0a23b4248c7d774a41744a1..f1deb8fd271ca009acb787ce2a26033fe4289e60 100644 (file)
@@ -130,10 +130,10 @@ int cx25821_video_irq(struct cx25821_dev *dev, int chan_num, u32 status)
                        buf = list_entry(dmaq->active.next,
                                         struct cx25821_buffer, queue);
 
-                       v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp);
-                       buf->vb.v4l2_buf.sequence = dmaq->count++;
+                       v4l2_get_timestamp(&buf->vb.timestamp);
+                       buf->vb.sequence = dmaq->count++;
                        list_del(&buf->queue);
-                       vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE);
+                       vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
                }
                spin_unlock(&dev->slock);
                handled++;
@@ -159,10 +159,11 @@ static int cx25821_queue_setup(struct vb2_queue *q, const struct v4l2_format *fm
 
 static int cx25821_buffer_prepare(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx25821_channel *chan = vb->vb2_queue->drv_priv;
        struct cx25821_dev *dev = chan->dev;
        struct cx25821_buffer *buf =
-               container_of(vb, struct cx25821_buffer, vb);
+               container_of(vbuf, struct cx25821_buffer, vb);
        struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
        u32 line0_offset;
        int bpl_local = LINE_SIZE_D1;
@@ -176,7 +177,7 @@ static int cx25821_buffer_prepare(struct vb2_buffer *vb)
        if (vb2_plane_size(vb, 0) < chan->height * buf->bpl)
                return -EINVAL;
        vb2_set_plane_payload(vb, 0, chan->height * buf->bpl);
-       buf->vb.v4l2_buf.field = chan->field;
+       buf->vb.field = chan->field;
 
        if (chan->pixel_formats == PIXEL_FRMT_411) {
                bpl_local = buf->bpl;
@@ -231,7 +232,7 @@ static int cx25821_buffer_prepare(struct vb2_buffer *vb)
        }
 
        dprintk(2, "[%p/%d] buffer_prep - %dx%d %dbpp \"%s\" - dma=0x%08lx\n",
-               buf, buf->vb.v4l2_buf.index, chan->width, chan->height,
+               buf, buf->vb.vb2_buf.index, chan->width, chan->height,
                chan->fmt->depth, chan->fmt->name,
                (unsigned long)buf->risc.dma);
 
@@ -240,8 +241,9 @@ static int cx25821_buffer_prepare(struct vb2_buffer *vb)
 
 static void cx25821_buffer_finish(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx25821_buffer *buf =
-               container_of(vb, struct cx25821_buffer, vb);
+               container_of(vbuf, struct cx25821_buffer, vb);
        struct cx25821_channel *chan = vb->vb2_queue->drv_priv;
        struct cx25821_dev *dev = chan->dev;
 
@@ -250,8 +252,9 @@ static void cx25821_buffer_finish(struct vb2_buffer *vb)
 
 static void cx25821_buffer_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx25821_buffer *buf =
-               container_of(vb, struct cx25821_buffer, vb);
+               container_of(vbuf, struct cx25821_buffer, vb);
        struct cx25821_channel *chan = vb->vb2_queue->drv_priv;
        struct cx25821_dev *dev = chan->dev;
        struct cx25821_buffer *prev;
@@ -300,7 +303,7 @@ static void cx25821_stop_streaming(struct vb2_queue *q)
                        struct cx25821_buffer, queue);
 
                list_del(&buf->queue);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
        }
        spin_unlock_irqrestore(&dev->slock, flags);
 }
index d81a08a2df4f3a8d808b8552d4fc189bc44394ce..a513b68be0fa1c10ca53b2b58706a3a1f87ee1be 100644 (file)
@@ -34,6 +34,7 @@
 #include <media/v4l2-common.h>
 #include <media/v4l2-device.h>
 #include <media/v4l2-ctrls.h>
+#include <media/videobuf2-v4l2.h>
 #include <media/videobuf2-dma-sg.h>
 
 #include "cx25821-reg.h"
@@ -127,7 +128,7 @@ struct cx25821_riscmem {
 /* buffer for one video frame */
 struct cx25821_buffer {
        /* common v4l buffer stuff -- must be first */
-       struct vb2_buffer vb;
+       struct vb2_v4l2_buffer vb;
        struct list_head queue;
 
        /* cx25821 specific */
index 24216efa56e76fda79e7cf42c799f74e9fe81d4e..49d0b7c5271bd28f7e1b5d343ef100835121ae9a 100644 (file)
@@ -653,16 +653,18 @@ static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
 
 static int buffer_prepare(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx8802_dev *dev = vb->vb2_queue->drv_priv;
-       struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
+       struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
 
        return cx8802_buf_prepare(vb->vb2_queue, dev, buf);
 }
 
 static void buffer_finish(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx8802_dev *dev = vb->vb2_queue->drv_priv;
-       struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
+       struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
        struct cx88_riscmem *risc = &buf->risc;
 
        if (risc->cpu)
@@ -672,8 +674,9 @@ static void buffer_finish(struct vb2_buffer *vb)
 
 static void buffer_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx8802_dev *dev = vb->vb2_queue->drv_priv;
-       struct cx88_buffer    *buf = container_of(vb, struct cx88_buffer, vb);
+       struct cx88_buffer    *buf = container_of(vbuf, struct cx88_buffer, vb);
 
        cx8802_buf_queue(dev, buf);
 }
@@ -721,7 +724,7 @@ fail:
                        struct cx88_buffer, list);
 
                list_del(&buf->list);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_QUEUED);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_QUEUED);
        }
        spin_unlock_irqrestore(&dev->slock, flags);
        return err;
@@ -749,7 +752,7 @@ static void stop_streaming(struct vb2_queue *q)
                        struct cx88_buffer, list);
 
                list_del(&buf->list);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
        }
        spin_unlock_irqrestore(&dev->slock, flags);
 }
index aab7cf4c9825e118bb0ecb506bd63fc018b66f3c..9a43c7826b603e2c535b952addaad0a6e4c2636d 100644 (file)
@@ -518,11 +518,11 @@ void cx88_wakeup(struct cx88_core *core,
 
        buf = list_entry(q->active.next,
                         struct cx88_buffer, list);
-       v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp);
-       buf->vb.v4l2_buf.field = core->field;
-       buf->vb.v4l2_buf.sequence = q->count++;
+       v4l2_get_timestamp(&buf->vb.timestamp);
+       buf->vb.field = core->field;
+       buf->vb.sequence = q->count++;
        list_del(&buf->list);
-       vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE);
+       vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
 }
 
 void cx88_shutdown(struct cx88_core *core)
index 9dfa5ee32a8fa17c21871afa0e1b47347a2cabe3..f0923fb5a35dd118c33e32d14a97a6cbe1b007fd 100644 (file)
@@ -99,16 +99,18 @@ static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
 
 static int buffer_prepare(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx8802_dev *dev = vb->vb2_queue->drv_priv;
-       struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
+       struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
 
        return cx8802_buf_prepare(vb->vb2_queue, dev, buf);
 }
 
 static void buffer_finish(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx8802_dev *dev = vb->vb2_queue->drv_priv;
-       struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
+       struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
        struct cx88_riscmem *risc = &buf->risc;
 
        if (risc->cpu)
@@ -118,8 +120,9 @@ static void buffer_finish(struct vb2_buffer *vb)
 
 static void buffer_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx8802_dev *dev = vb->vb2_queue->drv_priv;
-       struct cx88_buffer    *buf = container_of(vb, struct cx88_buffer, vb);
+       struct cx88_buffer    *buf = container_of(vbuf, struct cx88_buffer, vb);
 
        cx8802_buf_queue(dev, buf);
 }
@@ -149,7 +152,7 @@ static void stop_streaming(struct vb2_queue *q)
                        struct cx88_buffer, list);
 
                list_del(&buf->list);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
        }
        spin_unlock_irqrestore(&dev->slock, flags);
 }
index 34f5057444772f34a364bd0a596adfe5b683588d..9961b2232b97fd42eaef0e2fffa16de06cad99d1 100644 (file)
@@ -214,7 +214,7 @@ static int cx8802_restart_queue(struct cx8802_dev    *dev,
 
        buf = list_entry(q->active.next, struct cx88_buffer, list);
        dprintk(2,"restart_queue [%p/%d]: restart dma\n",
-               buf, buf->vb.v4l2_buf.index);
+               buf, buf->vb.vb2_buf.index);
        cx8802_start_dma(dev, q, buf);
        return 0;
 }
@@ -225,13 +225,13 @@ int cx8802_buf_prepare(struct vb2_queue *q, struct cx8802_dev *dev,
                        struct cx88_buffer *buf)
 {
        int size = dev->ts_packet_size * dev->ts_packet_count;
-       struct sg_table *sgt = vb2_dma_sg_plane_desc(&buf->vb, 0);
+       struct sg_table *sgt = vb2_dma_sg_plane_desc(&buf->vb.vb2_buf, 0);
        struct cx88_riscmem *risc = &buf->risc;
        int rc;
 
-       if (vb2_plane_size(&buf->vb, 0) < size)
+       if (vb2_plane_size(&buf->vb.vb2_buf, 0) < size)
                return -EINVAL;
-       vb2_set_plane_payload(&buf->vb, 0, size);
+       vb2_set_plane_payload(&buf->vb.vb2_buf, 0, size);
 
        rc = cx88_risc_databuffer(dev->pci, risc, sgt->sgl,
                             dev->ts_packet_size, dev->ts_packet_count, 0);
@@ -259,7 +259,7 @@ void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf)
                dprintk( 1, "queue is empty - first active\n" );
                list_add_tail(&buf->list, &cx88q->active);
                dprintk(1,"[%p/%d] %s - first active\n",
-                       buf, buf->vb.v4l2_buf.index, __func__);
+                       buf, buf->vb.vb2_buf.index, __func__);
 
        } else {
                buf->risc.cpu[0] |= cpu_to_le32(RISC_IRQ1);
@@ -268,7 +268,7 @@ void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf)
                list_add_tail(&buf->list, &cx88q->active);
                prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
                dprintk( 1, "[%p/%d] %s - append to active\n",
-                       buf, buf->vb.v4l2_buf.index, __func__);
+                       buf, buf->vb.vb2_buf.index, __func__);
        }
 }
 
@@ -284,7 +284,7 @@ static void do_cancel_buffers(struct cx8802_dev *dev)
        while (!list_empty(&q->active)) {
                buf = list_entry(q->active.next, struct cx88_buffer, list);
                list_del(&buf->list);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
        }
        spin_unlock_irqrestore(&dev->slock,flags);
 }
index 7510e80eb2ff89537ec360ebb43867b382320e5f..1d65543003b43f2897dd536ed3e204a676cfa50a 100644 (file)
@@ -100,7 +100,7 @@ int cx8800_restart_vbi_queue(struct cx8800_dev    *dev,
 
        buf = list_entry(q->active.next, struct cx88_buffer, list);
        dprintk(2,"restart_queue [%p/%d]: restart dma\n",
-               buf, buf->vb.v4l2_buf.index);
+               buf, buf->vb.vb2_buf.index);
        cx8800_start_vbi_dma(dev, q, buf);
        return 0;
 }
@@ -125,8 +125,9 @@ static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
 
 static int buffer_prepare(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx8800_dev *dev = vb->vb2_queue->drv_priv;
-       struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
+       struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
        struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
        unsigned int lines;
        unsigned int size;
@@ -149,8 +150,9 @@ static int buffer_prepare(struct vb2_buffer *vb)
 
 static void buffer_finish(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx8800_dev *dev = vb->vb2_queue->drv_priv;
-       struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
+       struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
        struct cx88_riscmem *risc = &buf->risc;
 
        if (risc->cpu)
@@ -160,8 +162,9 @@ static void buffer_finish(struct vb2_buffer *vb)
 
 static void buffer_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx8800_dev *dev = vb->vb2_queue->drv_priv;
-       struct cx88_buffer    *buf = container_of(vb, struct cx88_buffer, vb);
+       struct cx88_buffer    *buf = container_of(vbuf, struct cx88_buffer, vb);
        struct cx88_buffer    *prev;
        struct cx88_dmaqueue  *q    = &dev->vbiq;
 
@@ -174,7 +177,7 @@ static void buffer_queue(struct vb2_buffer *vb)
                list_add_tail(&buf->list, &q->active);
                cx8800_start_vbi_dma(dev, q, buf);
                dprintk(2,"[%p/%d] vbi_queue - first active\n",
-                       buf, buf->vb.v4l2_buf.index);
+                       buf, buf->vb.vb2_buf.index);
 
        } else {
                buf->risc.cpu[0] |= cpu_to_le32(RISC_IRQ1);
@@ -182,7 +185,7 @@ static void buffer_queue(struct vb2_buffer *vb)
                list_add_tail(&buf->list, &q->active);
                prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
                dprintk(2,"[%p/%d] buffer_queue - append to active\n",
-                       buf, buf->vb.v4l2_buf.index);
+                       buf, buf->vb.vb2_buf.index);
        }
 }
 
@@ -213,7 +216,7 @@ static void stop_streaming(struct vb2_queue *q)
                        struct cx88_buffer, list);
 
                list_del(&buf->list);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
        }
        spin_unlock_irqrestore(&dev->slock, flags);
 }
index 400e5caefd5841d54886af13c71e2903e355c6f7..c6a337abdbb3651e9f1fcb723a0164c949e8af8a 100644 (file)
@@ -420,7 +420,7 @@ static int restart_video_queue(struct cx8800_dev    *dev,
        if (!list_empty(&q->active)) {
                buf = list_entry(q->active.next, struct cx88_buffer, list);
                dprintk(2,"restart_queue [%p/%d]: restart dma\n",
-                       buf, buf->vb.v4l2_buf.index);
+                       buf, buf->vb.vb2_buf.index);
                start_video_dma(dev, q, buf);
        }
        return 0;
@@ -444,9 +444,10 @@ static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
 
 static int buffer_prepare(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx8800_dev *dev = vb->vb2_queue->drv_priv;
        struct cx88_core *core = dev->core;
-       struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
+       struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
        struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
 
        buf->bpl = core->width * dev->fmt->depth >> 3;
@@ -489,7 +490,7 @@ static int buffer_prepare(struct vb2_buffer *vb)
                break;
        }
        dprintk(2,"[%p/%d] buffer_prepare - %dx%d %dbpp \"%s\" - dma=0x%08lx\n",
-               buf, buf->vb.v4l2_buf.index,
+               buf, buf->vb.vb2_buf.index,
                core->width, core->height, dev->fmt->depth, dev->fmt->name,
                (unsigned long)buf->risc.dma);
        return 0;
@@ -497,8 +498,9 @@ static int buffer_prepare(struct vb2_buffer *vb)
 
 static void buffer_finish(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx8800_dev *dev = vb->vb2_queue->drv_priv;
-       struct cx88_buffer *buf = container_of(vb, struct cx88_buffer, vb);
+       struct cx88_buffer *buf = container_of(vbuf, struct cx88_buffer, vb);
        struct cx88_riscmem *risc = &buf->risc;
 
        if (risc->cpu)
@@ -508,8 +510,9 @@ static void buffer_finish(struct vb2_buffer *vb)
 
 static void buffer_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct cx8800_dev *dev = vb->vb2_queue->drv_priv;
-       struct cx88_buffer    *buf = container_of(vb, struct cx88_buffer, vb);
+       struct cx88_buffer    *buf = container_of(vbuf, struct cx88_buffer, vb);
        struct cx88_buffer    *prev;
        struct cx88_core      *core = dev->core;
        struct cx88_dmaqueue  *q    = &dev->vidq;
@@ -522,7 +525,7 @@ static void buffer_queue(struct vb2_buffer *vb)
        if (list_empty(&q->active)) {
                list_add_tail(&buf->list, &q->active);
                dprintk(2,"[%p/%d] buffer_queue - first active\n",
-                       buf, buf->vb.v4l2_buf.index);
+                       buf, buf->vb.vb2_buf.index);
 
        } else {
                buf->risc.cpu[0] |= cpu_to_le32(RISC_IRQ1);
@@ -530,7 +533,7 @@ static void buffer_queue(struct vb2_buffer *vb)
                list_add_tail(&buf->list, &q->active);
                prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
                dprintk(2, "[%p/%d] buffer_queue - append to active\n",
-                       buf, buf->vb.v4l2_buf.index);
+                       buf, buf->vb.vb2_buf.index);
        }
 }
 
@@ -560,7 +563,7 @@ static void stop_streaming(struct vb2_queue *q)
                        struct cx88_buffer, list);
 
                list_del(&buf->list);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
        }
        spin_unlock_irqrestore(&dev->slock, flags);
 }
index 785fe2e0d702e3ac5614b789c06ba54d705069ec..2996eb3ea1fc87db583dfbc80a5fd417de70da45 100644 (file)
@@ -321,7 +321,7 @@ struct cx88_riscmem {
 /* buffer for one video frame */
 struct cx88_buffer {
        /* common v4l buffer stuff -- must be first */
-       struct vb2_buffer vb;
+       struct vb2_v4l2_buffer vb;
        struct list_head       list;
 
        /* cx88 specific */
index 8df6345189272eef437eefeff52600fe322db7cc..f27a8582d17958c18128bba96af79ed7fe573c11 100644 (file)
@@ -160,7 +160,7 @@ static int dt3155_buf_prepare(struct vb2_buffer *vb)
 static int dt3155_start_streaming(struct vb2_queue *q, unsigned count)
 {
        struct dt3155_priv *pd = vb2_get_drv_priv(q);
-       struct vb2_buffer *vb = pd->curr_buf;
+       struct vb2_buffer *vb = &pd->curr_buf->vb2_buf;
        dma_addr_t dma_addr;
 
        pd->sequence = 0;
@@ -208,7 +208,7 @@ static void dt3155_stop_streaming(struct vb2_queue *q)
 
        spin_lock_irq(&pd->lock);
        if (pd->curr_buf) {
-               vb2_buffer_done(pd->curr_buf, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&pd->curr_buf->vb2_buf, VB2_BUF_STATE_ERROR);
                pd->curr_buf = NULL;
        }
 
@@ -222,6 +222,7 @@ static void dt3155_stop_streaming(struct vb2_queue *q)
 
 static void dt3155_buf_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct dt3155_priv *pd = vb2_get_drv_priv(vb->vb2_queue);
 
        /*  pd->vidq.streaming = 1 when dt3155_buf_queue() is invoked  */
@@ -229,7 +230,7 @@ static void dt3155_buf_queue(struct vb2_buffer *vb)
        if (pd->curr_buf)
                list_add_tail(&vb->done_entry, &pd->dmaq);
        else
-               pd->curr_buf = vb;
+               pd->curr_buf = vbuf;
        spin_unlock_irq(&pd->lock);
 }
 
@@ -269,14 +270,14 @@ static irqreturn_t dt3155_irq_handler_even(int irq, void *dev_id)
 
        spin_lock(&ipd->lock);
        if (ipd->curr_buf && !list_empty(&ipd->dmaq)) {
-               v4l2_get_timestamp(&ipd->curr_buf->v4l2_buf.timestamp);
-               ipd->curr_buf->v4l2_buf.sequence = ipd->sequence++;
-               ipd->curr_buf->v4l2_buf.field = V4L2_FIELD_NONE;
-               vb2_buffer_done(ipd->curr_buf, VB2_BUF_STATE_DONE);
+               v4l2_get_timestamp(&ipd->curr_buf->timestamp);
+               ipd->curr_buf->sequence = ipd->sequence++;
+               ipd->curr_buf->field = V4L2_FIELD_NONE;
+               vb2_buffer_done(&ipd->curr_buf->vb2_buf, VB2_BUF_STATE_DONE);
 
                ivb = list_first_entry(&ipd->dmaq, typeof(*ivb), done_entry);
                list_del(&ivb->done_entry);
-               ipd->curr_buf = ivb;
+               ipd->curr_buf = to_vb2_v4l2_buffer(ivb);
                dma_addr = vb2_dma_contig_plane_dma_addr(ivb, 0);
                iowrite32(dma_addr, ipd->regs + EVEN_DMA_START);
                iowrite32(dma_addr + ipd->width, ipd->regs + ODD_DMA_START);
index 4e1f4d598d57deedae3be108989d25eb7ace860b..b3531e0bc7333d1981e0983f54c08fbdd1230024 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/interrupt.h>
 #include <media/v4l2-device.h>
 #include <media/v4l2-dev.h>
+#include <media/videobuf2-v4l2.h>
 
 #define DT3155_NAME "dt3155"
 #define DT3155_VER_MAJ 2
@@ -181,7 +182,7 @@ struct dt3155_priv {
        struct pci_dev *pdev;
        struct vb2_queue vidq;
        struct vb2_alloc_ctx *alloc_ctx;
-       struct vb2_buffer *curr_buf;
+       struct vb2_v4l2_buffer *curr_buf;
        struct mutex mux;
        struct list_head dmaq;
        spinlock_t lock;
index 6d8bf627764738c507eeaf73c38b94ea160d4da5..b012aa658a54405e4386f74a043dcd496cbd2652 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/interrupt.h>
 #include <linux/delay.h>
 #include <linux/list.h>
+#include <media/videobuf2-v4l2.h>
 #include <media/videobuf2-vmalloc.h>
 
 #include "netup_unidvb.h"
@@ -110,7 +111,7 @@ struct netup_dma_regs {
 } __packed __aligned(1);
 
 struct netup_unidvb_buffer {
-       struct vb2_buffer       vb;
+       struct vb2_v4l2_buffer vb;
        struct list_head        list;
        u32                     size;
 };
@@ -300,7 +301,8 @@ static int netup_unidvb_queue_setup(struct vb2_queue *vq,
 static int netup_unidvb_buf_prepare(struct vb2_buffer *vb)
 {
        struct netup_dma *dma = vb2_get_drv_priv(vb->vb2_queue);
-       struct netup_unidvb_buffer *buf = container_of(vb,
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
+       struct netup_unidvb_buffer *buf = container_of(vbuf,
                                struct netup_unidvb_buffer, vb);
 
        dev_dbg(&dma->ndev->pci_dev->dev, "%s(): buf 0x%p\n", __func__, buf);
@@ -312,7 +314,8 @@ static void netup_unidvb_buf_queue(struct vb2_buffer *vb)
 {
        unsigned long flags;
        struct netup_dma *dma = vb2_get_drv_priv(vb->vb2_queue);
-       struct netup_unidvb_buffer *buf = container_of(vb,
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
+       struct netup_unidvb_buffer *buf = container_of(vbuf,
                                struct netup_unidvb_buffer, vb);
 
        dev_dbg(&dma->ndev->pci_dev->dev, "%s(): %p\n", __func__, buf);
@@ -509,7 +512,7 @@ static int netup_unidvb_ring_copy(struct netup_dma *dma,
 {
        u32 copy_bytes, ring_bytes;
        u32 buff_bytes = NETUP_DMA_PACKETS_COUNT * 188 - buf->size;
-       u8 *p = vb2_plane_vaddr(&buf->vb, 0);
+       u8 *p = vb2_plane_vaddr(&buf->vb.vb2_buf, 0);
        struct netup_unidvb_dev *ndev = dma->ndev;
 
        if (p == NULL) {
@@ -579,9 +582,9 @@ static void netup_unidvb_dma_worker(struct work_struct *work)
                        dev_dbg(&ndev->pci_dev->dev,
                                "%s(): buffer %p done, size %d\n",
                                __func__, buf, buf->size);
-                       v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp);
-                       vb2_set_plane_payload(&buf->vb, 0, buf->size);
-                       vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE);
+                       v4l2_get_timestamp(&buf->vb.timestamp);
+                       vb2_set_plane_payload(&buf->vb.vb2_buf, 0, buf->size);
+                       vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
                }
        }
 work_done:
@@ -599,7 +602,7 @@ static void netup_unidvb_queue_cleanup(struct netup_dma *dma)
                buf = list_first_entry(&dma->free_buffers,
                        struct netup_unidvb_buffer, list);
                list_del(&buf->list);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
        }
        spin_unlock_irqrestore(&dma->lock, flags);
 }
index 72d7f992375ec225eca6a31dc2b36a93716871ee..87f39f97a79f21ab8dc016754cc8a19d0d2677de 100644 (file)
@@ -216,13 +216,14 @@ int saa7134_buffer_count(unsigned int size, unsigned int count)
 
 int saa7134_buffer_startpage(struct saa7134_buf *buf)
 {
-       return saa7134_buffer_pages(vb2_plane_size(&buf->vb2, 0)) * buf->vb2.v4l2_buf.index;
+       return saa7134_buffer_pages(vb2_plane_size(&buf->vb2.vb2_buf, 0))
+                       * buf->vb2.vb2_buf.index;
 }
 
 unsigned long saa7134_buffer_base(struct saa7134_buf *buf)
 {
        unsigned long base;
-       struct sg_table *dma = vb2_dma_sg_plane_desc(&buf->vb2, 0);
+       struct sg_table *dma = vb2_dma_sg_plane_desc(&buf->vb2.vb2_buf, 0);
 
        base  = saa7134_buffer_startpage(buf) * 4096;
        base += dma->sgl[0].offset;
@@ -308,9 +309,9 @@ void saa7134_buffer_finish(struct saa7134_dev *dev,
        core_dbg("buffer_finish %p\n", q->curr);
 
        /* finish current buffer */
-       v4l2_get_timestamp(&q->curr->vb2.v4l2_buf.timestamp);
-       q->curr->vb2.v4l2_buf.sequence = q->seq_nr++;
-       vb2_buffer_done(&q->curr->vb2, state);
+       v4l2_get_timestamp(&q->curr->vb2.timestamp);
+       q->curr->vb2.sequence = q->seq_nr++;
+       vb2_buffer_done(&q->curr->vb2.vb2_buf, state);
        q->curr = NULL;
 }
 
@@ -375,7 +376,8 @@ void saa7134_stop_streaming(struct saa7134_dev *dev, struct saa7134_dmaqueue *q)
        if (!list_empty(&q->queue)) {
                list_for_each_safe(pos, n, &q->queue) {
                         tmp = list_entry(pos, struct saa7134_buf, entry);
-                        vb2_buffer_done(&tmp->vb2, VB2_BUF_STATE_ERROR);
+                        vb2_buffer_done(&tmp->vb2.vb2_buf,
+                                        VB2_BUF_STATE_ERROR);
                         list_del(pos);
                         tmp = NULL;
                }
index 4b202fa5fbc4e9e92d860dfaa15bd1af6c98039e..b0ef37dc770aa1062bc827034fe91dea36f8ddee 100644 (file)
@@ -79,8 +79,9 @@ static int buffer_activate(struct saa7134_dev *dev,
 
 int saa7134_ts_buffer_init(struct vb2_buffer *vb2)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb2);
        struct saa7134_dmaqueue *dmaq = vb2->vb2_queue->drv_priv;
-       struct saa7134_buf *buf = container_of(vb2, struct saa7134_buf, vb2);
+       struct saa7134_buf *buf = container_of(vbuf, struct saa7134_buf, vb2);
 
        dmaq->curr = NULL;
        buf->activate = buffer_activate;
@@ -91,9 +92,10 @@ EXPORT_SYMBOL_GPL(saa7134_ts_buffer_init);
 
 int saa7134_ts_buffer_prepare(struct vb2_buffer *vb2)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb2);
        struct saa7134_dmaqueue *dmaq = vb2->vb2_queue->drv_priv;
        struct saa7134_dev *dev = dmaq->dev;
-       struct saa7134_buf *buf = container_of(vb2, struct saa7134_buf, vb2);
+       struct saa7134_buf *buf = container_of(vbuf, struct saa7134_buf, vb2);
        struct sg_table *dma = vb2_dma_sg_plane_desc(vb2, 0);
        unsigned int lines, llength, size;
 
@@ -107,7 +109,7 @@ int saa7134_ts_buffer_prepare(struct vb2_buffer *vb2)
                return -EINVAL;
 
        vb2_set_plane_payload(vb2, 0, size);
-       vb2->v4l2_buf.field = dev->field;
+       vbuf->field = dev->field;
 
        return saa7134_pgtable_build(dev->pci, &dmaq->pt, dma->sgl, dma->nents,
                                    saa7134_buffer_startpage(buf));
@@ -148,10 +150,12 @@ int saa7134_ts_start_streaming(struct vb2_queue *vq, unsigned int count)
 
                list_for_each_entry_safe(buf, tmp, &dmaq->queue, entry) {
                        list_del(&buf->entry);
-                       vb2_buffer_done(&buf->vb2, VB2_BUF_STATE_QUEUED);
+                       vb2_buffer_done(&buf->vb2.vb2_buf,
+                                       VB2_BUF_STATE_QUEUED);
                }
                if (dmaq->curr) {
-                       vb2_buffer_done(&dmaq->curr->vb2, VB2_BUF_STATE_QUEUED);
+                       vb2_buffer_done(&dmaq->curr->vb2.vb2_buf,
+                                       VB2_BUF_STATE_QUEUED);
                        dmaq->curr = NULL;
                }
                return -EBUSY;
index 4d36586ad752bd48159fcdfa6d2480eadb4844db..fb1605e25e528de71dfe6f4d390e40f4a4e91d77 100644 (file)
@@ -83,7 +83,7 @@ static int buffer_activate(struct saa7134_dev *dev,
                           struct saa7134_buf *buf,
                           struct saa7134_buf *next)
 {
-       struct saa7134_dmaqueue *dmaq = buf->vb2.vb2_queue->drv_priv;
+       struct saa7134_dmaqueue *dmaq = buf->vb2.vb2_buf.vb2_queue->drv_priv;
        unsigned long control, base;
 
        vbi_dbg("buffer_activate [%p]\n", buf);
@@ -119,8 +119,9 @@ static int buffer_prepare(struct vb2_buffer *vb2)
 {
        struct saa7134_dmaqueue *dmaq = vb2->vb2_queue->drv_priv;
        struct saa7134_dev *dev = dmaq->dev;
-       struct saa7134_buf *buf = container_of(vb2, struct saa7134_buf, vb2);
-       struct sg_table *dma = vb2_dma_sg_plane_desc(&buf->vb2, 0);
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb2);
+       struct saa7134_buf *buf = container_of(vbuf, struct saa7134_buf, vb2);
+       struct sg_table *dma = vb2_dma_sg_plane_desc(vb2, 0);
        unsigned int size;
 
        if (dma->sgl->offset) {
@@ -161,7 +162,8 @@ static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
 static int buffer_init(struct vb2_buffer *vb2)
 {
        struct saa7134_dmaqueue *dmaq = vb2->vb2_queue->drv_priv;
-       struct saa7134_buf *buf = container_of(vb2, struct saa7134_buf, vb2);
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb2);
+       struct saa7134_buf *buf = container_of(vbuf, struct saa7134_buf, vb2);
 
        dmaq->curr = NULL;
        buf->activate = buffer_activate;
index 035039cfae6d61558ba400e7139156f8dbd74b42..602d53d6122c6099deca74ff9b1b005a1239a959 100644 (file)
@@ -791,7 +791,7 @@ static int buffer_activate(struct saa7134_dev *dev,
                           struct saa7134_buf *buf,
                           struct saa7134_buf *next)
 {
-       struct saa7134_dmaqueue *dmaq = buf->vb2.vb2_queue->drv_priv;
+       struct saa7134_dmaqueue *dmaq = buf->vb2.vb2_buf.vb2_queue->drv_priv;
        unsigned long base,control,bpl;
        unsigned long bpl_uv,lines_uv,base2,base3,tmp; /* planar */
 
@@ -872,7 +872,8 @@ static int buffer_activate(struct saa7134_dev *dev,
 static int buffer_init(struct vb2_buffer *vb2)
 {
        struct saa7134_dmaqueue *dmaq = vb2->vb2_queue->drv_priv;
-       struct saa7134_buf *buf = container_of(vb2, struct saa7134_buf, vb2);
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb2);
+       struct saa7134_buf *buf = container_of(vbuf, struct saa7134_buf, vb2);
 
        dmaq->curr = NULL;
        buf->activate = buffer_activate;
@@ -883,8 +884,9 @@ static int buffer_prepare(struct vb2_buffer *vb2)
 {
        struct saa7134_dmaqueue *dmaq = vb2->vb2_queue->drv_priv;
        struct saa7134_dev *dev = dmaq->dev;
-       struct saa7134_buf *buf = container_of(vb2, struct saa7134_buf, vb2);
-       struct sg_table *dma = vb2_dma_sg_plane_desc(&buf->vb2, 0);
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb2);
+       struct saa7134_buf *buf = container_of(vbuf, struct saa7134_buf, vb2);
+       struct sg_table *dma = vb2_dma_sg_plane_desc(vb2, 0);
        unsigned int size;
 
        if (dma->sgl->offset) {
@@ -896,7 +898,7 @@ static int buffer_prepare(struct vb2_buffer *vb2)
                return -EINVAL;
 
        vb2_set_plane_payload(vb2, 0, size);
-       vb2->v4l2_buf.field = dev->field;
+       vbuf->field = dev->field;
 
        return saa7134_pgtable_build(dev->pci, &dmaq->pt, dma->sgl, dma->nents,
                                    saa7134_buffer_startpage(buf));
@@ -932,7 +934,8 @@ void saa7134_vb2_buffer_queue(struct vb2_buffer *vb)
 {
        struct saa7134_dmaqueue *dmaq = vb->vb2_queue->drv_priv;
        struct saa7134_dev *dev = dmaq->dev;
-       struct saa7134_buf *buf = container_of(vb, struct saa7134_buf, vb2);
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
+       struct saa7134_buf *buf = container_of(vbuf, struct saa7134_buf, vb2);
 
        saa7134_buffer_queue(dev, dmaq, buf);
 }
@@ -953,10 +956,12 @@ int saa7134_vb2_start_streaming(struct vb2_queue *vq, unsigned int count)
 
                list_for_each_entry_safe(buf, tmp, &dmaq->queue, entry) {
                        list_del(&buf->entry);
-                       vb2_buffer_done(&buf->vb2, VB2_BUF_STATE_QUEUED);
+                       vb2_buffer_done(&buf->vb2.vb2_buf,
+                                       VB2_BUF_STATE_QUEUED);
                }
                if (dmaq->curr) {
-                       vb2_buffer_done(&dmaq->curr->vb2, VB2_BUF_STATE_QUEUED);
+                       vb2_buffer_done(&dmaq->curr->vb2.vb2_buf,
+                                       VB2_BUF_STATE_QUEUED);
                        dmaq->curr = NULL;
                }
                return -EBUSY;
index 14c2b4e0ee400c9048ae0929a11039dbd99713cf..fea0514dfa4a814ab78ca80c20e5b1362eeeeec7 100644 (file)
@@ -460,7 +460,7 @@ struct saa7134_thread {
 /* buffer for one video/vbi/ts frame */
 struct saa7134_buf {
        /* common v4l buffer stuff -- must be first */
-       struct vb2_buffer vb2;
+       struct vb2_v4l2_buffer vb2;
 
        /* saa7134 specific */
        unsigned int            top_seen;
index 53fff5425c13817e1242f08dbf2f6365c2c8de48..78ac3fe22b45240b3104bc0ddab05f026ec3d53a 100644 (file)
@@ -458,11 +458,12 @@ static inline u32 vop_usec(const vop_header *vh)
 static int solo_fill_jpeg(struct solo_enc_dev *solo_enc,
                          struct vb2_buffer *vb, const vop_header *vh)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct solo_dev *solo_dev = solo_enc->solo_dev;
-       struct sg_table *vbuf = vb2_dma_sg_plane_desc(vb, 0);
+       struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
        int frame_size;
 
-       vb->v4l2_buf.flags |= V4L2_BUF_FLAG_KEYFRAME;
+       vbuf->flags |= V4L2_BUF_FLAG_KEYFRAME;
 
        if (vb2_plane_size(vb, 0) < vop_jpeg_size(vh) + solo_enc->jpeg_len)
                return -EIO;
@@ -470,7 +471,7 @@ static int solo_fill_jpeg(struct solo_enc_dev *solo_enc,
        frame_size = ALIGN(vop_jpeg_size(vh) + solo_enc->jpeg_len, DMA_ALIGN);
        vb2_set_plane_payload(vb, 0, vop_jpeg_size(vh) + solo_enc->jpeg_len);
 
-       return solo_send_desc(solo_enc, solo_enc->jpeg_len, vbuf,
+       return solo_send_desc(solo_enc, solo_enc->jpeg_len, sgt,
                             vop_jpeg_offset(vh) - SOLO_JPEG_EXT_ADDR(solo_dev),
                             frame_size, SOLO_JPEG_EXT_ADDR(solo_dev),
                             SOLO_JPEG_EXT_SIZE(solo_dev));
@@ -479,8 +480,9 @@ static int solo_fill_jpeg(struct solo_enc_dev *solo_enc,
 static int solo_fill_mpeg(struct solo_enc_dev *solo_enc,
                struct vb2_buffer *vb, const vop_header *vh)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct solo_dev *solo_dev = solo_enc->solo_dev;
-       struct sg_table *vbuf = vb2_dma_sg_plane_desc(vb, 0);
+       struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
        int frame_off, frame_size;
        int skip = 0;
 
@@ -488,15 +490,15 @@ static int solo_fill_mpeg(struct solo_enc_dev *solo_enc,
                return -EIO;
 
        /* If this is a key frame, add extra header */
-       vb->v4l2_buf.flags &= ~(V4L2_BUF_FLAG_KEYFRAME | V4L2_BUF_FLAG_PFRAME |
+       vbuf->flags &= ~(V4L2_BUF_FLAG_KEYFRAME | V4L2_BUF_FLAG_PFRAME |
                V4L2_BUF_FLAG_BFRAME);
        if (!vop_type(vh)) {
                skip = solo_enc->vop_len;
-               vb->v4l2_buf.flags |= V4L2_BUF_FLAG_KEYFRAME;
+               vbuf->flags |= V4L2_BUF_FLAG_KEYFRAME;
                vb2_set_plane_payload(vb, 0, vop_mpeg_size(vh) +
                        solo_enc->vop_len);
        } else {
-               vb->v4l2_buf.flags |= V4L2_BUF_FLAG_PFRAME;
+               vbuf->flags |= V4L2_BUF_FLAG_PFRAME;
                vb2_set_plane_payload(vb, 0, vop_mpeg_size(vh));
        }
 
@@ -505,7 +507,7 @@ static int solo_fill_mpeg(struct solo_enc_dev *solo_enc,
                sizeof(*vh)) % SOLO_MP4E_EXT_SIZE(solo_dev);
        frame_size = ALIGN(vop_mpeg_size(vh) + skip, DMA_ALIGN);
 
-       return solo_send_desc(solo_enc, skip, vbuf, frame_off, frame_size,
+       return solo_send_desc(solo_enc, skip, sgt, frame_off, frame_size,
                        SOLO_MP4E_EXT_ADDR(solo_dev),
                        SOLO_MP4E_EXT_SIZE(solo_dev));
 }
@@ -513,6 +515,7 @@ static int solo_fill_mpeg(struct solo_enc_dev *solo_enc,
 static int solo_enc_fillbuf(struct solo_enc_dev *solo_enc,
                            struct vb2_buffer *vb, struct solo_enc_buf *enc_buf)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        const vop_header *vh = enc_buf->vh;
        int ret;
 
@@ -527,17 +530,18 @@ static int solo_enc_fillbuf(struct solo_enc_dev *solo_enc,
        }
 
        if (!ret) {
-               vb->v4l2_buf.sequence = solo_enc->sequence++;
-               vb->v4l2_buf.timestamp.tv_sec = vop_sec(vh);
-               vb->v4l2_buf.timestamp.tv_usec = vop_usec(vh);
+               vbuf->sequence = solo_enc->sequence++;
+               vbuf->timestamp.tv_sec = vop_sec(vh);
+               vbuf->timestamp.tv_usec = vop_usec(vh);
 
                /* Check for motion flags */
                if (solo_is_motion_on(solo_enc) && enc_buf->motion) {
                        struct v4l2_event ev = {
                                .type = V4L2_EVENT_MOTION_DET,
                                .u.motion_det = {
-                                       .flags = V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ,
-                                       .frame_sequence = vb->v4l2_buf.sequence,
+                                       .flags
+                                       = V4L2_EVENT_MD_FL_HAVE_FRAME_SEQ,
+                                       .frame_sequence = vbuf->sequence,
                                        .region_mask = enc_buf->motion ? 1 : 0,
                                },
                        };
@@ -571,7 +575,7 @@ static void solo_enc_handle_one(struct solo_enc_dev *solo_enc,
        list_del(&vb->list);
        spin_unlock_irqrestore(&solo_enc->av_lock, flags);
 
-       solo_enc_fillbuf(solo_enc, &vb->vb, enc_buf);
+       solo_enc_fillbuf(solo_enc, &vb->vb.vb2_buf, enc_buf);
 unlock:
        mutex_unlock(&solo_enc->lock);
 }
@@ -678,10 +682,11 @@ static int solo_enc_queue_setup(struct vb2_queue *q,
 
 static void solo_enc_buf_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct vb2_queue *vq = vb->vb2_queue;
        struct solo_enc_dev *solo_enc = vb2_get_drv_priv(vq);
        struct solo_vb2_buf *solo_vb =
-               container_of(vb, struct solo_vb2_buf, vb);
+               container_of(vbuf, struct solo_vb2_buf, vb);
 
        spin_lock(&solo_enc->av_lock);
        list_add_tail(&solo_vb->list, &solo_enc->vidq_active);
@@ -734,25 +739,26 @@ static void solo_enc_stop_streaming(struct vb2_queue *q)
                                struct solo_vb2_buf, list);
 
                list_del(&buf->list);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
        }
        spin_unlock_irqrestore(&solo_enc->av_lock, flags);
 }
 
 static void solo_enc_buf_finish(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct solo_enc_dev *solo_enc = vb2_get_drv_priv(vb->vb2_queue);
-       struct sg_table *vbuf = vb2_dma_sg_plane_desc(vb, 0);
+       struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0);
 
        switch (solo_enc->fmt) {
        case V4L2_PIX_FMT_MPEG4:
        case V4L2_PIX_FMT_H264:
-               if (vb->v4l2_buf.flags & V4L2_BUF_FLAG_KEYFRAME)
-                       sg_copy_from_buffer(vbuf->sgl, vbuf->nents,
+               if (vbuf->flags & V4L2_BUF_FLAG_KEYFRAME)
+                       sg_copy_from_buffer(sgt->sgl, sgt->nents,
                                        solo_enc->vop, solo_enc->vop_len);
                break;
        default: /* V4L2_PIX_FMT_MJPEG */
-               sg_copy_from_buffer(vbuf->sgl, vbuf->nents,
+               sg_copy_from_buffer(sgt->sgl, sgt->nents,
                                solo_enc->jpeg_header, solo_enc->jpeg_len);
                break;
        }
index 63ae8a61f6030d20fe2d67aad87f2cd0583d0942..57d0d9cf190ed8c07cb58b7b8a7648c8bc71a4c0 100644 (file)
@@ -26,6 +26,7 @@
 #include <media/v4l2-ioctl.h>
 #include <media/v4l2-common.h>
 #include <media/v4l2-event.h>
+#include <media/videobuf2-v4l2.h>
 #include <media/videobuf2-dma-contig.h>
 
 #include "solo6x10.h"
@@ -191,13 +192,14 @@ static int solo_v4l2_set_ch(struct solo_dev *solo_dev, u8 ch)
 static void solo_fillbuf(struct solo_dev *solo_dev,
                         struct vb2_buffer *vb)
 {
-       dma_addr_t vbuf;
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
+       dma_addr_t addr;
        unsigned int fdma_addr;
        int error = -1;
        int i;
 
-       vbuf = vb2_dma_contig_plane_dma_addr(vb, 0);
-       if (!vbuf)
+       addr = vb2_dma_contig_plane_dma_addr(vb, 0);
+       if (!addr)
                goto finish_buf;
 
        if (erase_off(solo_dev)) {
@@ -213,7 +215,7 @@ static void solo_fillbuf(struct solo_dev *solo_dev,
                fdma_addr = SOLO_DISP_EXT_ADDR + (solo_dev->old_write *
                                (SOLO_HW_BPL * solo_vlines(solo_dev)));
 
-               error = solo_p2m_dma_t(solo_dev, 0, vbuf, fdma_addr,
+               error = solo_p2m_dma_t(solo_dev, 0, addr, fdma_addr,
                                       solo_bytesperline(solo_dev),
                                       solo_vlines(solo_dev), SOLO_HW_BPL);
        }
@@ -222,8 +224,8 @@ finish_buf:
        if (!error) {
                vb2_set_plane_payload(vb, 0,
                        solo_vlines(solo_dev) * solo_bytesperline(solo_dev));
-               vb->v4l2_buf.sequence = solo_dev->sequence++;
-               v4l2_get_timestamp(&vb->v4l2_buf.timestamp);
+               vbuf->sequence = solo_dev->sequence++;
+               v4l2_get_timestamp(&vbuf->timestamp);
        }
 
        vb2_buffer_done(vb, error ? VB2_BUF_STATE_ERROR : VB2_BUF_STATE_DONE);
@@ -256,7 +258,7 @@ static void solo_thread_try(struct solo_dev *solo_dev)
 
                spin_unlock(&solo_dev->slock);
 
-               solo_fillbuf(solo_dev, &vb->vb);
+               solo_fillbuf(solo_dev, &vb->vb.vb2_buf);
        }
 
        assert_spin_locked(&solo_dev->slock);
@@ -345,10 +347,11 @@ static void solo_stop_streaming(struct vb2_queue *q)
 
 static void solo_buf_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct vb2_queue *vq = vb->vb2_queue;
        struct solo_dev *solo_dev = vb2_get_drv_priv(vq);
        struct solo_vb2_buf *solo_vb =
-               container_of(vb, struct solo_vb2_buf, vb);
+               container_of(vbuf, struct solo_vb2_buf, vb);
 
        spin_lock(&solo_dev->slock);
        list_add_tail(&solo_vb->list, &solo_dev->vidq_active);
index 5cc9e9dc61e479dd7e3acd8e90e8a1f06e326378..4ab6586c0467529ea145452f2e534f30edeb2a73 100644 (file)
@@ -135,7 +135,7 @@ struct solo_p2m_dev {
 #define OSD_TEXT_MAX           44
 
 struct solo_vb2_buf {
-       struct vb2_buffer vb;
+       struct vb2_v4l2_buffer vb;
        struct list_head list;
 };
 
index 59b3a36a3639d86167736b224b8aae88d57c4e09..fc99f33d65e943225ee2aaa075ebb36ddcb0755e 100644 (file)
 
 
 struct vip_buffer {
-       struct vb2_buffer       vb;
+       struct vb2_v4l2_buffer vb;
        struct list_head        list;
        dma_addr_t              dma;
 };
-static inline struct vip_buffer *to_vip_buffer(struct vb2_buffer *vb2)
+static inline struct vip_buffer *to_vip_buffer(struct vb2_v4l2_buffer *vb2)
 {
        return container_of(vb2, struct vip_buffer, vb);
 }
@@ -287,7 +287,8 @@ static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt,
 };
 static int buffer_init(struct vb2_buffer *vb)
 {
-       struct vip_buffer *vip_buf = to_vip_buffer(vb);
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
+       struct vip_buffer *vip_buf = to_vip_buffer(vbuf);
 
        vip_buf->dma = vb2_dma_contig_plane_dma_addr(vb, 0);
        INIT_LIST_HEAD(&vip_buf->list);
@@ -296,8 +297,9 @@ static int buffer_init(struct vb2_buffer *vb)
 
 static int buffer_prepare(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct sta2x11_vip *vip = vb2_get_drv_priv(vb->vb2_queue);
-       struct vip_buffer *vip_buf = to_vip_buffer(vb);
+       struct vip_buffer *vip_buf = to_vip_buffer(vbuf);
        unsigned long size;
 
        size = vip->format.sizeimage;
@@ -307,14 +309,15 @@ static int buffer_prepare(struct vb2_buffer *vb)
                return -EINVAL;
        }
 
-       vb2_set_plane_payload(&vip_buf->vb, 0, size);
+       vb2_set_plane_payload(&vip_buf->vb.vb2_buf, 0, size);
 
        return 0;
 }
 static void buffer_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct sta2x11_vip *vip = vb2_get_drv_priv(vb->vb2_queue);
-       struct vip_buffer *vip_buf = to_vip_buffer(vb);
+       struct vip_buffer *vip_buf = to_vip_buffer(vbuf);
 
        spin_lock(&vip->lock);
        list_add_tail(&vip_buf->list, &vip->buffer_list);
@@ -329,8 +332,9 @@ static void buffer_queue(struct vb2_buffer *vb)
 }
 static void buffer_finish(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct sta2x11_vip *vip = vb2_get_drv_priv(vb->vb2_queue);
-       struct vip_buffer *vip_buf = to_vip_buffer(vb);
+       struct vip_buffer *vip_buf = to_vip_buffer(vbuf);
 
        /* Buffer handled, remove it from the list */
        spin_lock(&vip->lock);
@@ -370,7 +374,7 @@ static void stop_streaming(struct vb2_queue *vq)
        /* Release all active buffers */
        spin_lock(&vip->lock);
        list_for_each_entry_safe(vip_buf, node, &vip->buffer_list, list) {
-               vb2_buffer_done(&vip_buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&vip_buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
                list_del(&vip_buf->list);
        }
        spin_unlock(&vip->lock);
@@ -813,9 +817,9 @@ static irqreturn_t vip_irq(int irq, struct sta2x11_vip *vip)
                /* Disable acquisition */
                reg_write(vip, DVP_CTL, reg_read(vip, DVP_CTL) & ~DVP_CTL_ENA);
                /* Remove the active buffer from the list */
-               v4l2_get_timestamp(&vip->active->vb.v4l2_buf.timestamp);
-               vip->active->vb.v4l2_buf.sequence = vip->sequence++;
-               vb2_buffer_done(&vip->active->vb, VB2_BUF_STATE_DONE);
+               v4l2_get_timestamp(&vip->active->vb.timestamp);
+               vip->active->vb.sequence = vip->sequence++;
+               vb2_buffer_done(&vip->active->vb.vb2_buf, VB2_BUF_STATE_DONE);
        }
 
        return IRQ_HANDLED;
index 8355e55b4e8ed75fa94d0f087f5908b95e78e12c..323721439b8e82a91de70cba81a9b9023763d618 100644 (file)
@@ -423,9 +423,10 @@ static int tw68_queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
  */
 static void tw68_buf_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct vb2_queue *vq = vb->vb2_queue;
        struct tw68_dev *dev = vb2_get_drv_priv(vq);
-       struct tw68_buf *buf = container_of(vb, struct tw68_buf, vb);
+       struct tw68_buf *buf = container_of(vbuf, struct tw68_buf, vb);
        struct tw68_buf *prev;
        unsigned long flags;
 
@@ -457,9 +458,10 @@ static void tw68_buf_queue(struct vb2_buffer *vb)
  */
 static int tw68_buf_prepare(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct vb2_queue *vq = vb->vb2_queue;
        struct tw68_dev *dev = vb2_get_drv_priv(vq);
-       struct tw68_buf *buf = container_of(vb, struct tw68_buf, vb);
+       struct tw68_buf *buf = container_of(vbuf, struct tw68_buf, vb);
        struct sg_table *dma = vb2_dma_sg_plane_desc(vb, 0);
        unsigned size, bpl;
 
@@ -499,9 +501,10 @@ static int tw68_buf_prepare(struct vb2_buffer *vb)
 
 static void tw68_buf_finish(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct vb2_queue *vq = vb->vb2_queue;
        struct tw68_dev *dev = vb2_get_drv_priv(vq);
-       struct tw68_buf *buf = container_of(vb, struct tw68_buf, vb);
+       struct tw68_buf *buf = container_of(vbuf, struct tw68_buf, vb);
 
        pci_free_consistent(dev->pci, buf->size, buf->cpu, buf->dma);
 }
@@ -528,7 +531,7 @@ static void tw68_stop_streaming(struct vb2_queue *q)
                        container_of(dev->active.next, struct tw68_buf, list);
 
                list_del(&buf->list);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
        }
 }
 
@@ -1012,10 +1015,10 @@ void tw68_irq_video_done(struct tw68_dev *dev, unsigned long status)
                buf = list_entry(dev->active.next, struct tw68_buf, list);
                list_del(&buf->list);
                spin_unlock(&dev->slock);
-               v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp);
-               buf->vb.v4l2_buf.field = dev->field;
-               buf->vb.v4l2_buf.sequence = dev->seqnr++;
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE);
+               v4l2_get_timestamp(&buf->vb.timestamp);
+               buf->vb.field = dev->field;
+               buf->vb.sequence = dev->seqnr++;
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
                status &= ~(TW68_DMAPI);
                if (0 == status)
                        return;
index ef51e4d4886633f24e6ef9d472d684a63e6a079a..6c7dcb300f345ee525715e6ef56cc14162068440 100644 (file)
@@ -36,6 +36,7 @@
 #include <media/v4l2-ioctl.h>
 #include <media/v4l2-ctrls.h>
 #include <media/v4l2-device.h>
+#include <media/videobuf2-v4l2.h>
 #include <media/videobuf2-dma-sg.h>
 
 #include "tw68-reg.h"
@@ -118,7 +119,7 @@ struct tw68_dev;    /* forward delclaration */
 
 /* buffer for one video/vbi/ts frame */
 struct tw68_buf {
-       struct vb2_buffer vb;
+       struct vb2_v4l2_buffer vb;
        struct list_head list;
 
        unsigned int   size;
index c8447fa3fd91b4051ef7f47e03cb854d9f239028..488d2754c27cf065d514aae864ea27ba37f0d821 100644 (file)
@@ -307,7 +307,8 @@ static inline struct vpfe_device *to_vpfe(struct vpfe_ccdc *ccdc)
        return container_of(ccdc, struct vpfe_device, ccdc);
 }
 
-static inline struct vpfe_cap_buffer *to_vpfe_buffer(struct vb2_buffer *vb)
+static inline
+struct vpfe_cap_buffer *to_vpfe_buffer(struct vb2_v4l2_buffer *vb)
 {
        return container_of(vb, struct vpfe_cap_buffer, vb);
 }
@@ -1257,14 +1258,14 @@ static inline void vpfe_schedule_next_buffer(struct vpfe_device *vpfe)
        list_del(&vpfe->next_frm->list);
 
        vpfe_set_sdr_addr(&vpfe->ccdc,
-                      vb2_dma_contig_plane_dma_addr(&vpfe->next_frm->vb, 0));
+              vb2_dma_contig_plane_dma_addr(&vpfe->next_frm->vb.vb2_buf, 0));
 }
 
 static inline void vpfe_schedule_bottom_field(struct vpfe_device *vpfe)
 {
        unsigned long addr;
 
-       addr = vb2_dma_contig_plane_dma_addr(&vpfe->next_frm->vb, 0) +
+       addr = vb2_dma_contig_plane_dma_addr(&vpfe->next_frm->vb.vb2_buf, 0) +
                                        vpfe->field_off;
 
        vpfe_set_sdr_addr(&vpfe->ccdc, addr);
@@ -1280,10 +1281,10 @@ static inline void vpfe_schedule_bottom_field(struct vpfe_device *vpfe)
  */
 static inline void vpfe_process_buffer_complete(struct vpfe_device *vpfe)
 {
-       v4l2_get_timestamp(&vpfe->cur_frm->vb.v4l2_buf.timestamp);
-       vpfe->cur_frm->vb.v4l2_buf.field = vpfe->fmt.fmt.pix.field;
-       vpfe->cur_frm->vb.v4l2_buf.sequence = vpfe->sequence++;
-       vb2_buffer_done(&vpfe->cur_frm->vb, VB2_BUF_STATE_DONE);
+       v4l2_get_timestamp(&vpfe->cur_frm->vb.timestamp);
+       vpfe->cur_frm->vb.field = vpfe->fmt.fmt.pix.field;
+       vpfe->cur_frm->vb.sequence = vpfe->sequence++;
+       vb2_buffer_done(&vpfe->cur_frm->vb.vb2_buf, VB2_BUF_STATE_DONE);
        vpfe->cur_frm = vpfe->next_frm;
 }
 
@@ -1942,6 +1943,7 @@ static int vpfe_queue_setup(struct vb2_queue *vq,
  */
 static int vpfe_buffer_prepare(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct vpfe_device *vpfe = vb2_get_drv_priv(vb->vb2_queue);
 
        vb2_set_plane_payload(vb, 0, vpfe->fmt.fmt.pix.sizeimage);
@@ -1949,7 +1951,7 @@ static int vpfe_buffer_prepare(struct vb2_buffer *vb)
        if (vb2_get_plane_payload(vb, 0) > vb2_plane_size(vb, 0))
                return -EINVAL;
 
-       vb->v4l2_buf.field = vpfe->fmt.fmt.pix.field;
+       vbuf->field = vpfe->fmt.fmt.pix.field;
 
        return 0;
 }
@@ -1960,8 +1962,9 @@ static int vpfe_buffer_prepare(struct vb2_buffer *vb)
  */
 static void vpfe_buffer_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct vpfe_device *vpfe = vb2_get_drv_priv(vb->vb2_queue);
-       struct vpfe_cap_buffer *buf = to_vpfe_buffer(vb);
+       struct vpfe_cap_buffer *buf = to_vpfe_buffer(vbuf);
        unsigned long flags = 0;
 
        /* add the buffer to the DMA queue */
@@ -2006,7 +2009,7 @@ static int vpfe_start_streaming(struct vb2_queue *vq, unsigned int count)
        list_del(&vpfe->cur_frm->list);
        spin_unlock_irqrestore(&vpfe->dma_queue_lock, flags);
 
-       addr = vb2_dma_contig_plane_dma_addr(&vpfe->cur_frm->vb, 0);
+       addr = vb2_dma_contig_plane_dma_addr(&vpfe->cur_frm->vb.vb2_buf, 0);
 
        vpfe_set_sdr_addr(&vpfe->ccdc, (unsigned long)(addr));
 
@@ -2023,7 +2026,7 @@ static int vpfe_start_streaming(struct vb2_queue *vq, unsigned int count)
 err:
        list_for_each_entry_safe(buf, tmp, &vpfe->dma_queue, list) {
                list_del(&buf->list);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_QUEUED);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_QUEUED);
        }
 
        return ret;
@@ -2055,13 +2058,14 @@ static void vpfe_stop_streaming(struct vb2_queue *vq)
        /* release all active buffers */
        spin_lock_irqsave(&vpfe->dma_queue_lock, flags);
        if (vpfe->cur_frm == vpfe->next_frm) {
-               vb2_buffer_done(&vpfe->cur_frm->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&vpfe->cur_frm->vb.vb2_buf,
+                               VB2_BUF_STATE_ERROR);
        } else {
                if (vpfe->cur_frm != NULL)
-                       vb2_buffer_done(&vpfe->cur_frm->vb,
+                       vb2_buffer_done(&vpfe->cur_frm->vb.vb2_buf,
                                        VB2_BUF_STATE_ERROR);
                if (vpfe->next_frm != NULL)
-                       vb2_buffer_done(&vpfe->next_frm->vb,
+                       vb2_buffer_done(&vpfe->next_frm->vb.vb2_buf,
                                        VB2_BUF_STATE_ERROR);
        }
 
@@ -2069,7 +2073,8 @@ static void vpfe_stop_streaming(struct vb2_queue *vq)
                vpfe->next_frm = list_entry(vpfe->dma_queue.next,
                                                struct vpfe_cap_buffer, list);
                list_del(&vpfe->next_frm->list);
-               vb2_buffer_done(&vpfe->next_frm->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&vpfe->next_frm->vb.vb2_buf,
+                               VB2_BUF_STATE_ERROR);
        }
        spin_unlock_irqrestore(&vpfe->dma_queue_lock, flags);
 }
index 5bfb35649a39b92494dfd35594fc9cb824a43c98..777bf97fea572067da979c812d79ecbcde0d83b6 100644 (file)
@@ -31,6 +31,7 @@
 #include <media/v4l2-dev.h>
 #include <media/v4l2-device.h>
 #include <media/v4l2-ioctl.h>
+#include <media/videobuf2-v4l2.h>
 #include <media/videobuf2-dma-contig.h>
 
 #include "am437x-vpfe_regs.h"
@@ -104,7 +105,7 @@ struct vpfe_config {
 };
 
 struct vpfe_cap_buffer {
-       struct vb2_buffer vb;
+       struct vb2_v4l2_buffer vb;
        struct list_head list;
 };
 
index b7e70fb05eb81e3808d2dc819475f884f9415050..db059eb0ff197f712a9f15b094aa28a3b870f9fa 100644 (file)
@@ -54,7 +54,7 @@ struct bcap_format {
 };
 
 struct bcap_buffer {
-       struct vb2_buffer vb;
+       struct vb2_v4l2_buffer vb;
        struct list_head list;
 };
 
@@ -149,7 +149,7 @@ static const struct bcap_format bcap_formats[] = {
 
 static irqreturn_t bcap_isr(int irq, void *dev_id);
 
-static struct bcap_buffer *to_bcap_vb(struct vb2_buffer *vb)
+static struct bcap_buffer *to_bcap_vb(struct vb2_v4l2_buffer *vb)
 {
        return container_of(vb, struct bcap_buffer, vb);
 }
@@ -223,6 +223,7 @@ static int bcap_queue_setup(struct vb2_queue *vq,
 
 static int bcap_buffer_prepare(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct bcap_device *bcap_dev = vb2_get_drv_priv(vb->vb2_queue);
        unsigned long size = bcap_dev->fmt.sizeimage;
 
@@ -233,15 +234,16 @@ static int bcap_buffer_prepare(struct vb2_buffer *vb)
        }
        vb2_set_plane_payload(vb, 0, size);
 
-       vb->v4l2_buf.field = bcap_dev->fmt.field;
+       vbuf->field = bcap_dev->fmt.field;
 
        return 0;
 }
 
 static void bcap_buffer_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct bcap_device *bcap_dev = vb2_get_drv_priv(vb->vb2_queue);
-       struct bcap_buffer *buf = to_bcap_vb(vb);
+       struct bcap_buffer *buf = to_bcap_vb(vbuf);
        unsigned long flags;
 
        spin_lock_irqsave(&bcap_dev->lock, flags);
@@ -251,8 +253,9 @@ static void bcap_buffer_queue(struct vb2_buffer *vb)
 
 static void bcap_buffer_cleanup(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct bcap_device *bcap_dev = vb2_get_drv_priv(vb->vb2_queue);
-       struct bcap_buffer *buf = to_bcap_vb(vb);
+       struct bcap_buffer *buf = to_bcap_vb(vbuf);
        unsigned long flags;
 
        spin_lock_irqsave(&bcap_dev->lock, flags);
@@ -333,7 +336,8 @@ static int bcap_start_streaming(struct vb2_queue *vq, unsigned int count)
                                        struct bcap_buffer, list);
        /* remove buffer from the dma queue */
        list_del_init(&bcap_dev->cur_frm->list);
-       addr = vb2_dma_contig_plane_dma_addr(&bcap_dev->cur_frm->vb, 0);
+       addr = vb2_dma_contig_plane_dma_addr(&bcap_dev->cur_frm->vb.vb2_buf,
+                                               0);
        /* update DMA address */
        ppi->ops->update_addr(ppi, (unsigned long)addr);
        /* enable ppi */
@@ -344,7 +348,7 @@ static int bcap_start_streaming(struct vb2_queue *vq, unsigned int count)
 err:
        list_for_each_entry_safe(buf, tmp, &bcap_dev->dma_queue, list) {
                list_del(&buf->list);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_QUEUED);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_QUEUED);
        }
 
        return ret;
@@ -367,13 +371,15 @@ static void bcap_stop_streaming(struct vb2_queue *vq)
 
        /* release all active buffers */
        if (bcap_dev->cur_frm)
-               vb2_buffer_done(&bcap_dev->cur_frm->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&bcap_dev->cur_frm->vb.vb2_buf,
+                               VB2_BUF_STATE_ERROR);
 
        while (!list_empty(&bcap_dev->dma_queue)) {
                bcap_dev->cur_frm = list_entry(bcap_dev->dma_queue.next,
                                                struct bcap_buffer, list);
                list_del_init(&bcap_dev->cur_frm->list);
-               vb2_buffer_done(&bcap_dev->cur_frm->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&bcap_dev->cur_frm->vb.vb2_buf,
+                               VB2_BUF_STATE_ERROR);
        }
 }
 
@@ -392,18 +398,19 @@ static irqreturn_t bcap_isr(int irq, void *dev_id)
 {
        struct ppi_if *ppi = dev_id;
        struct bcap_device *bcap_dev = ppi->priv;
-       struct vb2_buffer *vb = &bcap_dev->cur_frm->vb;
+       struct vb2_v4l2_buffer *vbuf = &bcap_dev->cur_frm->vb;
+       struct vb2_buffer *vb = &vbuf->vb2_buf;
        dma_addr_t addr;
 
        spin_lock(&bcap_dev->lock);
 
        if (!list_empty(&bcap_dev->dma_queue)) {
-               v4l2_get_timestamp(&vb->v4l2_buf.timestamp);
+               v4l2_get_timestamp(&vbuf->timestamp);
                if (ppi->err) {
                        vb2_buffer_done(vb, VB2_BUF_STATE_ERROR);
                        ppi->err = false;
                } else {
-                       vb->v4l2_buf.sequence = bcap_dev->sequence++;
+                       vbuf->sequence = bcap_dev->sequence++;
                        vb2_buffer_done(vb, VB2_BUF_STATE_DONE);
                }
                bcap_dev->cur_frm = list_entry(bcap_dev->dma_queue.next,
@@ -420,7 +427,8 @@ static irqreturn_t bcap_isr(int irq, void *dev_id)
        if (bcap_dev->stop) {
                complete(&bcap_dev->comp);
        } else {
-               addr = vb2_dma_contig_plane_dma_addr(&bcap_dev->cur_frm->vb, 0);
+               addr = vb2_dma_contig_plane_dma_addr(
+                               &bcap_dev->cur_frm->vb.vb2_buf, 0);
                ppi->ops->update_addr(ppi, (unsigned long)addr);
                ppi->ops->start(ppi);
        }
index cd41d49b206ddff2e8aedfc63d6cf225132cda13..654e964f84a2f4eac941a204b03de0ace256b2f4 100644 (file)
@@ -179,31 +179,32 @@ static void coda_kfifo_sync_to_device_write(struct coda_ctx *ctx)
 }
 
 static int coda_bitstream_queue(struct coda_ctx *ctx,
-                               struct vb2_buffer *src_buf)
+                               struct vb2_v4l2_buffer *src_buf)
 {
-       u32 src_size = vb2_get_plane_payload(src_buf, 0);
+       u32 src_size = vb2_get_plane_payload(&src_buf->vb2_buf, 0);
        u32 n;
 
-       n = kfifo_in(&ctx->bitstream_fifo, vb2_plane_vaddr(src_buf, 0),
-                    src_size);
+       n = kfifo_in(&ctx->bitstream_fifo,
+                       vb2_plane_vaddr(&src_buf->vb2_buf, 0), src_size);
        if (n < src_size)
                return -ENOSPC;
 
-       src_buf->v4l2_buf.sequence = ctx->qsequence++;
+       src_buf->sequence = ctx->qsequence++;
 
        return 0;
 }
 
 static bool coda_bitstream_try_queue(struct coda_ctx *ctx,
-                                    struct vb2_buffer *src_buf)
+                                    struct vb2_v4l2_buffer *src_buf)
 {
        int ret;
 
        if (coda_get_bitstream_payload(ctx) +
-           vb2_get_plane_payload(src_buf, 0) + 512 >= ctx->bitstream.size)
+           vb2_get_plane_payload(&src_buf->vb2_buf, 0) + 512 >=
+           ctx->bitstream.size)
                return false;
 
-       if (vb2_plane_vaddr(src_buf, 0) == NULL) {
+       if (vb2_plane_vaddr(&src_buf->vb2_buf, 0) == NULL) {
                v4l2_err(&ctx->dev->v4l2_dev, "trying to queue empty buffer\n");
                return true;
        }
@@ -224,7 +225,7 @@ static bool coda_bitstream_try_queue(struct coda_ctx *ctx,
 
 void coda_fill_bitstream(struct coda_ctx *ctx, bool streaming)
 {
-       struct vb2_buffer *src_buf;
+       struct vb2_v4l2_buffer *src_buf;
        struct coda_buffer_meta *meta;
        unsigned long flags;
        u32 start;
@@ -257,7 +258,7 @@ void coda_fill_bitstream(struct coda_ctx *ctx, bool streaming)
                }
 
                /* Dump empty buffers */
-               if (!vb2_get_plane_payload(src_buf, 0)) {
+               if (!vb2_get_plane_payload(&src_buf->vb2_buf, 0)) {
                        src_buf = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx);
                        v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_DONE);
                        continue;
@@ -276,9 +277,9 @@ void coda_fill_bitstream(struct coda_ctx *ctx, bool streaming)
 
                        meta = kmalloc(sizeof(*meta), GFP_KERNEL);
                        if (meta) {
-                               meta->sequence = src_buf->v4l2_buf.sequence;
-                               meta->timecode = src_buf->v4l2_buf.timecode;
-                               meta->timestamp = src_buf->v4l2_buf.timestamp;
+                               meta->sequence = src_buf->sequence;
+                               meta->timecode = src_buf->timecode;
+                               meta->timestamp = src_buf->timestamp;
                                meta->start = start;
                                meta->end = ctx->bitstream_fifo.kfifo.in &
                                            ctx->bitstream_fifo.kfifo.mask;
@@ -483,20 +484,21 @@ err:
        return ret;
 }
 
-static int coda_encode_header(struct coda_ctx *ctx, struct vb2_buffer *buf,
+static int coda_encode_header(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf,
                              int header_code, u8 *header, int *size)
 {
+       struct vb2_buffer *vb = &buf->vb2_buf;
        struct coda_dev *dev = ctx->dev;
        size_t bufsize;
        int ret;
        int i;
 
        if (dev->devtype->product == CODA_960)
-               memset(vb2_plane_vaddr(buf, 0), 0, 64);
+               memset(vb2_plane_vaddr(vb, 0), 0, 64);
 
-       coda_write(dev, vb2_dma_contig_plane_dma_addr(buf, 0),
+       coda_write(dev, vb2_dma_contig_plane_dma_addr(vb, 0),
                   CODA_CMD_ENC_HEADER_BB_START);
-       bufsize = vb2_plane_size(buf, 0);
+       bufsize = vb2_plane_size(vb, 0);
        if (dev->devtype->product == CODA_960)
                bufsize /= 1024;
        coda_write(dev, bufsize, CODA_CMD_ENC_HEADER_BB_SIZE);
@@ -509,14 +511,14 @@ static int coda_encode_header(struct coda_ctx *ctx, struct vb2_buffer *buf,
 
        if (dev->devtype->product == CODA_960) {
                for (i = 63; i > 0; i--)
-                       if (((char *)vb2_plane_vaddr(buf, 0))[i] != 0)
+                       if (((char *)vb2_plane_vaddr(vb, 0))[i] != 0)
                                break;
                *size = i + 1;
        } else {
                *size = coda_read(dev, CODA_REG_BIT_WR_PTR(ctx->reg_idx)) -
                        coda_read(dev, CODA_CMD_ENC_HEADER_BB_START);
        }
-       memcpy(header, vb2_plane_vaddr(buf, 0), *size);
+       memcpy(header, vb2_plane_vaddr(vb, 0), *size);
 
        return 0;
 }
@@ -799,7 +801,7 @@ static int coda_start_encoding(struct coda_ctx *ctx)
        struct v4l2_device *v4l2_dev = &dev->v4l2_dev;
        struct coda_q_data *q_data_src, *q_data_dst;
        u32 bitstream_buf, bitstream_size;
-       struct vb2_buffer *buf;
+       struct vb2_v4l2_buffer *buf;
        int gamma, ret, value;
        u32 dst_fourcc;
        int num_fb;
@@ -810,7 +812,7 @@ static int coda_start_encoding(struct coda_ctx *ctx)
        dst_fourcc = q_data_dst->fourcc;
 
        buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx);
-       bitstream_buf = vb2_dma_contig_plane_dma_addr(buf, 0);
+       bitstream_buf = vb2_dma_contig_plane_dma_addr(&buf->vb2_buf, 0);
        bitstream_size = q_data_dst->sizeimage;
 
        if (!coda_is_initialized(dev)) {
@@ -1185,7 +1187,7 @@ out:
 static int coda_prepare_encode(struct coda_ctx *ctx)
 {
        struct coda_q_data *q_data_src, *q_data_dst;
-       struct vb2_buffer *src_buf, *dst_buf;
+       struct vb2_v4l2_buffer *src_buf, *dst_buf;
        struct coda_dev *dev = ctx->dev;
        int force_ipicture;
        int quant_param = 0;
@@ -1200,8 +1202,8 @@ static int coda_prepare_encode(struct coda_ctx *ctx)
        q_data_dst = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
        dst_fourcc = q_data_dst->fourcc;
 
-       src_buf->v4l2_buf.sequence = ctx->osequence;
-       dst_buf->v4l2_buf.sequence = ctx->osequence;
+       src_buf->sequence = ctx->osequence;
+       dst_buf->sequence = ctx->osequence;
        ctx->osequence++;
 
        /*
@@ -1209,12 +1211,12 @@ static int coda_prepare_encode(struct coda_ctx *ctx)
         * frame as IDR. This is a problem for some decoders that can't
         * recover when a frame is lost.
         */
-       if (src_buf->v4l2_buf.sequence % ctx->params.gop_size) {
-               src_buf->v4l2_buf.flags |= V4L2_BUF_FLAG_PFRAME;
-               src_buf->v4l2_buf.flags &= ~V4L2_BUF_FLAG_KEYFRAME;
+       if (src_buf->sequence % ctx->params.gop_size) {
+               src_buf->flags |= V4L2_BUF_FLAG_PFRAME;
+               src_buf->flags &= ~V4L2_BUF_FLAG_KEYFRAME;
        } else {
-               src_buf->v4l2_buf.flags |= V4L2_BUF_FLAG_KEYFRAME;
-               src_buf->v4l2_buf.flags &= ~V4L2_BUF_FLAG_PFRAME;
+               src_buf->flags |= V4L2_BUF_FLAG_KEYFRAME;
+               src_buf->flags &= ~V4L2_BUF_FLAG_PFRAME;
        }
 
        if (dev->devtype->product == CODA_960)
@@ -1224,9 +1226,9 @@ static int coda_prepare_encode(struct coda_ctx *ctx)
         * Copy headers at the beginning of the first frame for H.264 only.
         * In MPEG4 they are already copied by the coda.
         */
-       if (src_buf->v4l2_buf.sequence == 0) {
+       if (src_buf->sequence == 0) {
                pic_stream_buffer_addr =
-                       vb2_dma_contig_plane_dma_addr(dst_buf, 0) +
+                       vb2_dma_contig_plane_dma_addr(&dst_buf->vb2_buf, 0) +
                        ctx->vpu_header_size[0] +
                        ctx->vpu_header_size[1] +
                        ctx->vpu_header_size[2];
@@ -1234,20 +1236,21 @@ static int coda_prepare_encode(struct coda_ctx *ctx)
                        ctx->vpu_header_size[0] -
                        ctx->vpu_header_size[1] -
                        ctx->vpu_header_size[2];
-               memcpy(vb2_plane_vaddr(dst_buf, 0),
+               memcpy(vb2_plane_vaddr(&dst_buf->vb2_buf, 0),
                       &ctx->vpu_header[0][0], ctx->vpu_header_size[0]);
-               memcpy(vb2_plane_vaddr(dst_buf, 0) + ctx->vpu_header_size[0],
-                      &ctx->vpu_header[1][0], ctx->vpu_header_size[1]);
-               memcpy(vb2_plane_vaddr(dst_buf, 0) + ctx->vpu_header_size[0] +
-                       ctx->vpu_header_size[1], &ctx->vpu_header[2][0],
-                       ctx->vpu_header_size[2]);
+               memcpy(vb2_plane_vaddr(&dst_buf->vb2_buf, 0)
+                       + ctx->vpu_header_size[0], &ctx->vpu_header[1][0],
+                       ctx->vpu_header_size[1]);
+               memcpy(vb2_plane_vaddr(&dst_buf->vb2_buf, 0)
+                       + ctx->vpu_header_size[0] + ctx->vpu_header_size[1],
+                       &ctx->vpu_header[2][0], ctx->vpu_header_size[2]);
        } else {
                pic_stream_buffer_addr =
-                       vb2_dma_contig_plane_dma_addr(dst_buf, 0);
+                       vb2_dma_contig_plane_dma_addr(&dst_buf->vb2_buf, 0);
                pic_stream_buffer_size = q_data_dst->sizeimage;
        }
 
-       if (src_buf->v4l2_buf.flags & V4L2_BUF_FLAG_KEYFRAME) {
+       if (src_buf->flags & V4L2_BUF_FLAG_KEYFRAME) {
                force_ipicture = 1;
                switch (dst_fourcc) {
                case V4L2_PIX_FMT_H264:
@@ -1324,7 +1327,7 @@ static int coda_prepare_encode(struct coda_ctx *ctx)
 
 static void coda_finish_encode(struct coda_ctx *ctx)
 {
-       struct vb2_buffer *src_buf, *dst_buf;
+       struct vb2_v4l2_buffer *src_buf, *dst_buf;
        struct coda_dev *dev = ctx->dev;
        u32 wr_ptr, start_ptr;
 
@@ -1338,13 +1341,13 @@ static void coda_finish_encode(struct coda_ctx *ctx)
        wr_ptr = coda_read(dev, CODA_REG_BIT_WR_PTR(ctx->reg_idx));
 
        /* Calculate bytesused field */
-       if (dst_buf->v4l2_buf.sequence == 0) {
-               vb2_set_plane_payload(dst_buf, 0, wr_ptr - start_ptr +
+       if (dst_buf->sequence == 0) {
+               vb2_set_plane_payload(&dst_buf->vb2_buf, 0,
                                        ctx->vpu_header_size[0] +
                                        ctx->vpu_header_size[1] +
                                        ctx->vpu_header_size[2]);
        } else {
-               vb2_set_plane_payload(dst_buf, 0, wr_ptr - start_ptr);
+               vb2_set_plane_payload(&dst_buf->vb2_buf, 0, wr_ptr - start_ptr);
        }
 
        v4l2_dbg(1, coda_debug, &ctx->dev->v4l2_dev, "frame size = %u\n",
@@ -1354,18 +1357,18 @@ static void coda_finish_encode(struct coda_ctx *ctx)
        coda_read(dev, CODA_RET_ENC_PIC_FLAG);
 
        if (coda_read(dev, CODA_RET_ENC_PIC_TYPE) == 0) {
-               dst_buf->v4l2_buf.flags |= V4L2_BUF_FLAG_KEYFRAME;
-               dst_buf->v4l2_buf.flags &= ~V4L2_BUF_FLAG_PFRAME;
+               dst_buf->flags |= V4L2_BUF_FLAG_KEYFRAME;
+               dst_buf->flags &= ~V4L2_BUF_FLAG_PFRAME;
        } else {
-               dst_buf->v4l2_buf.flags |= V4L2_BUF_FLAG_PFRAME;
-               dst_buf->v4l2_buf.flags &= ~V4L2_BUF_FLAG_KEYFRAME;
+               dst_buf->flags |= V4L2_BUF_FLAG_PFRAME;
+               dst_buf->flags &= ~V4L2_BUF_FLAG_KEYFRAME;
        }
 
-       dst_buf->v4l2_buf.timestamp = src_buf->v4l2_buf.timestamp;
-       dst_buf->v4l2_buf.flags &= ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
-       dst_buf->v4l2_buf.flags |=
-               src_buf->v4l2_buf.flags & V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
-       dst_buf->v4l2_buf.timecode = src_buf->v4l2_buf.timecode;
+       dst_buf->timestamp = src_buf->timestamp;
+       dst_buf->flags &= ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
+       dst_buf->flags |=
+               src_buf->flags & V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
+       dst_buf->timecode = src_buf->timecode;
 
        v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_DONE);
 
@@ -1378,8 +1381,8 @@ static void coda_finish_encode(struct coda_ctx *ctx)
 
        v4l2_dbg(1, coda_debug, &dev->v4l2_dev,
                "job finished: encoding frame (%d) (%s)\n",
-               dst_buf->v4l2_buf.sequence,
-               (dst_buf->v4l2_buf.flags & V4L2_BUF_FLAG_KEYFRAME) ?
+               dst_buf->sequence,
+               (dst_buf->flags & V4L2_BUF_FLAG_KEYFRAME) ?
                "KEYFRAME" : "PFRAME");
 }
 
@@ -1716,7 +1719,7 @@ static int coda_start_decoding(struct coda_ctx *ctx)
 
 static int coda_prepare_decode(struct coda_ctx *ctx)
 {
-       struct vb2_buffer *dst_buf;
+       struct vb2_v4l2_buffer *dst_buf;
        struct coda_dev *dev = ctx->dev;
        struct coda_q_data *q_data_dst;
        struct coda_buffer_meta *meta;
@@ -1763,7 +1766,7 @@ static int coda_prepare_decode(struct coda_ctx *ctx)
                 * well as the rotator buffer output.
                 * ROT_INDEX needs to be < 0x40, but > ctx->num_internal_frames.
                 */
-               coda_write(dev, CODA_MAX_FRAMEBUFFERS + dst_buf->v4l2_buf.index,
+               coda_write(dev, CODA_MAX_FRAMEBUFFERS + dst_buf->vb2_buf.index,
                                CODA9_CMD_DEC_PIC_ROT_INDEX);
 
                reg_addr = CODA9_CMD_DEC_PIC_ROT_ADDR_Y;
@@ -1838,7 +1841,7 @@ static void coda_finish_decode(struct coda_ctx *ctx)
        struct coda_dev *dev = ctx->dev;
        struct coda_q_data *q_data_src;
        struct coda_q_data *q_data_dst;
-       struct vb2_buffer *dst_buf;
+       struct vb2_v4l2_buffer *dst_buf;
        struct coda_buffer_meta *meta;
        unsigned long payload;
        unsigned long flags;
@@ -2029,15 +2032,15 @@ static void coda_finish_decode(struct coda_ctx *ctx)
        if (ctx->display_idx >= 0 &&
            ctx->display_idx < ctx->num_internal_frames) {
                dst_buf = v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx);
-               dst_buf->v4l2_buf.sequence = ctx->osequence++;
+               dst_buf->sequence = ctx->osequence++;
 
-               dst_buf->v4l2_buf.flags &= ~(V4L2_BUF_FLAG_KEYFRAME |
+               dst_buf->flags &= ~(V4L2_BUF_FLAG_KEYFRAME |
                                             V4L2_BUF_FLAG_PFRAME |
                                             V4L2_BUF_FLAG_BFRAME);
-               dst_buf->v4l2_buf.flags |= ctx->frame_types[ctx->display_idx];
+               dst_buf->flags |= ctx->frame_types[ctx->display_idx];
                meta = &ctx->frame_metas[ctx->display_idx];
-               dst_buf->v4l2_buf.timecode = meta->timecode;
-               dst_buf->v4l2_buf.timestamp = meta->timestamp;
+               dst_buf->timecode = meta->timecode;
+               dst_buf->timestamp = meta->timestamp;
 
                trace_coda_dec_rot_done(ctx, dst_buf, meta);
 
@@ -2052,15 +2055,15 @@ static void coda_finish_decode(struct coda_ctx *ctx)
                        payload = width * height * 2;
                        break;
                }
-               vb2_set_plane_payload(dst_buf, 0, payload);
+               vb2_set_plane_payload(&dst_buf->vb2_buf, 0, payload);
 
                coda_m2m_buf_done(ctx, dst_buf, ctx->frame_errors[display_idx] ?
                                  VB2_BUF_STATE_ERROR : VB2_BUF_STATE_DONE);
 
                v4l2_dbg(1, coda_debug, &dev->v4l2_dev,
                        "job finished: decoding frame (%d) (%s)\n",
-                       dst_buf->v4l2_buf.sequence,
-                       (dst_buf->v4l2_buf.flags & V4L2_BUF_FLAG_KEYFRAME) ?
+                       dst_buf->sequence,
+                       (dst_buf->flags & V4L2_BUF_FLAG_KEYFRAME) ?
                        "KEYFRAME" : "PFRAME");
        } else {
                v4l2_dbg(1, coda_debug, &dev->v4l2_dev,
index 998fe6614b338fe92f5ee22f66e30eaa97f15cd3..60336eec75af7ce4360bd515464472ce6dde123c 100644 (file)
@@ -84,9 +84,9 @@ unsigned int coda_read(struct coda_dev *dev, u32 reg)
 }
 
 void coda_write_base(struct coda_ctx *ctx, struct coda_q_data *q_data,
-                    struct vb2_buffer *buf, unsigned int reg_y)
+                    struct vb2_v4l2_buffer *buf, unsigned int reg_y)
 {
-       u32 base_y = vb2_dma_contig_plane_dma_addr(buf, 0);
+       u32 base_y = vb2_dma_contig_plane_dma_addr(&buf->vb2_buf, 0);
        u32 base_cb, base_cr;
 
        switch (q_data->fourcc) {
@@ -684,17 +684,17 @@ static int coda_qbuf(struct file *file, void *priv,
 }
 
 static bool coda_buf_is_end_of_stream(struct coda_ctx *ctx,
-                                     struct vb2_buffer *buf)
+                                     struct vb2_v4l2_buffer *buf)
 {
        struct vb2_queue *src_vq;
 
        src_vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
 
        return ((ctx->bit_stream_param & CODA_BIT_STREAM_END_FLAG) &&
-               (buf->v4l2_buf.sequence == (ctx->qsequence - 1)));
+               (buf->sequence == (ctx->qsequence - 1)));
 }
 
-void coda_m2m_buf_done(struct coda_ctx *ctx, struct vb2_buffer *buf,
+void coda_m2m_buf_done(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf,
                       enum vb2_buffer_state state)
 {
        const struct v4l2_event eos_event = {
@@ -702,7 +702,7 @@ void coda_m2m_buf_done(struct coda_ctx *ctx, struct vb2_buffer *buf,
        };
 
        if (coda_buf_is_end_of_stream(ctx, buf)) {
-               buf->v4l2_buf.flags |= V4L2_BUF_FLAG_LAST;
+               buf->flags |= V4L2_BUF_FLAG_LAST;
 
                v4l2_event_queue_fh(&ctx->fh, &eos_event);
        }
@@ -1175,6 +1175,7 @@ static int coda_buf_prepare(struct vb2_buffer *vb)
 
 static void coda_buf_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct coda_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
        struct vb2_queue *vq = vb->vb2_queue;
        struct coda_q_data *q_data;
@@ -1193,12 +1194,12 @@ static void coda_buf_queue(struct vb2_buffer *vb)
                if (vb2_get_plane_payload(vb, 0) == 0)
                        coda_bit_stream_end_flag(ctx);
                mutex_lock(&ctx->bitstream_mutex);
-               v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vb);
+               v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vbuf);
                if (vb2_is_streaming(vb->vb2_queue))
                        coda_fill_bitstream(ctx, true);
                mutex_unlock(&ctx->bitstream_mutex);
        } else {
-               v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vb);
+               v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vbuf);
        }
 }
 
@@ -1247,7 +1248,7 @@ static int coda_start_streaming(struct vb2_queue *q, unsigned int count)
        struct coda_ctx *ctx = vb2_get_drv_priv(q);
        struct v4l2_device *v4l2_dev = &ctx->dev->v4l2_dev;
        struct coda_q_data *q_data_src, *q_data_dst;
-       struct vb2_buffer *buf;
+       struct vb2_v4l2_buffer *buf;
        int ret = 0;
 
        q_data_src = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
@@ -1338,7 +1339,7 @@ static void coda_stop_streaming(struct vb2_queue *q)
 {
        struct coda_ctx *ctx = vb2_get_drv_priv(q);
        struct coda_dev *dev = ctx->dev;
-       struct vb2_buffer *buf;
+       struct vb2_v4l2_buffer *buf;
        unsigned long flags;
        bool stop;
 
index 11e734bc2cbd53bcd483c706006fb682ab983bdb..96cd42a0baaf6fd3087d82b256697f6890ffdcd8 100644 (file)
@@ -178,12 +178,12 @@ int coda_jpeg_write_tables(struct coda_ctx *ctx)
        return 0;
 }
 
-bool coda_jpeg_check_buffer(struct coda_ctx *ctx, struct vb2_buffer *vb)
+bool coda_jpeg_check_buffer(struct coda_ctx *ctx, struct vb2_v4l2_buffer *vb)
 {
-       void *vaddr = vb2_plane_vaddr(vb, 0);
+       void *vaddr = vb2_plane_vaddr(&vb->vb2_buf, 0);
        u16 soi = be16_to_cpup((__be16 *)vaddr);
        u16 eoi = be16_to_cpup((__be16 *)(vaddr +
-                                         vb2_get_plane_payload(vb, 0) - 2));
+                         vb2_get_plane_payload(&vb->vb2_buf, 0) - 2));
 
        return soi == SOI_MARKER && eoi == EOI_MARKER;
 }
index feb9671a12bd29a2c326c5384e53a16f3217d845..96532b06bd9e1c840769ce63d3dff5f942aec343 100644 (file)
@@ -243,7 +243,7 @@ extern int coda_debug;
 void coda_write(struct coda_dev *dev, u32 data, u32 reg);
 unsigned int coda_read(struct coda_dev *dev, u32 reg);
 void coda_write_base(struct coda_ctx *ctx, struct coda_q_data *q_data,
-                    struct vb2_buffer *buf, unsigned int reg_y);
+                    struct vb2_v4l2_buffer *buf, unsigned int reg_y);
 
 int coda_alloc_aux_buf(struct coda_dev *dev, struct coda_aux_buf *buf,
                       size_t size, const char *name, struct dentry *parent);
@@ -284,12 +284,12 @@ static inline unsigned int coda_get_bitstream_payload(struct coda_ctx *ctx)
 
 void coda_bit_stream_end_flag(struct coda_ctx *ctx);
 
-void coda_m2m_buf_done(struct coda_ctx *ctx, struct vb2_buffer *buf,
+void coda_m2m_buf_done(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf,
                       enum vb2_buffer_state state);
 
 int coda_h264_padding(int size, char *p);
 
-bool coda_jpeg_check_buffer(struct coda_ctx *ctx, struct vb2_buffer *vb);
+bool coda_jpeg_check_buffer(struct coda_ctx *ctx, struct vb2_v4l2_buffer *vb);
 int coda_jpeg_write_tables(struct coda_ctx *ctx);
 void coda_set_jpeg_compression_quality(struct coda_ctx *ctx, int quality);
 
index 9db6a66629135638a3a44fe287a4673e4f5b2b29..f20666a4aa89b0e4e7626952b8a172df747f0d1a 100644 (file)
@@ -49,7 +49,7 @@ TRACE_EVENT(coda_bit_done,
 );
 
 DECLARE_EVENT_CLASS(coda_buf_class,
-       TP_PROTO(struct coda_ctx *ctx, struct vb2_buffer *buf),
+       TP_PROTO(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf),
 
        TP_ARGS(ctx, buf),
 
@@ -61,7 +61,7 @@ DECLARE_EVENT_CLASS(coda_buf_class,
 
        TP_fast_assign(
                __entry->minor = ctx->fh.vdev->minor;
-               __entry->index = buf->v4l2_buf.index;
+               __entry->index = buf->vb2_buf.index;
                __entry->ctx = ctx->idx;
        ),
 
@@ -70,17 +70,17 @@ DECLARE_EVENT_CLASS(coda_buf_class,
 );
 
 DEFINE_EVENT(coda_buf_class, coda_enc_pic_run,
-       TP_PROTO(struct coda_ctx *ctx, struct vb2_buffer *buf),
+       TP_PROTO(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf),
        TP_ARGS(ctx, buf)
 );
 
 DEFINE_EVENT(coda_buf_class, coda_enc_pic_done,
-       TP_PROTO(struct coda_ctx *ctx, struct vb2_buffer *buf),
+       TP_PROTO(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf),
        TP_ARGS(ctx, buf)
 );
 
 DECLARE_EVENT_CLASS(coda_buf_meta_class,
-       TP_PROTO(struct coda_ctx *ctx, struct vb2_buffer *buf,
+       TP_PROTO(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf,
                 struct coda_buffer_meta *meta),
 
        TP_ARGS(ctx, buf, meta),
@@ -95,7 +95,7 @@ DECLARE_EVENT_CLASS(coda_buf_meta_class,
 
        TP_fast_assign(
                __entry->minor = ctx->fh.vdev->minor;
-               __entry->index = buf->v4l2_buf.index;
+               __entry->index = buf->vb2_buf.index;
                __entry->start = meta->start;
                __entry->end = meta->end;
                __entry->ctx = ctx->idx;
@@ -107,7 +107,7 @@ DECLARE_EVENT_CLASS(coda_buf_meta_class,
 );
 
 DEFINE_EVENT(coda_buf_meta_class, coda_bit_queue,
-       TP_PROTO(struct coda_ctx *ctx, struct vb2_buffer *buf,
+       TP_PROTO(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf,
                 struct coda_buffer_meta *meta),
        TP_ARGS(ctx, buf, meta)
 );
@@ -146,7 +146,7 @@ DEFINE_EVENT(coda_meta_class, coda_dec_pic_done,
 );
 
 DEFINE_EVENT(coda_buf_meta_class, coda_dec_rot_done,
-       TP_PROTO(struct coda_ctx *ctx, struct vb2_buffer *buf,
+       TP_PROTO(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf,
                 struct coda_buffer_meta *meta),
        TP_ARGS(ctx, buf, meta)
 );
index f69cdd7da10cf7c029b9965bb5aad5ac4414da52..39f8ccfae339d8d506bfa4c68546b4f5abba1cb7 100644 (file)
@@ -74,8 +74,8 @@ static void vpbe_isr_even_field(struct vpbe_display *disp_obj,
        if (layer->cur_frm == layer->next_frm)
                return;
 
-       v4l2_get_timestamp(&layer->cur_frm->vb.v4l2_buf.timestamp);
-       vb2_buffer_done(&layer->cur_frm->vb, VB2_BUF_STATE_DONE);
+       v4l2_get_timestamp(&layer->cur_frm->vb.timestamp);
+       vb2_buffer_done(&layer->cur_frm->vb.vb2_buf, VB2_BUF_STATE_DONE);
        /* Make cur_frm pointing to next_frm */
        layer->cur_frm = layer->next_frm;
 }
@@ -104,8 +104,8 @@ static void vpbe_isr_odd_field(struct vpbe_display *disp_obj,
        list_del(&layer->next_frm->list);
        spin_unlock(&disp_obj->dma_queue_lock);
        /* Mark state of the frame to active */
-       layer->next_frm->vb.state = VB2_BUF_STATE_ACTIVE;
-       addr = vb2_dma_contig_plane_dma_addr(&layer->next_frm->vb, 0);
+       layer->next_frm->vb.vb2_buf.state = VB2_BUF_STATE_ACTIVE;
+       addr = vb2_dma_contig_plane_dma_addr(&layer->next_frm->vb.vb2_buf, 0);
        osd_device->ops.start_layer(osd_device,
                        layer->layer_info.id,
                        addr,
@@ -259,8 +259,9 @@ vpbe_buffer_queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt,
  */
 static void vpbe_buffer_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        /* Get the file handle object and layer object */
-       struct vpbe_disp_buffer *buf = container_of(vb,
+       struct vpbe_disp_buffer *buf = container_of(vbuf,
                                struct vpbe_disp_buffer, vb);
        struct vpbe_layer *layer = vb2_get_drv_priv(vb->vb2_queue);
        struct vpbe_display *disp = layer->disp_dev;
@@ -290,7 +291,7 @@ static int vpbe_start_streaming(struct vb2_queue *vq, unsigned int count)
        /* Remove buffer from the buffer queue */
        list_del(&layer->cur_frm->list);
        /* Mark state of the current frame to active */
-       layer->cur_frm->vb.state = VB2_BUF_STATE_ACTIVE;
+       layer->cur_frm->vb.vb2_buf.state = VB2_BUF_STATE_ACTIVE;
        /* Initialize field_id and started member */
        layer->field_id = 0;
 
@@ -299,10 +300,12 @@ static int vpbe_start_streaming(struct vb2_queue *vq, unsigned int count)
        if (ret < 0) {
                struct vpbe_disp_buffer *buf, *tmp;
 
-               vb2_buffer_done(&layer->cur_frm->vb, VB2_BUF_STATE_QUEUED);
+               vb2_buffer_done(&layer->cur_frm->vb.vb2_buf,
+                               VB2_BUF_STATE_QUEUED);
                list_for_each_entry_safe(buf, tmp, &layer->dma_queue, list) {
                        list_del(&buf->list);
-                       vb2_buffer_done(&buf->vb, VB2_BUF_STATE_QUEUED);
+                       vb2_buffer_done(&buf->vb.vb2_buf,
+                                       VB2_BUF_STATE_QUEUED);
                }
 
                return ret;
@@ -332,13 +335,14 @@ static void vpbe_stop_streaming(struct vb2_queue *vq)
        /* release all active buffers */
        spin_lock_irqsave(&disp->dma_queue_lock, flags);
        if (layer->cur_frm == layer->next_frm) {
-               vb2_buffer_done(&layer->cur_frm->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&layer->cur_frm->vb.vb2_buf,
+                               VB2_BUF_STATE_ERROR);
        } else {
                if (layer->cur_frm != NULL)
-                       vb2_buffer_done(&layer->cur_frm->vb,
+                       vb2_buffer_done(&layer->cur_frm->vb.vb2_buf,
                                        VB2_BUF_STATE_ERROR);
                if (layer->next_frm != NULL)
-                       vb2_buffer_done(&layer->next_frm->vb,
+                       vb2_buffer_done(&layer->next_frm->vb.vb2_buf,
                                        VB2_BUF_STATE_ERROR);
        }
 
@@ -346,7 +350,8 @@ static void vpbe_stop_streaming(struct vb2_queue *vq)
                layer->next_frm = list_entry(layer->dma_queue.next,
                                                struct vpbe_disp_buffer, list);
                list_del(&layer->next_frm->list);
-               vb2_buffer_done(&layer->next_frm->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&layer->next_frm->vb.vb2_buf,
+                               VB2_BUF_STATE_ERROR);
        }
        spin_unlock_irqrestore(&disp->dma_queue_lock, flags);
 }
@@ -383,7 +388,7 @@ static int vpbe_set_osd_display_params(struct vpbe_display *disp_dev,
        unsigned long addr;
        int ret;
 
-       addr = vb2_dma_contig_plane_dma_addr(&layer->cur_frm->vb, 0);
+       addr = vb2_dma_contig_plane_dma_addr(&layer->cur_frm->vb.vb2_buf, 0);
        /* Set address in the display registers */
        osd_device->ops.start_layer(osd_device,
                                    layer->layer_info.id,
index a5f548138b91b4d000b70178b71c94ebda35fcdc..b29bb64db8bf6f8cf061b6f832a4c7c6ce26cd59 100644 (file)
@@ -57,7 +57,8 @@ static u8 channel_first_int[VPIF_NUMBER_OF_OBJECTS][2] = { {1, 1} };
 /* Is set to 1 in case of SDTV formats, 2 in case of HDTV formats. */
 static int ycmux_mode;
 
-static inline struct vpif_cap_buffer *to_vpif_buffer(struct vb2_buffer *vb)
+static inline
+struct vpif_cap_buffer *to_vpif_buffer(struct vb2_v4l2_buffer *vb)
 {
        return container_of(vb, struct vpif_cap_buffer, vb);
 }
@@ -72,6 +73,7 @@ static inline struct vpif_cap_buffer *to_vpif_buffer(struct vb2_buffer *vb)
  */
 static int vpif_buffer_prepare(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct vb2_queue *q = vb->vb2_queue;
        struct channel_obj *ch = vb2_get_drv_priv(q);
        struct common_obj *common;
@@ -85,7 +87,7 @@ static int vpif_buffer_prepare(struct vb2_buffer *vb)
        if (vb2_get_plane_payload(vb, 0) > vb2_plane_size(vb, 0))
                return -EINVAL;
 
-       vb->v4l2_buf.field = common->fmt.fmt.pix.field;
+       vbuf->field = common->fmt.fmt.pix.field;
 
        addr = vb2_dma_contig_plane_dma_addr(vb, 0);
        if (!IS_ALIGNED((addr + common->ytop_off), 8) ||
@@ -145,8 +147,9 @@ static int vpif_buffer_queue_setup(struct vb2_queue *vq,
  */
 static void vpif_buffer_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct channel_obj *ch = vb2_get_drv_priv(vb->vb2_queue);
-       struct vpif_cap_buffer *buf = to_vpif_buffer(vb);
+       struct vpif_cap_buffer *buf = to_vpif_buffer(vbuf);
        struct common_obj *common;
        unsigned long flags;
 
@@ -214,7 +217,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
        list_del(&common->cur_frm->list);
        spin_unlock_irqrestore(&common->irqlock, flags);
 
-       addr = vb2_dma_contig_plane_dma_addr(&common->cur_frm->vb, 0);
+       addr = vb2_dma_contig_plane_dma_addr(&common->cur_frm->vb.vb2_buf, 0);
 
        common->set_addr(addr + common->ytop_off,
                         addr + common->ybtm_off,
@@ -243,7 +246,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 err:
        list_for_each_entry_safe(buf, tmp, &common->dma_queue, list) {
                list_del(&buf->list);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_QUEUED);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_QUEUED);
        }
        spin_unlock_irqrestore(&common->irqlock, flags);
 
@@ -286,13 +289,14 @@ static void vpif_stop_streaming(struct vb2_queue *vq)
        /* release all active buffers */
        spin_lock_irqsave(&common->irqlock, flags);
        if (common->cur_frm == common->next_frm) {
-               vb2_buffer_done(&common->cur_frm->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&common->cur_frm->vb.vb2_buf,
+                               VB2_BUF_STATE_ERROR);
        } else {
                if (common->cur_frm != NULL)
-                       vb2_buffer_done(&common->cur_frm->vb,
+                       vb2_buffer_done(&common->cur_frm->vb.vb2_buf,
                                        VB2_BUF_STATE_ERROR);
                if (common->next_frm != NULL)
-                       vb2_buffer_done(&common->next_frm->vb,
+                       vb2_buffer_done(&common->next_frm->vb.vb2_buf,
                                        VB2_BUF_STATE_ERROR);
        }
 
@@ -300,7 +304,8 @@ static void vpif_stop_streaming(struct vb2_queue *vq)
                common->next_frm = list_entry(common->dma_queue.next,
                                                struct vpif_cap_buffer, list);
                list_del(&common->next_frm->list);
-               vb2_buffer_done(&common->next_frm->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&common->next_frm->vb.vb2_buf,
+                               VB2_BUF_STATE_ERROR);
        }
        spin_unlock_irqrestore(&common->irqlock, flags);
 }
@@ -325,9 +330,8 @@ static struct vb2_ops video_qops = {
  */
 static void vpif_process_buffer_complete(struct common_obj *common)
 {
-       v4l2_get_timestamp(&common->cur_frm->vb.v4l2_buf.timestamp);
-       vb2_buffer_done(&common->cur_frm->vb,
-                                           VB2_BUF_STATE_DONE);
+       v4l2_get_timestamp(&common->cur_frm->vb.timestamp);
+       vb2_buffer_done(&common->cur_frm->vb.vb2_buf, VB2_BUF_STATE_DONE);
        /* Make curFrm pointing to nextFrm */
        common->cur_frm = common->next_frm;
 }
@@ -350,7 +354,7 @@ static void vpif_schedule_next_buffer(struct common_obj *common)
        /* Remove that buffer from the buffer queue */
        list_del(&common->next_frm->list);
        spin_unlock(&common->irqlock);
-       addr = vb2_dma_contig_plane_dma_addr(&common->next_frm->vb, 0);
+       addr = vb2_dma_contig_plane_dma_addr(&common->next_frm->vb.vb2_buf, 0);
 
        /* Set top and bottom field addresses in VPIF registers */
        common->set_addr(addr + common->ytop_off,
index 8b8a663f6b2213ac18e1c0b15d236a960c07780a..4a7600929b61318f7808b85fbf8f9a14eefa290c 100644 (file)
@@ -52,7 +52,7 @@ struct video_obj {
 };
 
 struct vpif_cap_buffer {
-       struct vb2_buffer vb;
+       struct vb2_v4l2_buffer vb;
        struct list_head list;
 };
 
index 682e5d578bf7b843f73317b7a7c3a34bdf0fe5bd..f51518c5b7879b81b628abde01866d13cf7a59b8 100644 (file)
@@ -53,7 +53,8 @@ static struct device *vpif_dev;
 static void vpif_calculate_offsets(struct channel_obj *ch);
 static void vpif_config_addr(struct channel_obj *ch, int muxmode);
 
-static inline struct vpif_disp_buffer *to_vpif_buffer(struct vb2_buffer *vb)
+static inline
+struct vpif_disp_buffer *to_vpif_buffer(struct vb2_v4l2_buffer *vb)
 {
        return container_of(vb, struct vpif_disp_buffer, vb);
 }
@@ -68,6 +69,7 @@ static inline struct vpif_disp_buffer *to_vpif_buffer(struct vb2_buffer *vb)
  */
 static int vpif_buffer_prepare(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct channel_obj *ch = vb2_get_drv_priv(vb->vb2_queue);
        struct common_obj *common;
 
@@ -77,7 +79,7 @@ static int vpif_buffer_prepare(struct vb2_buffer *vb)
        if (vb2_get_plane_payload(vb, 0) > vb2_plane_size(vb, 0))
                return -EINVAL;
 
-       vb->v4l2_buf.field = common->fmt.fmt.pix.field;
+       vbuf->field = common->fmt.fmt.pix.field;
 
        if (vb->vb2_queue->type != V4L2_BUF_TYPE_SLICED_VBI_OUTPUT) {
                unsigned long addr = vb2_dma_contig_plane_dma_addr(vb, 0);
@@ -138,7 +140,8 @@ static int vpif_buffer_queue_setup(struct vb2_queue *vq,
  */
 static void vpif_buffer_queue(struct vb2_buffer *vb)
 {
-       struct vpif_disp_buffer *buf = to_vpif_buffer(vb);
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
+       struct vpif_disp_buffer *buf = to_vpif_buffer(vbuf);
        struct channel_obj *ch = vb2_get_drv_priv(vb->vb2_queue);
        struct common_obj *common;
        unsigned long flags;
@@ -197,7 +200,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
        list_del(&common->cur_frm->list);
        spin_unlock_irqrestore(&common->irqlock, flags);
 
-       addr = vb2_dma_contig_plane_dma_addr(&common->cur_frm->vb, 0);
+       addr = vb2_dma_contig_plane_dma_addr(&common->cur_frm->vb.vb2_buf, 0);
        common->set_addr((addr + common->ytop_off),
                            (addr + common->ybtm_off),
                            (addr + common->ctop_off),
@@ -229,7 +232,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count)
 err:
        list_for_each_entry_safe(buf, tmp, &common->dma_queue, list) {
                list_del(&buf->list);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_QUEUED);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_QUEUED);
        }
        spin_unlock_irqrestore(&common->irqlock, flags);
 
@@ -264,13 +267,14 @@ static void vpif_stop_streaming(struct vb2_queue *vq)
        /* release all active buffers */
        spin_lock_irqsave(&common->irqlock, flags);
        if (common->cur_frm == common->next_frm) {
-               vb2_buffer_done(&common->cur_frm->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&common->cur_frm->vb.vb2_buf,
+                               VB2_BUF_STATE_ERROR);
        } else {
                if (common->cur_frm != NULL)
-                       vb2_buffer_done(&common->cur_frm->vb,
+                       vb2_buffer_done(&common->cur_frm->vb.vb2_buf,
                                        VB2_BUF_STATE_ERROR);
                if (common->next_frm != NULL)
-                       vb2_buffer_done(&common->next_frm->vb,
+                       vb2_buffer_done(&common->next_frm->vb.vb2_buf,
                                        VB2_BUF_STATE_ERROR);
        }
 
@@ -278,7 +282,8 @@ static void vpif_stop_streaming(struct vb2_queue *vq)
                common->next_frm = list_entry(common->dma_queue.next,
                                                struct vpif_disp_buffer, list);
                list_del(&common->next_frm->list);
-               vb2_buffer_done(&common->next_frm->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&common->next_frm->vb.vb2_buf,
+                               VB2_BUF_STATE_ERROR);
        }
        spin_unlock_irqrestore(&common->irqlock, flags);
 }
@@ -306,7 +311,7 @@ static void process_progressive_mode(struct common_obj *common)
        spin_unlock(&common->irqlock);
 
        /* Set top and bottom field addrs in VPIF registers */
-       addr = vb2_dma_contig_plane_dma_addr(&common->next_frm->vb, 0);
+       addr = vb2_dma_contig_plane_dma_addr(&common->next_frm->vb.vb2_buf, 0);
        common->set_addr(addr + common->ytop_off,
                                 addr + common->ybtm_off,
                                 addr + common->ctop_off,
@@ -324,10 +329,10 @@ static void process_interlaced_mode(int fid, struct common_obj *common)
                /* one frame is displayed If next frame is
                 *  available, release cur_frm and move on */
                /* Copy frame display time */
-               v4l2_get_timestamp(&common->cur_frm->vb.v4l2_buf.timestamp);
+               v4l2_get_timestamp(&common->cur_frm->vb.timestamp);
                /* Change status of the cur_frm */
-               vb2_buffer_done(&common->cur_frm->vb,
-                                           VB2_BUF_STATE_DONE);
+               vb2_buffer_done(&common->cur_frm->vb.vb2_buf,
+                                       VB2_BUF_STATE_DONE);
                /* Make cur_frm pointing to next_frm */
                common->cur_frm = common->next_frm;
 
@@ -380,10 +385,10 @@ static irqreturn_t vpif_channel_isr(int irq, void *dev_id)
                        if (!channel_first_int[i][channel_id]) {
                                /* Mark status of the cur_frm to
                                 * done and unlock semaphore on it */
-                               v4l2_get_timestamp(&common->cur_frm->vb.
-                                                  v4l2_buf.timestamp);
-                               vb2_buffer_done(&common->cur_frm->vb,
-                                           VB2_BUF_STATE_DONE);
+                               v4l2_get_timestamp(
+                                       &common->cur_frm->vb.timestamp);
+                               vb2_buffer_done(&common->cur_frm->vb.vb2_buf,
+                                               VB2_BUF_STATE_DONE);
                                /* Make cur_frm pointing to next_frm */
                                common->cur_frm = common->next_frm;
                        }
index 849e0e385f182f0c1324e19c1d44b15b2024327d..e7a1723a1b7ab384fe745b8c7a237b6121321c1d 100644 (file)
@@ -62,7 +62,7 @@ struct video_obj {
 };
 
 struct vpif_disp_buffer {
-       struct vb2_buffer vb;
+       struct vb2_v4l2_buffer vb;
        struct list_head list;
 };
 
index 769ff50a95a2d552f84a52661db8d7a79858cdc7..e93a2336cfa2f75944ba84cb20a1530053aa8d5e 100644 (file)
@@ -136,7 +136,7 @@ struct gsc_fmt {
  * @idx : index of G-Scaler input buffer
  */
 struct gsc_input_buf {
-       struct vb2_buffer       vb;
+       struct vb2_v4l2_buffer vb;
        struct list_head        list;
        int                     idx;
 };
index d5cffef2e2271232d223b4f8a836af26c45b087f..59d134d1fa939b8b86addf0f972bf8ca4252d998 100644 (file)
@@ -77,7 +77,7 @@ static void gsc_m2m_stop_streaming(struct vb2_queue *q)
 
 void gsc_m2m_job_finish(struct gsc_ctx *ctx, int vb_state)
 {
-       struct vb2_buffer *src_vb, *dst_vb;
+       struct vb2_v4l2_buffer *src_vb, *dst_vb;
 
        if (!ctx || !ctx->m2m_ctx)
                return;
@@ -86,11 +86,11 @@ void gsc_m2m_job_finish(struct gsc_ctx *ctx, int vb_state)
        dst_vb = v4l2_m2m_dst_buf_remove(ctx->m2m_ctx);
 
        if (src_vb && dst_vb) {
-               dst_vb->v4l2_buf.timestamp = src_vb->v4l2_buf.timestamp;
-               dst_vb->v4l2_buf.timecode = src_vb->v4l2_buf.timecode;
-               dst_vb->v4l2_buf.flags &= ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
-               dst_vb->v4l2_buf.flags |=
-                       src_vb->v4l2_buf.flags
+               dst_vb->timestamp = src_vb->timestamp;
+               dst_vb->timecode = src_vb->timecode;
+               dst_vb->flags &= ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
+               dst_vb->flags |=
+                       src_vb->flags
                        & V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
 
                v4l2_m2m_buf_done(src_vb, vb_state);
@@ -109,23 +109,23 @@ static void gsc_m2m_job_abort(void *priv)
 static int gsc_get_bufs(struct gsc_ctx *ctx)
 {
        struct gsc_frame *s_frame, *d_frame;
-       struct vb2_buffer *src_vb, *dst_vb;
+       struct vb2_v4l2_buffer *src_vb, *dst_vb;
        int ret;
 
        s_frame = &ctx->s_frame;
        d_frame = &ctx->d_frame;
 
        src_vb = v4l2_m2m_next_src_buf(ctx->m2m_ctx);
-       ret = gsc_prepare_addr(ctx, src_vb, s_frame, &s_frame->addr);
+       ret = gsc_prepare_addr(ctx, &src_vb->vb2_buf, s_frame, &s_frame->addr);
        if (ret)
                return ret;
 
        dst_vb = v4l2_m2m_next_dst_buf(ctx->m2m_ctx);
-       ret = gsc_prepare_addr(ctx, dst_vb, d_frame, &d_frame->addr);
+       ret = gsc_prepare_addr(ctx, &dst_vb->vb2_buf, d_frame, &d_frame->addr);
        if (ret)
                return ret;
 
-       dst_vb->v4l2_buf.timestamp = src_vb->v4l2_buf.timestamp;
+       dst_vb->timestamp = src_vb->timestamp;
 
        return 0;
 }
@@ -255,12 +255,13 @@ static int gsc_m2m_buf_prepare(struct vb2_buffer *vb)
 
 static void gsc_m2m_buf_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct gsc_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
 
        pr_debug("ctx: %p, ctx->state: 0x%x", ctx, ctx->state);
 
        if (ctx->m2m_ctx)
-               v4l2_m2m_buf_queue(ctx->m2m_ctx, vb);
+               v4l2_m2m_buf_queue(ctx->m2m_ctx, vbuf);
 }
 
 static struct vb2_ops gsc_m2m_qops = {
index b1cdadccf2d70f9b21f327f8919021f8fc6de862..fa698e7b916b4982c1514c8556e301fbbc343d25 100644 (file)
@@ -103,7 +103,7 @@ static int fimc_capture_state_cleanup(struct fimc_dev *fimc, bool suspend)
        /* Release unused buffers */
        while (!suspend && !list_empty(&cap->pending_buf_q)) {
                buf = fimc_pending_queue_pop(cap);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
        }
        /* If suspending put unused buffers onto pending queue */
        while (!list_empty(&cap->active_buf_q)) {
@@ -111,7 +111,7 @@ static int fimc_capture_state_cleanup(struct fimc_dev *fimc, bool suspend)
                if (suspend)
                        fimc_pending_queue_add(cap, buf);
                else
-                       vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+                       vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
        }
 
        fimc_hw_reset(fimc);
@@ -193,10 +193,10 @@ void fimc_capture_irq_handler(struct fimc_dev *fimc, int deq_buf)
            test_bit(ST_CAPT_RUN, &fimc->state) && deq_buf) {
                v_buf = fimc_active_queue_pop(cap);
 
-               v4l2_get_timestamp(&v_buf->vb.v4l2_buf.timestamp);
-               v_buf->vb.v4l2_buf.sequence = cap->frame_count++;
+               v4l2_get_timestamp(&v_buf->vb.timestamp);
+               v_buf->vb.sequence = cap->frame_count++;
 
-               vb2_buffer_done(&v_buf->vb, VB2_BUF_STATE_DONE);
+               vb2_buffer_done(&v_buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
        }
 
        if (!list_empty(&cap->pending_buf_q)) {
@@ -227,7 +227,7 @@ void fimc_capture_irq_handler(struct fimc_dev *fimc, int deq_buf)
                list_for_each_entry(v_buf, &cap->active_buf_q, list) {
                        if (v_buf->index != index)
                                continue;
-                       vaddr = vb2_plane_vaddr(&v_buf->vb, plane);
+                       vaddr = vb2_plane_vaddr(&v_buf->vb.vb2_buf, plane);
                        v4l2_subdev_call(csis, video, s_rx_buffer,
                                         vaddr, &size);
                        break;
@@ -332,7 +332,7 @@ int fimc_capture_resume(struct fimc_dev *fimc)
                if (list_empty(&vid_cap->pending_buf_q))
                        break;
                buf = fimc_pending_queue_pop(vid_cap);
-               buffer_queue(&buf->vb);
+               buffer_queue(&buf->vb.vb2_buf);
        }
        return 0;
 
@@ -404,8 +404,9 @@ static int buffer_prepare(struct vb2_buffer *vb)
 
 static void buffer_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct fimc_vid_buffer *buf
-               = container_of(vb, struct fimc_vid_buffer, vb);
+               = container_of(vbuf, struct fimc_vid_buffer, vb);
        struct fimc_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
        struct fimc_dev *fimc = ctx->fimc_dev;
        struct fimc_vid_cap *vid_cap = &fimc->vid_cap;
@@ -414,7 +415,7 @@ static void buffer_queue(struct vb2_buffer *vb)
        int min_bufs;
 
        spin_lock_irqsave(&fimc->slock, flags);
-       fimc_prepare_addr(ctx, &buf->vb, &ctx->d_frame, &buf->paddr);
+       fimc_prepare_addr(ctx, &buf->vb.vb2_buf, &ctx->d_frame, &buf->paddr);
 
        if (!test_bit(ST_CAPT_SUSPENDED, &fimc->state) &&
            !test_bit(ST_CAPT_STREAM, &fimc->state) &&
@@ -1466,7 +1467,8 @@ void fimc_sensor_notify(struct v4l2_subdev *sd, unsigned int notification,
                if (!list_empty(&fimc->vid_cap.active_buf_q)) {
                        buf = list_entry(fimc->vid_cap.active_buf_q.next,
                                         struct fimc_vid_buffer, list);
-                       vb2_set_plane_payload(&buf->vb, 0, *((u32 *)arg));
+                       vb2_set_plane_payload(&buf->vb.vb2_buf, 0,
+                                             *((u32 *)arg));
                }
                fimc_capture_irq_handler(fimc, 1);
                fimc_deactivate_capture(fimc);
index ccb5d917292bf84fb447d6786a8ca890285fc29e..d336fa2916df8541ffbe63da8a9cf83788ea4901 100644 (file)
@@ -224,7 +224,7 @@ struct fimc_addr {
  * @index: buffer index for the output DMA engine
  */
 struct fimc_vid_buffer {
-       struct vb2_buffer       vb;
+       struct vb2_v4l2_buffer vb;
        struct list_head        list;
        struct fimc_addr        paddr;
        int                     index;
index 195f9b5e95124853577b168f5a47a29c1c6daf8e..bacc3a389b7c1ef7c3b0dff885339670f1d94d9e 100644 (file)
@@ -194,10 +194,11 @@ static int isp_video_capture_buffer_prepare(struct vb2_buffer *vb)
 
 static void isp_video_capture_buffer_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct fimc_isp *isp = vb2_get_drv_priv(vb->vb2_queue);
        struct fimc_is_video *video = &isp->video_capture;
        struct fimc_is *is = fimc_isp_to_is(isp);
-       struct isp_video_buf *ivb = to_isp_video_buf(vb);
+       struct isp_video_buf *ivb = to_isp_video_buf(vbuf);
        unsigned long flags;
        unsigned int i;
 
@@ -220,7 +221,7 @@ static void isp_video_capture_buffer_queue(struct vb2_buffer *vb)
 
                        isp_dbg(2, &video->ve.vdev,
                                "dma_buf %pad (%d/%d/%d) addr: %pad\n",
-                               &buf_index, ivb->index, i, vb->v4l2_buf.index,
+                               &buf_index, ivb->index, i, vb->index,
                                &ivb->dma_addr[i]);
                }
 
@@ -242,7 +243,7 @@ static void isp_video_capture_buffer_queue(struct vb2_buffer *vb)
 void fimc_isp_video_irq_handler(struct fimc_is *is)
 {
        struct fimc_is_video *video = &is->isp.video_capture;
-       struct vb2_buffer *vb;
+       struct vb2_v4l2_buffer *vbuf;
        int buf_index;
 
        /* TODO: Ensure the DMA is really stopped in stop_streaming callback */
@@ -250,10 +251,10 @@ void fimc_isp_video_irq_handler(struct fimc_is *is)
                return;
 
        buf_index = (is->i2h_cmd.args[1] - 1) % video->buf_count;
-       vb = &video->buffers[buf_index]->vb;
+       vbuf = &video->buffers[buf_index]->vb;
 
-       v4l2_get_timestamp(&vb->v4l2_buf.timestamp);
-       vb2_buffer_done(vb, VB2_BUF_STATE_DONE);
+       v4l2_get_timestamp(&vbuf->timestamp);
+       vb2_buffer_done(&vbuf->vb2_buf, VB2_BUF_STATE_DONE);
 
        video->buf_mask &= ~BIT(buf_index);
        fimc_is_hw_set_isp_buf_mask(is, video->buf_mask);
index ad9908bb79668b2febab9c2decb6643413c79e29..c2d25df85db9d157ec1baa088fba3e245336338f 100644 (file)
@@ -102,7 +102,7 @@ struct fimc_isp_ctrls {
 };
 
 struct isp_video_buf {
-       struct vb2_buffer vb;
+       struct vb2_v4l2_buffer vb;
        dma_addr_t dma_addr[FIMC_ISP_MAX_PLANES];
        unsigned int index;
 };
index f56c69a63c9be7fa54aabe499b2def55ba02f248..1920cfbd0369075f04437aa5afa24213151354a1 100644 (file)
@@ -200,7 +200,7 @@ static int fimc_lite_reinit(struct fimc_lite *fimc, bool suspend)
        /* Release unused buffers */
        while (!suspend && !list_empty(&fimc->pending_buf_q)) {
                buf = fimc_lite_pending_queue_pop(fimc);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
        }
        /* If suspending put unused buffers onto pending queue */
        while (!list_empty(&fimc->active_buf_q)) {
@@ -208,7 +208,7 @@ static int fimc_lite_reinit(struct fimc_lite *fimc, bool suspend)
                if (suspend)
                        fimc_lite_pending_queue_add(fimc, buf);
                else
-                       vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+                       vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
        }
 
        spin_unlock_irqrestore(&fimc->slock, flags);
@@ -292,10 +292,10 @@ static irqreturn_t flite_irq_handler(int irq, void *priv)
            test_bit(ST_FLITE_RUN, &fimc->state) &&
            !list_empty(&fimc->active_buf_q)) {
                vbuf = fimc_lite_active_queue_pop(fimc);
-               v4l2_get_timestamp(&vbuf->vb.v4l2_buf.timestamp);
-               vbuf->vb.v4l2_buf.sequence = fimc->frame_count++;
+               v4l2_get_timestamp(&vbuf->vb.timestamp);
+               vbuf->vb.sequence = fimc->frame_count++;
                flite_hw_mask_dma_buffer(fimc, vbuf->index);
-               vb2_buffer_done(&vbuf->vb, VB2_BUF_STATE_DONE);
+               vb2_buffer_done(&vbuf->vb.vb2_buf, VB2_BUF_STATE_DONE);
        }
 
        if (test_bit(ST_FLITE_CONFIG, &fimc->state))
@@ -417,8 +417,9 @@ static int buffer_prepare(struct vb2_buffer *vb)
 
 static void buffer_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct flite_buffer *buf
-               = container_of(vb, struct flite_buffer, vb);
+               = container_of(vbuf, struct flite_buffer, vb);
        struct fimc_lite *fimc = vb2_get_drv_priv(vb->vb2_queue);
        unsigned long flags;
 
@@ -1632,7 +1633,7 @@ static int fimc_lite_resume(struct device *dev)
                if (list_empty(&fimc->pending_buf_q))
                        break;
                buf = fimc_lite_pending_queue_pop(fimc);
-               buffer_queue(&buf->vb);
+               buffer_queue(&buf->vb.vb2_buf);
        }
        return 0;
 }
index 7e4c7080e4259296496e6a8cf32e30f752c02763..b302305dedbeedf16d0e35e2229162d8b396fb1e 100644 (file)
@@ -100,7 +100,7 @@ struct flite_frame {
  * @index: DMA start address register's index
  */
 struct flite_buffer {
-       struct vb2_buffer vb;
+       struct vb2_v4l2_buffer vb;
        struct list_head list;
        dma_addr_t paddr;
        unsigned short index;
index 07bfddb322f8dd5bb53bdbcc65a7334cf62e44c1..79b8a3bfbd2bce23911ed77f6b7326558beef12e 100644 (file)
@@ -42,7 +42,7 @@ static unsigned int get_m2m_fmt_flags(unsigned int stream_type)
 
 void fimc_m2m_job_finish(struct fimc_ctx *ctx, int vb_state)
 {
-       struct vb2_buffer *src_vb, *dst_vb;
+       struct vb2_v4l2_buffer *src_vb, *dst_vb;
 
        if (!ctx || !ctx->fh.m2m_ctx)
                return;
@@ -99,7 +99,7 @@ static void stop_streaming(struct vb2_queue *q)
 
 static void fimc_device_run(void *priv)
 {
-       struct vb2_buffer *src_vb, *dst_vb;
+       struct vb2_v4l2_buffer *src_vb, *dst_vb;
        struct fimc_ctx *ctx = priv;
        struct fimc_frame *sf, *df;
        struct fimc_dev *fimc;
@@ -123,19 +123,19 @@ static void fimc_device_run(void *priv)
        }
 
        src_vb = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
-       ret = fimc_prepare_addr(ctx, src_vb, sf, &sf->paddr);
+       ret = fimc_prepare_addr(ctx, &src_vb->vb2_buf, sf, &sf->paddr);
        if (ret)
                goto dma_unlock;
 
        dst_vb = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx);
-       ret = fimc_prepare_addr(ctx, dst_vb, df, &df->paddr);
+       ret = fimc_prepare_addr(ctx, &dst_vb->vb2_buf, df, &df->paddr);
        if (ret)
                goto dma_unlock;
 
-       dst_vb->v4l2_buf.timestamp = src_vb->v4l2_buf.timestamp;
-       dst_vb->v4l2_buf.flags &= ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
-       dst_vb->v4l2_buf.flags |=
-               src_vb->v4l2_buf.flags & V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
+       dst_vb->timestamp = src_vb->timestamp;
+       dst_vb->flags &= ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
+       dst_vb->flags |=
+               src_vb->flags & V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
 
        /* Reconfigure hardware if the context has changed. */
        if (fimc->m2m.ctx != ctx) {
@@ -220,8 +220,9 @@ static int fimc_buf_prepare(struct vb2_buffer *vb)
 
 static void fimc_buf_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct fimc_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
-       v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vb);
+       v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vbuf);
 }
 
 static struct vb2_ops fimc_qops = {
index c07f367aa436f6bb44c7c46cf06e501a60ca1b85..bdd8f11d8fb15e2d9f377d8c8c32cc29fd678dcd 100644 (file)
@@ -200,18 +200,18 @@ static void dma_callback(void *data)
 {
        struct deinterlace_ctx *curr_ctx = data;
        struct deinterlace_dev *pcdev = curr_ctx->dev;
-       struct vb2_buffer *src_vb, *dst_vb;
+       struct vb2_v4l2_buffer *src_vb, *dst_vb;
 
        atomic_set(&pcdev->busy, 0);
 
        src_vb = v4l2_m2m_src_buf_remove(curr_ctx->m2m_ctx);
        dst_vb = v4l2_m2m_dst_buf_remove(curr_ctx->m2m_ctx);
 
-       dst_vb->v4l2_buf.timestamp = src_vb->v4l2_buf.timestamp;
-       dst_vb->v4l2_buf.flags &= ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
-       dst_vb->v4l2_buf.flags |=
-               src_vb->v4l2_buf.flags & V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
-       dst_vb->v4l2_buf.timecode = src_vb->v4l2_buf.timecode;
+       dst_vb->timestamp = src_vb->timestamp;
+       dst_vb->flags &= ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
+       dst_vb->flags |=
+               src_vb->flags & V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
+       dst_vb->timecode = src_vb->timecode;
 
        v4l2_m2m_buf_done(src_vb, VB2_BUF_STATE_DONE);
        v4l2_m2m_buf_done(dst_vb, VB2_BUF_STATE_DONE);
@@ -225,7 +225,7 @@ static void deinterlace_issue_dma(struct deinterlace_ctx *ctx, int op,
                                  int do_callback)
 {
        struct deinterlace_q_data *s_q_data;
-       struct vb2_buffer *src_buf, *dst_buf;
+       struct vb2_v4l2_buffer *src_buf, *dst_buf;
        struct deinterlace_dev *pcdev = ctx->dev;
        struct dma_chan *chan = pcdev->dma_chan;
        struct dma_device *dmadev = chan->device;
@@ -243,8 +243,9 @@ static void deinterlace_issue_dma(struct deinterlace_ctx *ctx, int op,
        s_height = s_q_data->height;
        s_size = s_width * s_height;
 
-       p_in = (dma_addr_t)vb2_dma_contig_plane_dma_addr(src_buf, 0);
-       p_out = (dma_addr_t)vb2_dma_contig_plane_dma_addr(dst_buf, 0);
+       p_in = (dma_addr_t)vb2_dma_contig_plane_dma_addr(&src_buf->vb2_buf, 0);
+       p_out = (dma_addr_t)vb2_dma_contig_plane_dma_addr(&dst_buf->vb2_buf,
+                                                         0);
        if (!p_in || !p_out) {
                v4l2_err(&pcdev->v4l2_dev,
                         "Acquiring kernel pointers to buffers failed\n");
@@ -849,8 +850,10 @@ static int deinterlace_buf_prepare(struct vb2_buffer *vb)
 
 static void deinterlace_buf_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct deinterlace_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
-       v4l2_m2m_buf_queue(ctx->m2m_ctx, vb);
+
+       v4l2_m2m_buf_queue(ctx->m2m_ctx, vbuf);
 }
 
 static struct vb2_ops deinterlace_qops = {
index 5e2b4df48b3c93ee7ce89c4bcb08cc2000660358..1d95842e207106916695cf0b26fe762c5bd36e17 100644 (file)
@@ -201,18 +201,18 @@ struct mcam_dma_desc {
 
 /*
  * Our buffer type for working with videobuf2.  Note that the vb2
- * developers have decreed that struct vb2_buffer must be at the
+ * developers have decreed that struct vb2_v4l2_buffer must be at the
  * beginning of this structure.
  */
 struct mcam_vb_buffer {
-       struct vb2_buffer vb_buf;
+       struct vb2_v4l2_buffer vb_buf;
        struct list_head queue;
        struct mcam_dma_desc *dma_desc; /* Descriptor virtual address */
        dma_addr_t dma_desc_pa;         /* Descriptor physical address */
        int dma_desc_nent;              /* Number of mapped descriptors */
 };
 
-static inline struct mcam_vb_buffer *vb_to_mvb(struct vb2_buffer *vb)
+static inline struct mcam_vb_buffer *vb_to_mvb(struct vb2_v4l2_buffer *vb)
 {
        return container_of(vb, struct mcam_vb_buffer, vb_buf);
 }
@@ -221,14 +221,14 @@ static inline struct mcam_vb_buffer *vb_to_mvb(struct vb2_buffer *vb)
  * Hand a completed buffer back to user space.
  */
 static void mcam_buffer_done(struct mcam_camera *cam, int frame,
-               struct vb2_buffer *vbuf)
+               struct vb2_v4l2_buffer *vbuf)
 {
-       vbuf->v4l2_buf.bytesused = cam->pix_format.sizeimage;
-       vbuf->v4l2_buf.sequence = cam->buf_seq[frame];
-       vbuf->v4l2_buf.field = V4L2_FIELD_NONE;
-       v4l2_get_timestamp(&vbuf->v4l2_buf.timestamp);
-       vb2_set_plane_payload(vbuf, 0, cam->pix_format.sizeimage);
-       vb2_buffer_done(vbuf, VB2_BUF_STATE_DONE);
+       vbuf->vb2_buf.planes[0].bytesused = cam->pix_format.sizeimage;
+       vbuf->sequence = cam->buf_seq[frame];
+       vbuf->field = V4L2_FIELD_NONE;
+       v4l2_get_timestamp(&vbuf->timestamp);
+       vb2_set_plane_payload(&vbuf->vb2_buf, 0, cam->pix_format.sizeimage);
+       vb2_buffer_done(&vbuf->vb2_buf, VB2_BUF_STATE_DONE);
 }
 
 
@@ -482,7 +482,8 @@ static void mcam_frame_tasklet(unsigned long data)
                 * Drop the lock during the big copy.  This *should* be safe...
                 */
                spin_unlock_irqrestore(&cam->dev_lock, flags);
-               memcpy(vb2_plane_vaddr(&buf->vb_buf, 0), cam->dma_bufs[bufno],
+               memcpy(vb2_plane_vaddr(&buf->vb_buf.vb2_buf, 0),
+                               cam->dma_bufs[bufno],
                                cam->pix_format.sizeimage);
                mcam_buffer_done(cam, bufno, &buf->vb_buf);
                spin_lock_irqsave(&cam->dev_lock, flags);
@@ -548,7 +549,7 @@ static void mcam_set_contig_buffer(struct mcam_camera *cam, int frame)
 {
        struct mcam_vb_buffer *buf;
        dma_addr_t dma_handle;
-       struct vb2_buffer *vb;
+       struct vb2_v4l2_buffer *vb;
 
        /*
         * If there are no available buffers, go into single mode
@@ -570,7 +571,7 @@ static void mcam_set_contig_buffer(struct mcam_camera *cam, int frame)
        cam->vb_bufs[frame] = buf;
        vb = &buf->vb_buf;
 
-       dma_handle = vb2_dma_contig_plane_dma_addr(vb, 0);
+       dma_handle = vb2_dma_contig_plane_dma_addr(&vb->vb2_buf, 0);
        mcam_write_yuv_bases(cam, frame, dma_handle);
 }
 
@@ -1071,7 +1072,8 @@ static int mcam_vb_queue_setup(struct vb2_queue *vq,
 
 static void mcam_vb_buf_queue(struct vb2_buffer *vb)
 {
-       struct mcam_vb_buffer *mvb = vb_to_mvb(vb);
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
+       struct mcam_vb_buffer *mvb = vb_to_mvb(vbuf);
        struct mcam_camera *cam = vb2_get_drv_priv(vb->vb2_queue);
        unsigned long flags;
        int start;
@@ -1096,14 +1098,14 @@ static void mcam_vb_requeue_bufs(struct vb2_queue *vq,
 
        spin_lock_irqsave(&cam->dev_lock, flags);
        list_for_each_entry_safe(buf, node, &cam->buffers, queue) {
-               vb2_buffer_done(&buf->vb_buf, state);
+               vb2_buffer_done(&buf->vb_buf.vb2_buf, state);
                list_del(&buf->queue);
        }
        for (i = 0; i < MAX_DMA_BUFS; i++) {
                buf = cam->vb_bufs[i];
 
                if (buf) {
-                       vb2_buffer_done(&buf->vb_buf, state);
+                       vb2_buffer_done(&buf->vb_buf.vb2_buf, state);
                        cam->vb_bufs[i] = NULL;
                }
        }
@@ -1198,7 +1200,8 @@ static const struct vb2_ops mcam_vb2_ops = {
  */
 static int mcam_vb_sg_buf_init(struct vb2_buffer *vb)
 {
-       struct mcam_vb_buffer *mvb = vb_to_mvb(vb);
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
+       struct mcam_vb_buffer *mvb = vb_to_mvb(vbuf);
        struct mcam_camera *cam = vb2_get_drv_priv(vb->vb2_queue);
        int ndesc = cam->pix_format.sizeimage/PAGE_SIZE + 1;
 
@@ -1214,7 +1217,8 @@ static int mcam_vb_sg_buf_init(struct vb2_buffer *vb)
 
 static int mcam_vb_sg_buf_prepare(struct vb2_buffer *vb)
 {
-       struct mcam_vb_buffer *mvb = vb_to_mvb(vb);
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
+       struct mcam_vb_buffer *mvb = vb_to_mvb(vbuf);
        struct sg_table *sg_table = vb2_dma_sg_plane_desc(vb, 0);
        struct mcam_dma_desc *desc = mvb->dma_desc;
        struct scatterlist *sg;
@@ -1230,8 +1234,9 @@ static int mcam_vb_sg_buf_prepare(struct vb2_buffer *vb)
 
 static void mcam_vb_sg_buf_cleanup(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct mcam_camera *cam = vb2_get_drv_priv(vb->vb2_queue);
-       struct mcam_vb_buffer *mvb = vb_to_mvb(vb);
+       struct mcam_vb_buffer *mvb = vb_to_mvb(vbuf);
        int ndesc = cam->pix_format.sizeimage/PAGE_SIZE + 1;
 
        dma_free_coherent(cam->dev, ndesc * sizeof(struct mcam_dma_desc),
index 87314b743f55e22fec9e6306b11832528aee4eeb..b7cea274d7ea178d2c2448bac44b5baf49c291a2 100644 (file)
@@ -351,7 +351,7 @@ static irqreturn_t emmaprp_irq(int irq_emma, void *data)
 {
        struct emmaprp_dev *pcdev = data;
        struct emmaprp_ctx *curr_ctx;
-       struct vb2_buffer *src_vb, *dst_vb;
+       struct vb2_v4l2_buffer *src_vb, *dst_vb;
        unsigned long flags;
        u32 irqst;
 
@@ -375,13 +375,13 @@ static irqreturn_t emmaprp_irq(int irq_emma, void *data)
                        src_vb = v4l2_m2m_src_buf_remove(curr_ctx->m2m_ctx);
                        dst_vb = v4l2_m2m_dst_buf_remove(curr_ctx->m2m_ctx);
 
-                       dst_vb->v4l2_buf.timestamp = src_vb->v4l2_buf.timestamp;
-                       dst_vb->v4l2_buf.flags &=
+                       dst_vb->timestamp = src_vb->timestamp;
+                       dst_vb->flags &=
                                ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
-                       dst_vb->v4l2_buf.flags |=
-                               src_vb->v4l2_buf.flags
+                       dst_vb->flags |=
+                               src_vb->flags
                                & V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
-                       dst_vb->v4l2_buf.timecode = src_vb->v4l2_buf.timecode;
+                       dst_vb->timecode = src_vb->timecode;
 
                        spin_lock_irqsave(&pcdev->irqlock, flags);
                        v4l2_m2m_buf_done(src_vb, VB2_BUF_STATE_DONE);
@@ -742,8 +742,9 @@ static int emmaprp_buf_prepare(struct vb2_buffer *vb)
 
 static void emmaprp_buf_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct emmaprp_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
-       v4l2_m2m_buf_queue(ctx->m2m_ctx, vb);
+       v4l2_m2m_buf_queue(ctx->m2m_ctx, vbuf);
 }
 
 static struct vb2_ops emmaprp_qops = {
index 41bb8df91f72e1fd1f2068338fe0fe3ca2deaff1..786cc8593f9477d7241ed1bc56a84890f3cb5901 100644 (file)
@@ -342,8 +342,9 @@ static int isp_video_queue_setup(struct vb2_queue *queue,
 
 static int isp_video_buffer_prepare(struct vb2_buffer *buf)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(buf);
        struct isp_video_fh *vfh = vb2_get_drv_priv(buf->vb2_queue);
-       struct isp_buffer *buffer = to_isp_buffer(buf);
+       struct isp_buffer *buffer = to_isp_buffer(vbuf);
        struct isp_video *video = vfh->video;
        dma_addr_t addr;
 
@@ -363,7 +364,8 @@ static int isp_video_buffer_prepare(struct vb2_buffer *buf)
                return -EINVAL;
        }
 
-       vb2_set_plane_payload(&buffer->vb, 0, vfh->format.fmt.pix.sizeimage);
+       vb2_set_plane_payload(&buffer->vb.vb2_buf, 0,
+                             vfh->format.fmt.pix.sizeimage);
        buffer->dma = addr;
 
        return 0;
@@ -380,8 +382,9 @@ static int isp_video_buffer_prepare(struct vb2_buffer *buf)
  */
 static void isp_video_buffer_queue(struct vb2_buffer *buf)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(buf);
        struct isp_video_fh *vfh = vb2_get_drv_priv(buf->vb2_queue);
-       struct isp_buffer *buffer = to_isp_buffer(buf);
+       struct isp_buffer *buffer = to_isp_buffer(vbuf);
        struct isp_video *video = vfh->video;
        struct isp_pipeline *pipe = to_isp_pipeline(&video->video.entity);
        enum isp_pipeline_state state;
@@ -392,7 +395,7 @@ static void isp_video_buffer_queue(struct vb2_buffer *buf)
        spin_lock_irqsave(&video->irqlock, flags);
 
        if (unlikely(video->error)) {
-               vb2_buffer_done(&buffer->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buffer->vb.vb2_buf, VB2_BUF_STATE_ERROR);
                spin_unlock_irqrestore(&video->irqlock, flags);
                return;
        }
@@ -464,7 +467,7 @@ struct isp_buffer *omap3isp_video_buffer_next(struct isp_video *video)
        list_del(&buf->irqlist);
        spin_unlock_irqrestore(&video->irqlock, flags);
 
-       v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp);
+       v4l2_get_timestamp(&buf->vb.timestamp);
 
        /* Do frame number propagation only if this is the output video node.
         * Frame number either comes from the CSI receivers or it gets
@@ -473,15 +476,15 @@ struct isp_buffer *omap3isp_video_buffer_next(struct isp_video *video)
         * first, so the input number might lag behind by 1 in some cases.
         */
        if (video == pipe->output && !pipe->do_propagation)
-               buf->vb.v4l2_buf.sequence =
+               buf->vb.sequence =
                        atomic_inc_return(&pipe->frame_number);
        else
-               buf->vb.v4l2_buf.sequence = atomic_read(&pipe->frame_number);
+               buf->vb.sequence = atomic_read(&pipe->frame_number);
 
        if (pipe->field != V4L2_FIELD_NONE)
-               buf->vb.v4l2_buf.sequence /= 2;
+               buf->vb.sequence /= 2;
 
-       buf->vb.v4l2_buf.field = pipe->field;
+       buf->vb.field = pipe->field;
 
        /* Report pipeline errors to userspace on the capture device side. */
        if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && pipe->error) {
@@ -491,7 +494,7 @@ struct isp_buffer *omap3isp_video_buffer_next(struct isp_video *video)
                state = VB2_BUF_STATE_DONE;
        }
 
-       vb2_buffer_done(&buf->vb, state);
+       vb2_buffer_done(&buf->vb.vb2_buf, state);
 
        spin_lock_irqsave(&video->irqlock, flags);
 
@@ -546,7 +549,7 @@ void omap3isp_video_cancel_stream(struct isp_video *video)
                buf = list_first_entry(&video->dmaqueue,
                                       struct isp_buffer, irqlist);
                list_del(&buf->irqlist);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
        }
 
        video->error = true;
index 31c2445f9eb21bf4f15eb0ef6cd28a85688b3b5f..bcf0e0acc8f387a86aabeb31181e4cbfb827397f 100644 (file)
@@ -122,7 +122,7 @@ static inline int isp_pipeline_ready(struct isp_pipeline *pipe)
  * @dma: DMA address
  */
 struct isp_buffer {
-       struct vb2_buffer vb;
+       struct vb2_v4l2_buffer vb;
        struct list_head irqlist;
        dma_addr_t dma;
 };
index 18e62d06797cbd09c7e544fb5b4ff1fd9d66a814..7533b9e16649503274bd49340d380cf412c132f7 100644 (file)
@@ -471,7 +471,7 @@ static const char *error_to_text[16] = {
        "Unknown"
 };
 
-static struct jpu_buffer *vb2_to_jpu_buffer(struct vb2_buffer *vb)
+static struct jpu_buffer *vb2_to_jpu_buffer(struct vb2_v4l2_buffer *vb)
 {
        struct v4l2_m2m_buffer *b =
                container_of(vb, struct v4l2_m2m_buffer, vb);
@@ -1044,6 +1044,7 @@ static int jpu_queue_setup(struct vb2_queue *vq,
 
 static int jpu_buf_prepare(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct jpu_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
        struct jpu_q_data *q_data;
        unsigned int i;
@@ -1051,9 +1052,9 @@ static int jpu_buf_prepare(struct vb2_buffer *vb)
        q_data = jpu_get_q_data(ctx, vb->vb2_queue->type);
 
        if (V4L2_TYPE_IS_OUTPUT(vb->vb2_queue->type)) {
-               if (vb->v4l2_buf.field == V4L2_FIELD_ANY)
-                       vb->v4l2_buf.field = V4L2_FIELD_NONE;
-               if (vb->v4l2_buf.field != V4L2_FIELD_NONE) {
+               if (vbuf->field == V4L2_FIELD_ANY)
+                       vbuf->field = V4L2_FIELD_NONE;
+               if (vbuf->field != V4L2_FIELD_NONE) {
                        dev_err(ctx->jpu->dev, "%s field isn't supported\n",
                                        __func__);
                        return -EINVAL;
@@ -1080,10 +1081,11 @@ static int jpu_buf_prepare(struct vb2_buffer *vb)
 
 static void jpu_buf_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct jpu_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
 
        if (!ctx->encoder && V4L2_TYPE_IS_OUTPUT(vb->vb2_queue->type)) {
-               struct jpu_buffer *jpu_buf = vb2_to_jpu_buffer(vb);
+               struct jpu_buffer *jpu_buf = vb2_to_jpu_buffer(vbuf);
                struct jpu_q_data *q_data, adjust;
                void *buffer = vb2_plane_vaddr(vb, 0);
                unsigned long buf_size = vb2_get_plane_payload(vb, 0);
@@ -1117,7 +1119,7 @@ static void jpu_buf_queue(struct vb2_buffer *vb)
        }
 
        if (ctx->fh.m2m_ctx)
-               v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vb);
+               v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vbuf);
 
        return;
 
@@ -1128,14 +1130,15 @@ format_error:
 
 static void jpu_buf_finish(struct vb2_buffer *vb)
 {
-       struct jpu_buffer *jpu_buf = vb2_to_jpu_buffer(vb);
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
+       struct jpu_buffer *jpu_buf = vb2_to_jpu_buffer(vbuf);
        struct jpu_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
        struct jpu_q_data *q_data = &ctx->out_q;
        enum v4l2_buf_type type = vb->vb2_queue->type;
        u8 *buffer;
 
        if (vb->state == VB2_BUF_STATE_DONE)
-               vb->v4l2_buf.sequence = jpu_get_q_data(ctx, type)->sequence++;
+               vbuf->sequence = jpu_get_q_data(ctx, type)->sequence++;
 
        if (!ctx->encoder || vb->state != VB2_BUF_STATE_DONE ||
            V4L2_TYPE_IS_OUTPUT(type))
@@ -1163,7 +1166,7 @@ static int jpu_start_streaming(struct vb2_queue *vq, unsigned count)
 static void jpu_stop_streaming(struct vb2_queue *vq)
 {
        struct jpu_ctx *ctx = vb2_get_drv_priv(vq);
-       struct vb2_buffer *vb;
+       struct vb2_v4l2_buffer *vb;
        unsigned long flags;
 
        for (;;) {
@@ -1327,7 +1330,7 @@ static const struct v4l2_file_operations jpu_fops = {
 static void jpu_cleanup(struct jpu_ctx *ctx, bool reset)
 {
        /* remove current buffers and finish job */
-       struct vb2_buffer *src_buf, *dst_buf;
+       struct vb2_v4l2_buffer *src_buf, *dst_buf;
        unsigned long flags;
 
        spin_lock_irqsave(&ctx->jpu->lock, flags);
@@ -1353,7 +1356,7 @@ static void jpu_device_run(void *priv)
        struct jpu *jpu = ctx->jpu;
        struct jpu_buffer *jpu_buf;
        struct jpu_q_data *q_data;
-       struct vb2_buffer *src_buf, *dst_buf;
+       struct vb2_v4l2_buffer *src_buf, *dst_buf;
        unsigned int w, h, bpl;
        unsigned char num_planes, subsampling;
        unsigned long flags;
@@ -1389,10 +1392,12 @@ static void jpu_device_run(void *priv)
                unsigned long src_1_addr, src_2_addr, dst_addr;
                unsigned int redu, inft;
 
-               dst_addr = vb2_dma_contig_plane_dma_addr(dst_buf, 0);
-               src_1_addr = vb2_dma_contig_plane_dma_addr(src_buf, 0);
+               dst_addr = vb2_dma_contig_plane_dma_addr(&dst_buf->vb2_buf, 0);
+               src_1_addr =
+                       vb2_dma_contig_plane_dma_addr(&src_buf->vb2_buf, 0);
                if (num_planes > 1)
-                       src_2_addr = vb2_dma_contig_plane_dma_addr(src_buf, 1);
+                       src_2_addr = vb2_dma_contig_plane_dma_addr(
+                                       &src_buf->vb2_buf, 1);
                else
                        src_2_addr = src_1_addr + w * h;
 
@@ -1453,10 +1458,12 @@ static void jpu_device_run(void *priv)
                        return;
                }
 
-               src_addr = vb2_dma_contig_plane_dma_addr(src_buf, 0);
-               dst_1_addr = vb2_dma_contig_plane_dma_addr(dst_buf, 0);
+               src_addr = vb2_dma_contig_plane_dma_addr(&src_buf->vb2_buf, 0);
+               dst_1_addr =
+                       vb2_dma_contig_plane_dma_addr(&dst_buf->vb2_buf, 0);
                if (q_data->fmtinfo->num_planes > 1)
-                       dst_2_addr = vb2_dma_contig_plane_dma_addr(dst_buf, 1);
+                       dst_2_addr = vb2_dma_contig_plane_dma_addr(
+                                       &dst_buf->vb2_buf, 1);
                else
                        dst_2_addr = dst_1_addr + w * h;
 
@@ -1511,7 +1518,7 @@ static irqreturn_t jpu_irq_handler(int irq, void *dev_id)
 {
        struct jpu *jpu = dev_id;
        struct jpu_ctx *curr_ctx;
-       struct vb2_buffer *src_buf, *dst_buf;
+       struct vb2_v4l2_buffer *src_buf, *dst_buf;
        unsigned int int_status;
 
        int_status = jpu_read(jpu, JINTS);
@@ -1547,18 +1554,18 @@ static irqreturn_t jpu_irq_handler(int irq, void *dev_id)
                        unsigned long payload_size = jpu_read(jpu, JCDTCU) << 16
                                                   | jpu_read(jpu, JCDTCM) << 8
                                                   | jpu_read(jpu, JCDTCD);
-                       vb2_set_plane_payload(dst_buf, 0,
+                       vb2_set_plane_payload(&dst_buf->vb2_buf, 0,
                                payload_size + JPU_JPEG_HDR_SIZE);
                }
 
-               dst_buf->v4l2_buf.field = src_buf->v4l2_buf.field;
-               dst_buf->v4l2_buf.timestamp = src_buf->v4l2_buf.timestamp;
-               if (src_buf->v4l2_buf.flags & V4L2_BUF_FLAG_TIMECODE)
-                       dst_buf->v4l2_buf.timecode = src_buf->v4l2_buf.timecode;
-               dst_buf->v4l2_buf.flags &= ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
-               dst_buf->v4l2_buf.flags |= src_buf->v4l2_buf.flags &
+               dst_buf->field = src_buf->field;
+               dst_buf->timestamp = src_buf->timestamp;
+               if (src_buf->flags & V4L2_BUF_FLAG_TIMECODE)
+                       dst_buf->timecode = src_buf->timecode;
+               dst_buf->flags &= ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
+               dst_buf->flags |= src_buf->flags &
                                        V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
-               dst_buf->v4l2_buf.flags = src_buf->v4l2_buf.flags &
+               dst_buf->flags = src_buf->flags &
                        (V4L2_BUF_FLAG_TIMECODE | V4L2_BUF_FLAG_KEYFRAME |
                         V4L2_BUF_FLAG_PFRAME | V4L2_BUF_FLAG_BFRAME |
                         V4L2_BUF_FLAG_TSTAMP_SRC_MASK);
index bb86cf9b367f792977e53ae792194409e16bb5e6..5666766e2b87723497c380c0691783747393d6aa 100644 (file)
@@ -164,12 +164,12 @@ static int camif_reinitialize(struct camif_vp *vp)
        /* Release unused buffers */
        while (!list_empty(&vp->pending_buf_q)) {
                buf = camif_pending_queue_pop(vp);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
        }
 
        while (!list_empty(&vp->active_buf_q)) {
                buf = camif_active_queue_pop(vp);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
        }
 
        spin_unlock_irqrestore(&camif->slock, flags);
@@ -338,9 +338,9 @@ irqreturn_t s3c_camif_irq_handler(int irq, void *priv)
 
                if (!WARN_ON(vbuf == NULL)) {
                        /* Dequeue a filled buffer */
-                       v4l2_get_timestamp(&vbuf->vb.v4l2_buf.timestamp);
-                       vbuf->vb.v4l2_buf.sequence = vp->frame_sequence++;
-                       vb2_buffer_done(&vbuf->vb, VB2_BUF_STATE_DONE);
+                       v4l2_get_timestamp(&vbuf->vb.timestamp);
+                       vbuf->vb.sequence = vp->frame_sequence++;
+                       vb2_buffer_done(&vbuf->vb.vb2_buf, VB2_BUF_STATE_DONE);
 
                        /* Set up an empty buffer at the DMA engine */
                        vbuf = camif_pending_queue_pop(vp);
@@ -490,13 +490,14 @@ static int buffer_prepare(struct vb2_buffer *vb)
 
 static void buffer_queue(struct vb2_buffer *vb)
 {
-       struct camif_buffer *buf = container_of(vb, struct camif_buffer, vb);
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
+       struct camif_buffer *buf = container_of(vbuf, struct camif_buffer, vb);
        struct camif_vp *vp = vb2_get_drv_priv(vb->vb2_queue);
        struct camif_dev *camif = vp->camif;
        unsigned long flags;
 
        spin_lock_irqsave(&camif->slock, flags);
-       WARN_ON(camif_prepare_addr(vp, &buf->vb, &buf->paddr));
+       WARN_ON(camif_prepare_addr(vp, &buf->vb.vb2_buf, &buf->paddr));
 
        if (!(vp->state & ST_VP_STREAMING) && vp->active_buffers < 2) {
                /* Schedule an empty buffer in H/W */
index 8ef6f26187dd74b692643989c4cc08b925988496..adaf1969ef6372e501441860f91b6f271de9fc88 100644 (file)
@@ -322,7 +322,7 @@ struct camif_addr {
  * @index: an identifier of this buffer at the DMA engine
  */
 struct camif_buffer {
-       struct vb2_buffer vb;
+       struct vb2_v4l2_buffer vb;
        struct list_head list;
        struct camif_addr paddr;
        unsigned int index;
index 81483da2464bb62a1bcb742a56bb688d79524862..4db507ab6777e9d3fb3451fffcabfbae204392da 100644 (file)
@@ -134,8 +134,9 @@ static int g2d_buf_prepare(struct vb2_buffer *vb)
 
 static void g2d_buf_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct g2d_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
-       v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vb);
+       v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vbuf);
 }
 
 static struct vb2_ops g2d_qops = {
@@ -537,7 +538,7 @@ static irqreturn_t g2d_isr(int irq, void *prv)
 {
        struct g2d_dev *dev = prv;
        struct g2d_ctx *ctx = dev->curr;
-       struct vb2_buffer *src, *dst;
+       struct vb2_v4l2_buffer *src, *dst;
 
        g2d_clear_int(dev);
        clk_disable(dev->gate);
@@ -550,11 +551,11 @@ static irqreturn_t g2d_isr(int irq, void *prv)
        BUG_ON(src == NULL);
        BUG_ON(dst == NULL);
 
-       dst->v4l2_buf.timecode = src->v4l2_buf.timecode;
-       dst->v4l2_buf.timestamp = src->v4l2_buf.timestamp;
-       dst->v4l2_buf.flags &= ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
-       dst->v4l2_buf.flags |=
-               src->v4l2_buf.flags & V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
+       dst->timecode = src->timecode;
+       dst->timestamp = src->timestamp;
+       dst->flags &= ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
+       dst->flags |=
+               src->flags & V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
 
        v4l2_m2m_buf_done(src, VB2_BUF_STATE_DONE);
        v4l2_m2m_buf_done(dst, VB2_BUF_STATE_DONE);
index 18e754d319cf9f8a2946d6c82cc855caecd3f3fe..f026366dc185a43c9d6af9d8b6d768347638bcd7 100644 (file)
@@ -2483,6 +2483,7 @@ static int s5p_jpeg_buf_prepare(struct vb2_buffer *vb)
 
 static void s5p_jpeg_buf_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct s5p_jpeg_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
 
        if (ctx->mode == S5P_JPEG_DECODE &&
@@ -2517,7 +2518,7 @@ static void s5p_jpeg_buf_queue(struct vb2_buffer *vb)
                q_data->h = tmp.h;
        }
 
-       v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vb);
+       v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vbuf);
 }
 
 static int s5p_jpeg_start_streaming(struct vb2_queue *q, unsigned int count)
@@ -2588,7 +2589,7 @@ static irqreturn_t s5p_jpeg_irq(int irq, void *dev_id)
 {
        struct s5p_jpeg *jpeg = dev_id;
        struct s5p_jpeg_ctx *curr_ctx;
-       struct vb2_buffer *src_buf, *dst_buf;
+       struct vb2_v4l2_buffer *src_buf, *dst_buf;
        unsigned long payload_size = 0;
        enum vb2_buffer_state state = VB2_BUF_STATE_DONE;
        bool enc_jpeg_too_large = false;
@@ -2622,15 +2623,15 @@ static irqreturn_t s5p_jpeg_irq(int irq, void *dev_id)
                payload_size = s5p_jpeg_compressed_size(jpeg->regs);
        }
 
-       dst_buf->v4l2_buf.timecode = src_buf->v4l2_buf.timecode;
-       dst_buf->v4l2_buf.timestamp = src_buf->v4l2_buf.timestamp;
-       dst_buf->v4l2_buf.flags &= ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
-       dst_buf->v4l2_buf.flags |=
-               src_buf->v4l2_buf.flags & V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
+       dst_buf->timecode = src_buf->timecode;
+       dst_buf->timestamp = src_buf->timestamp;
+       dst_buf->flags &= ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
+       dst_buf->flags |=
+               src_buf->flags & V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
 
        v4l2_m2m_buf_done(src_buf, state);
        if (curr_ctx->mode == S5P_JPEG_ENCODE)
-               vb2_set_plane_payload(dst_buf, 0, payload_size);
+               vb2_set_plane_payload(&dst_buf->vb2_buf, 0, payload_size);
        v4l2_m2m_buf_done(dst_buf, state);
        v4l2_m2m_job_finish(jpeg->m2m_dev, curr_ctx->fh.m2m_ctx);
 
@@ -2645,7 +2646,7 @@ static irqreturn_t s5p_jpeg_irq(int irq, void *dev_id)
 static irqreturn_t exynos4_jpeg_irq(int irq, void *priv)
 {
        unsigned int int_status;
-       struct vb2_buffer *src_vb, *dst_vb;
+       struct vb2_v4l2_buffer *src_vb, *dst_vb;
        struct s5p_jpeg *jpeg = priv;
        struct s5p_jpeg_ctx *curr_ctx;
        unsigned long payload_size = 0;
@@ -2687,7 +2688,8 @@ static irqreturn_t exynos4_jpeg_irq(int irq, void *priv)
        if (jpeg->irq_ret == OK_ENC_OR_DEC) {
                if (curr_ctx->mode == S5P_JPEG_ENCODE) {
                        payload_size = exynos4_jpeg_get_stream_size(jpeg->regs);
-                       vb2_set_plane_payload(dst_vb, 0, payload_size);
+                       vb2_set_plane_payload(&dst_vb->vb2_buf,
+                                       0, payload_size);
                }
                v4l2_m2m_buf_done(src_vb, VB2_BUF_STATE_DONE);
                v4l2_m2m_buf_done(dst_vb, VB2_BUF_STATE_DONE);
@@ -2708,7 +2710,7 @@ static irqreturn_t exynos3250_jpeg_irq(int irq, void *dev_id)
 {
        struct s5p_jpeg *jpeg = dev_id;
        struct s5p_jpeg_ctx *curr_ctx;
-       struct vb2_buffer *src_buf, *dst_buf;
+       struct vb2_v4l2_buffer *src_buf, *dst_buf;
        unsigned long payload_size = 0;
        enum vb2_buffer_state state = VB2_BUF_STATE_DONE;
        bool interrupt_timeout = false;
@@ -2752,12 +2754,12 @@ static irqreturn_t exynos3250_jpeg_irq(int irq, void *dev_id)
        src_buf = v4l2_m2m_src_buf_remove(curr_ctx->fh.m2m_ctx);
        dst_buf = v4l2_m2m_dst_buf_remove(curr_ctx->fh.m2m_ctx);
 
-       dst_buf->v4l2_buf.timecode = src_buf->v4l2_buf.timecode;
-       dst_buf->v4l2_buf.timestamp = src_buf->v4l2_buf.timestamp;
+       dst_buf->timecode = src_buf->timecode;
+       dst_buf->timestamp = src_buf->timestamp;
 
        v4l2_m2m_buf_done(src_buf, state);
        if (curr_ctx->mode == S5P_JPEG_ENCODE)
-               vb2_set_plane_payload(dst_buf, 0, payload_size);
+               vb2_set_plane_payload(&dst_buf->vb2_buf, 0, payload_size);
        v4l2_m2m_buf_done(dst_buf, state);
        v4l2_m2m_job_finish(jpeg->m2m_dev, curr_ctx->fh.m2m_ctx);
 
index b3758b8a3c1de2cfc134e12c105216a6004570ca..7b646c2e51cd498959b27e8867f84a242bc25361 100644 (file)
@@ -199,22 +199,22 @@ static void s5p_mfc_handle_frame_all_extracted(struct s5p_mfc_ctx *ctx)
                dst_buf = list_entry(ctx->dst_queue.next,
                                     struct s5p_mfc_buf, list);
                mfc_debug(2, "Cleaning up buffer: %d\n",
-                                         dst_buf->b->v4l2_buf.index);
-               vb2_set_plane_payload(dst_buf->b, 0, 0);
-               vb2_set_plane_payload(dst_buf->b, 1, 0);
+                                         dst_buf->b->vb2_buf.index);
+               vb2_set_plane_payload(&dst_buf->b->vb2_buf, 0, 0);
+               vb2_set_plane_payload(&dst_buf->b->vb2_buf, 1, 0);
                list_del(&dst_buf->list);
                ctx->dst_queue_cnt--;
-               dst_buf->b->v4l2_buf.sequence = (ctx->sequence++);
+               dst_buf->b->sequence = (ctx->sequence++);
 
                if (s5p_mfc_hw_call(dev->mfc_ops, get_pic_type_top, ctx) ==
                        s5p_mfc_hw_call(dev->mfc_ops, get_pic_type_bot, ctx))
-                       dst_buf->b->v4l2_buf.field = V4L2_FIELD_NONE;
+                       dst_buf->b->field = V4L2_FIELD_NONE;
                else
-                       dst_buf->b->v4l2_buf.field = V4L2_FIELD_INTERLACED;
-               dst_buf->b->v4l2_buf.flags |= V4L2_BUF_FLAG_LAST;
+                       dst_buf->b->field = V4L2_FIELD_INTERLACED;
+               dst_buf->b->flags |= V4L2_BUF_FLAG_LAST;
 
-               ctx->dec_dst_flag &= ~(1 << dst_buf->b->v4l2_buf.index);
-               vb2_buffer_done(dst_buf->b, VB2_BUF_STATE_DONE);
+               ctx->dec_dst_flag &= ~(1 << dst_buf->b->vb2_buf.index);
+               vb2_buffer_done(&dst_buf->b->vb2_buf, VB2_BUF_STATE_DONE);
        }
 }
 
@@ -235,27 +235,28 @@ static void s5p_mfc_handle_frame_copy_time(struct s5p_mfc_ctx *ctx)
           appropriate flags. */
        src_buf = list_entry(ctx->src_queue.next, struct s5p_mfc_buf, list);
        list_for_each_entry(dst_buf, &ctx->dst_queue, list) {
-               if (vb2_dma_contig_plane_dma_addr(dst_buf->b, 0) == dec_y_addr) {
-                       dst_buf->b->v4l2_buf.timecode =
-                                               src_buf->b->v4l2_buf.timecode;
-                       dst_buf->b->v4l2_buf.timestamp =
-                                               src_buf->b->v4l2_buf.timestamp;
-                       dst_buf->b->v4l2_buf.flags &=
+               if (vb2_dma_contig_plane_dma_addr(&dst_buf->b->vb2_buf, 0)
+                               == dec_y_addr) {
+                       dst_buf->b->timecode =
+                                               src_buf->b->timecode;
+                       dst_buf->b->timestamp =
+                                               src_buf->b->timestamp;
+                       dst_buf->b->flags &=
                                ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
-                       dst_buf->b->v4l2_buf.flags |=
-                               src_buf->b->v4l2_buf.flags
+                       dst_buf->b->flags |=
+                               src_buf->b->flags
                                & V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
                        switch (frame_type) {
                        case S5P_FIMV_DECODE_FRAME_I_FRAME:
-                               dst_buf->b->v4l2_buf.flags |=
+                               dst_buf->b->flags |=
                                                V4L2_BUF_FLAG_KEYFRAME;
                                break;
                        case S5P_FIMV_DECODE_FRAME_P_FRAME:
-                               dst_buf->b->v4l2_buf.flags |=
+                               dst_buf->b->flags |=
                                                V4L2_BUF_FLAG_PFRAME;
                                break;
                        case S5P_FIMV_DECODE_FRAME_B_FRAME:
-                               dst_buf->b->v4l2_buf.flags |=
+                               dst_buf->b->flags |=
                                                V4L2_BUF_FLAG_BFRAME;
                                break;
                        default:
@@ -296,25 +297,28 @@ static void s5p_mfc_handle_frame_new(struct s5p_mfc_ctx *ctx, unsigned int err)
         * check which videobuf does it correspond to */
        list_for_each_entry(dst_buf, &ctx->dst_queue, list) {
                /* Check if this is the buffer we're looking for */
-               if (vb2_dma_contig_plane_dma_addr(dst_buf->b, 0) == dspl_y_addr) {
+               if (vb2_dma_contig_plane_dma_addr(&dst_buf->b->vb2_buf, 0)
+                               == dspl_y_addr) {
                        list_del(&dst_buf->list);
                        ctx->dst_queue_cnt--;
-                       dst_buf->b->v4l2_buf.sequence = ctx->sequence;
+                       dst_buf->b->sequence = ctx->sequence;
                        if (s5p_mfc_hw_call(dev->mfc_ops,
                                        get_pic_type_top, ctx) ==
                                s5p_mfc_hw_call(dev->mfc_ops,
                                        get_pic_type_bot, ctx))
-                               dst_buf->b->v4l2_buf.field = V4L2_FIELD_NONE;
+                               dst_buf->b->field = V4L2_FIELD_NONE;
                        else
-                               dst_buf->b->v4l2_buf.field =
+                               dst_buf->b->field =
                                                        V4L2_FIELD_INTERLACED;
-                       vb2_set_plane_payload(dst_buf->b, 0, ctx->luma_size);
-                       vb2_set_plane_payload(dst_buf->b, 1, ctx->chroma_size);
-                       clear_bit(dst_buf->b->v4l2_buf.index,
+                       vb2_set_plane_payload(&dst_buf->b->vb2_buf, 0,
+                                               ctx->luma_size);
+                       vb2_set_plane_payload(&dst_buf->b->vb2_buf, 1,
+                                               ctx->chroma_size);
+                       clear_bit(dst_buf->b->vb2_buf.index,
                                                        &ctx->dec_dst_flag);
 
-                       vb2_buffer_done(dst_buf->b,
-                               err ? VB2_BUF_STATE_ERROR : VB2_BUF_STATE_DONE);
+                       vb2_buffer_done(&dst_buf->b->vb2_buf, err ?
+                               VB2_BUF_STATE_ERROR : VB2_BUF_STATE_DONE);
 
                        break;
                }
@@ -395,7 +399,7 @@ static void s5p_mfc_handle_frame(struct s5p_mfc_ctx *ctx,
                if (ctx->codec_mode != S5P_MFC_CODEC_H264_DEC &&
                        ctx->codec_mode != S5P_MFC_CODEC_VP8_DEC &&
                        ctx->consumed_stream + STUFF_BYTE <
-                       src_buf->b->v4l2_planes[0].bytesused) {
+                       src_buf->b->vb2_buf.planes[0].bytesused) {
                        /* Run MFC again on the same buffer */
                        mfc_debug(2, "Running again the same buffer\n");
                        ctx->after_packed_pb = 1;
@@ -407,9 +411,11 @@ static void s5p_mfc_handle_frame(struct s5p_mfc_ctx *ctx,
                        list_del(&src_buf->list);
                        ctx->src_queue_cnt--;
                        if (s5p_mfc_hw_call(dev->mfc_ops, err_dec, err) > 0)
-                               vb2_buffer_done(src_buf->b, VB2_BUF_STATE_ERROR);
+                               vb2_buffer_done(&src_buf->b->vb2_buf,
+                                               VB2_BUF_STATE_ERROR);
                        else
-                               vb2_buffer_done(src_buf->b, VB2_BUF_STATE_DONE);
+                               vb2_buffer_done(&src_buf->b->vb2_buf,
+                                               VB2_BUF_STATE_DONE);
                }
        }
 leave_handle_frame:
@@ -510,7 +516,7 @@ static void s5p_mfc_handle_seq_done(struct s5p_mfc_ctx *ctx,
                                        struct s5p_mfc_buf, list);
                        if (s5p_mfc_hw_call(dev->mfc_ops, get_consumed_stream,
                                                dev) <
-                                       src_buf->b->v4l2_planes[0].bytesused)
+                                       src_buf->b->vb2_buf.planes[0].bytesused)
                                ctx->head_processed = 0;
                        else
                                ctx->head_processed = 1;
@@ -551,7 +557,7 @@ static void s5p_mfc_handle_init_buffers(struct s5p_mfc_ctx *ctx,
                                             struct s5p_mfc_buf, list);
                                list_del(&src_buf->list);
                                ctx->src_queue_cnt--;
-                               vb2_buffer_done(src_buf->b,
+                               vb2_buffer_done(&src_buf->b->vb2_buf,
                                                VB2_BUF_STATE_DONE);
                        }
                        spin_unlock_irqrestore(&dev->irqlock, flags);
@@ -592,8 +598,8 @@ static void s5p_mfc_handle_stream_complete(struct s5p_mfc_ctx *ctx,
                                                                        list);
                list_del(&mb_entry->list);
                ctx->dst_queue_cnt--;
-               vb2_set_plane_payload(mb_entry->b, 0, 0);
-               vb2_buffer_done(mb_entry->b, VB2_BUF_STATE_DONE);
+               vb2_set_plane_payload(&mb_entry->b->vb2_buf, 0, 0);
+               vb2_buffer_done(&mb_entry->b->vb2_buf, VB2_BUF_STATE_DONE);
        }
        spin_unlock(&dev->irqlock);
 
index 10884a77f79fb115677072c24f06c986a7d50251..d1a3f9b1bc4412dfb4a30d380d63e611717a974f 100644 (file)
@@ -179,8 +179,8 @@ struct s5p_mfc_ctx;
  * struct s5p_mfc_buf - MFC buffer
  */
 struct s5p_mfc_buf {
+       struct vb2_v4l2_buffer *b;
        struct list_head list;
-       struct vb2_buffer *b;
        union {
                struct {
                        size_t luma;
index 2fd59e7c70c2701980bc65bbe30fc804edc906c0..1734775a63e64c9c82b1531f9b9653428f8063f8 100644 (file)
@@ -945,6 +945,7 @@ static int s5p_mfc_queue_setup(struct vb2_queue *vq,
 
 static int s5p_mfc_buf_init(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct vb2_queue *vq = vb->vb2_queue;
        struct s5p_mfc_ctx *ctx = fh_to_ctx(vq->drv_priv);
        unsigned int i;
@@ -964,8 +965,8 @@ static int s5p_mfc_buf_init(struct vb2_buffer *vb)
                        mfc_err("Plane buffer (CAPTURE) is too small\n");
                        return -EINVAL;
                }
-               i = vb->v4l2_buf.index;
-               ctx->dst_bufs[i].b = vb;
+               i = vb->index;
+               ctx->dst_bufs[i].b = vbuf;
                ctx->dst_bufs[i].cookie.raw.luma =
                                        vb2_dma_contig_plane_dma_addr(vb, 0);
                ctx->dst_bufs[i].cookie.raw.chroma =
@@ -982,8 +983,8 @@ static int s5p_mfc_buf_init(struct vb2_buffer *vb)
                        return -EINVAL;
                }
 
-               i = vb->v4l2_buf.index;
-               ctx->src_bufs[i].b = vb;
+               i = vb->index;
+               ctx->src_bufs[i].b = vbuf;
                ctx->src_bufs[i].cookie.stream =
                                        vb2_dma_contig_plane_dma_addr(vb, 0);
                ctx->src_bufs_cnt++;
@@ -1065,18 +1066,18 @@ static void s5p_mfc_buf_queue(struct vb2_buffer *vb)
        struct s5p_mfc_buf *mfc_buf;
 
        if (vq->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
-               mfc_buf = &ctx->src_bufs[vb->v4l2_buf.index];
+               mfc_buf = &ctx->src_bufs[vb->index];
                mfc_buf->flags &= ~MFC_BUF_FLAG_USED;
                spin_lock_irqsave(&dev->irqlock, flags);
                list_add_tail(&mfc_buf->list, &ctx->src_queue);
                ctx->src_queue_cnt++;
                spin_unlock_irqrestore(&dev->irqlock, flags);
        } else if (vq->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
-               mfc_buf = &ctx->dst_bufs[vb->v4l2_buf.index];
+               mfc_buf = &ctx->dst_bufs[vb->index];
                mfc_buf->flags &= ~MFC_BUF_FLAG_USED;
                /* Mark destination as available for use by MFC */
                spin_lock_irqsave(&dev->irqlock, flags);
-               set_bit(vb->v4l2_buf.index, &ctx->dec_dst_flag);
+               set_bit(vb->index, &ctx->dec_dst_flag);
                list_add_tail(&mfc_buf->list, &ctx->dst_queue);
                ctx->dst_queue_cnt++;
                spin_unlock_irqrestore(&dev->irqlock, flags);
index e42014c1cecade01bb4f413eb7c03a2626ce7c0b..94868f7214da703f290bf6e5072acb1c65cda8bc 100644 (file)
@@ -773,8 +773,8 @@ static int enc_pre_seq_start(struct s5p_mfc_ctx *ctx)
 
        spin_lock_irqsave(&dev->irqlock, flags);
        dst_mb = list_entry(ctx->dst_queue.next, struct s5p_mfc_buf, list);
-       dst_addr = vb2_dma_contig_plane_dma_addr(dst_mb->b, 0);
-       dst_size = vb2_plane_size(dst_mb->b, 0);
+       dst_addr = vb2_dma_contig_plane_dma_addr(&dst_mb->b->vb2_buf, 0);
+       dst_size = vb2_plane_size(&dst_mb->b->vb2_buf, 0);
        s5p_mfc_hw_call_void(dev->mfc_ops, set_enc_stream_buffer, ctx, dst_addr,
                        dst_size);
        spin_unlock_irqrestore(&dev->irqlock, flags);
@@ -796,10 +796,11 @@ static int enc_post_seq_start(struct s5p_mfc_ctx *ctx)
                                        struct s5p_mfc_buf, list);
                        list_del(&dst_mb->list);
                        ctx->dst_queue_cnt--;
-                       vb2_set_plane_payload(dst_mb->b, 0,
+                       vb2_set_plane_payload(&dst_mb->b->vb2_buf, 0,
                                s5p_mfc_hw_call(dev->mfc_ops, get_enc_strm_size,
                                                dev));
-                       vb2_buffer_done(dst_mb->b, VB2_BUF_STATE_DONE);
+                       vb2_buffer_done(&dst_mb->b->vb2_buf,
+                                       VB2_BUF_STATE_DONE);
                }
                spin_unlock_irqrestore(&dev->irqlock, flags);
        }
@@ -831,16 +832,16 @@ static int enc_pre_frame_start(struct s5p_mfc_ctx *ctx)
 
        spin_lock_irqsave(&dev->irqlock, flags);
        src_mb = list_entry(ctx->src_queue.next, struct s5p_mfc_buf, list);
-       src_y_addr = vb2_dma_contig_plane_dma_addr(src_mb->b, 0);
-       src_c_addr = vb2_dma_contig_plane_dma_addr(src_mb->b, 1);
+       src_y_addr = vb2_dma_contig_plane_dma_addr(&src_mb->b->vb2_buf, 0);
+       src_c_addr = vb2_dma_contig_plane_dma_addr(&src_mb->b->vb2_buf, 1);
        s5p_mfc_hw_call_void(dev->mfc_ops, set_enc_frame_buffer, ctx,
                                                        src_y_addr, src_c_addr);
        spin_unlock_irqrestore(&dev->irqlock, flags);
 
        spin_lock_irqsave(&dev->irqlock, flags);
        dst_mb = list_entry(ctx->dst_queue.next, struct s5p_mfc_buf, list);
-       dst_addr = vb2_dma_contig_plane_dma_addr(dst_mb->b, 0);
-       dst_size = vb2_plane_size(dst_mb->b, 0);
+       dst_addr = vb2_dma_contig_plane_dma_addr(&dst_mb->b->vb2_buf, 0);
+       dst_size = vb2_plane_size(&dst_mb->b->vb2_buf, 0);
        s5p_mfc_hw_call_void(dev->mfc_ops, set_enc_stream_buffer, ctx, dst_addr,
                        dst_size);
        spin_unlock_irqrestore(&dev->irqlock, flags);
@@ -869,25 +870,29 @@ static int enc_post_frame_start(struct s5p_mfc_ctx *ctx)
                s5p_mfc_hw_call_void(dev->mfc_ops, get_enc_frame_buffer, ctx,
                                &enc_y_addr, &enc_c_addr);
                list_for_each_entry(mb_entry, &ctx->src_queue, list) {
-                       mb_y_addr = vb2_dma_contig_plane_dma_addr(mb_entry->b, 0);
-                       mb_c_addr = vb2_dma_contig_plane_dma_addr(mb_entry->b, 1);
+                       mb_y_addr = vb2_dma_contig_plane_dma_addr(
+                                       &mb_entry->b->vb2_buf, 0);
+                       mb_c_addr = vb2_dma_contig_plane_dma_addr(
+                                       &mb_entry->b->vb2_buf, 1);
                        if ((enc_y_addr == mb_y_addr) &&
                                                (enc_c_addr == mb_c_addr)) {
                                list_del(&mb_entry->list);
                                ctx->src_queue_cnt--;
-                               vb2_buffer_done(mb_entry->b,
+                               vb2_buffer_done(&mb_entry->b->vb2_buf,
                                                        VB2_BUF_STATE_DONE);
                                break;
                        }
                }
                list_for_each_entry(mb_entry, &ctx->ref_queue, list) {
-                       mb_y_addr = vb2_dma_contig_plane_dma_addr(mb_entry->b, 0);
-                       mb_c_addr = vb2_dma_contig_plane_dma_addr(mb_entry->b, 1);
+                       mb_y_addr = vb2_dma_contig_plane_dma_addr(
+                                       &mb_entry->b->vb2_buf, 0);
+                       mb_c_addr = vb2_dma_contig_plane_dma_addr(
+                                       &mb_entry->b->vb2_buf, 1);
                        if ((enc_y_addr == mb_y_addr) &&
                                                (enc_c_addr == mb_c_addr)) {
                                list_del(&mb_entry->list);
                                ctx->ref_queue_cnt--;
-                               vb2_buffer_done(mb_entry->b,
+                               vb2_buffer_done(&mb_entry->b->vb2_buf,
                                                        VB2_BUF_STATE_DONE);
                                break;
                        }
@@ -912,17 +917,17 @@ static int enc_post_frame_start(struct s5p_mfc_ctx *ctx)
                ctx->dst_queue_cnt--;
                switch (slice_type) {
                case S5P_FIMV_ENC_SI_SLICE_TYPE_I:
-                       mb_entry->b->v4l2_buf.flags |= V4L2_BUF_FLAG_KEYFRAME;
+                       mb_entry->b->flags |= V4L2_BUF_FLAG_KEYFRAME;
                        break;
                case S5P_FIMV_ENC_SI_SLICE_TYPE_P:
-                       mb_entry->b->v4l2_buf.flags |= V4L2_BUF_FLAG_PFRAME;
+                       mb_entry->b->flags |= V4L2_BUF_FLAG_PFRAME;
                        break;
                case S5P_FIMV_ENC_SI_SLICE_TYPE_B:
-                       mb_entry->b->v4l2_buf.flags |= V4L2_BUF_FLAG_BFRAME;
+                       mb_entry->b->flags |= V4L2_BUF_FLAG_BFRAME;
                        break;
                }
-               vb2_set_plane_payload(mb_entry->b, 0, strm_size);
-               vb2_buffer_done(mb_entry->b, VB2_BUF_STATE_DONE);
+               vb2_set_plane_payload(&mb_entry->b->vb2_buf, 0, strm_size);
+               vb2_buffer_done(&mb_entry->b->vb2_buf, VB2_BUF_STATE_DONE);
        }
        spin_unlock_irqrestore(&dev->irqlock, flags);
        if ((ctx->src_queue_cnt == 0) || (ctx->dst_queue_cnt == 0))
@@ -1806,7 +1811,7 @@ static int check_vb_with_fmt(struct s5p_mfc_fmt *fmt, struct vb2_buffer *vb)
                        return -EINVAL;
                }
                mfc_debug(2, "index: %d, plane[%d] cookie: %pad\n",
-                         vb->v4l2_buf.index, i, &dma);
+                         vb->index, i, &dma);
        }
        return 0;
 }
@@ -1869,6 +1874,7 @@ static int s5p_mfc_queue_setup(struct vb2_queue *vq,
 
 static int s5p_mfc_buf_init(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct vb2_queue *vq = vb->vb2_queue;
        struct s5p_mfc_ctx *ctx = fh_to_ctx(vq->drv_priv);
        unsigned int i;
@@ -1878,8 +1884,8 @@ static int s5p_mfc_buf_init(struct vb2_buffer *vb)
                ret = check_vb_with_fmt(ctx->dst_fmt, vb);
                if (ret < 0)
                        return ret;
-               i = vb->v4l2_buf.index;
-               ctx->dst_bufs[i].b = vb;
+               i = vb->index;
+               ctx->dst_bufs[i].b = vbuf;
                ctx->dst_bufs[i].cookie.stream =
                                        vb2_dma_contig_plane_dma_addr(vb, 0);
                ctx->dst_bufs_cnt++;
@@ -1887,8 +1893,8 @@ static int s5p_mfc_buf_init(struct vb2_buffer *vb)
                ret = check_vb_with_fmt(ctx->src_fmt, vb);
                if (ret < 0)
                        return ret;
-               i = vb->v4l2_buf.index;
-               ctx->src_bufs[i].b = vb;
+               i = vb->index;
+               ctx->src_bufs[i].b = vbuf;
                ctx->src_bufs[i].cookie.raw.luma =
                                        vb2_dma_contig_plane_dma_addr(vb, 0);
                ctx->src_bufs[i].cookie.raw.chroma =
@@ -2012,7 +2018,7 @@ static void s5p_mfc_buf_queue(struct vb2_buffer *vb)
                return;
        }
        if (vq->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
-               mfc_buf = &ctx->dst_bufs[vb->v4l2_buf.index];
+               mfc_buf = &ctx->dst_bufs[vb->index];
                mfc_buf->flags &= ~MFC_BUF_FLAG_USED;
                /* Mark destination as available for use by MFC */
                spin_lock_irqsave(&dev->irqlock, flags);
@@ -2020,7 +2026,7 @@ static void s5p_mfc_buf_queue(struct vb2_buffer *vb)
                ctx->dst_queue_cnt++;
                spin_unlock_irqrestore(&dev->irqlock, flags);
        } else if (vq->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
-               mfc_buf = &ctx->src_bufs[vb->v4l2_buf.index];
+               mfc_buf = &ctx->src_bufs[vb->index];
                mfc_buf->flags &= ~MFC_BUF_FLAG_USED;
                spin_lock_irqsave(&dev->irqlock, flags);
                list_add_tail(&mfc_buf->list, &ctx->src_queue);
index 6402f76cc620d4e7e937cd5d1e20532774b433c3..873c933bc7d4b509a6c0238fa73299a98f4aafd4 100644 (file)
@@ -1208,11 +1208,11 @@ static int s5p_mfc_run_dec_frame(struct s5p_mfc_ctx *ctx, int last_frame)
        temp_vb = list_entry(ctx->src_queue.next, struct s5p_mfc_buf, list);
        temp_vb->flags |= MFC_BUF_FLAG_USED;
        s5p_mfc_set_dec_stream_buffer_v5(ctx,
-               vb2_dma_contig_plane_dma_addr(temp_vb->b, 0),
-               ctx->consumed_stream, temp_vb->b->v4l2_planes[0].bytesused);
+               vb2_dma_contig_plane_dma_addr(&temp_vb->b->vb2_buf, 0),
+               ctx->consumed_stream, temp_vb->b->vb2_buf.planes[0].bytesused);
        spin_unlock_irqrestore(&dev->irqlock, flags);
        dev->curr_ctx = ctx->num;
-       if (temp_vb->b->v4l2_planes[0].bytesused == 0) {
+       if (temp_vb->b->vb2_buf.planes[0].bytesused == 0) {
                last_frame = MFC_DEC_LAST_FRAME;
                mfc_debug(2, "Setting ctx->state to FINISHING\n");
                ctx->state = MFCINST_FINISHING;
@@ -1249,16 +1249,16 @@ static int s5p_mfc_run_enc_frame(struct s5p_mfc_ctx *ctx)
                src_mb = list_entry(ctx->src_queue.next, struct s5p_mfc_buf,
                                                                        list);
                src_mb->flags |= MFC_BUF_FLAG_USED;
-               if (src_mb->b->v4l2_planes[0].bytesused == 0) {
+               if (src_mb->b->vb2_buf.planes[0].bytesused == 0) {
                        /* send null frame */
                        s5p_mfc_set_enc_frame_buffer_v5(ctx, dev->bank2,
                                                                dev->bank2);
                        ctx->state = MFCINST_FINISHING;
                } else {
-                       src_y_addr = vb2_dma_contig_plane_dma_addr(src_mb->b,
-                                                                       0);
-                       src_c_addr = vb2_dma_contig_plane_dma_addr(src_mb->b,
-                                                                       1);
+                       src_y_addr = vb2_dma_contig_plane_dma_addr(
+                                       &src_mb->b->vb2_buf, 0);
+                       src_c_addr = vb2_dma_contig_plane_dma_addr(
+                                       &src_mb->b->vb2_buf, 1);
                        s5p_mfc_set_enc_frame_buffer_v5(ctx, src_y_addr,
                                                                src_c_addr);
                        if (src_mb->flags & MFC_BUF_FLAG_EOS)
@@ -1267,13 +1267,13 @@ static int s5p_mfc_run_enc_frame(struct s5p_mfc_ctx *ctx)
        }
        dst_mb = list_entry(ctx->dst_queue.next, struct s5p_mfc_buf, list);
        dst_mb->flags |= MFC_BUF_FLAG_USED;
-       dst_addr = vb2_dma_contig_plane_dma_addr(dst_mb->b, 0);
-       dst_size = vb2_plane_size(dst_mb->b, 0);
+       dst_addr = vb2_dma_contig_plane_dma_addr(&dst_mb->b->vb2_buf, 0);
+       dst_size = vb2_plane_size(&dst_mb->b->vb2_buf, 0);
        s5p_mfc_set_enc_stream_buffer_v5(ctx, dst_addr, dst_size);
        spin_unlock_irqrestore(&dev->irqlock, flags);
        dev->curr_ctx = ctx->num;
        mfc_debug(2, "encoding buffer with index=%d state=%d\n",
-                 src_mb ? src_mb->b->v4l2_buf.index : -1, ctx->state);
+                 src_mb ? src_mb->b->vb2_buf.index : -1, ctx->state);
        s5p_mfc_encode_one_frame_v5(ctx);
        return 0;
 }
@@ -1289,10 +1289,11 @@ static void s5p_mfc_run_init_dec(struct s5p_mfc_ctx *ctx)
        mfc_debug(2, "Preparing to init decoding\n");
        temp_vb = list_entry(ctx->src_queue.next, struct s5p_mfc_buf, list);
        s5p_mfc_set_dec_desc_buffer(ctx);
-       mfc_debug(2, "Header size: %d\n", temp_vb->b->v4l2_planes[0].bytesused);
+       mfc_debug(2, "Header size: %d\n",
+                       temp_vb->b->vb2_buf.planes[0].bytesused);
        s5p_mfc_set_dec_stream_buffer_v5(ctx,
-                               vb2_dma_contig_plane_dma_addr(temp_vb->b, 0),
-                               0, temp_vb->b->v4l2_planes[0].bytesused);
+                       vb2_dma_contig_plane_dma_addr(&temp_vb->b->vb2_buf, 0),
+                       0, temp_vb->b->vb2_buf.planes[0].bytesused);
        spin_unlock_irqrestore(&dev->irqlock, flags);
        dev->curr_ctx = ctx->num;
        s5p_mfc_init_decode_v5(ctx);
@@ -1309,8 +1310,8 @@ static void s5p_mfc_run_init_enc(struct s5p_mfc_ctx *ctx)
        s5p_mfc_set_enc_ref_buffer_v5(ctx);
        spin_lock_irqsave(&dev->irqlock, flags);
        dst_mb = list_entry(ctx->dst_queue.next, struct s5p_mfc_buf, list);
-       dst_addr = vb2_dma_contig_plane_dma_addr(dst_mb->b, 0);
-       dst_size = vb2_plane_size(dst_mb->b, 0);
+       dst_addr = vb2_dma_contig_plane_dma_addr(&dst_mb->b->vb2_buf, 0);
+       dst_size = vb2_plane_size(&dst_mb->b->vb2_buf, 0);
        s5p_mfc_set_enc_stream_buffer_v5(ctx, dst_addr, dst_size);
        spin_unlock_irqrestore(&dev->irqlock, flags);
        dev->curr_ctx = ctx->num;
@@ -1342,10 +1343,11 @@ static int s5p_mfc_run_init_dec_buffers(struct s5p_mfc_ctx *ctx)
                return -EIO;
        }
        temp_vb = list_entry(ctx->src_queue.next, struct s5p_mfc_buf, list);
-       mfc_debug(2, "Header size: %d\n", temp_vb->b->v4l2_planes[0].bytesused);
+       mfc_debug(2, "Header size: %d\n",
+                       temp_vb->b->vb2_buf.planes[0].bytesused);
        s5p_mfc_set_dec_stream_buffer_v5(ctx,
-                               vb2_dma_contig_plane_dma_addr(temp_vb->b, 0),
-                               0, temp_vb->b->v4l2_planes[0].bytesused);
+                       vb2_dma_contig_plane_dma_addr(&temp_vb->b->vb2_buf, 0),
+                       0, temp_vb->b->vb2_buf.planes[0].bytesused);
        spin_unlock_irqrestore(&dev->irqlock, flags);
        dev->curr_ctx = ctx->num;
        ret = s5p_mfc_set_dec_frame_buffer_v5(ctx);
@@ -1478,9 +1480,9 @@ static void s5p_mfc_cleanup_queue_v5(struct list_head *lh, struct vb2_queue *vq)
 
        while (!list_empty(lh)) {
                b = list_entry(lh->next, struct s5p_mfc_buf, list);
-               for (i = 0; i < b->b->num_planes; i++)
-                       vb2_set_plane_payload(b->b, i, 0);
-               vb2_buffer_done(b->b, VB2_BUF_STATE_ERROR);
+               for (i = 0; i < b->b->vb2_buf.num_planes; i++)
+                       vb2_set_plane_payload(&b->b->vb2_buf, i, 0);
+               vb2_buffer_done(&b->b->vb2_buf, VB2_BUF_STATE_ERROR);
                list_del(&b->list);
        }
 }
index 04f8c7b5a86f4452b0fbb5364e9aa6060859aab5..e0924a5233c8d7e742e6ecf2c6c81bc00a706be4 100644 (file)
@@ -1562,13 +1562,13 @@ static inline int s5p_mfc_run_dec_frame(struct s5p_mfc_ctx *ctx)
        temp_vb = list_entry(ctx->src_queue.next, struct s5p_mfc_buf, list);
        temp_vb->flags |= MFC_BUF_FLAG_USED;
        s5p_mfc_set_dec_stream_buffer_v6(ctx,
-               vb2_dma_contig_plane_dma_addr(temp_vb->b, 0),
-                       ctx->consumed_stream,
-                       temp_vb->b->v4l2_planes[0].bytesused);
+               vb2_dma_contig_plane_dma_addr(&temp_vb->b->vb2_buf, 0),
+               ctx->consumed_stream,
+               temp_vb->b->vb2_buf.planes[0].bytesused);
        spin_unlock_irqrestore(&dev->irqlock, flags);
 
        dev->curr_ctx = ctx->num;
-       if (temp_vb->b->v4l2_planes[0].bytesused == 0) {
+       if (temp_vb->b->vb2_buf.planes[0].bytesused == 0) {
                last_frame = 1;
                mfc_debug(2, "Setting ctx->state to FINISHING\n");
                ctx->state = MFCINST_FINISHING;
@@ -1606,8 +1606,8 @@ static inline int s5p_mfc_run_enc_frame(struct s5p_mfc_ctx *ctx)
 
        src_mb = list_entry(ctx->src_queue.next, struct s5p_mfc_buf, list);
        src_mb->flags |= MFC_BUF_FLAG_USED;
-       src_y_addr = vb2_dma_contig_plane_dma_addr(src_mb->b, 0);
-       src_c_addr = vb2_dma_contig_plane_dma_addr(src_mb->b, 1);
+       src_y_addr = vb2_dma_contig_plane_dma_addr(&src_mb->b->vb2_buf, 0);
+       src_c_addr = vb2_dma_contig_plane_dma_addr(&src_mb->b->vb2_buf, 1);
 
        mfc_debug(2, "enc src y addr: 0x%08lx\n", src_y_addr);
        mfc_debug(2, "enc src c addr: 0x%08lx\n", src_c_addr);
@@ -1616,8 +1616,8 @@ static inline int s5p_mfc_run_enc_frame(struct s5p_mfc_ctx *ctx)
 
        dst_mb = list_entry(ctx->dst_queue.next, struct s5p_mfc_buf, list);
        dst_mb->flags |= MFC_BUF_FLAG_USED;
-       dst_addr = vb2_dma_contig_plane_dma_addr(dst_mb->b, 0);
-       dst_size = vb2_plane_size(dst_mb->b, 0);
+       dst_addr = vb2_dma_contig_plane_dma_addr(&dst_mb->b->vb2_buf, 0);
+       dst_size = vb2_plane_size(&dst_mb->b->vb2_buf, 0);
 
        s5p_mfc_set_enc_stream_buffer_v6(ctx, dst_addr, dst_size);
 
@@ -1639,10 +1639,11 @@ static inline void s5p_mfc_run_init_dec(struct s5p_mfc_ctx *ctx)
        spin_lock_irqsave(&dev->irqlock, flags);
        mfc_debug(2, "Preparing to init decoding.\n");
        temp_vb = list_entry(ctx->src_queue.next, struct s5p_mfc_buf, list);
-       mfc_debug(2, "Header size: %d\n", temp_vb->b->v4l2_planes[0].bytesused);
+       mfc_debug(2, "Header size: %d\n",
+               temp_vb->b->vb2_buf.planes[0].bytesused);
        s5p_mfc_set_dec_stream_buffer_v6(ctx,
-               vb2_dma_contig_plane_dma_addr(temp_vb->b, 0), 0,
-                       temp_vb->b->v4l2_planes[0].bytesused);
+               vb2_dma_contig_plane_dma_addr(&temp_vb->b->vb2_buf, 0), 0,
+               temp_vb->b->vb2_buf.planes[0].bytesused);
        spin_unlock_irqrestore(&dev->irqlock, flags);
        dev->curr_ctx = ctx->num;
        s5p_mfc_init_decode_v6(ctx);
@@ -1659,8 +1660,8 @@ static inline void s5p_mfc_run_init_enc(struct s5p_mfc_ctx *ctx)
        spin_lock_irqsave(&dev->irqlock, flags);
 
        dst_mb = list_entry(ctx->dst_queue.next, struct s5p_mfc_buf, list);
-       dst_addr = vb2_dma_contig_plane_dma_addr(dst_mb->b, 0);
-       dst_size = vb2_plane_size(dst_mb->b, 0);
+       dst_addr = vb2_dma_contig_plane_dma_addr(&dst_mb->b->vb2_buf, 0);
+       dst_size = vb2_plane_size(&dst_mb->b->vb2_buf, 0);
        s5p_mfc_set_enc_stream_buffer_v6(ctx, dst_addr, dst_size);
        spin_unlock_irqrestore(&dev->irqlock, flags);
        dev->curr_ctx = ctx->num;
@@ -1836,9 +1837,9 @@ static void s5p_mfc_cleanup_queue_v6(struct list_head *lh, struct vb2_queue *vq)
 
        while (!list_empty(lh)) {
                b = list_entry(lh->next, struct s5p_mfc_buf, list);
-               for (i = 0; i < b->b->num_planes; i++)
-                       vb2_set_plane_payload(b->b, i, 0);
-               vb2_buffer_done(b->b, VB2_BUF_STATE_ERROR);
+               for (i = 0; i < b->b->vb2_buf.num_planes; i++)
+                       vb2_set_plane_payload(&b->b->vb2_buf, i, 0);
+               vb2_buffer_done(&b->b->vb2_buf, VB2_BUF_STATE_ERROR);
                list_del(&b->list);
        }
 }
index 855b7238adaa7e400484740cca5806372e0ef564..42cd2709c41cc1ad6118f2353d0c71ede8728020 100644 (file)
@@ -113,7 +113,7 @@ struct mxr_geometry {
 /** instance of a buffer */
 struct mxr_buffer {
        /** common v4l buffer stuff -- must be first */
-       struct vb2_buffer       vb;
+       struct vb2_v4l2_buffer vb;
        /** node for layer's lists */
        struct list_head        list;
 };
index 74344c764daad5ebe4fa19011a83d70f5f8751e1..db3163b23ea0bd92d96c2d0d12812eb782764567 100644 (file)
@@ -86,7 +86,7 @@ static void mxr_graph_buffer_set(struct mxr_layer *layer,
        dma_addr_t addr = 0;
 
        if (buf)
-               addr = vb2_dma_contig_plane_dma_addr(&buf->vb, 0);
+               addr = vb2_dma_contig_plane_dma_addr(&buf->vb.vb2_buf, 0);
        mxr_reg_graph_buffer(layer->mdev, layer->idx, addr);
 }
 
index 5127acb1e571c5d140a8d63c3de1377cd096246d..a0ec14a1da13d736f27017f486c3904b3fc3a3fd 100644 (file)
@@ -279,7 +279,7 @@ static void mxr_irq_layer_handle(struct mxr_layer *layer)
        layer->ops.buffer_set(layer, layer->update_buf);
 
        if (done && done != layer->shadow_buf)
-               vb2_buffer_done(&done->vb, VB2_BUF_STATE_DONE);
+               vb2_buffer_done(&done->vb.vb2_buf, VB2_BUF_STATE_DONE);
 
 done:
        spin_unlock(&layer->enq_slock);
index 751f3b618337cea77b7eff822842f95a3ef0f8d9..dba92b54a588df40f6698a0b710179159b0fd807 100644 (file)
@@ -914,7 +914,8 @@ static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *pfmt,
 
 static void buf_queue(struct vb2_buffer *vb)
 {
-       struct mxr_buffer *buffer = container_of(vb, struct mxr_buffer, vb);
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
+       struct mxr_buffer *buffer = container_of(vbuf, struct mxr_buffer, vb);
        struct mxr_layer *layer = vb2_get_drv_priv(vb->vb2_queue);
        struct mxr_device *mdev = layer->mdev;
        unsigned long flags;
@@ -963,11 +964,13 @@ static void mxr_watchdog(unsigned long arg)
        if (layer->update_buf == layer->shadow_buf)
                layer->update_buf = NULL;
        if (layer->update_buf) {
-               vb2_buffer_done(&layer->update_buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&layer->update_buf->vb.vb2_buf,
+                               VB2_BUF_STATE_ERROR);
                layer->update_buf = NULL;
        }
        if (layer->shadow_buf) {
-               vb2_buffer_done(&layer->shadow_buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&layer->shadow_buf->vb.vb2_buf,
+                               VB2_BUF_STATE_ERROR);
                layer->shadow_buf = NULL;
        }
        spin_unlock_irqrestore(&layer->enq_slock, flags);
@@ -991,7 +994,7 @@ static void stop_streaming(struct vb2_queue *vq)
        /* set all buffer to be done */
        list_for_each_entry_safe(buf, buf_tmp, &layer->enq_list, list) {
                list_del(&buf->list);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
        }
 
        spin_unlock_irqrestore(&layer->enq_slock, flags);
index c9388c45ad757b48d42c7b45f7b603d03fdd0b12..dd002a497dbb4993f54084e3ff5fa02c14afcb27 100644 (file)
@@ -97,9 +97,10 @@ static void mxr_vp_buffer_set(struct mxr_layer *layer,
                mxr_reg_vp_buffer(layer->mdev, luma_addr, chroma_addr);
                return;
        }
-       luma_addr[0] = vb2_dma_contig_plane_dma_addr(&buf->vb, 0);
+       luma_addr[0] = vb2_dma_contig_plane_dma_addr(&buf->vb.vb2_buf, 0);
        if (layer->fmt->num_subframes == 2) {
-               chroma_addr[0] = vb2_dma_contig_plane_dma_addr(&buf->vb, 1);
+               chroma_addr[0] =
+                       vb2_dma_contig_plane_dma_addr(&buf->vb.vb2_buf, 1);
        } else {
                /* FIXME: mxr_get_plane_size compute integer division,
                 * which is slow and should not be performed in interrupt */
index f5e3eb3a20ff77823ac2d8dbe1a0caad2454d19d..6455cb9b3224bb4e373c885f8de9ed00b2571418 100644 (file)
@@ -931,9 +931,10 @@ static int sh_veu_buf_prepare(struct vb2_buffer *vb)
 
 static void sh_veu_buf_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct sh_veu_dev *veu = vb2_get_drv_priv(vb->vb2_queue);
-       dev_dbg(veu->dev, "%s(%d)\n", __func__, vb->v4l2_buf.type);
-       v4l2_m2m_buf_queue(veu->m2m_ctx, vb);
+       dev_dbg(veu->dev, "%s(%d)\n", __func__, vb->type);
+       v4l2_m2m_buf_queue(veu->m2m_ctx, vbuf);
 }
 
 static const struct vb2_ops sh_veu_qops = {
@@ -1084,8 +1085,8 @@ static irqreturn_t sh_veu_bh(int irq, void *dev_id)
 static irqreturn_t sh_veu_isr(int irq, void *dev_id)
 {
        struct sh_veu_dev *veu = dev_id;
-       struct vb2_buffer *dst;
-       struct vb2_buffer *src;
+       struct vb2_v4l2_buffer *dst;
+       struct vb2_v4l2_buffer *src;
        u32 status = sh_veu_reg_read(veu, VEU_EVTR);
 
        /* bundle read mode not used */
@@ -1105,11 +1106,11 @@ static irqreturn_t sh_veu_isr(int irq, void *dev_id)
        if (!src || !dst)
                return IRQ_NONE;
 
-       dst->v4l2_buf.timestamp = src->v4l2_buf.timestamp;
-       dst->v4l2_buf.flags &= ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
-       dst->v4l2_buf.flags |=
-               src->v4l2_buf.flags & V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
-       dst->v4l2_buf.timecode = src->v4l2_buf.timecode;
+       dst->timestamp = src->timestamp;
+       dst->flags &= ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
+       dst->flags |=
+               src->flags & V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
+       dst->timecode = src->timecode;
 
        spin_lock(&veu->lock);
        v4l2_m2m_buf_done(src, VB2_BUF_STATE_DONE);
index fe5c8ab06bd5c7e9af78a462f12a34df2b57cbf7..7967a75fde36731575450535afa0aa624fae48e2 100644 (file)
@@ -27,6 +27,7 @@
 #include <media/v4l2-device.h>
 #include <media/v4l2-ioctl.h>
 #include <media/v4l2-mediabus.h>
+#include <media/videobuf2-v4l2.h>
 #include <media/videobuf2-dma-contig.h>
 
 /* Mirror addresses are not available for all registers */
@@ -62,11 +63,12 @@ enum sh_vou_status {
 #define VOU_MIN_IMAGE_HEIGHT   16
 
 struct sh_vou_buffer {
-       struct vb2_buffer vb;
+       struct vb2_v4l2_buffer vb;
        struct list_head list;
 };
 
-static inline struct sh_vou_buffer *to_sh_vou_buffer(struct vb2_buffer *vb2)
+static inline struct
+sh_vou_buffer *to_sh_vou_buffer(struct vb2_v4l2_buffer *vb2)
 {
        return container_of(vb2, struct sh_vou_buffer, vb);
 }
@@ -193,11 +195,11 @@ static struct sh_vou_fmt vou_fmt[] = {
 };
 
 static void sh_vou_schedule_next(struct sh_vou_device *vou_dev,
-                                struct vb2_buffer *vb)
+                                struct vb2_v4l2_buffer *vbuf)
 {
        dma_addr_t addr1, addr2;
 
-       addr1 = vb2_dma_contig_plane_dma_addr(vb, 0);
+       addr1 = vb2_dma_contig_plane_dma_addr(&vbuf->vb2_buf, 0);
        switch (vou_dev->pix.pixelformat) {
        case V4L2_PIX_FMT_NV12:
        case V4L2_PIX_FMT_NV16:
@@ -282,8 +284,9 @@ static int sh_vou_buf_prepare(struct vb2_buffer *vb)
 /* Locking: caller holds fop_lock mutex and vq->irqlock spinlock */
 static void sh_vou_buf_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct sh_vou_device *vou_dev = vb2_get_drv_priv(vb->vb2_queue);
-       struct sh_vou_buffer *shbuf = to_sh_vou_buffer(vb);
+       struct sh_vou_buffer *shbuf = to_sh_vou_buffer(vbuf);
        unsigned long flags;
 
        spin_lock_irqsave(&vou_dev->lock, flags);
@@ -302,7 +305,8 @@ static int sh_vou_start_streaming(struct vb2_queue *vq, unsigned int count)
                                         video, s_stream, 1);
        if (ret < 0 && ret != -ENOIOCTLCMD) {
                list_for_each_entry_safe(buf, node, &vou_dev->buf_list, list) {
-                       vb2_buffer_done(&buf->vb, VB2_BUF_STATE_QUEUED);
+                       vb2_buffer_done(&buf->vb.vb2_buf,
+                                       VB2_BUF_STATE_QUEUED);
                        list_del(&buf->list);
                }
                vou_dev->active = NULL;
@@ -353,7 +357,7 @@ static void sh_vou_stop_streaming(struct vb2_queue *vq)
        msleep(50);
        spin_lock_irqsave(&vou_dev->lock, flags);
        list_for_each_entry_safe(buf, node, &vou_dev->buf_list, list) {
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
                list_del(&buf->list);
        }
        vou_dev->active = NULL;
@@ -1066,10 +1070,10 @@ static irqreturn_t sh_vou_isr(int irq, void *dev_id)
 
        list_del(&vb->list);
 
-       v4l2_get_timestamp(&vb->vb.v4l2_buf.timestamp);
-       vb->vb.v4l2_buf.sequence = vou_dev->sequence++;
-       vb->vb.v4l2_buf.field = V4L2_FIELD_INTERLACED;
-       vb2_buffer_done(&vb->vb, VB2_BUF_STATE_DONE);
+       v4l2_get_timestamp(&vb->vb.timestamp);
+       vb->vb.sequence = vou_dev->sequence++;
+       vb->vb.field = V4L2_FIELD_INTERLACED;
+       vb2_buffer_done(&vb->vb.vb2_buf, VB2_BUF_STATE_DONE);
 
        vou_dev->active = list_entry(vou_dev->buf_list.next,
                                     struct sh_vou_buffer, list);
index 45e304a3dd85b581710915dae81a2a7ed09c1de2..1036f77ab28ab5fb3a6a1137c94c5bfbf20c3261 100644 (file)
@@ -60,7 +60,7 @@ struct isi_dma_desc {
 
 /* Frame buffer data */
 struct frame_buffer {
-       struct vb2_buffer vb;
+       struct vb2_v4l2_buffer vb;
        struct isi_dma_desc *p_dma_desc;
        struct list_head list;
 };
@@ -161,13 +161,13 @@ static bool is_supported(struct soc_camera_device *icd,
 static irqreturn_t atmel_isi_handle_streaming(struct atmel_isi *isi)
 {
        if (isi->active) {
-               struct vb2_buffer *vb = &isi->active->vb;
+               struct vb2_v4l2_buffer *vbuf = &isi->active->vb;
                struct frame_buffer *buf = isi->active;
 
                list_del_init(&buf->list);
-               v4l2_get_timestamp(&vb->v4l2_buf.timestamp);
-               vb->v4l2_buf.sequence = isi->sequence++;
-               vb2_buffer_done(vb, VB2_BUF_STATE_DONE);
+               v4l2_get_timestamp(&vbuf->timestamp);
+               vbuf->sequence = isi->sequence++;
+               vb2_buffer_done(&vbuf->vb2_buf, VB2_BUF_STATE_DONE);
        }
 
        if (list_empty(&isi->video_buffer_list)) {
@@ -277,7 +277,8 @@ static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt,
 
 static int buffer_init(struct vb2_buffer *vb)
 {
-       struct frame_buffer *buf = container_of(vb, struct frame_buffer, vb);
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
+       struct frame_buffer *buf = container_of(vbuf, struct frame_buffer, vb);
 
        buf->p_dma_desc = NULL;
        INIT_LIST_HEAD(&buf->list);
@@ -287,8 +288,9 @@ static int buffer_init(struct vb2_buffer *vb)
 
 static int buffer_prepare(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct soc_camera_device *icd = soc_camera_from_vb2q(vb->vb2_queue);
-       struct frame_buffer *buf = container_of(vb, struct frame_buffer, vb);
+       struct frame_buffer *buf = container_of(vbuf, struct frame_buffer, vb);
        struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
        struct atmel_isi *isi = ici->priv;
        unsigned long size;
@@ -302,7 +304,7 @@ static int buffer_prepare(struct vb2_buffer *vb)
                return -EINVAL;
        }
 
-       vb2_set_plane_payload(&buf->vb, 0, size);
+       vb2_set_plane_payload(vb, 0, size);
 
        if (!buf->p_dma_desc) {
                if (list_empty(&isi->dma_desc_head)) {
@@ -329,10 +331,11 @@ static int buffer_prepare(struct vb2_buffer *vb)
 
 static void buffer_cleanup(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct soc_camera_device *icd = soc_camera_from_vb2q(vb->vb2_queue);
        struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
        struct atmel_isi *isi = ici->priv;
-       struct frame_buffer *buf = container_of(vb, struct frame_buffer, vb);
+       struct frame_buffer *buf = container_of(vbuf, struct frame_buffer, vb);
 
        /* This descriptor is available now and we add to head list */
        if (buf->p_dma_desc)
@@ -370,10 +373,11 @@ static void start_dma(struct atmel_isi *isi, struct frame_buffer *buffer)
 
 static void buffer_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct soc_camera_device *icd = soc_camera_from_vb2q(vb->vb2_queue);
        struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
        struct atmel_isi *isi = ici->priv;
-       struct frame_buffer *buf = container_of(vb, struct frame_buffer, vb);
+       struct frame_buffer *buf = container_of(vbuf, struct frame_buffer, vb);
        unsigned long flags = 0;
 
        spin_lock_irqsave(&isi->lock, flags);
@@ -435,7 +439,7 @@ static void stop_streaming(struct vb2_queue *vq)
        /* Release all active buffers */
        list_for_each_entry_safe(buf, node, &isi->video_buffer_list, list) {
                list_del_init(&buf->list);
-               vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
+               vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
        }
        spin_unlock_irq(&isi->lock);
 
index 6e413359b59538888f4ddccd41e225ea6e8e545a..9079196708b161929cbfe3f0582340f5be26c76a 100644 (file)
@@ -225,7 +225,7 @@ struct mx2_buf_internal {
 /* buffer for one video frame */
 struct mx2_buffer {
        /* common v4l buffer stuff -- must be first */
-       struct vb2_buffer               vb;
+       struct vb2_v4l2_buffer vb;
        struct mx2_buf_internal         internal;
 };
 
@@ -530,11 +530,12 @@ out:
 
 static void mx2_videobuf_queue(struct vb2_buffer *vb)
 {
+       struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
        struct soc_camera_device *icd = soc_camera_from_vb2q(vb->vb2_queue);
        struct soc_camera_host *ici =
                to_soc_camera_host(icd->parent);
        struct mx2_camera_dev *pcdev = ici->priv;
-       struct mx2_buffer *buf = container_of(vb, struct mx2_buffer, vb);
+       struct mx2_buffer *buf = container_of(vbuf, struct mx2_buffer, vb);
        unsigned long flags;
 
        dev_dbg(icd->parent, "%s (vb=0x%p) 0x%p %lu\n", __func__,
@@ -664,7 +665,7 @@ static int mx2_start_streaming(struct vb2_queue *q, unsigned int count)
        buf = list_first_entry(&pcdev->capture, struct mx2_buffer,
                               internal.queue);
        buf->internal.bufnum = 0;
-       vb = &buf->vb;
+       vb = &buf->vb.vb2_buf;
 
        phys = vb2_dma_contig_plane_dma_addr(vb, 0);
        mx27_update_emma_buf(pcdev, phys, buf->internal.bufnum);
@@ -673,7 +674,7 @@ static int mx2_start_streaming(struct vb2_queue *q, unsigned int count)
        buf = list_first_entry(&pcdev->capture, struct mx2_buffer,
                               internal.queue);
        buf->internal.bufnum = 1;
-       vb = &buf->vb;
+       vb = &buf->vb.vb2_buf;
 
        phys = vb2_dma_contig_plane_dma_addr(vb, 0);
        mx27_update_emma_buf(pcdev, phys, buf->internal.bufnum);
@@ -1307,6 +1308,7 @@ static void mx27_camera_frame_done_emma(struct mx2_camera_dev *pcdev,
        struct mx2_buf_internal *ibuf;
        struct mx2_buffer *buf;
        struct vb2_buffer *vb;
+       struct vb2_v4l2_buffer *vbuf;
        unsigned long phys;
 
        ibuf = list_first_entry(&pcdev->active_bufs, struct mx2_buf_internal,
@@ -1323,7 +1325,8 @@ static void mx27_camera_frame_done_emma(struct mx2_camera_dev *pcdev,
        } else {
                buf = mx2_ibuf_to_buf(ibuf);
 
-               vb = &buf->vb;
+               vb = &buf->vb.vb2_buf;
+               vbuf = to_vb2_v4l2_buffer(vb);
 #ifdef DEBUG
                phys = vb2_dma_contig_plane_dma_addr(vb, 0);
                if (prp->cfg.channel == 1) {
@@ -1347,8 +1350,8 @@ static void mx27_camera_frame_done_emma(struct mx2_camera_dev *pcdev,
                                vb2_get_plane_payload(vb, 0));
 
                list_del_init(&buf->internal.queue);
-               v4l2_get_timestamp(&vb->v4l2_buf.timestamp);
-               vb->v4l2_buf.sequence = pcdev->frame_count;
+               v4l2_get_timestamp(&vbuf->timestamp);
+               vbuf->sequence = pcdev->frame_count;
                if (err)
                        vb2_buffer_done(vb, VB2_BUF_STATE_ERROR);
                else
@@ -1380,7 +1383,7 @@ static void mx27_camera_frame_done_emma(struct mx2_camera_dev *pcdev,
 
        list_move_tail(pcdev->capture.next, &pcdev->active_bufs);
 
-       vb = &buf->vb;
+       vb = &buf->vb.vb2_buf;
 
        phys = vb2_dma_contig_plane_dma_addr(vb, 0);
        mx27_update_emma_buf(pcdev, phys, bufnum);
index ace41f53caca3059a0bf42771b278fdff1b027e2..5ea4350ffdd69d42184bc20ab9572fc7252b9863 100644 (file)
@@ -63,7 +63,7 @@
 
 struct mx3_camera_buffer {
        /* common v4l buffer stuff -- must be first */
-       struct vb2_buffer                       vb;
+       struct vb2_v4l2_buffer vb;
        struct list_head                        queue;
 
        /* One descriptot per scatterlist (per frame) */
@@ -133,7 +133,7 @@ static void csi_reg_write(struct mx3_camera_dev *mx3, u32 value, off_t reg)
  &