[Intel-gfx] [PATCH 2/2] drm/i915: Remove temporary allocation of dma addresses when rotating
Chris Wilson
chris at chris-wilson.co.uk
Thu Nov 16 11:17:05 UTC 2017
Quoting Joonas Lahtinen (2017-11-16 10:43:42)
> On Tue, 2017-11-14 at 19:11 +0000, Chris Wilson wrote:
> > The object already stores (computed on the fly) the index to dma address
> > so use it instead of reallocating a large temporary array every time we
> > bind a rotated framebuffer.
> >
> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> > Cc: Matthew Auld <matthew.william.auld at gmail.com>
> > Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
> > Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
>
> <SNIP>
>
> > @@ -3665,27 +3665,32 @@ void i915_gem_restore_gtt_mappings(struct drm_i915_private *dev_priv)
> > }
> >
> > static struct scatterlist *
> > -rotate_pages(const dma_addr_t *in, unsigned int offset,
> > - unsigned int width, unsigned int height,
> > - unsigned int stride,
> > +rotate_pages(struct drm_i915_gem_object *obj,
> > + const struct intel_rotation_plane_info *p,
> > struct sg_table *st, struct scatterlist *sg)
> > {
> > unsigned int column, row;
> > - unsigned int src_idx;
> >
> > - for (column = 0; column < width; column++) {
> > - src_idx = stride * (height - 1) + column;
> > - for (row = 0; row < height; row++) {
> > - st->nents++;
> > + for (column = 0; column < p->width; column++) {
> > + unsigned long src_idx =
> > + p->stride * (p->height - 1) + column + p->offset;
>
> Wouldn't you rather do offset + ...? It's the most dominating factor.
Yes. p->offset matches image in the (image, row, column) hierarchy. It
just happens that when I was playing with the selftests, I used very
small (and unrealistic) offsets.
-Chris
More information about the Intel-gfx
mailing list