diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2013-03-01 13:44:20 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-03-21 12:17:51 -0400 |
commit | b6ba2057f7823352bbc44ee846faa03b36e8b6ac (patch) | |
tree | 130c5bafcd2e497c45d8a1e5e9e764dc88bff00c /include/media | |
parent | 808d24d6c0b5c30c8f804b251caf476ea63954ef (diff) |
[media] videobuf2: add gfp_flags
Some drivers have special memory requirements for their buffers, usually
related to DMA (e.g. GFP_DMA or __GFP_DMA32). Make it possible to specify
additional GFP flags for those buffers by adding a gfp_flags field to
vb2_queue.
Note that this field will be replaced in the future with a different
mechanism, but that is still work in progress and we need this feature
now so we won't be able to convert drivers with such requirements to vb2.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Federico Vaga <federico.vaga@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'include/media')
-rw-r--r-- | include/media/videobuf2-core.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index a2d427450780..d88a098d1aff 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h | |||
@@ -27,7 +27,9 @@ struct vb2_fileio_data; | |||
27 | * return NULL on failure or a pointer to allocator private, | 27 | * return NULL on failure or a pointer to allocator private, |
28 | * per-buffer data on success; the returned private structure | 28 | * per-buffer data on success; the returned private structure |
29 | * will then be passed as buf_priv argument to other ops in this | 29 | * will then be passed as buf_priv argument to other ops in this |
30 | * structure | 30 | * structure. Additional gfp_flags to use when allocating the |
31 | * are also passed to this operation. These flags are from the | ||
32 | * gfp_flags field of vb2_queue. | ||
31 | * @put: inform the allocator that the buffer will no longer be used; | 33 | * @put: inform the allocator that the buffer will no longer be used; |
32 | * usually will result in the allocator freeing the buffer (if | 34 | * usually will result in the allocator freeing the buffer (if |
33 | * no other users of this buffer are present); the buf_priv | 35 | * no other users of this buffer are present); the buf_priv |
@@ -79,7 +81,7 @@ struct vb2_fileio_data; | |||
79 | * unmap_dmabuf. | 81 | * unmap_dmabuf. |
80 | */ | 82 | */ |
81 | struct vb2_mem_ops { | 83 | struct vb2_mem_ops { |
82 | void *(*alloc)(void *alloc_ctx, unsigned long size); | 84 | void *(*alloc)(void *alloc_ctx, unsigned long size, gfp_t gfp_flags); |
83 | void (*put)(void *buf_priv); | 85 | void (*put)(void *buf_priv); |
84 | struct dma_buf *(*get_dmabuf)(void *buf_priv); | 86 | struct dma_buf *(*get_dmabuf)(void *buf_priv); |
85 | 87 | ||
@@ -302,6 +304,9 @@ struct v4l2_fh; | |||
302 | * @buf_struct_size: size of the driver-specific buffer structure; | 304 | * @buf_struct_size: size of the driver-specific buffer structure; |
303 | * "0" indicates the driver doesn't want to use a custom buffer | 305 | * "0" indicates the driver doesn't want to use a custom buffer |
304 | * structure type, so sizeof(struct vb2_buffer) will is used | 306 | * structure type, so sizeof(struct vb2_buffer) will is used |
307 | * @gfp_flags: additional gfp flags used when allocating the buffers. | ||
308 | * Typically this is 0, but it may be e.g. GFP_DMA or __GFP_DMA32 | ||
309 | * to force the buffer allocation to a specific memory zone. | ||
305 | * | 310 | * |
306 | * @memory: current memory type used | 311 | * @memory: current memory type used |
307 | * @bufs: videobuf buffer structures | 312 | * @bufs: videobuf buffer structures |
@@ -327,6 +332,7 @@ struct vb2_queue { | |||
327 | void *drv_priv; | 332 | void *drv_priv; |
328 | unsigned int buf_struct_size; | 333 | unsigned int buf_struct_size; |
329 | u32 timestamp_type; | 334 | u32 timestamp_type; |
335 | gfp_t gfp_flags; | ||
330 | 336 | ||
331 | /* private: internal use only */ | 337 | /* private: internal use only */ |
332 | enum v4l2_memory memory; | 338 | enum v4l2_memory memory; |