All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] media: vb2-core: vb2_buffer_done: consolidate docs
@ 2018-02-28 22:24 Luca Ceresoli
  2018-02-28 22:24 ` [PATCH 2/3] media: vb2-core: document the REQUEUEING state Luca Ceresoli
  2018-02-28 22:24 ` [PATCH 3/3] media: vb2-core: vb2_ops: document non-interrupt-cantext calling Luca Ceresoli
  0 siblings, 2 replies; 4+ messages in thread
From: Luca Ceresoli @ 2018-02-28 22:24 UTC (permalink / raw)
  To: linux-media
  Cc: linux-kernel, Luca Ceresoli, Laurent Pinchart, Pawel Osciak,
	Marek Szyprowski, Kyungmin Park, Mauro Carvalho Chehab

Documentation about what start_streaming() should do on failure are
scattered in two places and mostly duplicated, so consolidate them in
one of the two places.

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Pawel Osciak <pawel@osciak.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
---
 include/media/videobuf2-core.h | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index 5b6c541e4e1b..f1a479060f9e 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -602,9 +602,7 @@ void *vb2_plane_cookie(struct vb2_buffer *vb, unsigned int plane_no);
  *		Either %VB2_BUF_STATE_DONE if the operation finished
  *		successfully, %VB2_BUF_STATE_ERROR if the operation finished
  *		with an error or %VB2_BUF_STATE_QUEUED if the driver wants to
- *		requeue buffers. If start_streaming fails then it should return
- *		buffers with state %VB2_BUF_STATE_QUEUED to put them back into
- *		the queue.
+ *		requeue buffers.
  *
  * This function should be called by the driver after a hardware operation on
  * a buffer is finished and the buffer may be returned to userspace. The driver
@@ -613,9 +611,9 @@ void *vb2_plane_cookie(struct vb2_buffer *vb, unsigned int plane_no);
  * to the driver by &vb2_ops->buf_queue can be passed to this function.
  *
  * While streaming a buffer can only be returned in state DONE or ERROR.
- * The start_streaming op can also return them in case the DMA engine cannot
- * be started for some reason. In that case the buffers should be returned with
- * state QUEUED.
+ * The &vb2_ops->start_streaming op can also return them in case the DMA engine
+ * cannot be started for some reason. In that case the buffers should be
+ * returned with state QUEUED to put them back into the queue.
  */
 void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state);
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] media: vb2-core: document the REQUEUEING state
  2018-02-28 22:24 [PATCH 1/3] media: vb2-core: vb2_buffer_done: consolidate docs Luca Ceresoli
@ 2018-02-28 22:24 ` Luca Ceresoli
  2018-02-28 22:24 ` [PATCH 3/3] media: vb2-core: vb2_ops: document non-interrupt-cantext calling Luca Ceresoli
  1 sibling, 0 replies; 4+ messages in thread
From: Luca Ceresoli @ 2018-02-28 22:24 UTC (permalink / raw)
  To: linux-media
  Cc: linux-kernel, Luca Ceresoli, Laurent Pinchart, Pawel Osciak,
	Marek Szyprowski, Kyungmin Park, Mauro Carvalho Chehab

