[media] V4L: vb2: prepare to support multi-size buffers
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Wed, 24 Aug 2011 13:30:21 +0000 (10:30 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 3 Nov 2011 20:28:28 +0000 (18:28 -0200)
In preparation for the forthcoming VIDIOC_CREATE_BUFS ioctl add a
"const struct v4l2_format *" argument to the .queue_setup() vb2
operation.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
14 files changed:
drivers/media/video/atmel-isi.c
drivers/media/video/marvell-ccic/mcam-core.c
drivers/media/video/mem2mem_testdev.c
drivers/media/video/mx3_camera.c
drivers/media/video/pwc/pwc-if.c
drivers/media/video/s5p-fimc/fimc-capture.c
drivers/media/video/s5p-fimc/fimc-core.c
drivers/media/video/s5p-mfc/s5p_mfc_dec.c
drivers/media/video/s5p-mfc/s5p_mfc_enc.c
drivers/media/video/s5p-tv/mixer_video.c
drivers/media/video/sh_mobile_ceu_camera.c
drivers/media/video/videobuf2-core.c
drivers/media/video/vivi.c
include/media/videobuf2-core.h

index 06f6595a1c9a8faa97ff734c383875d6a545abb0..8c775c59e120f30589d520c49d75b18fd9a397fa 100644 (file)
@@ -249,9 +249,9 @@ static int atmel_isi_wait_status(struct atmel_isi *isi, int wait_reset)
 /* ------------------------------------------------------------------
        Videobuf operations
    ------------------------------------------------------------------*/
-static int queue_setup(struct vb2_queue *vq, unsigned int *nbuffers,
-                               unsigned int *nplanes, unsigned int sizes[],
-                               void *alloc_ctxs[])
+static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt,
+                               unsigned int *nbuffers, unsigned int *nplanes,
+                               unsigned int sizes[], void *alloc_ctxs[])
 {
        struct soc_camera_device *icd = soc_camera_from_vb2q(vq);
        struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
index 1141b976dff47bf3bd56fe1445d652cf601a81a9..80ec64d2d6d87f8e8fc4dcf4d6da81d67400fbc6 100644 (file)
@@ -883,7 +883,8 @@ static int mcam_read_setup(struct mcam_camera *cam)
  * Videobuf2 interface code.
  */
 
-static int mcam_vb_queue_setup(struct vb2_queue *vq, unsigned int *nbufs,
+static int mcam_vb_queue_setup(struct vb2_queue *vq,
+               const struct v4l2_format *fmt, unsigned int *nbufs,
                unsigned int *num_planes, unsigned int sizes[],
                void *alloc_ctxs[])
 {
index 9594b52f86059d533f179d350c55d322294c4a68..12897e8a33145f73ebf2f49be04b6d507f2fbee5 100644 (file)
@@ -738,9 +738,10 @@ static const struct v4l2_ioctl_ops m2mtest_ioctl_ops = {
  * Queue operations
  */
 
-static int m2mtest_queue_setup(struct vb2_queue *vq, unsigned int *nbuffers,
-                               unsigned int *nplanes, unsigned int sizes[],
-                               void *alloc_ctxs[])
+static int m2mtest_queue_setup(struct vb2_queue *vq,
+                               const struct v4l2_format *fmt,
+                               unsigned int *nbuffers, unsigned int *nplanes,
+                               unsigned int sizes[], void *alloc_ctxs[])
 {
        struct m2mtest_ctx *ctx = vb2_get_drv_priv(vq);
        struct m2mtest_q_data *q_data;
index f4ef6b993ff14e006e5be026b87ccc4c8be23887..24c2fe0714c556899cf2db73c9c4daa2d888bb78 100644 (file)
@@ -191,6 +191,7 @@ static void mx3_cam_dma_done(void *arg)
  * Calculate the __buffer__ (not data) size and number of buffers.
  */
 static int mx3_videobuf_setup(struct vb2_queue *vq,
+                       const struct v4l2_format *fmt,
                        unsigned int *count, unsigned int *num_planes,
                        unsigned int sizes[], void *alloc_ctxs[])
 {
index 360be226718de37f39bcb02d4c66d1a1b1532169..01ff643e682dd8a7c9c20a79c980d8509b4b90a1 100644 (file)
@@ -744,9 +744,9 @@ static int pwc_video_mmap(struct file *file, struct vm_area_struct *vma)
 /***************************************************************************/
 /* Videobuf2 operations */
 
-static int queue_setup(struct vb2_queue *vq, unsigned int *nbuffers,
-                               unsigned int *nplanes, unsigned int sizes[],
-                               void *alloc_ctxs[])
+static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt,
+                               unsigned int *nbuffers, unsigned int *nplanes,
+                               unsigned int sizes[], void *alloc_ctxs[])
 {
        struct pwc_device *pdev = vb2_get_drv_priv(vq);
 
index 931f469604b06d32e4b500a048f91528b8ed63b8..c8d91b0cd9bdd043e54e2ed47391a5736bda61ad 100644 (file)
@@ -246,9 +246,9 @@ static unsigned int get_plane_size(struct fimc_frame *fr, unsigned int plane)
        return fr->f_width * fr->f_height * fr->fmt->depth[plane] / 8;
 }
 
-static int queue_setup(struct vb2_queue *vq, unsigned int *num_buffers,
-                      unsigned int *num_planes, unsigned int sizes[],
-                      void *allocators[])
+static int queue_setup(struct vb2_queue *vq,  const struct v4l2_format *pfmt,
+                      unsigned int *num_buffers, unsigned int *num_planes,
+                      unsigned int sizes[], void *allocators[])
 {
        struct fimc_ctx *ctx = vq->drv_priv;
        struct fimc_fmt *fmt = ctx->d_frame.fmt;
index 6c1c9cb5537840bc1fb25ad057e100c093e870be..19ca6db38b2f87f7951fe423cfe6741d3733acac 100644 (file)
@@ -670,9 +670,9 @@ static void fimc_job_abort(void *priv)
        fimc_m2m_shutdown(priv);
 }
 
-static int fimc_queue_setup(struct vb2_queue *vq, unsigned int *num_buffers,
-                           unsigned int *num_planes, unsigned int sizes[],
-                           void *allocators[])
+static int fimc_queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt,
+                           unsigned int *num_buffers, unsigned int *num_planes,
+                           unsigned int sizes[], void *allocators[])
 {
        struct fimc_ctx *ctx = vb2_get_drv_priv(vq);
        struct fimc_frame *f;
index bfbe08432050af205ca19d46e7abcfd073ee2df8..725634d9736d5de28e1dd9f35719515abf6e5508 100644 (file)
@@ -744,9 +744,10 @@ static const struct v4l2_ioctl_ops s5p_mfc_dec_ioctl_ops = {
        .vidioc_g_crop = vidioc_g_crop,
 };
 
-static int s5p_mfc_queue_setup(struct vb2_queue *vq, unsigned int *buf_count,
-                              unsigned int *plane_count, unsigned int psize[],
-                              void *allocators[])
+static int s5p_mfc_queue_setup(struct vb2_queue *vq,
+                       const struct v4l2_format *fmt, unsigned int *buf_count,
+                       unsigned int *plane_count, unsigned int psize[],
+                       void *allocators[])
 {
        struct s5p_mfc_ctx *ctx = fh_to_ctx(vq->drv_priv);
 
index 4c90e53bd96467675c7ab7155773ec7bf590d6c2..ecef127dbc66faf3a949360882a424d4c1c49182 100644 (file)
@@ -1513,8 +1513,9 @@ static int check_vb_with_fmt(struct s5p_mfc_fmt *fmt, struct vb2_buffer *vb)
 }
 
 static int s5p_mfc_queue_setup(struct vb2_queue *vq,
-                      unsigned int *buf_count, unsigned int *plane_count,
-                      unsigned int psize[], void *allocators[])
+                       const struct v4l2_format *fmt,
+                       unsigned int *buf_count, unsigned int *plane_count,
+                       unsigned int psize[], void *allocators[])
 {
        struct s5p_mfc_ctx *ctx = fh_to_ctx(vq->drv_priv);
 
index 4917e2c2b321ee8a74b7528b732e2807e4ff04cb..e16d3a4bc1dcc0a0c4522e252b61a53d0e8e78d6 100644 (file)
@@ -727,8 +727,8 @@ static const struct v4l2_file_operations mxr_fops = {
        .unlocked_ioctl = video_ioctl2,
 };
 
-static int queue_setup(struct vb2_queue *vq, unsigned int *nbuffers,
-       unsigned int *nplanes, unsigned int sizes[],
+static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *pfmt,
+       unsigned int *nbuffers, unsigned int *nplanes, unsigned int sizes[],
        void *alloc_ctxs[])
 {
        struct mxr_layer *layer = vb2_get_drv_priv(vq);
index 5c8ddd821df604405b43061dc8c12b4e9ca311ff..0cb19689cfe8d71f792eea1762ae50e8341f90f5 100644 (file)
@@ -193,6 +193,7 @@ static int sh_mobile_ceu_soft_reset(struct sh_mobile_ceu_dev *pcdev)
  *  Videobuf operations
  */
 static int sh_mobile_ceu_videobuf_setup(struct vb2_queue *vq,
+                       const struct v4l2_format *fmt,
                        unsigned int *count, unsigned int *num_planes,
                        unsigned int sizes[], void *alloc_ctxs[])
 {
index 82b51be3ca720eb012a0ccaaf6f8984deca74b3e..f04f27d68cec95b6e2315199d7f71f37bb88aa9f 100644 (file)
@@ -530,7 +530,7 @@ int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req)
         * Ask the driver how many buffers and planes per buffer it requires.
         * Driver also sets the size and allocator context for each plane.
         */
-       ret = call_qop(q, queue_setup, q, &num_buffers, &num_planes,
+       ret = call_qop(q, queue_setup, q, NULL, &num_buffers, &num_planes,
                       q->plane_sizes, q->alloc_ctx);
        if (ret)
                return ret;
@@ -549,8 +549,8 @@ int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req)
                unsigned int orig_num_buffers;
 
                orig_num_buffers = num_buffers = ret;
-               ret = call_qop(q, queue_setup, q, &num_buffers, &num_planes,
-                              q->plane_sizes, q->alloc_ctx);
+               ret = call_qop(q, queue_setup, q, NULL, &num_buffers,
+                              &num_planes, q->plane_sizes, q->alloc_ctx);
                if (ret)
                        goto free_mem;
 
index 7cf94c09d99ab54d75b7ccf2668b0dbf200ac567..7d754fbcccbf78761b0185fdd2304513c70999af 100644 (file)
@@ -650,9 +650,9 @@ static void vivi_stop_generating(struct vivi_dev *dev)
 /* ------------------------------------------------------------------
        Videobuf operations
    ------------------------------------------------------------------*/
-static int queue_setup(struct vb2_queue *vq, unsigned int *nbuffers,
-                               unsigned int *nplanes, unsigned int sizes[],
-                               void *alloc_ctxs[])
+static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt,
+                               unsigned int *nbuffers, unsigned int *nplanes,
+                               unsigned int sizes[], void *alloc_ctxs[])
 {
        struct vivi_dev *dev = vb2_get_drv_priv(vq);
        unsigned long size;
index dbd10acc8e80b634378db20023644b8fca8ab355..692e35c232a9b46fcce45867e9c96e8d16eeda7a 100644 (file)
@@ -218,9 +218,9 @@ struct vb2_buffer {
  *                     pre-queued buffers before calling STREAMON
  */
 struct vb2_ops {
-       int (*queue_setup)(struct vb2_queue *q, unsigned int *num_buffers,
-                          unsigned int *num_planes, unsigned int sizes[],
-                          void *alloc_ctxs[]);
+       int (*queue_setup)(struct vb2_queue *q, const struct v4l2_format *fmt,
+                          unsigned int *num_buffers, unsigned int *num_planes,
+                          unsigned int sizes[], void *alloc_ctxs[]);
 
        void (*wait_prepare)(struct vb2_queue *q);
        void (*wait_finish)(struct vb2_queue *q);