From: Gustavo Padovan <gustavo@padovan.org>
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>
Subject: [PATCH v8 04/13] [media] vb2: add is_unordered callback for drivers
Date: Fri, 9 Mar 2018 14:49:11 -0300 [thread overview]
Message-ID: <20180309174920.22373-5-gustavo@padovan.org> (raw)
In-Reply-To: <20180309174920.22373-1-gustavo@padovan.org>
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.
v2: - improve comments for is_unordered flag (Hans)
v3: - make it bool (Hans)
- create vb2_ops_set_unordered() helper
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
---
drivers/media/common/videobuf2/videobuf2-v4l2.c | 6 ++++++
include/media/videobuf2-core.h | 6 ++++++
include/media/videobuf2-v4l2.h | 10 ++++++++++
3 files changed, 22 insertions(+)
diff --git a/drivers/media/common/videobuf2/videobuf2-v4l2.c b/drivers/media/common/videobuf2/videobuf2-v4l2.c
index 886a2d8d5c6c..68291ba8632d 100644
--- a/drivers/media/common/videobuf2/videobuf2-v4l2.c
+++ b/drivers/media/common/videobuf2/videobuf2-v4l2.c
@@ -961,6 +961,12 @@ void vb2_ops_wait_finish(struct vb2_queue *vq)
}
EXPORT_SYMBOL_GPL(vb2_ops_wait_finish);
+bool vb2_ops_set_unordered(struct vb2_queue *q)
+{
+ return true;
+}
+EXPORT_SYMBOL_GPL(vb2_ops_set_unordered);
+
MODULE_DESCRIPTION("Driver helper framework for Video for Linux 2");
MODULE_AUTHOR("Pawel Osciak <pawel@osciak.com>, Marek Szyprowski");
MODULE_LICENSE("GPL");
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index 5b6c541e4e1b..46a9e674f7e1 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -370,6 +370,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;
@@ -393,6 +397,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);
};
@@ -566,6 +571,7 @@ struct vb2_queue {
u32 cnt_wait_finish;
u32 cnt_start_streaming;
u32 cnt_stop_streaming;
+ u32 cnt_is_unordered;
#endif
};
diff --git a/include/media/videobuf2-v4l2.h b/include/media/videobuf2-v4l2.h
index 3d5e2d739f05..9de3c887c875 100644
--- a/include/media/videobuf2-v4l2.h
+++ b/include/media/videobuf2-v4l2.h
@@ -291,4 +291,14 @@ void vb2_ops_wait_prepare(struct vb2_queue *vq);
*/
void vb2_ops_wait_finish(struct vb2_queue *vq);
+/**
+ * vb2_ops_set_unordered - helper function to mark queue as unordered
+ *
+ * @vq: pointer to &struct vb2_queue
+ *
+ * This helper just return true to notify that the driver can't deal with
+ * ordered queues.
+ */
+bool vb2_ops_set_unordered(struct vb2_queue *q);
+
#endif /* _MEDIA_VIDEOBUF2_V4L2_H */
--
2.14.3
next prev parent reply other threads:[~2018-03-09 17:49 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-09 17:49 [PATCH v8 00/13] V4L2 Explicit Synchronization Gustavo Padovan
2018-03-09 17:49 ` [PATCH v8 01/13] [media] xilinx: regroup caps on querycap Gustavo Padovan
2018-03-14 2:30 ` Hans Verkuil
2018-03-09 17:49 ` [PATCH v8 02/13] [media] hackrf: group device capabilities Gustavo Padovan
2018-03-09 17:49 ` [PATCH v8 03/13] [media] omap3isp: " Gustavo Padovan
2018-03-14 2:34 ` Hans Verkuil
2018-03-09 17:49 ` Gustavo Padovan [this message]
2018-03-14 2:44 ` [PATCH v8 04/13] [media] vb2: add is_unordered callback for drivers Hans Verkuil
2018-03-09 17:49 ` [PATCH v8 05/13] [media] v4l: add 'unordered' flag to format description ioctl Gustavo Padovan
2018-03-09 17:49 ` [PATCH v8 06/13] [media] cobalt: add .is_unordered() for cobalt Gustavo Padovan
2018-03-14 2:48 ` Hans Verkuil
2018-03-09 17:49 ` [PATCH v8 07/13] [media] vb2: mark codec drivers as unordered Gustavo Padovan
2018-03-09 18:51 ` Nicolas Dufresne
2018-03-14 2:57 ` Hans Verkuil
2018-03-09 17:49 ` [PATCH v8 08/13] [media] vb2: add explicit fence user API Gustavo Padovan
2018-03-14 3:06 ` Hans Verkuil
2018-03-09 17:49 ` [PATCH v8 09/13] [media] vb2: add in-fence support to QBUF Gustavo Padovan
2018-03-14 15:55 ` Hans Verkuil
2018-04-25 20:11 ` Ezequiel Garcia
2018-04-26 6:27 ` Hans Verkuil
2018-03-09 17:49 ` [PATCH v8 10/13] [media] vb2: add out-fence " Gustavo Padovan
2018-03-14 16:25 ` Hans Verkuil
2018-04-30 15:27 ` Ezequiel Garcia
2018-03-09 17:49 ` [PATCH v8 11/13] [media] v4l: introduce the fences capability Gustavo Padovan
2018-03-14 3:12 ` Hans Verkuil
2018-03-09 17:49 ` [PATCH v8 12/13] [media] v4l: Add V4L2_CAP_FENCES to drivers Gustavo Padovan
2018-03-14 16:07 ` Hans Verkuil
2018-03-09 17:49 ` [PATCH v8 13/13] [media] v4l: Document explicit synchronization behavior Gustavo Padovan
2018-03-13 9:26 ` jacopo mondi
2018-03-14 3:33 ` Hans Verkuil
2018-03-14 16:01 ` Hans Verkuil
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=20180309174920.22373-5-gustavo@padovan.org \
--to=gustavo@padovan.org \
--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).