drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c- Extension
.c- Size
- 22628 bytes
- Lines
- 778
- 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/drm_vblank.hdrm/drm_atomic_helper.hdc.hamdgpu.hamdgpu_dm_psr.hamdgpu_dm_replay.hamdgpu_dm_crtc.hamdgpu_dm_plane.hamdgpu_dm_trace.hamdgpu_dm_debugfs.hmodules/inc/mod_power.h
Detected Declarations
function filesfunction amdgpu_dm_crtc_modeset_requiredfunction amdgpu_dm_crtc_vrr_active_irqfunction amdgpu_dm_crtc_set_vupdate_irqfunction amdgpu_dm_crtc_vrr_activefunction amdgpu_dm_crtc_set_static_screen_optimzefunction amdgpu_dm_is_headlessfunction amdgpu_dm_idle_workerfunction amdgpu_dm_crtc_vblank_control_workerfunction amdgpu_dm_crtc_set_vblankfunction amdgpu_dm_crtc_enable_vblankfunction amdgpu_dm_crtc_disable_vblankfunction amdgpu_dm_crtc_destroy_statefunction amdgpu_dm_crtc_destroyfunction amdgpu_dm_crtc_reset_statefunction amdgpu_dm_crtc_late_registerfunction dm_crtc_additional_color_mgmtfunction amdgpu_dm_atomic_crtc_set_propertyfunction amdgpu_dm_atomic_crtc_get_propertyfunction amdgpu_dm_crtc_helper_disablefunction drm_for_each_plane_maskfunction amdgpu_dm_crtc_update_crtc_active_planesfunction amdgpu_dm_crtc_helper_mode_fixupfunction amdgpu_dm_crtc_helper_atomic_checkfunction amdgpu_dm_crtc_init
Annotated Snippet
if (connector->status == connector_status_connected) {
is_headless = false;
break;
}
}
drm_connector_list_iter_end(&iter);
return is_headless;
}
static void amdgpu_dm_idle_worker(struct work_struct *work)
{
struct idle_workqueue *idle_work;
idle_work = container_of(work, struct idle_workqueue, work);
idle_work->dm->idle_workqueue->running = true;
while (idle_work->enable) {
fsleep(HPD_DETECTION_PERIOD_uS);
mutex_lock(&idle_work->dm->dc_lock);
if (!idle_work->dm->dc->idle_optimizations_allowed) {
mutex_unlock(&idle_work->dm->dc_lock);
break;
}
dc_allow_idle_optimizations(idle_work->dm->dc, false);
mutex_unlock(&idle_work->dm->dc_lock);
fsleep(HPD_DETECTION_TIME_uS);
mutex_lock(&idle_work->dm->dc_lock);
if (!amdgpu_dm_is_headless(idle_work->dm->adev) &&
!amdgpu_dm_psr_is_active_allowed(idle_work->dm)) {
mutex_unlock(&idle_work->dm->dc_lock);
break;
}
if (idle_work->enable) {
dc_post_update_surfaces_to_stream(idle_work->dm->dc);
dc_allow_idle_optimizations(idle_work->dm->dc, true);
}
mutex_unlock(&idle_work->dm->dc_lock);
}
idle_work->dm->idle_workqueue->running = false;
}
struct idle_workqueue *idle_create_workqueue(struct amdgpu_device *adev)
{
struct idle_workqueue *idle_work;
idle_work = kzalloc_obj(*idle_work);
if (ZERO_OR_NULL_PTR(idle_work))
return NULL;
idle_work->dm = &adev->dm;
idle_work->enable = false;
idle_work->running = false;
INIT_WORK(&idle_work->work, amdgpu_dm_idle_worker);
return idle_work;
}
static void amdgpu_dm_crtc_vblank_control_worker(struct work_struct *work)
{
struct vblank_control_work *vblank_work =
container_of(work, struct vblank_control_work, work);
struct amdgpu_display_manager *dm = vblank_work->dm;
mutex_lock(&dm->dc_lock);
if (vblank_work->enable) {
dm->active_vblank_irq_count++;
amdgpu_dm_ism_commit_event(&vblank_work->acrtc->ism,
DM_ISM_EVENT_EXIT_IDLE_REQUESTED);
} else {
if (dm->active_vblank_irq_count > 0)
dm->active_vblank_irq_count--;
amdgpu_dm_ism_commit_event(&vblank_work->acrtc->ism,
DM_ISM_EVENT_ENTER_IDLE_REQUESTED);
}
mutex_unlock(&dm->dc_lock);
dc_stream_release(vblank_work->stream);
kfree(vblank_work);
}
static inline int amdgpu_dm_crtc_set_vblank(struct drm_crtc *crtc, bool enable)
{
struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
struct amdgpu_device *adev = drm_to_adev(crtc->dev);
Annotation
- Immediate include surface: `drm/drm_vblank.h`, `drm/drm_atomic_helper.h`, `dc.h`, `amdgpu.h`, `amdgpu_dm_psr.h`, `amdgpu_dm_replay.h`, `amdgpu_dm_crtc.h`, `amdgpu_dm_plane.h`.
- Detected declarations: `function files`, `function amdgpu_dm_crtc_modeset_required`, `function amdgpu_dm_crtc_vrr_active_irq`, `function amdgpu_dm_crtc_set_vupdate_irq`, `function amdgpu_dm_crtc_vrr_active`, `function amdgpu_dm_crtc_set_static_screen_optimze`, `function amdgpu_dm_is_headless`, `function amdgpu_dm_idle_worker`, `function amdgpu_dm_crtc_vblank_control_worker`, `function amdgpu_dm_crtc_set_vblank`.
- 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.