Lines Matching refs:vma
96 i915_get_ggtt_vma_pages(struct i915_vma *vma);
149 static int ppgtt_bind_vma(struct i915_vma *vma, in ppgtt_bind_vma() argument
156 if (vma->obj->gt_ro) in ppgtt_bind_vma()
159 vma->vm->insert_entries(vma->vm, vma->obj->pages, vma->node.start, in ppgtt_bind_vma()
165 static void ppgtt_unbind_vma(struct i915_vma *vma) in ppgtt_unbind_vma() argument
167 vma->vm->clear_range(vma->vm, in ppgtt_unbind_vma()
168 vma->node.start, in ppgtt_unbind_vma()
169 vma->obj->base.size, in ppgtt_unbind_vma()
2501 static int ggtt_bind_vma(struct i915_vma *vma, in ggtt_bind_vma() argument
2505 struct drm_i915_gem_object *obj = vma->obj; in ggtt_bind_vma()
2509 ret = i915_get_ggtt_vma_pages(vma); in ggtt_bind_vma()
2517 vma->vm->insert_entries(vma->vm, vma->ggtt_view.pages, in ggtt_bind_vma()
2518 vma->node.start, in ggtt_bind_vma()
2526 vma->bound |= GLOBAL_BIND | LOCAL_BIND; in ggtt_bind_vma()
2531 static int aliasing_gtt_bind_vma(struct i915_vma *vma, in aliasing_gtt_bind_vma() argument
2535 struct drm_device *dev = vma->vm->dev; in aliasing_gtt_bind_vma()
2537 struct drm_i915_gem_object *obj = vma->obj; in aliasing_gtt_bind_vma()
2542 ret = i915_get_ggtt_vma_pages(vma); in aliasing_gtt_bind_vma()
2545 pages = vma->ggtt_view.pages; in aliasing_gtt_bind_vma()
2553 vma->vm->insert_entries(vma->vm, pages, in aliasing_gtt_bind_vma()
2554 vma->node.start, in aliasing_gtt_bind_vma()
2561 vma->node.start, in aliasing_gtt_bind_vma()
2568 static void ggtt_unbind_vma(struct i915_vma *vma) in ggtt_unbind_vma() argument
2570 struct drm_device *dev = vma->vm->dev; in ggtt_unbind_vma()
2572 struct drm_i915_gem_object *obj = vma->obj; in ggtt_unbind_vma()
2575 vma->node.size); in ggtt_unbind_vma()
2577 if (vma->bound & GLOBAL_BIND) { in ggtt_unbind_vma()
2578 vma->vm->clear_range(vma->vm, in ggtt_unbind_vma()
2579 vma->node.start, in ggtt_unbind_vma()
2584 if (dev_priv->mm.aliasing_ppgtt && vma->bound & LOCAL_BIND) { in ggtt_unbind_vma()
2588 vma->node.start, in ggtt_unbind_vma()
2667 struct i915_vma *vma = i915_gem_obj_to_vma(obj, ggtt_vm); in i915_gem_setup_global_gtt() local
2673 ret = drm_mm_reserve_node(&ggtt_vm->mm, &vma->node); in i915_gem_setup_global_gtt()
2678 vma->bound |= GLOBAL_BIND; in i915_gem_setup_global_gtt()
2679 __i915_vma_set_map_and_fenceable(vma); in i915_gem_setup_global_gtt()
2680 list_add_tail(&vma->mm_list, &ggtt_vm->inactive_list); in i915_gem_setup_global_gtt()
3147 struct i915_vma *vma; in i915_gem_restore_gtt_mappings() local
3162 list_for_each_entry(vma, &obj->vma_list, vma_link) { in i915_gem_restore_gtt_mappings()
3163 if (vma->vm != vm) in i915_gem_restore_gtt_mappings()
3166 WARN_ON(i915_vma_bind(vma, obj->cache_level, in i915_gem_restore_gtt_mappings()
3209 struct i915_vma *vma; in __i915_gem_vma_create() local
3214 vma = kmem_cache_zalloc(to_i915(obj->base.dev)->vmas, GFP_KERNEL); in __i915_gem_vma_create()
3215 if (vma == NULL) in __i915_gem_vma_create()
3218 INIT_LIST_HEAD(&vma->vma_link); in __i915_gem_vma_create()
3219 INIT_LIST_HEAD(&vma->mm_list); in __i915_gem_vma_create()
3220 INIT_LIST_HEAD(&vma->exec_list); in __i915_gem_vma_create()
3221 vma->vm = vm; in __i915_gem_vma_create()
3222 vma->obj = obj; in __i915_gem_vma_create()
3225 vma->ggtt_view = *ggtt_view; in __i915_gem_vma_create()
3227 list_add_tail(&vma->vma_link, &obj->vma_list); in __i915_gem_vma_create()
3231 return vma; in __i915_gem_vma_create()
3238 struct i915_vma *vma; in i915_gem_obj_lookup_or_create_vma() local
3240 vma = i915_gem_obj_to_vma(obj, vm); in i915_gem_obj_lookup_or_create_vma()
3241 if (!vma) in i915_gem_obj_lookup_or_create_vma()
3242 vma = __i915_gem_vma_create(obj, vm, in i915_gem_obj_lookup_or_create_vma()
3245 return vma; in i915_gem_obj_lookup_or_create_vma()
3253 struct i915_vma *vma; in i915_gem_obj_lookup_or_create_ggtt_vma() local
3258 vma = i915_gem_obj_to_ggtt_view(obj, view); in i915_gem_obj_lookup_or_create_ggtt_vma()
3260 if (IS_ERR(vma)) in i915_gem_obj_lookup_or_create_ggtt_vma()
3261 return vma; in i915_gem_obj_lookup_or_create_ggtt_vma()
3263 if (!vma) in i915_gem_obj_lookup_or_create_ggtt_vma()
3264 vma = __i915_gem_vma_create(obj, ggtt, view); in i915_gem_obj_lookup_or_create_ggtt_vma()
3266 return vma; in i915_gem_obj_lookup_or_create_ggtt_vma()
3433 i915_get_ggtt_vma_pages(struct i915_vma *vma) in i915_get_ggtt_vma_pages() argument
3437 if (vma->ggtt_view.pages) in i915_get_ggtt_vma_pages()
3440 if (vma->ggtt_view.type == I915_GGTT_VIEW_NORMAL) in i915_get_ggtt_vma_pages()
3441 vma->ggtt_view.pages = vma->obj->pages; in i915_get_ggtt_vma_pages()
3442 else if (vma->ggtt_view.type == I915_GGTT_VIEW_ROTATED) in i915_get_ggtt_vma_pages()
3443 vma->ggtt_view.pages = in i915_get_ggtt_vma_pages()
3444 intel_rotate_fb_obj_pages(&vma->ggtt_view, vma->obj); in i915_get_ggtt_vma_pages()
3445 else if (vma->ggtt_view.type == I915_GGTT_VIEW_PARTIAL) in i915_get_ggtt_vma_pages()
3446 vma->ggtt_view.pages = in i915_get_ggtt_vma_pages()
3447 intel_partial_pages(&vma->ggtt_view, vma->obj); in i915_get_ggtt_vma_pages()
3450 vma->ggtt_view.type); in i915_get_ggtt_vma_pages()
3452 if (!vma->ggtt_view.pages) { in i915_get_ggtt_vma_pages()
3454 vma->ggtt_view.type); in i915_get_ggtt_vma_pages()
3456 } else if (IS_ERR(vma->ggtt_view.pages)) { in i915_get_ggtt_vma_pages()
3457 ret = PTR_ERR(vma->ggtt_view.pages); in i915_get_ggtt_vma_pages()
3458 vma->ggtt_view.pages = NULL; in i915_get_ggtt_vma_pages()
3460 vma->ggtt_view.type, ret); in i915_get_ggtt_vma_pages()
3476 int i915_vma_bind(struct i915_vma *vma, enum i915_cache_level cache_level, in i915_vma_bind() argument
3492 bind_flags |= vma->bound; in i915_vma_bind()
3494 bind_flags &= ~vma->bound; in i915_vma_bind()
3499 if (vma->bound == 0 && vma->vm->allocate_va_range) { in i915_vma_bind()
3500 trace_i915_va_alloc(vma->vm, in i915_vma_bind()
3501 vma->node.start, in i915_vma_bind()
3502 vma->node.size, in i915_vma_bind()
3503 VM_TO_TRACE_NAME(vma->vm)); in i915_vma_bind()
3506 vma->pin_count++; in i915_vma_bind()
3507 ret = vma->vm->allocate_va_range(vma->vm, in i915_vma_bind()
3508 vma->node.start, in i915_vma_bind()
3509 vma->node.size); in i915_vma_bind()
3510 vma->pin_count--; in i915_vma_bind()
3515 ret = vma->vm->bind_vma(vma, cache_level, bind_flags); in i915_vma_bind()
3519 vma->bound |= bind_flags; in i915_vma_bind()