drivers/gpu/drm/imagination/pvr_context.h
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/imagination/pvr_context.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/imagination/pvr_context.h- Extension
.h- Size
- 5683 bytes
- Lines
- 227
- 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
drm/gpu_scheduler.hlinux/compiler_attributes.hlinux/dma-fence.hlinux/kref.hlinux/types.hlinux/xarray.huapi/drm/pvr_drm.hpvr_cccb.hpvr_device.hpvr_queue.h
Detected Declarations
struct pvr_fw_objectstruct pvr_contextenum pvr_context_priorityfunction pvr_context_get_queue_for_jobfunction pvr_context_getfunction pvr_context_get_if_referencedfunction pvr_context_lookupfunction pvr_context_lookup_idfunction pvr_context_get_fw_addr
Annotated Snippet
struct pvr_context {
/** @ref_count: Refcount for context. */
struct kref ref_count;
/** @pvr_dev: Pointer to owning device. */
struct pvr_device *pvr_dev;
/** @vm_ctx: Pointer to associated VM context. */
struct pvr_vm_context *vm_ctx;
/** @type: Type of context. */
enum drm_pvr_ctx_type type;
/** @flags: Context flags. */
u32 flags;
/** @priority: Context priority*/
enum pvr_context_priority priority;
/** @fw_obj: FW object representing FW-side context data. */
struct pvr_fw_object *fw_obj;
/** @data: Pointer to local copy of FW context data. */
void *data;
/** @data_size: Size of FW context data, in bytes. */
u32 data_size;
/** @ctx_id: FW context ID. */
u32 ctx_id;
/**
* @faulty: Set to 1 when the context queues had unfinished job when
* a GPU reset happened.
*
* In that case, the context is in an inconsistent state and can't be
* used anymore.
*/
atomic_t faulty;
/** @queues: Union containing all kind of queues. */
union {
struct {
/** @geometry: Geometry queue. */
struct pvr_queue *geometry;
/** @fragment: Fragment queue. */
struct pvr_queue *fragment;
};
/** @compute: Compute queue. */
struct pvr_queue *compute;
/** @compute: Transfer queue. */
struct pvr_queue *transfer;
} queues;
/** @file_link: pvr_file PVR context list link. */
struct list_head file_link;
};
static __always_inline struct pvr_queue *
pvr_context_get_queue_for_job(struct pvr_context *ctx, enum drm_pvr_job_type type)
{
switch (type) {
case DRM_PVR_JOB_TYPE_GEOMETRY:
return ctx->type == DRM_PVR_CTX_TYPE_RENDER ? ctx->queues.geometry : NULL;
case DRM_PVR_JOB_TYPE_FRAGMENT:
return ctx->type == DRM_PVR_CTX_TYPE_RENDER ? ctx->queues.fragment : NULL;
case DRM_PVR_JOB_TYPE_COMPUTE:
return ctx->type == DRM_PVR_CTX_TYPE_COMPUTE ? ctx->queues.compute : NULL;
case DRM_PVR_JOB_TYPE_TRANSFER_FRAG:
return ctx->type == DRM_PVR_CTX_TYPE_TRANSFER_FRAG ? ctx->queues.transfer : NULL;
}
return NULL;
}
/**
* pvr_context_get() - Take additional reference on context.
* @ctx: Context pointer.
*
* Call pvr_context_put() to release.
*
* Returns:
* * The requested context on success, or
* * %NULL if no context pointer passed.
*/
static __always_inline struct pvr_context *
pvr_context_get(struct pvr_context *ctx)
Annotation
- Immediate include surface: `drm/gpu_scheduler.h`, `linux/compiler_attributes.h`, `linux/dma-fence.h`, `linux/kref.h`, `linux/types.h`, `linux/xarray.h`, `uapi/drm/pvr_drm.h`, `pvr_cccb.h`.
- Detected declarations: `struct pvr_fw_object`, `struct pvr_context`, `enum pvr_context_priority`, `function pvr_context_get_queue_for_job`, `function pvr_context_get`, `function pvr_context_get_if_referenced`, `function pvr_context_lookup`, `function pvr_context_lookup_id`, `function pvr_context_get_fw_addr`.
- 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.