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

Chris Wilson chris at chris-wilson.co.uk
Thu Nov 29 10:32:37 UTC 2018


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?

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