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

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
Loading
Loading
Loading
Loading
+20 −1
Original line number Diff line number Diff line
@@ -3954,6 +3954,7 @@ bool dc_update_planes_and_stream(struct dc *dc,
	struct dc_state *context;
	enum surface_update_type update_type;
	int i;
	struct mall_temp_config mall_temp_config;

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

	/* on plane removal, minimal state is the new one */
	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)) {
			dc_release_state(context);
			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;
	}

+11 −0
Original line number Diff line number Diff line
@@ -160,6 +160,17 @@ struct mall_stream_config {
	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 {
	// sink is deprecated, new code should not reference
	// this pointer
+2 −0
Original line number Diff line number Diff line
@@ -2069,6 +2069,8 @@ static struct resource_funcs dcn32_res_pool_funcs = {
	.add_phantom_pipes = dcn32_add_phantom_pipes,
	.remove_phantom_pipes = dcn32_remove_phantom_pipes,
	.retain_phantom_pipes = dcn32_retain_phantom_pipes,
	.save_mall_state = dcn32_save_mall_state,
	.restore_mall_state = dcn32_restore_mall_state,
};


+0 −11
Original line number Diff line number Diff line
@@ -45,17 +45,6 @@
extern struct _vcs_dpi_ip_params_st dcn3_2_ip;
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 resource_pool base;
};
+2 −0
Original line number Diff line number Diff line
@@ -1622,6 +1622,8 @@ static struct resource_funcs dcn321_res_pool_funcs = {
	.add_phantom_pipes = dcn32_add_phantom_pipes,
	.remove_phantom_pipes = dcn32_remove_phantom_pipes,
	.retain_phantom_pipes = dcn32_retain_phantom_pipes,
	.save_mall_state = dcn32_save_mall_state,
	.restore_mall_state = dcn32_restore_mall_state,
};


Loading