drivers/gpu/drm/radeon/rs600.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/radeon/rs600.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/radeon/rs600.c- Extension
.c- Size
- 34486 bytes
- Lines
- 1168
- 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
linux/io-64-nonatomic-lo-hi.hlinux/pci.hdrm/drm_device.hdrm/drm_vblank.hdrm/drm_fourcc.hdrm/drm_framebuffer.hatom.hradeon.hradeon_asic.hradeon_audio.hrs600_reg_safe.hrs600d.h
Detected Declarations
function avivo_is_in_vblankfunction avivo_is_counter_movingfunction crtcfunction rs600_page_flipfunction rs600_page_flip_pendingfunction avivo_program_fmtfunction rs600_pm_miscfunction rs600_pm_preparefunction rs600_pm_finishfunction rs600_hpd_sensefunction rs600_hpd_set_polarityfunction rs600_hpd_initfunction list_for_each_entryfunction rs600_hpd_finifunction list_for_each_entryfunction rs600_asic_resetfunction rs600_gart_tlb_flushfunction rs600_gart_initfunction rs600_gart_enablefunction rs600_gart_disablefunction rs600_gart_finifunction rs600_gart_get_page_entryfunction rs600_gart_set_pagefunction rs600_irq_setfunction atomic_readfunction atomic_readfunction rs600_irq_ackfunction rs600_irq_disablefunction rs600_irq_processfunction rs600_get_vblank_counterfunction rs600_mc_wait_for_idlefunction rs600_gpu_initfunction rs600_mc_initfunction rs600_bandwidth_updatefunction rs600_mc_rregfunction rs600_mc_wregfunction rs600_set_safe_registersfunction rs600_mc_programfunction rs600_startupfunction rs600_resumefunction rs600_suspendfunction rs600_finifunction rs600_init
Annotated Snippet
if (i++ % 100 == 0) {
if (!avivo_is_counter_moving(rdev, crtc))
break;
}
}
while (!avivo_is_in_vblank(rdev, crtc)) {
if (i++ % 100 == 0) {
if (!avivo_is_counter_moving(rdev, crtc))
break;
}
}
}
void rs600_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base, bool async)
{
struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id];
struct drm_framebuffer *fb = radeon_crtc->base.primary->fb;
u32 tmp = RREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset);
int i;
/* Lock the graphics update lock */
tmp |= AVIVO_D1GRPH_UPDATE_LOCK;
WREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset, tmp);
/* flip at hsync for async, default is vsync */
WREG32(AVIVO_D1GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset,
async ? AVIVO_D1GRPH_SURFACE_UPDATE_H_RETRACE_EN : 0);
/* update pitch */
WREG32(AVIVO_D1GRPH_PITCH + radeon_crtc->crtc_offset,
fb->pitches[0] / fb->format->cpp[0]);
/* update the scanout addresses */
WREG32(AVIVO_D1GRPH_SECONDARY_SURFACE_ADDRESS + radeon_crtc->crtc_offset,
(u32)crtc_base);
WREG32(AVIVO_D1GRPH_PRIMARY_SURFACE_ADDRESS + radeon_crtc->crtc_offset,
(u32)crtc_base);
/* Wait for update_pending to go high. */
for (i = 0; i < rdev->usec_timeout; i++) {
if (RREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset) & AVIVO_D1GRPH_SURFACE_UPDATE_PENDING)
break;
udelay(1);
}
DRM_DEBUG("Update pending now high. Unlocking vupdate_lock.\n");
/* Unlock the lock, so double-buffering can take place inside vblank */
tmp &= ~AVIVO_D1GRPH_UPDATE_LOCK;
WREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset, tmp);
}
bool rs600_page_flip_pending(struct radeon_device *rdev, int crtc_id)
{
struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id];
/* Return current update_pending status: */
return !!(RREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset) &
AVIVO_D1GRPH_SURFACE_UPDATE_PENDING);
}
void avivo_program_fmt(struct drm_encoder *encoder)
{
struct drm_device *dev = encoder->dev;
struct radeon_device *rdev = dev->dev_private;
struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
struct drm_connector *connector = radeon_get_connector_for_encoder(encoder);
int bpc = 0;
u32 tmp = 0;
enum radeon_connector_dither dither = RADEON_FMT_DITHER_DISABLE;
if (connector) {
struct radeon_connector *radeon_connector = to_radeon_connector(connector);
bpc = radeon_get_monitor_bpc(connector);
dither = radeon_connector->dither;
}
/* LVDS FMT is set up by atom */
if (radeon_encoder->devices & ATOM_DEVICE_LCD_SUPPORT)
return;
if (bpc == 0)
return;
switch (bpc) {
case 6:
if (dither == RADEON_FMT_DITHER_ENABLE)
/* XXX sort out optimal dither settings */
tmp |= AVIVO_TMDS_BIT_DEPTH_CONTROL_SPATIAL_DITHER_EN;
else
tmp |= AVIVO_TMDS_BIT_DEPTH_CONTROL_TRUNCATE_EN;
break;
Annotation
- Immediate include surface: `linux/io-64-nonatomic-lo-hi.h`, `linux/pci.h`, `drm/drm_device.h`, `drm/drm_vblank.h`, `drm/drm_fourcc.h`, `drm/drm_framebuffer.h`, `atom.h`, `radeon.h`.
- Detected declarations: `function avivo_is_in_vblank`, `function avivo_is_counter_moving`, `function crtc`, `function rs600_page_flip`, `function rs600_page_flip_pending`, `function avivo_program_fmt`, `function rs600_pm_misc`, `function rs600_pm_prepare`, `function rs600_pm_finish`, `function rs600_hpd_sense`.
- 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.