drivers/gpu/drm/vc4/vc4_drv.h
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/vc4/vc4_drv.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/vc4/vc4_drv.h- Extension
.h- Size
- 32461 bytes
- Lines
- 1102
- 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/debugfs.hlinux/delay.hlinux/of.hlinux/refcount.hlinux/uaccess.hdrm/drm_atomic.hdrm/drm_debugfs.hdrm/drm_device.hdrm/drm_encoder.hdrm/drm_fourcc.hdrm/drm_gem_dma_helper.hdrm/drm_managed.hdrm/drm_mm.hdrm/drm_modeset_lock.hkunit/test-bug.huapi/drm/vc4_drm.h
Detected Declarations
struct drm_devicestruct drm_gem_objectstruct vc4_perfmonstruct vc4_devstruct vc4_bo_cachestruct vc4_labelstruct vc4_bostruct vc4_fencestruct vc4_v3dstruct vc4_upm_refcountsstruct vc4_hvsstruct vc4_hvs_statestruct vc4_planestruct vc4_plane_statestruct vc4_encoderstruct vc4_crtc_datastruct vc4_txp_datastruct vc4_pv_datastruct vc4_crtcstruct vc4_crtc_statestruct vc4_exec_infostruct vc4_shader_statestruct vc4_filestruct vc4_texture_sample_infostruct vc4_validated_shader_infoenum vc4_kernel_bo_typeenum vc4_genenum vc4_scaling_modeenum vc4_encoder_typefunction drm_for_each_encoderfunction vc4_crtc_to_vc4_crtc_datafunction vc4_crtc_to_vc4_pv_datafunction vc4_first_bin_jobfunction vc4_first_render_jobfunction vc4_last_render_jobfunction vc4_debugfs_add_regset32
Annotated Snippet
struct vc4_perfmon {
struct vc4_dev *dev;
/* Tracks the number of users of the perfmon, when this counter reaches
* zero the perfmon is destroyed.
*/
refcount_t refcnt;
/* Number of counters activated in this perfmon instance
* (should be less than DRM_VC4_MAX_PERF_COUNTERS).
*/
u8 ncounters;
/* Events counted by the HW perf counters. */
u8 events[DRM_VC4_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 counters[] __counted_by(ncounters);
};
enum vc4_gen {
VC4_GEN_4,
VC4_GEN_5,
VC4_GEN_6_C,
VC4_GEN_6_D,
};
struct vc4_dev {
struct drm_device base;
struct device *dev;
enum vc4_gen gen;
unsigned int irq;
struct vc4_hvs *hvs;
struct vc4_v3d *v3d;
struct vc4_hang_state *hang_state;
/* The kernel-space BO cache. Tracks buffers that have been
* unreferenced by all other users (refcounts of 0!) but not
* yet freed, so we can do cheap allocations.
*/
struct vc4_bo_cache {
/* Array of list heads for entries in the BO cache,
* based on number of pages, so we can do O(1) lookups
* in the cache when allocating.
*/
struct list_head *size_list;
uint32_t size_list_size;
/* List of all BOs in the cache, ordered by age, so we
* can do O(1) lookups when trying to free old
* buffers.
*/
struct list_head time_list;
struct work_struct time_work;
struct timer_list time_timer;
} bo_cache;
u32 num_labels;
struct vc4_label {
const char *name;
u32 num_allocated;
u32 size_allocated;
} *bo_labels;
/* Protects bo_cache and bo_labels. */
struct mutex bo_lock;
/* Purgeable BO pool. All BOs in this pool can have their memory
* reclaimed if the driver is unable to allocate new BOs. We also
* keep stats related to the purge mechanism here.
*/
struct {
struct list_head list;
unsigned int num;
size_t size;
unsigned int purged_num;
size_t purged_size;
struct mutex lock;
} purgeable;
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/delay.h`, `linux/of.h`, `linux/refcount.h`, `linux/uaccess.h`, `drm/drm_atomic.h`, `drm/drm_debugfs.h`, `drm/drm_device.h`.
- Detected declarations: `struct drm_device`, `struct drm_gem_object`, `struct vc4_perfmon`, `struct vc4_dev`, `struct vc4_bo_cache`, `struct vc4_label`, `struct vc4_bo`, `struct vc4_fence`, `struct vc4_v3d`, `struct vc4_upm_refcounts`.
- 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.