drivers/gpu/drm/imagination/pvr_queue.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/imagination/pvr_queue.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/imagination/pvr_queue.c- Extension
.c- Size
- 44832 bytes
- Lines
- 1507
- 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
drm/drm_managed.hdrm/gpu_scheduler.hpvr_cccb.hpvr_context.hpvr_device.hpvr_drv.hpvr_job.hpvr_queue.hpvr_trace.hpvr_vm.hpvr_rogue_fwif_client.h
Detected Declarations
function get_xfer_ctx_state_sizefunction get_frag_ctx_state_sizefunction get_ctx_state_sizefunction get_ctx_offsetfunction pvr_queue_fence_get_driver_namefunction pvr_queue_fence_release_workfunction pvr_queue_fence_releasefunction pvr_queue_job_fence_get_timeline_namefunction pvr_queue_cccb_fence_get_timeline_namefunction pvr_queue_fence_is_ufo_backedfunction to_pvr_queue_job_fencefunction pvr_queue_fence_putfunction pvr_queue_fence_allocfunction pvr_queue_fence_initfunction pvr_queue_cccb_fence_initfunction pvr_queue_job_fence_initfunction pvr_queue_fence_ctx_initfunction ufo_cmds_sizefunction job_cmds_sizefunction is_paired_job_fencefunction job_count_remaining_native_depsfunction xa_for_eachfunction pvr_queue_get_job_cccb_fencefunction pvr_queue_get_job_kccb_fencefunction pvr_queue_get_paired_frag_job_depfunction pvr_queue_prepare_jobfunction pvr_queue_update_active_state_lockedfunction pvr_queue_update_active_statefunction pvr_queue_submit_job_to_cccbfunction xa_for_eachfunction pvr_queue_run_jobfunction pvr_queue_stopfunction pvr_queue_startfunction list_for_each_entryfunction pvr_queue_timedout_jobfunction pvr_queue_free_jobfunction pvr_queue_fence_is_nativefunction pvr_queue_signal_done_fencesfunction pvr_queue_check_job_waiting_for_cccb_spacefunction pvr_queue_processfunction get_dm_typefunction init_fw_contextfunction pvr_queue_cleanup_fw_contextfunction pvr_queue_job_initfunction pvr_queue_job_armfunction pvr_queue_job_cleanupfunction pvr_queue_job_pushfunction reg_state_init
Annotated Snippet
if (PVR_HAS_FEATURE(pvr_dev, gpu_multicore_support)) {
u32 xpu_max_slaves;
err = PVR_FEATURE_VALUE(pvr_dev, xpu_max_slaves, &xpu_max_slaves);
if (WARN_ON(err))
return err;
num_isp_store_registers *= (1 + xpu_max_slaves);
}
} else {
err = PVR_FEATURE_VALUE(pvr_dev, num_isp_ipp_pipes, &num_isp_store_registers);
if (WARN_ON(err))
return err;
}
return sizeof(struct rogue_fwif_frag_ctx_state) +
(num_isp_store_registers *
sizeof(((struct rogue_fwif_frag_ctx_state *)0)->frag_reg_isp_store[0]));
}
static int get_ctx_state_size(struct pvr_device *pvr_dev, enum drm_pvr_job_type type)
{
switch (type) {
case DRM_PVR_JOB_TYPE_GEOMETRY:
return sizeof(struct rogue_fwif_geom_ctx_state);
case DRM_PVR_JOB_TYPE_FRAGMENT:
return get_frag_ctx_state_size(pvr_dev);
case DRM_PVR_JOB_TYPE_COMPUTE:
return sizeof(struct rogue_fwif_compute_ctx_state);
case DRM_PVR_JOB_TYPE_TRANSFER_FRAG:
return get_xfer_ctx_state_size(pvr_dev);
}
WARN(1, "Invalid queue type");
return -EINVAL;
}
static u32 get_ctx_offset(enum drm_pvr_job_type type)
{
switch (type) {
case DRM_PVR_JOB_TYPE_GEOMETRY:
return offsetof(struct rogue_fwif_fwrendercontext, geom_context);
case DRM_PVR_JOB_TYPE_FRAGMENT:
return offsetof(struct rogue_fwif_fwrendercontext, frag_context);
case DRM_PVR_JOB_TYPE_COMPUTE:
return offsetof(struct rogue_fwif_fwcomputecontext, cdm_context);
case DRM_PVR_JOB_TYPE_TRANSFER_FRAG:
return offsetof(struct rogue_fwif_fwtransfercontext, tq_context);
}
return 0;
}
static const char *
pvr_queue_fence_get_driver_name(struct dma_fence *f)
{
return PVR_DRIVER_NAME;
}
static void pvr_queue_fence_release_work(struct work_struct *w)
{
struct pvr_queue_fence *fence = container_of(w, struct pvr_queue_fence, release_work);
pvr_context_put(fence->queue->ctx);
dma_fence_free(&fence->base);
}
static void pvr_queue_fence_release(struct dma_fence *f)
{
struct pvr_queue_fence *fence = container_of(f, struct pvr_queue_fence, base);
struct pvr_device *pvr_dev = fence->queue->ctx->pvr_dev;
queue_work(pvr_dev->sched_wq, &fence->release_work);
}
static const char *
pvr_queue_job_fence_get_timeline_name(struct dma_fence *f)
{
struct pvr_queue_fence *fence = container_of(f, struct pvr_queue_fence, base);
switch (fence->queue->type) {
case DRM_PVR_JOB_TYPE_GEOMETRY:
return "geometry";
case DRM_PVR_JOB_TYPE_FRAGMENT:
return "fragment";
case DRM_PVR_JOB_TYPE_COMPUTE:
return "compute";
Annotation
- Immediate include surface: `drm/drm_managed.h`, `drm/gpu_scheduler.h`, `pvr_cccb.h`, `pvr_context.h`, `pvr_device.h`, `pvr_drv.h`, `pvr_job.h`, `pvr_queue.h`.
- Detected declarations: `function get_xfer_ctx_state_size`, `function get_frag_ctx_state_size`, `function get_ctx_state_size`, `function get_ctx_offset`, `function pvr_queue_fence_get_driver_name`, `function pvr_queue_fence_release_work`, `function pvr_queue_fence_release`, `function pvr_queue_job_fence_get_timeline_name`, `function pvr_queue_cccb_fence_get_timeline_name`, `function pvr_queue_fence_is_ufo_backed`.
- 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.