Lines Matching full:fence
46 * for GPU/CPU synchronization. When the fence is written,
47 * it is expected that all buffers associated with that fence
94 * amdgpu_fence_write - write a fence value
96 * @ring: ring the fence is associated with
99 * Writes a fence value to memory (all asics).
110 * amdgpu_fence_read - read a fence value
112 * @ring: ring the fence is associated with
114 * Reads a fence value from memory (all asics).
115 * Returns the value of the fence read from memory.
131 * amdgpu_fence_emit - emit a fence on the requested ring
133 * @ring: ring the fence is associated with
134 * @f: resulting fence object
135 * @job: job the fence is embedded in
138 * Emits a fence command on the requested ring (all asics).
145 struct dma_fence *fence; in amdgpu_fence_emit() local
152 /* create a sperate hw fence */ in amdgpu_fence_emit()
156 fence = &am_fence->base; in amdgpu_fence_emit()
159 /* take use of job-embedded fence */ in amdgpu_fence_emit()
160 fence = &job->hw_fence; in amdgpu_fence_emit()
166 fence->seqno = seq; in amdgpu_fence_emit()
167 /* TO be inline with external fence creation and other drivers */ in amdgpu_fence_emit()
168 dma_fence_get(fence); in amdgpu_fence_emit()
171 dma_fence_init(fence, &amdgpu_job_fence_ops, in amdgpu_fence_emit()
175 dma_fence_get(fence); in amdgpu_fence_emit()
177 dma_fence_init(fence, &amdgpu_fence_ops, in amdgpu_fence_emit()
203 to_amdgpu_fence(fence)->start_timestamp = ktime_get(); in amdgpu_fence_emit()
206 * emitting the fence would mess up the hardware ring buffer. in amdgpu_fence_emit()
208 rcu_assign_pointer(*ptr, dma_fence_get(fence)); in amdgpu_fence_emit()
210 *f = fence; in amdgpu_fence_emit()
216 * amdgpu_fence_emit_polling - emit a fence on the requeste ring
218 * @ring: ring the fence is associated with
222 * Emits a fence command on the requested ring (all asics).
223 * Used For polling fence.
264 * amdgpu_fence_process - check for fence activity
268 * Checks the current fence value and calculates the last
269 * signalled fence value. Wakes the fence queue if the
272 * Returns true if fence was processed
297 struct dma_fence *fence, **ptr; in amdgpu_fence_process() local
303 /* There is always exactly one thread signaling this fence slot */ in amdgpu_fence_process()
304 fence = rcu_dereference_protected(*ptr, 1); in amdgpu_fence_process()
307 if (!fence) in amdgpu_fence_process()
310 dma_fence_signal(fence); in amdgpu_fence_process()
311 dma_fence_put(fence); in amdgpu_fence_process()
325 * Checks for fence activity.
333 DRM_WARN("Fence fallback timer expired on ring %s\n", ring->name); in amdgpu_fence_fallback()
339 * @ring: ring index the fence is associated with
347 struct dma_fence *fence, **ptr; in amdgpu_fence_wait_empty() local
355 fence = rcu_dereference(*ptr); in amdgpu_fence_wait_empty()
356 if (!fence || !dma_fence_get_rcu(fence)) { in amdgpu_fence_wait_empty()
362 r = dma_fence_wait(fence, false); in amdgpu_fence_wait_empty()
363 dma_fence_put(fence); in amdgpu_fence_wait_empty()
370 * @ring: ring index the fence is associated with
391 * @ring: ring the fence is associated with
402 * but it's ok to report slightly wrong fence count here. in amdgpu_fence_count_emitted()
411 * amdgpu_fence_last_unsignaled_time_us - the time fence emitted until now
412 * @ring: ring the fence is associated with
414 * Find the earliest fence unsignaled until now, calculate the time delta
415 * between the time fence emitted and now.
420 struct dma_fence *fence; in amdgpu_fence_last_unsignaled_time_us() local
430 fence = drv->fences[last_seq]; in amdgpu_fence_last_unsignaled_time_us()
431 if (!fence) in amdgpu_fence_last_unsignaled_time_us()
435 to_amdgpu_fence(fence)->start_timestamp); in amdgpu_fence_last_unsignaled_time_us()
439 * amdgpu_fence_update_start_timestamp - update the timestamp of the fence
440 * @ring: ring the fence is associated with
441 * @seq: the fence seq number to update.
444 * The function called at the time the fence and related ib is about to
446 * with amdgpu_fence_process to modify the same fence.
451 struct dma_fence *fence; in amdgpu_fence_update_start_timestamp() local
454 fence = drv->fences[seq]; in amdgpu_fence_update_start_timestamp()
455 if (!fence) in amdgpu_fence_update_start_timestamp()
458 to_amdgpu_fence(fence)->start_timestamp = timestamp; in amdgpu_fence_update_start_timestamp()
462 * amdgpu_fence_driver_start_ring - make the fence driver
465 * @ring: ring to start the fence driver on
469 * Make the fence driver ready for processing (all asics).
471 * start the fence driver on the rings it has.
485 /* put fence directly behind firmware */ in amdgpu_fence_driver_start_ring()
496 DRM_DEV_DEBUG(adev->dev, "fence driver on ring %s use gpu addr 0x%016llx\n", in amdgpu_fence_driver_start_ring()
502 * amdgpu_fence_driver_init_ring - init the fence driver
505 * @ring: ring to init the fence driver on
507 * Init the fence driver for the requested ring (all asics).
540 * amdgpu_fence_driver_sw_init - init the fence driver
545 * Init the fence driver for all possible rings (all asics).
547 * start the fence driver on the rings it has using
558 * fence driver interrupts need to be restored.
593 * amdgpu_fence_driver_hw_fini - tear down the fence driver
598 * Tear down the fence driver for all possible rings (all asics).
675 * amdgpu_fence_driver_hw_init - enable the fence driver
680 * Enable the fence driver for all possible rings (all asics).
682 * start the fence driver on the rings it has using
707 * @ring: fence of the ring to be cleared
748 struct dma_fence *fence; in amdgpu_fence_driver_set_error() local
750 fence = rcu_dereference_protected(drv->fences[i], in amdgpu_fence_driver_set_error()
752 if (fence && !dma_fence_is_signaled_locked(fence)) in amdgpu_fence_driver_set_error()
753 dma_fence_set_error(fence, error); in amdgpu_fence_driver_set_error()
759 * amdgpu_fence_driver_force_completion - force signal latest fence of ring
761 * @ring: fence of the ring to signal
772 * Common fence implementation
775 static const char *amdgpu_fence_get_driver_name(struct dma_fence *fence) in amdgpu_fence_get_driver_name() argument
793 * amdgpu_fence_enable_signaling - enable signalling on fence
794 * @f: fence
797 * to fence_queue that checks if this fence is signaled, and if so it
798 * signals the fence and removes itself.
809 * amdgpu_job_fence_enable_signaling - enable signalling on job fence
810 * @f: fence
813 * only handles the job embedded fence.
826 * amdgpu_fence_free - free up the fence memory
830 * Free up the fence memory after the RCU grace period.
836 /* free fence_slab if it's separated fence*/ in amdgpu_fence_free()
841 * amdgpu_job_fence_free - free up the job with embedded fence
845 * Free up the job with embedded fence after the RCU grace period.
851 /* free job if fence has a parent job */ in amdgpu_job_fence_free()
856 * amdgpu_fence_release - callback that fence can be freed
858 * @f: fence
861 * It just RCU schedules freeing up the fence.
869 * amdgpu_job_fence_release - callback that job embedded fence can be freed
871 * @f: fence
874 * only handles the job embedded fence.
896 * Fence debugfs
913 seq_printf(m, "Last signaled fence 0x%08x\n", in amdgpu_debugfs_fence_info_show()
920 seq_printf(m, "Last signaled trailing fence 0x%08x\n", in amdgpu_debugfs_fence_info_show()
945 * Manually trigger a gpu reset at the next fence wait.