Lines Matching +full:offset +full:- +full:y
42 if (vma->vm != rcu_access_pointer(ctx->vm)) { in assert_vma()
47 if (vma->size != obj->base.size) { in assert_vma()
49 vma->size, obj->base.size); in assert_vma()
53 if (vma->ggtt_view.type != I915_GGTT_VIEW_NORMAL) { in assert_vma()
55 vma->ggtt_view.type); in assert_vma()
75 if (vma->vm != vm) { in checked_vma_instance()
77 vma->vm, vm); in checked_vma_instance()
89 return ERR_PTR(-EINVAL); in checked_vma_instance()
92 if (i915_vma_compare(vma, vma->vm, in checked_vma_instance()
93 i915_vma_is_ggtt(vma) ? &vma->ggtt_view : NULL)) { in checked_vma_instance()
95 return ERR_PTR(-EINVAL); in checked_vma_instance()
100 return ERR_PTR(-EINVAL); in checked_vma_instance()
129 return -EINVAL; in create_vmas()
151 struct drm_i915_private *i915 = ggtt->vm.i915; in igt_vma_create()
159 int err = -ENOMEM; in igt_vma_create()
166 for_each_prime_number(num_obj, ULONG_MAX - 1) { in igt_vma_create()
172 list_add(&obj->st_link, &objects); in igt_vma_create()
182 list_move(&ctx->link, &contexts); in igt_vma_create()
196 list_del_init(&ctx->link); in igt_vma_create()
208 list_del_init(&ctx->link); in igt_vma_create()
233 if (i915_vma_misplaced(vma, mode->size, 0, mode->flags)) in assert_pin_valid()
244 return result == -ENOSPC; in assert_pin_enospc()
252 return result == -EINVAL; in assert_pin_einval()
268 VALID(0, PIN_GLOBAL | PIN_OFFSET_BIAS | (ggtt->mappable_end - 4096)), in igt_vma_pin1()
269 VALID(0, PIN_GLOBAL | PIN_MAPPABLE | PIN_OFFSET_BIAS | (ggtt->mappable_end - 4096)), in igt_vma_pin1()
270 VALID(0, PIN_GLOBAL | PIN_OFFSET_BIAS | (ggtt->vm.total - 4096)), in igt_vma_pin1()
272 VALID(0, PIN_GLOBAL | PIN_MAPPABLE | PIN_OFFSET_FIXED | (ggtt->mappable_end - 4096)), in igt_vma_pin1()
273 INVALID(0, PIN_GLOBAL | PIN_MAPPABLE | PIN_OFFSET_FIXED | ggtt->mappable_end), in igt_vma_pin1()
274 VALID(0, PIN_GLOBAL | PIN_OFFSET_FIXED | (ggtt->vm.total - 4096)), in igt_vma_pin1()
275 INVALID(0, PIN_GLOBAL | PIN_OFFSET_FIXED | ggtt->vm.total), in igt_vma_pin1()
280 VALID(ggtt->mappable_end - 4096, PIN_GLOBAL | PIN_MAPPABLE), in igt_vma_pin1()
281 VALID(ggtt->mappable_end, PIN_GLOBAL | PIN_MAPPABLE), in igt_vma_pin1()
282 NOSPACE(ggtt->mappable_end + 4096, PIN_GLOBAL | PIN_MAPPABLE), in igt_vma_pin1()
283 VALID(ggtt->vm.total - 4096, PIN_GLOBAL), in igt_vma_pin1()
284 VALID(ggtt->vm.total, PIN_GLOBAL), in igt_vma_pin1()
285 NOSPACE(ggtt->vm.total + 4096, PIN_GLOBAL), in igt_vma_pin1()
287 INVALID(8192, PIN_GLOBAL | PIN_MAPPABLE | PIN_OFFSET_FIXED | (ggtt->mappable_end - 4096)), in igt_vma_pin1()
288 INVALID(8192, PIN_GLOBAL | PIN_OFFSET_FIXED | (ggtt->vm.total - 4096)), in igt_vma_pin1()
289 INVALID(8192, PIN_GLOBAL | PIN_OFFSET_FIXED | (round_down(U64_MAX, PAGE_SIZE) - 4096)), in igt_vma_pin1()
291 VALID(8192, PIN_GLOBAL | PIN_OFFSET_BIAS | (ggtt->mappable_end - 4096)), in igt_vma_pin1()
299 NOSPACE(0, PIN_GLOBAL | PIN_MAPPABLE | PIN_OFFSET_BIAS | ggtt->mappable_end), in igt_vma_pin1()
300 NOSPACE(0, PIN_GLOBAL | PIN_OFFSET_BIAS | ggtt->vm.total), in igt_vma_pin1()
301 NOSPACE(8192, PIN_GLOBAL | PIN_MAPPABLE | PIN_OFFSET_BIAS | (ggtt->mappable_end - 4096)), in igt_vma_pin1()
302 NOSPACE(8192, PIN_GLOBAL | PIN_OFFSET_BIAS | (ggtt->vm.total - 4096)), in igt_vma_pin1()
312 int err = -EINVAL; in igt_vma_pin1()
318 GEM_BUG_ON(!drm_mm_clean(&ggtt->vm.mm)); in igt_vma_pin1()
320 obj = i915_gem_object_create_internal(ggtt->vm.i915, PAGE_SIZE); in igt_vma_pin1()
324 vma = checked_vma_instance(obj, &ggtt->vm, NULL); in igt_vma_pin1()
328 for (m = modes; m->assert; m++) { in igt_vma_pin1()
329 err = i915_vma_pin(vma, m->size, 0, m->flags); in igt_vma_pin1()
330 if (!m->assert(vma, m, err)) { in igt_vma_pin1()
332 m->assert == assert_pin_valid ? "Failed" : "Unexpectedly succeeded", in igt_vma_pin1()
333 (int)(m - modes), m->string, m->size, m->flags, in igt_vma_pin1()
337 err = -EINVAL; in igt_vma_pin1()
362 unsigned int y) in rotated_index() argument
364 return (r->plane[n].stride * (r->plane[n].height - y - 1) + in rotated_index()
365 r->plane[n].offset + x); in rotated_index()
373 unsigned int x, y; in assert_rotated() local
375 for (x = 0; x < r->plane[n].width; x++) { in assert_rotated()
376 for (y = 0; y < r->plane[n].height; y++) { in assert_rotated()
382 n, x, y); in assert_rotated()
383 return ERR_PTR(-EINVAL); in assert_rotated()
386 src_idx = rotated_index(r, n, x, y); in assert_rotated()
392 x, y, src_idx); in assert_rotated()
393 return ERR_PTR(-EINVAL); in assert_rotated()
398 x, y, src_idx); in assert_rotated()
399 return ERR_PTR(-EINVAL); in assert_rotated()
412 unsigned int y) in remapped_index() argument
414 return (r->plane[n].stride * y + in remapped_index()
415 r->plane[n].offset + x); in remapped_index()
423 unsigned int x, y; in assert_remapped() local
425 unsigned int offset; in assert_remapped() local
427 for (y = 0; y < r->plane[n].height; y++) { in assert_remapped()
428 for (x = 0; x < r->plane[n].width; x++) { in assert_remapped()
434 n, x, y); in assert_remapped()
435 return ERR_PTR(-EINVAL); in assert_remapped()
438 offset = 0; in assert_remapped()
442 src_idx = remapped_index(r, n, x, y); in assert_remapped()
445 if (left < PAGE_SIZE || left & (PAGE_SIZE-1)) { in assert_remapped()
448 x, y, src_idx); in assert_remapped()
449 return ERR_PTR(-EINVAL); in assert_remapped()
452 if (sg_dma_address(sg) + offset != src) { in assert_remapped()
454 x, y, src_idx); in assert_remapped()
455 return ERR_PTR(-EINVAL); in assert_remapped()
458 left -= PAGE_SIZE; in assert_remapped()
459 offset += PAGE_SIZE; in assert_remapped()
473 return a->width * a->height + b->width * b->height; in rotated_size()
479 struct i915_address_space *vm = &ggtt->vm; in igt_vma_rotate_remap()
505 int err = -ENOMEM; in igt_vma_rotate_remap()
511 obj = i915_gem_object_create_internal(vm->i915, max_pages * PAGE_SIZE); in igt_vma_rotate_remap()
516 for (a = planes; a->width; a++) { in igt_vma_rotate_remap()
517 for (b = planes + ARRAY_SIZE(planes); b-- != planes; ) { in igt_vma_rotate_remap()
521 max_offset = max(a->stride * a->height, in igt_vma_rotate_remap()
522 b->stride * b->height); in igt_vma_rotate_remap()
524 max_offset = max_pages - max_offset; in igt_vma_rotate_remap()
530 for_each_prime_number_from(view.rotated.plane[0].offset, 0, max_offset) { in igt_vma_rotate_remap()
531 for_each_prime_number_from(view.rotated.plane[1].offset, 0, max_offset) { in igt_vma_rotate_remap()
548 vma->size != rotated_size(a, b) * PAGE_SIZE) { in igt_vma_rotate_remap()
550 PAGE_SIZE * rotated_size(a, b), vma->size); in igt_vma_rotate_remap()
551 err = -EINVAL; in igt_vma_rotate_remap()
556 vma->size > rotated_size(a, b) * PAGE_SIZE) { in igt_vma_rotate_remap()
558 PAGE_SIZE * rotated_size(a, b), vma->size); in igt_vma_rotate_remap()
559 err = -EINVAL; in igt_vma_rotate_remap()
563 if (vma->pages->nents > rotated_size(a, b)) { in igt_vma_rotate_remap()
565 rotated_size(a, b), vma->pages->nents); in igt_vma_rotate_remap()
566 err = -EINVAL; in igt_vma_rotate_remap()
570 if (vma->node.size < vma->size) { in igt_vma_rotate_remap()
572 vma->size, vma->node.size); in igt_vma_rotate_remap()
573 err = -EINVAL; in igt_vma_rotate_remap()
577 if (vma->pages == obj->mm.pages) { in igt_vma_rotate_remap()
579 err = -EINVAL; in igt_vma_rotate_remap()
583 sg = vma->pages->sgl; in igt_vma_rotate_remap()
596 view.rotated.plane[0].offset, in igt_vma_rotate_remap()
600 view.rotated.plane[1].offset); in igt_vma_rotate_remap()
601 err = -EINVAL; in igt_vma_rotate_remap()
623 unsigned long offset, in assert_partial() argument
629 for_each_sgt_daddr(dma, sgt, vma->pages) { in assert_partial()
637 src = i915_gem_object_get_dma_address(obj, offset); in assert_partial()
639 pr_err("DMA mismatch for partial page offset %lu\n", in assert_partial()
640 offset); in assert_partial()
644 offset++; in assert_partial()
645 size--; in assert_partial()
658 if (vma->size != size) { in assert_pin()
660 name, size, vma->size); in assert_pin()
664 if (vma->node.size < vma->size) { in assert_pin()
666 name, vma->size, vma->node.size); in assert_pin()
670 if (view && view->type != I915_GGTT_VIEW_NORMAL) { in assert_pin()
671 if (memcmp(&vma->ggtt_view, view, sizeof(*view))) { in assert_pin()
677 if (vma->pages == vma->obj->mm.pages) { in assert_pin()
683 if (vma->ggtt_view.type != I915_GGTT_VIEW_NORMAL) { in assert_pin()
685 vma->ggtt_view.type); in assert_pin()
689 if (vma->pages != vma->obj->mm.pages) { in assert_pin()
701 struct i915_address_space *vm = &ggtt->vm; in igt_vma_partial()
711 unsigned int sz, offset; in igt_vma_partial() local
713 int err = -ENOMEM; in igt_vma_partial()
719 obj = i915_gem_object_create_internal(vm->i915, npages * PAGE_SIZE); in igt_vma_partial()
723 for (p = phases; p->name; p++) { /* exercise both create/lookup */ in igt_vma_partial()
728 for_each_prime_number_from(offset, 0, npages - sz) { in igt_vma_partial()
732 view.partial.offset = offset; in igt_vma_partial()
748 if (!assert_pin(vma, &view, sz*PAGE_SIZE, p->name)) { in igt_vma_partial()
749 pr_err("(%s) Inconsistent partial pinning for (offset=%d, size=%d)\n", in igt_vma_partial()
750 p->name, offset, sz); in igt_vma_partial()
751 err = -EINVAL; in igt_vma_partial()
755 if (!assert_partial(obj, vma, offset, sz)) { in igt_vma_partial()
756 pr_err("(%s) Inconsistent partial pages for (offset=%d, size=%d)\n", in igt_vma_partial()
757 p->name, offset, sz); in igt_vma_partial()
758 err = -EINVAL; in igt_vma_partial()
770 list_for_each_entry(vma, &obj->vma.list, obj_link) in igt_vma_partial()
773 pr_err("(%s) All partial vma were not recorded on the obj->vma_list: found %u, expected %u\n", in igt_vma_partial()
774 p->name, count, nvma); in igt_vma_partial()
775 err = -EINVAL; in igt_vma_partial()
790 if (!assert_pin(vma, NULL, obj->base.size, p->name)) { in igt_vma_partial()
791 pr_err("(%s) inconsistent full pin\n", p->name); in igt_vma_partial()
792 err = -EINVAL; in igt_vma_partial()
799 list_for_each_entry(vma, &obj->vma.list, obj_link) in igt_vma_partial()
802 pr_err("(%s) allocated an extra full vma!\n", p->name); in igt_vma_partial()
803 err = -EINVAL; in igt_vma_partial()
828 return -ENOMEM; in i915_vma_mock_selftests()
832 err = -ENOMEM; in i915_vma_mock_selftests()
882 wakeref = intel_runtime_pm_get(&i915->runtime_pm); in igt_vma_remapped_gtt()
885 for (p = planes; p->width; p++) { in igt_vma_remapped_gtt()
892 unsigned int x, y; in igt_vma_remapped_gtt() local
907 GEM_BUG_ON(vma->ggtt_view.type != *t); in igt_vma_remapped_gtt()
916 for (y = 0 ; y < p->height; y++) { in igt_vma_remapped_gtt()
917 for (x = 0 ; x < p->width; x++) { in igt_vma_remapped_gtt()
918 unsigned int offset; in igt_vma_remapped_gtt() local
919 u32 val = y << 16 | x; in igt_vma_remapped_gtt()
922 offset = (x * p->height + y) * PAGE_SIZE; in igt_vma_remapped_gtt()
924 offset = (y * p->width + x) * PAGE_SIZE; in igt_vma_remapped_gtt()
926 iowrite32(val, &map[offset / sizeof(*map)]); in igt_vma_remapped_gtt()
938 GEM_BUG_ON(vma->ggtt_view.type != I915_GGTT_VIEW_NORMAL); in igt_vma_remapped_gtt()
947 for (y = 0 ; y < p->height; y++) { in igt_vma_remapped_gtt()
948 for (x = 0 ; x < p->width; x++) { in igt_vma_remapped_gtt()
949 unsigned int offset, src_idx; in igt_vma_remapped_gtt() local
950 u32 exp = y << 16 | x; in igt_vma_remapped_gtt()
954 src_idx = rotated_index(&view.rotated, 0, x, y); in igt_vma_remapped_gtt()
956 src_idx = remapped_index(&view.remapped, 0, x, y); in igt_vma_remapped_gtt()
957 offset = src_idx * PAGE_SIZE; in igt_vma_remapped_gtt()
959 val = ioread32(&map[offset / sizeof(*map)]); in igt_vma_remapped_gtt()
976 intel_runtime_pm_put(&i915->runtime_pm, wakeref); in igt_vma_remapped_gtt()