diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2015-03-18 17:05:10 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2015-03-27 10:17:42 -0400 |
commit | 3899ca844b82fb201fb764f56eec483acb59a29c (patch) | |
tree | 3b2e057f58df5814f2e25b8703355ced4a0ce2d5 | |
parent | 9822393d23ba9129396ab9308dbb8ce10ae74751 (diff) |
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
-rw-r--r-- | drivers/gpu/drm/radeon/radeon.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_pm.c | 22 |
2 files changed, 18 insertions, 5 deletions
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 5587603b4a89..33d5a4f4eebd 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -1565,6 +1565,7 @@ struct radeon_dpm { | |||
1565 | int new_active_crtc_count; | 1565 | int new_active_crtc_count; |
1566 | u32 current_active_crtcs; | 1566 | u32 current_active_crtcs; |
1567 | int current_active_crtc_count; | 1567 | int current_active_crtc_count; |
1568 | bool single_display; | ||
1568 | struct radeon_dpm_dynamic_state dyn_state; | 1569 | struct radeon_dpm_dynamic_state dyn_state; |
1569 | struct radeon_dpm_fan fan; | 1570 | struct radeon_dpm_fan fan; |
1570 | u32 tdp_limit; | 1571 | u32 tdp_limit; |
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index 33cf4108386d..c1ba83a8dd8c 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c | |||
@@ -837,12 +837,8 @@ static void radeon_dpm_thermal_work_handler(struct work_struct *work) | |||
837 | radeon_pm_compute_clocks(rdev); | 837 | radeon_pm_compute_clocks(rdev); |
838 | } | 838 | } |
839 | 839 | ||
840 | static struct radeon_ps *radeon_dpm_pick_power_state(struct radeon_device *rdev, | 840 | static bool radeon_dpm_single_display(struct radeon_device *rdev) |
841 | enum radeon_pm_state_type dpm_state) | ||
842 | { | 841 | { |
843 | int i; | ||
844 | struct radeon_ps *ps; | ||
845 | u32 ui_class; | ||
846 | bool single_display = (rdev->pm.dpm.new_active_crtc_count < 2) ? | 842 | bool single_display = (rdev->pm.dpm.new_active_crtc_count < 2) ? |
847 | true : false; | 843 | true : false; |
848 | 844 | ||
@@ -858,6 +854,17 @@ static struct radeon_ps *radeon_dpm_pick_power_state(struct radeon_device *rdev, | |||
858 | if (single_display && (r600_dpm_get_vrefresh(rdev) >= 120)) | 854 | if (single_display && (r600_dpm_get_vrefresh(rdev) >= 120)) |
859 | single_display = false; | 855 | single_display = false; |
860 | 856 | ||
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 | |||
861 | /* certain older asics have a separare 3D performance state, | 868 | /* certain older asics have a separare 3D performance state, |
862 | * so try that first if the user selected performance | 869 | * so try that first if the user selected performance |
863 | */ | 870 | */ |
@@ -983,6 +990,7 @@ static void radeon_dpm_change_power_state_locked(struct radeon_device *rdev) | |||
983 | struct radeon_ps *ps; | 990 | struct radeon_ps *ps; |
984 | enum radeon_pm_state_type dpm_state; | 991 | enum radeon_pm_state_type dpm_state; |
985 | int ret; | 992 | int ret; |
993 | bool single_display = radeon_dpm_single_display(rdev); | ||
986 | 994 | ||
987 | /* if dpm init failed */ | 995 | /* if dpm init failed */ |
988 | if (!rdev->pm.dpm_enabled) | 996 | if (!rdev->pm.dpm_enabled) |
@@ -1007,6 +1015,9 @@ static void radeon_dpm_change_power_state_locked(struct radeon_device *rdev) | |||
1007 | /* vce just modifies an existing state so force a change */ | 1015 | /* vce just modifies an existing state so force a change */ |
1008 | if (ps->vce_active != rdev->pm.dpm.vce_active) | 1016 | if (ps->vce_active != rdev->pm.dpm.vce_active) |
1009 | goto force; | 1017 | goto force; |
1018 | /* user has made a display change (such as timing) */ | ||
1019 | if (rdev->pm.dpm.single_display != single_display) | ||
1020 | goto force; | ||
1010 | if ((rdev->family < CHIP_BARTS) || (rdev->flags & RADEON_IS_IGP)) { | 1021 | if ((rdev->family < CHIP_BARTS) || (rdev->flags & RADEON_IS_IGP)) { |
1011 | /* for pre-BTC and APUs if the num crtcs changed but state is the same, | 1022 | /* for pre-BTC and APUs if the num crtcs changed but state is the same, |
1012 | * all we need to do is update the display configuration. | 1023 | * all we need to do is update the display configuration. |
@@ -1069,6 +1080,7 @@ force: | |||
1069 | 1080 | ||
1070 | rdev->pm.dpm.current_active_crtcs = rdev->pm.dpm.new_active_crtcs; | 1081 | rdev->pm.dpm.current_active_crtcs = rdev->pm.dpm.new_active_crtcs; |
1071 | rdev->pm.dpm.current_active_crtc_count = rdev->pm.dpm.new_active_crtc_count; | 1082 | rdev->pm.dpm.current_active_crtc_count = rdev->pm.dpm.new_active_crtc_count; |
1083 | rdev->pm.dpm.single_display = single_display; | ||
1072 | 1084 | ||
1073 | /* wait for the rings to drain */ | 1085 | /* wait for the rings to drain */ |
1074 | for (i = 0; i < RADEON_NUM_RINGS; i++) { | 1086 | for (i = 0; i < RADEON_NUM_RINGS; i++) { |