[PATCH 02/11] dma-buf: add new dma_fence_chain container v2

Christian König ckoenig.leichtzumerken at gmail.com
Thu Nov 29 11:10:15 UTC 2018


Am 29.11.18 um 11:32 schrieb Chris Wilson:
> Quoting Christian König (2018-11-28 14:50:12)
>> +/**
>> + * dma_fence_chain_for_each - iterate over all fences in chain
>> + * @fence: starting point as well as current fence
>> + *
>> + * Iterate over all fences in the chain. We keep a reference to the current
>> + * fence while inside the loop which must be dropped when breaking out.
>> + */
>> +#define dma_fence_chain_for_each(fence)        \
>> +       for (dma_fence_get(fence);fence;fence=dma_fence_chain_walk(fence))
> That's a nasty macro. Can we have separate vars for iter and head?

Good idea, I was also running into some issues where making this 
distinct could have made it more easier to understand.

Going to change that,
Christian.

>
> Reading,
>
>> +static bool dma_fence_chain_signaled(struct dma_fence *fence)
>> +{
>> +       dma_fence_chain_for_each(fence) {
>> +               struct dma_fence_chain *chain = to_dma_fence_chain(fence);
>> +               struct dma_fence *f = chain ? chain->fence : fence;
>> +
>> +               if (!dma_fence_is_signaled(f)) {
>> +                       dma_fence_put(fence);
>> +                       return false;
>> +               }
>> +       }
>> +
>> +       return true;
>> +}
> it's not clear whether the intent there is to use the in parameter fence
> or an iter.
>
> for (it = dma_fence_get(fence); it; it = dma_fence_chain_walk(it))
>
> dma_fence_chain_for_each(it, fence) {
> 	struct dma_fence_chain *chain = to_dma_fence_chain(it);
> 	struct dma_fence *f = chain ? chain->fence : it;
>
> 	if (!dma_fence_is_signaled(f)) {
> 		dma_fence_put(it);
> 		return false;
> 	}
> }
> -Chris



More information about the amd-gfx mailing list