diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2016-04-15 08:15:05 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2016-07-08 13:45:07 -0400 |
commit | 36c0f8b32c4bd4f668cedfba6d97afaa84f055fb (patch) | |
tree | fb65309d392241a0ae6733346b38145be971274f /include/media/videobuf2-core.h | |
parent | 2548fee63d9eb43299dacd0ca30dd9d8f407d795 (diff) |
[media] vb2: replace void *alloc_ctxs by struct device *alloc_devs
Make this a proper typed array. Drop the old allocate context code since
that is no longer used.
Note that the memops functions now get a struct device pointer instead of
the struct device ** that was there initially (actually a void pointer to
a struct containing only a struct device pointer).
This code is now a lot cleaner.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'include/media/videobuf2-core.h')
-rw-r--r-- | include/media/videobuf2-core.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index d38668c2ea06..bea81c9e3758 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h | |||
@@ -56,7 +56,7 @@ struct vb2_threadio_data; | |||
56 | * @put_userptr: inform the allocator that a USERPTR buffer will no longer | 56 | * @put_userptr: inform the allocator that a USERPTR buffer will no longer |
57 | * be used. | 57 | * be used. |
58 | * @attach_dmabuf: attach a shared struct dma_buf for a hardware operation; | 58 | * @attach_dmabuf: attach a shared struct dma_buf for a hardware operation; |
59 | * used for DMABUF memory types; alloc_ctx is the alloc context | 59 | * used for DMABUF memory types; dev is the alloc device |
60 | * dbuf is the shared dma_buf; returns NULL on failure; | 60 | * dbuf is the shared dma_buf; returns NULL on failure; |
61 | * allocator private per-buffer structure on success; | 61 | * allocator private per-buffer structure on success; |
62 | * this needs to be used for further accesses to the buffer. | 62 | * this needs to be used for further accesses to the buffer. |
@@ -92,13 +92,13 @@ struct vb2_threadio_data; | |||
92 | * unmap_dmabuf. | 92 | * unmap_dmabuf. |
93 | */ | 93 | */ |
94 | struct vb2_mem_ops { | 94 | struct vb2_mem_ops { |
95 | void *(*alloc)(void *alloc_ctx, const struct dma_attrs *attrs, | 95 | void *(*alloc)(struct device *dev, const struct dma_attrs *attrs, |
96 | unsigned long size, enum dma_data_direction dma_dir, | 96 | unsigned long size, enum dma_data_direction dma_dir, |
97 | gfp_t gfp_flags); | 97 | gfp_t gfp_flags); |
98 | void (*put)(void *buf_priv); | 98 | void (*put)(void *buf_priv); |
99 | struct dma_buf *(*get_dmabuf)(void *buf_priv, unsigned long flags); | 99 | struct dma_buf *(*get_dmabuf)(void *buf_priv, unsigned long flags); |
100 | 100 | ||
101 | void *(*get_userptr)(void *alloc_ctx, unsigned long vaddr, | 101 | void *(*get_userptr)(struct device *dev, unsigned long vaddr, |
102 | unsigned long size, | 102 | unsigned long size, |
103 | enum dma_data_direction dma_dir); | 103 | enum dma_data_direction dma_dir); |
104 | void (*put_userptr)(void *buf_priv); | 104 | void (*put_userptr)(void *buf_priv); |
@@ -106,7 +106,7 @@ struct vb2_mem_ops { | |||
106 | void (*prepare)(void *buf_priv); | 106 | void (*prepare)(void *buf_priv); |
107 | void (*finish)(void *buf_priv); | 107 | void (*finish)(void *buf_priv); |
108 | 108 | ||
109 | void *(*attach_dmabuf)(void *alloc_ctx, struct dma_buf *dbuf, | 109 | void *(*attach_dmabuf)(struct device *dev, struct dma_buf *dbuf, |
110 | unsigned long size, | 110 | unsigned long size, |
111 | enum dma_data_direction dma_dir); | 111 | enum dma_data_direction dma_dir); |
112 | void (*detach_dmabuf)(void *buf_priv); | 112 | void (*detach_dmabuf)(void *buf_priv); |
@@ -281,7 +281,7 @@ struct vb2_buffer { | |||
281 | * in *num_buffers, the required number of planes per | 281 | * in *num_buffers, the required number of planes per |
282 | * buffer in *num_planes, the size of each plane should be | 282 | * buffer in *num_planes, the size of each plane should be |
283 | * set in the sizes[] array and optional per-plane | 283 | * set in the sizes[] array and optional per-plane |
284 | * allocator specific context in the alloc_ctxs[] array. | 284 | * allocator specific device in the alloc_devs[] array. |
285 | * When called from VIDIOC_REQBUFS, *num_planes == 0, the | 285 | * When called from VIDIOC_REQBUFS, *num_planes == 0, the |
286 | * driver has to use the currently configured format to | 286 | * driver has to use the currently configured format to |
287 | * determine the plane sizes and *num_buffers is the total | 287 | * determine the plane sizes and *num_buffers is the total |
@@ -355,7 +355,7 @@ struct vb2_buffer { | |||
355 | struct vb2_ops { | 355 | struct vb2_ops { |
356 | int (*queue_setup)(struct vb2_queue *q, | 356 | int (*queue_setup)(struct vb2_queue *q, |
357 | unsigned int *num_buffers, unsigned int *num_planes, | 357 | unsigned int *num_buffers, unsigned int *num_planes, |
358 | unsigned int sizes[], void *alloc_ctxs[]); | 358 | unsigned int sizes[], struct device *alloc_devs[]); |
359 | 359 | ||
360 | void (*wait_prepare)(struct vb2_queue *q); | 360 | void (*wait_prepare)(struct vb2_queue *q); |
361 | void (*wait_finish)(struct vb2_queue *q); | 361 | void (*wait_finish)(struct vb2_queue *q); |
@@ -401,7 +401,7 @@ struct vb2_buf_ops { | |||
401 | * the V4L2_BUF_TYPE_* in include/uapi/linux/videodev2.h | 401 | * the V4L2_BUF_TYPE_* in include/uapi/linux/videodev2.h |
402 | * @io_modes: supported io methods (see vb2_io_modes enum) | 402 | * @io_modes: supported io methods (see vb2_io_modes enum) |
403 | * @dev: device to use for the default allocation context if the driver | 403 | * @dev: device to use for the default allocation context if the driver |
404 | * doesn't fill in the @alloc_ctx array. | 404 | * doesn't fill in the @alloc_devs array. |
405 | * @dma_attrs: DMA attributes to use for the DMA. May be NULL. | 405 | * @dma_attrs: DMA attributes to use for the DMA. May be NULL. |
406 | * @fileio_read_once: report EOF after reading the first buffer | 406 | * @fileio_read_once: report EOF after reading the first buffer |
407 | * @fileio_write_immediately: queue buffer after each write() call | 407 | * @fileio_write_immediately: queue buffer after each write() call |
@@ -449,7 +449,7 @@ struct vb2_buf_ops { | |||
449 | * @done_list: list of buffers ready to be dequeued to userspace | 449 | * @done_list: list of buffers ready to be dequeued to userspace |
450 | * @done_lock: lock to protect done_list list | 450 | * @done_lock: lock to protect done_list list |
451 | * @done_wq: waitqueue for processes waiting for buffers ready to be dequeued | 451 | * @done_wq: waitqueue for processes waiting for buffers ready to be dequeued |
452 | * @alloc_ctx: memory type/allocator-specific contexts for each plane | 452 | * @alloc_devs: memory type/allocator-specific per-plane device |
453 | * @streaming: current streaming state | 453 | * @streaming: current streaming state |
454 | * @start_streaming_called: start_streaming() was called successfully and we | 454 | * @start_streaming_called: start_streaming() was called successfully and we |
455 | * started streaming. | 455 | * started streaming. |
@@ -503,7 +503,7 @@ struct vb2_queue { | |||
503 | spinlock_t done_lock; | 503 | spinlock_t done_lock; |
504 | wait_queue_head_t done_wq; | 504 | wait_queue_head_t done_wq; |
505 | 505 | ||
506 | void *alloc_ctx[VB2_MAX_PLANES]; | 506 | struct device *alloc_devs[VB2_MAX_PLANES]; |
507 | 507 | ||
508 | unsigned int streaming:1; | 508 | unsigned int streaming:1; |
509 | unsigned int start_streaming_called:1; | 509 | unsigned int start_streaming_called:1; |