[PATCH 1/9] dma-buf: fix dma_fence_array_signaled
Chris Wilson
chris at chris-wilson.co.uk
Tue Aug 27 11:44:27 UTC 2019
Quoting Christian König (2019-08-26 15:57:23)
> 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;
num_fences may be 0 (it's not rejected in construction and works
currently as a simple always-signaled stub).
if (!test_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT, &fence->flags)) {
for (i = 0; i < array->num_fences; ++i)
if (dma_fence_is_signaled(array->fences[i]) &&
--num_pending == 0)
break;
}
return num_pending <= 0;
More information about the dri-devel
mailing list