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()
202 to_amdgpu_fence(fence)->start_timestamp = ktime_get(); in amdgpu_fence_emit()
205 * emitting the fence would mess up the hardware ring buffer. in amdgpu_fence_emit()
207 rcu_assign_pointer(*ptr, dma_fence_get(fence)); in amdgpu_fence_emit()
209 *f = fence; in amdgpu_fence_emit()
215 * amdgpu_fence_emit_polling - emit a fence on the requeste ring
217 * @ring: ring the fence is associated with
221 * Emits a fence command on the requested ring (all asics).
222 * Used For polling fence.
263 * amdgpu_fence_process - check for fence activity
267 * Checks the current fence value and calculates the last
268 * signalled fence value. Wakes the fence queue if the
271 * Returns true if fence was processed
296 struct dma_fence *fence, **ptr; in amdgpu_fence_process() local
302 /* There is always exactly one thread signaling this fence slot */ in amdgpu_fence_process()
303 fence = rcu_dereference_protected(*ptr, 1); in amdgpu_fence_process()
306 if (!fence) in amdgpu_fence_process()
309 dma_fence_signal(fence); in amdgpu_fence_process()
310 dma_fence_put(fence); in amdgpu_fence_process()
323 * Checks for fence activity.
331 DRM_WARN("Fence fallback timer expired on ring %s\n", ring->name); in amdgpu_fence_fallback()
337 * @ring: ring index the fence is associated with
345 struct dma_fence *fence, **ptr; in amdgpu_fence_wait_empty() local
353 fence = rcu_dereference(*ptr); in amdgpu_fence_wait_empty()
354 if (!fence || !dma_fence_get_rcu(fence)) { in amdgpu_fence_wait_empty()
360 r = dma_fence_wait(fence, false); in amdgpu_fence_wait_empty()
361 dma_fence_put(fence); in amdgpu_fence_wait_empty()
368 * @ring: ring index the fence is associated with
389 * @ring: ring the fence is associated with
400 * but it's ok to report slightly wrong fence count here. in amdgpu_fence_count_emitted()
409 * amdgpu_fence_last_unsignaled_time_us - the time fence emitted until now
410 * @ring: ring the fence is associated with
412 * Find the earliest fence unsignaled until now, calculate the time delta
413 * between the time fence emitted and now.
418 struct dma_fence *fence; in amdgpu_fence_last_unsignaled_time_us() local
428 fence = drv->fences[last_seq]; in amdgpu_fence_last_unsignaled_time_us()
429 if (!fence) in amdgpu_fence_last_unsignaled_time_us()
433 to_amdgpu_fence(fence)->start_timestamp); in amdgpu_fence_last_unsignaled_time_us()
437 * amdgpu_fence_update_start_timestamp - update the timestamp of the fence
438 * @ring: ring the fence is associated with
439 * @seq: the fence seq number to update.
442 * The function called at the time the fence and related ib is about to
444 * with amdgpu_fence_process to modify the same fence.
449 struct dma_fence *fence; in amdgpu_fence_update_start_timestamp() local
452 fence = drv->fences[seq]; in amdgpu_fence_update_start_timestamp()
453 if (!fence) in amdgpu_fence_update_start_timestamp()
456 to_amdgpu_fence(fence)->start_timestamp = timestamp; in amdgpu_fence_update_start_timestamp()
460 * amdgpu_fence_driver_start_ring - make the fence driver
463 * @ring: ring to start the fence driver on
467 * Make the fence driver ready for processing (all asics).
469 * start the fence driver on the rings it has.
483 /* put fence directly behind firmware */ in amdgpu_fence_driver_start_ring()
494 DRM_DEV_DEBUG(adev->dev, "fence driver on ring %s use gpu addr 0x%016llx\n", in amdgpu_fence_driver_start_ring()
500 * amdgpu_fence_driver_init_ring - init the fence driver
503 * @ring: ring to init the fence driver on
505 * Init the fence driver for the requested ring (all asics).
538 * amdgpu_fence_driver_sw_init - init the fence driver
543 * Init the fence driver for all possible rings (all asics).
545 * start the fence driver on the rings it has using
556 * fence driver interrupts need to be restored.
590 * amdgpu_fence_driver_hw_fini - tear down the fence driver
595 * Tear down the fence driver for all possible rings (all asics).
672 * amdgpu_fence_driver_hw_init - enable the fence driver
677 * Enable the fence driver for all possible rings (all asics).
679 * start the fence driver on the rings it has using
704 * @ring: fence of the ring to be cleared
745 struct dma_fence *fence; in amdgpu_fence_driver_set_error() local
747 fence = rcu_dereference_protected(drv->fences[i], in amdgpu_fence_driver_set_error()
749 if (fence && !dma_fence_is_signaled_locked(fence)) in amdgpu_fence_driver_set_error()
750 dma_fence_set_error(fence, error); in amdgpu_fence_driver_set_error()
756 * amdgpu_fence_driver_force_completion - force signal latest fence of ring
758 * @ring: fence of the ring to signal
769 * Common fence implementation
772 static const char *amdgpu_fence_get_driver_name(struct dma_fence *fence) in amdgpu_fence_get_driver_name() argument
790 * amdgpu_fence_enable_signaling - enable signalling on fence
791 * @f: fence
794 * to fence_queue that checks if this fence is signaled, and if so it
795 * signals the fence and removes itself.
806 * amdgpu_job_fence_enable_signaling - enable signalling on job fence
807 * @f: fence
810 * only handles the job embedded fence.
823 * amdgpu_fence_free - free up the fence memory
827 * Free up the fence memory after the RCU grace period.
833 /* free fence_slab if it's separated fence*/ in amdgpu_fence_free()
838 * amdgpu_job_fence_free - free up the job with embedded fence
842 * Free up the job with embedded fence after the RCU grace period.
848 /* free job if fence has a parent job */ in amdgpu_job_fence_free()
853 * amdgpu_fence_release - callback that fence can be freed
855 * @f: fence
858 * It just RCU schedules freeing up the fence.
866 * amdgpu_job_fence_release - callback that job embedded fence can be freed
868 * @f: fence
871 * only handles the job embedded fence.
893 * Fence debugfs
910 seq_printf(m, "Last signaled fence 0x%08x\n", in amdgpu_debugfs_fence_info_show()
917 seq_printf(m, "Last signaled trailing fence 0x%08x\n", in amdgpu_debugfs_fence_info_show()
942 * Manually trigger a gpu reset at the next fence wait.