Skip to content

Commit 5097157

Browse files
Fudongwanggregkh
authored andcommitted
drm/amd/display: fix disable otg wa logic in DCN316
commit cf79814 upstream. [Why] Wrong logic cause screen corruption. [How] Port logic from DCN35/314. Cc: [email protected] Reviewed-by: Nicholas Kazlauskas <[email protected]> Acked-by: Hamza Mahfooz <[email protected]> Signed-off-by: Fudongwang <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 5ca6cbd commit 5097157

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn316/dcn316_clk_mgr.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,20 +99,25 @@ static int dcn316_get_active_display_cnt_wa(
9999
return display_count;
100100
}
101101

102-
static void dcn316_disable_otg_wa(struct clk_mgr *clk_mgr_base, struct dc_state *context, bool disable)
102+
static void dcn316_disable_otg_wa(struct clk_mgr *clk_mgr_base, struct dc_state *context,
103+
bool safe_to_lower, bool disable)
103104
{
104105
struct dc *dc = clk_mgr_base->ctx->dc;
105106
int i;
106107

107108
for (i = 0; i < dc->res_pool->pipe_count; ++i) {
108-
struct pipe_ctx *pipe = &dc->current_state->res_ctx.pipe_ctx[i];
109+
struct pipe_ctx *pipe = safe_to_lower
110+
? &context->res_ctx.pipe_ctx[i]
111+
: &dc->current_state->res_ctx.pipe_ctx[i];
109112

110113
if (pipe->top_pipe || pipe->prev_odm_pipe)
111114
continue;
112-
if (pipe->stream && (pipe->stream->dpms_off || pipe->plane_state == NULL ||
113-
dc_is_virtual_signal(pipe->stream->signal))) {
115+
if (pipe->stream && (pipe->stream->dpms_off || dc_is_virtual_signal(pipe->stream->signal) ||
116+
!pipe->stream->link_enc)) {
114117
if (disable) {
115-
pipe->stream_res.tg->funcs->immediate_disable_crtc(pipe->stream_res.tg);
118+
if (pipe->stream_res.tg && pipe->stream_res.tg->funcs->immediate_disable_crtc)
119+
pipe->stream_res.tg->funcs->immediate_disable_crtc(pipe->stream_res.tg);
120+
116121
reset_sync_context_for_pipe(dc, context, i);
117122
} else
118123
pipe->stream_res.tg->funcs->enable_crtc(pipe->stream_res.tg);
@@ -207,11 +212,11 @@ static void dcn316_update_clocks(struct clk_mgr *clk_mgr_base,
207212
}
208213

209214
if (should_set_clock(safe_to_lower, new_clocks->dispclk_khz, clk_mgr_base->clks.dispclk_khz)) {
210-
dcn316_disable_otg_wa(clk_mgr_base, context, true);
215+
dcn316_disable_otg_wa(clk_mgr_base, context, safe_to_lower, true);
211216

212217
clk_mgr_base->clks.dispclk_khz = new_clocks->dispclk_khz;
213218
dcn316_smu_set_dispclk(clk_mgr, clk_mgr_base->clks.dispclk_khz);
214-
dcn316_disable_otg_wa(clk_mgr_base, context, false);
219+
dcn316_disable_otg_wa(clk_mgr_base, context, safe_to_lower, false);
215220

216221
update_dispclk = true;
217222
}

0 commit comments

Comments
 (0)