VB2_BUF_STATE_REQUEUEING is accepted by vb2_buffer_done() but not
documented, so add it along with notes about calls in interrupt context.

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Pawel Osciak <pawel@osciak.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
---
 include/media/videobuf2-core.h | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index f1a479060f9e..f20000887d3c 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -358,12 +358,12 @@ struct vb2_buffer {
  *			driver can return an error if hardware fails, in that
  *			case all buffers that have been already given by
  *			the @buf_queue callback are to be returned by the driver
- *			by calling vb2_buffer_done() with %VB2_BUF_STATE_QUEUED.
- *			If you need a minimum number of buffers before you can
- *			start streaming, then set
- *			&vb2_queue->min_buffers_needed. If that is non-zero then
- *			@start_streaming won't be called until at least that
- *			many buffers have been queued up by userspace.
+ *			by calling vb2_buffer_done() with %VB2_BUF_STATE_QUEUED
+ *			or %VB2_BUF_STATE_REQUEUEING. If you need a minimum
+ *			number of buffers before you can start streaming, then
+ *			set &vb2_queue->min_buffers_needed. If that is non-zero
+ *			then @start_streaming won't be called until at least
+ *			that many buffers have been queued up by userspace.
  * @stop_streaming:	called when 'streaming' state must be disabled; driver
  *			should stop any DMA transactions or wait until they
  *			finish and give back all buffers it got from &buf_queue
@@ -601,8 +601,9 @@ void *vb2_plane_cookie(struct vb2_buffer *vb, unsigned int plane_no);
  * @state:	state of the buffer, as defined by &enum vb2_buffer_state.
  *		Either %VB2_BUF_STATE_DONE if the operation finished
  *		successfully, %VB2_BUF_STATE_ERROR if the operation finished
- *		with an error or %VB2_BUF_STATE_QUEUED if the driver wants to
- *		requeue buffers.
+ *		with an error or any of %VB2_BUF_STATE_QUEUED or
+ *		%VB2_BUF_STATE_REQUEUEING if the driver wants to
+ *		requeue buffers (see below).
  *
  * This function should be called by the driver after a hardware operation on
  * a buffer is finished and the buffer may be returned to userspace. The driver
@@ -613,7 +614,12 @@ void *vb2_plane_cookie(struct vb2_buffer *vb, unsigned int plane_no);
  * While streaming a buffer can only be returned in state DONE or ERROR.
  * The &vb2_ops->start_streaming op can also return them in case the DMA engine
  * cannot be started for some reason. In that case the buffers should be
- * returned with state QUEUED to put them back into the queue.
+ * returned with state QUEUED or REQUEUEING to put them back into the queue.
+ *
+ * %VB2_BUF_STATE_REQUEUEING is like %VB2_BUF_STATE_QUEUED, but it also calls
+ * &vb2_ops->buf_queue to queue buffers back to the driver. Note that calling
+ * vb2_buffer_done(..., VB2_BUF_STATE_REQUEUEING) from interrupt context will
+ * result in &vb2_ops->buf_queue being called in interrupt context as well.
  */
 void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state);
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] media: vb2-core: vb2_ops: document non-interrupt-cantext calling
  2018-02-28 22:24 [PATCH 1/3] media: vb2-core: vb2_buffer_done: consolidate docs Luca Ceresoli
  2018-02-28 22:24 ` [PATCH 2/3] media: vb2-core: document the REQUEUEING state Luca Ceresoli
@ 2018-02-28 22:24 ` Luca Ceresoli
  2018-03-06 19:39   ` Luca Ceresoli
  1 sibling, 1 reply; 4+ messages in thread
From: Luca Ceresoli @ 2018-02-28 22:24 UTC (permalink / raw)
  To: linux-media
  Cc: linux-kernel, Luca Ceresoli, Laurent Pinchart, Pawel Osciak,
	Marek Szyprowski, Kyungmin Park, Mauro Carvalho Chehab

Driver writers can benefit in knowing if/when callbacks are called in
interrupt context. But it is not completely obvious here, so document it.

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Pawel Osciak <pawel@osciak.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
---
 include/media/videobuf2-core.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index f20000887d3c..f6818f732f34 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -296,6 +296,9 @@ struct vb2_buffer {
 /**
  * struct vb2_ops - driver-specific callbacks.
  *
+ * These operations are not called from interrupt context except where
+ * mentioned specifically.
+ *
  * @queue_setup:	called from VIDIOC_REQBUFS() and VIDIOC_CREATE_BUFS()
  *			handlers before memory allocation. It can be called
  *			twice: if the original number of requested buffers
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 3/3] media: vb2-core: vb2_ops: document non-interrupt-cantext calling
  2018-02-28 22:24 ` [PATCH 3/3] media: vb2-core: vb2_ops: document non-interrupt-cantext calling Luca Ceresoli
@ 2018-03-06 19:39   ` Luca Ceresoli
  0 siblings, 0 replies; 4+ messages in thread
From: Luca Ceresoli @ 2018-03-06 19:39 UTC (permalink / raw)
  To: linux-media
  Cc: linux-kernel, Laurent Pinchart, Pawel Osciak, Marek Szyprowski,
	Kyungmin Park, Mauro Carvalho Chehab

Hi,

I noticed a typo in the title:
cantext -> context

I will fix in v2.

On 28/02/2018 23:24, Luca Ceresoli wrote:
> Driver writers can benefit in knowing if/when callbacks are called in
> interrupt context. But it is not completely obvious here, so document it.
> 
> Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Pawel Osciak <pawel@osciak.com>
> Cc: Marek Szyprowski <m.szyprowski@samsung.com>
> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> ---
>  include/media/videobuf2-core.h | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
> index f20000887d3c..f6818f732f34 100644
> --- a/include/media/videobuf2-core.h
> +++ b/include/media/videobuf2-core.h
> @@ -296,6 +296,9 @@ struct vb2_buffer {
>  /**
>   * struct vb2_ops - driver-specific callbacks.
>   *
> + * These operations are not called from interrupt context except where
> + * mentioned specifically.
> + *
>   * @queue_setup:	called from VIDIOC_REQBUFS() and VIDIOC_CREATE_BUFS()
>   *			handlers before memory allocation. It can be called
>   *			twice: if the original number of requested buffers
> 


-- 
Luca

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-03-06 19:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-28 22:24 [PATCH 1/3] media: vb2-core: vb2_buffer_done: consolidate docs Luca Ceresoli
2018-02-28 22:24 ` [PATCH 2/3] media: vb2-core: document the REQUEUEING state Luca Ceresoli
2018-02-28 22:24 ` [PATCH 3/3] media: vb2-core: vb2_ops: document non-interrupt-cantext calling Luca Ceresoli
2018-03-06 19:39   ` Luca Ceresoli

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.