Commit fc714e70 authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by Mauro Carvalho Chehab

[media] V4L: vb2: prepare to support multi-size buffers

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: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 55093284
...@@ -249,9 +249,9 @@ static int atmel_isi_wait_status(struct atmel_isi *isi, int wait_reset) ...@@ -249,9 +249,9 @@ static int atmel_isi_wait_status(struct atmel_isi *isi, int wait_reset)
/* ------------------------------------------------------------------ /* ------------------------------------------------------------------
Videobuf operations Videobuf operations
------------------------------------------------------------------*/ ------------------------------------------------------------------*/
static int queue_setup(struct vb2_queue *vq, unsigned int *nbuffers, static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt,
unsigned int *nplanes, unsigned int sizes[], unsigned int *nbuffers, unsigned int *nplanes,
void *alloc_ctxs[]) unsigned int sizes[], void *alloc_ctxs[])
{ {
struct soc_camera_device *icd = soc_camera_from_vb2q(vq); struct soc_camera_device *icd = soc_camera_from_vb2q(vq);
struct soc_camera_host *ici = to_soc_camera_host(icd->parent); struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
......
...@@ -883,7 +883,8 @@ static int mcam_read_setup(struct mcam_camera *cam) ...@@ -883,7 +883,8 @@ static int mcam_read_setup(struct mcam_camera *cam)
* Videobuf2 interface code. * 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[], unsigned int *num_planes, unsigned int sizes[],
void *alloc_ctxs[]) void *alloc_ctxs[])
{ {
......
...@@ -738,9 +738,10 @@ static const struct v4l2_ioctl_ops m2mtest_ioctl_ops = { ...@@ -738,9 +738,10 @@ static const struct v4l2_ioctl_ops m2mtest_ioctl_ops = {
* Queue operations * Queue operations
*/ */
static int m2mtest_queue_setup(struct vb2_queue *vq, unsigned int *nbuffers, static int m2mtest_queue_setup(struct vb2_queue *vq,
unsigned int *nplanes, unsigned int sizes[], const struct v4l2_format *fmt,
void *alloc_ctxs[]) unsigned int *nbuffers, unsigned int *nplanes,
unsigned int sizes[], void *alloc_ctxs[])
{ {
struct m2mtest_ctx *ctx = vb2_get_drv_priv(vq); struct m2mtest_ctx *ctx = vb2_get_drv_priv(vq);
struct m2mtest_q_data *q_data; struct m2mtest_q_data *q_data;
......
...@@ -191,6 +191,7 @@ static void mx3_cam_dma_done(void *arg) ...@@ -191,6 +191,7 @@ static void mx3_cam_dma_done(void *arg)
* Calculate the __buffer__ (not data) size and number of buffers. * Calculate the __buffer__ (not data) size and number of buffers.
*/ */
static int mx3_videobuf_setup(struct vb2_queue *vq, static int mx3_videobuf_setup(struct vb2_queue *vq,
const struct v4l2_format *fmt,
unsigned int *count, unsigned int *num_planes, unsigned int *count, unsigned int *num_planes,
unsigned int sizes[], void *alloc_ctxs[]) unsigned int sizes[], void *alloc_ctxs[])
{ {
......
...@@ -744,9 +744,9 @@ static int pwc_video_mmap(struct file *file, struct vm_area_struct *vma) ...@@ -744,9 +744,9 @@ static int pwc_video_mmap(struct file *file, struct vm_area_struct *vma)
/***************************************************************************/ /***************************************************************************/
/* Videobuf2 operations */ /* Videobuf2 operations */
static int queue_setup(struct vb2_queue *vq, unsigned int *nbuffers, static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt,
unsigned int *nplanes, unsigned int sizes[], unsigned int *nbuffers, unsigned int *nplanes,
void *alloc_ctxs[]) unsigned int sizes[], void *alloc_ctxs[])
{ {
struct pwc_device *pdev = vb2_get_drv_priv(vq); struct pwc_device *pdev = vb2_get_drv_priv(vq);
......
...@@ -246,9 +246,9 @@ static unsigned int get_plane_size(struct fimc_frame *fr, unsigned int plane) ...@@ -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; return fr->f_width * fr->f_height * fr->fmt->depth[plane] / 8;
} }
static int queue_setup(struct vb2_queue *vq, unsigned int *num_buffers, static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *pfmt,
unsigned int *num_planes, unsigned int sizes[], unsigned int *num_buffers, unsigned int *num_planes,
void *allocators[]) unsigned int sizes[], void *allocators[])
{ {
struct fimc_ctx *ctx = vq->drv_priv; struct fimc_ctx *ctx = vq->drv_priv;
struct fimc_fmt *fmt = ctx->d_frame.fmt; struct fimc_fmt *fmt = ctx->d_frame.fmt;
......
...@@ -670,9 +670,9 @@ static void fimc_job_abort(void *priv) ...@@ -670,9 +670,9 @@ static void fimc_job_abort(void *priv)
fimc_m2m_shutdown(priv); fimc_m2m_shutdown(priv);
} }
static int fimc_queue_setup(struct vb2_queue *vq, unsigned int *num_buffers, static int fimc_queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt,
unsigned int *num_planes, unsigned int sizes[], unsigned int *num_buffers, unsigned int *num_planes,
void *allocators[]) unsigned int sizes[], void *allocators[])
{ {
struct fimc_ctx *ctx = vb2_get_drv_priv(vq); struct fimc_ctx *ctx = vb2_get_drv_priv(vq);
struct fimc_frame *f; struct fimc_frame *f;
......
...@@ -744,7 +744,8 @@ static const struct v4l2_ioctl_ops s5p_mfc_dec_ioctl_ops = { ...@@ -744,7 +744,8 @@ static const struct v4l2_ioctl_ops s5p_mfc_dec_ioctl_ops = {
.vidioc_g_crop = vidioc_g_crop, .vidioc_g_crop = vidioc_g_crop,
}; };
static int s5p_mfc_queue_setup(struct vb2_queue *vq, unsigned int *buf_count, 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[], unsigned int *plane_count, unsigned int psize[],
void *allocators[]) void *allocators[])
{ {
......
...@@ -1513,6 +1513,7 @@ static int check_vb_with_fmt(struct s5p_mfc_fmt *fmt, struct vb2_buffer *vb) ...@@ -1513,6 +1513,7 @@ 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, 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 *buf_count, unsigned int *plane_count,
unsigned int psize[], void *allocators[]) unsigned int psize[], void *allocators[])
{ {
......
...@@ -727,8 +727,8 @@ static const struct v4l2_file_operations mxr_fops = { ...@@ -727,8 +727,8 @@ static const struct v4l2_file_operations mxr_fops = {
.unlocked_ioctl = video_ioctl2, .unlocked_ioctl = video_ioctl2,
}; };
static int queue_setup(struct vb2_queue *vq, unsigned int *nbuffers, static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *pfmt,
unsigned int *nplanes, unsigned int sizes[], unsigned int *nbuffers, unsigned int *nplanes, unsigned int sizes[],
void *alloc_ctxs[]) void *alloc_ctxs[])
{ {
struct mxr_layer *layer = vb2_get_drv_priv(vq); struct mxr_layer *layer = vb2_get_drv_priv(vq);
......
...@@ -193,6 +193,7 @@ static int sh_mobile_ceu_soft_reset(struct sh_mobile_ceu_dev *pcdev) ...@@ -193,6 +193,7 @@ static int sh_mobile_ceu_soft_reset(struct sh_mobile_ceu_dev *pcdev)
* Videobuf operations * Videobuf operations
*/ */
static int sh_mobile_ceu_videobuf_setup(struct vb2_queue *vq, 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 *count, unsigned int *num_planes,
unsigned int sizes[], void *alloc_ctxs[]) unsigned int sizes[], void *alloc_ctxs[])
{ {
......
...@@ -530,7 +530,7 @@ int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req) ...@@ -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. * Ask the driver how many buffers and planes per buffer it requires.
* Driver also sets the size and allocator context for each plane. * 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); q->plane_sizes, q->alloc_ctx);
if (ret) if (ret)
return ret; return ret;
...@@ -549,8 +549,8 @@ int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req) ...@@ -549,8 +549,8 @@ int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req)
unsigned int orig_num_buffers; unsigned int orig_num_buffers;
orig_num_buffers = num_buffers = ret; orig_num_buffers = num_buffers = ret;
ret = call_qop(q, queue_setup, q, &num_buffers, &num_planes, ret = call_qop(q, queue_setup, q, NULL, &num_buffers,
q->plane_sizes, q->alloc_ctx); &num_planes, q->plane_sizes, q->alloc_ctx);
if (ret) if (ret)
goto free_mem; goto free_mem;
......
...@@ -650,9 +650,9 @@ static void vivi_stop_generating(struct vivi_dev *dev) ...@@ -650,9 +650,9 @@ static void vivi_stop_generating(struct vivi_dev *dev)
/* ------------------------------------------------------------------ /* ------------------------------------------------------------------
Videobuf operations Videobuf operations
------------------------------------------------------------------*/ ------------------------------------------------------------------*/
static int queue_setup(struct vb2_queue *vq, unsigned int *nbuffers, static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt,
unsigned int *nplanes, unsigned int sizes[], unsigned int *nbuffers, unsigned int *nplanes,
void *alloc_ctxs[]) unsigned int sizes[], void *alloc_ctxs[])
{ {
struct vivi_dev *dev = vb2_get_drv_priv(vq); struct vivi_dev *dev = vb2_get_drv_priv(vq);
unsigned long size; unsigned long size;
......
...@@ -218,9 +218,9 @@ struct vb2_buffer { ...@@ -218,9 +218,9 @@ struct vb2_buffer {
* pre-queued buffers before calling STREAMON * pre-queued buffers before calling STREAMON
*/ */
struct vb2_ops { struct vb2_ops {
int (*queue_setup)(struct vb2_queue *q, unsigned int *num_buffers, int (*queue_setup)(struct vb2_queue *q, const struct v4l2_format *fmt,
unsigned int *num_planes, unsigned int sizes[], unsigned int *num_buffers, unsigned int *num_planes,
void *alloc_ctxs[]); unsigned int sizes[], void *alloc_ctxs[]);
void (*wait_prepare)(struct vb2_queue *q); void (*wait_prepare)(struct vb2_queue *q);
void (*wait_finish)(struct vb2_queue *q); void (*wait_finish)(struct vb2_queue *q);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment