If we want a contiguous mapping of a single page sized object, we can forgo using vmap() and just use a regular kmap(). (This maybe worth lifting to the core, with the additional proviso that the pgprot_t is compatible.) Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> --- drivers/gpu/drm/i915/i915_gem.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index cca45f60d0bd..7be5a8fb9180 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -1882,14 +1882,17 @@ i915_gem_object_put_pages(struct drm_i915_gem_object *obj) * lists early. */ list_del(&obj->global_list); - ops->put_pages(obj); - obj->pages = NULL; - if (obj->vmapping) { - vunmap(obj->vmapping); + if (obj->base.size == PAGE_SIZE) + kunmap(sg_page(obj->pages->sgl)); + else + vunmap(obj->vmapping); obj->vmapping = NULL; } + ops->put_pages(obj); + obj->pages = NULL; + i915_gem_object_invalidate(obj); return 0; @@ -2069,15 +2072,22 @@ void *i915_gem_object_pin_vmap(struct drm_i915_gem_object *obj) i915_gem_object_pin_pages(obj); if (obj->vmapping == NULL) { - struct sg_page_iter sg_iter; struct page **pages; - int n; - n = obj->base.size >> PAGE_SHIFT; - pages = drm_malloc_gfp(n, sizeof(*pages), GFP_TEMPORARY); + pages = NULL; + if (obj->base.size == PAGE_SIZE) + obj->vmapping = kmap(sg_page(obj->pages->sgl)); + else + pages = drm_malloc_gfp(obj->base.size >> PAGE_SHIFT, + sizeof(*pages), + GFP_TEMPORARY); if (pages != NULL) { + struct sg_page_iter sg_iter; + int n; + n = 0; - for_each_sg_page(obj->pages->sgl, &sg_iter, obj->pages->nents, 0) + for_each_sg_page(obj->pages->sgl, &sg_iter, + obj->pages->nents, 0) pages[n++] = sg_page_iter_page(&sg_iter); obj->vmapping = vmap(pages, n, 0, PAGE_KERNEL); -- 2.7.0.rc3 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx