Skip to contentSkip to conversation

drm/amd/pp: Refine pp_dpm_switch_power_profile exposed to kfd

PATCH New Rex Zhu 1 participant 1 message Feb 23, 2018

Subsystems (2)
lore
Share & tools
lore

Rex Zhu

author
#0 lore raw

PATCH 1/1 drm/amd/pp: Refine pp_dpm_switch_power_profile exposed to kfd

use pp_set_power_profile_mode to support kfd's gfx/compute profiling mode switch

Change-Id I351cd23a8394c7b0c7945e6875c2ccb29968712e
---
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +14 -4
index 376ed2d..5feb91b 100644
@@ -1187,19 +1187,29 @@ static int pp_dpm_switch_power_profile(void *handle,
 		enum amd_pp_profile_type type)
 {
 	struct pp_hwmgr *hwmgr;
-	struct amd_pp_profile request = {0};
 	struct pp_instance *pp_handle = (struct pp_instance *)handle;
+	long *workload;
 
 	if (pp_check(pp_handle))
 		return -EINVAL;
 
 	hwmgr = pp_handle->hwmgr;
 
-	if (hwmgr->current_power_profile != type) {
-		request.type = type;
-		pp_dpm_set_power_profile_state(handle, &request);
+	mutex_lock(&pp_handle->pp_lock);
+
+	if (type == AMD_PP_GFX_PROFILE) {
+		if (hwmgr->power_profile_mode != hwmgr->default_power_profile_mode)
+			pp_dpm_force_performance_level(handle, AMD_DPM_FORCED_LEVEL_AUTO);
+	} else {
+		if (hwmgr->power_profile_mode != PP_SMC_POWER_PROFILE_COMPUTE) {
+			*workload = PP_SMC_POWER_PROFILE_COMPUTE;
+			pp_dpm_force_performance_level(handle, AMD_DPM_FORCED_LEVEL_MANUAL);
+			pp_set_power_profile_mode(handle, workload, 0);
+		}
 	}
 
+	mutex_unlock(&pp_handle->pp_lock);
+
 	return 0;
 }
 
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx