Lines Matching full:fd

53 set_domain_gtt(int fd, uint32_t handle)  in set_domain_gtt()  argument
55 gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); in set_domain_gtt()
59 mmap_bo(int fd, uint32_t handle) in mmap_bo() argument
63 ptr = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE); in mmap_bo()
69 create_pointer(int fd) in create_pointer() argument
74 handle = gem_create(fd, OBJECT_SIZE); in create_pointer()
76 ptr = mmap_bo(fd, handle); in create_pointer()
78 gem_close(fd, handle); in create_pointer()
84 test_access(int fd) in test_access() argument
90 handle = gem_create(fd, OBJECT_SIZE); in test_access()
97 do_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP_GTT, &mmap_arg); in test_access()
100 MAP_SHARED, fd, mmap_arg.offset)); in test_access()
102 /* Check that the same offset on the other fd doesn't work. */ in test_access()
107 flink = gem_flink(fd, handle); in test_access()
113 /* Check that the same offset on the other fd doesn't work. */ in test_access()
119 test_short(int fd) in test_short() argument
124 mmap_arg.handle = gem_create(fd, OBJECT_SIZE); in test_short()
127 do_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP_GTT, &mmap_arg); in test_short()
132 MAP_SHARED, fd, mmap_arg.offset); in test_short()
136 MAP_SHARED, fd, mmap_arg.offset); in test_short()
148 gem_close(fd, mmap_arg.handle); in test_short()
152 test_copy(int fd) in test_copy() argument
157 src = create_pointer(fd); in test_copy()
158 dst = create_pointer(fd); in test_copy()
173 test_read_write(int fd, enum test_read_write order) in test_read_write() argument
179 handle = gem_create(fd, OBJECT_SIZE); in test_read_write()
181 ptr = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE); in test_read_write()
182 gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); in test_read_write()
192 gem_close(fd, handle); in test_read_write()
197 test_read_write2(int fd, enum test_read_write order) in test_read_write2() argument
203 handle = gem_create(fd, OBJECT_SIZE); in test_read_write2()
205 r = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ); in test_read_write2()
206 w = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE); in test_read_write2()
208 gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); in test_read_write2()
218 gem_close(fd, handle); in test_read_write2()
224 test_write(int fd) in test_write() argument
230 src = create_pointer(fd); in test_write()
231 dst = gem_create(fd, OBJECT_SIZE); in test_write()
233 gem_write(fd, dst, 0, src, OBJECT_SIZE); in test_write()
235 gem_close(fd, dst); in test_write()
240 test_wc(int fd) in test_wc() argument
246 handle = gem_create(fd, 4096); in test_wc()
247 cpu = gem_mmap__cpu(fd, handle, 0, 4096, PROT_READ | PROT_WRITE); in test_wc()
248 gem_set_domain(fd, handle, I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU); in test_wc()
249 gem_close(fd, handle); in test_wc()
251 handle = gem_create(fd, 4096); in test_wc()
252 gtt = gem_mmap__gtt(fd, handle, 4096, PROT_READ | PROT_WRITE); in test_wc()
253 gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); in test_wc()
254 gem_close(fd, handle); in test_wc()
346 igt_info("A: {fd:%d, handle:%d, offset:%"PRIx64"}\n", in test_isolation()
348 igt_info("B: {fd:%d, handle:%d, offset:%"PRIx64"}\n", in test_isolation()
364 test_write_gtt(int fd) in test_write_gtt() argument
370 dst = gem_create(fd, OBJECT_SIZE); in test_write_gtt()
373 dst_gtt = mmap_bo(fd, dst); in test_write_gtt()
374 set_domain_gtt(fd, dst); in test_write_gtt()
378 src = create_pointer(fd); in test_write_gtt()
380 gem_write(fd, dst, 0, src, OBJECT_SIZE); in test_write_gtt()
382 gem_close(fd, dst); in test_write_gtt()
399 test_coherency(int fd) in test_coherency() argument
405 igt_require(is_coherent(fd)); in test_coherency()
408 handle = gem_create(fd, OBJECT_SIZE); in test_coherency()
410 gtt = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE); in test_coherency()
411 cpu = gem_mmap__cpu(fd, handle, 0, OBJECT_SIZE, PROT_READ | PROT_WRITE); in test_coherency()
412 set_domain_gtt(fd, handle); in test_coherency()
427 gem_close(fd, handle); in test_coherency()
431 test_clflush(int fd) in test_clflush() argument
438 handle = gem_create(fd, OBJECT_SIZE); in test_clflush()
440 gtt = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ | PROT_WRITE); in test_clflush()
441 set_domain_gtt(fd, handle); in test_clflush()
446 gem_close(fd, handle); in test_clflush()
450 test_hang(int fd) in test_hang() argument
464 hang = igt_allow_hang(fd, 0, 0); in test_hang()
465 igt_require(igt_sysfs_set_parameter(fd, "reset", "1")); /* global */ in test_hang()
478 handle = gem_create(fd, OBJECT_SIZE); in test_hang()
479 gem_set_tiling(fd, handle, I915_TILING_X + i, 2048); in test_hang()
481 gtt[i] = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_WRITE); in test_hang()
482 set_domain_gtt(fd, handle); in test_hang()
483 gem_close(fd, handle); in test_hang()
515 dir = igt_debugfs_dir(fd); in test_hang()
531 igt_disallow_hang(fd, hang); in test_hang()
571 static bool known_swizzling(int fd, uint32_t handle) in known_swizzling() argument
583 if (igt_ioctl(fd, DRM_IOCTL_I915_GEM_GET_TILING2, &arg)) in known_swizzling()
590 test_huge_bo(int fd, int huge, int tiling) in test_huge_bo() argument
597 uint32_t devid = intel_get_drm_devid(fd); in test_huge_bo()
613 intel_gen(intel_get_drm_devid(fd)) < 4 && in test_huge_bo()
614 size >= gem_global_aperture_size(fd) / 2) in test_huge_bo()
621 size = gem_global_aperture_size(fd) + PAGE_SIZE; in test_huge_bo()
629 bo = gem_create(fd, PAGE_SIZE); in test_huge_bo()
631 igt_require(__gem_set_tiling(fd, bo, tiling, pitch) == 0); in test_huge_bo()
632 igt_require(known_swizzling(fd, bo)); in test_huge_bo()
634 linear_pattern = gem_mmap__gtt(fd, bo, PAGE_SIZE, in test_huge_bo()
638 tiled_pattern = gem_mmap__cpu(fd, bo, 0, PAGE_SIZE, PROT_READ); in test_huge_bo()
640 gem_set_domain(fd, bo, I915_GEM_DOMAIN_CPU | I915_GEM_DOMAIN_GTT, 0); in test_huge_bo()
641 gem_close(fd, bo); in test_huge_bo()
643 bo = gem_create(fd, size); in test_huge_bo()
645 igt_require(__gem_set_tiling(fd, bo, tiling, pitch) == 0); in test_huge_bo()
648 ptr = gem_mmap__cpu(fd, bo, 0, size, PROT_READ | PROT_WRITE); in test_huge_bo()
654 ptr = __gem_mmap__gtt(fd, bo, size, PROT_READ | PROT_WRITE); in test_huge_bo()
657 set_domain_gtt(fd, bo); in test_huge_bo()
663 gem_set_tiling(fd, bo, I915_TILING_NONE, 0); in test_huge_bo()
670 gem_close(fd, bo); in test_huge_bo()
691 test_huge_copy(int fd, int huge, int tiling_a, int tiling_b, int ncpus) in test_huge_copy() argument
693 const uint32_t devid = intel_get_drm_devid(fd); in test_huge_copy()
711 huge_object_size = gem_global_aperture_size(fd) + PAGE_SIZE; in test_huge_copy()
725 bo[0] = gem_create(fd, huge_object_size); in test_huge_copy()
727 igt_require(__gem_set_tiling(fd, bo[0], abs(tiling_a), min_tile_width(devid, tiling_a)) == 0); in test_huge_copy()
730 a = __gem_mmap__gtt(fd, bo[0], huge_object_size, PROT_READ | PROT_WRITE); in test_huge_copy()
733 bo[1] = gem_create(fd, huge_object_size); in test_huge_copy()
735 igt_require(__gem_set_tiling(fd, bo[1], abs(tiling_b), max_tile_width(devid, tiling_b)) == 0); in test_huge_copy()
738 b = __gem_mmap__gtt(fd, bo[1], huge_object_size, PROT_READ | PROT_WRITE); in test_huge_copy()
741 gem_set_domain(fd, bo[0], I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); in test_huge_copy()
749 gem_set_domain(fd, bo[1], I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); in test_huge_copy()
771 gem_set_domain(fd, bo[0], I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); in test_huge_copy()
774 gem_set_domain(fd, bo[1], I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); in test_huge_copy()
780 gem_close(fd, bo[0]); in test_huge_copy()
781 gem_close(fd, bo[1]); in test_huge_copy()
811 test_read(int fd) in test_read() argument
817 dst = create_pointer(fd); in test_read()
818 src = gem_create(fd, OBJECT_SIZE); in test_read()
820 gem_read(fd, src, 0, dst, OBJECT_SIZE); in test_read()
822 gem_close(fd, src); in test_read()
827 test_write_cpu_read_gtt(int fd) in test_write_cpu_read_gtt() argument
832 igt_require(gem_has_llc(fd)); in test_write_cpu_read_gtt()
834 handle = gem_create(fd, OBJECT_SIZE); in test_write_cpu_read_gtt()
836 dst = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_READ); in test_write_cpu_read_gtt()
838 src = gem_mmap__cpu(fd, handle, 0, OBJECT_SIZE, PROT_WRITE); in test_write_cpu_read_gtt()
840 gem_close(fd, handle); in test_write_cpu_read_gtt()
873 test_fault_concurrent(int fd) in test_fault_concurrent() argument
880 ptr[n] = create_pointer(fd); in test_fault_concurrent()
898 run_without_prefault(int fd, in run_without_prefault() argument
899 void (*func)(int fd)) in run_without_prefault() argument
902 func(fd); in run_without_prefault()
917 int fd; variable
925 fd = drm_open_driver(DRIVER_INTEL); variable
928 uint32_t real_handle = gem_create(fd, 4096);
942 igt_assert_eq(mmap_ioctl(fd, &arg), -ENOENT);
945 gem_close(fd, real_handle);
949 test_access(fd);
951 test_short(fd);
953 test_copy(fd);
955 test_read(fd);
957 test_write(fd);
959 test_write_gtt(fd);
961 test_coherency(fd);
963 test_clflush(fd);
965 test_hang(fd);
967 test_read_write(fd, READ_BEFORE_WRITE);
969 test_read_write(fd, READ_AFTER_WRITE);
971 test_read_write2(fd, READ_BEFORE_WRITE);
973 test_read_write2(fd, READ_AFTER_WRITE);
975 test_fault_concurrent(fd);
977 run_without_prefault(fd, test_read);
979 run_without_prefault(fd, test_write);
981 run_without_prefault(fd, test_write_gtt);
983 test_write_cpu_read_gtt(fd);
985 test_wc(fd);
987 test_isolation(fd);
989 test_pf_nonblock(fd);
992 test_huge_bo(fd, -1, I915_TILING_NONE);
994 test_huge_bo(fd, -1, I915_TILING_X);
996 test_huge_bo(fd, -1, I915_TILING_Y);
999 test_huge_bo(fd, 0, I915_TILING_NONE);
1001 test_huge_bo(fd, 0, I915_TILING_X);
1003 test_huge_bo(fd, 0, I915_TILING_Y);
1006 test_huge_bo(fd, 1, I915_TILING_NONE);
1008 test_huge_bo(fd, 1, I915_TILING_X);
1010 test_huge_bo(fd, 1, I915_TILING_Y);
1038 test_huge_copy(fd,
1045 test_huge_copy(fd,
1055 close(fd);