drivers/gpu/drm/radeon/radeon_fence.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/radeon/radeon_fence.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/radeon/radeon_fence.c- Extension
.c- Size
- 30019 bytes
- Lines
- 1053
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/atomic.hlinux/debugfs.hlinux/firmware.hlinux/kref.hlinux/sched/signal.hlinux/seq_file.hlinux/slab.hlinux/wait.hdrm/drm_device.hdrm/drm_file.hradeon.hradeon_reg.hradeon_trace.h
Detected Declarations
struct radeon_wait_cbfunction filesfunction registerfunction radeon_fence_schedule_checkfunction ringfunction radeon_fence_check_signaledfunction radeon_fence_activityfunction radeon_fence_check_lockupfunction increasedfunction numberfunction radeon_fence_is_signaledfunction radeon_fence_enable_signalingfunction signaledfunction numberfunction numberfunction signalfunction signalfunction signalfunction signalfunction fencefunction fencefunction ringfunction radeon_fence_need_syncfunction ringfunction processingfunction ringfunction ringsfunction ringsfunction radeon_fence_driver_force_completionfunction radeon_debugfs_fence_info_showfunction radeon_debugfs_gpu_resetfunction radeon_debugfs_fence_initfunction radeon_test_signaledfunction radeon_fence_wait_cbfunction radeon_fence_default_wait
Annotated Snippet
struct radeon_wait_cb {
struct dma_fence_cb base;
struct task_struct *task;
};
static void
radeon_fence_wait_cb(struct dma_fence *fence, struct dma_fence_cb *cb)
{
struct radeon_wait_cb *wait =
container_of(cb, struct radeon_wait_cb, base);
wake_up_process(wait->task);
}
static signed long radeon_fence_default_wait(struct dma_fence *f, bool intr,
signed long t)
{
struct radeon_fence *fence = to_radeon_fence(f);
struct radeon_device *rdev = fence->rdev;
struct radeon_wait_cb cb;
cb.task = current;
if (dma_fence_add_callback(f, &cb.base, radeon_fence_wait_cb))
return t;
while (t > 0) {
if (intr)
set_current_state(TASK_INTERRUPTIBLE);
else
set_current_state(TASK_UNINTERRUPTIBLE);
/*
* radeon_test_signaled must be called after
* set_current_state to prevent a race with wake_up_process
*/
if (radeon_test_signaled(fence))
break;
if (rdev->needs_reset) {
t = -EDEADLK;
break;
}
t = schedule_timeout(t);
if (t > 0 && intr && signal_pending(current))
t = -ERESTARTSYS;
}
__set_current_state(TASK_RUNNING);
dma_fence_remove_callback(f, &cb.base);
return t;
}
const struct dma_fence_ops radeon_fence_ops = {
.get_driver_name = radeon_fence_get_driver_name,
.get_timeline_name = radeon_fence_get_timeline_name,
.enable_signaling = radeon_fence_enable_signaling,
.signaled = radeon_fence_is_signaled,
.wait = radeon_fence_default_wait,
.release = NULL,
};
Annotation
- Immediate include surface: `linux/atomic.h`, `linux/debugfs.h`, `linux/firmware.h`, `linux/kref.h`, `linux/sched/signal.h`, `linux/seq_file.h`, `linux/slab.h`, `linux/wait.h`.
- Detected declarations: `struct radeon_wait_cb`, `function files`, `function register`, `function radeon_fence_schedule_check`, `function ring`, `function radeon_fence_check_signaled`, `function radeon_fence_activity`, `function radeon_fence_check_lockup`, `function increased`, `function number`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.