From: Ray Wu <[email protected]>

[Why]
During mode change, replay_event_general_ui may remain set on the old
stream while replay_event_hw_programming is set. This can re-enable
Replay too early before hardware programming is complete.

[How]
Clear replay_event_general_ui in the mode-change path when setting
replay_event_hw_programming to keep Replay blocked until programming
finishes, avoiding white screen on OLED panels after boot.

Reviewed-by: Sunpeng Li <[email protected]>
Signed-off-by: Ray Wu <[email protected]>
Signed-off-by: James Lin <[email protected]>
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c    | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index e42a5eecdf46..7ff1af3528dd 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -10086,8 +10086,6 @@ static void amdgpu_dm_enable_self_refresh(struct 
amdgpu_display_manager *dm,
                        amdgpu_dm_psr_set_event(dm, acrtc_state->stream, false,
                                psr_event_hw_programming, false);
 
-                       amdgpu_dm_replay_set_event(dm, acrtc_state->stream, 
true,
-                               replay_event_general_ui, true);
                        amdgpu_dm_replay_set_event(dm, acrtc_state->stream, 
false,
                                replay_event_hw_programming, false);
                }
@@ -10616,6 +10614,8 @@ static void amdgpu_dm_mod_power_update_streams(struct 
drm_atomic_state *state,
                                        psr_event_hw_programming, true);
                                amdgpu_dm_replay_set_event(dm, 
dm_old_crtc_state->stream, true,
                                        replay_event_hw_programming, true);
+                               amdgpu_dm_replay_set_event(dm, 
dm_old_crtc_state->stream, false,
+                                       replay_event_general_ui, false);
                        }
                }
 
@@ -10669,6 +10669,18 @@ static void amdgpu_dm_mod_power_setup_streams(struct 
drm_atomic_state *state,
                        mod_power_notify_mode_change(dm->power_module,
                                                dm_new_crtc_state->stream,
                                                false);
+
+                       /*
+                        * Block PSR / Replay on the new stream until display 
settles post-modeset.
+                        * These events will be cleared by 
amdgpu_dm_enable_self_refresh() once
+                        * allow_sr_entry becomes true.
+                        */
+                       amdgpu_dm_psr_set_event(dm, dm_new_crtc_state->stream, 
true,
+                               psr_event_hw_programming, true);
+
+                       amdgpu_dm_replay_set_event(dm, 
dm_new_crtc_state->stream, true,
+                               replay_event_hw_programming | 
replay_event_general_ui,
+                               true);
                }
        }
 
-- 
2.43.0

Reply via email to