All of lore.kernel.org
 help / color / mirror / Atom feed
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>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Javier Martinez Canillas <javier@osg.samsung.com>,
	linux-kernel@vger.kernel.org
Subject: [RFC 08/10] [media] vb2: add videobuf2 dma-buf fence helpers
Date: Mon, 13 Mar 2017 16:20:33 -0300	[thread overview]
Message-ID: <20170313192035.29859-9-gustavo@padovan.org> (raw)
In-Reply-To: <20170313192035.29859-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.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
---
 include/media/videobuf2-fence.h | 49 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 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 0000000..ed5612c
--- /dev/null
+++ b/include/media/videobuf2-fence.h
@@ -0,0 +1,49 @@
+/*
+ * 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(void)
+{
+	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,
+		       dma_fence_context_alloc(1), 1);
+
+	return vb2_fence;
+}
-- 
2.9.3

  parent reply	other threads:[~2017-03-13 19:22 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-13 19:20 [RFC 00/10] V4L2 explicit synchronization support Gustavo Padovan
2017-03-13 19:20 ` [RFC 01/10] [media] vb2: add explicit fence user API Gustavo Padovan
2017-04-03  9:48   ` Philipp Zabel
2017-04-05 14:08     ` Gustavo Padovan
2017-03-13 19:20 ` [RFC 02/10] [media] vb2: split out queueing from vb_core_qbuf() Gustavo Padovan
2017-03-13 19:20 ` [RFC 03/10] [media] vb2: add in-fence support to QBUF Gustavo Padovan
2017-04-03 18:27   ` Javier Martinez Canillas
2017-03-13 19:20 ` [RFC 04/10] [media] uvc: enable subscriptions to other events Gustavo Padovan
2017-03-13 19:20 ` [RFC 05/10] [media] vivid: assign the specific device to the vb2_queue->dev Gustavo Padovan
2017-03-13 19:20 ` [RFC 06/10] [media] v4l: add V4L2_EVENT_BUF_QUEUED event Gustavo Padovan
2017-03-13 19:20 ` [RFC 07/10] [media] v4l: add support to BUF_QUEUED event Gustavo Padovan
2017-03-13 19:20 ` Gustavo Padovan [this message]
2017-03-13 19:20 ` [RFC 09/10] [media] vb2: add infrastructure to support out-fences Gustavo Padovan
2017-03-13 19:20 ` [RFC 10/10] [media] vb2: add out-fence support to QBUF Gustavo Padovan
2017-04-03 11:16 ` [RFC 00/10] V4L2 explicit synchronization support Mauro Carvalho Chehab
2017-04-03 19:46   ` Javier Martinez Canillas
2017-04-03 20:48     ` Shuah Khan
2017-04-05 15:09     ` Gustavo Padovan
2017-04-05 17:12       ` Javier Martinez Canillas
2017-04-06 14:08         ` Gustavo Padovan
2017-04-06 14:35           ` Javier Martinez Canillas
2017-06-09 15:38     ` Nicolas Dufresne
2017-04-04 11:34 ` Sakari Ailus
2017-04-05 15:24   ` Gustavo Padovan
2017-04-05 20:43     ` Sakari Ailus
2017-05-25  0:31 ` Gustavo Padovan
2017-06-08 20:17   ` Mauro Carvalho Chehab
2017-06-08 21:36     ` Shuah Khan
2017-06-09  6:25       ` Gustavo Padovan
2017-06-09 16:09         ` Shuah Khan
2017-06-09  6:15     ` 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=20170313192035.29859-9-gustavo@padovan.org \
    --to=gustavo@padovan.org \
    --cc=hverkuil@xs4all.nl \
    --cc=javier@osg.samsung.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@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 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.