drivers/gpu/drm/radeon/radeon_legacy_crtc.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/radeon/radeon_legacy_crtc.c- Extension
.c- Size
- 33093 bytes
- Lines
- 1115
- 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
drm/drm_fixed.hdrm/drm_fourcc.hdrm/drm_framebuffer.hdrm/drm_modeset_helper_vtables.hdrm/drm_vblank.hdrm/radeon_drm.hatom.hradeon.h
Detected Declarations
function filesfunction radeon_legacy_rmx_mode_setfunction radeon_pll_wait_for_read_update_completefunction radeon_pll_write_updatefunction radeon_pll2_wait_for_read_update_completefunction radeon_pll2_write_updatefunction radeon_compute_pll_gainfunction radeon_crtc_dpmsfunction radeon_crtc_set_basefunction radeon_crtc_do_set_basefunction radeon_set_crtc_timingfunction radeon_set_pllfunction list_for_each_entryfunction radeon_crtc_mode_fixupfunction radeon_crtc_mode_setfunction radeon_crtc_preparefunction radeon_crtc_commitfunction radeon_crtc_disablefunction radeon_legacy_init_crtc
Annotated Snippet
if (fb && fb != crtc->primary->fb) {
struct radeon_bo *old_rbo;
unsigned long nsize, osize;
old_rbo = gem_to_radeon_bo(fb->obj[0]);
osize = radeon_bo_size(old_rbo);
nsize = radeon_bo_size(rbo);
if (nsize <= osize && !radeon_bo_reserve(old_rbo, false)) {
radeon_bo_unpin(old_rbo);
radeon_bo_unreserve(old_rbo);
fb = NULL;
goto retry;
}
}
return -EINVAL;
}
radeon_bo_get_tiling_flags(rbo, &tiling_flags, NULL);
radeon_bo_unreserve(rbo);
if (tiling_flags & RADEON_TILING_MICRO)
DRM_ERROR("trying to scanout microtiled buffer\n");
/* if scanout was in GTT this really wouldn't work */
/* crtc offset is from display base addr not FB location */
radeon_crtc->legacy_display_base_addr = rdev->mc.vram_start;
base -= radeon_crtc->legacy_display_base_addr;
crtc_offset_cntl = 0;
pitch_pixels = target_fb->pitches[0] / target_fb->format->cpp[0];
crtc_pitch = DIV_ROUND_UP(pitch_pixels * target_fb->format->cpp[0] * 8,
target_fb->format->cpp[0] * 8 * 8);
crtc_pitch |= crtc_pitch << 16;
crtc_offset_cntl |= RADEON_CRTC_GUI_TRIG_OFFSET_LEFT_EN;
if (tiling_flags & RADEON_TILING_MACRO) {
if (ASIC_IS_R300(rdev))
crtc_offset_cntl |= (R300_CRTC_X_Y_MODE_EN |
R300_CRTC_MICRO_TILE_BUFFER_DIS |
R300_CRTC_MACRO_TILE_EN);
else
crtc_offset_cntl |= RADEON_CRTC_TILE_EN;
} else {
if (ASIC_IS_R300(rdev))
crtc_offset_cntl &= ~(R300_CRTC_X_Y_MODE_EN |
R300_CRTC_MICRO_TILE_BUFFER_DIS |
R300_CRTC_MACRO_TILE_EN);
else
crtc_offset_cntl &= ~RADEON_CRTC_TILE_EN;
}
if (tiling_flags & RADEON_TILING_MACRO) {
if (ASIC_IS_R300(rdev)) {
crtc_tile_x0_y0 = x | (y << 16);
base &= ~0x7ff;
} else {
int byteshift = target_fb->format->cpp[0] * 8 >> 4;
int tile_addr = (((y >> 3) * pitch_pixels + x) >> (8 - byteshift)) << 11;
base += tile_addr + ((x << byteshift) % 256) + ((y % 8) << 8);
crtc_offset_cntl |= (y % 16);
}
} else {
int offset = y * pitch_pixels + x;
switch (target_fb->format->cpp[0] * 8) {
case 8:
offset *= 1;
break;
case 15:
case 16:
offset *= 2;
break;
case 24:
offset *= 3;
break;
case 32:
offset *= 4;
break;
default:
return false;
}
base += offset;
}
base &= ~7;
if (radeon_crtc->crtc_id == 1)
gen_cntl_reg = RADEON_CRTC2_GEN_CNTL;
else
gen_cntl_reg = RADEON_CRTC_GEN_CNTL;
Annotation
- Immediate include surface: `drm/drm_fixed.h`, `drm/drm_fourcc.h`, `drm/drm_framebuffer.h`, `drm/drm_modeset_helper_vtables.h`, `drm/drm_vblank.h`, `drm/radeon_drm.h`, `atom.h`, `radeon.h`.
- Detected declarations: `function files`, `function radeon_legacy_rmx_mode_set`, `function radeon_pll_wait_for_read_update_complete`, `function radeon_pll_write_update`, `function radeon_pll2_wait_for_read_update_complete`, `function radeon_pll2_write_update`, `function radeon_compute_pll_gain`, `function radeon_crtc_dpms`, `function radeon_crtc_set_base`, `function radeon_crtc_do_set_base`.
- 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.