drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c- Extension
.c- Size
- 59083 bytes
- Lines
- 1919
- 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
drm/amdgpu_drm.hamdgpu.hamdgpu_i2c.hatom.hamdgpu_connectors.hamdgpu_display.hsoc15_common.hgc/gc_11_0_0_offset.hgc/gc_11_0_0_sh_mask.hbif/bif_4_1_d.hasm/div64.hlinux/pci.hlinux/pm_runtime.hdrm/drm_crtc_helper.hdrm/drm_damage_helper.hdrm/drm_drv.hdrm/drm_edid.hdrm/drm_fb_helper.hdrm/drm_gem_framebuffer_helper.hdrm/drm_fourcc.hdrm/drm_modeset_helper.hdrm/drm_vblank.h
Detected Declarations
function filesfunction amdgpu_display_flip_callbackfunction amdgpu_display_flip_handle_fencefunction amdgpu_display_flip_work_funcfunction amdgpu_get_vblank_counter_kmsfunction amdgpu_display_unpin_work_funcfunction amdgpu_display_crtc_page_flip_targetfunction amdgpu_display_crtc_set_configfunction amdgpu_display_print_display_setupfunction list_for_each_entryfunction amdgpu_display_ddc_probefunction drm_edid_block_validfunction amdgpu_dirtyfbfunction amdgpu_display_supported_domainsfunction lookup_format_infofunction amdgpu_lookup_format_infofunction extract_render_dcc_offsetfunction convert_tiling_flags_to_modifier_gfx12function convert_tiling_flags_to_modifierfunction check_tiling_flags_gfx6function get_block_dimensionsfunction get_dcc_block_sizefunction amdgpu_display_verify_planefunction amdgpu_display_verify_sizesfunction amdgpu_display_get_fb_infofunction amdgpu_display_gem_fb_verify_and_initfunction amdgpu_display_framebuffer_initfunction amdgpu_display_user_framebuffer_createfunction amdgpu_display_setup_abm_propfunction amdgpu_display_modeset_create_propsfunction amdgpu_display_update_priorityfunction amdgpu_display_is_hdtv_modefunction amdgpu_display_crtc_scaling_mode_fixupfunction list_for_each_entryfunction amdgpu_display_get_crtc_scanoutposfunction amdgpu_display_crtc_idx_to_irq_typefunction amdgpu_crtc_get_scanout_positionfunction amdgpu_display_suspend_helperfunction amdgpu_display_resume_helperfunction amdgpu_device_mm_accessfunction amdgpu_display_get_scanout_bufferfunction ttm_bo_kmap
Annotated Snippet
amdgpu_get_vblank_counter_kms(crtc)) > 0) {
schedule_delayed_work(&work->flip_work, usecs_to_jiffies(1000));
return;
}
/* We borrow the event spin lock for protecting flip_status */
spin_lock_irqsave(&crtc->dev->event_lock, flags);
/* Do the flip (mmio) */
adev->mode_info.funcs->page_flip(adev, work->crtc_id, work->base, work->async);
/* Set the flip status */
amdgpu_crtc->pflip_status = AMDGPU_FLIP_SUBMITTED;
spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
drm_dbg_vbl(adev_to_drm(adev),
"crtc:%d[%p], pflip_stat:AMDGPU_FLIP_SUBMITTED, work: %p,\n",
amdgpu_crtc->crtc_id, amdgpu_crtc, work);
}
/*
* Handle unpin events outside the interrupt handler proper.
*/
static void amdgpu_display_unpin_work_func(struct work_struct *__work)
{
struct amdgpu_flip_work *work =
container_of(__work, struct amdgpu_flip_work, unpin_work);
int r;
/* unpin of the old buffer */
r = amdgpu_bo_reserve(work->old_abo, true);
if (likely(r == 0)) {
amdgpu_bo_unpin(work->old_abo);
amdgpu_bo_unreserve(work->old_abo);
} else
DRM_ERROR("failed to reserve buffer after flip\n");
amdgpu_bo_unref(&work->old_abo);
kfree(work->shared);
kfree(work);
}
int amdgpu_display_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 amdgpu_device *adev = drm_to_adev(dev);
struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
struct drm_gem_object *obj;
struct amdgpu_flip_work *work;
struct amdgpu_bo *new_abo;
unsigned long flags;
u64 tiling_flags;
int i, r;
work = kzalloc_obj(*work);
if (work == NULL)
return -ENOMEM;
INIT_DELAYED_WORK(&work->flip_work, amdgpu_display_flip_work_func);
INIT_WORK(&work->unpin_work, amdgpu_display_unpin_work_func);
work->event = event;
work->adev = adev;
work->crtc_id = amdgpu_crtc->crtc_id;
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 */
work->old_abo = gem_to_amdgpu_bo(obj);
amdgpu_bo_ref(work->old_abo);
obj = fb->obj[0];
new_abo = gem_to_amdgpu_bo(obj);
/* pin the new buffer */
r = amdgpu_bo_reserve(new_abo, false);
if (unlikely(r != 0)) {
DRM_ERROR("failed to reserve new abo buffer before flip\n");
goto cleanup;
}
if (!adev->enable_virtual_display) {
Annotation
- Immediate include surface: `drm/amdgpu_drm.h`, `amdgpu.h`, `amdgpu_i2c.h`, `atom.h`, `amdgpu_connectors.h`, `amdgpu_display.h`, `soc15_common.h`, `gc/gc_11_0_0_offset.h`.
- Detected declarations: `function files`, `function amdgpu_display_flip_callback`, `function amdgpu_display_flip_handle_fence`, `function amdgpu_display_flip_work_func`, `function amdgpu_get_vblank_counter_kms`, `function amdgpu_display_unpin_work_func`, `function amdgpu_display_crtc_page_flip_target`, `function amdgpu_display_crtc_set_config`, `function amdgpu_display_print_display_setup`, `function list_for_each_entry`.
- 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.