drivers/gpu/drm/amd/display/modules/power/power_replay.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/display/modules/power/power_replay.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/display/modules/power/power_replay.c- Extension
.c- Size
- 27996 bytes
- Lines
- 912
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
dm_services.hdc.hmod_power.hcore_types.hdmcu.habm.hpower_helpers.hdce/dmub_psr.hdal_asic_id.hlink_service.hlinux/math.hdc/inc/hw/dmcu.hdc/inc/hw/abm.hdmub_cmd.h
Detected Declarations
function container_offunction mod_power_replay_setup_power_optfunction mod_power_replay_set_power_optfunction mod_power_get_replay_eventfunction mod_power_update_replay_active_statusfunction mod_power_replay_set_coasting_vtotalfunction mod_power_replay_set_timing_sync_supportedfunction mod_power_replay_disabled_adaptive_sync_sdpfunction mod_power_replay_set_general_cmdfunction mod_power_replay_disabled_desync_error_detectionfunction mod_power_replay_set_pseudo_vtotalfunction mod_power_update_error_statusfunction mod_power_set_low_rr_activatefunction mod_power_set_video_conferencing_activatefunction mod_power_set_coasting_vtotal_without_frame_updatefunction mod_power_set_replay_continuously_resyncfunction mod_power_set_live_capture_with_cvt_activatefunction mod_power_set_replay_eventfunction mod_power_get_replay_active_statusfunction mod_power_replay_residencyfunction mod_power_replay_set_power_opt_and_coasting_vtotalfunction mod_power_replay_notify_mode_changefunction init_replay_configfunction set_replay_frame_skip_numberfunction set_replay_defer_update_coasting_vtotalfunction update_replay_coasting_vtotal_from_deferfunction set_replay_coasting_vtotalfunction set_replay_low_rr_full_screen_video_src_vtotalfunction calculate_replay_link_off_frame_countfunction reset_replay_dsync_error_count
Annotated Snippet
if (replay_active) {
if (state != REPLAY_STATE_0 &&
(!force_static || state == REPLAY_STATE_3))
break;
} else {
if (state == REPLAY_STATE_0)
break;
}
udelay(500);
}
/* assert if max retry hit */
if (retry_count >= max_retry)
ASSERT(0);
} else {
/* To-do: Add trace log */
}
return true;
}
static unsigned int mod_power_replay_setup_power_opt(struct dc_link *link,
unsigned int active_replay_events, bool is_ultra_sleep_mode)
{
unsigned int power_opt = 0;
if (is_ultra_sleep_mode) {
/* Static Screen */
power_opt |= (replay_power_opt_smu_opt_static_screen | replay_power_opt_z10_static_screen);
} else if (active_replay_events & replay_event_test_harness_ultra_sleep) {
power_opt |= replay_power_opt_z10_static_screen;
}
/* replay_power_opt_flag is a configuration parameter into the module that determines
* which optimizations to enable during replay
*/
power_opt &= link->replay_settings.config.replay_power_opt_supported;
return power_opt;
}
static bool mod_power_replay_set_power_opt(struct mod_power *mod_power,
struct dc_stream_state *stream,
unsigned int active_replay_events,
bool is_ultra_sleep_mode)
{
(void)mod_power;
struct dc_link *link = NULL;
unsigned int power_opt = 0;
if (!stream)
return false;
link = dc_stream_get_link(stream);
if (!link || !link->replay_settings.replay_feature_enabled)
return false;
power_opt = mod_power_replay_setup_power_opt(link, active_replay_events, is_ultra_sleep_mode);
if (!dc_link_set_replay_allow_active(link, NULL, false, false, &power_opt))
return false;
return true;
}
bool mod_power_get_replay_event(struct mod_power *mod_power,
struct dc_stream_state *stream,
unsigned int *active_replay_events)
{
struct core_power *core_power = NULL;
unsigned int stream_index = 0;
if (mod_power == NULL)
return false;
core_power = MOD_POWER_TO_CORE(mod_power);
if (core_power->num_entities == 0)
return false;
stream_index = map_index_from_stream(core_power, stream);
*active_replay_events = core_power->map[stream_index].replay_events;
return true;
}
static bool mod_power_update_replay_active_status(unsigned int active_replay_events,
struct dc_link *link, uint32_t *coasting_vtotal, bool *is_full_screen_video,
Annotation
- Immediate include surface: `dm_services.h`, `dc.h`, `mod_power.h`, `core_types.h`, `dmcu.h`, `abm.h`, `power_helpers.h`, `dce/dmub_psr.h`.
- Detected declarations: `function container_of`, `function mod_power_replay_setup_power_opt`, `function mod_power_replay_set_power_opt`, `function mod_power_get_replay_event`, `function mod_power_update_replay_active_status`, `function mod_power_replay_set_coasting_vtotal`, `function mod_power_replay_set_timing_sync_supported`, `function mod_power_replay_disabled_adaptive_sync_sdp`, `function mod_power_replay_set_general_cmd`, `function mod_power_replay_disabled_desync_error_detection`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
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.