From: Gustavo Padovan <gustavo@padovan.org>
To: linux-media@vger.kernel.org
Cc: 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>,
Thierry Escande <thierry.escande@collabora.com>,
linux-kernel@vger.kernel.org,
Javier Martinez Canillas <javier@osg.samsung.com>
Subject: [RFC v5 08/11] [media] vb2: add videobuf2 dma-buf fence helpers
Date: Wed, 15 Nov 2017 15:10:54 -0200 [thread overview]
Message-ID: <20171115171057.17340-9-gustavo@padovan.org> (raw)
In-Reply-To: <20171115171057.17340-1-gustavo@padovan.org>
From: Javier Martinez Canillas <javier@osg.samsung.com>
Add a videobuf2-fence.h header file that contains different helpers
for DMA buffer sharing explicit fence support in videobuf2.
v2: - use fence context provided by the caller in vb2_fence_alloc()
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
---
include/media/videobuf2-fence.h | 48 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
create mode 100644 include/media/videobuf2-fence.h
diff --git a/include/media/videobuf2-fence.h b/include/media/videobuf2-fence.h
new file mode 100644
index 000000000000..b49cc1bf6bb4
--- /dev/null
+++ b/include/media/videobuf2-fence.h
@@ -0,0 +1,48 @@
+/*
+ * videobuf2-fence.h - DMA buffer sharing fence helpers for videobuf 2
+ *
+ * Copyright (C) 2016 Samsung Electronics
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ */
+
+#include <linux/dma-fence.h>
+#include <linux/slab.h>
+
+static DEFINE_SPINLOCK(vb2_fence_lock);
+
+static inline const char *vb2_fence_get_driver_name(struct dma_fence *fence)
+{
+ return "vb2_fence";
+}
+
+static inline const char *vb2_fence_get_timeline_name(struct dma_fence *fence)
+{
+ return "vb2_fence_timeline";
+}
+
+static inline bool vb2_fence_enable_signaling(struct dma_fence *fence)
+{
+ return true;
+}
+
+static const struct dma_fence_ops vb2_fence_ops = {
+ .get_driver_name = vb2_fence_get_driver_name,
+ .get_timeline_name = vb2_fence_get_timeline_name,
+ .enable_signaling = vb2_fence_enable_signaling,
+ .wait = dma_fence_default_wait,
+};
+
+static inline struct dma_fence *vb2_fence_alloc(u64 context)
+{
+ struct dma_fence *vb2_fence = kzalloc(sizeof(*vb2_fence), GFP_KERNEL);
+
+ if (!vb2_fence)
+ return NULL;
+
+ dma_fence_init(vb2_fence, &vb2_fence_ops, &vb2_fence_lock, context, 1);
+
+ return vb2_fence;
+}
--
2.13.6
next prev parent reply other threads:[~2017-11-15 17:14 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-15 17:10 [RFC v5 00/11] V4L2 Explicit Synchronization Gustavo Padovan
2017-11-15 17:10 ` [RFC v5 01/11] [media] v4l: add V4L2_CAP_ORDERED to the uapi Gustavo Padovan
2017-11-17 11:57 ` Mauro Carvalho Chehab
2017-11-17 12:23 ` Gustavo Padovan
2017-11-15 17:10 ` [RFC v5 02/11] [media] vivid: add the V4L2_CAP_ORDERED capability Gustavo Padovan
2017-11-15 17:10 ` [RFC v5 03/11] [media] vb2: add 'ordered_in_driver' property to queues Gustavo Padovan
2017-11-17 5:56 ` Alexandre Courbot
2017-11-17 11:23 ` Gustavo Padovan
2017-11-17 12:15 ` Mauro Carvalho Chehab
2017-11-17 12:27 ` Gustavo Padovan
2017-11-15 17:10 ` [RFC v5 04/11] [media] vivid: mark vivid queues as ordered_in_driver Gustavo Padovan
2017-11-15 17:10 ` [RFC v5 05/11] [media] vb2: check earlier if stream can be started Gustavo Padovan
2017-11-15 17:10 ` [RFC v5 06/11] [media] vb2: add explicit fence user API Gustavo Padovan
2017-11-17 12:25 ` Mauro Carvalho Chehab
2017-11-17 13:29 ` Hans Verkuil
2017-11-17 13:53 ` Mauro Carvalho Chehab
2017-11-17 14:31 ` Hans Verkuil
2017-11-15 17:10 ` [RFC v5 07/11] [media] vb2: add in-fence support to QBUF Gustavo Padovan
2017-11-17 6:49 ` Alexandre Courbot
2017-11-17 13:00 ` Mauro Carvalho Chehab
2017-11-17 13:08 ` Gustavo Padovan
2017-11-17 13:19 ` Mauro Carvalho Chehab
2017-11-20 11:41 ` Brian Starkey
2017-11-17 13:01 ` Gustavo Padovan
2017-11-20 2:53 ` Alexandre Courbot
2017-11-17 12:53 ` Mauro Carvalho Chehab
2017-11-17 13:12 ` Gustavo Padovan
2017-11-17 13:47 ` Mauro Carvalho Chehab
2017-11-17 17:20 ` Gustavo Padovan
2017-11-17 14:15 ` Hans Verkuil
2017-11-17 17:40 ` Gustavo Padovan
2017-11-17 17:50 ` Gustavo Padovan
2017-11-18 9:30 ` Hans Verkuil
2017-11-15 17:10 ` Gustavo Padovan [this message]
2017-11-17 7:02 ` [RFC v5 08/11] [media] vb2: add videobuf2 dma-buf fence helpers Alexandre Courbot
2017-11-17 7:11 ` Alexandre Courbot
2017-11-17 11:27 ` Gustavo Padovan
2017-11-15 17:10 ` [RFC v5 09/11] [media] vb2: add infrastructure to support out-fences Gustavo Padovan
2017-11-17 7:19 ` Alexandre Courbot
2017-11-17 7:29 ` Alexandre Courbot
2017-11-17 11:30 ` Gustavo Padovan
2017-11-15 17:10 ` [RFC v5 10/11] [media] vb2: add out-fence support to QBUF Gustavo Padovan
2017-11-17 7:38 ` Alexandre Courbot
2017-11-17 11:48 ` Gustavo Padovan
2017-11-17 13:34 ` Hans Verkuil
2017-11-15 17:10 ` [RFC v5 11/11] [media] v4l: Document explicit synchronization behavior Gustavo Padovan
2017-11-20 10:19 ` [RFC v5 00/11] V4L2 Explicit Synchronization Smitha T Murthy
2017-11-30 18:53 ` Gustavo Padovan
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=20171115171057.17340-9-gustavo@padovan.org \
--to=gustavo@padovan.org \
--cc=acourbot@chromium.org \
--cc=brian.starkey@arm.com \
--cc=hverkuil@xs4all.nl \
--cc=javier@osg.samsung.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 \
--cc=thierry.escande@collabora.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
all inboxes | Powered by JetHome®