drivers/gpu/drm/radeon/radeon_display.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/radeon/radeon_display.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/radeon/radeon_display.c- Extension
.c- Size
- 62211 bytes
- Lines
- 2006
- 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.
- 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/pci.hlinux/pm_runtime.hlinux/gcd.hasm/div64.hdrm/drm_crtc_helper.hdrm/drm_device.hdrm/drm_drv.hdrm/drm_edid.hdrm/drm_fourcc.hdrm/drm_framebuffer.hdrm/drm_gem_framebuffer_helper.hdrm/drm_modeset_helper.hdrm/drm_probe_helper.hdrm/drm_vblank.hdrm/radeon_drm.hdrm/drm_print.hatom.hradeon.hradeon_kms.h
Detected Declarations
function filesfunction dce4_crtc_load_lutfunction dce5_crtc_load_lutfunction legacy_crtc_load_lutfunction radeon_crtc_load_lutfunction radeon_crtc_gamma_setfunction radeon_crtc_destroyfunction radeon_unpin_work_funcfunction radeon_crtc_handle_vblankfunction radeon_get_crtc_scanoutposfunction radeon_crtc_handle_flipfunction radeon_flip_work_funcfunction radeon_crtc_page_flip_targetfunction radeon_crtc_set_configfunction radeon_crtc_initfunction radeon_print_display_setupfunction list_for_each_entryfunction radeon_setup_enc_connfunction avivo_reduce_ratiofunction avivo_get_fb_ref_divfunction radeon_compute_pll_avivofunction radeon_divfunction radeon_compute_pll_legacyfunction radeon_framebuffer_initfunction radeon_user_framebuffer_createfunction radeon_modeset_create_propsfunction radeon_update_display_priorityfunction radeon_afmt_initfunction radeon_afmt_finifunction radeon_modeset_initfunction radeon_modeset_finifunction is_hdtv_modefunction radeon_crtc_scaling_mode_fixupfunction list_for_each_entryfunction radeon_get_crtc_scanoutposfunction radeon_get_crtc_scanout_position
Annotated Snippet
if (fence && fence->rdev == rdev) {
r = radeon_fence_wait(fence, false);
if (r == -EDEADLK) {
up_read(&rdev->exclusive_lock);
do {
r = radeon_gpu_reset(rdev);
} while (r == -EAGAIN);
down_read(&rdev->exclusive_lock);
}
} else
r = dma_fence_wait(work->fence, false);
if (r)
drm_err(dev, "failed to wait on page flip fence (%d)!\n", r);
/* We continue with the page flip even if we failed to wait on
* the fence, otherwise the DRM core and userspace will be
* confused about which BO the CRTC is scanning out
*/
dma_fence_put(work->fence);
work->fence = NULL;
}
/* Wait until we're out of the vertical blank period before the one
* targeted by the flip. Always wait on pre DCE4 to avoid races with
* flip completion handling from vblank irq, as these old asics don't
* have reliable pageflip completion interrupts.
*/
while (radeon_crtc->enabled &&
(radeon_get_crtc_scanoutpos(dev, work->crtc_id, 0,
&vpos, &hpos, NULL, NULL,
&crtc->hwmode)
& (DRM_SCANOUTPOS_VALID | DRM_SCANOUTPOS_IN_VBLANK)) ==
(DRM_SCANOUTPOS_VALID | DRM_SCANOUTPOS_IN_VBLANK) &&
(!ASIC_IS_AVIVO(rdev) ||
((int) (work->target_vblank -
crtc->funcs->get_vblank_counter(crtc)) > 0)))
usleep_range(1000, 2000);
/* We borrow the event spin lock for protecting flip_status */
spin_lock_irqsave(&crtc->dev->event_lock, flags);
/* set the proper interrupt */
radeon_irq_kms_pflip_irq_get(rdev, radeon_crtc->crtc_id);
/* do the flip (mmio) */
radeon_page_flip(rdev, radeon_crtc->crtc_id, work->base, work->async);
radeon_crtc->flip_status = RADEON_FLIP_SUBMITTED;
spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
up_read(&rdev->exclusive_lock);
}
static int radeon_crtc_page_flip_target(struct drm_crtc *crtc,
struct drm_framebuffer *fb,
struct drm_pending_vblank_event *event,
uint32_t page_flip_flags,
uint32_t target,
struct drm_modeset_acquire_ctx *ctx)
{
struct drm_device *dev = crtc->dev;
struct radeon_device *rdev = dev->dev_private;
struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
struct drm_gem_object *obj;
struct radeon_flip_work *work;
struct radeon_bo *new_rbo;
uint32_t tiling_flags, pitch_pixels;
uint64_t base;
unsigned long flags;
int r;
work = kzalloc_obj(*work);
if (work == NULL)
return -ENOMEM;
INIT_WORK(&work->flip_work, radeon_flip_work_func);
INIT_WORK(&work->unpin_work, radeon_unpin_work_func);
work->rdev = rdev;
work->crtc_id = radeon_crtc->crtc_id;
work->event = event;
work->async = (page_flip_flags & DRM_MODE_PAGE_FLIP_ASYNC) != 0;
/* schedule unpin of the old buffer */
obj = crtc->primary->fb->obj[0];
/* take a reference to the old object */
drm_gem_object_get(obj);
work->old_rbo = gem_to_radeon_bo(obj);
Annotation
- Immediate include surface: `linux/pci.h`, `linux/pm_runtime.h`, `linux/gcd.h`, `asm/div64.h`, `drm/drm_crtc_helper.h`, `drm/drm_device.h`, `drm/drm_drv.h`, `drm/drm_edid.h`.
- Detected declarations: `function files`, `function dce4_crtc_load_lut`, `function dce5_crtc_load_lut`, `function legacy_crtc_load_lut`, `function radeon_crtc_load_lut`, `function radeon_crtc_gamma_set`, `function radeon_crtc_destroy`, `function radeon_unpin_work_func`, `function radeon_crtc_handle_vblank`, `function radeon_get_crtc_scanoutpos`.
- 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.
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.