[Intel-gfx] [PATCH] drm/i915/gem: Support discontiguous lmem object maps
Matthew Auld
matthew.william.auld at gmail.com
Thu Jan 2 11:39:41 UTC 2020
On Thu, 2 Jan 2020 at 10:38, Chris Wilson <chris at chris-wilson.co.uk> wrote:
>
> Create a vmap for discontinguous lmem objects to support
> i915_gem_object_pin_map().
Yes, please.
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Matthew Auld <matthew.auld at intel.com>
> ---
[snip]
> @@ -288,12 +284,28 @@ static void *i915_gem_object_map(struct drm_i915_gem_object *obj,
> pgprot = pgprot_writecombine(PAGE_KERNEL_IO);
> break;
> }
> - addr = vmap(pages, n_pages, 0, pgprot);
>
> - if (pages != stack_pages)
> - kvfree(pages);
> + if (i915_gem_object_has_struct_page(obj)) {
> + struct sgt_iter iter;
> + struct page *page;
> + pte_t **ptes = mem;
> +
> + for_each_sgt_page(page, iter, sgt)
> + **ptes++ = mk_pte(page, pgprot);
> + } else {
> + const resource_size_t iomap = obj->mm.region->iomap.base;
> + struct sgt_iter iter;
> + dma_addr_t addr;
> + pte_t **ptes = mem;
> +
> + for_each_sgt_daddr(addr, iter, sgt)
addr -= region.start; for poor old fake local-memory.
> + **ptes++ = iomap_pte(iomap, addr, pgprot);
More information about the Intel-gfx
mailing list