Lines Matching refs:spin
72 emit_recursive_batch(igt_spin_t *spin, in emit_recursive_batch() argument
103 memset(&spin->execbuf, 0, sizeof(spin->execbuf)); in emit_recursive_batch()
104 execbuf = &spin->execbuf; in emit_recursive_batch()
105 memset(spin->obj, 0, sizeof(spin->obj)); in emit_recursive_batch()
106 obj = spin->obj; in emit_recursive_batch()
146 spin->poll_handle = gem_create(fd, 4096); in emit_recursive_batch()
147 obj[SCRATCH].handle = spin->poll_handle; in emit_recursive_batch()
149 if (__gem_set_caching(fd, spin->poll_handle, in emit_recursive_batch()
151 spin->poll = gem_mmap__cpu(fd, spin->poll_handle, in emit_recursive_batch()
155 spin->poll = gem_mmap__wc(fd, spin->poll_handle, in emit_recursive_batch()
159 igt_assert_eq(spin->poll[SPIN_POLL_START_IDX], 0); in emit_recursive_batch()
186 spin->handle = obj[BATCH].handle; in emit_recursive_batch()
189 spin->condition = batch + LOOP_START_OFFSET / sizeof(*cs); in emit_recursive_batch()
190 cs = spin->condition; in emit_recursive_batch()
265 for (i = 0; i < ARRAY_SIZE(spin->obj); i++) { in emit_recursive_batch()
266 spin->obj[i].relocation_count = 0; in emit_recursive_batch()
267 spin->obj[i].relocs_ptr = 0; in emit_recursive_batch()
268 spin->obj[i].flags = EXEC_OBJECT_PINNED; in emit_recursive_batch()
271 spin->cmd_precondition = *spin->condition; in emit_recursive_batch()
279 igt_spin_t *spin; in spin_create() local
281 spin = calloc(1, sizeof(struct igt_spin)); in spin_create()
282 igt_assert(spin); in spin_create()
284 spin->out_fence = emit_recursive_batch(spin, fd, opts); in spin_create()
287 igt_list_add(&spin->link, &spin_list); in spin_create()
290 return spin; in spin_create()
314 igt_spin_t *spin; in igt_spin_factory() local
334 spin = spin_create(fd, opts); in igt_spin_factory()
336 igt_assert(gem_bo_busy(fd, spin->handle)); in igt_spin_factory()
338 struct pollfd pfd = { spin->out_fence, POLLIN }; in igt_spin_factory()
343 return spin; in igt_spin_factory()
348 igt_spin_t *spin = arg.sival_ptr; in notify() local
350 igt_spin_end(spin); in notify()
362 void igt_spin_set_timeout(igt_spin_t *spin, int64_t ns) in igt_spin_set_timeout() argument
369 if (!spin) in igt_spin_set_timeout()
372 igt_assert(!spin->timer); in igt_spin_set_timeout()
376 sev.sigev_value.sival_ptr = spin; in igt_spin_set_timeout()
386 spin->timer = timer; in igt_spin_set_timeout()
395 void igt_spin_reset(igt_spin_t *spin) in igt_spin_reset() argument
397 if (igt_spin_has_poll(spin)) in igt_spin_reset()
398 spin->poll[SPIN_POLL_START_IDX] = 0; in igt_spin_reset()
400 *spin->condition = spin->cmd_precondition; in igt_spin_reset()
410 void igt_spin_end(igt_spin_t *spin) in igt_spin_end() argument
412 if (!spin) in igt_spin_end()
415 *spin->condition = MI_BATCH_BUFFER_END; in igt_spin_end()
427 void igt_spin_free(int fd, igt_spin_t *spin) in igt_spin_free() argument
429 if (!spin) in igt_spin_free()
433 igt_list_del(&spin->link); in igt_spin_free()
436 if (spin->timer) in igt_spin_free()
437 timer_delete(spin->timer); in igt_spin_free()
439 igt_spin_end(spin); in igt_spin_free()
440 gem_munmap((void *)((unsigned long)spin->condition & (~4095UL)), in igt_spin_free()
443 if (spin->poll) { in igt_spin_free()
444 gem_munmap(spin->poll, 4096); in igt_spin_free()
445 gem_close(fd, spin->poll_handle); in igt_spin_free()
448 gem_close(fd, spin->handle); in igt_spin_free()
450 if (spin->out_fence >= 0) in igt_spin_free()
451 close(spin->out_fence); in igt_spin_free()
453 free(spin); in igt_spin_free()