[Intel-gfx] [PATCH 1/2] dma-fence: Flag when a fence-array is using signal-on-any

Chris Wilson chris at chris-wilson.co.uk
Fri Feb 17 18:35:35 UTC 2017


Indicate that the fence array will be signaled on the first completion
(signal-on-any mode) as opposed to waiting for all to be signaled.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Sumit Semwal <sumit.semwal at linaro.org>
Cc: Gustavo Padovan <gustavo at padovan.org>
Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
Cc: "Christian König" <christian.koenig at amd.com>
---
 drivers/dma-buf/dma-fence-array.c | 3 +++
 include/linux/dma-fence-array.h   | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/drivers/dma-buf/dma-fence-array.c b/drivers/dma-buf/dma-fence-array.c
index 67eb7c8fb88c..8c48402a2daa 100644
--- a/drivers/dma-buf/dma-fence-array.c
+++ b/drivers/dma-buf/dma-fence-array.c
@@ -137,6 +137,9 @@ struct dma_fence_array *dma_fence_array_create(int num_fences,
 	dma_fence_init(&array->base, &dma_fence_array_ops, &array->lock,
 		       context, seqno);
 
+	if (num_fences > 1 && signal_on_any)
+		__set_bit(DMA_FENCE_ARRAY_SIGNAL_ANY, &array->base.flags);
+
 	array->num_fences = num_fences;
 	atomic_set(&array->num_pending, signal_on_any ? 1 : num_fences);
 	array->fences = fences;
diff --git a/include/linux/dma-fence-array.h b/include/linux/dma-fence-array.h
index 5900945f962d..4270d33d05b3 100644
--- a/include/linux/dma-fence-array.h
+++ b/include/linux/dma-fence-array.h
@@ -49,6 +49,10 @@ struct dma_fence_array {
 	struct dma_fence **fences;
 };
 
+enum {
+	DMA_FENCE_ARRAY_SIGNAL_ANY = DMA_FENCE_FLAG_USER_BITS,
+};
+
 extern const struct dma_fence_ops dma_fence_array_ops;
 
 /**
-- 
2.11.0



More information about the Intel-gfx mailing list