drm/amd/pp: Add profiling mode setting on RV
Subsystems (2)
PATCH 1/2 drm/amd/pp: Add profiling mode setting on RV
For power saving, default profiling mode was setted to power saving mode.
Currently, not support CUSTOM mode and not display detailed profiling mode parameters in sysfs.
--- drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c | 42 +++++++++++++++++++++++ 1 file changed, 42 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c +42 -0
@@ -450,6 +450,10 @@ static int smu10_hwmgr_backend_init(struct pp_hwmgr *hwmgr) hwmgr->backend = data; + hwmgr->workload_mask =1 << hwmgr->workload_prority[PP_SMC_POWER_PROFILE_POWERSAVING ]; + hwmgr->power_profile_mode =PP_SMC_POWER_PROFILE_POWERSAVING ; + hwmgr->default_power_profile_mode =PP_SMC_POWER_PROFILE_POWERSAVING ; + result =smu10_initialize_dpm_defaults (hwmgr);if (result !=0 ) {pr_err ("smu10_initialize_dpm_defaults failed\n" );
@@ -1163,6 +1167,42 @@ static void smu10_powergate_vcn(struct pp_hwmgr *hwmgr, bool bgate) } } +static int smu10_get_power_profile_mode (struct pp_hwmgr *hwmgr,char *buf) +{ +uint32_t i, size =0 ; + +static const char *profile_name[6 ] = {"3D_FULL_SCREEN" , +"POWER_SAVING" , +"VIDEO" , +"VR" , +"COMPUTE" }; +static const char *title[2 ] = {"NUM" ,"MODE_NAME" }; + +if (!buf) +return -EINVAL ; + + size +=sprintf (buf + size,"%s %10s\n" , title[0 ], title[1 ]); + +for (i =0 ; i <PP_SMC_POWER_PROFILE_CUSTOM ; i++) + size +=sprintf (buf + size,"%3d %14s%s\n" , + i, profile_name[i], + (i == hwmgr->power_profile_mode) ?"*" :" " ); +return size; +} + +static int smu10_set_power_profile_mode (struct pp_hwmgr *hwmgr,long *input,uint32_t size) +{ +if (input[size] >=PP_SMC_POWER_PROFILE_CUSTOM ) +return -EINVAL ; + + hwmgr->power_profile_mode = input[size]; + +smum_send_msg_to_smc_with_parameter (hwmgr, PPSMC_MSG_ActiveProcessNotify, +1 <<hwmgr->power_profile_mode); + +return 0 ; +} +static const struct pp_hwmgr_func smu10_hwmgr_funcs = { .backend_init = smu10_hwmgr_backend_init, .backend_fini = smu10_hwmgr_backend_fini,
@@ -1200,6 +1240,8 @@ static void smu10_powergate_vcn(struct pp_hwmgr *hwmgr, bool bgate) .set_mmhub_powergating_by_smu = smu10_set_mmhub_powergating_by_smu, .smus_notify_pwe = smu10_smus_notify_pwe, .gfx_off_control = smu10_gfx_off_control, + .get_power_profile_mode = smu10_get_power_profile_mode, + .set_power_profile_mode = smu10_set_power_profile_mode, };int smu10_init_function_pointers (struct pp_hwmgr *hwmgr)
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1526635990-17551-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org
PATCH 2/2 drm/amdgpu: Auto switch to video profiling mode on VCN demand
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +8 -4
@@ -207,11 +207,13 @@ static void amdgpu_vcn_idle_work_handler(struct work_struct *work)unsigned fences =amdgpu_fence_count_emitted (&adev->vcn.ring_dec);if (fences ==0 ) { -if (adev->pm.dpm_enabled) +if (adev->pm.dpm_enabled) { +amdgpu_dpm_switch_power_profile (adev,PP_SMC_POWER_PROFILE_VIDEO , false);amdgpu_dpm_enable_uvd (adev, false); -else + }else {amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_VCN ,AMD_PG_STATE_GATE ); + } }else {schedule_delayed_work (&adev->vcn.idle_work,VCN_IDLE_TIMEOUT ); }
@@ -223,11 +225,13 @@ void amdgpu_vcn_ring_begin_use(struct amdgpu_ring *ring)bool set_clocks = !cancel_delayed_work_sync (&adev->vcn.idle_work);if (set_clocks && adev->pm.dpm_enabled) { -if (adev->pm.dpm_enabled) +if (adev->pm.dpm_enabled) {amdgpu_dpm_enable_uvd (adev, true); -else +amdgpu_dpm_switch_power_profile (adev,PP_SMC_POWER_PROFILE_VIDEO , true); + }else {amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_VCN ,AMD_PG_STATE_UNGATE ); + } } }
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1526635990-17551-2-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org
Alex Deucher
Reviewed-byRe: [PATCH 2/2] drm/amdgpu: Auto switch to video profiling mode on VCN demand
On Fri, May 18, 2018 at 5:33 AM, Rex Zhu <[email protected]> wrote:
Add a commit message. Something like:
Switch to the VIDEO power profiles when VCN is active which is the power profile optimized for video playback.
With that fixed:
Want to take a stab at doing similar patches for UVD and VCE?
Also, does the smu/driver properly handle profile arbitration. E.g., if VR profile is active and the user runs VCN which switches to the VIDEO profile, we should stay in VR profile. I think vg10 and RV do the right thing because the SMU handles it, but on older parts we probably need to double check.
Alex
Quoted 44 lines
Signed-off-by Rex Zhu <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +8
-5@@ -207,11 +207,13 @@ static void amdgpu_vcn_idle_work_handler(struct work_struct *work)unsigned fences =amdgpu_fence_count_emitted (&adev->vcn.ring_dec);if (fences ==0 ) { -if (adev->pm.dpm_enabled) +if (adev->pm.dpm_enabled) { +amdgpu_dpm_switch_power_profile (adev,PP_SMC_POWER_PROFILE_VIDEO , false);amdgpu_dpm_enable_uvd (adev, false); -else + }else {amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_VCN ,AMD_PG_STATE_GATE ); + } }else {schedule_delayed_work (&adev->vcn.idle_work,VCN_IDLE_TIMEOUT ); }@@ -223,11 +225,13 @@ void amdgpu_vcn_ring_begin_use(struct amdgpu_ring *ring)bool set_clocks = !cancel_delayed_work_sync (&adev->vcn.idle_work);if (set_clocks && adev->pm.dpm_enabled) { -if (adev->pm.dpm_enabled) +if (adev->pm.dpm_enabled) {amdgpu_dpm_enable_uvd (adev, true); -else +amdgpu_dpm_switch_power_profile (adev,PP_SMC_POWER_PROFILE_VIDEO , true); + }else {amdgpu_device_ip_set_powergating_state (adev,AMD_IP_BLOCK_TYPE_VCN ,AMD_PG_STATE_UNGATE ); + } } } --1.9.1
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
Reviewed-byQuoted 7 lines · Rex Zhu
For power saving, default profiling mode was setted to power saving mode.
Currently, not support CUSTOM mode and not display detailed profiling mode parameters in sysfs.
Signed-off-by Rex Zhu <[email protected]>
Quoted 74 lines
--- drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c | 42 +++++++++++++++++++++++ 1 file changed, 42 insertions(+)drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c +42
-1@@ -450,6 +450,10 @@ static int smu10_hwmgr_backend_init(struct pp_hwmgr *hwmgr) hwmgr->backend = data; + hwmgr->workload_mask =1 << hwmgr->workload_prority[PP_SMC_POWER_PROFILE_POWERSAVING ]; + hwmgr->power_profile_mode =PP_SMC_POWER_PROFILE_POWERSAVING ; + hwmgr->default_power_profile_mode =PP_SMC_POWER_PROFILE_POWERSAVING ; + result =smu10_initialize_dpm_defaults (hwmgr);if (result !=0 ) {pr_err ("smu10_initialize_dpm_defaults failed\n" );@@ -1163,6 +1167,42 @@ static void smu10_powergate_vcn(struct pp_hwmgr *hwmgr, bool bgate) } } +static int smu10_get_power_profile_mode (struct pp_hwmgr *hwmgr,char *buf) +{ +uint32_t i, size =0 ; + +static const char *profile_name[6 ] = {"3D_FULL_SCREEN" , +"POWER_SAVING" , +"VIDEO" , +"VR" , +"COMPUTE" }; +static const char *title[2 ] = {"NUM" ,"MODE_NAME" }; + +if (!buf) +return -EINVAL ; + + size +=sprintf (buf + size,"%s %10s\n" , title[0 ], title[1 ]); + +for (i =0 ; i <PP_SMC_POWER_PROFILE_CUSTOM ; i++) + size +=sprintf (buf + size,"%3d %14s%s\n" , + i, profile_name[i], + (i == hwmgr->power_profile_mode) ?"*" :" " ); +return size; +} + +static int smu10_set_power_profile_mode (struct pp_hwmgr *hwmgr,long *input,uint32_t size) +{ +if (input[size] >=PP_SMC_POWER_PROFILE_CUSTOM ) +return -EINVAL ; + + hwmgr->power_profile_mode = input[size]; + +smum_send_msg_to_smc_with_parameter (hwmgr, PPSMC_MSG_ActiveProcessNotify, +1 <<hwmgr->power_profile_mode); + +return 0 ; +} +static const struct pp_hwmgr_func smu10_hwmgr_funcs = { .backend_init = smu10_hwmgr_backend_init, .backend_fini = smu10_hwmgr_backend_fini,@@ -1200,6 +1240,8 @@ static void smu10_powergate_vcn(struct pp_hwmgr *hwmgr, bool bgate) .set_mmhub_powergating_by_smu = smu10_set_mmhub_powergating_by_smu, .smus_notify_pwe = smu10_smus_notify_pwe, .gfx_off_control = smu10_gfx_off_control, + .get_power_profile_mode = smu10_get_power_profile_mode, + .set_power_profile_mode = smu10_set_power_profile_mode, };int smu10_init_function_pointers (struct pp_hwmgr *hwmgr) --1.9.1
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx