[PATCH 05/10] drm/amd/pp: Expose new interface to DC to ctrl auto wattman

Rex Zhu Rex.Zhu at amd.com
Sat Feb 24 13:56:02 UTC 2018


AutoWattman changes clocks quite aggressively which can make
framerates jump significantly and lead to a subpar experience
when using Freesync.

Disable AutoWattman (if enabled) when FreeSync is enabled.

Change-Id: I1c8e6b6d0d77b8bb3aa5250d4f5aec81270c27f1
Signed-off-by: Rex Zhu <Rex.Zhu at amd.com>
---
 drivers/gpu/drm/amd/include/kgd_pp_interface.h |  1 +
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c  | 23 +++++++++++++++++++++++
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c    |  1 +
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h      |  1 +
 4 files changed, 26 insertions(+)

diff --git a/drivers/gpu/drm/amd/include/kgd_pp_interface.h b/drivers/gpu/drm/amd/include/kgd_pp_interface.h
index 7dfba2d..168184e 100644
--- a/drivers/gpu/drm/amd/include/kgd_pp_interface.h
+++ b/drivers/gpu/drm/amd/include/kgd_pp_interface.h
@@ -306,6 +306,7 @@ struct amd_pm_funcs {
 	int (*set_power_profile_mode)(void *handle, long *input, uint32_t size);
 	int (*odn_edit_dpm_table)(void *handle, uint32_t type, long *input, uint32_t size);
 	int (*set_mmhub_powergating_by_smu)(void *handle);
+	int (*notify_free_sync_change)(void *handle, bool en);
 };
 
 #endif
diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
index 5f5fbb6..c88f392 100644
--- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
+++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
@@ -1454,6 +1454,28 @@ static int pp_set_mmhub_powergating_by_smu(void *handle)
 	return hwmgr->hwmgr_func->set_mmhub_powergating_by_smu(hwmgr);
 }
 
+static int pp_notify_free_sync_change(void *handle, bool en)
+{
+	struct pp_hwmgr *hwmgr;
+	struct pp_instance *pp_handle = (struct pp_instance *)handle;
+	int ret = 0;
+
+	ret = pp_check(pp_handle);
+
+	if (ret)
+		return ret;
+
+	hwmgr = pp_handle->hwmgr;
+
+	mutex_lock(&pp_handle->pp_lock);
+	if (hwmgr->autowattman_enabled && hwmgr->hwmgr_func->start_auto_wattman != NULL) {
+		hwmgr->autowattman_mask = en ? true : false;
+		hwmgr->hwmgr_func->start_auto_wattman(hwmgr, en);
+	}
+	mutex_unlock(&pp_handle->pp_lock);
+	return 0;
+}
+
 const struct amd_pm_funcs pp_dpm_funcs = {
 	.load_firmware = pp_dpm_load_fw,
 	.wait_for_fw_loading_complete = pp_dpm_fw_loading_complete,
@@ -1500,4 +1522,5 @@ static int pp_set_mmhub_powergating_by_smu(void *handle)
 	.display_clock_voltage_request = pp_display_clock_voltage_request,
 	.get_display_mode_validation_clocks = pp_get_display_mode_validation_clocks,
 	.set_mmhub_powergating_by_smu = pp_set_mmhub_powergating_by_smu,
+	.notify_free_sync_change = pp_notify_free_sync_change,
 };
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
index cad71ec..2fd0417 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
@@ -175,6 +175,7 @@ int hwmgr_early_init(struct pp_instance *handle)
 	hwmgr_set_user_specify_caps(hwmgr);
 	hwmgr->fan_ctrl_is_in_default_mode = true;
 	hwmgr->reload_fw = 1;
+	hwmgr->autowattman_mask = true;
 
 	switch (hwmgr->chip_family) {
 	case AMDGPU_FAMILY_CI:
diff --git a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
index 0fb14a1..5583a84 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
@@ -760,6 +760,7 @@ struct pp_hwmgr {
 	uint32_t power_limit;
 	uint32_t default_power_limit;
 	bool autowattman_enabled;
+	bool autowattman_mask;
 	struct delayed_work wattman_update_work;
 };
 
-- 
1.9.1



More information about the amd-gfx mailing list