linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ezequiel Garcia <ezequiel@collabora.com>
To: linux-media@vger.kernel.org
Cc: kernel@collabora.com, Hans Verkuil <hverkuil@xs4all.nl>,
	Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
	Shuah Khan <shuahkh@osg.samsung.com>,
	Pawel Osciak <pawel@osciak.com>,
	Alexandre Courbot <acourbot@chromium.org>,
	Sakari Ailus <sakari.ailus@iki.fi>,
	Brian Starkey <brian.starkey@arm.com>,
	linux-kernel@vger.kernel.org,
	Gustavo Padovan <gustavo.padovan@collabora.com>,
	Ezequiel Garcia <ezequiel@collabora.com>
Subject: [PATCH v10 06/16] vb2: add is_unordered callback for drivers
Date: Mon, 21 May 2018 13:59:36 -0300	[thread overview]
Message-ID: <20180521165946.11778-7-ezequiel@collabora.com> (raw)
In-Reply-To: <20180521165946.11778-1-ezequiel@collabora.com>

From: Gustavo Padovan <gustavo.padovan@collabora.com>

Explicit synchronization benefits a lot from ordered queues, they fit
better in a pipeline with DRM for example so create a opt-in way for
drivers notify videobuf2 that the queue is unordered.

Drivers don't need implement it if the queue is ordered.

v5: rename it to vb2_ops_is_unordered() (Hans Verkuil)

v4: go back to a bitfield property for the unordered property.

v3: - make it bool (Hans)
    - create vb2_ops_set_unordered() helper

v2: - improve comments for is_unordered flag (Hans Verkuil)

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
---
 drivers/media/common/videobuf2/videobuf2-core.c |  6 ++++++
 include/media/videobuf2-core.h                  | 16 ++++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c
index 61e7b6407586..a9a0a9d1decb 100644
--- a/drivers/media/common/videobuf2/videobuf2-core.c
+++ b/drivers/media/common/videobuf2/videobuf2-core.c
@@ -691,6 +691,12 @@ void vb2_ops_wait_finish(struct vb2_queue *vq)
 }
 EXPORT_SYMBOL_GPL(vb2_ops_wait_finish);
 
