Skip to contentSkip to conversation

drm/amd/pp: fix mclk fixed in high when no display connected

PATCH In review Rex Zhu 3 participants 3 messages Feb 2, 2018 – Feb 3, 2018 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Rex Zhu

author
#0 lore raw

PATCH 1/1 drm/amd/pp: fix mclk fixed in high when no display connected

Change-Id I2d7663e164ff8eeafe0a4fed99e106b1d130a285
---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +3 -3
index ba3c7d6..6700839 100644
@@ -2919,10 +2919,10 @@ static int smu7_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,
 				    PHM_PlatformCaps_DisableMclkSwitchingForFrameLock);
 
 
-	disable_mclk_switching = ((1 < info.display_count) ||
-				  disable_mclk_switching_for_frame_lock ||
+	disable_mclk_switching = ((1 < info.display_count) &&
+				  (disable_mclk_switching_for_frame_lock ||
 				  smu7_vblank_too_short(hwmgr, mode_info.vblank_time_us) ||
-				  (mode_info.refresh_rate > 120));
+				  (mode_info.refresh_rate > 120)));
 
 	sclk = smu7_ps->performance_levels[0].engine_clock;
 	mclk = smu7_ps->performance_levels[0].memory_clock;
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): 1517547179-30756-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

#2 lore raw
Quoted 11 lines · Rex Zhu
Change-Id I2d7663e164ff8eeafe0a4fed99e106b1d130a285
---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -0
index ba3c7d6..6700839 100644

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c static int smu7_apply_state_adjust_rules(struct pp_hwmgr *hwmgr, · line 2925

Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +3 -3
@@ -2919,10 +2919,10 @@ static int smu7_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,
                                    PHM_PlatformCaps_DisableMclkSwitchingForFrameLock);
 
 
-       disable_mclk_switching = ((1 < info.display_count) ||
-                                 disable_mclk_switching_for_frame_lock ||
+       disable_mclk_switching = ((1 < info.display_count) &&
+                                 (disable_mclk_switching_for_frame_lock ||
                                  smu7_vblank_too_short(hwmgr, mode_info.vblank_time_us) ||
-                                 (mode_info.refresh_rate > 120));
+                                 (mode_info.refresh_rate > 120)));

I think this will break the logic to handle single display over 120 hz and the vblank too short cases. I think you want 1 <= display_count. It might be better to make the logic more clear. How about the attached patch?

Alex

Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -1
        sclk = smu7_ps->performance_levels[0].engine_clock;
        mclk = smu7_ps->performance_levels[0].memory_clock;
--

1.9.1

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

From bc82506320e594b1b46515ff09c080187f3d2656 Mon Sep 17 00:00:00 2001
From: Alex Deucher <[email protected]>
Date: Fri, 2 Feb 2018 10:19:13 -0500
Subject: [PATCH] drm/amd/pp: fix mclk fixed in high when no display connected
(v2)

Also clean up the logic to make it clearer how mclk switching is determined.

v2: Make the logic clearer, fix the single display case.

---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +12 -5
index c59cb9499e06..bc56e6f2f7a9 100644
@@ -2903,11 +2903,18 @@ static int smu7_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,
 				    hwmgr->platform_descriptor.platformCaps,
 				    PHM_PlatformCaps_DisableMclkSwitchingForFrameLock);
 
-
-	disable_mclk_switching = ((1 < info.display_count) ||
-				  disable_mclk_switching_for_frame_lock ||
-				  smu7_vblank_too_short(hwmgr, mode_info.vblank_time_us) ||
-				  (mode_info.refresh_rate > 120));
+	if (info.display_count == 0)
+		/* no displays, enable mclk switching */
+		disable_mclk_switching = false;
+	else if (info.display_count == 1)
+		/* 1 display, enable mclk switching if possible */
+		disable_mclk_switching =
+			disable_mclk_switching_for_frame_lock ||
+			smu7_vblank_too_short(hwmgr, mode_info.vblank_time_us) ||
+			(mode_info.refresh_rate > 120);
+	else
+		/* >1 display, disable mclk switching */
+		disable_mclk_switching = true;
 
 	sclk = smu7_ps->performance_levels[0].engine_clock;
 	mclk = smu7_ps->performance_levels[0].memory_clock;
Signature · 1 line
2.13.6

_______________________________________________
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): CADnq5_Nu75QhsdVKEA4xSyRPsPnrZRniJzAU8PtR1MUyP1EmcQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#4 lore raw

Hi Alex,

This also seems to work on my setup.

Cheers,
Tom

Quoted 28 lines · Alex Deucher
Quoted 11 lines · Rex Zhu
Change-Id I2d7663e164ff8eeafe0a4fed99e106b1d130a285
---
  drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -0
index ba3c7d6..6700839 100644

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c static int smu7_apply_state_adjust_rules(struct pp_hwmgr *hwmgr, · line 2925

Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +3 -3
@@ -2919,10 +2919,10 @@ static int smu7_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,
                                     PHM_PlatformCaps_DisableMclkSwitchingForFrameLock);
 
 
-       disable_mclk_switching = ((1 < info.display_count) ||
-                                 disable_mclk_switching_for_frame_lock ||
+       disable_mclk_switching = ((1 < info.display_count) &&
+                                 (disable_mclk_switching_for_frame_lock ||
                                   smu7_vblank_too_short(hwmgr, mode_info.vblank_time_us) ||
-                                 (mode_info.refresh_rate > 120));
+                                 (mode_info.refresh_rate > 120)));

I think this will break the logic to handle single display over 120 hz and the vblank too short cases. I think you want 1 <= display_count. It might be better to make the logic more clear. How about the attached patch?

Quoted 18 lines

Alex

Quoted 16 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -1
         sclk = smu7_ps->performance_levels[0].engine_clock;
         mclk = smu7_ps->performance_levels[0].memory_clock;
--

1.9.1

_______________________________________________
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

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