drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c- Extension
.c- Size
- 78485 bytes
- Lines
- 2390
- 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/firmware.hamdgpu.hamdgpu_vcn.hamdgpu_pm.hamdgpu_cs.hsoc15.hsoc15d.hvcn_v2_0.hmmsch_v3_0.hvcn_sw_ring.hvcn/vcn_3_0_0_offset.hvcn/vcn_3_0_0_sh_mask.hivsrcid/vcn/irqsrcs_vcn_2_0.hdrm/drm_drv.h
Detected Declarations
function vcn_v3_0_early_initfunction vcn_v3_0_sw_initfunction vcn_v3_0_sw_finifunction vcn_v3_0_hw_initfunction vcn_v3_0_hw_finifunction vcn_v3_0_suspendfunction vcn_v3_0_resumefunction vcn_v3_0_mc_resumefunction vcn_v3_0_mc_resume_dpg_modefunction vcn_v3_0_disable_static_power_gatingfunction vcn_v3_0_enable_static_power_gatingfunction vcn_v3_0_disable_clock_gatingfunction vcn_v3_0_clock_gating_dpg_modefunction vcn_v3_0_enable_clock_gatingfunction vcn_v3_0_start_dpg_modefunction vcn_v3_0_startfunction vcn_v3_0_start_sriovfunction vcn_v3_0_stop_dpg_modefunction vcn_v3_0_stopfunction vcn_v3_0_pause_dpg_modefunction vcn_v3_0_dec_ring_get_rptrfunction vcn_v3_0_dec_ring_get_wptrfunction vcn_v3_0_dec_ring_set_wptrfunction vcn_v3_0_limit_schedfunction vcn_v3_0_dec_msgfunction vcn_v3_0_ring_patch_cs_in_placefunction vcn_v3_0_enc_ring_get_rptrfunction vcn_v3_0_enc_ring_get_wptrfunction vcn_v3_0_enc_ring_set_wptrfunction vcn_v3_0_set_dec_ring_funcsfunction vcn_v3_0_set_enc_ring_funcsfunction vcn_v3_0_resetfunction vcn_v3_0_is_idlefunction vcn_v3_0_wait_for_idlefunction vcn_v3_0_set_clockgating_statefunction vcn_v3_0_set_pg_statefunction vcn_v3_0_set_interrupt_statefunction vcn_v3_0_process_interruptfunction vcn_v3_0_set_irq_funcs
Annotated Snippet
if (amdgpu_sriov_vf(adev)) {
ring->doorbell_index = vcn_doorbell_index + i * (adev->vcn.inst[i].num_enc_rings + 1);
} else {
ring->doorbell_index = (adev->doorbell_index.vcn.vcn_ring0_1 << 1) + 8 * i;
}
ring->vm_hub = AMDGPU_MMHUB0(0);
sprintf(ring->name, "vcn_dec_%d", i);
r = amdgpu_ring_init(adev, ring, 512, &adev->vcn.inst[i].irq, 0,
AMDGPU_RING_PRIO_DEFAULT,
&adev->vcn.inst[i].sched_score);
if (r)
return r;
for (j = 0; j < adev->vcn.inst[i].num_enc_rings; ++j) {
enum amdgpu_ring_priority_level hw_prio = amdgpu_vcn_get_enc_ring_prio(j);
/* VCN ENC TRAP */
r = amdgpu_irq_add_id(adev, amdgpu_ih_clientid_vcns[i],
j + VCN_2_0__SRCID__UVD_ENC_GENERAL_PURPOSE, &adev->vcn.inst[i].irq);
if (r)
return r;
ring = &adev->vcn.inst[i].ring_enc[j];
ring->use_doorbell = true;
if (amdgpu_sriov_vf(adev)) {
ring->doorbell_index = vcn_doorbell_index + i * (adev->vcn.inst[i].num_enc_rings + 1) + 1 + j;
} else {
ring->doorbell_index = (adev->doorbell_index.vcn.vcn_ring0_1 << 1) + 2 + j + 8 * i;
}
ring->vm_hub = AMDGPU_MMHUB0(0);
sprintf(ring->name, "vcn_enc_%d.%d", i, j);
r = amdgpu_ring_init(adev, ring, 512, &adev->vcn.inst[i].irq, 0,
hw_prio, &adev->vcn.inst[i].sched_score);
if (r)
return r;
}
fw_shared = adev->vcn.inst[i].fw_shared.cpu_addr;
fw_shared->present_flag_0 |= cpu_to_le32(AMDGPU_VCN_SW_RING_FLAG) |
cpu_to_le32(AMDGPU_VCN_MULTI_QUEUE_FLAG) |
cpu_to_le32(AMDGPU_VCN_FW_SHARED_FLAG_0_RB);
fw_shared->sw_ring.is_enabled = cpu_to_le32(DEC_SW_RING_ENABLED);
fw_shared->present_flag_0 |= AMDGPU_VCN_SMU_VERSION_INFO_FLAG;
if (amdgpu_ip_version(adev, UVD_HWIP, 0) == IP_VERSION(3, 1, 2))
fw_shared->smu_interface_info.smu_interface_type = 2;
else if (amdgpu_ip_version(adev, UVD_HWIP, 0) ==
IP_VERSION(3, 1, 1))
fw_shared->smu_interface_info.smu_interface_type = 1;
if (amdgpu_vcnfw_log)
amdgpu_vcn_fwlog_init(&adev->vcn.inst[i]);
if (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG)
adev->vcn.inst[i].pause_dpg_mode = vcn_v3_0_pause_dpg_mode;
adev->vcn.inst[i].reset = vcn_v3_0_reset;
}
adev->vcn.supported_reset =
amdgpu_get_soft_full_reset_mask(&adev->vcn.inst[0].ring_enc[0]);
if (!amdgpu_sriov_vf(adev))
adev->vcn.supported_reset |= AMDGPU_RESET_TYPE_PER_QUEUE;
if (amdgpu_sriov_vf(adev)) {
r = amdgpu_virt_alloc_mm_table(adev);
if (r)
return r;
}
r = amdgpu_vcn_reg_dump_init(adev, vcn_reg_list_3_0, ARRAY_SIZE(vcn_reg_list_3_0));
if (r)
return r;
r = amdgpu_vcn_sysfs_reset_mask_init(adev);
if (r)
return r;
return 0;
}
/**
* vcn_v3_0_sw_fini - sw fini for VCN block
*
* @ip_block: Pointer to the amdgpu_ip_block for this hw instance.
*
* VCN suspend and free up sw allocation
*/
static int vcn_v3_0_sw_fini(struct amdgpu_ip_block *ip_block)
{
struct amdgpu_device *adev = ip_block->adev;
int i, r, idx;
Annotation
- Immediate include surface: `linux/firmware.h`, `amdgpu.h`, `amdgpu_vcn.h`, `amdgpu_pm.h`, `amdgpu_cs.h`, `soc15.h`, `soc15d.h`, `vcn_v2_0.h`.
- Detected declarations: `function vcn_v3_0_early_init`, `function vcn_v3_0_sw_init`, `function vcn_v3_0_sw_fini`, `function vcn_v3_0_hw_init`, `function vcn_v3_0_hw_fini`, `function vcn_v3_0_suspend`, `function vcn_v3_0_resume`, `function vcn_v3_0_mc_resume`, `function vcn_v3_0_mc_resume_dpg_mode`, `function vcn_v3_0_disable_static_power_gating`.
- 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.