[igt-dev] [PATCH i-g-t 2/2] lib/i915/gem_mman: mmap to the CPU instead of the GTT in some tests
Chris Wilson
chris at chris-wilson.co.uk
Tue Nov 19 22:28:09 UTC 2019
Quoting Summers, Stuart (2019-11-19 22:00:17)
> On Tue, 2019-11-19 at 19:20 +0000, Chris Wilson wrote:
> > So a possible gem_mmap__device_coherent() {
> > ptr = gem_mmap__offset(.type = WC);
> > if (ptr)
> > return ptr;
> >
> > ptr = gem_mmap__wc();
> > if (ptr)
> > return ptr;
> >
> > return gem_mmap__gt();
> > }
>
> Yeah I've been playing around locally with something like this (or at
> least with the mmap_offset/mmap_gtt, your suggestion is cleaner). The
> problem is in application. Do we apply this to all tests which aren't
> expliclity doing GGTT testing? Or do we start with something like the
> gem_ctx_shared and expand over time? I don't have all of the history
> across the tests, so really appreciate the feedback here Chris.
In almost all cases, gtt was being used only because it provided
coherent [uncached] access. There are a few tests that are explicitly
testing GTT features (and they are easy to spot). The other day I think
I counted around 100 test.c using gem_mmap__gtt of which a quick
inspection said only 10% of those were looking at GTT features.
The biggest challenge is choosing the name and semantics of the
replacement: device/pci_coherent or something like that. And then define
whether or not we use gem_sync() + manual clflush for nonspecific
testing, or stick with gem_set_domain(GTT) as the lowest common
denominator. There's pros/cons for either choice (and there will always
be corner cases that explicitly need one or the other) , just patches
need to be written.
-Chris
More information about the igt-dev
mailing list