Lines Matching +full:offset +full:- +full:y
43 if (vma->vm != ctx->vm) { in assert_vma()
48 if (vma->size != obj->base.size) { in assert_vma()
50 vma->size, obj->base.size); in assert_vma()
54 if (vma->gtt_view.type != I915_GTT_VIEW_NORMAL) { in assert_vma()
56 vma->gtt_view.type); in assert_vma()
76 if (vma->vm != vm) { in checked_vma_instance()
78 vma->vm, vm); in checked_vma_instance()
90 return ERR_PTR(-EINVAL); in checked_vma_instance()
93 if (i915_vma_compare(vma, vma->vm, in checked_vma_instance()
94 i915_vma_is_ggtt(vma) ? &vma->gtt_view : NULL)) { in checked_vma_instance()
96 return ERR_PTR(-EINVAL); in checked_vma_instance()
101 return ERR_PTR(-EINVAL); in checked_vma_instance()
130 return -EINVAL; in create_vmas()
152 struct drm_i915_private *i915 = ggtt->vm.i915; in igt_vma_create()
160 int err = -ENOMEM; in igt_vma_create()
167 for_each_prime_number(num_obj, ULONG_MAX - 1) { in igt_vma_create()
173 list_add(&obj->st_link, &objects); in igt_vma_create()
183 list_move(&ctx->link, &contexts); in igt_vma_create()
197 list_del_init(&ctx->link); in igt_vma_create()
209 list_del_init(&ctx->link); in igt_vma_create()
234 if (i915_vma_misplaced(vma, mode->size, 0, mode->flags)) in assert_pin_valid()
245 return result == -ENOSPC; in assert_pin_enospc()
253 return result == -EINVAL; in assert_pin_einval()
269 VALID(0, PIN_GLOBAL | PIN_OFFSET_BIAS | (ggtt->mappable_end - 4096)), in igt_vma_pin1()
270 VALID(0, PIN_GLOBAL | PIN_MAPPABLE | PIN_OFFSET_BIAS | (ggtt->mappable_end - 4096)), in igt_vma_pin1()
271 VALID(0, PIN_GLOBAL | PIN_OFFSET_BIAS | (ggtt->vm.total - 4096)), in igt_vma_pin1()
273 VALID(0, PIN_GLOBAL | PIN_MAPPABLE | PIN_OFFSET_FIXED | (ggtt->mappable_end - 4096)), in igt_vma_pin1()
274 INVALID(0, PIN_GLOBAL | PIN_MAPPABLE | PIN_OFFSET_FIXED | ggtt->mappable_end), in igt_vma_pin1()
275 VALID(0, PIN_GLOBAL | PIN_OFFSET_FIXED | (ggtt->vm.total - 4096)), in igt_vma_pin1()
276 INVALID(0, PIN_GLOBAL | PIN_OFFSET_FIXED | ggtt->vm.total), in igt_vma_pin1()
281 VALID(ggtt->mappable_end - 4096, PIN_GLOBAL | PIN_MAPPABLE), in igt_vma_pin1()
282 VALID(ggtt->mappable_end, PIN_GLOBAL | PIN_MAPPABLE), in igt_vma_pin1()
283 NOSPACE(ggtt->mappable_end + 4096, PIN_GLOBAL | PIN_MAPPABLE), in igt_vma_pin1()
284 VALID(ggtt->vm.total - 4096, PIN_GLOBAL), in igt_vma_pin1()
285 VALID(ggtt->vm.total, PIN_GLOBAL), in igt_vma_pin1()
286 NOSPACE(ggtt->vm.total + 4096, PIN_GLOBAL), in igt_vma_pin1()
288 INVALID(8192, PIN_GLOBAL | PIN_MAPPABLE | PIN_OFFSET_FIXED | (ggtt->mappable_end - 4096)), in igt_vma_pin1()
289 INVALID(8192, PIN_GLOBAL | PIN_OFFSET_FIXED | (ggtt->vm.total - 4096)), in igt_vma_pin1()
290 INVALID(8192, PIN_GLOBAL | PIN_OFFSET_FIXED | (round_down(U64_MAX, PAGE_SIZE) - 4096)), in igt_vma_pin1()
292 VALID(8192, PIN_GLOBAL | PIN_OFFSET_BIAS | (ggtt->mappable_end - 4096)), in igt_vma_pin1()
300 NOSPACE(0, PIN_GLOBAL | PIN_MAPPABLE | PIN_OFFSET_BIAS | ggtt->mappable_end), in igt_vma_pin1()
301 NOSPACE(0, PIN_GLOBAL | PIN_OFFSET_BIAS | ggtt->vm.total), in igt_vma_pin1()
302 NOSPACE(8192, PIN_GLOBAL | PIN_MAPPABLE | PIN_OFFSET_BIAS | (ggtt->mappable_end - 4096)), in igt_vma_pin1()
303 NOSPACE(8192, PIN_GLOBAL | PIN_OFFSET_BIAS | (ggtt->vm.total - 4096)), in igt_vma_pin1()
313 int err = -EINVAL; in igt_vma_pin1()
319 GEM_BUG_ON(!drm_mm_clean(&ggtt->vm.mm)); in igt_vma_pin1()
321 obj = i915_gem_object_create_internal(ggtt->vm.i915, PAGE_SIZE); in igt_vma_pin1()
325 vma = checked_vma_instance(obj, &ggtt->vm, NULL); in igt_vma_pin1()
329 for (m = modes; m->assert; m++) { in igt_vma_pin1()
330 err = i915_vma_pin(vma, m->size, 0, m->flags); in igt_vma_pin1()
331 if (!m->assert(vma, m, err)) { in igt_vma_pin1()
333 m->assert == assert_pin_valid ? "Failed" : "Unexpectedly succeeded", in igt_vma_pin1()
334 (int)(m - modes), m->string, m->size, m->flags, in igt_vma_pin1()
338 err = -EINVAL; in igt_vma_pin1()
363 unsigned int y) in rotated_index() argument
365 return (r->plane[n].src_stride * (r->plane[n].height - y - 1) + in rotated_index()
366 r->plane[n].offset + x); in rotated_index()
374 unsigned int x, y; in assert_rotated() local
376 for (x = 0; x < r->plane[n].width; x++) { in assert_rotated()
379 for (y = 0; y < r->plane[n].height; y++) { in assert_rotated()
385 n, x, y); in assert_rotated()
386 return ERR_PTR(-EINVAL); in assert_rotated()
389 src_idx = rotated_index(r, n, x, y); in assert_rotated()
395 x, y, src_idx); in assert_rotated()
396 return ERR_PTR(-EINVAL); in assert_rotated()
401 x, y, src_idx); in assert_rotated()
402 return ERR_PTR(-EINVAL); in assert_rotated()
408 left = (r->plane[n].dst_stride - y) * PAGE_SIZE; in assert_rotated()
415 n, x, y); in assert_rotated()
416 return ERR_PTR(-EINVAL); in assert_rotated()
421 sg_dma_len(sg), left, x, y); in assert_rotated()
422 return ERR_PTR(-EINVAL); in assert_rotated()
427 &sg_dma_address(sg), x, y); in assert_rotated()
428 return ERR_PTR(-EINVAL); in assert_rotated()
440 unsigned int y) in remapped_index() argument
442 return (r->plane[n].src_stride * y + in remapped_index()
443 r->plane[n].offset + x); in remapped_index()
451 unsigned int x, y; in assert_remapped() local
453 unsigned int offset; in assert_remapped() local
455 for (y = 0; y < r->plane[n].height; y++) { in assert_remapped()
456 for (x = 0; x < r->plane[n].width; x++) { in assert_remapped()
462 n, x, y); in assert_remapped()
463 return ERR_PTR(-EINVAL); in assert_remapped()
466 offset = 0; in assert_remapped()
470 src_idx = remapped_index(r, n, x, y); in assert_remapped()
473 if (left < PAGE_SIZE || left & (PAGE_SIZE-1)) { in assert_remapped()
476 x, y, src_idx); in assert_remapped()
477 return ERR_PTR(-EINVAL); in assert_remapped()
480 if (sg_dma_address(sg) + offset != src) { in assert_remapped()
482 x, y, src_idx); in assert_remapped()
483 return ERR_PTR(-EINVAL); in assert_remapped()
486 left -= PAGE_SIZE; in assert_remapped()
487 offset += PAGE_SIZE; in assert_remapped()
497 x, y); in assert_remapped()
498 return ERR_PTR(-EINVAL); in assert_remapped()
501 left = (r->plane[n].dst_stride - r->plane[n].width) * PAGE_SIZE; in assert_remapped()
508 n, x, y); in assert_remapped()
509 return ERR_PTR(-EINVAL); in assert_remapped()
515 x, y); in assert_remapped()
516 return ERR_PTR(-EINVAL); in assert_remapped()
522 x, y); in assert_remapped()
523 return ERR_PTR(-EINVAL); in assert_remapped()
539 return a->dst_stride * a->width + b->dst_stride * b->width; in remapped_size()
541 return a->dst_stride * a->height + b->dst_stride * b->height; in remapped_size()
547 struct i915_address_space *vm = &ggtt->vm; in igt_vma_rotate_remap()
578 int err = -ENOMEM; in igt_vma_rotate_remap()
584 obj = i915_gem_object_create_internal(vm->i915, max_pages * PAGE_SIZE); in igt_vma_rotate_remap()
589 for (a = planes; a->width; a++) { in igt_vma_rotate_remap()
590 for (b = planes + ARRAY_SIZE(planes); b-- != planes; ) { in igt_vma_rotate_remap()
602 max_offset = max_pages - max_offset; in igt_vma_rotate_remap()
613 for_each_prime_number_from(plane_info[0].offset, 0, max_offset) { in igt_vma_rotate_remap()
614 for_each_prime_number_from(plane_info[1].offset, 0, max_offset) { in igt_vma_rotate_remap()
634 vma->size != expected_pages * PAGE_SIZE) { in igt_vma_rotate_remap()
636 PAGE_SIZE * expected_pages, vma->size); in igt_vma_rotate_remap()
637 err = -EINVAL; in igt_vma_rotate_remap()
642 vma->size > expected_pages * PAGE_SIZE) { in igt_vma_rotate_remap()
644 PAGE_SIZE * expected_pages, vma->size); in igt_vma_rotate_remap()
645 err = -EINVAL; in igt_vma_rotate_remap()
649 if (vma->pages->nents > expected_pages) { in igt_vma_rotate_remap()
651 expected_pages, vma->pages->nents); in igt_vma_rotate_remap()
652 err = -EINVAL; in igt_vma_rotate_remap()
656 if (vma->node.size < vma->size) { in igt_vma_rotate_remap()
658 vma->size, vma->node.size); in igt_vma_rotate_remap()
659 err = -EINVAL; in igt_vma_rotate_remap()
663 if (vma->pages == obj->mm.pages) { in igt_vma_rotate_remap()
665 err = -EINVAL; in igt_vma_rotate_remap()
669 sg = vma->pages->sgl; in igt_vma_rotate_remap()
683 plane_info[0].offset, in igt_vma_rotate_remap()
688 plane_info[1].offset); in igt_vma_rotate_remap()
689 err = -EINVAL; in igt_vma_rotate_remap()
715 unsigned long offset, in assert_partial() argument
721 for_each_sgt_daddr(dma, sgt, vma->pages) { in assert_partial()
729 src = i915_gem_object_get_dma_address(obj, offset); in assert_partial()
731 pr_err("DMA mismatch for partial page offset %lu\n", in assert_partial()
732 offset); in assert_partial()
736 offset++; in assert_partial()
737 size--; in assert_partial()
750 if (vma->size != size) { in assert_pin()
752 name, size, vma->size); in assert_pin()
756 if (vma->node.size < vma->size) { in assert_pin()
758 name, vma->size, vma->node.size); in assert_pin()
762 if (view && view->type != I915_GTT_VIEW_NORMAL) { in assert_pin()
763 if (memcmp(&vma->gtt_view, view, sizeof(*view))) { in assert_pin()
769 if (vma->pages == vma->obj->mm.pages) { in assert_pin()
775 if (vma->gtt_view.type != I915_GTT_VIEW_NORMAL) { in assert_pin()
777 vma->gtt_view.type); in assert_pin()
781 if (vma->pages != vma->obj->mm.pages) { in assert_pin()
793 struct i915_address_space *vm = &ggtt->vm; in igt_vma_partial()
803 unsigned int sz, offset; in igt_vma_partial() local
805 int err = -ENOMEM; in igt_vma_partial()
811 obj = i915_gem_object_create_internal(vm->i915, npages * PAGE_SIZE); in igt_vma_partial()
815 for (p = phases; p->name; p++) { /* exercise both create/lookup */ in igt_vma_partial()
820 for_each_prime_number_from(offset, 0, npages - sz) { in igt_vma_partial()
824 view.partial.offset = offset; in igt_vma_partial()
840 if (!assert_pin(vma, &view, sz*PAGE_SIZE, p->name)) { in igt_vma_partial()
841 pr_err("(%s) Inconsistent partial pinning for (offset=%d, size=%d)\n", in igt_vma_partial()
842 p->name, offset, sz); in igt_vma_partial()
843 err = -EINVAL; in igt_vma_partial()
847 if (!assert_partial(obj, vma, offset, sz)) { in igt_vma_partial()
848 pr_err("(%s) Inconsistent partial pages for (offset=%d, size=%d)\n", in igt_vma_partial()
849 p->name, offset, sz); in igt_vma_partial()
850 err = -EINVAL; in igt_vma_partial()
867 list_for_each_entry(vma, &obj->vma.list, obj_link) in igt_vma_partial()
870 pr_err("(%s) All partial vma were not recorded on the obj->vma_list: found %u, expected %u\n", in igt_vma_partial()
871 p->name, count, nvma); in igt_vma_partial()
872 err = -EINVAL; in igt_vma_partial()
887 if (!assert_pin(vma, NULL, obj->base.size, p->name)) { in igt_vma_partial()
888 pr_err("(%s) inconsistent full pin\n", p->name); in igt_vma_partial()
889 err = -EINVAL; in igt_vma_partial()
902 list_for_each_entry(vma, &obj->vma.list, obj_link) in igt_vma_partial()
905 pr_err("(%s) allocated an extra full vma!\n", p->name); in igt_vma_partial()
906 err = -EINVAL; in igt_vma_partial()
931 return -ENOMEM; in i915_vma_mock_selftests()
942 err = i915_subtests(tests, gt->ggtt); in i915_vma_mock_selftests()
946 mock_fini_ggtt(gt->ggtt); in i915_vma_mock_selftests()
988 if (!i915_ggtt_has_aperture(to_gt(i915)->ggtt)) in igt_vma_remapped_gtt()
995 wakeref = intel_runtime_pm_get(&i915->runtime_pm); in igt_vma_remapped_gtt()
998 for (p = planes; p->width; p++) { in igt_vma_remapped_gtt()
1006 unsigned int x, y; in igt_vma_remapped_gtt() local
1016 p->height : p->width; in igt_vma_remapped_gtt()
1024 GEM_BUG_ON(vma->gtt_view.type != *t); in igt_vma_remapped_gtt()
1033 for (y = 0 ; y < plane_info[0].height; y++) { in igt_vma_remapped_gtt()
1035 unsigned int offset; in igt_vma_remapped_gtt() local
1036 u32 val = y << 16 | x; in igt_vma_remapped_gtt()
1039 offset = (x * plane_info[0].dst_stride + y) * PAGE_SIZE; in igt_vma_remapped_gtt()
1041 offset = (y * plane_info[0].dst_stride + x) * PAGE_SIZE; in igt_vma_remapped_gtt()
1043 iowrite32(val, &map[offset / sizeof(*map)]); in igt_vma_remapped_gtt()
1055 GEM_BUG_ON(vma->gtt_view.type != I915_GTT_VIEW_NORMAL); in igt_vma_remapped_gtt()
1064 for (y = 0 ; y < plane_info[0].height; y++) { in igt_vma_remapped_gtt()
1066 unsigned int offset, src_idx; in igt_vma_remapped_gtt() local
1067 u32 exp = y << 16 | x; in igt_vma_remapped_gtt()
1071 src_idx = rotated_index(&view.rotated, 0, x, y); in igt_vma_remapped_gtt()
1073 src_idx = remapped_index(&view.remapped, 0, x, y); in igt_vma_remapped_gtt()
1074 offset = src_idx * PAGE_SIZE; in igt_vma_remapped_gtt()
1076 val = ioread32(&map[offset / sizeof(*map)]); in igt_vma_remapped_gtt()
1082 err = -EINVAL; in igt_vma_remapped_gtt()
1094 intel_runtime_pm_put(&i915->runtime_pm, wakeref); in igt_vma_remapped_gtt()