drivers/gpu/drm/msm/adreno/a8xx_gpu.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/msm/adreno/a8xx_gpu.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/msm/adreno/a8xx_gpu.c- Extension
.c- Size
- 41714 bytes
- Lines
- 1370
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
msm_gem.hmsm_mmu.hmsm_gpu_trace.ha6xx_gpu.ha6xx_gmu.xml.hlinux/bitfield.hlinux/devfreq.hlinux/firmware/qcom/qcom_scm.hlinux/pm_domain.hlinux/soc/qcom/llcc-qcom.h
Detected Declarations
function a8xx_aperture_slice_setfunction a8xx_aperture_acquirefunction a8xx_aperture_releasefunction a8xx_aperture_clearfunction a8xx_write_pipefunction a8xx_read_pipe_slicefunction a8xx_gpu_get_slice_infofunction a8xx_get_first_slicefunction _a8xx_check_idlefunction a8xx_idlefunction a8xx_flushfunction a8xx_set_hwcgfunction a8xx_set_cp_protectfunction a8xx_set_ubwc_configfunction a8xx_nonctxt_configfunction a8xx_patch_pwrup_reglistfunction a8xx_preempt_startfunction a8xx_cp_initfunction hw_initfunction a8xx_hw_initfunction a8xx_dumpfunction a8xx_recoverfunction a8xx_fault_handlerfunction a8xx_cp_hw_err_irqfunction gpu_periph_readfunction gpu_periph_read64function a8xx_fault_detect_irqfunction a8xx_sw_fuse_violation_irqfunction a8xx_irqfunction a8xx_llc_activatefunction a8xx_bus_clear_pending_transactionsfunction a8xx_gmu_get_timestampfunction a8xx_gpu_busyfunction a8xx_progressfunction a8xx_perfcntr_flush
Annotated Snippet
if (protect->regs[i]) {
gpu_write(gpu, REG_A8XX_CP_PROTECT_GLOBAL(i), protect->regs[i]);
final_cfg = protect->regs[i];
}
}
/*
* Last span feature is only supported on PIPE specific register.
* So update those here
*/
a8xx_write_pipe(gpu, PIPE_BR, REG_A8XX_CP_PROTECT_PIPE(15), final_cfg);
a8xx_write_pipe(gpu, PIPE_BV, REG_A8XX_CP_PROTECT_PIPE(15), final_cfg);
a8xx_aperture_clear(gpu);
}
static void a8xx_set_ubwc_config(struct msm_gpu *gpu)
{
struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
const struct qcom_ubwc_cfg_data *cfg = adreno_gpu->ubwc_config;
u32 level2_swizzling_dis = !(qcom_ubwc_swizzle(cfg) & UBWC_SWIZZLE_ENABLE_LVL2);
u32 level3_swizzling_dis = !(qcom_ubwc_swizzle(cfg) & UBWC_SWIZZLE_ENABLE_LVL3);
bool rgba8888_lossless = false, fp16compoptdis = false;
bool yuvnotcomptofc = false, min_acc_len_64b = false;
bool rgb565_predicator = false;
bool amsbc = qcom_ubwc_enable_amsbc(cfg);
bool ubwc_mode = qcom_ubwc_get_ubwc_mode(cfg);
u32 ubwc_version = cfg->ubwc_enc_version;
u32 hbb, hbb_hi, hbb_lo, mode;
u8 uavflagprd_inv = 2;
if (ubwc_version > UBWC_6_0)
dev_err(&gpu->pdev->dev, "Unknown UBWC version: 0x%x\n", ubwc_version);
if (ubwc_version == UBWC_6_0)
yuvnotcomptofc = true;
if (ubwc_version < UBWC_5_0 &&
ubwc_version >= UBWC_4_0)
rgba8888_lossless = true;
if (ubwc_version < UBWC_4_3)
fp16compoptdis = true;
if (cfg->ubwc_enc_version >= UBWC_4_0)
rgb565_predicator = true;
if (ubwc_version < UBWC_3_0)
dev_err(&gpu->pdev->dev, "Unsupported UBWC version: 0x%x\n", ubwc_version);
mode = qcom_ubwc_version_tag(cfg);
/*
* We subtract 13 from the highest bank bit (13 is the minimum value
* allowed by hw) and write the lowest two bits of the remaining value
* as hbb_lo and the one above it as hbb_hi to the hardware.
*/
WARN_ON(cfg->highest_bank_bit < 13);
hbb = cfg->highest_bank_bit - 13;
hbb_hi = hbb >> 2;
hbb_lo = hbb & 3;
a8xx_write_pipe(gpu, PIPE_BV, REG_A8XX_GRAS_NC_MODE_CNTL,
hbb << 5 |
level3_swizzling_dis << 4 |
level2_swizzling_dis << 3);
a8xx_write_pipe(gpu, PIPE_BR, REG_A8XX_GRAS_NC_MODE_CNTL,
hbb << 5 |
level3_swizzling_dis << 4 |
level2_swizzling_dis << 3);
a8xx_write_pipe(gpu, PIPE_BR, REG_A8XX_RB_CCU_NC_MODE_CNTL,
yuvnotcomptofc << 6 |
level3_swizzling_dis << 5 |
level2_swizzling_dis << 4 |
hbb_hi << 3 |
hbb_lo << 1);
a8xx_write_pipe(gpu, PIPE_BR, REG_A8XX_RB_CMP_NC_MODE_CNTL,
mode << 15 |
yuvnotcomptofc << 6 |
rgba8888_lossless << 4 |
fp16compoptdis << 3 |
rgb565_predicator << 2 |
amsbc << 1 |
min_acc_len_64b);
a8xx_aperture_clear(gpu);
Annotation
- Immediate include surface: `msm_gem.h`, `msm_mmu.h`, `msm_gpu_trace.h`, `a6xx_gpu.h`, `a6xx_gmu.xml.h`, `linux/bitfield.h`, `linux/devfreq.h`, `linux/firmware/qcom/qcom_scm.h`.
- Detected declarations: `function a8xx_aperture_slice_set`, `function a8xx_aperture_acquire`, `function a8xx_aperture_release`, `function a8xx_aperture_clear`, `function a8xx_write_pipe`, `function a8xx_read_pipe_slice`, `function a8xx_gpu_get_slice_info`, `function a8xx_get_first_slice`, `function _a8xx_check_idle`, `function a8xx_idle`.
- 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.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.