diff mbox

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

Message ID 20170217183536.26100-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson Feb. 17, 2017, 6:35 p.m. UTC
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@chris-wilson.co.uk>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Gustavo Padovan <gustavo@padovan.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: "Christian König" <christian.koenig@amd.com>
---
 drivers/dma-buf/dma-fence-array.c | 3 +++
 include/linux/dma-fence-array.h   | 4 ++++
 2 files changed, 7 insertions(+)

Comments

Christian König Feb. 18, 2017, 7:41 a.m. UTC | #1
Am 17.02.2017 um 19:35 schrieb Chris Wilson:
> 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@chris-wilson.co.uk>
> Cc: Sumit Semwal <sumit.semwal@linaro.org>
> Cc: Gustavo Padovan <gustavo@padovan.org>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: "Christian König" <christian.koenig@amd.com>

Reviewed-by: Christian König <christian.koenig@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;
>   
>   /**
diff mbox

Patch

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;
 
 /**