diff options
Diffstat (limited to 'include/media/videobuf2-core.h')
| -rw-r--r-- | include/media/videobuf2-core.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index 22f3ff76a8b5..640aabe69450 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h | |||
| @@ -54,7 +54,8 @@ struct vb2_threadio_data; | |||
| 54 | * will then be passed as @buf_priv argument to other ops in this | 54 | * will then be passed as @buf_priv argument to other ops in this |
| 55 | * structure. Additional gfp_flags to use when allocating the | 55 | * structure. Additional gfp_flags to use when allocating the |
| 56 | * are also passed to this operation. These flags are from the | 56 | * are also passed to this operation. These flags are from the |
| 57 | * gfp_flags field of vb2_queue. | 57 | * gfp_flags field of vb2_queue. The size argument to this function |
| 58 | * shall be *page aligned*. | ||
| 58 | * @put: inform the allocator that the buffer will no longer be used; | 59 | * @put: inform the allocator that the buffer will no longer be used; |
| 59 | * usually will result in the allocator freeing the buffer (if | 60 | * usually will result in the allocator freeing the buffer (if |
| 60 | * no other users of this buffer are present); the @buf_priv | 61 | * no other users of this buffer are present); the @buf_priv |
| @@ -1162,6 +1163,24 @@ static inline void vb2_clear_last_buffer_dequeued(struct vb2_queue *q) | |||
| 1162 | q->last_buffer_dequeued = false; | 1163 | q->last_buffer_dequeued = false; |
| 1163 | } | 1164 | } |
| 1164 | 1165 | ||
| 1166 | /** | ||
| 1167 | * vb2_get_buffer() - get a buffer from a queue | ||
| 1168 | * @q: pointer to &struct vb2_queue with videobuf2 queue. | ||
| 1169 | * @index: buffer index | ||
| 1170 | * | ||
| 1171 | * This function obtains a buffer from a queue, by its index. | ||
| 1172 | * Keep in mind that there is no refcounting involved in this | ||
| 1173 | * operation, so the buffer lifetime should be taken into | ||
| 1174 | * consideration. | ||
| 1175 | */ | ||
| 1176 | static inline struct vb2_buffer *vb2_get_buffer(struct vb2_queue *q, | ||
| 1177 | unsigned int index) | ||
| 1178 | { | ||
| 1179 | if (index < q->num_buffers) | ||
| 1180 | return q->bufs[index]; | ||
| 1181 | return NULL; | ||
| 1182 | } | ||
| 1183 | |||
| 1165 | /* | 1184 | /* |
| 1166 | * The following functions are not part of the vb2 core API, but are useful | 1185 | * The following functions are not part of the vb2 core API, but are useful |
| 1167 | * functions for videobuf2-*. | 1186 | * functions for videobuf2-*. |