+bool vb2_ops_is_unordered(struct vb2_queue *q)
+{
+	return true;
+}
+EXPORT_SYMBOL_GPL(vb2_ops_is_unordered);
+
 int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory,
 		unsigned int *count)
 {
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index 137f72702101..71538ae2c255 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -376,6 +376,10 @@ struct vb2_buffer {
  *			callback by calling vb2_buffer_done() with either
  *			%VB2_BUF_STATE_DONE or %VB2_BUF_STATE_ERROR; may use
  *			vb2_wait_for_all_buffers() function
+ * @is_unordered:	tell if the queue is unordered, i.e. buffers can be
+ *			dequeued in a different order from how they were queued.
+ *			The default is assumed to be ordered and this function
+ *			only needs to be implemented for unordered queues.
  * @buf_queue:		passes buffer vb to the driver; driver may start
  *			hardware operation on this buffer; driver should give
  *			the buffer back by calling vb2_buffer_done() function;
@@ -399,6 +403,7 @@ struct vb2_ops {
 
 	int (*start_streaming)(struct vb2_queue *q, unsigned int count);
 	void (*stop_streaming)(struct vb2_queue *q);
+	bool (*is_unordered)(struct vb2_queue *q);
 
 	void (*buf_queue)(struct vb2_buffer *vb);
 };
@@ -421,6 +426,16 @@ void vb2_ops_wait_prepare(struct vb2_queue *vq);
  */
 void vb2_ops_wait_finish(struct vb2_queue *vq);
 
+/**
+ * vb2_ops_is_unordered - helper function to check if queue is unordered
+ *
+ * @vq: pointer to &struct vb2_queue
+ *
+ * This helper just returns true to notify that the driver can't deal with
+ * ordered queues.
+ */
+bool vb2_ops_is_unordered(struct vb2_queue *q);
+
 /**
  * struct vb2_buf_ops - driver-specific callbacks.
  *
@@ -590,6 +605,7 @@ struct vb2_queue {
 	u32				cnt_wait_finish;
 	u32				cnt_start_streaming;
 	u32				cnt_stop_streaming;
+	u32				cnt_is_unordered;
 #endif
 };
 
-- 
2.16.3

  parent reply	other threads:[~2018-05-21 17:04 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-21 16:59 [PATCH v10 00/16] V4L2 Explicit Synchronization Ezequiel Garcia
2018-05-21 16:59 ` [PATCH v10 01/16] videobuf2: Make struct vb2_buffer refcounted Ezequiel Garcia
2018-05-25  6:41   ` sathyam panda
2018-05-29 13:17     ` Ezequiel Garcia
2018-05-29 15:11       ` sathyam panda
2018-05-21 16:59 ` [PATCH v10 02/16] xilinx: regroup caps on querycap Ezequiel Garcia
2018-05-21 16:59 ` [PATCH v10 03/16] hackrf: group device capabilities Ezequiel Garcia
2018-05-21 16:59 ` [PATCH v10 04/16] omap3isp: " Ezequiel Garcia
2018-05-21 16:59 ` [PATCH v10 05/16] vb2: move vb2_ops functions to videobuf2-core.[ch] Ezequiel Garcia
2018-05-21 16:59 ` Ezequiel Garcia [this message]
2018-05-21 16:59 ` [PATCH v10 07/16] v4l: add unordered flag to format description ioctl Ezequiel Garcia
2018-05-21 16:59 ` [PATCH v10 08/16] v4l: mark unordered formats Ezequiel Garcia
2018-05-22 11:55   ` Hans Verkuil
2018-05-23 10:30     ` Ezequiel Garcia
2018-05-23 11:29       ` Hans Verkuil
2018-05-21 16:59 ` [PATCH v10 09/16] cobalt: add .is_unordered() for cobalt Ezequiel Garcia
2018-05-22 11:57   ` Hans Verkuil
2018-05-21 16:59 ` [PATCH v10 10/16] vb2: mark codec drivers as unordered Ezequiel Garcia
2018-05-21 16:59 ` [PATCH v10 11/16] vb2: add explicit fence user API Ezequiel Garcia
2018-05-22 12:05   ` Hans Verkuil
2018-05-22 15:51     ` Ezequiel Garcia
2018-05-21 16:59 ` [PATCH v10 12/16] vb2: add in-fence support to QBUF Ezequiel Garcia
2018-05-22 12:37   ` Hans Verkuil
2018-05-22 16:22     ` Ezequiel Garcia
2018-05-22 16:48       ` Hans Verkuil
2018-05-22 17:41         ` Ezequiel Garcia
2018-05-25  6:12   ` sathyam panda
2018-05-21 16:59 ` [PATCH v10 13/16] vb2: add out-fence " Ezequiel Garcia
2018-05-22 12:41   ` Hans Verkuil
2018-05-25 16:36   ` Brian Starkey
2018-05-21 16:59 ` [PATCH v10 14/16] v4l: introduce the fences capability Ezequiel Garcia
2018-05-21 16:59 ` [PATCH v10 15/16] v4l: Add V4L2_CAP_FENCES to drivers Ezequiel Garcia
2018-05-21 16:59 ` [PATCH v10 16/16] v4l: Document explicit synchronization behavior Ezequiel Garcia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180521165946.11778-7-ezequiel@collabora.com \
    --to=ezequiel@collabora.com \
    --cc=acourbot@chromium.org \
    --cc=brian.starkey@arm.com \
    --cc=gustavo.padovan@collabora.com \
    --cc=hverkuil@xs4all.nl \
    --cc=kernel@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@osg.samsung.com \
    --cc=pawel@osciak.com \
    --cc=sakari.ailus@iki.fi \
    --cc=shuahkh@osg.samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).