[igt-dev] [PATCH i-g-t 8/9] lib/igt_fb: Speed up format conversion for local memory

Imre Deak imre.deak at intel.com
Thu Jan 30 18:20:22 UTC 2020


On Thu, Jan 30, 2020 at 03:10:59PM +0200, Imre Deak wrote:
> On Thu, Jan 30, 2020 at 12:12:06PM +0000, Chris Wilson wrote:
> > Quoting Imre Deak (2020-01-30 12:04:09)
> > > On Thu, Jan 30, 2020 at 10:24:05AM +0000, Chris Wilson wrote:
> > > > Quoting Imre Deak (2020-01-29 18:16:00)
> > > > > To speed up the conversion that needs to read from a dGFX local memory
> > > > > use the same trick as what's used for GTT apertures and make a copy
> > > > > first into system memory.
> > > > > 
> > > > > Signed-off-by: Imre Deak <imre.deak at intel.com>
> > > > > ---
> > > > >  lib/igt_fb.c | 4 ++++
> > > > >  1 file changed, 4 insertions(+)
> > > > > 
> > > > > diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> > > > > index 30f3bfba..ef3fa2ed 100644
> > > > > --- a/lib/igt_fb.c
> > > > > +++ b/lib/igt_fb.c
> > > > > @@ -3427,6 +3427,10 @@ static void create_cairo_surface__convert(int fd, struct igt_fb *fb)
> > > > >         if (use_enginecopy(fb) || use_blitter(fb) ||
> > > > >             igt_vc4_is_tiled(fb->modifier)) {
> > > > >                 setup_linear_mapping(&blit->base);
> > > > > +
> > > > > +               /* speed things up by working from a copy in system memory */
> > > > > +               cvt.src.slow_reads =
> > > > > +                       is_i915_device(fd) && !gem_has_mappable_ggtt(fd);
> > > > 
> > > > Any read from WC (including from GGTT) is greatly improved by using
> > > > memcpy_from_wc, and it even works with X/Y-tiling through fences.
> > > > 
> > > > slow_reads is a question of the mapping, at the time of use.
> > > 
> > > Yes, setting slow_reads above will lead to a memcpy_from_wc() of the
> > > source to a system memory buf and the conversion will happen from the
> > > latter. What's slow is the random access read during conversion from
> > > local memory.
> > 
> > We have fast routines for those, if needed. We can read from tiled
> > surfaces faster than the HW can detile in most cases.
> 
> Not sure what you mean here. The above change is to make sure
> conversions between YUV/RGB formats are fast even if the buffer is not
> tiled.

FTR: After discussing with Ville, I checked a version that blits to
system memory directly, but that was somewhat slower than blitting to
local memory and then memcpy_from_wc() that.

> 
> > -Chris
> _______________________________________________
> igt-dev mailing list
> igt-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev


More information about the igt-dev mailing list