[igt-dev] [PATCH i-g-t v7 4/5] i915/gem_render_copy.c: Simplify code by switch to rendercopy bufmgr

Chris Wilson chris at chris-wilson.co.uk
Mon Jan 13 16:07:19 UTC 2020


Quoting Zbigniew Kempczyński (2020-01-13 09:19:07)
> @@ -209,13 +94,13 @@ copy_from_linear_buf(data_t *data, struct igt_buf *src, struct igt_buf *dst)
>  
>         gem_set_domain(data->drm_fd, src->bo->handle,
>                        I915_GEM_DOMAIN_CPU, 0);
> -       linear = gem_mmap__cpu(data->drm_fd, src->bo->handle, 0,
> -                              src->bo->size, PROT_READ);
> +       linear = __gem_mmap_offset__cpu(data->drm_fd, src->bo->handle, 0,
> +                                       src->bo->size, PROT_READ);
> +       if (!linear)
> +               linear = gem_mmap__cpu(data->drm_fd, src->bo->handle, 0,
> +                                      src->bo->size, PROT_READ);

There's an argument here for
gem_mmap__cache_coherent() or (gem_mmap__cpu_coherent)

We may want something like:

linear = gem_mmap__cache_coherent();
if (!linear) {
	linear = gem_mmap__device_coherent();
	for_each_page(linear) {
		igt_memcpy_from_wc(tmp, linear + page, PAGE_SIZE);
		copy_linear_to_yt(data, dst + page, tmp);
	}
}

For complete belt and braces.
-Chris


More information about the igt-dev mailing list