drm/i915: Refactor duplicate object vmap functions
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 8 Apr 2016 11:11:11 +0000 (12:11 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Mon, 11 Apr 2016 16:11:44 +0000 (17:11 +0100)
commit0a798eb92e6dcc1cba45d13d7b75a523e5d0fc4c
tree642e2099c1b77ac324fb76418adeb0a26344fe57
parentd2cad5358ba7c6d94343837cd4d367fb6ce2a33c
drm/i915: Refactor duplicate object vmap functions

We now have two implementations for vmapping a whole object, one for
dma-buf and one for the ringbuffer. If we couple the mapping into the
obj->pages lifetime, then we can reuse an obj->mapping for both and at
the same time couple it into the shrinker. There is a third vmapping
routine in the cmdparser that maps only a range within the object, for
the time being that is left alone, but will eventually use these routines
in order to cache the mapping between invocations.

v2: Mark the failable kmalloc() as __GFP_NOWARN (vsyrjala)
v3: Call unpin_vmap from the right dmabuf unmapper

v4: Rename vmap to map as we don't wish to imply the type of mapping
involved, just that it contiguously maps the object into kernel space.
Add kerneldoc and lockdep annotations

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: Dave Gordon <david.s.gordon@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1460113874-17366-4-git-send-email-chris@chris-wilson.co.uk
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/i915_gem_dmabuf.c
drivers/gpu/drm/i915/intel_ringbuffer.c