]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/amd/display: save and restore mall state when applying minimal transition
authorWenjing Liu <wenjing.liu@amd.com>
Fri, 20 Oct 2023 20:18:40 +0000 (16:18 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 7 Nov 2023 17:03:30 +0000 (12:03 -0500)
[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.varone@amd.com>
Acked-by: Hersen Wu <hersenxs.wu@amd.com>
Signed-off-by: Wenjing Liu <wenjing.liu@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc.c

index de8e5b18a12c3b74e1c37d9d3179760c45f2b1ff..7b9bf5cb45299974757bd16d608e41d444ef3b0f 100644 (file)
@@ -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) {