Commit 25dc556a authored by Chris Wilson's avatar Chris Wilson

drm/i915: Wrap drm_gem_object_reference in i915_gem_object_get

Ultimately wraps kref_get(), so adopt its nomenclature for consistency
with other subsystems.

s/drm_gem_object_reference/i915_gem_object_get/
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/1469005202-9659-5-git-send-email-chris@chris-wilson.co.ukReviewed-by: default avatarDave Gordon <david.s.gordon@intel.com>
Reviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1469017917-15134-4-git-send-email-chris@chris-wilson.co.uk
parent 03ac0642
...@@ -2306,6 +2306,17 @@ __deprecated ...@@ -2306,6 +2306,17 @@ __deprecated
extern struct drm_gem_object * extern struct drm_gem_object *
drm_gem_object_lookup(struct drm_file *file, u32 handle); drm_gem_object_lookup(struct drm_file *file, u32 handle);
__attribute__((nonnull))
static inline struct drm_i915_gem_object *
i915_gem_object_get(struct drm_i915_gem_object *obj)
{
drm_gem_object_reference(&obj->base);
return obj;
}
__deprecated
extern void drm_gem_object_reference(struct drm_gem_object *);
static inline bool static inline bool
i915_gem_object_has_struct_page(const struct drm_i915_gem_object *obj) i915_gem_object_has_struct_page(const struct drm_i915_gem_object *obj)
{ {
......
...@@ -289,7 +289,7 @@ drop_pages(struct drm_i915_gem_object *obj) ...@@ -289,7 +289,7 @@ drop_pages(struct drm_i915_gem_object *obj)
struct i915_vma *vma, *next; struct i915_vma *vma, *next;
int ret; int ret;
drm_gem_object_reference(&obj->base); i915_gem_object_get(obj);
list_for_each_entry_safe(vma, next, &obj->vma_list, obj_link) list_for_each_entry_safe(vma, next, &obj->vma_list, obj_link)
if (i915_vma_unbind(vma)) if (i915_vma_unbind(vma))
break; break;
...@@ -2361,7 +2361,7 @@ void i915_vma_move_to_active(struct i915_vma *vma, ...@@ -2361,7 +2361,7 @@ void i915_vma_move_to_active(struct i915_vma *vma,
/* Add a reference if we're newly entering the active list. */ /* Add a reference if we're newly entering the active list. */
if (obj->active == 0) if (obj->active == 0)
drm_gem_object_reference(&obj->base); i915_gem_object_get(obj);
obj->active |= intel_engine_flag(engine); obj->active |= intel_engine_flag(engine);
list_move_tail(&obj->engine_list[engine->id], &engine->active_list); list_move_tail(&obj->engine_list[engine->id], &engine->active_list);
......
...@@ -278,8 +278,7 @@ struct drm_gem_object *i915_gem_prime_import(struct drm_device *dev, ...@@ -278,8 +278,7 @@ struct drm_gem_object *i915_gem_prime_import(struct drm_device *dev,
* Importing dmabuf exported from out own gem increases * Importing dmabuf exported from out own gem increases
* refcount on gem itself instead of f_count of dmabuf. * refcount on gem itself instead of f_count of dmabuf.
*/ */
drm_gem_object_reference(&obj->base); return &i915_gem_object_get(obj)->base;
return &obj->base;
} }
} }
......
...@@ -183,7 +183,7 @@ i915_gem_evict_something(struct drm_device *dev, struct i915_address_space *vm, ...@@ -183,7 +183,7 @@ i915_gem_evict_something(struct drm_device *dev, struct i915_address_space *vm,
exec_list); exec_list);
if (drm_mm_scan_remove_block(&vma->node)) { if (drm_mm_scan_remove_block(&vma->node)) {
list_move(&vma->exec_list, &eviction_list); list_move(&vma->exec_list, &eviction_list);
drm_gem_object_reference(&vma->obj->base); i915_gem_object_get(vma->obj);
continue; continue;
} }
list_del_init(&vma->exec_list); list_del_init(&vma->exec_list);
......
...@@ -123,7 +123,7 @@ eb_lookup_vmas(struct eb_vmas *eb, ...@@ -123,7 +123,7 @@ eb_lookup_vmas(struct eb_vmas *eb,
goto err; goto err;
} }
drm_gem_object_reference(&obj->base); i915_gem_object_get(obj);
list_add_tail(&obj->obj_exec_link, &objects); list_add_tail(&obj->obj_exec_link, &objects);
} }
spin_unlock(&file->table_lock); spin_unlock(&file->table_lock);
...@@ -1236,7 +1236,7 @@ i915_gem_execbuffer_parse(struct intel_engine_cs *engine, ...@@ -1236,7 +1236,7 @@ i915_gem_execbuffer_parse(struct intel_engine_cs *engine,
vma = i915_gem_obj_to_ggtt(shadow_batch_obj); vma = i915_gem_obj_to_ggtt(shadow_batch_obj);
vma->exec_entry = shadow_exec_entry; vma->exec_entry = shadow_exec_entry;
vma->exec_entry->flags = __EXEC_OBJECT_HAS_PIN; vma->exec_entry->flags = __EXEC_OBJECT_HAS_PIN;
drm_gem_object_reference(&shadow_batch_obj->base); i915_gem_object_get(shadow_batch_obj);
list_add_tail(&vma->exec_list, &eb->vmas); list_add_tail(&vma->exec_list, &eb->vmas);
shadow_batch_obj->base.pending_read_domains = I915_GEM_DOMAIN_COMMAND; shadow_batch_obj->base.pending_read_domains = I915_GEM_DOMAIN_COMMAND;
......
...@@ -190,7 +190,7 @@ i915_gem_shrink(struct drm_i915_private *dev_priv, ...@@ -190,7 +190,7 @@ i915_gem_shrink(struct drm_i915_private *dev_priv,
if (!can_release_pages(obj)) if (!can_release_pages(obj))
continue; continue;
drm_gem_object_reference(&obj->base); i915_gem_object_get(obj);
/* For the unbound phase, this should be a no-op! */ /* For the unbound phase, this should be a no-op! */
list_for_each_entry_safe(vma, v, list_for_each_entry_safe(vma, v,
......
...@@ -622,8 +622,7 @@ __i915_gem_userptr_get_pages_schedule(struct drm_i915_gem_object *obj, ...@@ -622,8 +622,7 @@ __i915_gem_userptr_get_pages_schedule(struct drm_i915_gem_object *obj,
obj->userptr.work = &work->work; obj->userptr.work = &work->work;
obj->userptr.workers++; obj->userptr.workers++;
work->obj = obj; work->obj = i915_gem_object_get(obj);
drm_gem_object_reference(&obj->base);
work->task = current; work->task = current;
get_task_struct(work->task); get_task_struct(work->task);
......
...@@ -11649,7 +11649,6 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, ...@@ -11649,7 +11649,6 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
/* Reference the objects for the scheduled work. */ /* Reference the objects for the scheduled work. */
drm_framebuffer_reference(work->old_fb); drm_framebuffer_reference(work->old_fb);
drm_gem_object_reference(&obj->base);
crtc->primary->fb = fb; crtc->primary->fb = fb;
update_state_fb(crtc->primary); update_state_fb(crtc->primary);
...@@ -11657,7 +11656,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, ...@@ -11657,7 +11656,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
intel_fbc_pre_update(intel_crtc, intel_crtc->config, intel_fbc_pre_update(intel_crtc, intel_crtc->config,
to_intel_plane_state(primary->state)); to_intel_plane_state(primary->state));
work->pending_flip_obj = obj; work->pending_flip_obj = i915_gem_object_get(obj);
ret = i915_mutex_lock_interruptible(dev); ret = i915_mutex_lock_interruptible(dev);
if (ret) if (ret)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment