[igt-dev] [PATCH i-g-t v3 1/2] lib/i915: add mmap_offset support
Chris Wilson
chris at chris-wilson.co.uk
Mon Feb 25 22:46:28 UTC 2019
Quoting Antonio Argenziano (2019-02-25 18:28:03)
> @@ -812,7 +827,12 @@ void *__gem_mmap__wc(int fd, uint32_t handle, uint64_t offset, uint64_t size, un
> */
> void *gem_mmap__wc(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsigned prot)
> {
> - void *ptr = __gem_mmap__wc(fd, handle, offset, size, prot);
> + void *ptr;
> +
> + ptr = __gem_mmap_offset(fd, handle, offset, size, prot, LOCAL_I915_MMAP_OFFSET_WC);
> + if (!ptr)
> + ptr = __gem_mmap__wc(fd, handle, offset, size, prot);
> +
> igt_assert(ptr);
> return ptr;
> }
> @@ -849,7 +869,12 @@ void *__gem_mmap__cpu(int fd, uint32_t handle, uint64_t offset, uint64_t size, u
> */
> void *gem_mmap__cpu(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsigned prot)
> {
> - void *ptr = __gem_mmap__cpu(fd, handle, offset, size, prot);
> + void *ptr;
> +
> + ptr = __gem_mmap_offset(fd, handle, offset, size, prot, LOCAL_I915_MMAP_OFFSET_WB);
> + if (!ptr)
> + ptr = __gem_mmap(fd, handle, offset, size, prot, 0);
> +
> igt_assert(ptr);
> return ptr;
I would make moving gem_mmmap__wc, gem_mmap__cpu, gem_mmap__gtt and
their support over to gem_mman.c as patch 0. Then introduce
mmap__offset.
-Chris
More information about the igt-dev
mailing list