[Intel-gfx] [PATCH 38/50] drm/i915: Pull scatterlist utils out of i915_gem.h

Chris Wilson chris at chris-wilson.co.uk
Wed Apr 17 11:17:30 UTC 2019


Quoting Matthew Auld (2019-04-17 12:11:21)
> On Fri, 12 Apr 2019 at 09:54, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> > diff --git a/drivers/gpu/drm/i915/i915_scatterlist.h b/drivers/gpu/drm/i915/i915_scatterlist.h
> > new file mode 100644
> > index 000000000000..ca9ddee41e88
> > --- /dev/null
> > +++ b/drivers/gpu/drm/i915/i915_scatterlist.h
> > @@ -0,0 +1,128 @@
> > +/*
> > + * SPDX-License-Identifier: MIT
> > + *
> > + * Copyright © 2016 Intel Corporation
> > + */
> > +
> > +#ifndef I915_SCATTERLIST_H
> > +#define I915_SCATTERLIST_H
> 
> I915_SCATTERLIST_H
> __I915_SCATTERLIST_H
> __I915_SCATTERLIST_H__
> 
> What is the proper style for that? Or just meh?

Yeah, I have no idea why the different fashions. Eventually we'll decree
the one true way and purge the heretics.

> > +/**
> > + * for_each_sgt_dma - iterate over the DMA addresses of the given sg_table
> > + * @__dmap:    DMA address (output)
> > + * @__iter:    'struct sgt_iter' (iterator state, internal)
> > + * @__sgt:     sg_table to iterate over (input)
> > + */
> > +#define for_each_sgt_dma(__dmap, __iter, __sgt)                                \
> > +       for ((__iter) = __sgt_iter((__sgt)->sgl, true);                 \
> > +            ((__dmap) = (__iter).dma + (__iter).curr);                 \
> > +            (((__iter).curr += I915_GTT_PAGE_SIZE) >= (__iter).max) ?  \
> 
> Do we need an #include "i915_gem_gtt.h" somewhere, or meh?

Hmm, indeed. Not so utilitarian. Do we need to pass in the inc? That
seems like a better plan.
-Chris


More information about the Intel-gfx mailing list