From 2f4afc5733d41c7a8c666f76465008457371d453 Mon Sep 17 00:00:00 2001 From: Rex Zhu Date: Fri, 16 Oct 2015 14:59:17 +0800 Subject: [PATCH] drm/amdgpu/powerplay: implement pem_task for display_configuration_change Add support for display configuration changes to the event manager. Signed-off-by: Rex Zhu Reviewed-by: Jammy Zhou Reviewed-by: Alex Deucher --- .../drm/amd/powerplay/eventmgr/eventsubchains.c | 2 +- .../gpu/drm/amd/powerplay/eventmgr/eventtasks.c | 15 ++++++++++++--- .../gpu/drm/amd/powerplay/eventmgr/eventtasks.h | 2 +- drivers/gpu/drm/amd/powerplay/eventmgr/psm.c | 2 +- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/amd/powerplay/eventmgr/eventsubchains.c b/drivers/gpu/drm/amd/powerplay/eventmgr/eventsubchains.c index 49d8a2978a18..e5dd86d23045 100644 --- a/drivers/gpu/drm/amd/powerplay/eventmgr/eventsubchains.c +++ b/drivers/gpu/drm/amd/powerplay/eventmgr/eventsubchains.c @@ -152,7 +152,7 @@ const pem_event_action set_boot_state_tasks[] = { const pem_event_action adjust_power_state_tasks[] = { pem_task_notify_hw_mgr_display_configuration_change, pem_task_adjust_power_state, - /*pem_task_notify_smc_display_config_after_power_state_adjustment,*/ + pem_task_notify_smc_display_config_after_power_state_adjustment, pem_task_update_allowed_performance_levels, /* to do pem_task_Enable_disable_bapm, */ NULL diff --git a/drivers/gpu/drm/amd/powerplay/eventmgr/eventtasks.c b/drivers/gpu/drm/amd/powerplay/eventmgr/eventtasks.c index 55d5490339e4..8ca32803c2ed 100644 --- a/drivers/gpu/drm/amd/powerplay/eventmgr/eventtasks.c +++ b/drivers/gpu/drm/amd/powerplay/eventmgr/eventtasks.c @@ -189,16 +189,25 @@ int pem_task_store_dal_configuration(struct pp_eventmgr *eventmgr, const struct int pem_task_notify_hw_mgr_display_configuration_change(struct pp_eventmgr *eventmgr, struct pem_event_data *event_data) { - /* TODO */ - return 0; + if (pem_is_hw_access_blocked(eventmgr)) + return 0; + + return phm_display_configuration_changed(eventmgr->hwmgr); } int pem_task_notify_hw_mgr_pre_display_configuration_change(struct pp_eventmgr *eventmgr, struct pem_event_data *event_data) { - /* TODO */ return 0; } +int pem_task_notify_smc_display_config_after_power_state_adjustment(struct pp_eventmgr *eventmgr, struct pem_event_data *event_data) +{ + if (pem_is_hw_access_blocked(eventmgr)) + return 0; + + return phm_notify_smc_display_config_after_ps_adjustment(eventmgr->hwmgr); +} + int pem_task_block_adjust_power_state(struct pp_eventmgr *eventmgr, struct pem_event_data *event_data) { eventmgr->block_adjust_power_state = true; diff --git a/drivers/gpu/drm/amd/powerplay/eventmgr/eventtasks.h b/drivers/gpu/drm/amd/powerplay/eventmgr/eventtasks.h index 37d3cf1665a0..287c87cede77 100644 --- a/drivers/gpu/drm/amd/powerplay/eventmgr/eventtasks.h +++ b/drivers/gpu/drm/amd/powerplay/eventmgr/eventtasks.h @@ -57,7 +57,7 @@ int pem_task_block_hw_access(struct pp_eventmgr *eventmgr, struct pem_event_data int pem_task_un_block_hw_access(struct pp_eventmgr *eventmgr, struct pem_event_data *event_data); int pem_task_reset_display_phys_access(struct pp_eventmgr *eventmgr, struct pem_event_data *event_data); int pem_task_set_cpu_power_state(struct pp_eventmgr *eventmgr, struct pem_event_data *event_data); - +int pem_task_notify_smc_display_config_after_power_state_adjustment(struct pp_eventmgr *eventmgr, struct pem_event_data *event_data); /*powersaving*/ int pem_task_set_power_source(struct pp_eventmgr *eventmgr, struct pem_event_data *event_data); diff --git a/drivers/gpu/drm/amd/powerplay/eventmgr/psm.c b/drivers/gpu/drm/amd/powerplay/eventmgr/psm.c index 7469c4cd9528..08b75bd70c0f 100644 --- a/drivers/gpu/drm/amd/powerplay/eventmgr/psm.c +++ b/drivers/gpu/drm/amd/powerplay/eventmgr/psm.c @@ -97,7 +97,7 @@ int psm_adjust_power_state_dynamic(struct pp_eventmgr *eventmgr, bool skip) pcurrent = hwmgr->current_ps; requested = hwmgr->request_ps; - if (pcurrent != NULL || requested != NULL) { + if ((pcurrent != NULL || requested != NULL) && (pcurrent != requested)) { phm_apply_state_adjust_rules(hwmgr, requested, pcurrent); phm_set_power_state(hwmgr, &pcurrent->hardware, &requested->hardware); hwmgr->current_ps = requested; -- 2.30.2