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

drm/amd/display: Add P-State Keepout to dcn401 Global Sync

[WHY&HOW]
OTG has new functionality to allow P-State relative to VStartup. Keepout region
for this should be configured based on DML outputs same as other global sync
params.

Reviewed-by: Alvin Lee <alvin.lee2@amd.com>
Signed-off-by: Jerry Zuo <jerry.zuo@amd.com>
Signed-off-by: Dillon Varone <dillon.varone@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Dillon Varone and committed by
Alex Deucher
9932ca4c f8220070

+83 -13
+1
drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.c
··· 1955 1955 int vstartup_start, 1956 1956 int vupdate_offset, 1957 1957 int vupdate_width, 1958 + int pstate_keepout, 1958 1959 const enum signal_type signal, 1959 1960 bool use_vbios) 1960 1961 {
+1
drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.h
··· 261 261 int vstartup_start, 262 262 int vupdate_offset, 263 263 int vupdate_width, 264 + int pstate_keepout, 264 265 const enum signal_type signal, 265 266 bool use_vbios); 266 267
+1
drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator_v.c
··· 438 438 int vstartup_start, 439 439 int vupdate_offset, 440 440 int vupdate_width, 441 + int pstate_keepout, 441 442 const enum signal_type signal, 442 443 bool use_vbios) 443 444 {
+1
drivers/gpu/drm/amd/display/dc/dce120/dce120_timing_generator.c
··· 697 697 int vstartup_start, 698 698 int vupdate_offset, 699 699 int vupdate_width, 700 + int pstate_keepout, 700 701 const enum signal_type signal, 701 702 bool use_vbios) 702 703 {
+2 -1
drivers/gpu/drm/amd/display/dc/dce60/dce60_timing_generator.c
··· 111 111 int vstartup_start, 112 112 int vupdate_offset, 113 113 int vupdate_width, 114 + int pstate_keepout, 114 115 const enum signal_type signal, 115 116 bool use_vbios) 116 117 { 117 118 if (!use_vbios) 118 119 program_pix_dur(tg, timing->pix_clk_100hz); 119 120 120 - dce110_tg_program_timing(tg, timing, 0, 0, 0, 0, 0, use_vbios); 121 + dce110_tg_program_timing(tg, timing, 0, 0, 0, 0, 0, 0, use_vbios); 121 122 } 122 123 123 124 static void dce60_timing_generator_enable_advanced_request(
+2 -1
drivers/gpu/drm/amd/display/dc/dce80/dce80_timing_generator.c
··· 111 111 int vstartup_start, 112 112 int vupdate_offset, 113 113 int vupdate_width, 114 + int pstate_keepout, 114 115 const enum signal_type signal, 115 116 bool use_vbios) 116 117 { 117 118 if (!use_vbios) 118 119 program_pix_dur(tg, timing->pix_clk_100hz); 119 120 120 - dce110_tg_program_timing(tg, timing, 0, 0, 0, 0, 0, use_vbios); 121 + dce110_tg_program_timing(tg, timing, 0, 0, 0, 0, 0, 0, use_vbios); 121 122 } 122 123 123 124 static void dce80_timing_generator_enable_advanced_request(
+1
drivers/gpu/drm/amd/display/dc/dml/display_mode_structs.h
··· 523 523 unsigned int vupdate_offset; 524 524 unsigned int vupdate_width; 525 525 unsigned int vready_offset; 526 + unsigned int pstate_keepout; 526 527 unsigned char interlaced; 527 528 double pixel_rate_mhz; 528 529 unsigned char synchronized_vblank_all_planes;
+1
drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_translation_helper.c
··· 1129 1129 pipe_ctx->pipe_dlg_param.vupdate_offset = global_sync->dcn4.vupdate_offset_pixels; 1130 1130 pipe_ctx->pipe_dlg_param.vupdate_width = global_sync->dcn4.vupdate_vupdate_width_pixels; 1131 1131 pipe_ctx->pipe_dlg_param.vready_offset = global_sync->dcn4.vready_offset_pixels; 1132 + pipe_ctx->pipe_dlg_param.pstate_keepout = global_sync->dcn4.pstate_keepout_start_lines; 1132 1133 1133 1134 pipe_ctx->pipe_dlg_param.otg_inst = pipe_ctx->stream_res.tg->inst; 1134 1135
+1
drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c
··· 1549 1549 0, 1550 1550 0, 1551 1551 0, 1552 + 0, 1552 1553 pipe_ctx->stream->signal, 1553 1554 true); 1554 1555 }
+3 -1
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c
··· 1005 1005 pipe_ctx->pipe_dlg_param.vstartup_start, 1006 1006 pipe_ctx->pipe_dlg_param.vupdate_offset, 1007 1007 pipe_ctx->pipe_dlg_param.vupdate_width, 1008 + pipe_ctx->pipe_dlg_param.pstate_keepout, 1008 1009 pipe_ctx->stream->signal, 1009 1010 true); 1010 1011 ··· 2996 2995 calculate_vready_offset_for_group(pipe_ctx), 2997 2996 pipe_ctx->pipe_dlg_param.vstartup_start, 2998 2997 pipe_ctx->pipe_dlg_param.vupdate_offset, 2999 - pipe_ctx->pipe_dlg_param.vupdate_width); 2998 + pipe_ctx->pipe_dlg_param.vupdate_width, 2999 + pipe_ctx->pipe_dlg_param.pstate_keepout); 3000 3000 3001 3001 pipe_ctx->stream_res.tg->funcs->set_vtg_params( 3002 3002 pipe_ctx->stream_res.tg, &pipe_ctx->stream->timing, true);
+5 -2
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c
··· 909 909 pipe_ctx->pipe_dlg_param.vstartup_start, 910 910 pipe_ctx->pipe_dlg_param.vupdate_offset, 911 911 pipe_ctx->pipe_dlg_param.vupdate_width, 912 + pipe_ctx->pipe_dlg_param.pstate_keepout, 912 913 pipe_ctx->stream->signal, 913 914 true); 914 915 ··· 1886 1885 calculate_vready_offset_for_group(pipe_ctx), 1887 1886 pipe_ctx->pipe_dlg_param.vstartup_start, 1888 1887 pipe_ctx->pipe_dlg_param.vupdate_offset, 1889 - pipe_ctx->pipe_dlg_param.vupdate_width); 1888 + pipe_ctx->pipe_dlg_param.vupdate_width, 1889 + pipe_ctx->pipe_dlg_param.pstate_keepout); 1890 1890 1891 1891 if (dc_state_get_pipe_subvp_type(context, pipe_ctx) != SUBVP_PHANTOM) 1892 1892 pipe_ctx->stream_res.tg->funcs->wait_for_state(pipe_ctx->stream_res.tg, CRTC_STATE_VACTIVE); ··· 2460 2458 calculate_vready_offset_for_group(pipe_ctx), 2461 2459 pipe_ctx->pipe_dlg_param.vstartup_start, 2462 2460 pipe_ctx->pipe_dlg_param.vupdate_offset, 2463 - pipe_ctx->pipe_dlg_param.vupdate_width); 2461 + pipe_ctx->pipe_dlg_param.vupdate_width, 2462 + pipe_ctx->pipe_dlg_param.pstate_keepout); 2464 2463 2465 2464 pipe_ctx->stream_res.tg->funcs->set_vtg_params( 2466 2465 pipe_ctx->stream_res.tg, &pipe_ctx->stream->timing, false);
+1
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c
··· 871 871 pipe_ctx->pipe_dlg_param.vstartup_start, 872 872 pipe_ctx->pipe_dlg_param.vupdate_offset, 873 873 pipe_ctx->pipe_dlg_param.vupdate_width, 874 + pipe_ctx->pipe_dlg_param.pstate_keepout, 874 875 pipe_ctx->stream->signal, 875 876 true); 876 877
+4 -1
drivers/gpu/drm/amd/display/dc/inc/hw/optc.h
··· 65 65 int vupdate_offset; 66 66 int vupdate_width; 67 67 int vready_offset; 68 + int pstate_keepout; 68 69 struct dc_crtc_timing orginal_patched_timing; 69 70 enum signal_type signal; 70 71 }; ··· 111 110 int vstartup_start, 112 111 int vupdate_offset, 113 112 int vupdate_width, 113 + int pstate_keepout, 114 114 const enum signal_type signal, 115 115 bool use_vbios); 116 116 ··· 129 127 int vready_offset, 130 128 int vstartup_start, 131 129 int vupdate_offset, 132 - int vupdate_width); 130 + int vupdate_width, 131 + int pstate_keepout); 133 132 134 133 bool optc1_disable_crtc(struct timing_generator *optc); 135 134
+3 -1
drivers/gpu/drm/amd/display/dc/inc/hw/timing_generator.h
··· 172 172 int vstartup_start, 173 173 int vupdate_offset, 174 174 int vupdate_width, 175 + int pstate_keepout, 175 176 const enum signal_type signal, 176 177 bool use_vbios 177 178 ); ··· 257 256 int vready_offset, 258 257 int vstartup_start, 259 258 int vupdate_offset, 260 - int vupdate_width); 259 + int vupdate_width, 260 + int pstate_keepout); 261 261 void (*enable_optc_clock)(struct timing_generator *tg, bool enable); 262 262 void (*program_stereo)(struct timing_generator *tg, 263 263 const struct dc_crtc_timing *timing, struct crtc_stereo_flags *flags);
+7 -2
drivers/gpu/drm/amd/display/dc/optc/dcn10/dcn10_optc.c
··· 65 65 int vready_offset, 66 66 int vstartup_start, 67 67 int vupdate_offset, 68 - int vupdate_width) 68 + int vupdate_width, 69 + int pstate_keepout) 69 70 { 70 71 struct optc *optc1 = DCN10TG_FROM_TG(optc); 71 72 ··· 74 73 optc1->vstartup_start = vstartup_start; 75 74 optc1->vupdate_offset = vupdate_offset; 76 75 optc1->vupdate_width = vupdate_width; 76 + optc1->pstate_keepout = pstate_keepout; 77 77 78 78 if (optc1->vstartup_start == 0) { 79 79 BREAK_TO_DEBUGGER(); ··· 159 157 int vstartup_start, 160 158 int vupdate_offset, 161 159 int vupdate_width, 160 + int pstate_keepout, 162 161 const enum signal_type signal, 163 162 bool use_vbios) 164 163 { ··· 180 177 optc1->vstartup_start = vstartup_start; 181 178 optc1->vupdate_offset = vupdate_offset; 182 179 optc1->vupdate_width = vupdate_width; 180 + optc1->pstate_keepout = pstate_keepout; 183 181 patched_crtc_timing = *dc_crtc_timing; 184 182 apply_front_porch_workaround(&patched_crtc_timing); 185 183 optc1->orginal_patched_timing = patched_crtc_timing; ··· 286 282 vready_offset, 287 283 vstartup_start, 288 284 vupdate_offset, 289 - vupdate_width); 285 + vupdate_width, 286 + pstate_keepout); 290 287 291 288 optc->funcs->set_vtg_params(optc, dc_crtc_timing, true); 292 289
+6 -1
drivers/gpu/drm/amd/display/dc/optc/dcn10/dcn10_optc.h
··· 201 201 uint32_t OTG_CRC1_WINDOWB_Y_CONTROL_READBACK; 202 202 uint32_t OPTC_CLOCK_CONTROL; 203 203 uint32_t OPTC_WIDTH_CONTROL2; 204 + uint32_t OTG_PSTATE_REGISTER; 204 205 }; 205 206 206 207 #define TG_COMMON_MASK_SH_LIST_DCN(mask_sh)\ ··· 591 590 type OTG_V_COUNT_STOP_TIMER; 592 591 593 592 #define TG_REG_FIELD_LIST_DCN401(type) \ 594 - type OPTC_SEGMENT_WIDTH_LAST; 593 + type OPTC_SEGMENT_WIDTH_LAST;\ 594 + type OTG_PSTATE_KEEPOUT_START;\ 595 + type OTG_PSTATE_EXTEND;\ 596 + type OTG_UNBLANK;\ 597 + type OTG_PSTATE_ALLOW_WIDTH_MIN; 595 598 596 599 597 600 struct dcn_optc_shift {
+35 -1
drivers/gpu/drm/amd/display/dc/optc/dcn401/dcn401_optc.c
··· 396 396 } 397 397 } 398 398 399 + static void optc401_program_global_sync( 400 + struct timing_generator *optc, 401 + int vready_offset, 402 + int vstartup_start, 403 + int vupdate_offset, 404 + int vupdate_width, 405 + int pstate_keepout) 406 + { 407 + struct optc *optc1 = DCN10TG_FROM_TG(optc); 408 + 409 + optc1->vready_offset = vready_offset; 410 + optc1->vstartup_start = vstartup_start; 411 + optc1->vupdate_offset = vupdate_offset; 412 + optc1->vupdate_width = vupdate_width; 413 + optc1->pstate_keepout = pstate_keepout; 414 + 415 + if (optc1->vstartup_start == 0) { 416 + BREAK_TO_DEBUGGER(); 417 + return; 418 + } 419 + 420 + REG_SET(OTG_VSTARTUP_PARAM, 0, 421 + VSTARTUP_START, optc1->vstartup_start); 422 + 423 + REG_SET_2(OTG_VUPDATE_PARAM, 0, 424 + VUPDATE_OFFSET, optc1->vupdate_offset, 425 + VUPDATE_WIDTH, optc1->vupdate_width); 426 + 427 + REG_SET(OTG_VREADY_PARAM, 0, 428 + VREADY_OFFSET, optc1->vready_offset); 429 + 430 + REG_UPDATE(OTG_PSTATE_REGISTER, OTG_PSTATE_KEEPOUT_START, pstate_keepout); 431 + } 432 + 399 433 static struct timing_generator_funcs dcn401_tg_funcs = { 400 434 .validate_timing = optc1_validate_timing, 401 435 .program_timing = optc1_program_timing, 402 436 .setup_vertical_interrupt0 = optc1_setup_vertical_interrupt0, 403 437 .setup_vertical_interrupt1 = optc1_setup_vertical_interrupt1, 404 438 .setup_vertical_interrupt2 = optc1_setup_vertical_interrupt2, 405 - .program_global_sync = optc1_program_global_sync, 439 + .program_global_sync = optc401_program_global_sync, 406 440 .enable_crtc = optc401_enable_crtc, 407 441 .disable_crtc = optc401_disable_crtc, 408 442 .phantom_crtc_post_enable = optc401_phantom_crtc_post_enable,
+5 -1
drivers/gpu/drm/amd/display/dc/optc/dcn401/dcn401_optc.h
··· 155 155 SF(OTG0_OTG_H_TIMING_CNTL, OTG_H_TIMING_DIV_MODE, mask_sh),\ 156 156 SF(OTG0_OTG_H_TIMING_CNTL, OTG_H_TIMING_DIV_MODE_MANUAL, mask_sh),\ 157 157 SF(OTG0_OTG_DOUBLE_BUFFER_CONTROL, OTG_DRR_TIMING_DBUF_UPDATE_MODE, mask_sh),\ 158 - SF(OTG0_OTG_DRR_CONTROL, OTG_V_TOTAL_LAST_USED_BY_DRR, mask_sh) 158 + SF(OTG0_OTG_DRR_CONTROL, OTG_V_TOTAL_LAST_USED_BY_DRR, mask_sh),\ 159 + SF(OTG0_OTG_PSTATE_REGISTER, OTG_PSTATE_KEEPOUT_START, mask_sh),\ 160 + SF(OTG0_OTG_PSTATE_REGISTER, OTG_PSTATE_EXTEND, mask_sh),\ 161 + SF(OTG0_OTG_PSTATE_REGISTER, OTG_UNBLANK, mask_sh),\ 162 + SF(OTG0_OTG_PSTATE_REGISTER, OTG_PSTATE_ALLOW_WIDTH_MIN, mask_sh) 159 163 160 164 void dcn401_timing_generator_init(struct optc *optc1); 161 165
+1
drivers/gpu/drm/amd/display/dc/resource/dce110/dce110_resource.c
··· 1163 1163 0, 1164 1164 0, 1165 1165 0, 1166 + 0, 1166 1167 pipe_ctx->stream->signal, 1167 1168 false); 1168 1169
+2 -1
drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.h
··· 534 534 SRI_ARR(OPTC_WIDTH_CONTROL, ODM, inst), \ 535 535 SRI_ARR(OPTC_WIDTH_CONTROL2, ODM, inst), \ 536 536 SRI_ARR(OPTC_MEMORY_CONFIG, ODM, inst), \ 537 - SRI_ARR(OTG_DRR_CONTROL, OTG, inst) 537 + SRI_ARR(OTG_DRR_CONTROL, OTG, inst), \ 538 + SRI_ARR(OTG_PSTATE_REGISTER, OTG, inst) 538 539 539 540 /* HUBBUB */ 540 541 #define HUBBUB_REG_LIST_DCN4_01_RI(id) \