Skip to content

Commit 3899ca8

Browse files
committed
drm/radeon/dpm: fix 120hz handling harder
Need to expand the check to handle short circuiting if the selected state is the same as current state. bug: https://bugs.freedesktop.org/show_bug.cgi?id=87796 Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org
1 parent 9822393 commit 3899ca8

2 files changed

Lines changed: 18 additions & 5 deletions

File tree

‎drivers/gpu/drm/radeon/radeon.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,6 +1565,7 @@ struct radeon_dpm {
15651565
int new_active_crtc_count;
15661566
u32 current_active_crtcs;
15671567
int current_active_crtc_count;
1568+
bool single_display;
15681569
struct radeon_dpm_dynamic_state dyn_state;
15691570
struct radeon_dpm_fan fan;
15701571
u32 tdp_limit;

‎drivers/gpu/drm/radeon/radeon_pm.c‎

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -837,12 +837,8 @@ static void radeon_dpm_thermal_work_handler(struct work_struct *work)
837837
radeon_pm_compute_clocks(rdev);
838838
}
839839

840-
static struct radeon_ps *radeon_dpm_pick_power_state(struct radeon_device *rdev,
841-
enum radeon_pm_state_type dpm_state)
840+
static bool radeon_dpm_single_display(struct radeon_device *rdev)
842841
{
843-
int i;
844-
struct radeon_ps *ps;
845-
u32 ui_class;
846842
bool single_display = (rdev->pm.dpm.new_active_crtc_count < 2) ?
847843
true : false;
848844

@@ -858,6 +854,17 @@ static struct radeon_ps *radeon_dpm_pick_power_state(struct radeon_device *rdev,
858854
if (single_display && (r600_dpm_get_vrefresh(rdev) >= 120))
859855
single_display = false;
860856

857+
return single_display;
858+
}
859+
860+
static struct radeon_ps *radeon_dpm_pick_power_state(struct radeon_device *rdev,
861+
enum radeon_pm_state_type dpm_state)
862+
{
863+
int i;
864+
struct radeon_ps *ps;
865+
u32 ui_class;
866+
bool single_display = radeon_dpm_single_display(rdev);
867+
861868
/* certain older asics have a separare 3D performance state,
862869
* so try that first if the user selected performance
863870
*/
@@ -983,6 +990,7 @@ static void radeon_dpm_change_power_state_locked(struct radeon_device *rdev)
983990
struct radeon_ps *ps;
984991
enum radeon_pm_state_type dpm_state;
985992
int ret;
993+
bool single_display = radeon_dpm_single_display(rdev);
986994

987995
/* if dpm init failed */
988996
if (!rdev->pm.dpm_enabled)
@@ -1007,6 +1015,9 @@ static void radeon_dpm_change_power_state_locked(struct radeon_device *rdev)
10071015
/* vce just modifies an existing state so force a change */
10081016
if (ps->vce_active != rdev->pm.dpm.vce_active)
10091017
goto force;
1018+
/* user has made a display change (such as timing) */
1019+
if (rdev->pm.dpm.single_display != single_display)
1020+
goto force;
10101021
if ((rdev->family < CHIP_BARTS) || (rdev->flags & RADEON_IS_IGP)) {
10111022
/* for pre-BTC and APUs if the num crtcs changed but state is the same,
10121023
* all we need to do is update the display configuration.
@@ -1069,6 +1080,7 @@ static void radeon_dpm_change_power_state_locked(struct radeon_device *rdev)
10691080

10701081
rdev->pm.dpm.current_active_crtcs = rdev->pm.dpm.new_active_crtcs;
10711082
rdev->pm.dpm.current_active_crtc_count = rdev->pm.dpm.new_active_crtc_count;
1083+
rdev->pm.dpm.single_display = single_display;
10721084

10731085
/* wait for the rings to drain */
10741086
for (i = 0; i < RADEON_NUM_RINGS; i++) {

0 commit comments

Comments
 (0)