diff options
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem_evict.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_evict.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_evict.c b/drivers/gpu/drm/i915/i915_gem_evict.c index 425939b7d343..91b700155850 100644 --- a/drivers/gpu/drm/i915/i915_gem_evict.c +++ b/drivers/gpu/drm/i915/i915_gem_evict.c | |||
@@ -37,7 +37,7 @@ mark_free(struct i915_vma *vma, struct list_head *unwind) | |||
37 | if (vma->obj->pin_count) | 37 | if (vma->obj->pin_count) |
38 | return false; | 38 | return false; |
39 | 39 | ||
40 | list_add(&vma->obj->exec_list, unwind); | 40 | list_add(&vma->exec_list, unwind); |
41 | return drm_mm_scan_add_block(&vma->node); | 41 | return drm_mm_scan_add_block(&vma->node); |
42 | } | 42 | } |
43 | 43 | ||
@@ -49,7 +49,6 @@ i915_gem_evict_something(struct drm_device *dev, struct i915_address_space *vm, | |||
49 | drm_i915_private_t *dev_priv = dev->dev_private; | 49 | drm_i915_private_t *dev_priv = dev->dev_private; |
50 | struct list_head eviction_list, unwind_list; | 50 | struct list_head eviction_list, unwind_list; |
51 | struct i915_vma *vma; | 51 | struct i915_vma *vma; |
52 | struct drm_i915_gem_object *obj; | ||
53 | int ret = 0; | 52 | int ret = 0; |
54 | 53 | ||
55 | trace_i915_gem_evict(dev, min_size, alignment, mappable); | 54 | trace_i915_gem_evict(dev, min_size, alignment, mappable); |
@@ -104,14 +103,13 @@ i915_gem_evict_something(struct drm_device *dev, struct i915_address_space *vm, | |||
104 | none: | 103 | none: |
105 | /* Nothing found, clean up and bail out! */ | 104 | /* Nothing found, clean up and bail out! */ |
106 | while (!list_empty(&unwind_list)) { | 105 | while (!list_empty(&unwind_list)) { |
107 | obj = list_first_entry(&unwind_list, | 106 | vma = list_first_entry(&unwind_list, |
108 | struct drm_i915_gem_object, | 107 | struct i915_vma, |
109 | exec_list); | 108 | exec_list); |
110 | vma = i915_gem_obj_to_vma(obj, vm); | ||
111 | ret = drm_mm_scan_remove_block(&vma->node); | 109 | ret = drm_mm_scan_remove_block(&vma->node); |
112 | BUG_ON(ret); | 110 | BUG_ON(ret); |
113 | 111 | ||
114 | list_del_init(&obj->exec_list); | 112 | list_del_init(&vma->exec_list); |
115 | } | 113 | } |
116 | 114 | ||
117 | /* We expect the caller to unpin, evict all and try again, or give up. | 115 | /* We expect the caller to unpin, evict all and try again, or give up. |
@@ -125,28 +123,30 @@ found: | |||
125 | * temporary list. */ | 123 | * temporary list. */ |
126 | INIT_LIST_HEAD(&eviction_list); | 124 | INIT_LIST_HEAD(&eviction_list); |
127 | while (!list_empty(&unwind_list)) { | 125 | while (!list_empty(&unwind_list)) { |
128 | obj = list_first_entry(&unwind_list, | 126 | vma = list_first_entry(&unwind_list, |
129 | struct drm_i915_gem_object, | 127 | struct i915_vma, |
130 | exec_list); | 128 | exec_list); |
131 | vma = i915_gem_obj_to_vma(obj, vm); | ||
132 | if (drm_mm_scan_remove_block(&vma->node)) { | 129 | if (drm_mm_scan_remove_block(&vma->node)) { |
133 | list_move(&obj->exec_list, &eviction_list); | 130 | list_move(&vma->exec_list, &eviction_list); |
134 | drm_gem_object_reference(&obj->base); | 131 | drm_gem_object_reference(&vma->obj->base); |
135 | continue; | 132 | continue; |
136 | } | 133 | } |
137 | list_del_init(&obj->exec_list); | 134 | list_del_init(&vma->exec_list); |
138 | } | 135 | } |
139 | 136 | ||
140 | /* Unbinding will emit any required flushes */ | 137 | /* Unbinding will emit any required flushes */ |
141 | while (!list_empty(&eviction_list)) { | 138 | while (!list_empty(&eviction_list)) { |
142 | obj = list_first_entry(&eviction_list, | 139 | struct drm_gem_object *obj; |
143 | struct drm_i915_gem_object, | 140 | vma = list_first_entry(&eviction_list, |
141 | struct i915_vma, | ||
144 | exec_list); | 142 | exec_list); |
143 | |||
144 | obj = &vma->obj->base; | ||
145 | list_del_init(&vma->exec_list); | ||
145 | if (ret == 0) | 146 | if (ret == 0) |
146 | ret = i915_vma_unbind(i915_gem_obj_to_vma(obj, vm)); | 147 | ret = i915_vma_unbind(vma); |
147 | 148 | ||
148 | list_del_init(&obj->exec_list); | 149 | drm_gem_object_unreference(obj); |
149 | drm_gem_object_unreference(&obj->base); | ||
150 | } | 150 | } |
151 | 151 | ||
152 | return ret; | 152 | return ret; |