Created
May 25, 2022 19:28
-
-
Save lucasdemarchi/b8ccd40e9b27150af5f0a89d4b843271 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/drivers/dma-buf/dma-fence-array.c b/drivers/dma-buf/dma-fence-array.c | |
index 3e07f961e2f3d7..c6fde5eaa53439 100644 | |
--- a/drivers/dma-buf/dma-fence-array.c | |
+++ b/drivers/dma-buf/dma-fence-array.c | |
@@ -158,6 +158,8 @@ struct dma_fence_array *dma_fence_array_create(int num_fences, | |
{ | |
struct dma_fence_array *array; | |
size_t size = sizeof(*array); | |
+ unsigned num_pending = 0; | |
+ struct dma_fence **f; | |
/* Allocate the callback structures behind the array. */ | |
size += num_fences * sizeof(struct dma_fence_array_cb); | |
@@ -171,7 +173,14 @@ struct dma_fence_array *dma_fence_array_create(int num_fences, | |
init_irq_work(&array->work, irq_dma_fence_array_work); | |
array->num_fences = num_fences; | |
- atomic_set(&array->num_pending, signal_on_any ? 1 : num_fences); | |
+ | |
+ for (f = fences; f < fences + num_fences; f++) | |
+ num_pending += !dma_fence_is_signaled(*f); | |
+ | |
+ if (signal_on_any) | |
+ num_pending = !!num_pending; | |
+ | |
+ atomic_set(&array->num_pending, num_pending); | |
array->fences = fences; | |
array->base.error = PENDING_ERROR; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment