drivers/gpu/drm/v3d/v3d_sched.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/v3d/v3d_sched.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/v3d/v3d_sched.c- Extension
.c- Size
- 23776 bytes
- Lines
- 900
- 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/sched/clock.hlinux/kthread.hdrm/drm_print.hdrm/drm_syncobj.hv3d_drv.hv3d_regs.hv3d_trace.h
Detected Declarations
function to_v3d_jobfunction to_bin_jobfunction to_render_jobfunction to_tfu_jobfunction to_csd_jobfunction to_cpu_jobfunction v3d_stats_releasefunction v3d_sched_job_freefunction v3d_timestamp_query_info_freefunction v3d_performance_query_info_freefunction v3d_switch_perfmonfunction v3d_stats_startfunction v3d_job_start_statsfunction v3d_stats_updatefunction v3d_job_update_statsfunction v3d_tfu_job_runfunction v3d_csd_job_runfunction v3d_rewrite_csd_job_wg_counts_from_indirectfunction v3d_timestamp_queryfunction v3d_reset_timestamp_queriesfunction write_to_buffer_32function write_to_buffer_64function write_to_bufferfunction v3d_copy_query_resultsfunction v3d_reset_performance_queriesfunction v3d_write_performance_query_resultfunction v3d_copy_performance_queryfunction v3d_cpu_job_runfunction v3d_cache_clean_job_runfunction v3d_gpu_reset_for_timeoutfunction v3d_cl_job_timedoutfunction v3d_bin_job_timedoutfunction v3d_render_job_timedoutfunction v3d_tfu_job_timedoutfunction v3d_csd_job_timedoutfunction v3d_queue_sched_initfunction v3d_sched_initfunction v3d_sched_fini
Annotated Snippet
if (indirect_csd->wg_uniform_offsets[i] != 0xffffffff) {
u32 uniform_idx = indirect_csd->wg_uniform_offsets[i];
((uint32_t *)indirect->vaddr)[uniform_idx] = wg_counts[i];
}
}
unmap_bo:
v3d_put_bo_vaddr(indirect);
v3d_put_bo_vaddr(bo);
}
static void
v3d_timestamp_query(struct v3d_cpu_job *job)
{
struct v3d_timestamp_query_info *timestamp_query = &job->timestamp_query;
struct v3d_bo *bo = to_v3d_bo(job->base.bo[0]);
u8 *value_addr;
v3d_get_bo_vaddr(bo);
for (int i = 0; i < timestamp_query->count; i++) {
value_addr = ((u8 *)bo->vaddr) + timestamp_query->queries[i].offset;
*((u64 *)value_addr) = i == 0 ? ktime_get_ns() : 0ull;
drm_syncobj_replace_fence(timestamp_query->queries[i].syncobj,
job->base.done_fence);
}
v3d_put_bo_vaddr(bo);
}
static void
v3d_reset_timestamp_queries(struct v3d_cpu_job *job)
{
struct v3d_timestamp_query_info *timestamp_query = &job->timestamp_query;
struct v3d_timestamp_query *queries = timestamp_query->queries;
struct v3d_bo *bo = to_v3d_bo(job->base.bo[0]);
u8 *value_addr;
v3d_get_bo_vaddr(bo);
for (int i = 0; i < timestamp_query->count; i++) {
value_addr = ((u8 *)bo->vaddr) + queries[i].offset;
*((u64 *)value_addr) = 0;
drm_syncobj_replace_fence(queries[i].syncobj, NULL);
}
v3d_put_bo_vaddr(bo);
}
static void write_to_buffer_32(u32 *dst, unsigned int idx, u32 value)
{
dst[idx] = value;
}
static void write_to_buffer_64(u64 *dst, unsigned int idx, u64 value)
{
dst[idx] = value;
}
static void
write_to_buffer(void *dst, unsigned int idx, bool do_64bit, u64 value)
{
if (do_64bit)
write_to_buffer_64(dst, idx, value);
else
write_to_buffer_32(dst, idx, value);
}
static void
v3d_copy_query_results(struct v3d_cpu_job *job)
{
struct v3d_timestamp_query_info *timestamp_query = &job->timestamp_query;
struct v3d_timestamp_query *queries = timestamp_query->queries;
struct v3d_bo *bo = to_v3d_bo(job->base.bo[0]);
struct v3d_bo *timestamp = to_v3d_bo(job->base.bo[1]);
struct v3d_copy_query_results_info *copy = &job->copy;
struct dma_fence *fence;
u8 *query_addr;
bool available, write_result;
u8 *data;
int i;
v3d_get_bo_vaddr(bo);
v3d_get_bo_vaddr(timestamp);
data = ((u8 *)bo->vaddr) + copy->offset;
for (i = 0; i < timestamp_query->count; i++) {
Annotation
- Immediate include surface: `linux/sched/clock.h`, `linux/kthread.h`, `drm/drm_print.h`, `drm/drm_syncobj.h`, `v3d_drv.h`, `v3d_regs.h`, `v3d_trace.h`.
- Detected declarations: `function to_v3d_job`, `function to_bin_job`, `function to_render_job`, `function to_tfu_job`, `function to_csd_job`, `function to_cpu_job`, `function v3d_stats_release`, `function v3d_sched_job_free`, `function v3d_timestamp_query_info_free`, `function v3d_performance_query_info_free`.
- 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.