[igt-dev] [PATCH i-g-t 2/2] i915/treewide: Replace gem_mmap__gtt() by gem_mmap__device_coherent()

Chris Wilson chris at chris-wilson.co.uk
Sat Jan 11 08:44:59 UTC 2020


Quoting Ashutosh Dixit (2020-01-11 05:36:53)
> diff --git a/benchmarks/gem_busy.c b/benchmarks/gem_busy.c
> index 2fb1edf98..55db17a7d 100644
> --- a/benchmarks/gem_busy.c
> +++ b/benchmarks/gem_busy.c
> @@ -188,7 +188,7 @@ static int loop(unsigned ring, int reps, int ncpus, unsigned flags)
>         if (gem_mmap__has_wc(fd))
>                 batch = gem_mmap__wc(fd, obj[1].handle, 0, 4096, PROT_WRITE);
>         else
> -               batch = gem_mmap__gtt(fd, obj[1].handle, 4096, PROT_WRITE);
> +               batch = gem_mmap__device_coherent(fd, obj[1].handle, 0, 4096, PROT_WRITE);

Chunks like this want the redundant branches eliminated.

>         gem_set_domain(fd, obj[1].handle,
>                         I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
>         batch[0] = MI_BATCH_BUFFER_END;
> diff --git a/benchmarks/gem_mmap.c b/benchmarks/gem_mmap.c
> index d3d4ad310..518f9fd9b 100644
> --- a/benchmarks/gem_mmap.c
> +++ b/benchmarks/gem_mmap.c
> @@ -122,7 +122,7 @@ int main(int argc, char **argv)
>                 gem_set_domain(fd, handle, I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU);
>                 break;
>         case GTT:
> -               ptr = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_WRITE);
> +               ptr = gem_mmap__device_coherent(fd, handle, 0, OBJECT_SIZE, PROT_WRITE);
>                 gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);

But if it says it is testing GTT, I want GTT, and only GTT!

Here, we want OFFSET_WC etc added. So leave this style for a later patch,
and focus on just converting the ones where we want any old mapping to
device_coherent(). Another patch can focus on converting any __cpu maps
that are only used for writes to device_coherent.
-Chris


More information about the igt-dev mailing list