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

drm/amd/display: Updates SubVP and SubVP DRR cases

[Description]
- For any DRR cases in SubVP, don't lock for VSYNC flips
- For DCN32/321 use FW to do DRR manual trigger programming
- Add bit in SubVP cmd to indicate if the SubVP pipe is DRR

Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alvin Lee <Alvin.Lee2@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Alvin Lee and committed by
Alex Deucher
319568d7 2ce0b218

+82 -6
+17
drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c
··· 270 270 dc_dmub_srv_wait_idle(dc->ctx->dmub_srv); 271 271 } 272 272 273 + void dc_dmub_srv_set_drr_manual_trigger_cmd(struct dc *dc, uint32_t tg_inst) 274 + { 275 + union dmub_rb_cmd cmd = { 0 }; 276 + 277 + cmd.drr_update.header.type = DMUB_CMD__FW_ASSISTED_MCLK_SWITCH; 278 + // TODO: Uncomment once FW headers are promoted 279 + //cmd.drr_update.header.sub_type = DMUB_CMD__FAMS_SET_MANUAL_TRIGGER; 280 + cmd.drr_update.dmub_optc_state_req.tg_inst = tg_inst; 281 + 282 + cmd.drr_update.header.payload_bytes = sizeof(cmd.drr_update) - sizeof(cmd.drr_update.header); 283 + 284 + // Send the command to the DMCUB. 285 + dc_dmub_srv_cmd_queue(dc->ctx->dmub_srv, &cmd); 286 + dc_dmub_srv_cmd_execute(dc->ctx->dmub_srv); 287 + dc_dmub_srv_wait_idle(dc->ctx->dmub_srv); 288 + } 289 + 273 290 static uint8_t dc_dmub_srv_get_pipes_for_stream(struct dc *dc, struct dc_stream_state *stream) 274 291 { 275 292 uint8_t pipes = 0;
+1
drivers/gpu/drm/amd/display/dc/dc_dmub_srv.h
··· 74 74 75 75 void dc_dmub_srv_drr_update_cmd(struct dc *dc, uint32_t tg_inst, uint32_t vtotal_min, uint32_t vtotal_max); 76 76 77 + void dc_dmub_srv_set_drr_manual_trigger_cmd(struct dc *dc, uint32_t tg_inst); 77 78 bool dc_dmub_srv_p_state_delegate(struct dc *dc, bool enable_pstate, struct dc_state *context); 78 79 79 80 void dc_dmub_srv_query_caps_cmd(struct dmub_srv *dmub);
+2 -5
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c
··· 424 424 unsigned int i = 0; 425 425 bool subvp_immediate_flip = false; 426 426 bool subvp_in_use = false; 427 - bool drr_pipe = false; 428 427 struct pipe_ctx *pipe; 429 428 430 429 for (i = 0; i < dc->res_pool->pipe_count; i++) { ··· 439 440 if (top_pipe_to_program->stream->mall_stream_config.type == SUBVP_MAIN && 440 441 top_pipe_to_program->plane_state->flip_immediate) 441 442 subvp_immediate_flip = true; 442 - else if (top_pipe_to_program->stream->mall_stream_config.type == SUBVP_NONE && 443 - top_pipe_to_program->stream->ignore_msa_timing_param) 444 - drr_pipe = true; 445 443 } 446 444 447 - if ((subvp_in_use && (should_lock_all_pipes || subvp_immediate_flip || drr_pipe)) || (!subvp_in_use && subvp_prev_use)) { 445 + // Don't need to lock for DRR VSYNC flips -- FW will wait for DRR pending update cleared. 446 + if ((subvp_in_use && (should_lock_all_pipes || subvp_immediate_flip)) || (!subvp_in_use && subvp_prev_use)) { 448 447 union dmub_inbox0_cmd_lock_hw hw_lock_cmd = { 0 }; 449 448 450 449 if (!lock) {
+62 -1
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_optc.c
··· 26 26 #include "dcn32_optc.h" 27 27 28 28 #include "dcn30/dcn30_optc.h" 29 + #include "dcn31/dcn31_optc.h" 29 30 #include "reg_helper.h" 30 31 #include "dc.h" 31 32 #include "dcn_calc_math.h" 33 + #include "dc_dmub_srv.h" 32 34 33 35 #define REG(reg)\ 34 36 optc1->tg_regs->reg ··· 190 188 optc1->opp_count = 1; 191 189 } 192 190 191 + void optc32_setup_manual_trigger(struct timing_generator *optc) 192 + { 193 + struct optc *optc1 = DCN10TG_FROM_TG(optc); 194 + struct dc *dc = optc->ctx->dc; 195 + 196 + if (dc->caps.dmub_caps.mclk_sw && !dc->debug.disable_fams) 197 + dc_dmub_srv_set_drr_manual_trigger_cmd(dc, optc->inst); 198 + else { 199 + /* 200 + * MIN_MASK_EN is gone and MASK is now always enabled. 201 + * 202 + * To get it to it work with manual trigger we need to make sure 203 + * we program the correct bit. 204 + */ 205 + REG_UPDATE_4(OTG_V_TOTAL_CONTROL, 206 + OTG_V_TOTAL_MIN_SEL, 1, 207 + OTG_V_TOTAL_MAX_SEL, 1, 208 + OTG_FORCE_LOCK_ON_EVENT, 0, 209 + OTG_SET_V_TOTAL_MIN_MASK, (1 << 1)); /* TRIGA */ 210 + 211 + // Setup manual flow control for EOF via TRIG_A 212 + optc->funcs->setup_manual_trigger(optc); 213 + } 214 + } 215 + 216 + void optc32_set_drr( 217 + struct timing_generator *optc, 218 + const struct drr_params *params) 219 + { 220 + struct optc *optc1 = DCN10TG_FROM_TG(optc); 221 + 222 + if (params != NULL && 223 + params->vertical_total_max > 0 && 224 + params->vertical_total_min > 0) { 225 + 226 + if (params->vertical_total_mid != 0) { 227 + 228 + REG_SET(OTG_V_TOTAL_MID, 0, 229 + OTG_V_TOTAL_MID, params->vertical_total_mid - 1); 230 + 231 + REG_UPDATE_2(OTG_V_TOTAL_CONTROL, 232 + OTG_VTOTAL_MID_REPLACING_MAX_EN, 1, 233 + OTG_VTOTAL_MID_FRAME_NUM, 234 + (uint8_t)params->vertical_total_mid_frame_num); 235 + 236 + } 237 + 238 + optc->funcs->set_vtotal_min_max(optc, params->vertical_total_min - 1, params->vertical_total_max - 1); 239 + optc32_setup_manual_trigger(optc); 240 + } else { 241 + REG_UPDATE_4(OTG_V_TOTAL_CONTROL, 242 + OTG_SET_V_TOTAL_MIN_MASK, 0, 243 + OTG_V_TOTAL_MIN_SEL, 0, 244 + OTG_V_TOTAL_MAX_SEL, 0, 245 + OTG_FORCE_LOCK_ON_EVENT, 0); 246 + 247 + optc->funcs->set_vtotal_min_max(optc, 0, 0); 248 + } 249 + } 193 250 194 251 static struct timing_generator_funcs dcn32_tg_funcs = { 195 252 .validate_timing = optc1_validate_timing, ··· 282 221 .lock_doublebuffer_disable = optc3_lock_doublebuffer_disable, 283 222 .enable_optc_clock = optc1_enable_optc_clock, 284 223 .set_vrr_m_const = optc3_set_vrr_m_const, 285 - .set_drr = optc1_set_drr, 224 + .set_drr = optc31_set_drr, // TODO: Update to optc32_set_drr once FW headers are promoted 286 225 .get_last_used_drr_vtotal = optc2_get_last_used_drr_vtotal, 287 226 .set_vtotal_min_max = optc3_set_vtotal_min_max, 288 227 .set_static_screen_control = optc1_set_static_screen_control,