Lines Matching refs:vma
50 static inline bool i915_vma_is_active(const struct i915_vma *vma) in i915_vma_is_active() argument
52 return !i915_active_is_idle(&vma->active); in i915_vma_is_active()
58 int __must_check __i915_vma_move_to_active(struct i915_vma *vma,
60 int __must_check _i915_vma_move_to_active(struct i915_vma *vma,
65 i915_vma_move_to_active(struct i915_vma *vma, struct i915_request *rq, in i915_vma_move_to_active() argument
68 return _i915_vma_move_to_active(vma, rq, &rq->fence, flags); in i915_vma_move_to_active()
73 static inline bool i915_vma_is_ggtt(const struct i915_vma *vma) in i915_vma_is_ggtt() argument
75 return test_bit(I915_VMA_GGTT_BIT, __i915_vma_flags(vma)); in i915_vma_is_ggtt()
78 static inline bool i915_vma_is_dpt(const struct i915_vma *vma) in i915_vma_is_dpt() argument
80 return i915_is_dpt(vma->vm); in i915_vma_is_dpt()
83 static inline bool i915_vma_has_ggtt_write(const struct i915_vma *vma) in i915_vma_has_ggtt_write() argument
85 return test_bit(I915_VMA_GGTT_WRITE_BIT, __i915_vma_flags(vma)); in i915_vma_has_ggtt_write()
88 static inline void i915_vma_set_ggtt_write(struct i915_vma *vma) in i915_vma_set_ggtt_write() argument
90 GEM_BUG_ON(!i915_vma_is_ggtt(vma)); in i915_vma_set_ggtt_write()
91 set_bit(I915_VMA_GGTT_WRITE_BIT, __i915_vma_flags(vma)); in i915_vma_set_ggtt_write()
94 static inline bool i915_vma_unset_ggtt_write(struct i915_vma *vma) in i915_vma_unset_ggtt_write() argument
97 __i915_vma_flags(vma)); in i915_vma_unset_ggtt_write()
100 void i915_vma_flush_writes(struct i915_vma *vma);
102 static inline bool i915_vma_is_map_and_fenceable(const struct i915_vma *vma) in i915_vma_is_map_and_fenceable() argument
104 return test_bit(I915_VMA_CAN_FENCE_BIT, __i915_vma_flags(vma)); in i915_vma_is_map_and_fenceable()
107 static inline bool i915_vma_set_userfault(struct i915_vma *vma) in i915_vma_set_userfault() argument
109 GEM_BUG_ON(!i915_vma_is_map_and_fenceable(vma)); in i915_vma_set_userfault()
110 return test_and_set_bit(I915_VMA_USERFAULT_BIT, __i915_vma_flags(vma)); in i915_vma_set_userfault()
113 static inline void i915_vma_unset_userfault(struct i915_vma *vma) in i915_vma_unset_userfault() argument
115 return clear_bit(I915_VMA_USERFAULT_BIT, __i915_vma_flags(vma)); in i915_vma_unset_userfault()
118 static inline bool i915_vma_has_userfault(const struct i915_vma *vma) in i915_vma_has_userfault() argument
120 return test_bit(I915_VMA_USERFAULT_BIT, __i915_vma_flags(vma)); in i915_vma_has_userfault()
123 static inline bool i915_vma_is_closed(const struct i915_vma *vma) in i915_vma_is_closed() argument
125 return !list_empty(&vma->closed_link); in i915_vma_is_closed()
128 static inline u32 i915_ggtt_offset(const struct i915_vma *vma) in i915_ggtt_offset() argument
130 GEM_BUG_ON(!i915_vma_is_ggtt(vma)); in i915_ggtt_offset()
131 GEM_BUG_ON(!drm_mm_node_allocated(&vma->node)); in i915_ggtt_offset()
132 GEM_BUG_ON(upper_32_bits(vma->node.start)); in i915_ggtt_offset()
133 GEM_BUG_ON(upper_32_bits(vma->node.start + vma->node.size - 1)); in i915_ggtt_offset()
134 return lower_32_bits(vma->node.start); in i915_ggtt_offset()
137 static inline u32 i915_ggtt_pin_bias(struct i915_vma *vma) in i915_ggtt_pin_bias() argument
139 return i915_vm_to_ggtt(vma->vm)->pin_bias; in i915_ggtt_pin_bias()
142 static inline struct i915_vma *i915_vma_get(struct i915_vma *vma) in i915_vma_get() argument
144 i915_gem_object_get(vma->obj); in i915_vma_get()
145 return vma; in i915_vma_get()
148 static inline struct i915_vma *i915_vma_tryget(struct i915_vma *vma) in i915_vma_tryget() argument
150 if (likely(kref_get_unless_zero(&vma->obj->base.refcount))) in i915_vma_tryget()
151 return vma; in i915_vma_tryget()
156 static inline void i915_vma_put(struct i915_vma *vma) in i915_vma_put() argument
158 i915_gem_object_put(vma->obj); in i915_vma_put()
162 i915_vma_compare(struct i915_vma *vma, in i915_vma_compare() argument
170 cmp = ptrdiff(vma->vm, vm); in i915_vma_compare()
175 cmp = vma->ggtt_view.type; in i915_vma_compare()
202 return memcmp(&vma->ggtt_view.partial, &view->partial, view->type); in i915_vma_compare()
206 int i915_vma_bind(struct i915_vma *vma,
211 bool i915_gem_valid_gtt_space(struct i915_vma *vma, unsigned long color);
212 bool i915_vma_misplaced(const struct i915_vma *vma,
214 void __i915_vma_set_map_and_fenceable(struct i915_vma *vma);
215 void i915_vma_revoke_mmap(struct i915_vma *vma);
216 void __i915_vma_evict(struct i915_vma *vma);
217 int __i915_vma_unbind(struct i915_vma *vma);
218 int __must_check i915_vma_unbind(struct i915_vma *vma);
219 void i915_vma_unlink_ctx(struct i915_vma *vma);
220 void i915_vma_close(struct i915_vma *vma);
221 void i915_vma_reopen(struct i915_vma *vma);
223 static inline struct i915_vma *__i915_vma_get(struct i915_vma *vma) in __i915_vma_get() argument
225 if (kref_get_unless_zero(&vma->ref)) in __i915_vma_get()
226 return vma; in __i915_vma_get()
232 static inline void __i915_vma_put(struct i915_vma *vma) in __i915_vma_put() argument
234 kref_put(&vma->ref, i915_vma_release); in __i915_vma_put()
237 #define assert_vma_held(vma) dma_resv_assert_held((vma)->resv) argument
239 static inline void i915_vma_lock(struct i915_vma *vma) in i915_vma_lock() argument
241 dma_resv_lock(vma->resv, NULL); in i915_vma_lock()
244 static inline void i915_vma_unlock(struct i915_vma *vma) in i915_vma_unlock() argument
246 dma_resv_unlock(vma->resv); in i915_vma_unlock()
250 i915_vma_pin_ww(struct i915_vma *vma, struct i915_gem_ww_ctx *ww,
254 i915_vma_pin(struct i915_vma *vma, u64 size, u64 alignment, u64 flags) in i915_vma_pin() argument
261 err = i915_gem_object_lock(vma->obj, &ww); in i915_vma_pin()
263 err = i915_vma_pin_ww(vma, &ww, size, alignment, flags); in i915_vma_pin()
274 int i915_ggtt_pin(struct i915_vma *vma, struct i915_gem_ww_ctx *ww,
277 static inline int i915_vma_pin_count(const struct i915_vma *vma) in i915_vma_pin_count() argument
279 return atomic_read(&vma->flags) & I915_VMA_PIN_MASK; in i915_vma_pin_count()
282 static inline bool i915_vma_is_pinned(const struct i915_vma *vma) in i915_vma_is_pinned() argument
284 return i915_vma_pin_count(vma); in i915_vma_is_pinned()
287 static inline void __i915_vma_pin(struct i915_vma *vma) in __i915_vma_pin() argument
289 atomic_inc(&vma->flags); in __i915_vma_pin()
290 GEM_BUG_ON(!i915_vma_is_pinned(vma)); in __i915_vma_pin()
293 static inline void __i915_vma_unpin(struct i915_vma *vma) in __i915_vma_unpin() argument
295 GEM_BUG_ON(!i915_vma_is_pinned(vma)); in __i915_vma_unpin()
296 atomic_dec(&vma->flags); in __i915_vma_unpin()
299 static inline void i915_vma_unpin(struct i915_vma *vma) in i915_vma_unpin() argument
301 GEM_BUG_ON(!drm_mm_node_allocated(&vma->node)); in i915_vma_unpin()
302 __i915_vma_unpin(vma); in i915_vma_unpin()
305 static inline bool i915_vma_is_bound(const struct i915_vma *vma, in i915_vma_is_bound() argument
308 return atomic_read(&vma->flags) & where; in i915_vma_is_bound()
328 void __iomem *i915_vma_pin_iomap(struct i915_vma *vma);
340 void i915_vma_unpin_iomap(struct i915_vma *vma);
342 static inline struct page *i915_vma_first_page(struct i915_vma *vma) in i915_vma_first_page() argument
344 GEM_BUG_ON(!vma->pages); in i915_vma_first_page()
345 return sg_page(vma->pages->sgl); in i915_vma_first_page()
363 int __must_check i915_vma_pin_fence(struct i915_vma *vma);
364 void i915_vma_revoke_fence(struct i915_vma *vma);
366 int __i915_vma_pin_fence(struct i915_vma *vma);
368 static inline void __i915_vma_unpin_fence(struct i915_vma *vma) in __i915_vma_unpin_fence() argument
370 GEM_BUG_ON(atomic_read(&vma->fence->pin_count) <= 0); in __i915_vma_unpin_fence()
371 atomic_dec(&vma->fence->pin_count); in __i915_vma_unpin_fence()
383 i915_vma_unpin_fence(struct i915_vma *vma) in i915_vma_unpin_fence() argument
385 if (vma->fence) in i915_vma_unpin_fence()
386 __i915_vma_unpin_fence(vma); in i915_vma_unpin_fence()
391 static inline bool i915_vma_is_scanout(const struct i915_vma *vma) in i915_vma_is_scanout() argument
393 return test_bit(I915_VMA_SCANOUT_BIT, __i915_vma_flags(vma)); in i915_vma_is_scanout()
396 static inline void i915_vma_mark_scanout(struct i915_vma *vma) in i915_vma_mark_scanout() argument
398 set_bit(I915_VMA_SCANOUT_BIT, __i915_vma_flags(vma)); in i915_vma_mark_scanout()
401 static inline void i915_vma_clear_scanout(struct i915_vma *vma) in i915_vma_clear_scanout() argument
403 clear_bit(I915_VMA_SCANOUT_BIT, __i915_vma_flags(vma)); in i915_vma_clear_scanout()
418 list_for_each_entry(V, &(OBJ)->vma.list, obj_link) \
422 void i915_vma_free(struct i915_vma *vma);
424 struct i915_vma *i915_vma_make_unshrinkable(struct i915_vma *vma);
425 void i915_vma_make_shrinkable(struct i915_vma *vma);
426 void i915_vma_make_purgeable(struct i915_vma *vma);
428 int i915_vma_wait_for_bind(struct i915_vma *vma);
430 static inline int i915_vma_sync(struct i915_vma *vma) in i915_vma_sync() argument
433 return i915_active_wait(&vma->active); in i915_vma_sync()