Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1728385

[PATCH v3 12/15] [media] vb2: add videobuf2 dma-buf fence helpers

From Gustavo Padovan <gustavo@padovan.org>
Newsgroups linux.kernel
Subject [PATCH v3 12/15] [media] vb2: add videobuf2 dma-buf fence helpers
Date 2017-09-07 20:50 +0200
Message-ID <una2f-3SJ-53@gated-at.bofh.it> (permalink)
References <una2d-3SJ-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 000000000000..ed5612ca03d6
--- /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.13.5

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 00/15] V4L2 Explicit Synchronization support Gustavo Padovan <gustavo@padovan.org> - 2017-09-07 20:50 +0200
  [PATCH v3 14/15] fs/files: export close_fd() symbol Gustavo Padovan <gustavo@padovan.org> - 2017-09-07 20:50 +0200
    Re: [PATCH v3 14/15] fs/files: export close_fd() symbol Eric Biggers <ebiggers3@gmail.com> - 2017-09-07 21:00 +0200
    Re: [PATCH v3 14/15] fs/files: export close_fd() symbol Al Viro <viro@ZenIV.linux.org.uk> - 2017-09-07 22:40 +0200
      Re: [PATCH v3 14/15] fs/files: export close_fd() symbol Gustavo Padovan <gustavo@padovan.org> - 2017-09-07 23:30 +0200
        Re: [PATCH v3 14/15] fs/files: export close_fd() symbol Al Viro <viro@ZenIV.linux.org.uk> - 2017-09-08 00:10 +0200
    Re: [PATCH v3 14/15] fs/files: export close_fd() symbol Hans Verkuil <hverkuil@xs4all.nl> - 2017-09-08 00:10 +0200
      Re: [PATCH v3 14/15] fs/files: export close_fd() symbol Gustavo Padovan <gustavo.padovan@collabora.com> - 2017-09-08 00:20 +0200
  [PATCH v3 08/15] [media] vb2: add .buffer_queued() to notify queueing in the driver Gustavo Padovan <gustavo@padovan.org> - 2017-09-07 20:50 +0200
  [PATCH v3 03/15] [media] vb2: check earlier if stream can be started Gustavo Padovan <gustavo@padovan.org> - 2017-09-07 20:50 +0200
  [PATCH v3 07/15] [media] v4l: add V4L2_EVENT_BUF_QUEUED event Gustavo Padovan <gustavo@padovan.org> - 2017-09-07 20:50 +0200
  [PATCH v3 12/15] [media] vb2: add videobuf2 dma-buf fence helpers Gustavo Padovan <gustavo@padovan.org> - 2017-09-07 20:50 +0200
  [PATCH v3 09/15] [media] v4l: add support to BUF_QUEUED event Gustavo Padovan <gustavo@padovan.org> - 2017-09-07 20:50 +0200
  [PATCH v3 02/15] [media] vb2: add explicit fence user API Gustavo Padovan <gustavo@padovan.org> - 2017-09-07 20:50 +0200
  [PATCH v3 13/15] [media] vb2: add infrastructure to support out-fences Gustavo Padovan <gustavo@padovan.org> - 2017-09-07 20:50 +0200

csiph-web