Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/display: Retain phantom pipes when min transition into subvp (#7358)

[Description]
- When entering into a SubVP config that requires a minimal
transition we need to retain phantom pipes and also restore
the mall config
- This is because the min transition will remove phantom pipes
from the context (shallow copy) and not restore it's original
state
- This is just a workaround, and needs a proper fix

Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Jasdeep Dhillon <jdhillon@amd.com>
Signed-off-by: Alvin Lee <Alvin.Lee2@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Alvin Lee and committed by
Alex Deucher
aaae5211 fd9978aa

+36 -11
+19
drivers/gpu/drm/amd/display/dc/core/dc.c
··· 3954 3954 struct dc_state *context; 3955 3955 enum surface_update_type update_type; 3956 3956 int i; 3957 + struct mall_temp_config mall_temp_config; 3957 3958 3958 3959 /* In cases where MPO and split or ODM are used transitions can 3959 3960 * cause underflow. Apply stream configuration with minimal pipe ··· 3986 3985 3987 3986 /* on plane removal, minimal state is the new one */ 3988 3987 if (force_minimal_pipe_splitting && !is_plane_addition) { 3988 + /* Since all phantom pipes are removed in full validation, 3989 + * we have to save and restore the subvp/mall config when 3990 + * we do a minimal transition since the flags marking the 3991 + * pipe as subvp/phantom will be cleared (dc copy constructor 3992 + * creates a shallow copy). 3993 + */ 3994 + if (dc->res_pool->funcs->save_mall_state) 3995 + dc->res_pool->funcs->save_mall_state(dc, context, &mall_temp_config); 3989 3996 if (!commit_minimal_transition_state(dc, context)) { 3990 3997 dc_release_state(context); 3991 3998 return false; 3992 3999 } 4000 + if (dc->res_pool->funcs->restore_mall_state) 4001 + dc->res_pool->funcs->restore_mall_state(dc, context, &mall_temp_config); 3993 4002 4003 + /* If we do a minimal transition with plane removal and the context 4004 + * has subvp we also have to retain back the phantom stream / planes 4005 + * since the refcount is decremented as part of the min transition 4006 + * (we commit a state with no subvp, so the phantom streams / planes 4007 + * had to be removed). 4008 + */ 4009 + if (dc->res_pool->funcs->retain_phantom_pipes) 4010 + dc->res_pool->funcs->retain_phantom_pipes(dc, context); 3994 4011 update_type = UPDATE_TYPE_FULL; 3995 4012 } 3996 4013
+11
drivers/gpu/drm/amd/display/dc/dc_stream.h
··· 160 160 struct dc_stream_state *paired_stream; // master / slave stream 161 161 }; 162 162 163 + /* Temp struct used to save and restore MALL config 164 + * during validation. 165 + * 166 + * TODO: Move MALL config into dc_state instead of stream struct 167 + * to avoid needing to save/restore. 168 + */ 169 + struct mall_temp_config { 170 + struct mall_stream_config mall_stream_config[MAX_PIPES]; 171 + bool is_phantom_plane[MAX_PIPES]; 172 + }; 173 + 163 174 struct dc_stream_state { 164 175 // sink is deprecated, new code should not reference 165 176 // this pointer
+2
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c
··· 2069 2069 .add_phantom_pipes = dcn32_add_phantom_pipes, 2070 2070 .remove_phantom_pipes = dcn32_remove_phantom_pipes, 2071 2071 .retain_phantom_pipes = dcn32_retain_phantom_pipes, 2072 + .save_mall_state = dcn32_save_mall_state, 2073 + .restore_mall_state = dcn32_restore_mall_state, 2072 2074 }; 2073 2075 2074 2076
-11
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.h
··· 45 45 extern struct _vcs_dpi_ip_params_st dcn3_2_ip; 46 46 extern struct _vcs_dpi_soc_bounding_box_st dcn3_2_soc; 47 47 48 - /* Temp struct used to save and restore MALL config 49 - * during validation. 50 - * 51 - * TODO: Move MALL config into dc_state instead of stream struct 52 - * to avoid needing to save/restore. 53 - */ 54 - struct mall_temp_config { 55 - struct mall_stream_config mall_stream_config[MAX_PIPES]; 56 - bool is_phantom_plane[MAX_PIPES]; 57 - }; 58 - 59 48 struct dcn32_resource_pool { 60 49 struct resource_pool base; 61 50 };
+2
drivers/gpu/drm/amd/display/dc/dcn321/dcn321_resource.c
··· 1622 1622 .add_phantom_pipes = dcn32_add_phantom_pipes, 1623 1623 .remove_phantom_pipes = dcn32_remove_phantom_pipes, 1624 1624 .retain_phantom_pipes = dcn32_retain_phantom_pipes, 1625 + .save_mall_state = dcn32_save_mall_state, 1626 + .restore_mall_state = dcn32_restore_mall_state, 1625 1627 }; 1626 1628 1627 1629
+2
drivers/gpu/drm/amd/display/dc/inc/core_types.h
··· 243 243 bool (*remove_phantom_pipes)(struct dc *dc, struct dc_state *context, bool fast_update); 244 244 void (*retain_phantom_pipes)(struct dc *dc, struct dc_state *context); 245 245 void (*get_panel_config_defaults)(struct dc_panel_config *panel_config); 246 + void (*save_mall_state)(struct dc *dc, struct dc_state *context, struct mall_temp_config *temp_config); 247 + void (*restore_mall_state)(struct dc *dc, struct dc_state *context, struct mall_temp_config *temp_config); 246 248 }; 247 249 248 250 struct audio_support{