[Intel-gfx] [PATCH] drm/i915: s/for_each_sgt_dma/for_each_sgt_daddr/

Chris Wilson chris at chris-wilson.co.uk
Thu Aug 29 20:45:47 UTC 2019


Quoting Matthew Auld (2019-08-29 21:19:19)
> The sg_table for our backing store might contain addresses from
> stolen-memory or in the future local-memory, at which point this is no
> longer a dma-iterator. As a consequence we should now break on NULL
> iter.sgp, instead of dmap == 0 which is considered an invalid dma
> address.

Function                                     old     new   delta
gen8_ggtt_insert_entries                     211     192     -19
gen6_ggtt_insert_entries                     292     262     -30
i915_error_object_create                     996     954     -42

Why didn't you say so!

> Signed-off-by: Matthew Auld <matthew.auld at intel.com>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>

> -#define __for_each_sgt_dma(__dmap, __iter, __sgt, __step)              \
> +#define __for_each_sgt_daddr(__dp, __iter, __sgt, __step)              \
>         for ((__iter) = __sgt_iter((__sgt)->sgl, true);                 \
> -            ((__dmap) = (__iter).dma + (__iter).curr);                 \
> +            ((__dp) = (__iter).dma + (__iter).curr), (__iter).sgp;     \
>              (((__iter).curr += (__step)) >= (__iter).max) ?            \
>              (__iter) = __sgt_iter(__sg_next((__iter).sgp), true), 0 : 0)

__sgt_iter() sets all to 0 if __sg_next() reports the end of the chain.

Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris


More information about the Intel-gfx mailing list