drivers/gpu/drm/etnaviv/etnaviv_gem.h
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/etnaviv/etnaviv_gem.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/etnaviv/etnaviv_gem.h- Extension
.h- Size
- 3380 bytes
- Lines
- 128
- 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/dma-resv.hetnaviv_cmdbuf.hetnaviv_drv.h
Detected Declarations
struct dma_fencestruct etnaviv_gem_opsstruct etnaviv_gem_objectstruct etnaviv_gem_userptrstruct etnaviv_vram_mappingstruct etnaviv_gem_objectstruct etnaviv_gem_opsstruct etnaviv_gem_submit_bostruct etnaviv_gem_submitfunction is_active
Annotated Snippet
struct etnaviv_gem_userptr {
uintptr_t ptr;
struct mm_struct *mm;
bool ro;
};
struct etnaviv_vram_mapping {
struct list_head obj_node;
struct list_head scan_node;
struct list_head mmu_node;
struct etnaviv_gem_object *object;
struct etnaviv_iommu_context *context;
struct drm_mm_node vram_node;
unsigned int use;
u32 iova;
};
struct etnaviv_gem_object {
struct drm_gem_object base;
const struct etnaviv_gem_ops *ops;
struct mutex lock;
/*
* The actual size that is visible to the GPU, not necessarily
* PAGE_SIZE aligned, but should be aligned to GPU page size.
*/
u32 size;
u32 flags;
struct list_head gem_node;
atomic_t gpu_active;
struct page **pages;
struct sg_table *sgt;
void *vaddr;
struct list_head vram_list;
/* cache maintenance */
u32 last_cpu_prep_op;
struct etnaviv_gem_userptr userptr;
};
static inline
struct etnaviv_gem_object *to_etnaviv_bo(struct drm_gem_object *obj)
{
return container_of(obj, struct etnaviv_gem_object, base);
}
struct etnaviv_gem_ops {
int (*get_pages)(struct etnaviv_gem_object *);
void (*release)(struct etnaviv_gem_object *);
void *(*vmap)(struct etnaviv_gem_object *);
int (*mmap)(struct etnaviv_gem_object *, struct vm_area_struct *);
};
static inline bool is_active(struct etnaviv_gem_object *etnaviv_obj)
{
return atomic_read(&etnaviv_obj->gpu_active) != 0;
}
#define MAX_CMDS 4
struct etnaviv_gem_submit_bo {
u32 flags;
u64 va;
struct etnaviv_gem_object *obj;
struct etnaviv_vram_mapping *mapping;
};
/* Created per submit-ioctl, to track bo's and cmdstream bufs, etc,
* associated with the cmdstream submission for synchronization (and
* make it easier to unwind when things go wrong, etc).
*/
struct etnaviv_gem_submit {
struct drm_sched_job sched_job;
struct kref refcount;
struct etnaviv_file_private *ctx;
struct etnaviv_gpu *gpu;
struct etnaviv_iommu_context *mmu_context, *prev_mmu_context;
struct dma_fence *out_fence;
int out_fence_id;
struct list_head node; /* GPU active submit list */
struct etnaviv_cmdbuf cmdbuf;
struct pid *pid; /* submitting process */
u32 exec_state;
u32 flags;
unsigned int nr_pmrs;
struct etnaviv_perfmon_request *pmrs;
Annotation
- Immediate include surface: `linux/dma-resv.h`, `etnaviv_cmdbuf.h`, `etnaviv_drv.h`.
- Detected declarations: `struct dma_fence`, `struct etnaviv_gem_ops`, `struct etnaviv_gem_object`, `struct etnaviv_gem_userptr`, `struct etnaviv_vram_mapping`, `struct etnaviv_gem_object`, `struct etnaviv_gem_ops`, `struct etnaviv_gem_submit_bo`, `struct etnaviv_gem_submit`, `function is_active`.
- 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.