[RFC 4/6] dma-buf/fence: add fence_collection_put()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Gustavo Padovan <gustavo.padovan@xxxxxxxxxxxxxxx>

Put fence_collection data. For that calls fence_put() on all fences
and the user put callback.

Signed-off-by: Gustavo Padovan <gustavo.padovan@xxxxxxxxxxxxxxx>
---
 drivers/dma-buf/fence.c | 17 +++++++++++++++++
 include/linux/fence.h   |  2 ++
 2 files changed, 19 insertions(+)

diff --git a/drivers/dma-buf/fence.c b/drivers/dma-buf/fence.c
index 7b05dbe..a3fe3e7 100644
--- a/drivers/dma-buf/fence.c
+++ b/drivers/dma-buf/fence.c
@@ -530,3 +530,20 @@ fence_init(struct fence *fence, const struct fence_ops *ops,
 	trace_fence_init(fence);
 }
 EXPORT_SYMBOL(fence_init);
+
+/**
+ * fence_collection_put - put all the fences in a collection
+ * @collection:	[in]	the collection to put fences
+ *
+ * This functions unrefs all fences in the collection.
+ */
+void fence_collection_put(struct fence_collection *collection)
+{
+	int i;
+
+	for (i = 0 ; i < collection->num_fences ; i++)
+		fence_put(collection->fences[i]);
+
+	collection->func(collection->user_data);
+}
+EXPORT_SYMBOL(fence_collection_put);
diff --git a/include/linux/fence.h b/include/linux/fence.h
index 3d1151f..3f871b0 100644
--- a/include/linux/fence.h
+++ b/include/linux/fence.h
@@ -244,6 +244,8 @@ int fence_add_callback(struct fence *fence, struct fence_cb *cb,
 bool fence_remove_callback(struct fence *fence, struct fence_cb *cb);
 void fence_enable_sw_signaling(struct fence *fence);
 
+void fence_collection_put(struct fence_collection *collection);
+
 /**
  * fence_is_signaled_locked - Return an indication if the fence is signaled yet.
  * @fence:	[in]	the fence to check
-- 
2.5.0

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux