Lines Matching refs:fence

45  * for GPU/CPU synchronization.  When the fence is written,
46 * it is expected that all buffers associated with that fence
54 * radeon_fence_write - write a fence value
58 * @ring: ring index the fence is associated with
60 * Writes a fence value to memory or a scratch register (all asics).
73 * radeon_fence_read - read a fence value
76 * @ring: ring index the fence is associated with
78 * Reads a fence value from memory or a scratch register (all asics).
79 * Returns the value of the fence read from memory or register.
95 * radeon_fence_emit - emit a fence on the requested ring
98 * @fence: radeon fence object
99 * @ring: ring index the fence is associated with
101 * Emits a fence command on the requested ring (all asics).
105 struct radeon_fence **fence,
109 *fence = malloc(sizeof(struct radeon_fence), DRM_MEM_DRIVER, M_NOWAIT);
110 if ((*fence) == NULL) {
113 refcount_init(&((*fence)->kref), 1);
114 (*fence)->rdev = rdev;
115 (*fence)->seq = ++rdev->fence_drv[ring].sync_seq[ring];
116 (*fence)->ring = ring;
117 radeon_fence_ring_emit(rdev, ring, *fence);
118 CTR2(KTR_DRM, "radeon fence: emit (ring=%d, seq=%d)", ring, (*fence)->seq);
123 * radeon_fence_process - process a fence
126 * @ring: ring index the fence is associated with
128 * Checks the current fence value and wakes the fence queue
144 * continuously new fence signaled ie radeon_fence_read needs
172 * checking if a fence is signaled as it means that the
179 * fact that we might have set an older fence
194 * radeon_fence_destroy - destroy a fence
196 * @kref: fence kref
198 * Frees the fence object (all asics).
200 static void radeon_fence_destroy(struct radeon_fence *fence)
203 free(fence, DRM_MEM_DRIVER);
207 * radeon_fence_seq_signaled - check if a fence sequeuce number has signaled
211 * @ring: ring index the fence is associated with
213 * Check if the last singled fence sequnce number is >= the requested
215 * Returns true if the fence has signaled (current fence value
216 * is >= requested value) or false if it has not (current fence
235 * radeon_fence_signaled - check if a fence has signaled
237 * @fence: radeon fence object
239 * Check if the requested fence has signaled (all asics).
240 * Returns true if the fence has signaled or false if it has not.
242 bool radeon_fence_signaled(struct radeon_fence *fence)
244 if (!fence) {
247 if (fence->seq == RADEON_FENCE_SIGNALED_SEQ) {
250 if (radeon_fence_seq_signaled(fence->rdev, fence->seq, fence->ring)) {
251 fence->seq = RADEON_FENCE_SIGNALED_SEQ;
262 * @ring: ring index the fence is associated with
294 /* either jiffies wrapped around, or no fence was signaled in the last 500ms
303 CTR2(KTR_DRM, "radeon fence: wait begin (ring=%d, seq=%d)",
342 CTR2(KTR_DRM, "radeon fence: wait end (ring=%d, seq=%d)",
347 /* we were interrupted for some reason and fence
373 dev_warn(rdev->dev, "GPU lockup (waiting for 0x%016jx last fence id 0x%016jx)\n",
398 * radeon_fence_wait - wait for a fence to signal
400 * @fence: radeon fence object
403 * Wait for the requested fence to signal (all asics).
405 * (false) sleep when waiting for the fence.
406 * Returns 0 if the fence has passed, error for all other cases.
408 int radeon_fence_wait(struct radeon_fence *fence, bool intr)
412 if (fence == NULL) {
413 DRM_ERROR("Querying an invalid fence : %p !\n", fence);
417 r = radeon_fence_wait_seq(fence->rdev, fence->seq,
418 fence->ring, intr, true);
422 fence->seq = RADEON_FENCE_SIGNALED_SEQ;
489 /* either jiffies wrapped around, or no fence was signaled in the last 500ms
495 CTR2(KTR_DRM, "radeon fence: wait begin (ring=%d, target_seq=%d)",
541 CTR2(KTR_DRM, "radeon fence: wait end (ring=%d, target_seq=%d)",
546 /* we were interrupted for some reason and fence
588 * radeon_fence_wait_any - wait for a fence to signal on any ring
591 * @fences: radeon fence object(s)
594 * Wait for any requested fence to signal (all asics). Fence
598 * Returns 0 if any fence has passed, error for all other cases.
631 * radeon_fence_wait_next_locked - wait for the next fence to signal
634 * @ring: ring index the fence is associated with
636 * Wait for the next fence on the requested ring to signal (all asics).
637 * Returns 0 if the next fence has passed, error for all other cases.
647 already the last emitted fence */
657 * @ring: ring index the fence is associated with
680 * radeon_fence_ref - take a ref on a fence
682 * @fence: radeon fence object
684 * Take a reference on a fence (all asics).
685 * Returns the fence.
687 struct radeon_fence *radeon_fence_ref(struct radeon_fence *fence)
689 refcount_acquire(&fence->kref);
690 return fence;
694 * radeon_fence_unref - remove a ref on a fence
696 * @fence: radeon fence object
698 * Remove a reference on a fence (all asics).
700 void radeon_fence_unref(struct radeon_fence **fence)
702 struct radeon_fence *tmp = *fence;
704 *fence = NULL;
716 * @ring: ring index the fence is associated with
727 * but it's ok to report slightly wrong fence count here.
742 * @fence: radeon fence object
745 * Check if the fence needs to be synced against another ring
750 bool radeon_fence_need_sync(struct radeon_fence *fence, int dst_ring)
754 if (!fence) {
758 if (fence->ring == dst_ring) {
763 fdrv = &fence->rdev->fence_drv[dst_ring];
764 if (fence->seq <= fdrv->sync_seq[fence->ring]) {
774 * @fence: radeon fence object
777 * Note the sequence number at which point the fence will
780 void radeon_fence_note_sync(struct radeon_fence *fence, int dst_ring)
785 if (!fence) {
789 if (fence->ring == dst_ring) {
794 src = &fence->rdev->fence_drv[fence->ring];
795 dst = &fence->rdev->fence_drv[dst_ring];
805 * radeon_fence_driver_start_ring - make the fence driver
809 * @ring: ring index to start the fence driver on
811 * Make the fence driver ready for processing (all asics).
813 * start the fence driver on the rings it has.
828 dev_err(rdev->dev, "fence failed to get scratch register\n");
839 dev_info(rdev->dev, "fence driver on ring %d use gpu addr 0x%016jx and cpu addr 0x%p\n",
845 * radeon_fence_driver_init_ring - init the fence driver
849 * @ring: ring index to start the fence driver on
851 * Init the fence driver for the requested ring (all asics).
869 * radeon_fence_driver_init - init the fence driver
874 * Init the fence driver for all possible rings (all asics).
876 * start the fence driver on the rings it has using
891 dev_err(rdev->dev, "fence debugfs file creation failed\n");
897 * radeon_fence_driver_fini - tear down the fence driver
902 * Tear down the fence driver for all possible rings (all asics).
926 * radeon_fence_driver_force_completion - force all fence waiter to complete
930 * In case of GPU reset failure make sure no process keep waiting on fence
961 seq_printf(m, "Last signaled fence 0x%016llx\n",