Lines Matching full:fd

41 static bool gem_busy(int fd, uint32_t handle)  in gem_busy()  argument
48 do_ioctl(fd, DRM_IOCTL_I915_GEM_BUSY, &busy); in gem_busy()
53 static void __gem_busy(int fd, in __gem_busy() argument
63 do_ioctl(fd, DRM_IOCTL_I915_GEM_BUSY, &busy); in __gem_busy()
69 static bool exec_noop(int fd, in exec_noop() argument
90 return __gem_execbuf(fd, &execbuf) == 0; in exec_noop()
93 static bool still_busy(int fd, uint32_t handle) in still_busy() argument
96 __gem_busy(fd, handle, &read, &write); in still_busy()
100 static void semaphore(int fd, const struct intel_execution_engine2 *e) in semaphore() argument
111 handle[TEST] = gem_create(fd, 4096); in semaphore()
112 handle[BATCH] = gem_create(fd, 4096); in semaphore()
113 gem_write(fd, handle[BATCH], 0, &bbe, sizeof(bbe)); in semaphore()
116 handle[BUSY] = gem_create(fd, 4096); in semaphore()
117 spin = igt_spin_new(fd, in semaphore()
122 igt_assert(exec_noop(fd, handle, e->flags, false)); in semaphore()
123 igt_assert(still_busy(fd, handle[BUSY])); in semaphore()
124 __gem_busy(fd, handle[TEST], &read, &write); in semaphore()
129 igt_assert(exec_noop(fd, handle, e->flags, true)); in semaphore()
130 igt_assert(still_busy(fd, handle[BUSY])); in semaphore()
131 __gem_busy(fd, handle[TEST], &read, &write); in semaphore()
137 __for_each_physical_engine(fd, __e) { in semaphore()
138 if (exec_noop(fd, handle, __e->flags, false)) in semaphore()
141 igt_assert(still_busy(fd, handle[BUSY])); in semaphore()
142 __gem_busy(fd, handle[TEST], &read, &write); in semaphore()
147 igt_assert(still_busy(fd, handle[BUSY])); in semaphore()
148 igt_spin_free(fd, spin); in semaphore()
151 gem_sync(fd, handle[TEST]); in semaphore()
152 __gem_busy(fd, handle[TEST], &read, &write); in semaphore()
157 gem_close(fd, handle[i]); in semaphore()
162 static void one(int fd, const struct intel_execution_engine2 *e, unsigned test_flags) in one() argument
164 const int gen = intel_gen(intel_get_drm_devid(fd)); in one()
185 obj[SCRATCH].handle = gem_create(fd, 4096); in one()
187 obj[BATCH].handle = gem_create(fd, size); in one()
192 batch = gem_mmap__wc(fd, obj[BATCH].handle, 0, size, PROT_WRITE); in one()
193 gem_set_domain(fd, obj[BATCH].handle, in one()
246 igt_require(__gem_execbuf(fd, &execbuf) == 0); in one()
248 __gem_busy(fd, obj[SCRATCH].handle, &read[SCRATCH], &write[SCRATCH]); in one()
249 __gem_busy(fd, obj[BATCH].handle, &read[BATCH], &write[BATCH]); in one()
254 __for_each_physical_engine(fd, e2) { in one()
259 if (!gem_class_can_store_dword(fd, e2->class)) in one()
263 one(fd, e2, 0); in one()
282 while (gem_busy(fd, obj[BATCH].handle)) in one()
284 igt_assert(!gem_busy(fd, obj[SCRATCH].handle)); in one()
287 batch = gem_mmap__wc(fd, obj[SCRATCH].handle, 0, 4096, PROT_READ); in one()
292 gem_close(fd, obj[BATCH].handle); in one()
293 gem_close(fd, obj[SCRATCH].handle); in one()
304 static void close_race(int fd) in close_race() argument
307 const unsigned int nhandles = gem_measure_ring_inflight(fd, ALL_ENGINES, 0) / 2; in close_race()
322 for_each_engine(fd, i) in close_race()
352 drmIoctl(fd, DRM_IOCTL_I915_GEM_BUSY, &busy); in close_race()
369 spin[i] = __igt_spin_new(fd, in close_race()
376 igt_spin_free(fd, spin[i]); in close_race()
377 spin[i] = __igt_spin_new(fd, in close_race()
388 igt_spin_free(fd, spin[i]); in close_race()
400 gem_quiescent_gpu(fd); in close_race()
403 static bool has_semaphores(int fd) in has_semaphores() argument
412 drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp); in has_semaphores()
418 static bool has_extended_busy_ioctl(int fd) in has_extended_busy_ioctl() argument
420 igt_spin_t *spin = igt_spin_new(fd, .engine = I915_EXEC_DEFAULT); in has_extended_busy_ioctl()
423 __gem_busy(fd, spin->handle, &read, &write); in has_extended_busy_ioctl()
424 igt_spin_free(fd, spin); in has_extended_busy_ioctl()
429 static void basic(int fd, const struct intel_execution_engine2 *e, unsigned flags) in basic() argument
432 igt_spin_new(fd, in basic()
439 busy = gem_bo_busy(fd, spin->handle); in basic()
449 while (gem_bo_busy(fd, spin->handle)) { in basic()
451 igt_debugfs_dump(fd, "i915_engine_info"); in basic()
452 igt_debugfs_dump(fd, "i915_hangcheck_info"); in basic()
460 igt_spin_free(fd, spin); in basic()
474 int fd = -1; variable
477 fd = drm_open_driver_master(DRIVER_INTEL);
478 igt_require_gem(fd);
479 igt_require(gem_class_can_store_dword(fd,
485 igt_fork_hang_detector(fd);
489 gem_quiescent_gpu(fd);
490 all(fd);
493 __for_each_physical_engine(fd, e) { in __for_each_physical_engine() argument
496 gem_quiescent_gpu(fd); in __for_each_physical_engine()
497 basic(fd, e, 0); in __for_each_physical_engine()
504 igt_require(has_extended_busy_ioctl(fd));
505 gem_require_mmap_wc(fd);
508 __for_each_physical_engine(fd, e) { in __for_each_physical_engine() argument
510 igt_require(gem_class_can_store_dword(fd, in __for_each_physical_engine()
512 gem_quiescent_gpu(fd); in __for_each_physical_engine()
513 one(fd, e, 0); in __for_each_physical_engine()
514 gem_quiescent_gpu(fd); in __for_each_physical_engine()
518 __for_each_physical_engine(fd, e) { in __for_each_physical_engine() argument
520 igt_require(gem_class_can_store_dword(fd, e->class)); in __for_each_physical_engine()
522 gem_quiescent_gpu(fd); in __for_each_physical_engine()
523 one(fd, e, PARALLEL); in __for_each_physical_engine()
524 gem_quiescent_gpu(fd); in __for_each_physical_engine()
531 igt_require(has_extended_busy_ioctl(fd));
532 igt_require(has_semaphores(fd));
535 __for_each_physical_engine(fd, e) { in __for_each_physical_engine() argument
537 semaphore(fd, e); in __for_each_physical_engine()
542 close_race(fd);
553 hang = igt_allow_hang(fd, 0, 0);
556 __for_each_physical_engine(fd, e) { in __for_each_physical_engine() argument
561 gem_quiescent_gpu(fd); in __for_each_physical_engine()
562 basic(fd, e, HANG); in __for_each_physical_engine()
568 igt_require(has_extended_busy_ioctl(fd));
569 gem_require_mmap_wc(fd);
572 __for_each_physical_engine(fd, e) { in __for_each_physical_engine() argument
575 igt_require(gem_class_can_store_dword(fd, e->class)); in __for_each_physical_engine()
577 gem_quiescent_gpu(fd); in __for_each_physical_engine()
578 one(fd, e, HANG); in __for_each_physical_engine()
579 gem_quiescent_gpu(fd); in __for_each_physical_engine()
585 igt_disallow_hang(fd, hang);
590 close(fd);