drivers/gpu/drm/v3d/v3d_drv.h
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/v3d/v3d_drv.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/v3d/v3d_drv.h- Extension
.h- Size
- 17795 bytes
- Lines
- 663
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hlinux/mutex.hlinux/pm_runtime.hlinux/spinlock_types.hlinux/workqueue.hdrm/drm_encoder.hdrm/drm_gem.hdrm/drm_gem_shmem_helper.hdrm/gpu_scheduler.hv3d_performance_counters.huapi/drm/v3d_drm.h
Detected Declarations
struct clkstruct platform_devicestruct reset_controlstruct v3d_statsstruct v3d_queue_statestruct v3d_perfmonstruct v3d_devstruct v3d_file_privstruct v3d_bostruct v3d_fencestruct v3d_jobstruct v3d_bin_jobstruct v3d_render_jobstruct v3d_tfu_jobstruct v3d_csd_jobstruct v3d_timestamp_querystruct v3d_performance_querystruct v3d_indirect_csd_infostruct v3d_timestamp_query_infostruct v3d_performance_query_infostruct v3d_copy_query_results_infostruct v3d_cpu_jobstruct v3d_submit_outsyncstruct v3d_submit_extenum v3d_genenum v3d_irqenum v3d_cpu_job_typefunction to_v3d_devfunction v3d_has_csdfunction to_v3d_bofunction to_v3d_fencefunction nsecs_to_jiffies_timeoutfunction v3d_pm_runtime_getfunction v3d_pm_runtime_putfunction v3d_stats_put
Annotated Snippet
struct v3d_stats {
struct kref refcount;
u64 start_ns;
u64 enabled_ns;
u64 jobs_completed;
/*
* This seqcount is used to protect the access to the GPU stats
* variables. It must be used as, while we are reading the stats,
* IRQs can happen and the stats can be updated.
*
* However, we use the raw seqcount helpers to interact with this lock
* to avoid false positives from lockdep, which is unable to detect that
* our readers are never from irq or softirq context, and that, for CPU
* job queues, even the write side never is.
*/
seqcount_t lock;
atomic_t reset_counter;
};
struct v3d_queue_state {
struct drm_gpu_scheduler sched;
u64 fence_context;
u64 emit_seqno;
/* Stores the GPU stats for this queue in the global context. */
struct v3d_stats *stats;
/* Currently active job for this queue */
struct v3d_job *active_job;
spinlock_t queue_lock;
};
/* Performance monitor object. The perform lifetime is controlled by userspace
* using perfmon related ioctls. A perfmon can be attached to a submit_cl
* request, and when this is the case, HW perf counters will be activated just
* before the submit_cl is submitted to the GPU and disabled when the job is
* done. This way, only events related to a specific job will be counted.
*/
struct v3d_perfmon {
/* Tracks the number of users of the perfmon, when this counter reaches
* zero the perfmon is destroyed.
*/
refcount_t refcnt;
/* Protects perfmon stop, as it can be invoked from multiple places. */
struct mutex lock;
/* Number of counters activated in this perfmon instance
* (should be less than DRM_V3D_MAX_PERF_COUNTERS).
*/
u8 ncounters;
/* Events counted by the HW perf counters. */
u8 counters[DRM_V3D_MAX_PERF_COUNTERS];
/* Storage for counter values. Counters are incremented by the
* HW perf counter values every time the perfmon is attached
* to a GPU job. This way, perfmon users don't have to
* retrieve the results after each job if they want to track
* events covering several submissions. Note that counter
* values can't be reset, but you can fake a reset by
* destroying the perfmon and creating a new one.
*/
u64 values[] __counted_by(ncounters);
};
enum v3d_gen {
V3D_GEN_33 = 33,
V3D_GEN_41 = 41,
V3D_GEN_42 = 42,
V3D_GEN_71 = 71,
};
enum v3d_irq {
V3D_CORE_IRQ,
V3D_HUB_IRQ,
V3D_MAX_IRQS,
};
struct v3d_dev {
struct drm_device drm;
/* Short representation (e.g. 33, 41) of the V3D tech version */
enum v3d_gen ver;
/* Short representation (e.g. 5, 6) of the V3D tech revision */
Annotation
- Immediate include surface: `linux/delay.h`, `linux/mutex.h`, `linux/pm_runtime.h`, `linux/spinlock_types.h`, `linux/workqueue.h`, `drm/drm_encoder.h`, `drm/drm_gem.h`, `drm/drm_gem_shmem_helper.h`.
- Detected declarations: `struct clk`, `struct platform_device`, `struct reset_control`, `struct v3d_stats`, `struct v3d_queue_state`, `struct v3d_perfmon`, `struct v3d_dev`, `struct v3d_file_priv`, `struct v3d_bo`, `struct v3d_fence`.
- 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.