aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
diff options
context:
space:
mode:
authorRex Zhu <Rex.Zhu@amd.com>2016-12-23 02:24:37 -0500
committerAlex Deucher <alexander.deucher@amd.com>2017-01-27 11:12:57 -0500
commit3bd58979648fd105258934fb9f0fea1d73341d08 (patch)
treec66bbd3e2ae6e137c998d4c8bff55b864b808850 /drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
parent9d273495e691f9473db6b2ae2da41515d53a70e9 (diff)
drm/amd/powerplay: add profiling mode in dpm level
In some case, App need to run under max stable clock. so export profiling mode: GFX CG was disabled. and user can select the max stable clock of the device. Signed-off-by: Rex Zhu <Rex.Zhu@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index ccf50b8b854b..0345fbbfff4e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -124,6 +124,7 @@ static ssize_t amdgpu_get_dpm_forced_performance_level(struct device *dev,
124 (level & AMD_DPM_FORCED_LEVEL_LOW) ? "low" : 124 (level & AMD_DPM_FORCED_LEVEL_LOW) ? "low" :
125 (level & AMD_DPM_FORCED_LEVEL_HIGH) ? "high" : 125 (level & AMD_DPM_FORCED_LEVEL_HIGH) ? "high" :
126 (level & AMD_DPM_FORCED_LEVEL_MANUAL) ? "manual" : 126 (level & AMD_DPM_FORCED_LEVEL_MANUAL) ? "manual" :
127 (level & AMD_DPM_FORCED_LEVEL_PROFILING) ? "profiling" :
127 "unknown")); 128 "unknown"));
128} 129}
129 130
@@ -135,6 +136,7 @@ static ssize_t amdgpu_set_dpm_forced_performance_level(struct device *dev,
135 struct drm_device *ddev = dev_get_drvdata(dev); 136 struct drm_device *ddev = dev_get_drvdata(dev);
136 struct amdgpu_device *adev = ddev->dev_private; 137 struct amdgpu_device *adev = ddev->dev_private;
137 enum amd_dpm_forced_level level; 138 enum amd_dpm_forced_level level;
139 enum amd_dpm_forced_level current_level;
138 int ret = 0; 140 int ret = 0;
139 141
140 /* Can't force performance level when the card is off */ 142 /* Can't force performance level when the card is off */
@@ -142,6 +144,8 @@ static ssize_t amdgpu_set_dpm_forced_performance_level(struct device *dev,
142 (ddev->switch_power_state != DRM_SWITCH_POWER_ON)) 144 (ddev->switch_power_state != DRM_SWITCH_POWER_ON))
143 return -EINVAL; 145 return -EINVAL;
144 146
147 current_level = amdgpu_dpm_get_performance_level(adev);
148
145 if (strncmp("low", buf, strlen("low")) == 0) { 149 if (strncmp("low", buf, strlen("low")) == 0) {
146 level = AMD_DPM_FORCED_LEVEL_LOW; 150 level = AMD_DPM_FORCED_LEVEL_LOW;
147 } else if (strncmp("high", buf, strlen("high")) == 0) { 151 } else if (strncmp("high", buf, strlen("high")) == 0) {
@@ -150,11 +154,24 @@ static ssize_t amdgpu_set_dpm_forced_performance_level(struct device *dev,
150 level = AMD_DPM_FORCED_LEVEL_AUTO; 154 level = AMD_DPM_FORCED_LEVEL_AUTO;
151 } else if (strncmp("manual", buf, strlen("manual")) == 0) { 155 } else if (strncmp("manual", buf, strlen("manual")) == 0) {
152 level = AMD_DPM_FORCED_LEVEL_MANUAL; 156 level = AMD_DPM_FORCED_LEVEL_MANUAL;
157 } else if (strncmp("profile", buf, strlen("profile")) == 0) {
158 level = AMD_DPM_FORCED_LEVEL_PROFILING;
153 } else { 159 } else {
154 count = -EINVAL; 160 count = -EINVAL;
155 goto fail; 161 goto fail;
156 } 162 }
157 163
164 if (current_level == level)
165 return 0;
166
167 if (level == AMD_DPM_FORCED_LEVEL_PROFILING)
168 amdgpu_set_clockgating_state(adev, AMD_IP_BLOCK_TYPE_GFX,
169 AMD_CG_STATE_UNGATE);
170 else if (level != AMD_DPM_FORCED_LEVEL_PROFILING &&
171 current_level == AMD_DPM_FORCED_LEVEL_PROFILING)
172 amdgpu_set_clockgating_state(adev, AMD_IP_BLOCK_TYPE_GFX,
173 AMD_CG_STATE_GATE);
174
158 if (adev->pp_enabled) 175 if (adev->pp_enabled)
159 amdgpu_dpm_force_performance_level(adev, level); 176 amdgpu_dpm_force_performance_level(adev, level);
160 else { 177 else {