diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2017-01-16 15:21:30 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2017-01-19 10:17:39 +0000 |
commit | a01cb37affb7ac698ed260c0e31d02af8df6b785 (patch) | |
tree | 7aedf9ed763ce01101b950897ee394b5ca7ebca7 /drivers/gpu/drm/i915/i915_vma.c | |
parent | 4ea9527cc03e73afc6a4ac5979d1ecde43b85cf3 (diff) | |
download | linux-a01cb37affb7ac698ed260c0e31d02af8df6b785.tar.gz |
drm/i915: Remove i915_vma_create from VMA API
With the introduce of i915_vma_instance() for obtaining the VMA
singleton for a (obj, vm, view) tuple, we can remove the
i915_vma_create() in favour of a single entry point. We do incur a
lookup onto an empty tree, but the i915_vma_create() were being called
infrequently and during initialisation, so the small overhead is
negligible.
v2: Drop the i915_ prefix from the now static vma_create() function
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170116152131.18089-4-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers/gpu/drm/i915/i915_vma.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_vma.c | 35 |
1 files changed, 4 insertions, 31 deletions
diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c index b4d7b51266d2..cb415bfe22d7 100644 --- a/drivers/gpu/drm/i915/i915_vma.c +++ b/drivers/gpu/drm/i915/i915_vma.c @@ -69,16 +69,14 @@ i915_vma_retire(struct i915_gem_active *active, } static struct i915_vma * -__i915_vma_create(struct drm_i915_gem_object *obj, - struct i915_address_space *vm, - const struct i915_ggtt_view *view) +vma_create(struct drm_i915_gem_object *obj, + struct i915_address_space *vm, + const struct i915_ggtt_view *view) { struct i915_vma *vma; struct rb_node *rb, **p; int i; - GEM_BUG_ON(vm->closed); - vma = kmem_cache_zalloc(to_i915(obj->base.dev)->vmas, GFP_KERNEL); if (vma == NULL) return ERR_PTR(-ENOMEM); @@ -187,31 +185,6 @@ i915_vma_lookup(struct drm_i915_gem_object *obj, } /** - * i915_vma_create - creates a VMA - * @obj: parent &struct drm_i915_gem_object to be mapped - * @vm: address space in which the mapping is located - * @view: additional mapping requirements - * - * i915_vma_create() allocates a new VMA of the @obj in the @vm with - * @view characteristics. - * - * Must be called with struct_mutex held. - * - * Returns the vma if found, or an error pointer. - */ -struct i915_vma * -i915_vma_create(struct drm_i915_gem_object *obj, - struct i915_address_space *vm, - const struct i915_ggtt_view *view) -{ - lockdep_assert_held(&obj->base.dev->struct_mutex); - GEM_BUG_ON(view && !i915_is_ggtt(vm)); - GEM_BUG_ON(i915_vma_lookup(obj, vm, view)); - - return __i915_vma_create(obj, vm, view); -} - -/** * i915_vma_instance - return the singleton instance of the VMA * @obj: parent &struct drm_i915_gem_object to be mapped * @vm: address space in which the mapping is located @@ -239,7 +212,7 @@ i915_vma_instance(struct drm_i915_gem_object *obj, vma = i915_vma_lookup(obj, vm, view); if (!vma) - vma = i915_vma_create(obj, vm, view); + vma = vma_create(obj, vm, view); GEM_BUG_ON(!IS_ERR(vma) && i915_vma_is_closed(vma)); GEM_BUG_ON(!IS_ERR(vma) && i915_vma_compare(vma, vm, view)); |