[PATCH 1/9] dma-buf: fix dma_fence_array_signaled

Christian König ckoenig.leichtzumerken at gmail.com
Mon Aug 26 14:57:23 UTC 2019


The function is supposed to give a hint even if signaling is not enabled.

Signed-off-by: Christian König <christian.koenig at amd.com>
---
 drivers/dma-buf/dma-fence-array.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/dma-buf/dma-fence-array.c b/drivers/dma-buf/dma-fence-array.c
index d3fbd950be94..52068ee5eb35 100644
--- a/drivers/dma-buf/dma-fence-array.c
+++ b/drivers/dma-buf/dma-fence-array.c
@@ -103,8 +103,18 @@ static bool dma_fence_array_enable_signaling(struct dma_fence *fence)
 static bool dma_fence_array_signaled(struct dma_fence *fence)
 {
 	struct dma_fence_array *array = to_dma_fence_array(fence);
+	int i, num_pending;
 
-	return atomic_read(&array->num_pending) <= 0;
+	num_pending = atomic_read(&array->num_pending);
+	if (test_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT, &fence->flags))
+		return num_pending <= 0;
+
+	for (i = 0; i < array->num_fences; ++i)
+		if (dma_fence_is_signaled(array->fences[i]) &&
+		    --num_pending == 0)
+			return true;
+
+	return false;
 }
 
 static void dma_fence_array_release(struct dma_fence *fence)
-- 
2.17.1



More information about the dri-devel mailing list