Subversion Repositories Kolibri OS

Rev

Rev 6084 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6084 Rev 6937
Line 197... Line 197...
197
	}
197
	}
Line 198... Line 198...
198
 
198
 
199
	return ret;
199
	return ret;
Line -... Line 200...
-
 
200
}
-
 
201
 
-
 
202
int
-
 
203
i915_gem_evict_for_vma(struct i915_vma *target)
-
 
204
{
-
 
205
	struct drm_mm_node *node, *next;
-
 
206
 
-
 
207
	list_for_each_entry_safe(node, next,
-
 
208
			&target->vm->mm.head_node.node_list,
-
 
209
			node_list) {
-
 
210
		struct i915_vma *vma;
-
 
211
		int ret;
-
 
212
 
-
 
213
		if (node->start + node->size <= target->node.start)
-
 
214
			continue;
-
 
215
		if (node->start >= target->node.start + target->node.size)
-
 
216
			break;
-
 
217
 
-
 
218
		vma = container_of(node, typeof(*vma), node);
-
 
219
 
-
 
220
		if (vma->pin_count) {
-
 
221
			if (!vma->exec_entry || (vma->pin_count > 1))
-
 
222
				/* Object is pinned for some other use */
-
 
223
				return -EBUSY;
-
 
224
 
-
 
225
			/* We need to evict a buffer in the same batch */
-
 
226
			if (vma->exec_entry->flags & EXEC_OBJECT_PINNED)
-
 
227
				/* Overlapping fixed objects in the same batch */
-
 
228
				return -EINVAL;
-
 
229
 
-
 
230
			return -ENOSPC;
-
 
231
		}
-
 
232
 
-
 
233
		ret = i915_vma_unbind(vma);
-
 
234
		if (ret)
-
 
235
			return ret;
-
 
236
	}
-
 
237
 
-
 
238
	return 0;
200
}
239
}
201
 
240
 
202
/**
241
/**
203
 * i915_gem_evict_vm - Evict all idle vmas from a vm
242
 * i915_gem_evict_vm - Evict all idle vmas from a vm
204
 * @vm: Address space to cleanse
243
 * @vm: Address space to cleanse