Commit f4caf3e5 authored by Rex Zhu's avatar Rex Zhu Committed by Alex Deucher

drm/amd/powerplay: refine the logic of whether need to update power state.

Better handle power state changes.
Signed-off-by: default avatarRex Zhu <Rex.Zhu@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Reviewed-by: default avatarJammy Zhou <Jammy.Zhou@amd.com>
parent e829ecdb
...@@ -86,9 +86,10 @@ int psm_set_performance_states(struct pp_eventmgr *eventmgr, unsigned long *stat ...@@ -86,9 +86,10 @@ int psm_set_performance_states(struct pp_eventmgr *eventmgr, unsigned long *stat
int psm_adjust_power_state_dynamic(struct pp_eventmgr *eventmgr, bool skip) int psm_adjust_power_state_dynamic(struct pp_eventmgr *eventmgr, bool skip)
{ {
const struct pp_power_state *pcurrent; struct pp_power_state *pcurrent;
struct pp_power_state *requested; struct pp_power_state *requested;
struct pp_hwmgr *hwmgr; struct pp_hwmgr *hwmgr;
bool equal;
if (skip) if (skip)
return 0; return 0;
...@@ -97,7 +98,13 @@ int psm_adjust_power_state_dynamic(struct pp_eventmgr *eventmgr, bool skip) ...@@ -97,7 +98,13 @@ int psm_adjust_power_state_dynamic(struct pp_eventmgr *eventmgr, bool skip)
pcurrent = hwmgr->current_ps; pcurrent = hwmgr->current_ps;
requested = hwmgr->request_ps; requested = hwmgr->request_ps;
if ((pcurrent != NULL || requested != NULL) && (pcurrent != requested)) { if (requested == NULL)
return 0;
if (pcurrent == NULL || (0 != phm_check_states_equal(hwmgr, &pcurrent->hardware, &requested->hardware, &equal)))
equal = false;
if (!equal || phm_check_smc_update_required_for_display_configuration(hwmgr)) {
phm_apply_state_adjust_rules(hwmgr, requested, pcurrent); phm_apply_state_adjust_rules(hwmgr, requested, pcurrent);
phm_set_power_state(hwmgr, &pcurrent->hardware, &requested->hardware); phm_set_power_state(hwmgr, &pcurrent->hardware, &requested->hardware);
hwmgr->current_ps = requested; hwmgr->current_ps = requested;
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "eventmanagement.h" #include "eventmanagement.h"
#include "eventmanager.h" #include "eventmanager.h"
#include "power_state.h" #include "power_state.h"
#include "hardwaremanager.h"
int psm_get_ui_state(struct pp_eventmgr *eventmgr, enum PP_StateUILabel ui_label, unsigned long *state_id); int psm_get_ui_state(struct pp_eventmgr *eventmgr, enum PP_StateUILabel ui_label, unsigned long *state_id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment