Commit aaae5211 authored by Alvin Lee's avatar Alvin Lee Committed by Alex Deucher

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: default avatarJun Lei <Jun.Lei@amd.com>
Acked-by: default avatarJasdeep Dhillon <jdhillon@amd.com>
Signed-off-by: default avatarAlvin Lee <Alvin.Lee2@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent fd9978aa
...@@ -3954,6 +3954,7 @@ bool dc_update_planes_and_stream(struct dc *dc, ...@@ -3954,6 +3954,7 @@ bool dc_update_planes_and_stream(struct dc *dc,
struct dc_state *context; struct dc_state *context;
enum surface_update_type update_type; enum surface_update_type update_type;
int i; int i;
struct mall_temp_config mall_temp_config;
/* In cases where MPO and split or ODM are used transitions can /* In cases where MPO and split or ODM are used transitions can
* cause underflow. Apply stream configuration with minimal pipe * cause underflow. Apply stream configuration with minimal pipe
...@@ -3985,11 +3986,29 @@ bool dc_update_planes_and_stream(struct dc *dc, ...@@ -3985,11 +3986,29 @@ bool dc_update_planes_and_stream(struct dc *dc,
/* on plane removal, minimal state is the new one */ /* on plane removal, minimal state is the new one */
if (force_minimal_pipe_splitting && !is_plane_addition) { if (force_minimal_pipe_splitting && !is_plane_addition) {
/* 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);
if (!commit_minimal_transition_state(dc, context)) { if (!commit_minimal_transition_state(dc, context)) {
dc_release_state(context); dc_release_state(context);
return false; return false;
} }
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);
update_type = UPDATE_TYPE_FULL; update_type = UPDATE_TYPE_FULL;
} }
......
...@@ -160,6 +160,17 @@ struct mall_stream_config { ...@@ -160,6 +160,17 @@ struct mall_stream_config {
struct dc_stream_state *paired_stream; // master / slave stream struct dc_stream_state *paired_stream; // master / slave stream
}; };
/* Temp struct used to save and restore MALL config
* during validation.
*
* TODO: Move MALL config into dc_state instead of stream struct
* to avoid needing to save/restore.
*/
struct mall_temp_config {
struct mall_stream_config mall_stream_config[MAX_PIPES];
bool is_phantom_plane[MAX_PIPES];
};
struct dc_stream_state { struct dc_stream_state {
// sink is deprecated, new code should not reference // sink is deprecated, new code should not reference
// this pointer // this pointer
......
...@@ -2069,6 +2069,8 @@ static struct resource_funcs dcn32_res_pool_funcs = { ...@@ -2069,6 +2069,8 @@ static struct resource_funcs dcn32_res_pool_funcs = {
.add_phantom_pipes = dcn32_add_phantom_pipes, .add_phantom_pipes = dcn32_add_phantom_pipes,
.remove_phantom_pipes = dcn32_remove_phantom_pipes, .remove_phantom_pipes = dcn32_remove_phantom_pipes,
.retain_phantom_pipes = dcn32_retain_phantom_pipes, .retain_phantom_pipes = dcn32_retain_phantom_pipes,
.save_mall_state = dcn32_save_mall_state,
.restore_mall_state = dcn32_restore_mall_state,
}; };
......
...@@ -45,17 +45,6 @@ ...@@ -45,17 +45,6 @@
extern struct _vcs_dpi_ip_params_st dcn3_2_ip; extern struct _vcs_dpi_ip_params_st dcn3_2_ip;
extern struct _vcs_dpi_soc_bounding_box_st dcn3_2_soc; extern struct _vcs_dpi_soc_bounding_box_st dcn3_2_soc;
/* Temp struct used to save and restore MALL config
* during validation.
*
* TODO: Move MALL config into dc_state instead of stream struct
* to avoid needing to save/restore.
*/
struct mall_temp_config {
struct mall_stream_config mall_stream_config[MAX_PIPES];
bool is_phantom_plane[MAX_PIPES];
};
struct dcn32_resource_pool { struct dcn32_resource_pool {
struct resource_pool base; struct resource_pool base;
}; };
......
...@@ -1622,6 +1622,8 @@ static struct resource_funcs dcn321_res_pool_funcs = { ...@@ -1622,6 +1622,8 @@ static struct resource_funcs dcn321_res_pool_funcs = {
.add_phantom_pipes = dcn32_add_phantom_pipes, .add_phantom_pipes = dcn32_add_phantom_pipes,
.remove_phantom_pipes = dcn32_remove_phantom_pipes, .remove_phantom_pipes = dcn32_remove_phantom_pipes,
.retain_phantom_pipes = dcn32_retain_phantom_pipes, .retain_phantom_pipes = dcn32_retain_phantom_pipes,
.save_mall_state = dcn32_save_mall_state,
.restore_mall_state = dcn32_restore_mall_state,
}; };
......
...@@ -243,6 +243,8 @@ struct resource_funcs { ...@@ -243,6 +243,8 @@ struct resource_funcs {
bool (*remove_phantom_pipes)(struct dc *dc, struct dc_state *context, bool fast_update); bool (*remove_phantom_pipes)(struct dc *dc, struct dc_state *context, bool fast_update);
void (*retain_phantom_pipes)(struct dc *dc, struct dc_state *context); void (*retain_phantom_pipes)(struct dc *dc, struct dc_state *context);
void (*get_panel_config_defaults)(struct dc_panel_config *panel_config); void (*get_panel_config_defaults)(struct dc_panel_config *panel_config);
void (*save_mall_state)(struct dc *dc, struct dc_state *context, struct mall_temp_config *temp_config);
void (*restore_mall_state)(struct dc *dc, struct dc_state *context, struct mall_temp_config *temp_config);
}; };
struct audio_support{ struct audio_support{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment