| /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 …]
|
| H A D | i915_active.c | 45 return IS_ERR(rcu_access_pointer(active->fence)); in is_barrier() 138 GEM_BUG_ON(rcu_access_pointer(ref->excl.fence)); in __active_retire() 206 return (struct dma_fence ** __force)&active->fence; in __active_fence_slot() 210 active_fence_cb(struct dma_fence *fence, struct dma_fence_cb *cb) in active_fence_cb() argument 215 return try_cmpxchg(__active_fence_slot(active), &fence, NULL); in active_fence_cb() 219 node_retire(struct dma_fence *fence, struct dma_fence_cb *cb) in node_retire() argument 221 if (active_fence_cb(fence, cb)) in node_retire() 226 excl_retire(struct dma_fence *fence, struct dma_fence_cb *cb) in excl_retire() argument 228 if (active_fence_cb(fence, cb)) in excl_retire() 434 struct dma_fence *fence = &rq->fence; in i915_active_add_request() local [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 …]
|
| /linux/drivers/gpu/drm/vmwgfx/ |
| H A D | vmwgfx_fence.c | 23 struct vmw_fence_obj fence; member 27 * struct vmw_event_fence_action - fence callback that delivers a DRM event. 33 * current time tv_sec val when the fence signals. 35 * be assigned the current time tv_usec val when the fence signals. 48 fman_from_fence(struct vmw_fence_obj *fence) in fman_from_fence() argument 50 return container_of(fence->base.extern_lock, struct vmw_fence_manager, in fman_from_fence() 56 struct vmw_fence_obj *fence = in vmw_fence_obj_destroy() local 58 struct vmw_fence_manager *fman = fman_from_fence(fence); in vmw_fence_obj_destroy() 60 if (!list_empty(&fence->head)) { in vmw_fence_obj_destroy() 61 /* The fence manager still has an implicit reference to this in vmw_fence_obj_destroy() [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/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/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 …]
|
| H A D | sync_fence.c | 2 * sync fence tests with one timeline 34 int fence, valid, ret; in test_fence_one_timeline_wait() local 40 fence = sw_sync_fence_create(timeline, "allocFence", 5); in test_fence_one_timeline_wait() 41 valid = sw_sync_fence_is_valid(fence); in test_fence_one_timeline_wait() 42 ASSERT(valid, "Failure allocating fence\n"); in test_fence_one_timeline_wait() 44 /* Wait on fence until timeout */ in test_fence_one_timeline_wait() 45 ret = sync_wait(fence, 0); in test_fence_one_timeline_wait() 46 ASSERT(ret == 0, "Failure waiting on fence until timeout\n"); in test_fence_one_timeline_wait() 52 /* Wait on fence until timeout */ in test_fence_one_timeline_wait() 53 ret = sync_wait(fence, 0); in test_fence_one_timeline_wait() [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 …]
|
| /linux/drivers/gpu/drm/xe/ |
| 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 …]
|
| H A D | xe_tlb_inval_job.c | 34 * @fence: dma fence to indicate completion. 1 way relationship - job 35 * can safely reference fence, fence cannot safely reference job. 37 struct dma_fence *fence; member 44 /** @fence_armed: Fence has been armed */ 53 container_of(job->fence, typeof(*ifence), base); in xe_tlb_inval_job_run() 65 return job->fence; in xe_tlb_inval_job_run() 133 job->fence = &ifence->base; in xe_tlb_inval_job_create() 161 * ownership can transfer to the TLB fence when the job is pushed. 179 container_of(job->fence, typeof(*ifence), base); in xe_tlb_inval_job_destroy() 191 dma_fence_put(job->fence); in xe_tlb_inval_job_destroy() [all …]
|
| /linux/tools/memory-model/ |
| H A D | linux-kernel.cat | 53 * smp_mb__after_unlock_lock() fence only affects a single lock handover. 58 * to the CPU that executes the fence. Therefore, all those stores are 59 * also affected by the fence. 65 let strong-fence = mb | gp 67 let nonrw-fence = strong-fence | po-rel | acq-po 68 let fence = nonrw-fence | wmb | rmb 95 let ppo = to-r | to-w | (fence & int) | (po-unlock-lock-po & int) 100 let cumul-fence [all...] |
| /linux/include/drm/ |
| H A D | drm_syncobj.h | 29 #include <linux/dma-fence.h> 30 #include <linux/dma-fence-chain.h> 45 * @fence: 46 * NULL or a pointer to the fence bound to this object. 51 struct dma_fence __rcu *fence; member 53 * @cb_list: List of callbacks to call when the &fence gets replaced. 61 * @lock: Protects &cb_list and &ev_fd_list, and write-locks &fence. 96 * drm_syncobj_fence_get - get a reference to a fence in a sync object 99 * This acquires additional reference to &drm_syncobj.fence contained in @obj, 104 * Either the fence of @obj or NULL if there's none. [all …]
|
| /linux/drivers/gpu/drm/imagination/ |
| H A D | pvr_queue.c | 115 struct pvr_queue_fence *fence = container_of(w, struct pvr_queue_fence, release_work); in pvr_queue_fence_release_work() local 117 pvr_context_put(fence->queue->ctx); in pvr_queue_fence_release_work() 118 dma_fence_free(&fence->base); in pvr_queue_fence_release_work() 123 struct pvr_queue_fence *fence = container_of(f, struct pvr_queue_fence, base); in pvr_queue_fence_release() local 124 struct pvr_device *pvr_dev = fence->queue->ctx->pvr_dev; in pvr_queue_fence_release() 126 queue_work(pvr_dev->sched_wq, &fence->release_work); in pvr_queue_fence_release() 132 struct pvr_queue_fence *fence = container_of(f, struct pvr_queue_fence, base); in pvr_queue_job_fence_get_timeline_name() local 134 switch (fence->queue->type) { in pvr_queue_job_fence_get_timeline_name() 155 struct pvr_queue_fence *fence = container_of(f, struct pvr_queue_fence, base); in pvr_queue_cccb_fence_get_timeline_name() local 157 switch (fence->queue->type) { in pvr_queue_cccb_fence_get_timeline_name() [all …]
|
| /linux/include/uapi/linux/ |
| H A D | sync_file.h | 20 * @name: name of new fence 21 * @fd2: file descriptor of second fence 22 * @fence: returns the fd of the new fence to userspace 26 * Creates a new fence containing copies of the sync_pts in both 27 * the calling fd and sync_merge_data.fd2. Returns the new fence's 28 * fd in sync_merge_data.fence 33 __s32 fence; member 39 * struct sync_fence_info - detailed fence information 42 * @status: status of the fence 0:active 1:signaled <0:error 56 * @name: name of fence [all …]
|
| /linux/drivers/gpu/host1x/ |
| H A D | fence.c | 8 #include <linux/dma-fence.h> 14 #include "fence.h" 44 * The dma_fence framework requires the fence driver to keep a in host1x_syncpt_fence_enable_signaling() 61 * The fence may get signalled at any time after the above call, in host1x_syncpt_fence_enable_signaling() 79 * Already on timeout path, but we removed the fence before in host1x_fence_signal() 113 * Managed to remove fence from queue, so it's safe to drop in do_fence_timeout() 128 struct host1x_syncpt_fence *fence; in host1x_fence_create() local 130 fence = kzalloc_obj(*fence); in host1x_fence_create() 131 if (!fence) in host1x_fence_create() 134 fence->sp = sp; in host1x_fence_create() [all …]
|