If either the previous fence or the newly chained on is an user fence the
dma_fence chain node is considered an user fence as well.

This way the user fence status propagates through the chain.

Signed-off-by: Christian König <christian.koe...@amd.com>
---
 drivers/dma-buf/dma-fence-chain.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/dma-buf/dma-fence-chain.c 
b/drivers/dma-buf/dma-fence-chain.c
index 06f8ef97c6e8..421241607ac2 100644
--- a/drivers/dma-buf/dma-fence-chain.c
+++ b/drivers/dma-buf/dma-fence-chain.c
@@ -253,6 +253,10 @@ void dma_fence_chain_init(struct dma_fence_chain *chain,
        dma_fence_init(&chain->base, &dma_fence_chain_ops,
                       &chain->lock, context, seqno);
 
+       if ((prev && test_bit(DMA_FENCE_FLAG_USER, &prev->flags)) ||
+           test_bit(DMA_FENCE_FLAG_USER, &fence->flags))
+               set_bit(DMA_FENCE_FLAG_USER, &chain->base.flags);
+
        /*
         * Chaining dma_fence_chain container together is only allowed through
         * the prev fence and not through the contained fence.
-- 
2.25.1

Reply via email to