Lines Matching refs:fc
113 static int fence_chains_init(struct fence_chains *fc, unsigned int count, in fence_chains_init() argument
119 fc->chains = kvmalloc_array(count, sizeof(*fc->chains), in fence_chains_init()
121 if (!fc->chains) in fence_chains_init()
124 fc->fences = kvmalloc_array(count, sizeof(*fc->fences), in fence_chains_init()
126 if (!fc->fences) { in fence_chains_init()
131 fc->tail = NULL; in fence_chains_init()
133 fc->fences[i] = mock_fence(); in fence_chains_init()
134 if (!fc->fences[i]) { in fence_chains_init()
139 fc->chains[i] = mock_chain(fc->tail, in fence_chains_init()
140 fc->fences[i], in fence_chains_init()
142 if (!fc->chains[i]) { in fence_chains_init()
147 fc->tail = fc->chains[i]; in fence_chains_init()
149 dma_fence_enable_sw_signaling(fc->chains[i]); in fence_chains_init()
152 fc->chain_length = i; in fence_chains_init()
157 dma_fence_put(fc->fences[i]); in fence_chains_init()
158 dma_fence_put(fc->chains[i]); in fence_chains_init()
160 kvfree(fc->fences); in fence_chains_init()
162 kvfree(fc->chains); in fence_chains_init()
166 static void fence_chains_fini(struct fence_chains *fc) in fence_chains_fini() argument
170 for (i = 0; i < fc->chain_length; i++) { in fence_chains_fini()
171 dma_fence_signal(fc->fences[i]); in fence_chains_fini()
172 dma_fence_put(fc->fences[i]); in fence_chains_fini()
174 kvfree(fc->fences); in fence_chains_fini()
176 for (i = 0; i < fc->chain_length; i++) in fence_chains_fini()
177 dma_fence_put(fc->chains[i]); in fence_chains_fini()
178 kvfree(fc->chains); in fence_chains_fini()
183 struct fence_chains fc; in find_seqno() local
188 err = fence_chains_init(&fc, 64, seqno_inc); in find_seqno()
192 fence = dma_fence_get(fc.tail); in find_seqno()
200 for (i = 0; i < fc.chain_length; i++) { in find_seqno()
201 fence = dma_fence_get(fc.tail); in find_seqno()
206 err, fc.chain_length + 1, i + 1); in find_seqno()
209 if (fence != fc.chains[i]) { in find_seqno()
211 fc.chain_length + 1, i + 1); in find_seqno()
223 if (fence != fc.chains[i]) { in find_seqno()
246 if (i > 0 && fence != fc.chains[i - 1]) { in find_seqno()
255 fence_chains_fini(&fc); in find_seqno()
261 struct fence_chains fc; in find_signaled() local
265 err = fence_chains_init(&fc, 2, seqno_inc); in find_signaled()
269 dma_fence_signal(fc.fences[0]); in find_signaled()
271 fence = dma_fence_get(fc.tail); in find_signaled()
279 if (fence && fence != fc.chains[0]) { in find_signaled()
293 fence_chains_fini(&fc); in find_signaled()
299 struct fence_chains fc; in find_out_of_order() local
303 err = fence_chains_init(&fc, 3, seqno_inc); in find_out_of_order()
307 dma_fence_signal(fc.fences[1]); in find_out_of_order()
309 fence = dma_fence_get(fc.tail); in find_out_of_order()
324 if (fence != fc.chains[0]) { in find_out_of_order()
332 fence_chains_fini(&fc); in find_out_of_order()
343 struct fence_chains fc; in find_gap() local
348 err = fence_chains_init(&fc, 64, seqno_inc2); in find_gap()
352 for (i = 0; i < fc.chain_length; i++) { in find_gap()
353 fence = dma_fence_get(fc.tail); in find_gap()
358 err, fc.chain_length + 1, 2 * i + 1); in find_gap()
361 if (fence != fc.chains[i]) { in find_gap()
364 fc.chain_length + 1, in find_gap()
377 if (fence != fc.chains[i]) { in find_gap()
385 fence_chains_fini(&fc); in find_gap()
390 struct fence_chains fc; member
400 struct dma_fence *fence = dma_fence_get(data->fc.tail); in __find_race()
403 seqno = get_random_u32_inclusive(1, data->fc.chain_length); in __find_race()
432 seqno = get_random_u32_below(data->fc.chain_length - 1); in __find_race()
433 dma_fence_signal(data->fc.fences[seqno]); in __find_race()
451 err = fence_chains_init(&data.fc, CHAIN_SZ, seqno_inc); in find_race()
487 for (i = 0; i < data.fc.chain_length; i++) in find_race()
488 if (dma_fence_is_signaled(data.fc.fences[i])) in find_race()
493 fence_chains_fini(&data.fc); in find_race()
499 struct fence_chains fc; in signal_forward() local
503 err = fence_chains_init(&fc, 64, seqno_inc); in signal_forward()
507 for (i = 0; i < fc.chain_length; i++) { in signal_forward()
508 dma_fence_signal(fc.fences[i]); in signal_forward()
510 if (!dma_fence_is_signaled(fc.chains[i])) { in signal_forward()
516 if (i + 1 < fc.chain_length && in signal_forward()
517 dma_fence_is_signaled(fc.chains[i + 1])) { in signal_forward()
525 fence_chains_fini(&fc); in signal_forward()
531 struct fence_chains fc; in signal_backward() local
535 err = fence_chains_init(&fc, 64, seqno_inc); in signal_backward()
539 for (i = fc.chain_length; i--; ) { in signal_backward()
540 dma_fence_signal(fc.fences[i]); in signal_backward()
542 if (i > 0 && dma_fence_is_signaled(fc.chains[i])) { in signal_backward()
549 for (i = 0; i < fc.chain_length; i++) { in signal_backward()
550 if (!dma_fence_is_signaled(fc.chains[i])) { in signal_backward()
558 fence_chains_fini(&fc); in signal_backward()
564 struct fence_chains *fc = arg; in __wait_fence_chains() local
566 if (dma_fence_wait(fc->tail, false)) in __wait_fence_chains()
574 struct fence_chains fc; in wait_forward() local
579 err = fence_chains_init(&fc, CHAIN_SZ, seqno_inc); in wait_forward()
583 tsk = kthread_run(__wait_fence_chains, &fc, "dmabuf/wait"); in wait_forward()
591 for (i = 0; i < fc.chain_length; i++) in wait_forward()
592 dma_fence_signal(fc.fences[i]); in wait_forward()
598 fence_chains_fini(&fc); in wait_forward()
604 struct fence_chains fc; in wait_backward() local
609 err = fence_chains_init(&fc, CHAIN_SZ, seqno_inc); in wait_backward()
613 tsk = kthread_run(__wait_fence_chains, &fc, "dmabuf/wait"); in wait_backward()
621 for (i = fc.chain_length; i--; ) in wait_backward()
622 dma_fence_signal(fc.fences[i]); in wait_backward()
628 fence_chains_fini(&fc); in wait_backward()
632 static void randomise_fences(struct fence_chains *fc) in randomise_fences() argument
634 unsigned int count = fc->chain_length; in randomise_fences()
644 swap(fc->fences[count], fc->fences[swp]); in randomise_fences()
650 struct fence_chains fc; in wait_random() local
655 err = fence_chains_init(&fc, CHAIN_SZ, seqno_inc); in wait_random()
659 randomise_fences(&fc); in wait_random()
661 tsk = kthread_run(__wait_fence_chains, &fc, "dmabuf/wait"); in wait_random()
669 for (i = 0; i < fc.chain_length; i++) in wait_random()
670 dma_fence_signal(fc.fences[i]); in wait_random()
676 fence_chains_fini(&fc); in wait_random()