drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c- Extension
.c- Size
- 21687 bytes
- Lines
- 860
- 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_uvd.hsid.huvd/uvd_3_1_d.huvd/uvd_3_1_sh_mask.hoss/oss_1_0_d.hoss/oss_1_0_sh_mask.h
Detected Declarations
function filesfunction uvd_v3_1_ring_get_wptrfunction uvd_v3_1_ring_set_wptrfunction uvd_v3_1_ring_emit_ibfunction uvd_v3_1_ring_emit_fencefunction uvd_v3_1_ring_test_ringfunction uvd_v3_1_ring_insert_nopfunction uvd_v3_1_set_ring_funcsfunction uvd_v3_1_set_dcmfunction uvd_v3_1_mc_resumefunction uvd_v3_1_fw_validatefunction uvd_v3_1_startfunction uvd_v3_1_stopfunction uvd_v3_1_set_interrupt_statefunction uvd_v3_1_process_interruptfunction uvd_v3_1_set_irq_funcsfunction uvd_v3_1_early_initfunction uvd_v3_1_sw_initfunction uvd_v3_1_sw_finifunction uvd_v3_1_enable_mgcgfunction uvd_v3_1_hw_initfunction uvd_v3_1_hw_finifunction uvd_v3_1_prepare_suspendfunction uvd_v3_1_suspendfunction uvd_v3_1_resumefunction uvd_v3_1_is_idlefunction uvd_v3_1_wait_for_idlefunction uvd_v3_1_soft_resetfunction uvd_v3_1_set_clockgating_statefunction uvd_v3_1_set_powergating_state
Annotated Snippet
#include <linux/firmware.h>
#include "amdgpu.h"
#include "amdgpu_uvd.h"
#include "sid.h"
#include "uvd/uvd_3_1_d.h"
#include "uvd/uvd_3_1_sh_mask.h"
#include "oss/oss_1_0_d.h"
#include "oss/oss_1_0_sh_mask.h"
/**
* uvd_v3_1_ring_get_rptr - get read pointer
*
* @ring: amdgpu_ring pointer
*
* Returns the current hardware read pointer
*/
static uint64_t uvd_v3_1_ring_get_rptr(struct amdgpu_ring *ring)
{
struct amdgpu_device *adev = ring->adev;
return RREG32(mmUVD_RBC_RB_RPTR);
}
/**
* uvd_v3_1_ring_get_wptr - get write pointer
*
* @ring: amdgpu_ring pointer
*
* Returns the current hardware write pointer
*/
static uint64_t uvd_v3_1_ring_get_wptr(struct amdgpu_ring *ring)
{
struct amdgpu_device *adev = ring->adev;
return RREG32(mmUVD_RBC_RB_WPTR);
}
/**
* uvd_v3_1_ring_set_wptr - set write pointer
*
* @ring: amdgpu_ring pointer
*
* Commits the write pointer to the hardware
*/
static void uvd_v3_1_ring_set_wptr(struct amdgpu_ring *ring)
{
struct amdgpu_device *adev = ring->adev;
WREG32(mmUVD_RBC_RB_WPTR, lower_32_bits(ring->wptr));
}
/**
* uvd_v3_1_ring_emit_ib - execute indirect buffer
*
* @ring: amdgpu_ring pointer
* @job: iob associated with the indirect buffer
* @ib: indirect buffer to execute
* @flags: flags associated with the indirect buffer
*
* Write ring commands to execute the indirect buffer
*/
static void uvd_v3_1_ring_emit_ib(struct amdgpu_ring *ring,
struct amdgpu_job *job,
struct amdgpu_ib *ib,
uint32_t flags)
{
amdgpu_ring_write(ring, PACKET0(mmUVD_RBC_IB_BASE, 0));
amdgpu_ring_write(ring, ib->gpu_addr);
amdgpu_ring_write(ring, PACKET0(mmUVD_RBC_IB_SIZE, 0));
amdgpu_ring_write(ring, ib->length_dw);
}
/**
* uvd_v3_1_ring_emit_fence - emit a fence & trap command
*
* @ring: amdgpu_ring pointer
* @addr: address
* @seq: sequence number
* @flags: fence related flags
*
* Write a fence and a trap command to the ring.
*/
static void uvd_v3_1_ring_emit_fence(struct amdgpu_ring *ring, u64 addr, u64 seq,
unsigned flags)
{
WARN_ON(flags & AMDGPU_FENCE_FLAG_64BIT);
Annotation
- Immediate include surface: `linux/firmware.h`, `amdgpu.h`, `amdgpu_uvd.h`, `sid.h`, `uvd/uvd_3_1_d.h`, `uvd/uvd_3_1_sh_mask.h`, `oss/oss_1_0_d.h`, `oss/oss_1_0_sh_mask.h`.
- Detected declarations: `function files`, `function uvd_v3_1_ring_get_wptr`, `function uvd_v3_1_ring_set_wptr`, `function uvd_v3_1_ring_emit_ib`, `function uvd_v3_1_ring_emit_fence`, `function uvd_v3_1_ring_test_ring`, `function uvd_v3_1_ring_insert_nop`, `function uvd_v3_1_set_ring_funcs`, `function uvd_v3_1_set_dcm`, `function uvd_v3_1_mc_resume`.
- 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.