Support mclk switching when monitors are in sync (v2)
Subsystems (3)
cover Support mclk switching when monitors are in sync (v2)
This patch set enables mclk switching with multiple monitors when all monitors are sync. Normally mclk switching is not available with multiple monitors because the vblank timing does not line up. However, if the timing is identical, the display driver can sync up the displays in some cases. Check for these cases and allow mclk switch when possible.
Alex Deucher (4):
drm/amdgpu/powerplay/smu7: enable mclk switching if monitors are
synced
drm/amdgpu/powerplay/vega10: enable mclk switching if monitors are
synced
drm/amd/display: update bw_calcs to take pipe sync into account (v3) drm/amdgpu/display: add flag for multi-display mclk switching
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++ .../gpu/drm/amd/display/dc/calcs/dce_calcs.c | 33 +++++++++++++++++-- drivers/gpu/drm/amd/display/dc/dc.h | 2 +- drivers/gpu/drm/amd/include/amd_shared.h | 1 + .../gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 7 ++-- .../drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 3 +- 6 files changed, 42 insertions(+), 7 deletions(-)
Signature · 6 lines
2.20.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): 20190822193050.3107-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org
PATCH 1/4 drm/amdgpu/powerplay/smu7: enable mclk switching if monitors are synced
If DC has synced the displays, we can enable mclk switching to save power.
--- drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +4 -3
@@ -2956,9 +2956,10 @@ static int smu7_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,if (hwmgr->display_config->num_display ==0 ) disable_mclk_switching = false;else - disable_mclk_switching = ((1 < hwmgr->display_config->num_display) || - disable_mclk_switching_for_frame_lock || -smu7_vblank_too_short (hwmgr, hwmgr->display_config->min_vblank_time)); + disable_mclk_switching = ((1 < hwmgr->display_config->num_display) && + !hwmgr->display_config->multi_monitor_in_sync) || + disable_mclk_switching_for_frame_lock || +smu7_vblank_too_short (hwmgr, hwmgr->display_config->min_vblank_time); sclk = smu7_ps->performance_levels[0 ].engine_clock; mclk = smu7_ps->performance_levels[0 ].memory_clock;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/4 drm/amdgpu/powerplay/vega10: enable mclk switching if monitors are synced
In reply to a message not in the archiveIf DC has synced the displays, we can enable mclk switching to save power.
--- drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +2 -1
@@ -3220,7 +3220,8 @@ static int vega10_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,if (hwmgr->display_config->num_display ==0 ) disable_mclk_switching = false;else - disable_mclk_switching = (hwmgr->display_config->num_display >1 ) || + disable_mclk_switching = ((1 < hwmgr->display_config->num_display) && + !hwmgr->display_config->multi_monitor_in_sync) || disable_mclk_switching_for_frame_lock || disable_mclk_switching_for_vr || force_mclk_high;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/4 drm/amd/display: update bw_calcs to take pipe sync into account (v3)
In reply to a message not in the archiveProperly set all_displays_in_sync so that when the data is propagated to powerplay, it's set properly and we can enable mclk switching when all monitors are in sync.
v2: fix logic, clean up
v3: check for blending chains, simplify logic
--- .../gpu/drm/amd/display/dc/calcs/dce_calcs.c | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c +28 -2
@@ -25,6 +25,7 @@#include <linux/slab.h> +#include "resource.h" #include "dm_services.h" #include "dce_calcs.h" #include "dc.h"
@@ -2977,6 +2978,32 @@ static void populate_initial_data( data->number_of_displays = num_displays; } +static bool all_displays_in_sync (const struct pipe_ctx pipe[], +int pipe_count) +{ +const struct pipe_ctx *active_pipes[MAX_PIPES ]; +int i, num_active_pipes =0 ; + +for (i =0 ; i < pipe_count; i++) { +if (!pipe[i].stream || pipe[i].top_pipe) +continue ; + + active_pipes[num_active_pipes++] = &pipe[i]; + } + +if (!num_active_pipes) +return false; + +for (i =1 ; i < num_active_pipes; ++i) { +if (!resource_are_streams_timing_synchronizable ( + active_pipes[0 ]->stream, active_pipes[i]->stream)) { +return false; + } + } + +return true; +} +/** * Return: * true - Display(s) configuration supported.
@@ -2998,8 +3025,7 @@ bool bw_calcs(struct dc_context *ctx,populate_initial_data (pipe, pipe_count, data); -/*TODO: this should be taken out calcs output and assigned during timing sync for pplib use*/ - calcs_output->all_displays_in_sync = false; + calcs_output->all_displays_in_sync =all_displays_in_sync (pipe, pipe_count);if (data->number_of_displays !=0 ) {uint8_t yclk_lvl, sclk_lvl;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/4 drm/amdgpu/display: add flag for multi-display mclk switching
In reply to a message not in the archiveAdd a dcfeaturemask flag for mclk switching. Disable by default; enable once the feature has seen more testing.
Set amdgpu.dcfeaturemask=2 on the kernel command line in grub to enable this.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +++ drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c | 5 ++++- drivers/gpu/drm/amd/display/dc/dc.h | 2 +- drivers/gpu/drm/amd/include/amd_shared.h | 1 + 4 files changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3 -0
@@ -694,6 +694,9 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)if (amdgpu_dc_feature_mask &DC_FBC_MASK ) init_data.flags.fbc_support = true; +if (amdgpu_dc_feature_mask &DC_MULTI_MON_PP_MCLK_SWITCH_MASK ) + init_data.flags.multi_mon_pp_mclk_switch = true; + init_data.flags.power_down_display_on_boot = true;#ifdef CONFIG_DRM_AMD_DC_DCN2_0
drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c +4 -1
@@ -3025,7 +3025,10 @@ bool bw_calcs(struct dc_context *ctx,populate_initial_data (pipe, pipe_count, data); - calcs_output->all_displays_in_sync =all_displays_in_sync (pipe, pipe_count); +if (ctx->dc->config.multi_mon_pp_mclk_switch) + calcs_output->all_displays_in_sync =all_displays_in_sync (pipe, pipe_count); +else + calcs_output->all_displays_in_sync = false;if (data->number_of_displays !=0 ) {uint8_t yclk_lvl, sclk_lvl;
drivers/gpu/drm/amd/display/dc/dc.h +1 -1
@@ -220,7 +220,7 @@ struct dc_config {bool power_down_display_on_boot;bool edp_not_connected;bool forced_clocks; - +bool multi_mon_pp_mclk_switch; };enum visual_confirm {
drivers/gpu/drm/amd/include/amd_shared.h +1 -0
@@ -142,6 +142,7 @@ enum PP_FEATURE_MASK {enum DC_FEATURE_MASK {DC_FBC_MASK =0x1 , +DC_MULTI_MON_PP_MCLK_SWITCH_MASK =0x2 , };enum amd_dpm_forced_level ;
Signature · 6 lines
2.20.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): 20190822193050.3107-5-alexander.deucher-5C7GfCeVMHo@public.gmane.org
Kazlauskas, Nicholas
Reviewed-by Nicholas KazlauskasRe: [PATCH 4/4] drm/amdgpu/display: add flag for multi-display mclk switching
Quoted 7 lines · Alex Deucher
Add a dcfeaturemask flag for mclk switching. Disable by default; enable once the feature has seen more testing.
Set amdgpu.dcfeaturemask=2 on the kernel command line in grub to enable this.
Signed-off-by Alex Deucher <[email protected]>
Patches 3 and 4 are
Quoted 56 lines
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +++ drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c | 5 ++++- drivers/gpu/drm/amd/display/dc/dc.h | 2 +- drivers/gpu/drm/amd/include/amd_shared.h | 1 + 4 files changed, 9 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3
-0@@ -694,6 +694,9 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)if (amdgpu_dc_feature_mask &DC_FBC_MASK ) init_data.flags.fbc_support = true; +if (amdgpu_dc_feature_mask &DC_MULTI_MON_PP_MCLK_SWITCH_MASK ) + init_data.flags.multi_mon_pp_mclk_switch = true; + init_data.flags.power_down_display_on_boot = true;#ifdef CONFIG_DRM_AMD_DC_DCN2_0 drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c +4
-1@@ -3025,7 +3025,10 @@ bool bw_calcs(struct dc_context *ctx,populate_initial_data (pipe, pipe_count, data); - calcs_output->all_displays_in_sync =all_displays_in_sync (pipe, pipe_count); +if (ctx->dc->config.multi_mon_pp_mclk_switch) + calcs_output->all_displays_in_sync =all_displays_in_sync (pipe, pipe_count); +else + calcs_output->all_displays_in_sync = false;if (data->number_of_displays !=0 ) {uint8_t yclk_lvl, sclk_lvl;drivers/gpu/drm/amd/display/dc/dc.h +1
-1@@ -220,7 +220,7 @@ struct dc_config {bool power_down_display_on_boot;bool edp_not_connected;bool forced_clocks; - +bool multi_mon_pp_mclk_switch; };enum visual_confirm {drivers/gpu/drm/amd/include/amd_shared.h +0
-0
drivers/gpu/drm/amd/include/amd_shared.h enum PP_FEATURE_MASK { · line 148
Quoted 7 lines
drivers/gpu/drm/amd/include/amd_shared.h +1
-0@@ -142,6 +142,7 @@ enum PP_FEATURE_MASK {enum DC_FEATURE_MASK {DC_FBC_MASK =0x1 , +DC_MULTI_MON_PP_MCLK_SWITCH_MASK =0x2 , };enum amd_dpm_forced_level ;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
RE: [PATCH 4/4] drm/amdgpu/display: add flag for multi-display mclk switching
In reply to a message not in the archivePatch1, 2 are reviewed-by: Evan Quan <[email protected]> Patch 3,4 are acked-by: Evan Quan <[email protected]>
Quoted 89 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Friday, August 23, 2019 3:31 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH 4/4] drm/amdgpu/display: add flag for multi-display mclk switchingAdd a dcfeaturemask flag for mclk switching. Disable by default; enable once the feature has seen more testing.
Set amdgpu.dcfeaturemask=2 on the kernel command line in grub to enable this.
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +++ drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c | 5 ++++- drivers/gpu/drm/amd/display/dc/dc.h | 2 +- drivers/gpu/drm/amd/include/amd_shared.h | 1 + 4 files changed, 9 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3
-0@@ -694,6 +694,9 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)if (amdgpu_dc_feature_mask &DC_FBC_MASK ) init_data.flags.fbc_support = true; +if (amdgpu_dc_feature_mask &DC_MULTI_MON_PP_MCLK_SWITCH_MASK ) + init_data.flags.multi_mon_pp_mclk_switch = true; + init_data.flags.power_down_display_on_boot = true;#ifdef
CONFIG_DRM_AMD_DC_DCN2_0drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c +4
-1@@ -3025,7 +3025,10 @@ bool bw_calcs(struct dc_context *ctx,populate_initial_data (pipe, pipe_count, data); - calcs_output->all_displays_in_sync =all_displays_in_sync (pipe, pipe_count); +if (ctx->dc->config.multi_mon_pp_mclk_switch) + calcs_output->all_displays_in_sync =all_displays_in_sync (pipe, pipe_count); +else + calcs_output->all_displays_in_sync = false;drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c +0
-0if (data->number_of_displays !=0 ) {uint8_t yclk_lvl, sclk_lvl;drivers/gpu/drm/amd/display/dc/dc.h +1
-1@@ -220,7 +220,7 @@ struct dc_config {bool power_down_display_on_boot;bool edp_not_connected;bool forced_clocks; - +bool multi_mon_pp_mclk_switch; };enum visual_confirm {drivers/gpu/drm/amd/include/amd_shared.h +1
-1@@ -142,6 +142,7 @@ enum PP_FEATURE_MASK {enum DC_FEATURE_MASK {DC_FBC_MASK =0x1 , +DC_MULTI_MON_PP_MCLK_SWITCH_MASK =0x2 , };enum amd_dpm_forced_level ; --2.20.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