| /linux/drivers/gpu/drm/i915/ |
| H A D | i915_sw_fence.c | 8 #include <linux/dma-fence.h> 49 static inline void debug_fence_init(struct i915_sw_fence *fence) in debug_fence_init() argument 51 debug_object_init(fence, &i915_sw_fence_debug_descr); in debug_fence_init() 54 static inline __maybe_unused void debug_fence_init_onstack(struct i915_sw_fence *fence) in debug_fence_init_onstack() argument 56 debug_object_init_on_stack(fence, &i915_sw_fence_debug_descr); in debug_fence_init_onstack() 59 static inline void debug_fence_activate(struct i915_sw_fence *fence) in debug_fence_activate() argument 61 debug_object_activate(fence, &i915_sw_fence_debug_descr); in debug_fence_activate() 64 static inline void debug_fence_set_state(struct i915_sw_fence *fence, in debug_fence_set_state() argument 67 debug_object_active_state(fence, &i915_sw_fence_debug_descr, old, new); in debug_fence_set_state() 70 static inline void debug_fence_deactivate(struct i915_sw_fence *fence) in debug_fence_deactivate() argument [all …]
|
| H A D | i915_sw_fence.h | 12 #include <linux/dma-fence.h> 42 void __i915_sw_fence_init(struct i915_sw_fence *fence, 47 #define i915_sw_fence_init(fence, fn) \ argument 52 __i915_sw_fence_init((fence), (fn), #fence, &__key); \ 55 #define i915_sw_fence_init(fence, fn) \ argument 58 __i915_sw_fence_init((fence), (fn), NULL, NULL); \ 62 void i915_sw_fence_reinit(struct i915_sw_fence *fence); 65 void i915_sw_fence_fini(struct i915_sw_fence *fence); 67 static inline void i915_sw_fence_fini(struct i915_sw_fence *fence) {} in i915_sw_fence_fini() argument 70 void i915_sw_fence_commit(struct i915_sw_fence *fence); [all …]
|
| H A D | i915_deps.c | 6 #include <linux/dma-fence.h> 18 * the migration fence with the unbind fences if these are coalesced 33 /* Min number of fence pointers in the array when an allocation occurs. */ 61 * This function drops all fence references taken, conditionally frees and 75 static int i915_deps_grow(struct i915_deps *deps, struct dma_fence *fence, in i915_deps_grow() argument 96 deps->fences[deps->num_deps++] = dma_fence_get(fence); in i915_deps_grow() 100 if (ctx->no_wait_gpu && !dma_fence_is_signaled(fence)) { in i915_deps_grow() 105 ret = dma_fence_wait(fence, ctx->interruptible); in i915_deps_grow() 109 ret = fence->error; in i915_deps_grow() 127 * encounters an error during the wait or a fence error, the wait for [all …]
|
| H A D | i915_active.h | 21 * "fence registers" but pipeline synchronisation objects ala GL_ARB_sync. 30 * In order to use a fence, the object must track the fence it needs to 34 * complete, or waiting for the last GPU user of a "fence register". The 38 * track the most recent fence request, typically this is done as part of 48 void i915_active_noop(struct dma_fence *fence, struct dma_fence_cb *cb); 53 * @fence: initial fence to track, can be NULL 58 * an activity tracker, that is for tracking the last known active fence 59 * associated with it. When the last fence becomes idle, when it is retired 64 void *fence, in __i915_active_fence_init() argument 67 RCU_INIT_POINTER(active->fence, fence); in __i915_active_fence_init() [all …]
|
| /linux/drivers/dma-buf/ |
| H A D | dma-fence.c | 3 * Fence mechanism for dma-buf and to allow for asynchronous dma access 16 #include <linux/dma-fence.h> 30 * fence context counter: each execution context should have its own 31 * fence context, this allows checking if fences belong to the same 44 * A fence is initialized using dma_fence_init() and completed using 59 * fence to be updated. 68 * DOC: fence cross-driver contract 94 * This means any code required for fence completion cannot acquire a 99 * callbacks. This means any code required for fence completion cannot 104 * for fence completion cannot allocate memory with GFP_NOFS or GFP_NOIO. [all …]
|
| H A D | sync_file.c | 8 #include <linux/dma-fence-unwrap.h> 58 * @fence: fence to add to the sync_fence 60 * Creates a sync_file containg @fence. This function acquires and additional 61 * reference of @fence for the newly-created &sync_file, if it succeeds. The 65 struct sync_file *sync_file_create(struct dma_fence *fence) in sync_file_create() argument 73 sync_file->fence = dma_fence_get(fence); in sync_file_create() 97 * sync_file_get_fence - get the fence related to the sync_file fd 98 * @fd: sync_file fd to get the fence from 100 * Ensures @fd references a valid sync_file and returns a fence that 101 * represents all fence in the sync_file. On error NULL is returned. [all …]
|
| H A D | st-dma-fence-chain.c | 8 #include <linux/dma-fence.h> 9 #include <linux/dma-fence-chain.h> 62 struct dma_fence *fence, in mock_chain() argument 71 dma_fence_chain_init(f, dma_fence_get(prev), dma_fence_get(fence), in mock_chain() 182 struct dma_fence *fence; in find_seqno() local 190 fence = dma_fence_get(fc.tail); in find_seqno() 191 err = dma_fence_chain_find_seqno(&fence, 0); in find_seqno() 192 dma_fence_put(fence); in find_seqno() 199 fence = dma_fence_get(fc.tail); in find_seqno() 200 err = dma_fence_chain_find_seqno(&fence, i + 1); in find_seqno() [all …]
|
| H A D | st-dma-fence-unwrap.c | 7 #include <linux/dma-fence.h> 8 #include <linux/dma-fence-array.h> 9 #include <linux/dma-fence-chain.h> 10 #include <linux/dma-fence-unwrap.h> 85 struct dma_fence *fence) in mock_chain() argument 92 dma_fence_put(fence); in mock_chain() 96 dma_fence_chain_init(f, prev, fence, 1); in mock_chain() 125 struct dma_fence *fence, *f1, *f2, *array; in unwrap_array() local 147 dma_fence_unwrap_for_each(fence, &iter, array) { in unwrap_array() 148 if (fence == f1) { in unwrap_array() [all …]
|
| /linux/drivers/gpu/drm/radeon/ |
| H A D | radeon_fence.c | 50 * for GPU/CPU synchronization. When the fence is written, 51 * it is expected that all buffers associated with that fence 59 * radeon_fence_write - write a fence value 63 * @ring: ring index the fence is associated with 65 * Writes a fence value to memory or a scratch register (all asics). 80 * radeon_fence_read - read a fence value 83 * @ring: ring index the fence is associated with 85 * Reads a fence value from memory or a scratch register (all asics). 86 * Returns the value of the fence read from memory or register. 124 * radeon_fence_emit - emit a fence on the requested ring [all …]
|
| H A D | radeon_sync.c | 55 * radeon_sync_fence - use the semaphore to sync to a fence 57 * @sync: sync object to add fence to 58 * @fence: fence to sync to 60 * Sync to the fence using the semaphore objects 63 struct radeon_fence *fence) in radeon_sync_fence() argument 67 if (!fence) in radeon_sync_fence() 70 other = sync->sync_to[fence->ring]; in radeon_sync_fence() 71 sync->sync_to[fence->ring] = radeon_fence_later(fence, other); in radeon_sync_fence() 73 if (fence->is_vm_update) { in radeon_sync_fence() 75 sync->last_vm_update = radeon_fence_later(fence, other); in radeon_sync_fence() [all …]
|
| /linux/drivers/gpu/drm/vgem/ |
| H A D | vgem_fence.c | 38 static const char *vgem_fence_get_driver_name(struct dma_fence *fence) in vgem_fence_get_driver_name() argument 43 static const char *vgem_fence_get_timeline_name(struct dma_fence *fence) in vgem_fence_get_timeline_name() argument 50 struct vgem_fence *fence = container_of(base, typeof(*fence), base); in vgem_fence_release() local 52 timer_delete_sync(&fence->timer); in vgem_fence_release() 53 dma_fence_free(&fence->base); in vgem_fence_release() 64 struct vgem_fence *fence = timer_container_of(fence, t, timer); in vgem_fence_timeout() local 66 dma_fence_signal(&fence->base); in vgem_fence_timeout() 72 struct vgem_fence *fence; in vgem_fence_create() local 74 fence = kzalloc_obj(*fence); in vgem_fence_create() 75 if (!fence) in vgem_fence_create() [all …]
|
| /linux/drivers/gpu/drm/amd/amdgpu/ |
| H A D | amdgpu_amdkfd_fence.c | 23 #include <linux/dma-fence.h> 36 /* Eviction Fence 37 * Fence helper functions to deal with KFD memory eviction. 41 * All the BOs in a process share an eviction fence. When process X wants 59 * user queues and signal fence. The work item will also start another delayed 68 struct amdgpu_amdkfd_fence *fence; in amdgpu_amdkfd_fence_create() local 70 fence = kzalloc_obj(*fence); in amdgpu_amdkfd_fence_create() 71 if (fence == NULL) in amdgpu_amdkfd_fence_create() 76 fence->mm = mm; in amdgpu_amdkfd_fence_create() 77 get_task_comm(fence->timeline_name, current); in amdgpu_amdkfd_fence_create() [all …]
|
| H A D | amdgpu_userq_fence.c | 27 #include <linux/dma-fence-unwrap.h> 141 struct dma_fence *fence; in amdgpu_userq_fence_driver_process() local 161 fence = &userq_fence->base; in amdgpu_userq_fence_driver_process() 163 dma_fence_signal(fence); in amdgpu_userq_fence_driver_process() 168 dma_fence_put(fence); in amdgpu_userq_fence_driver_process() 179 struct amdgpu_userq_fence *fence, *tmp; in amdgpu_userq_fence_driver_destroy() local 184 list_for_each_entry_safe(fence, tmp, &fence_drv->fences, link) { in amdgpu_userq_fence_driver_destroy() 185 f = &fence->base; in amdgpu_userq_fence_driver_destroy() 192 list_del(&fence->link); in amdgpu_userq_fence_driver_destroy() 223 struct dma_fence *fence; in amdgpu_userq_fence_create() local [all …]
|
| /linux/drivers/gpu/drm/ |
| H A D | drm_syncobj.c | 3 * Parts ported from amdgpu (fence wait code). 41 * - Import and export a syncobj's underlying fence to/from a sync file 42 * - Reset a syncobj (set its fence to NULL) 43 * - Signal a syncobj (set a trivially signaled fence) 44 * - Wait for a syncobj's fence to appear and be signaled 57 * to an already signaled fence depending on whether the 63 * the syncobj, the syncobj's fence is replaced with a fence which will be 67 * struct &dma_fence_chain pointing to the DRM driver's fence and also 68 * pointing to the previous fence that was in the syncobj. The new struct 69 * &dma_fence_chain fence replace the syncobj's fence and will be signaled by [all …]
|
| /linux/drivers/gpu/drm/xe/ |
| H A D | xe_range_fence.c | 6 #include <linux/dma-fence.h> 21 xe_range_fence_signal_notify(struct dma_fence *fence, struct dma_fence_cb *cb) in xe_range_fence_signal_notify() argument 36 dma_fence_put(rfence->fence); in __xe_range_fence_tree_cleanup() 44 * xe_range_fence_insert() - range fence insert 45 * @tree: range fence tree to insert intoi 46 * @rfence: range fence 47 * @ops: range fence ops 48 * @start: start address of range fence 49 * @last: last address of range fence 50 * @fence: dma fence which signals range fence can be removed + freed [all …]
|
| H A D | xe_sync.c | 8 #include <linux/dma-fence-array.h> 99 static void kick_ufence(struct xe_user_fence *ufence, struct dma_fence *fence) in kick_ufence() argument 103 dma_fence_put(fence); in kick_ufence() 106 static void user_fence_cb(struct dma_fence *fence, struct dma_fence_cb *cb) in user_fence_cb() argument 110 kick_ufence(ufence, fence); in user_fence_cb() 148 sync->fence = drm_syncobj_fence_get(sync->syncobj); in xe_sync_entry_parse() 149 if (XE_IOCTL_DBG(xe, !sync->fence)) { in xe_sync_entry_parse() 177 sync->fence = drm_syncobj_fence_get(sync->syncobj); in xe_sync_entry_parse() 178 if (XE_IOCTL_DBG(xe, !sync->fence)) { in xe_sync_entry_parse() 183 err = dma_fence_chain_find_seqno(&sync->fence, in xe_sync_entry_parse() [all …]
|
| H A D | xe_preempt_fence.c | 28 xe_gt_dbg(q->gt, "PREEMPT FENCE RETRY guc_id=%d", in preempt_fence_work_func() 44 * Opt for keep everything in the fence critical section. This looks really strange since we in preempt_fence_work_func() 45 * have just signalled the fence, however the preempt fences are all signalled via single in preempt_fence_work_func() 48 * ever signalling. Therefore try to keep everything here in the callback in the fence in preempt_fence_work_func() 59 preempt_fence_get_driver_name(struct dma_fence *fence) in preempt_fence_get_driver_name() argument 65 preempt_fence_get_timeline_name(struct dma_fence *fence) in preempt_fence_get_timeline_name() argument 70 static bool preempt_fence_enable_signaling(struct dma_fence *fence) in preempt_fence_enable_signaling() argument 73 container_of(fence, typeof(*pfence), base); in preempt_fence_enable_signaling() 88 * xe_preempt_fence_alloc() - Allocate a preempt fence with minimal 91 * Allocate a preempt fence, and initialize its list head. [all …]
|
| H A D | xe_hw_fence_types.h | 9 #include <linux/dma-fence.h> 19 * struct xe_hw_fence_irq - hardware fence IRQ handler 31 /** @enabled: fence signaling enabled */ 38 * struct xe_hw_fence_ctx - hardware fence context 40 * The context for a hardware fence. 1 to 1 relationship with xe_engine. Points 44 /** @gt: GT structure of hardware fence context */ 46 /** @irq: fence irq handler */ 48 /** @dma_fence_ctx: dma fence context for hardware fence */ 50 /** @next_seqno: next seqno for hardware fence */ 52 /** @name: name of hardware fence context */ [all …]
|
| /linux/drivers/gpu/drm/i915/selftests/ |
| H A D | lib_sw_fence.c | 27 /* Small library of different fence types useful for writing tests */ 30 nop_fence_notify(struct i915_sw_fence *fence, enum i915_sw_fence_notify state) in nop_fence_notify() argument 35 void __onstack_fence_init(struct i915_sw_fence *fence, in __onstack_fence_init() argument 39 debug_fence_init_onstack(fence); in __onstack_fence_init() 41 __init_waitqueue_head(&fence->wait, name, key); in __onstack_fence_init() 42 atomic_set(&fence->pending, 1); in __onstack_fence_init() 43 fence->error = 0; in __onstack_fence_init() 44 fence->fn = nop_fence_notify; in __onstack_fence_init() 47 void onstack_fence_fini(struct i915_sw_fence *fence) in onstack_fence_fini() argument 49 if (!fence->fn) in onstack_fence_fini() [all …]
|
| /linux/drivers/gpu/host1x/ |
| H A D | intr.c | 11 #include "fence.h" 15 struct host1x_syncpt_fence *fence) in host1x_intr_add_fence_to_list() argument 20 if ((s32)(fence_in_list->threshold - fence->threshold) <= 0) { in host1x_intr_add_fence_to_list() 21 /* Fence in list is before us, we can insert here */ in host1x_intr_add_fence_to_list() 22 list_add(&fence->list, &fence_in_list->list); in host1x_intr_add_fence_to_list() 28 list_add(&fence->list, &list->list); in host1x_intr_add_fence_to_list() 33 struct host1x_syncpt_fence *fence; in host1x_intr_update_hw_state() local 36 fence = list_first_entry(&sp->fences.list, struct host1x_syncpt_fence, list); in host1x_intr_update_hw_state() 38 host1x_hw_intr_set_syncpt_threshold(host, sp->id, fence->threshold); in host1x_intr_update_hw_state() 45 void host1x_intr_add_fence_locked(struct host1x *host, struct host1x_syncpt_fence *fence) in host1x_intr_add_fence_locked() argument [all …]
|
| /linux/tools/testing/selftests/sync/ |
| H A D | sync_stress_consumer.c | 40 static int busy_wait_on_fence(int fence) in busy_wait_on_fence() argument 45 error = sync_fence_count_with_status(fence, FENCE_STATUS_ERROR); in busy_wait_on_fence() 46 ASSERT(error == 0, "Error occurred on fence\n"); in busy_wait_on_fence() 47 active = sync_fence_count_with_status(fence, in busy_wait_on_fence() 66 int fence, valid, i; in mpsc_producer_thread() local 72 fence = sw_sync_fence_create(consumer_timeline, "fence", i); in mpsc_producer_thread() 73 valid = sw_sync_fence_is_valid(fence); in mpsc_producer_thread() 74 ASSERT(valid, "Failure creating fence\n"); in mpsc_producer_thread() 78 * means of waiting on the fence in mpsc_producer_thread() 82 ASSERT(sync_wait(fence, -1) > 0, in mpsc_producer_thread() [all …]
|
| H A D | sync_stress_merge.c | 43 int fence, tmpfence, merged, valid; in test_merge_stress_random_merge() local 51 fence = sw_sync_fence_create(timelines[0], "fence", 0); in test_merge_stress_random_merge() 52 valid = sw_sync_fence_is_valid(fence); in test_merge_stress_random_merge() 53 ASSERT(valid, "Failure creating fence\n"); in test_merge_stress_random_merge() 75 tmpfence = sw_sync_fence_create(timeline, "fence", sync_point); in test_merge_stress_random_merge() 76 merged = sync_merge("merge", tmpfence, fence); in test_merge_stress_random_merge() 78 sw_sync_fence_destroy(fence); in test_merge_stress_random_merge() 79 fence = merged; in test_merge_stress_random_merge() 82 ASSERT(valid, "Failure creating fence i\n"); in test_merge_stress_random_merge() 90 /* Confirm our map matches the fence. */ in test_merge_stress_random_merge() [all …]
|
| /linux/drivers/gpu/drm/msm/ |
| H A D | msm_fence.c | 7 #include <linux/dma-fence.h> 34 /* If deadline fence has already passed, nothing to do: */ in deadline_work() 61 * Start out close to the 32b fence rollover point, so we can in msm_fence_context_alloc() 62 * catch bugs with fence comparisons. in msm_fence_context_alloc() 82 bool msm_fence_completed(struct msm_fence_context *fctx, uint32_t fence) in msm_fence_completed() argument 88 return (int32_t)(fctx->completed_fence - fence) >= 0 || in msm_fence_completed() 89 (int32_t)(*fctx->fenceptr - fence) >= 0; in msm_fence_completed() 93 void msm_update_fence(struct msm_fence_context *fctx, uint32_t fence) in msm_update_fence() argument 98 if (fence_after(fence, fctx->completed_fence)) in msm_update_fence() 99 fctx->completed_fence = fence; in msm_update_fence() [all …]
|
| H A D | msm_fence.h | 13 * struct msm_fence_context - fence context for gpu 15 * Each ringbuffer has a single fence context, with the GPU writing an 16 * incrementing fence seqno at the end of each submit 21 /** @name: human readable name for fence timeline */ 29 * Last assigned fence, incremented each time a fence is created 30 * on this fence context. If last_fence == completed_fence, 36 * The last completed fence, updated from the CPU after interrupt 42 * The address that the GPU directly writes with completed fence 44 * this to see if a fence has already signaled but the CPU hasn't 50 * @spinlock: fence context spinlock [all …]
|
| /linux/drivers/gpu/drm/virtio/ |
| H A D | virtgpu_fence.c | 45 /* leaked fence outside driver before completing in virtio_gpu_fence_signaled() 64 struct virtio_gpu_fence *fence = kzalloc_obj(struct virtio_gpu_fence); in virtio_gpu_fence_alloc() local 66 if (!fence) in virtio_gpu_fence_alloc() 67 return fence; in virtio_gpu_fence_alloc() 69 fence->drv = drv; in virtio_gpu_fence_alloc() 70 fence->ring_idx = ring_idx; in virtio_gpu_fence_alloc() 71 fence->emit_fence_info = !(base_fence_ctx == drv->context); in virtio_gpu_fence_alloc() 73 /* This only partially initializes the fence because the seqno is in virtio_gpu_fence_alloc() 74 * unknown yet. The fence must not be used outside of the driver in virtio_gpu_fence_alloc() 78 dma_fence_init(&fence->f, &virtio_gpu_fence_ops, &drv->lock, in virtio_gpu_fence_alloc() [all …]
|