drivers/gpu/drm/imagination/pvr_context.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/imagination/pvr_context.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/imagination/pvr_context.c- Extension
.c- Size
- 12826 bytes
- Lines
- 488
- 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
pvr_cccb.hpvr_context.hpvr_device.hpvr_drv.hpvr_gem.hpvr_job.hpvr_power.hpvr_rogue_fwif.hpvr_rogue_fwif_common.hpvr_rogue_fwif_resetframework.hpvr_stream.hpvr_stream_defs.hpvr_vm.hdrm/drm_auth.hdrm/drm_managed.hlinux/bug.hlinux/errno.hlinux/kernel.hlinux/list.hlinux/sched.hlinux/slab.hlinux/spinlock.hlinux/string.hlinux/types.hlinux/xarray.h
Detected Declarations
function remap_priorityfunction get_fw_obj_sizefunction process_static_context_statefunction init_render_fw_objsfunction init_compute_fw_objsfunction init_transfer_fw_objsfunction init_fw_objsfunction ctx_fw_data_initfunction pvr_context_destroy_queuesfunction pvr_context_create_queuesfunction pvr_context_kill_queuesfunction pvr_context_createfunction pvr_context_releasefunction pvr_context_putfunction pvr_context_destroyfunction pvr_destroy_contexts_for_filefunction pvr_context_device_initfunction pvr_context_device_fini
Annotated Snippet
if (IS_ERR(ctx->queues.geometry)) {
err = PTR_ERR(ctx->queues.geometry);
ctx->queues.geometry = NULL;
goto err_destroy_queues;
}
ctx->queues.fragment = pvr_queue_create(ctx, DRM_PVR_JOB_TYPE_FRAGMENT,
args, fw_ctx_map);
if (IS_ERR(ctx->queues.fragment)) {
err = PTR_ERR(ctx->queues.fragment);
ctx->queues.fragment = NULL;
goto err_destroy_queues;
}
return 0;
case DRM_PVR_CTX_TYPE_COMPUTE:
ctx->queues.compute = pvr_queue_create(ctx, DRM_PVR_JOB_TYPE_COMPUTE,
args, fw_ctx_map);
if (IS_ERR(ctx->queues.compute)) {
err = PTR_ERR(ctx->queues.compute);
ctx->queues.compute = NULL;
goto err_destroy_queues;
}
return 0;
case DRM_PVR_CTX_TYPE_TRANSFER_FRAG:
ctx->queues.transfer = pvr_queue_create(ctx, DRM_PVR_JOB_TYPE_TRANSFER_FRAG,
args, fw_ctx_map);
if (IS_ERR(ctx->queues.transfer)) {
err = PTR_ERR(ctx->queues.transfer);
ctx->queues.transfer = NULL;
goto err_destroy_queues;
}
return 0;
}
return -EINVAL;
err_destroy_queues:
pvr_context_destroy_queues(ctx);
return err;
}
/**
* pvr_context_kill_queues() - Kill queues attached to context.
* @ctx: Context to kill queues on.
*
* Killing the queues implies making them unusable for future jobs, while still
* letting the currently submitted jobs a chance to finish. Queue resources will
* stay around until pvr_context_destroy_queues() is called.
*/
static void pvr_context_kill_queues(struct pvr_context *ctx)
{
switch (ctx->type) {
case DRM_PVR_CTX_TYPE_RENDER:
pvr_queue_kill(ctx->queues.fragment);
pvr_queue_kill(ctx->queues.geometry);
break;
case DRM_PVR_CTX_TYPE_COMPUTE:
pvr_queue_kill(ctx->queues.compute);
break;
case DRM_PVR_CTX_TYPE_TRANSFER_FRAG:
pvr_queue_kill(ctx->queues.transfer);
break;
}
}
/**
* pvr_context_create() - Create a context.
* @pvr_file: File to attach the created context to.
* @args: Context creation arguments.
*
* Return:
* * 0 on success, or
* * A negative error code on failure.
*/
int pvr_context_create(struct pvr_file *pvr_file, struct drm_pvr_ioctl_create_context_args *args)
{
struct pvr_device *pvr_dev = pvr_file->pvr_dev;
struct pvr_context *ctx;
int ctx_size;
int err;
/* Context creation flags are currently unused and must be zero. */
if (args->flags)
return -EINVAL;
ctx_size = get_fw_obj_size(args->type);
if (ctx_size < 0)
return ctx_size;
Annotation
- Immediate include surface: `pvr_cccb.h`, `pvr_context.h`, `pvr_device.h`, `pvr_drv.h`, `pvr_gem.h`, `pvr_job.h`, `pvr_power.h`, `pvr_rogue_fwif.h`.
- Detected declarations: `function remap_priority`, `function get_fw_obj_size`, `function process_static_context_state`, `function init_render_fw_objs`, `function init_compute_fw_objs`, `function init_transfer_fw_objs`, `function init_fw_objs`, `function ctx_fw_data_init`, `function pvr_context_destroy_queues`, `function pvr_context_create_queues`.
- 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.