aboutsummaryrefslogtreecommitdiffstats
path: root/include/media
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@s-opensource.com>2016-09-08 13:08:34 -0400
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-09-09 09:17:39 -0400
commitf286f4dfc50a9f4d777534794a773eb4fbbedd72 (patch)
tree362c22b5517bba950cbdbc9e5a26268ac6255ea3 /include/media
parent52839f66edde1ed709390b55a0d3f82593203308 (diff)
[media] videobuf2-core.h: improve documentation
There are several small issues with the documentation. Fix them, in order to avoid producing warnings. While here, also make checkpatch.pl happy. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'include/media')
-rw-r--r--include/media/videobuf2-core.h143
1 files changed, 85 insertions, 58 deletions
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index 65eeca83687a..9a144f2d9083 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -49,13 +49,13 @@ struct vb2_threadio_data;
49 * @alloc: allocate video memory and, optionally, allocator private data, 49 * @alloc: allocate video memory and, optionally, allocator private data,
50 * return ERR_PTR() on failure or a pointer to allocator private, 50 * return ERR_PTR() on failure or a pointer to allocator private,
51 * per-buffer data on success; the returned private structure 51 * per-buffer data on success; the returned private structure
52 * will then be passed as buf_priv argument to other ops in this 52 * will then be passed as @buf_priv argument to other ops in this
53 * structure. Additional gfp_flags to use when allocating the 53 * structure. Additional gfp_flags to use when allocating the
54 * are also passed to this operation. These flags are from the 54 * are also passed to this operation. These flags are from the
55 * gfp_flags field of vb2_queue. 55 * gfp_flags field of vb2_queue.
56 * @put: inform the allocator that the buffer will no longer be used; 56 * @put: inform the allocator that the buffer will no longer be used;
57 * usually will result in the allocator freeing the buffer (if 57 * usually will result in the allocator freeing the buffer (if
58 * no other users of this buffer are present); the buf_priv 58 * no other users of this buffer are present); the @buf_priv
59 * argument is the allocator private per-buffer structure 59 * argument is the allocator private per-buffer structure
60 * previously returned from the alloc callback. 60 * previously returned from the alloc callback.
61 * @get_dmabuf: acquire userspace memory for a hardware operation; used for 61 * @get_dmabuf: acquire userspace memory for a hardware operation; used for
@@ -65,7 +65,7 @@ struct vb2_threadio_data;
65 * videobuf layer when queuing a video buffer of USERPTR type; 65 * videobuf layer when queuing a video buffer of USERPTR type;
66 * should return an allocator private per-buffer structure 66 * should return an allocator private per-buffer structure
67 * associated with the buffer on success, ERR_PTR() on failure; 67 * associated with the buffer on success, ERR_PTR() on failure;
68 * the returned private structure will then be passed as buf_priv 68 * the returned private structure will then be passed as @buf_priv
69 * argument to other ops in this structure. 69 * argument to other ops in this structure.
70 * @put_userptr: inform the allocator that a USERPTR buffer will no longer 70 * @put_userptr: inform the allocator that a USERPTR buffer will no longer
71 * be used. 71 * be used.
@@ -75,7 +75,7 @@ struct vb2_threadio_data;
75 * allocator private per-buffer structure on success; 75 * allocator private per-buffer structure on success;
76 * this needs to be used for further accesses to the buffer. 76 * this needs to be used for further accesses to the buffer.
77 * @detach_dmabuf: inform the exporter of the buffer that the current DMABUF 77 * @detach_dmabuf: inform the exporter of the buffer that the current DMABUF
78 * buffer is no longer used; the buf_priv argument is the 78 * buffer is no longer used; the @buf_priv argument is the
79 * allocator private per-buffer structure previously returned 79 * allocator private per-buffer structure previously returned
80 * from the attach_dmabuf callback. 80 * from the attach_dmabuf callback.
81 * @map_dmabuf: request for access to the dmabuf from allocator; the allocator 81 * @map_dmabuf: request for access to the dmabuf from allocator; the allocator
@@ -109,11 +109,13 @@ struct vb2_threadio_data;
109 * 109 *
110 * #) Required ops for read/write access types: alloc, put, num_users, vaddr. 110 * #) Required ops for read/write access types: alloc, put, num_users, vaddr.
111 * 111 *
112 * #) Required ops for DMABUF types: attach_dmabuf, detach_dmabuf, map_dmabuf, unmap_dmabuf. 112 * #) Required ops for DMABUF types: attach_dmabuf, detach_dmabuf,
113 * map_dmabuf, unmap_dmabuf.
113 */ 114 */
114struct vb2_mem_ops { 115struct vb2_mem_ops {
115 void *(*alloc)(struct device *dev, unsigned long attrs, 116 void *(*alloc)(struct device *dev, unsigned long attrs,
116 unsigned long size, enum dma_data_direction dma_dir, 117 unsigned long size,
118 enum dma_data_direction dma_dir,
117 gfp_t gfp_flags); 119 gfp_t gfp_flags);
118 void (*put)(void *buf_priv); 120 void (*put)(void *buf_priv);
119 struct dma_buf *(*get_dmabuf)(void *buf_priv, unsigned long flags); 121 struct dma_buf *(*get_dmabuf)(void *buf_priv, unsigned long flags);
@@ -126,7 +128,8 @@ struct vb2_mem_ops {
126 void (*prepare)(void *buf_priv); 128 void (*prepare)(void *buf_priv);
127 void (*finish)(void *buf_priv); 129 void (*finish)(void *buf_priv);
128 130
129 void *(*attach_dmabuf)(struct device *dev, struct dma_buf *dbuf, 131 void *(*attach_dmabuf)(struct device *dev,
132 struct dma_buf *dbuf,
130 unsigned long size, 133 unsigned long size,
131 enum dma_data_direction dma_dir); 134 enum dma_data_direction dma_dir);
132 void (*detach_dmabuf)(void *buf_priv); 135 void (*detach_dmabuf)(void *buf_priv);
@@ -291,7 +294,7 @@ struct vb2_buffer {
291/** 294/**
292 * struct vb2_ops - driver-specific callbacks 295 * struct vb2_ops - driver-specific callbacks
293 * 296 *
294 * @queue_setup: called from %VIDIOC_REQBUFS and %VIDIOC_CREATE_BUFS 297 * @queue_setup: called from VIDIOC_REQBUFS() and VIDIOC_CREATE_BUFS()
295 * handlers before memory allocation. It can be called 298 * handlers before memory allocation. It can be called
296 * twice: if the original number of requested buffers 299 * twice: if the original number of requested buffers
297 * could not be allocated, then it will be called a 300 * could not be allocated, then it will be called a
@@ -302,11 +305,11 @@ struct vb2_buffer {
302 * buffer in \*num_planes, the size of each plane should be 305 * buffer in \*num_planes, the size of each plane should be
303 * set in the sizes\[\] array and optional per-plane 306 * set in the sizes\[\] array and optional per-plane
304 * allocator specific device in the alloc_devs\[\] array. 307 * allocator specific device in the alloc_devs\[\] array.
305 * When called from %VIDIOC_REQBUFS, \*num_planes == 0, the 308 * When called from VIDIOC_REQBUFS,() \*num_planes == 0,
306 * driver has to use the currently configured format to 309 * the driver has to use the currently configured format to
307 * determine the plane sizes and \*num_buffers is the total 310 * determine the plane sizes and \*num_buffers is the total
308 * number of buffers that are being allocated. When called 311 * number of buffers that are being allocated. When called
309 * from %VIDIOC_CREATE_BUFS, \*num_planes != 0 and it 312 * from VIDIOC_CREATE_BUFS,() \*num_planes != 0 and it
310 * describes the requested number of planes and sizes\[\] 313 * describes the requested number of planes and sizes\[\]
311 * contains the requested plane sizes. If either 314 * contains the requested plane sizes. If either
312 * \*num_planes or the requested sizes are invalid callback 315 * \*num_planes or the requested sizes are invalid callback
@@ -325,11 +328,11 @@ struct vb2_buffer {
325 * initialization failure (return != 0) will prevent 328 * initialization failure (return != 0) will prevent
326 * queue setup from completing successfully; optional. 329 * queue setup from completing successfully; optional.
327 * @buf_prepare: called every time the buffer is queued from userspace 330 * @buf_prepare: called every time the buffer is queued from userspace
328 * and from the %VIDIOC_PREPARE_BUF ioctl; drivers may 331 * and from the VIDIOC_PREPARE_BUF() ioctl; drivers may
329 * perform any initialization required before each 332 * perform any initialization required before each
330 * hardware operation in this callback; drivers can 333 * hardware operation in this callback; drivers can
331 * access/modify the buffer here as it is still synced for 334 * access/modify the buffer here as it is still synced for
332 * the CPU; drivers that support %VIDIOC_CREATE_BUFS must 335 * the CPU; drivers that support VIDIOC_CREATE_BUFS() must
333 * also validate the buffer size; if an error is returned, 336 * also validate the buffer size; if an error is returned,
334 * the buffer will not be queued in driver; optional. 337 * the buffer will not be queued in driver; optional.
335 * @buf_finish: called before every dequeue of the buffer back to 338 * @buf_finish: called before every dequeue of the buffer back to
@@ -353,24 +356,25 @@ struct vb2_buffer {
353 * driver can return an error if hardware fails, in that 356 * driver can return an error if hardware fails, in that
354 * case all buffers that have been already given by 357 * case all buffers that have been already given by
355 * the @buf_queue callback are to be returned by the driver 358 * the @buf_queue callback are to be returned by the driver
356 * by calling @vb2_buffer_done\(%VB2_BUF_STATE_QUEUED\). 359 * by calling vb2_buffer_done() with %VB2_BUF_STATE_QUEUED.
357 * If you need a minimum number of buffers before you can 360 * If you need a minimum number of buffers before you can
358 * start streaming, then set @min_buffers_needed in the 361 * start streaming, then set @min_buffers_needed in the
359 * vb2_queue structure. If that is non-zero then 362 * vb2_queue structure. If that is non-zero then
360 * start_streaming won't be called until at least that 363 * @start_streaming won't be called until at least that
361 * many buffers have been queued up by userspace. 364 * many buffers have been queued up by userspace.
362 * @stop_streaming: called when 'streaming' state must be disabled; driver 365 * @stop_streaming: called when 'streaming' state must be disabled; driver
363 * should stop any DMA transactions or wait until they 366 * should stop any DMA transactions or wait until they
364 * finish and give back all buffers it got from &buf_queue 367 * finish and give back all buffers it got from &buf_queue
365 * callback by calling @vb2_buffer_done\(\) with either 368 * callback by calling vb2_buffer_done() with either
366 * %VB2_BUF_STATE_DONE or %VB2_BUF_STATE_ERROR; may use 369 * %VB2_BUF_STATE_DONE or %VB2_BUF_STATE_ERROR; may use
367 * vb2_wait_for_all_buffers() function 370 * vb2_wait_for_all_buffers() function
368 * @buf_queue: passes buffer vb to the driver; driver may start 371 * @buf_queue: passes buffer vb to the driver; driver may start
369 * hardware operation on this buffer; driver should give 372 * hardware operation on this buffer; driver should give
370 * the buffer back by calling vb2_buffer_done() function; 373 * the buffer back by calling vb2_buffer_done() function;
371 * it is allways called after calling %VIDIOC_STREAMON ioctl; 374 * it is allways called after calling VIDIOC_STREAMON()
372 * might be called before start_streaming callback if user 375 * ioctl; might be called before @start_streaming callback
373 * pre-queued buffers before calling %VIDIOC_STREAMON. 376 * if user pre-queued buffers before calling
377 * VIDIOC_STREAMON().
374 */ 378 */
375struct vb2_ops { 379struct vb2_ops {
376 int (*queue_setup)(struct vb2_queue *q, 380 int (*queue_setup)(struct vb2_queue *q,
@@ -418,7 +422,7 @@ struct vb2_buf_ops {
418 * 422 *
419 * @type: private buffer type whose content is defined by the vb2-core 423 * @type: private buffer type whose content is defined by the vb2-core
420 * caller. For example, for V4L2, it should match 424 * caller. For example, for V4L2, it should match
421 * the V4L2_BUF_TYPE_* in include/uapi/linux/videodev2.h 425 * the types defined on enum &v4l2_buf_type
422 * @io_modes: supported io methods (see vb2_io_modes enum) 426 * @io_modes: supported io methods (see vb2_io_modes enum)
423 * @dev: device to use for the default allocation context if the driver 427 * @dev: device to use for the default allocation context if the driver
424 * doesn't fill in the @alloc_devs array. 428 * doesn't fill in the @alloc_devs array.
@@ -453,12 +457,12 @@ struct vb2_buf_ops {
453 * Typically this is 0, but it may be e.g. GFP_DMA or __GFP_DMA32 457 * Typically this is 0, but it may be e.g. GFP_DMA or __GFP_DMA32
454 * to force the buffer allocation to a specific memory zone. 458 * to force the buffer allocation to a specific memory zone.
455 * @min_buffers_needed: the minimum number of buffers needed before 459 * @min_buffers_needed: the minimum number of buffers needed before
456 * start_streaming() can be called. Used when a DMA engine 460 * @start_streaming can be called. Used when a DMA engine
457 * cannot be started unless at least this number of buffers 461 * cannot be started unless at least this number of buffers
458 * have been queued into the driver. 462 * have been queued into the driver.
459 */ 463 */
460/* 464/*
461 * Private elements (won't appear at the DocBook): 465 * Private elements (won't appear at the uAPI book):
462 * @mmap_lock: private mutex used when buffers are allocated/freed/mmapped 466 * @mmap_lock: private mutex used when buffers are allocated/freed/mmapped
463 * @memory: current memory type used 467 * @memory: current memory type used
464 * @bufs: videobuf buffer structures 468 * @bufs: videobuf buffer structures
@@ -471,7 +475,7 @@ struct vb2_buf_ops {
471 * @done_wq: waitqueue for processes waiting for buffers ready to be dequeued 475 * @done_wq: waitqueue for processes waiting for buffers ready to be dequeued
472 * @alloc_devs: memory type/allocator-specific per-plane device 476 * @alloc_devs: memory type/allocator-specific per-plane device
473 * @streaming: current streaming state 477 * @streaming: current streaming state
474 * @start_streaming_called: start_streaming() was called successfully and we 478 * @start_streaming_called: @start_streaming was called successfully and we
475 * started streaming. 479 * started streaming.
476 * @error: a fatal error occurred on the queue 480 * @error: a fatal error occurred on the queue
477 * @waiting_for_buffers: used in poll() to check if vb2 is still waiting for 481 * @waiting_for_buffers: used in poll() to check if vb2 is still waiting for
@@ -576,17 +580,18 @@ void *vb2_plane_cookie(struct vb2_buffer *vb, unsigned int plane_no);
576/** 580/**
577 * vb2_buffer_done() - inform videobuf that an operation on a buffer is finished 581 * vb2_buffer_done() - inform videobuf that an operation on a buffer is finished
578 * @vb: vb2_buffer returned from the driver 582 * @vb: vb2_buffer returned from the driver
579 * @state: either %VB2_BUF_STATE_DONE if the operation finished successfully, 583 * @state: either %VB2_BUF_STATE_DONE if the operation finished
580 * %VB2_BUF_STATE_ERROR if the operation finished with an error or 584 * successfully, %VB2_BUF_STATE_ERROR if the operation finished
581 * %VB2_BUF_STATE_QUEUED if the driver wants to requeue buffers. 585 * with an error or %VB2_BUF_STATE_QUEUED if the driver wants to
582 * If start_streaming fails then it should return buffers with state 586 * requeue buffers. If start_streaming fails then it should return
583 * %VB2_BUF_STATE_QUEUED to put them back into the queue. 587 * buffers with state %VB2_BUF_STATE_QUEUED to put them back into
588 * the queue.
584 * 589 *
585 * This function should be called by the driver after a hardware operation on 590 * This function should be called by the driver after a hardware operation on
586 * a buffer is finished and the buffer may be returned to userspace. The driver 591 * a buffer is finished and the buffer may be returned to userspace. The driver
587 * cannot use this buffer anymore until it is queued back to it by videobuf 592 * cannot use this buffer anymore until it is queued back to it by videobuf
588 * by the means of buf_queue callback. Only buffers previously queued to the 593 * by the means of &vb2_ops->buf_queue callback. Only buffers previously queued
589 * driver by buf_queue can be passed to this function. 594 * to the driver by &vb2_ops->buf_queue can be passed to this function.
590 * 595 *
591 * While streaming a buffer can only be returned in state DONE or ERROR. 596 * While streaming a buffer can only be returned in state DONE or ERROR.
592 * The start_streaming op can also return them in case the DMA engine cannot 597 * The start_streaming op can also return them in case the DMA engine cannot
@@ -614,9 +619,9 @@ void vb2_discard_done(struct vb2_queue *q);
614 * @q: videobuf2 queue 619 * @q: videobuf2 queue
615 * 620 *
616 * This function will wait until all buffers that have been given to the driver 621 * This function will wait until all buffers that have been given to the driver
617 * by buf_queue() are given back to vb2 with vb2_buffer_done(). It doesn't call 622 * by &vb2_ops->buf_queue are given back to vb2 with vb2_buffer_done(). It
618 * wait_prepare, wait_finish pair. It is intended to be called with all locks 623 * doesn't call wait_prepare()/wait_finish() pair. It is intended to be called
619 * taken, for example from stop_streaming() callback. 624 * with all locks taken, for example from &vb2_ops->stop_streaming callback.
620 */ 625 */
621int vb2_wait_for_all_buffers(struct vb2_queue *q); 626int vb2_wait_for_all_buffers(struct vb2_queue *q);
622 627
@@ -639,14 +644,16 @@ void vb2_core_querybuf(struct vb2_queue *q, unsigned int index, void *pb);
639 * @count: requested buffer count 644 * @count: requested buffer count
640 * 645 *
641 * Should be called from vidioc_reqbufs ioctl handler of a driver. 646 * Should be called from vidioc_reqbufs ioctl handler of a driver.
647 *
642 * This function: 648 * This function:
643 * 1) verifies streaming parameters passed from the userspace, 649 *
644 * 2) sets up the queue, 650 * #) verifies streaming parameters passed from the userspace,
645 * 3) negotiates number of buffers and planes per buffer with the driver 651 * #) sets up the queue,
652 * #) negotiates number of buffers and planes per buffer with the driver
646 * to be used during streaming, 653 * to be used during streaming,
647 * 4) allocates internal buffer structures (struct vb2_buffer), according to 654 * #) allocates internal buffer structures (struct vb2_buffer), according to
648 * the agreed parameters, 655 * the agreed parameters,
649 * 5) for MMAP memory type, allocates actual video memory, using the 656 * #) for MMAP memory type, allocates actual video memory, using the
650 * memory handling/allocation routines provided during queue initialization 657 * memory handling/allocation routines provided during queue initialization
651 * 658 *
652 * If req->count is 0, all the memory will be freed instead. 659 * If req->count is 0, all the memory will be freed instead.
@@ -664,20 +671,22 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory,
664 * @q: videobuf2 queue 671 * @q: videobuf2 queue
665 * @memory: memory type 672 * @memory: memory type
666 * @count: requested buffer count 673 * @count: requested buffer count
667 * @parg: parameter passed to device driver 674 * @requested_planes: number of planes requested
675 * @requested_sizes: array with the size of the planes
668 * 676 *
669 * Should be called from vidioc_create_bufs ioctl handler of a driver. 677 * Should be called from VIDIOC_CREATE_BUFS() ioctl handler of a driver.
670 * This function: 678 * This function:
671 * 1) verifies parameter sanity
672 * 2) calls the .queue_setup() queue operation
673 * 3) performs any necessary memory allocations
674 * 679 *
675 * The return values from this function are intended to be directly returned 680 * #) verifies parameter sanity
676 * from vidioc_create_bufs handler in driver. 681 * #) calls the .queue_setup() queue operation
682 * #) performs any necessary memory allocations
683 *
684 * Return: the return values from this function are intended to be directly
685 * returned from VIDIOC_CREATE_BUFS() handler in driver.
677 */ 686 */
678int vb2_core_create_bufs(struct vb2_queue *q, enum vb2_memory memory, 687int vb2_core_create_bufs(struct vb2_queue *q, enum vb2_memory memory,
679 unsigned int *count, unsigned requested_planes, 688 unsigned int *count, unsigned int requested_planes,
680 const unsigned int requested_sizes[]); 689 const unsigned int requested_sizes[]);
681 690
682/** 691/**
683 * vb2_core_prepare_buf() - Pass ownership of a buffer from userspace 692 * vb2_core_prepare_buf() - Pass ownership of a buffer from userspace
@@ -699,6 +708,7 @@ int vb2_core_prepare_buf(struct vb2_queue *q, unsigned int index, void *pb);
699 708
700/** 709/**
701 * vb2_core_qbuf() - Queue a buffer from userspace 710 * vb2_core_qbuf() - Queue a buffer from userspace
711 *
702 * @q: videobuf2 queue 712 * @q: videobuf2 queue
703 * @index: id number of the buffer 713 * @index: id number of the buffer
704 * @pb: buffer structure passed from userspace to vidioc_qbuf handler 714 * @pb: buffer structure passed from userspace to vidioc_qbuf handler
@@ -706,11 +716,13 @@ int vb2_core_prepare_buf(struct vb2_queue *q, unsigned int index, void *pb);
706 * 716 *
707 * Should be called from vidioc_qbuf ioctl handler of a driver. 717 * Should be called from vidioc_qbuf ioctl handler of a driver.
708 * The passed buffer should have been verified. 718 * The passed buffer should have been verified.
719 *
709 * This function: 720 * This function:
710 * 1) if necessary, calls buf_prepare callback in the driver (if provided), in 721 *
722 * #) if necessary, calls buf_prepare callback in the driver (if provided), in
711 * which driver-specific buffer initialization can be performed, 723 * which driver-specific buffer initialization can be performed,
712 * 2) if streaming is on, queues the buffer in driver by the means of buf_queue 724 * #) if streaming is on, queues the buffer in driver by the means of
713 * callback for processing. 725 * &vb2_ops->buf_queue callback for processing.
714 * 726 *
715 * The return values from this function are intended to be directly returned 727 * The return values from this function are intended to be directly returned
716 * from vidioc_qbuf handler in driver. 728 * from vidioc_qbuf handler in driver.
@@ -729,11 +741,13 @@ int vb2_core_qbuf(struct vb2_queue *q, unsigned int index, void *pb);
729 * 741 *
730 * Should be called from vidioc_dqbuf ioctl handler of a driver. 742 * Should be called from vidioc_dqbuf ioctl handler of a driver.
731 * The passed buffer should have been verified. 743 * The passed buffer should have been verified.
744 *
732 * This function: 745 * This function:
733 * 1) calls buf_finish callback in the driver (if provided), in which 746 *
747 * #) calls buf_finish callback in the driver (if provided), in which
734 * driver can perform any additional operations that may be required before 748 * driver can perform any additional operations that may be required before
735 * returning the buffer to userspace, such as cache sync, 749 * returning the buffer to userspace, such as cache sync,
736 * 2) the buffer struct members are filled with relevant information for 750 * #) the buffer struct members are filled with relevant information for
737 * the userspace. 751 * the userspace.
738 * 752 *
739 * The return values from this function are intended to be directly returned 753 * The return values from this function are intended to be directly returned
@@ -819,6 +833,7 @@ void vb2_queue_error(struct vb2_queue *q);
819 * from the mmap handler in driver. 833 * from the mmap handler in driver.
820 */ 834 */
821int vb2_mmap(struct vb2_queue *q, struct vm_area_struct *vma); 835int vb2_mmap(struct vb2_queue *q, struct vm_area_struct *vma);
836
822#ifndef CONFIG_MMU 837#ifndef CONFIG_MMU
823unsigned long vb2_get_unmapped_area(struct vb2_queue *q, 838unsigned long vb2_get_unmapped_area(struct vb2_queue *q,
824 unsigned long addr, 839 unsigned long addr,
@@ -844,14 +859,18 @@ unsigned long vb2_get_unmapped_area(struct vb2_queue *q,
844 * from poll handler in driver. 859 * from poll handler in driver.
845 */ 860 */
846unsigned int vb2_core_poll(struct vb2_queue *q, struct file *file, 861unsigned int vb2_core_poll(struct vb2_queue *q, struct file *file,
847 poll_table *wait); 862 poll_table *wait);
863
848size_t vb2_read(struct vb2_queue *q, char __user *data, size_t count, 864size_t vb2_read(struct vb2_queue *q, char __user *data, size_t count,
849 loff_t *ppos, int nonblock); 865 loff_t *ppos, int nonblock);
850size_t vb2_write(struct vb2_queue *q, const char __user *data, size_t count, 866size_t vb2_write(struct vb2_queue *q, const char __user *data, size_t count,
851 loff_t *ppos, int nonblock); 867 loff_t *ppos, int nonblock);
852 868
853/* 869/**
854 * vb2_thread_fnc - callback function for use with vb2_thread 870 * typedef vb2_thread_fnc - callback function for use with vb2_thread
871 *
872 * @vb: pointer to struct &vb2_buffer
873 * @priv: pointer to a private pointer
855 * 874 *
856 * This is called whenever a buffer is dequeued in the thread. 875 * This is called whenever a buffer is dequeued in the thread.
857 */ 876 */
@@ -867,9 +886,11 @@ typedef int (*vb2_thread_fnc)(struct vb2_buffer *vb, void *priv);
867 * This starts a thread that will queue and dequeue until an error occurs 886 * This starts a thread that will queue and dequeue until an error occurs
868 * or @vb2_thread_stop is called. 887 * or @vb2_thread_stop is called.
869 * 888 *
870 * This function should not be used for anything else but the videobuf2-dvb 889 * .. attention::
871 * support. If you think you have another good use-case for this, then please 890 *
872 * contact the linux-media mailinglist first. 891 * This function should not be used for anything else but the videobuf2-dvb
892 * support. If you think you have another good use-case for this, then please
893 * contact the linux-media mailing list first.
873 */ 894 */
874int vb2_thread_start(struct vb2_queue *q, vb2_thread_fnc fnc, void *priv, 895int vb2_thread_start(struct vb2_queue *q, vb2_thread_fnc fnc, void *priv,
875 const char *thread_name); 896 const char *thread_name);
@@ -1000,6 +1021,12 @@ bool vb2_buffer_in_use(struct vb2_queue *q, struct vb2_buffer *vb);
1000/** 1021/**
1001 * vb2_verify_memory_type() - Check whether the memory type and buffer type 1022 * vb2_verify_memory_type() - Check whether the memory type and buffer type
1002 * passed to a buffer operation are compatible with the queue. 1023 * passed to a buffer operation are compatible with the queue.
1024 *
1025 * @q: videobuf queue
1026 * @memory: memory model, as defined by enum &vb2_memory.
1027 * @type: private buffer type whose content is defined by the vb2-core
1028 * caller. For example, for V4L2, it should match
1029 * the types defined on enum &v4l2_buf_type
1003 */ 1030 */
1004int vb2_verify_memory_type(struct vb2_queue *q, 1031int vb2_verify_memory_type(struct vb2_queue *q,
1005 enum vb2_memory memory, unsigned int type); 1032 enum vb2_memory memory, unsigned int type);