Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "drm/amd/display: Fix for otg synchronization logic"

This reverts commit a896f870f8a5f23ec961d16baffd3fda1f8be57c.

It causes odd flickering on my Radeon RX580 (PCI ID 1002:67df rev e7,
subsystem ID 1da2:e353).

Bisected right to this commit, and reverting it fixes things.

Link: https://lore.kernel.org/all/CAHk-=wg9hDde_L3bK9tAfdJ4N=TJJ+SjO3ZDONqH5=bVoy_Mzg@mail.gmail.com/
Cc: Alex Deucher <alexdeucher@gmail.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Dave Airlie <airlied@gmail.com>
Cc: Christian Koenig <christian.koenig@amd.com>
Cc: Jun Lei <Jun.Lei@amd.com>
Cc: Mustapha Ghaddar <mustapha.ghaddar@amd.com>
Cc: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Cc: meenakshikumar somasundaram <meenakshikumar.somasundaram@amd.com>
Cc: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

+14 -99
+14 -21
drivers/gpu/drm/amd/display/dc/core/dc.c
··· 1404 1404 status->timing_sync_info.master = false; 1405 1405 1406 1406 } 1407 + /* remove any other unblanked pipes as they have already been synced */ 1408 + for (j = j + 1; j < group_size; j++) { 1409 + bool is_blanked; 1407 1410 1408 - /* remove any other pipes that are already been synced */ 1409 - if (dc->config.use_pipe_ctx_sync_logic) { 1410 - /* check pipe's syncd to decide which pipe to be removed */ 1411 - for (j = 1; j < group_size; j++) { 1412 - if (pipe_set[j]->pipe_idx_syncd == pipe_set[0]->pipe_idx_syncd) { 1413 - group_size--; 1414 - pipe_set[j] = pipe_set[group_size]; 1415 - j--; 1416 - } else 1417 - /* link slave pipe's syncd with master pipe */ 1418 - pipe_set[j]->pipe_idx_syncd = pipe_set[0]->pipe_idx_syncd; 1411 + if (pipe_set[j]->stream_res.opp->funcs->dpg_is_blanked) 1412 + is_blanked = 1413 + pipe_set[j]->stream_res.opp->funcs->dpg_is_blanked(pipe_set[j]->stream_res.opp); 1414 + else 1415 + is_blanked = 1416 + pipe_set[j]->stream_res.tg->funcs->is_blanked(pipe_set[j]->stream_res.tg); 1417 + if (!is_blanked) { 1418 + group_size--; 1419 + pipe_set[j] = pipe_set[group_size]; 1420 + j--; 1419 1421 } 1420 - } else { 1421 - /* remove any other pipes by checking valid plane */ 1422 - for (j = j + 1; j < group_size; j++) { 1423 - if (pipe_set[j]->plane_state) { 1424 - group_size--; 1425 - pipe_set[j] = pipe_set[group_size]; 1426 - j--; 1427 - } 1428 - } 1429 - } 1422 + } 1430 1423 1431 1424 if (group_size > 1) { 1432 1425 if (sync_type == TIMING_SYNCHRONIZABLE) {
-54
drivers/gpu/drm/amd/display/dc/core/dc_resource.c
··· 3216 3216 return hpo_dp_link_enc; 3217 3217 } 3218 3218 #endif 3219 - 3220 - void reset_syncd_pipes_from_disabled_pipes(struct dc *dc, 3221 - struct dc_state *context) 3222 - { 3223 - int i, j; 3224 - struct pipe_ctx *pipe_ctx_old, *pipe_ctx, *pipe_ctx_syncd; 3225 - 3226 - /* If pipe backend is reset, need to reset pipe syncd status */ 3227 - for (i = 0; i < dc->res_pool->pipe_count; i++) { 3228 - pipe_ctx_old = &dc->current_state->res_ctx.pipe_ctx[i]; 3229 - pipe_ctx = &context->res_ctx.pipe_ctx[i]; 3230 - 3231 - if (!pipe_ctx_old->stream) 3232 - continue; 3233 - 3234 - if (pipe_ctx_old->top_pipe || pipe_ctx_old->prev_odm_pipe) 3235 - continue; 3236 - 3237 - if (!pipe_ctx->stream || 3238 - pipe_need_reprogram(pipe_ctx_old, pipe_ctx)) { 3239 - 3240 - /* Reset all the syncd pipes from the disabled pipe */ 3241 - for (j = 0; j < dc->res_pool->pipe_count; j++) { 3242 - pipe_ctx_syncd = &context->res_ctx.pipe_ctx[j]; 3243 - if ((GET_PIPE_SYNCD_FROM_PIPE(pipe_ctx_syncd) == pipe_ctx_old->pipe_idx) || 3244 - !IS_PIPE_SYNCD_VALID(pipe_ctx_syncd)) 3245 - SET_PIPE_SYNCD_TO_PIPE(pipe_ctx_syncd, j); 3246 - } 3247 - } 3248 - } 3249 - } 3250 - 3251 - void check_syncd_pipes_for_disabled_master_pipe(struct dc *dc, 3252 - struct dc_state *context, 3253 - uint8_t disabled_master_pipe_idx) 3254 - { 3255 - int i; 3256 - struct pipe_ctx *pipe_ctx, *pipe_ctx_check; 3257 - 3258 - pipe_ctx = &context->res_ctx.pipe_ctx[disabled_master_pipe_idx]; 3259 - if ((GET_PIPE_SYNCD_FROM_PIPE(pipe_ctx) != disabled_master_pipe_idx) || 3260 - !IS_PIPE_SYNCD_VALID(pipe_ctx)) 3261 - SET_PIPE_SYNCD_TO_PIPE(pipe_ctx, disabled_master_pipe_idx); 3262 - 3263 - /* for the pipe disabled, check if any slave pipe exists and assert */ 3264 - for (i = 0; i < dc->res_pool->pipe_count; i++) { 3265 - pipe_ctx_check = &context->res_ctx.pipe_ctx[i]; 3266 - 3267 - if ((GET_PIPE_SYNCD_FROM_PIPE(pipe_ctx_check) == disabled_master_pipe_idx) && 3268 - IS_PIPE_SYNCD_VALID(pipe_ctx_check) && (i != disabled_master_pipe_idx)) 3269 - DC_ERR("DC: Failure: pipe_idx[%d] syncd with disabled master pipe_idx[%d]\n", 3270 - i, disabled_master_pipe_idx); 3271 - } 3272 - }
-1
drivers/gpu/drm/amd/display/dc/dc.h
··· 344 344 uint8_t vblank_alignment_max_frame_time_diff; 345 345 bool is_asymmetric_memory; 346 346 bool is_single_rank_dimm; 347 - bool use_pipe_ctx_sync_logic; 348 347 }; 349 348 350 349 enum visual_confirm {
-8
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
··· 1566 1566 &pipe_ctx->stream->audio_info); 1567 1567 } 1568 1568 1569 - /* make sure no pipes syncd to the pipe being enabled */ 1570 - if (!pipe_ctx->stream->apply_seamless_boot_optimization && dc->config.use_pipe_ctx_sync_logic) 1571 - check_syncd_pipes_for_disabled_master_pipe(dc, context, pipe_ctx->pipe_idx); 1572 - 1573 1569 #if defined(CONFIG_DRM_AMD_DC_DCN) 1574 1570 /* DCN3.1 FPGA Workaround 1575 1571 * Need to enable HPO DP Stream Encoder before setting OTG master enable. ··· 2296 2300 struct dc_bios *dcb = dc->ctx->dc_bios; 2297 2301 enum dc_status status; 2298 2302 int i; 2299 - 2300 - /* reset syncd pipes from disabled pipes */ 2301 - if (dc->config.use_pipe_ctx_sync_logic) 2302 - reset_syncd_pipes_from_disabled_pipes(dc, context); 2303 2303 2304 2304 /* Reset old context */ 2305 2305 /* look up the targets that have been removed since last commit */
-3
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c
··· 2260 2260 dc->caps.color.mpc.ogam_rom_caps.hlg = 0; 2261 2261 dc->caps.color.mpc.ocsc = 1; 2262 2262 2263 - /* Use pipe context based otg sync logic */ 2264 - dc->config.use_pipe_ctx_sync_logic = true; 2265 - 2266 2263 /* read VBIOS LTTPR caps */ 2267 2264 { 2268 2265 if (ctx->dc_bios->funcs->get_lttpr_caps) {
-1
drivers/gpu/drm/amd/display/dc/inc/core_types.h
··· 382 382 struct pll_settings pll_settings; 383 383 384 384 uint8_t pipe_idx; 385 - uint8_t pipe_idx_syncd; 386 385 387 386 struct pipe_ctx *top_pipe; 388 387 struct pipe_ctx *bottom_pipe;
-11
drivers/gpu/drm/amd/display/dc/inc/resource.h
··· 34 34 #define MEMORY_TYPE_HBM 2 35 35 36 36 37 - #define IS_PIPE_SYNCD_VALID(pipe) ((((pipe)->pipe_idx_syncd) & 0x80)?1:0) 38 - #define GET_PIPE_SYNCD_FROM_PIPE(pipe) ((pipe)->pipe_idx_syncd & 0x7F) 39 - #define SET_PIPE_SYNCD_TO_PIPE(pipe, pipe_syncd) ((pipe)->pipe_idx_syncd = (0x80 | pipe_syncd)) 40 - 41 37 enum dce_version resource_parse_asic_id( 42 38 struct hw_asic_id asic_id); 43 39 ··· 207 211 const struct resource_pool *pool, 208 212 const struct dc_link *link); 209 213 #endif 210 - 211 - void reset_syncd_pipes_from_disabled_pipes(struct dc *dc, 212 - struct dc_state *context); 213 - 214 - void check_syncd_pipes_for_disabled_master_pipe(struct dc *dc, 215 - struct dc_state *context, 216 - uint8_t disabled_master_pipe_idx); 217 214 218 215 #endif /* DRIVERS_GPU_DRM_AMD_DC_DEV_DC_INC_RESOURCE_H_ */