Skip to content

Commit aaae521

Browse files
Alvin Leealexdeucher
authored andcommitted
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 <[email protected]> Acked-by: Jasdeep Dhillon <[email protected]> Signed-off-by: Alvin Lee <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent fd9978a commit aaae521

File tree

6 files changed

+37
-12
lines changed

6 files changed

+37
-12
lines changed

drivers/gpu/drm/amd/display/dc/core/dc.c

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3954,6 +3954,7 @@ bool dc_update_planes_and_stream(struct dc *dc,
39543954
struct dc_state *context;
39553955
enum surface_update_type update_type;
39563956
int i;
3957+
struct mall_temp_config mall_temp_config;
39573958

39583959
/* In cases where MPO and split or ODM are used transitions can
39593960
* cause underflow. Apply stream configuration with minimal pipe
@@ -3985,11 +3986,29 @@ bool dc_update_planes_and_stream(struct dc *dc,
39853986

39863987
/* on plane removal, minimal state is the new one */
39873988
if (force_minimal_pipe_splitting && !is_plane_addition) {
3989+
/* Since all phantom pipes are removed in full validation,
3990+
* we have to save and restore the subvp/mall config when
3991+
* we do a minimal transition since the flags marking the
3992+
* pipe as subvp/phantom will be cleared (dc copy constructor
3993+
* creates a shallow copy).
3994+
*/
3995+
if (dc->res_pool->funcs->save_mall_state)
3996+
dc->res_pool->funcs->save_mall_state(dc, context, &mall_temp_config);
39883997
if (!commit_minimal_transition_state(dc, context)) {
39893998
dc_release_state(context);
39903999
return false;
39914000
}
3992-
4001+
if (dc->res_pool->funcs->restore_mall_state)
4002+
dc->res_pool->funcs->restore_mall_state(dc, context, &mall_temp_config);
4003+
4004+
/* If we do a minimal transition with plane removal and the context
4005+
* has subvp we also have to retain back the phantom stream / planes
4006+
* since the refcount is decremented as part of the min transition
4007+
* (we commit a state with no subvp, so the phantom streams / planes
4008+
* had to be removed).
4009+
*/
4010+
if (dc->res_pool->funcs->retain_phantom_pipes)
4011+
dc->res_pool->funcs->retain_phantom_pipes(dc, context);
39934012
update_type = UPDATE_TYPE_FULL;
39944013
}
39954014

drivers/gpu/drm/amd/display/dc/dc_stream.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,17 @@ struct mall_stream_config {
160160
struct dc_stream_state *paired_stream; // master / slave stream
161161
};
162162

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+
163174
struct dc_stream_state {
164175
// sink is deprecated, new code should not reference
165176
// this pointer

drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2069,6 +2069,8 @@ static struct resource_funcs dcn32_res_pool_funcs = {
20692069
.add_phantom_pipes = dcn32_add_phantom_pipes,
20702070
.remove_phantom_pipes = dcn32_remove_phantom_pipes,
20712071
.retain_phantom_pipes = dcn32_retain_phantom_pipes,
2072+
.save_mall_state = dcn32_save_mall_state,
2073+
.restore_mall_state = dcn32_restore_mall_state,
20722074
};
20732075

20742076

drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,6 @@
4545
extern struct _vcs_dpi_ip_params_st dcn3_2_ip;
4646
extern struct _vcs_dpi_soc_bounding_box_st dcn3_2_soc;
4747

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-
5948
struct dcn32_resource_pool {
6049
struct resource_pool base;
6150
};

drivers/gpu/drm/amd/display/dc/dcn321/dcn321_resource.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1622,6 +1622,8 @@ static struct resource_funcs dcn321_res_pool_funcs = {
16221622
.add_phantom_pipes = dcn32_add_phantom_pipes,
16231623
.remove_phantom_pipes = dcn32_remove_phantom_pipes,
16241624
.retain_phantom_pipes = dcn32_retain_phantom_pipes,
1625+
.save_mall_state = dcn32_save_mall_state,
1626+
.restore_mall_state = dcn32_restore_mall_state,
16251627
};
16261628

16271629

drivers/gpu/drm/amd/display/dc/inc/core_types.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,8 @@ struct resource_funcs {
243243
bool (*remove_phantom_pipes)(struct dc *dc, struct dc_state *context, bool fast_update);
244244
void (*retain_phantom_pipes)(struct dc *dc, struct dc_state *context);
245245
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);
246248
};
247249

248250
struct audio_support{

0 commit comments

Comments
 (0)