drivers/gpu/drm/amd/amdgpu/vce_v2_0.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c- Extension
.c- Size
- 16892 bytes
- Lines
- 694
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/firmware.hamdgpu.hamdgpu_vce.hcikd.hvce/vce_2_0_d.hvce/vce_2_0_sh_mask.hsmu/smu_7_0_1_d.hsmu/smu_7_0_1_sh_mask.hoss/oss_2_0_d.hoss/oss_2_0_sh_mask.h
Detected Declarations
function vce_v2_0_ring_get_rptrfunction vce_v2_0_ring_get_wptrfunction vce_v2_0_ring_set_wptrfunction vce_v2_0_lmi_cleanfunction vce_v2_0_firmware_loadedfunction vce_v2_0_disable_cgfunction vce_v2_0_init_cgfunction vce_v2_0_mc_resumefunction vce_v2_0_is_idlefunction vce_v2_0_wait_for_idlefunction vce_v2_0_startfunction vce_v2_0_stopfunction vce_v2_0_set_sw_cgfunction vce_v2_0_set_dyn_cgfunction vce_v2_0_enable_mgcgfunction vce_v2_0_early_initfunction vce_v2_0_sw_initfunction vce_v2_0_sw_finifunction vce_v2_0_hw_initfunction vce_v2_0_hw_finifunction vce_v2_0_suspendfunction vce_v2_0_resumefunction vce_v2_0_soft_resetfunction vce_v2_0_set_interrupt_statefunction vce_v2_0_process_interruptfunction vce_v2_0_set_clockgating_statefunction vce_v2_0_set_powergating_statefunction vce_v2_0_set_ring_funcsfunction vce_v2_0_set_irq_funcs
Annotated Snippet
#include <linux/firmware.h>
#include "amdgpu.h"
#include "amdgpu_vce.h"
#include "cikd.h"
#include "vce/vce_2_0_d.h"
#include "vce/vce_2_0_sh_mask.h"
#include "smu/smu_7_0_1_d.h"
#include "smu/smu_7_0_1_sh_mask.h"
#include "oss/oss_2_0_d.h"
#include "oss/oss_2_0_sh_mask.h"
/* Use 24K to be safe. The FW supposedly only requires 23744 bytes. */
#define VCE_V2_0_DATA_ENTRY_SIZE (24 * 1024)
#define VCE_V2_0_FW_SIZE (256 * 1024)
#define VCE_V2_0_STACK_SIZE (64 * 1024)
#define VCE_V2_0_DATA_SIZE (VCE_V2_0_DATA_ENTRY_SIZE * (AMDGPU_MAX_VCE_HANDLES + 1))
#define VCE_STATUS_VCPU_REPORT_FW_LOADED_MASK 0x02
static void vce_v2_0_set_ring_funcs(struct amdgpu_device *adev);
static void vce_v2_0_set_irq_funcs(struct amdgpu_device *adev);
/**
* vce_v2_0_ring_get_rptr - get read pointer
*
* @ring: amdgpu_ring pointer
*
* Returns the current hardware read pointer
*/
static uint64_t vce_v2_0_ring_get_rptr(struct amdgpu_ring *ring)
{
struct amdgpu_device *adev = ring->adev;
if (ring->me == 0)
return RREG32(mmVCE_RB_RPTR);
else
return RREG32(mmVCE_RB_RPTR2);
}
/**
* vce_v2_0_ring_get_wptr - get write pointer
*
* @ring: amdgpu_ring pointer
*
* Returns the current hardware write pointer
*/
static uint64_t vce_v2_0_ring_get_wptr(struct amdgpu_ring *ring)
{
struct amdgpu_device *adev = ring->adev;
if (ring->me == 0)
return RREG32(mmVCE_RB_WPTR);
else
return RREG32(mmVCE_RB_WPTR2);
}
/**
* vce_v2_0_ring_set_wptr - set write pointer
*
* @ring: amdgpu_ring pointer
*
* Commits the write pointer to the hardware
*/
static void vce_v2_0_ring_set_wptr(struct amdgpu_ring *ring)
{
struct amdgpu_device *adev = ring->adev;
if (ring->me == 0)
WREG32(mmVCE_RB_WPTR, lower_32_bits(ring->wptr));
else
WREG32(mmVCE_RB_WPTR2, lower_32_bits(ring->wptr));
}
static int vce_v2_0_lmi_clean(struct amdgpu_device *adev)
{
int i, j;
for (i = 0; i < 10; ++i) {
for (j = 0; j < 100; ++j) {
uint32_t status = RREG32(mmVCE_LMI_STATUS);
if (status & 0x337f)
return 0;
mdelay(10);
}
}
Annotation
- Immediate include surface: `linux/firmware.h`, `amdgpu.h`, `amdgpu_vce.h`, `cikd.h`, `vce/vce_2_0_d.h`, `vce/vce_2_0_sh_mask.h`, `smu/smu_7_0_1_d.h`, `smu/smu_7_0_1_sh_mask.h`.
- Detected declarations: `function vce_v2_0_ring_get_rptr`, `function vce_v2_0_ring_get_wptr`, `function vce_v2_0_ring_set_wptr`, `function vce_v2_0_lmi_clean`, `function vce_v2_0_firmware_loaded`, `function vce_v2_0_disable_cg`, `function vce_v2_0_init_cg`, `function vce_v2_0_mc_resume`, `function vce_v2_0_is_idle`, `function vce_v2_0_wait_for_idle`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
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.