drivers/gpu/drm/radeon/r100.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/radeon/r100.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/radeon/r100.c- Extension
.c- Size
- 120117 bytes
- Lines
- 4163
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/debugfs.hlinux/firmware.hlinux/module.hlinux/pci.hlinux/seq_file.hlinux/slab.hdrm/drm_device.hdrm/drm_file.hdrm/drm_fourcc.hdrm/drm_framebuffer.hdrm/drm_vblank.hdrm/radeon_drm.hatom.hr100_reg_safe.hr100d.hradeon.hradeon_asic.hradeon_reg.hrn50_reg_safe.hrs100d.hrv200d.hrv250d.hr100_track.h
Detected Declarations
function r100_is_in_vblankfunction r100_is_counter_movingfunction crtcfunction pageflipfunction pendingfunction GPUfunction r100_pm_init_profilefunction r100_pm_miscfunction changefunction changefunction GUIfunction connectedfunction pinfunction cardfunction list_for_each_entryfunction cardfunction list_for_each_entryfunction r100_pci_gart_tlb_flushfunction r100_pci_gart_enablefunction r100_pci_gart_disablefunction r100_pci_gart_get_page_entryfunction r100_pci_gart_set_pagefunction r100_pci_gart_finifunction r100_irq_setfunction atomic_readfunction atomic_readfunction r100_irq_disablefunction r100_irq_ackfunction r100_irq_processfunction r100_get_vblank_counterfunction r100_ring_hdp_flushfunction spacefunction r100_semaphore_ring_emitfunction r100_cp_wait_for_idlefunction r100_ring_startfunction r100_cp_init_microcodefunction r100_gfx_get_rptrfunction r100_gfx_get_wptrfunction r100_gfx_set_wptrfunction r100_cp_load_microcodefunction r100_cp_initfunction r100_cp_finifunction r100_cp_disablefunction r100_reloc_pitch_offsetfunction r100_packet3_load_vbpntrfunction r100_cs_parse_packet0function entryfunction r100_cs_packet_parse_vline
Annotated Snippet
if (i++ % 100 == 0) {
if (!r100_is_counter_moving(rdev, crtc))
break;
}
}
while (!r100_is_in_vblank(rdev, crtc)) {
if (i++ % 100 == 0) {
if (!r100_is_counter_moving(rdev, crtc))
break;
}
}
}
/**
* r100_page_flip - pageflip callback.
*
* @rdev: radeon_device pointer
* @crtc_id: crtc to cleanup pageflip on
* @crtc_base: new address of the crtc (GPU MC address)
* @async: asynchronous flip
*
* Does the actual pageflip (r1xx-r4xx).
* During vblank we take the crtc lock and wait for the update_pending
* bit to go high, when it does, we release the lock, and allow the
* double buffered update to take place.
*/
void r100_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];
uint32_t crtc_pitch, pitch_pixels;
struct drm_framebuffer *fb = radeon_crtc->base.primary->fb;
u32 tmp = ((u32)crtc_base) | RADEON_CRTC_OFFSET__OFFSET_LOCK;
int i;
/* Lock the graphics update lock */
/* update the scanout addresses */
WREG32(RADEON_CRTC_OFFSET + radeon_crtc->crtc_offset, tmp);
/* update pitch */
pitch_pixels = fb->pitches[0] / fb->format->cpp[0];
crtc_pitch = DIV_ROUND_UP(pitch_pixels * fb->format->cpp[0] * 8,
fb->format->cpp[0] * 8 * 8);
crtc_pitch |= crtc_pitch << 16;
WREG32(RADEON_CRTC_PITCH + radeon_crtc->crtc_offset, crtc_pitch);
/* Wait for update_pending to go high. */
for (i = 0; i < rdev->usec_timeout; i++) {
if (RREG32(RADEON_CRTC_OFFSET + radeon_crtc->crtc_offset) & RADEON_CRTC_OFFSET__GUI_TRIG_OFFSET)
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 &= ~RADEON_CRTC_OFFSET__OFFSET_LOCK;
WREG32(RADEON_CRTC_OFFSET + radeon_crtc->crtc_offset, tmp);
}
/**
* r100_page_flip_pending - check if page flip is still pending
*
* @rdev: radeon_device pointer
* @crtc_id: crtc to check
*
* Check if the last pagefilp is still pending (r1xx-r4xx).
* Returns the current update pending status.
*/
bool r100_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(RADEON_CRTC_OFFSET + radeon_crtc->crtc_offset) &
RADEON_CRTC_OFFSET__GUI_TRIG_OFFSET);
}
/**
* r100_pm_get_dynpm_state - look up dynpm power state callback.
*
* @rdev: radeon_device pointer
*
* Look up the optimal power state based on the
* current state of the GPU (r1xx-r5xx).
* Used for dynpm only.
*/
void r100_pm_get_dynpm_state(struct radeon_device *rdev)
{
int i;
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/firmware.h`, `linux/module.h`, `linux/pci.h`, `linux/seq_file.h`, `linux/slab.h`, `drm/drm_device.h`, `drm/drm_file.h`.
- Detected declarations: `function r100_is_in_vblank`, `function r100_is_counter_moving`, `function crtc`, `function pageflip`, `function pending`, `function GPU`, `function r100_pm_init_profile`, `function r100_pm_misc`, `function change`, `function change`.
- 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.