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

drm/amd/display: When resync fifo ensure to use correct pipe ctx

We resync the FIFO after each pipe update in apply_ctx_to_hw.
However, this means that some pipes (in hardware) are based on the
new context and some are based on the current_state (since the pipes
are updated on at a time). In this case we must ensure to use the
pipe_ctx that's currently still configured in hardware when turning
off / on OTG's and reconfiguring ODM during the resync.
Reviewed-by: default avatarNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Signed-off-by: default avatarJerry Zuo <jerry.zuo@amd.com>
Signed-off-by: default avatarAlvin Lee <alvin.lee2@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent f5c78386
...@@ -2443,7 +2443,7 @@ enum dc_status dce110_apply_ctx_to_hw( ...@@ -2443,7 +2443,7 @@ enum dc_status dce110_apply_ctx_to_hw(
#ifdef CONFIG_DRM_AMD_DC_FP #ifdef CONFIG_DRM_AMD_DC_FP
if (hws->funcs.resync_fifo_dccg_dio) if (hws->funcs.resync_fifo_dccg_dio)
hws->funcs.resync_fifo_dccg_dio(hws, dc, context); hws->funcs.resync_fifo_dccg_dio(hws, dc, context, i);
#endif #endif
} }
......
...@@ -355,14 +355,18 @@ void dcn314_calculate_pix_rate_divider( ...@@ -355,14 +355,18 @@ void dcn314_calculate_pix_rate_divider(
} }
} }
void dcn314_resync_fifo_dccg_dio(struct dce_hwseq *hws, struct dc *dc, struct dc_state *context) void dcn314_resync_fifo_dccg_dio(struct dce_hwseq *hws, struct dc *dc, struct dc_state *context, unsigned int current_pipe_idx)
{ {
unsigned int i; unsigned int i;
struct pipe_ctx *pipe = NULL; struct pipe_ctx *pipe = NULL;
bool otg_disabled[MAX_PIPES] = {false}; bool otg_disabled[MAX_PIPES] = {false};
for (i = 0; i < dc->res_pool->pipe_count; i++) { for (i = 0; i < dc->res_pool->pipe_count; i++) {
pipe = &dc->current_state->res_ctx.pipe_ctx[i]; if (i <= current_pipe_idx) {
pipe = &context->res_ctx.pipe_ctx[i];
} else {
pipe = &dc->current_state->res_ctx.pipe_ctx[i];
}
if (pipe->top_pipe || pipe->prev_odm_pipe) if (pipe->top_pipe || pipe->prev_odm_pipe)
continue; continue;
...@@ -377,7 +381,10 @@ void dcn314_resync_fifo_dccg_dio(struct dce_hwseq *hws, struct dc *dc, struct dc ...@@ -377,7 +381,10 @@ void dcn314_resync_fifo_dccg_dio(struct dce_hwseq *hws, struct dc *dc, struct dc
hws->ctx->dc->res_pool->dccg->funcs->trigger_dio_fifo_resync(hws->ctx->dc->res_pool->dccg); hws->ctx->dc->res_pool->dccg->funcs->trigger_dio_fifo_resync(hws->ctx->dc->res_pool->dccg);
for (i = 0; i < dc->res_pool->pipe_count; i++) { for (i = 0; i < dc->res_pool->pipe_count; i++) {
pipe = &dc->current_state->res_ctx.pipe_ctx[i]; if (i <= current_pipe_idx)
pipe = &context->res_ctx.pipe_ctx[i];
else
pipe = &dc->current_state->res_ctx.pipe_ctx[i];
if (otg_disabled[i]) { if (otg_disabled[i]) {
int opp_inst[MAX_PIPES] = { pipe->stream_res.opp->inst }; int opp_inst[MAX_PIPES] = { pipe->stream_res.opp->inst };
......
...@@ -41,7 +41,7 @@ unsigned int dcn314_calculate_dccg_k1_k2_values(struct pipe_ctx *pipe_ctx, unsig ...@@ -41,7 +41,7 @@ unsigned int dcn314_calculate_dccg_k1_k2_values(struct pipe_ctx *pipe_ctx, unsig
void dcn314_calculate_pix_rate_divider(struct dc *dc, struct dc_state *context, const struct dc_stream_state *stream); void dcn314_calculate_pix_rate_divider(struct dc *dc, struct dc_state *context, const struct dc_stream_state *stream);
void dcn314_resync_fifo_dccg_dio(struct dce_hwseq *hws, struct dc *dc, struct dc_state *context); void dcn314_resync_fifo_dccg_dio(struct dce_hwseq *hws, struct dc *dc, struct dc_state *context, unsigned int current_pipe_idx);
void dcn314_dpp_root_clock_control(struct dce_hwseq *hws, unsigned int dpp_inst, bool clock_on); void dcn314_dpp_root_clock_control(struct dce_hwseq *hws, unsigned int dpp_inst, bool clock_on);
......
...@@ -1201,20 +1201,27 @@ void dcn32_calculate_pix_rate_divider( ...@@ -1201,20 +1201,27 @@ void dcn32_calculate_pix_rate_divider(
} }
} }
void dcn32_resync_fifo_dccg_dio(struct dce_hwseq *hws, struct dc *dc, struct dc_state *context) void dcn32_resync_fifo_dccg_dio(struct dce_hwseq *hws, struct dc *dc, struct dc_state *context, unsigned int current_pipe_idx)
{ {
unsigned int i; unsigned int i;
struct pipe_ctx *pipe = NULL; struct pipe_ctx *pipe = NULL;
bool otg_disabled[MAX_PIPES] = {false}; bool otg_disabled[MAX_PIPES] = {false};
struct dc_state *dc_state = NULL;
for (i = 0; i < dc->res_pool->pipe_count; i++) { for (i = 0; i < dc->res_pool->pipe_count; i++) {
pipe = &dc->current_state->res_ctx.pipe_ctx[i]; if (i <= current_pipe_idx) {
pipe = &context->res_ctx.pipe_ctx[i];
dc_state = context;
} else {
pipe = &dc->current_state->res_ctx.pipe_ctx[i];
dc_state = dc->current_state;
}
if (!resource_is_pipe_type(pipe, OTG_MASTER)) if (!resource_is_pipe_type(pipe, OTG_MASTER))
continue; continue;
if ((pipe->stream->dpms_off || dc_is_virtual_signal(pipe->stream->signal)) if ((pipe->stream->dpms_off || dc_is_virtual_signal(pipe->stream->signal))
&& dc_state_get_pipe_subvp_type(dc->current_state, pipe) != SUBVP_PHANTOM) { && dc_state_get_pipe_subvp_type(dc_state, pipe) != SUBVP_PHANTOM) {
pipe->stream_res.tg->funcs->disable_crtc(pipe->stream_res.tg); pipe->stream_res.tg->funcs->disable_crtc(pipe->stream_res.tg);
reset_sync_context_for_pipe(dc, context, i); reset_sync_context_for_pipe(dc, context, i);
otg_disabled[i] = true; otg_disabled[i] = true;
...@@ -1224,7 +1231,10 @@ void dcn32_resync_fifo_dccg_dio(struct dce_hwseq *hws, struct dc *dc, struct dc_ ...@@ -1224,7 +1231,10 @@ void dcn32_resync_fifo_dccg_dio(struct dce_hwseq *hws, struct dc *dc, struct dc_
hws->ctx->dc->res_pool->dccg->funcs->trigger_dio_fifo_resync(hws->ctx->dc->res_pool->dccg); hws->ctx->dc->res_pool->dccg->funcs->trigger_dio_fifo_resync(hws->ctx->dc->res_pool->dccg);
for (i = 0; i < dc->res_pool->pipe_count; i++) { for (i = 0; i < dc->res_pool->pipe_count; i++) {
pipe = &dc->current_state->res_ctx.pipe_ctx[i]; if (i <= current_pipe_idx)
pipe = &context->res_ctx.pipe_ctx[i];
else
pipe = &dc->current_state->res_ctx.pipe_ctx[i];
if (otg_disabled[i]) { if (otg_disabled[i]) {
int opp_inst[MAX_PIPES] = { pipe->stream_res.opp->inst }; int opp_inst[MAX_PIPES] = { pipe->stream_res.opp->inst };
...@@ -1572,7 +1582,7 @@ void dcn32_enable_phantom_streams(struct dc *dc, struct dc_state *context) ...@@ -1572,7 +1582,7 @@ void dcn32_enable_phantom_streams(struct dc *dc, struct dc_state *context)
#ifdef CONFIG_DRM_AMD_DC_FP #ifdef CONFIG_DRM_AMD_DC_FP
if (hws->funcs.resync_fifo_dccg_dio) if (hws->funcs.resync_fifo_dccg_dio)
hws->funcs.resync_fifo_dccg_dio(hws, dc, context); hws->funcs.resync_fifo_dccg_dio(hws, dc, context, i);
#endif #endif
} }
} }
......
...@@ -75,7 +75,7 @@ void dcn32_update_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable); ...@@ -75,7 +75,7 @@ void dcn32_update_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable);
unsigned int dcn32_calculate_dccg_k1_k2_values(struct pipe_ctx *pipe_ctx, unsigned int *k1_div, unsigned int *k2_div); unsigned int dcn32_calculate_dccg_k1_k2_values(struct pipe_ctx *pipe_ctx, unsigned int *k1_div, unsigned int *k2_div);
void dcn32_resync_fifo_dccg_dio(struct dce_hwseq *hws, struct dc *dc, struct dc_state *context); void dcn32_resync_fifo_dccg_dio(struct dce_hwseq *hws, struct dc *dc, struct dc_state *context, unsigned int current_pipe_idx);
void dcn32_subvp_pipe_control_lock(struct dc *dc, void dcn32_subvp_pipe_control_lock(struct dc *dc,
struct dc_state *context, struct dc_state *context,
......
...@@ -170,7 +170,8 @@ struct hwseq_private_funcs { ...@@ -170,7 +170,8 @@ struct hwseq_private_funcs {
unsigned int *k1_div, unsigned int *k1_div,
unsigned int *k2_div); unsigned int *k2_div);
void (*resync_fifo_dccg_dio)(struct dce_hwseq *hws, struct dc *dc, void (*resync_fifo_dccg_dio)(struct dce_hwseq *hws, struct dc *dc,
struct dc_state *context); struct dc_state *context,
unsigned int current_pipe_idx);
enum dc_status (*apply_single_controller_ctx_to_hw)( enum dc_status (*apply_single_controller_ctx_to_hw)(
struct pipe_ctx *pipe_ctx, struct pipe_ctx *pipe_ctx,
struct dc_state *context, struct dc_state *context,
......
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