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


Groups > linux.kernel > #1429929

[RFC 4/5] dma-buf/fence-array: add fence_array_get_fences()

From Gustavo Padovan <gustavo@padovan.org>
Newsgroups linux.kernel
Subject [RFC 4/5] dma-buf/fence-array: add fence_array_get_fences()
Date 2016-06-23 17:40 +0200
Message-ID <rNeTw-3z3-19@gated-at.bofh.it> (permalink)
References <rNeTw-3z3-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

This function returns a copy of the array of fences.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 drivers/dma-buf/fence-array.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/dma-buf/fence-array.c b/drivers/dma-buf/fence-array.c
index 601448a..ce98249 100644
--- a/drivers/dma-buf/fence-array.c
+++ b/drivers/dma-buf/fence-array.c
@@ -33,6 +33,19 @@ static const char *fence_array_get_timeline_name(struct fence *fence)
 	return "unbound";
 }
 
+static struct fence **fence_array_get_fences(struct fence *fence)
+{
+	struct fence_array *array = to_fence_array(fence);
+	struct fence **fences;
+
+	fences = kmalloc(array->num_fences * sizeof(*fences), GFP_KERNEL);
+	if (!fences)
+		return NULL;
+
+	memcpy(fences, array->fences, array->num_fences * sizeof(*fences));
+	return fences;
+}
+
 static void fence_array_cb_func(struct fence *f, struct fence_cb *cb)
 {
 	struct fence_array_cb *array_cb =
@@ -109,6 +122,7 @@ static void fence_array_release(struct fence *fence)
 const struct fence_ops fence_array_ops = {
 	.get_driver_name = fence_array_get_driver_name,
 	.get_timeline_name = fence_array_get_timeline_name,
+	.get_fences = fence_array_get_fences,
 	.enable_signaling = fence_array_enable_signaling,
 	.signaled = fence_array_signaled,
 	.wait = fence_default_wait,
-- 
2.5.5

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


Thread

[RFC 0/5] rework fences on struct sync_file Gustavo Padovan <gustavo@padovan.org> - 2016-06-23 17:40 +0200
  [RFC 3/5] dma-buf/fence: add .get_fences() ops Gustavo Padovan <gustavo@padovan.org> - 2016-06-23 17:40 +0200
    Re: [RFC 3/5] dma-buf/fence: add .get_fences() ops Chris Wilson <chris@chris-wilson.co.uk> - 2016-06-23 22:50 +0200
  [RFC 4/5] dma-buf/fence-array: add fence_array_get_fences() Gustavo Padovan <gustavo@padovan.org> - 2016-06-23 17:40 +0200
    Re: [RFC 4/5] dma-buf/fence-array: add fence_array_get_fences() Chris Wilson <chris@chris-wilson.co.uk> - 2016-06-23 22:40 +0200
  [RFC 5/5] dma-buf/sync_file: rework fence storage in struct file Gustavo Padovan <gustavo@padovan.org> - 2016-06-23 17:40 +0200
    Re: [RFC 5/5] dma-buf/sync_file: rework fence storage in struct file Chris Wilson <chris@chris-wilson.co.uk> - 2016-06-23 23:30 +0200
      Re: [RFC 5/5] dma-buf/sync_file: rework fence storage in struct file Gustavo Padovan <gustavo@padovan.org> - 2016-06-24 15:30 +0200
  [RFC 2/5] dma-buf/fence-array: add fence_array_teardown() Gustavo Padovan <gustavo@padovan.org> - 2016-06-23 17:40 +0200
  [RFC 1/5] dma-buf/fence: add .teardown() ops Gustavo Padovan <gustavo@padovan.org> - 2016-06-23 17:40 +0200
    Re: [RFC 1/5] dma-buf/fence: add .teardown() ops Chris Wilson <chris@chris-wilson.co.uk> - 2016-06-23 22:50 +0200
      Re: [RFC 1/5] dma-buf/fence: add .teardown() ops Gustavo Padovan <gustavo@padovan.org> - 2016-06-24 15:20 +0200
  Re: [RFC 0/5] rework fences on struct sync_file Gustavo Padovan <gustavo@padovan.org> - 2016-06-24 15:20 +0200
    Re: [RFC 0/5] rework fences on struct sync_file Christian König <deathsimple@vodafone.de> - 2016-06-24 16:20 +0200
      Re: [RFC 0/5] rework fences on struct sync_file Gustavo Padovan <gustavo.padovan@collabora.com> - 2016-06-24 17:00 +0200
        Re: [RFC 0/5] rework fences on struct sync_file Gustavo Padovan <gustavo.padovan@collabora.com> - 2016-06-24 17:20 +0200

csiph-web