From: Wenjing Liu <wenjing....@amd.com>

[why]
There is a case when we are switching from ODM combine to Subvp where
minimal transition based off subvp state is required. In thise case, we
need to save and restore mall state when applying minimal transition.

Reviewed-by: Dillon Varone <dillon.var...@amd.com>
Acked-by: Hersen Wu <hersenxs...@amd.com>
Signed-off-by: Wenjing Liu <wenjing....@amd.com>
---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c 
b/drivers/gpu/drm/amd/display/dc/core/dc.c
index de8e5b18a12c..7b9bf5cb4529 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -4116,8 +4116,17 @@ static bool 
commit_minimal_transition_state_for_windowed_mpo_odm(struct dc *dc,
        bool success = false;
        struct dc_state *minimal_transition_context;
        struct pipe_split_policy_backup policy;
+       struct mall_temp_config mall_temp_config;
 
        /* commit based on new context */
+       /* Since all phantom pipes are removed in full validation,
+        * we have to save and restore the subvp/mall config when
+        * we do a minimal transition since the flags marking the
+        * pipe as subvp/phantom will be cleared (dc copy constructor
+        * creates a shallow copy).
+        */
+       if (dc->res_pool->funcs->save_mall_state)
+               dc->res_pool->funcs->save_mall_state(dc, context, 
&mall_temp_config);
        minimal_transition_context = create_minimal_transition_state(dc,
                        context, &policy);
        if (minimal_transition_context) {
@@ -4126,9 +4135,20 @@ static bool 
commit_minimal_transition_state_for_windowed_mpo_odm(struct dc *dc,
                        dc->hwss.is_pipe_topology_transition_seamless(
                                        dc, minimal_transition_context, 
context)) {
                        DC_LOG_DC("%s base = new state\n", __func__);
+
                        success = dc_commit_state_no_check(dc, 
minimal_transition_context) == DC_OK;
                }
                release_minimal_transition_state(dc, 
minimal_transition_context, &policy);
+               if (dc->res_pool->funcs->restore_mall_state)
+                       dc->res_pool->funcs->restore_mall_state(dc, context, 
&mall_temp_config);
+               /* If we do a minimal transition with plane removal and the 
context
+                * has subvp we also have to retain back the phantom stream / 
planes
+                * since the refcount is decremented as part of the min 
transition
+                * (we commit a state with no subvp, so the phantom streams / 
planes
+                * had to be removed).
+                */
+               if (dc->res_pool->funcs->retain_phantom_pipes)
+                       dc->res_pool->funcs->retain_phantom_pipes(dc, context);
        }
 
        if (!success) {
-- 
2.25.1

Reply via email to