drm/i915: Remove surplus drm_device parameter to i915_gem_evict_something()
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 4 Aug 2016 15:32:18 +0000 (16:32 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Thu, 4 Aug 2016 19:19:50 +0000 (20:19 +0100)
Eviction is VM local, so we can ignore the significance of the
drm_device in the caller, and leave it to i915_gem_evict_something() to
manage itself.

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/1470324762-2545-2-git-send-email-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/i915_gem_evict.c
drivers/gpu/drm/i915/i915_gem_gtt.c
drivers/gpu/drm/i915/i915_trace.h

index 66b98fa4715a5d365bf354f58542a891857a2090..fbda38f25c6be8d111161365ccea31d5f1f1ad5f 100644 (file)
@@ -3398,8 +3398,7 @@ int i915_gem_context_reset_stats_ioctl(struct drm_device *dev, void *data,
                                       struct drm_file *file);
 
 /* i915_gem_evict.c */
-int __must_check i915_gem_evict_something(struct drm_device *dev,
-                                         struct i915_address_space *vm,
+int __must_check i915_gem_evict_something(struct i915_address_space *vm,
                                          int min_size,
                                          unsigned alignment,
                                          unsigned cache_level,
index 03bad1b70aea2914f147ee1351d0ae6a86505ab3..2868a3a883530e4ca6de9310a48f43b18489fe47 100644 (file)
@@ -3089,7 +3089,7 @@ search_free:
                                                          search_flag,
                                                          alloc_flag);
                if (ret) {
-                       ret = i915_gem_evict_something(dev, vm, size, alignment,
+                       ret = i915_gem_evict_something(vm, size, alignment,
                                                       obj->cache_level,
                                                       start, end,
                                                       flags);
index 016be73166769cfd89adb3f3f1a194956cba7f73..4bce72fa14c44f180c8e1a06b502d35e6d071d1e 100644 (file)
@@ -61,7 +61,6 @@ mark_free(struct i915_vma *vma, struct list_head *unwind)
 
 /**
  * i915_gem_evict_something - Evict vmas to make room for binding a new one
- * @dev: drm_device
  * @vm: address space to evict from
  * @min_size: size of the desired free space
  * @alignment: alignment constraint of the desired free space
@@ -84,12 +83,12 @@ mark_free(struct i915_vma *vma, struct list_head *unwind)
  * memory in e.g. the shrinker.
  */
 int
-i915_gem_evict_something(struct drm_device *dev, struct i915_address_space *vm,
+i915_gem_evict_something(struct i915_address_space *vm,
                         int min_size, unsigned alignment, unsigned cache_level,
                         unsigned long start, unsigned long end,
                         unsigned flags)
 {
-       struct drm_i915_private *dev_priv = to_i915(dev);
+       struct drm_i915_private *dev_priv = to_i915(vm->dev);
        struct list_head eviction_list;
        struct list_head *phases[] = {
                &vm->inactive_list,
@@ -99,7 +98,7 @@ i915_gem_evict_something(struct drm_device *dev, struct i915_address_space *vm,
        struct i915_vma *vma, *next;
        int ret;
 
-       trace_i915_gem_evict(dev, min_size, alignment, flags);
+       trace_i915_gem_evict(vm, min_size, alignment, flags);
 
        /*
         * The goal is to evict objects and amalgamate space in LRU order.
@@ -154,7 +153,7 @@ search_again:
                 * back to userspace to give our workqueues time to
                 * acquire our locks and unpin the old scanouts.
                 */
-               return intel_has_pending_fb_unpin(dev) ? -EAGAIN : -ENOSPC;
+               return intel_has_pending_fb_unpin(vm->dev) ? -EAGAIN : -ENOSPC;
        }
 
        /* Not everything in the GGTT is tracked via vma (otherwise we
index 685ca2aaada8dbaae95d664e3acf77ed353b1ea2..f1f14e5a5a9975ed4ff3592c7be83b879aa26abc 100644 (file)
@@ -2012,7 +2012,7 @@ alloc:
                                                  0, ggtt->base.total,
                                                  DRM_MM_TOPDOWN);
        if (ret == -ENOSPC && !retried) {
-               ret = i915_gem_evict_something(dev, &ggtt->base,
+               ret = i915_gem_evict_something(&ggtt->base,
                                               GEN6_PD_SIZE, GEN6_PD_ALIGN,
                                               I915_CACHE_NONE,
                                               0, ggtt->base.total,
index 9e43c0aa6e3b7c6193c293a953a59294b53882a3..178798002a7335694ddc391f8f4fe20260aebc4b 100644 (file)
@@ -394,25 +394,27 @@ DEFINE_EVENT(i915_gem_object, i915_gem_object_destroy,
 );
 
 TRACE_EVENT(i915_gem_evict,
-           TP_PROTO(struct drm_device *dev, u32 size, u32 align, unsigned flags),
-           TP_ARGS(dev, size, align, flags),
+           TP_PROTO(struct i915_address_space *vm, u32 size, u32 align, unsigned int flags),
+           TP_ARGS(vm, size, align, flags),
 
            TP_STRUCT__entry(
                             __field(u32, dev)
+                            __field(struct i915_address_space *, vm)
                             __field(u32, size)
                             __field(u32, align)
-                            __field(unsigned, flags)
+                            __field(unsigned int, flags)
                            ),
 
            TP_fast_assign(
-                          __entry->dev = dev->primary->index;
+                          __entry->dev = vm->dev->primary->index;
+                          __entry->vm = vm;
                           __entry->size = size;
                           __entry->align = align;
                           __entry->flags = flags;
                          ),
 
-           TP_printk("dev=%d, size=%d, align=%d %s",
-                     __entry->dev, __entry->size, __entry->align,
+           TP_printk("dev=%d, vm=%p, size=%d, align=%d %s",
+                     __entry->dev, __entry->vm, __entry->size, __entry->align,
                      __entry->flags & PIN_MAPPABLE ? ", mappable" : "")
 );