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.

Dependency Surface

Detected Declarations

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

Implementation Notes