Skip to content

Commit 89713ce

Browse files
Dillon Varonealexdeucher
authored andcommitted
drm/amd/display: Enable Request rate limiter during C-State on dcn401
[WHY] When C-State entry is requested, the rate limiter will be disabled which can result in high contention in the DCHUB return path. [HOW] Enable the rate limiter during C-state requests to prevent contention. Cc: [email protected] # 6.11+ Reviewed-by: Alvin Lee <[email protected]> Signed-off-by: Dillon Varone <[email protected]> Signed-off-by: Hamza Mahfooz <[email protected]> Tested-by: Daniel Wheeler <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 27227a2 commit 89713ce

File tree

8 files changed

+53
-11
lines changed

8 files changed

+53
-11
lines changed

drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_dcn4_calcs.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#define DML2_MAX_FMT_420_BUFFER_WIDTH 4096
1313
#define DML_MAX_NUM_OF_SLICES_PER_DSC 4
14+
#define ALLOW_SDPIF_RATE_LIMIT_PRE_CSTATE
1415

1516
const char *dml2_core_internal_bw_type_str(enum dml2_core_internal_bw_type bw_type)
1617
{
@@ -3886,6 +3887,10 @@ static void CalculateSwathAndDETConfiguration(struct dml2_core_internal_scratch
38863887
#endif
38873888

38883889
*p->hw_debug5 = false;
3890+
#ifdef ALLOW_SDPIF_RATE_LIMIT_PRE_CSTATE
3891+
if (p->NumberOfActiveSurfaces > 1)
3892+
*p->hw_debug5 = true;
3893+
#else
38893894
for (unsigned int k = 0; k < p->NumberOfActiveSurfaces; ++k) {
38903895
if (!(p->mrq_present) && (!(*p->UnboundedRequestEnabled)) && (TotalActiveDPP == 1)
38913896
&& p->display_cfg->plane_descriptors[k].surface.dcc.enable
@@ -3901,6 +3906,7 @@ static void CalculateSwathAndDETConfiguration(struct dml2_core_internal_scratch
39013906
dml2_printf("DML::%s: k=%u hw_debug5 = %u\n", __func__, k, *p->hw_debug5);
39023907
#endif
39033908
}
3909+
#endif
39043910
}
39053911

39063912
static enum dml2_odm_mode DecideODMMode(unsigned int HActive,

drivers/gpu/drm/amd/display/dc/hubbub/dcn10/dcn10_hubbub.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ struct dcn_hubbub_registers {
200200
uint32_t DCHUBBUB_ARB_FRAC_URG_BW_MALL_B;
201201
uint32_t DCHUBBUB_TIMEOUT_DETECTION_CTRL1;
202202
uint32_t DCHUBBUB_TIMEOUT_DETECTION_CTRL2;
203+
uint32_t DCHUBBUB_CTRL_STATUS;
203204
};
204205

205206
#define HUBBUB_REG_FIELD_LIST_DCN32(type) \
@@ -320,7 +321,12 @@ struct dcn_hubbub_registers {
320321
type DCHUBBUB_TIMEOUT_REQ_STALL_THRESHOLD;\
321322
type DCHUBBUB_TIMEOUT_PSTATE_STALL_THRESHOLD;\
322323
type DCHUBBUB_TIMEOUT_DETECTION_EN;\
323-
type DCHUBBUB_TIMEOUT_TIMER_RESET
324+
type DCHUBBUB_TIMEOUT_TIMER_RESET;\
325+
type ROB_UNDERFLOW_STATUS;\
326+
type ROB_OVERFLOW_STATUS;\
327+
type ROB_OVERFLOW_CLEAR;\
328+
type DCHUBBUB_HW_DEBUG;\
329+
type CSTATE_SWATH_CHK_GOOD_MODE
324330

325331
#define HUBBUB_STUTTER_REG_FIELD_LIST(type) \
326332
type DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_A;\

drivers/gpu/drm/amd/display/dc/hubbub/dcn20/dcn20_hubbub.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ struct dcn20_hubbub {
9696
unsigned int det1_size;
9797
unsigned int det2_size;
9898
unsigned int det3_size;
99+
bool allow_sdpif_rate_limit_when_cstate_req;
99100
};
100101

101102
void hubbub2_construct(struct dcn20_hubbub *hubbub,

drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.c

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,15 +1192,35 @@ static void dcn401_wait_for_det_update(struct hubbub *hubbub, int hubp_inst)
11921192
}
11931193
}
11941194

1195-
static void dcn401_program_timeout_thresholds(struct hubbub *hubbub, struct dml2_display_arb_regs *arb_regs)
1195+
static bool dcn401_program_arbiter(struct hubbub *hubbub, struct dml2_display_arb_regs *arb_regs, bool safe_to_lower)
11961196
{
11971197
struct dcn20_hubbub *hubbub2 = TO_DCN20_HUBBUB(hubbub);
11981198

1199+
bool wm_pending = false;
1200+
uint32_t temp;
1201+
11991202
/* request backpressure and outstanding return threshold (unused)*/
12001203
//REG_UPDATE(DCHUBBUB_TIMEOUT_DETECTION_CTRL1, DCHUBBUB_TIMEOUT_REQ_STALL_THRESHOLD, arb_regs->req_stall_threshold);
12011204

12021205
/* P-State stall threshold */
12031206
REG_UPDATE(DCHUBBUB_TIMEOUT_DETECTION_CTRL2, DCHUBBUB_TIMEOUT_PSTATE_STALL_THRESHOLD, arb_regs->pstate_stall_threshold);
1207+
1208+
if (safe_to_lower || arb_regs->allow_sdpif_rate_limit_when_cstate_req > hubbub2->allow_sdpif_rate_limit_when_cstate_req) {
1209+
hubbub2->allow_sdpif_rate_limit_when_cstate_req = arb_regs->allow_sdpif_rate_limit_when_cstate_req;
1210+
1211+
/* only update the required bits */
1212+
REG_GET(DCHUBBUB_CTRL_STATUS, DCHUBBUB_HW_DEBUG, &temp);
1213+
if (hubbub2->allow_sdpif_rate_limit_when_cstate_req) {
1214+
temp |= (1 << 5);
1215+
} else {
1216+
temp &= ~(1 << 5);
1217+
}
1218+
REG_UPDATE(DCHUBBUB_CTRL_STATUS, DCHUBBUB_HW_DEBUG, temp);
1219+
} else {
1220+
wm_pending = true;
1221+
}
1222+
1223+
return wm_pending;
12041224
}
12051225

12061226
static const struct hubbub_funcs hubbub4_01_funcs = {
@@ -1226,7 +1246,7 @@ static const struct hubbub_funcs hubbub4_01_funcs = {
12261246
.program_det_segments = dcn401_program_det_segments,
12271247
.program_compbuf_segments = dcn401_program_compbuf_segments,
12281248
.wait_for_det_update = dcn401_wait_for_det_update,
1229-
.program_timeout_thresholds = dcn401_program_timeout_thresholds,
1249+
.program_arbiter = dcn401_program_arbiter,
12301250
};
12311251

12321252
void hubbub401_construct(struct dcn20_hubbub *hubbub2,

drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,12 @@
128128
HUBBUB_SF(DCHUBBUB_TIMEOUT_DETECTION_CTRL1, DCHUBBUB_TIMEOUT_REQ_STALL_THRESHOLD, mask_sh),\
129129
HUBBUB_SF(DCHUBBUB_TIMEOUT_DETECTION_CTRL2, DCHUBBUB_TIMEOUT_PSTATE_STALL_THRESHOLD, mask_sh),\
130130
HUBBUB_SF(DCHUBBUB_TIMEOUT_DETECTION_CTRL2, DCHUBBUB_TIMEOUT_DETECTION_EN, mask_sh),\
131-
HUBBUB_SF(DCHUBBUB_TIMEOUT_DETECTION_CTRL2, DCHUBBUB_TIMEOUT_TIMER_RESET, mask_sh)
131+
HUBBUB_SF(DCHUBBUB_TIMEOUT_DETECTION_CTRL2, DCHUBBUB_TIMEOUT_TIMER_RESET, mask_sh),\
132+
HUBBUB_SF(DCHUBBUB_CTRL_STATUS, ROB_UNDERFLOW_STATUS, mask_sh),\
133+
HUBBUB_SF(DCHUBBUB_CTRL_STATUS, ROB_OVERFLOW_STATUS, mask_sh),\
134+
HUBBUB_SF(DCHUBBUB_CTRL_STATUS, ROB_OVERFLOW_CLEAR, mask_sh),\
135+
HUBBUB_SF(DCHUBBUB_CTRL_STATUS, DCHUBBUB_HW_DEBUG, mask_sh),\
136+
HUBBUB_SF(DCHUBBUB_CTRL_STATUS, CSTATE_SWATH_CHK_GOOD_MODE, mask_sh)
132137

133138
bool hubbub401_program_urgent_watermarks(
134139
struct hubbub *hubbub,

drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,6 +1488,10 @@ void dcn401_prepare_bandwidth(struct dc *dc,
14881488
&context->bw_ctx.bw.dcn.watermarks,
14891489
dc->res_pool->ref_clocks.dchub_ref_clock_inKhz / 1000,
14901490
false);
1491+
/* update timeout thresholds */
1492+
if (hubbub->funcs->program_arbiter) {
1493+
dc->wm_optimized_required |= hubbub->funcs->program_arbiter(hubbub, &context->bw_ctx.bw.dcn.arb_regs, false);
1494+
}
14911495

14921496
/* decrease compbuf size */
14931497
if (hubbub->funcs->program_compbuf_segments) {
@@ -1529,6 +1533,10 @@ void dcn401_optimize_bandwidth(
15291533
&context->bw_ctx.bw.dcn.watermarks,
15301534
dc->res_pool->ref_clocks.dchub_ref_clock_inKhz / 1000,
15311535
true);
1536+
/* update timeout thresholds */
1537+
if (hubbub->funcs->program_arbiter) {
1538+
hubbub->funcs->program_arbiter(hubbub, &context->bw_ctx.bw.dcn.arb_regs, true);
1539+
}
15321540

15331541
if (dc->clk_mgr->dc_mode_softmax_enabled)
15341542
if (dc->clk_mgr->clks.dramclk_khz > dc->clk_mgr->bw_params->dc_mode_softmax_memclk * 1000 &&
@@ -1554,11 +1562,6 @@ void dcn401_optimize_bandwidth(
15541562
pipe_ctx->dlg_regs.min_dst_y_next_start);
15551563
}
15561564
}
1557-
1558-
/* update timeout thresholds */
1559-
if (hubbub->funcs->program_timeout_thresholds) {
1560-
hubbub->funcs->program_timeout_thresholds(hubbub, &context->bw_ctx.bw.dcn.arb_regs);
1561-
}
15621565
}
15631566

15641567
void dcn401_fams2_global_control_lock(struct dc *dc,

drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ struct hubbub_funcs {
228228
void (*program_det_segments)(struct hubbub *hubbub, int hubp_inst, unsigned det_buffer_size_seg);
229229
void (*program_compbuf_segments)(struct hubbub *hubbub, unsigned compbuf_size_seg, bool safe_to_increase);
230230
void (*wait_for_det_update)(struct hubbub *hubbub, int hubp_inst);
231-
void (*program_timeout_thresholds)(struct hubbub *hubbub, struct dml2_display_arb_regs *arb_regs);
231+
bool (*program_arbiter)(struct hubbub *hubbub, struct dml2_display_arb_regs *arb_regs, bool safe_to_lower);
232232
};
233233

234234
struct hubbub {

drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,8 @@ void dcn401_prepare_mcache_programming(struct dc *dc, struct dc_state *context);
612612
SR(DCHUBBUB_SDPIF_CFG1), \
613613
SR(DCHUBBUB_MEM_PWR_MODE_CTRL), \
614614
SR(DCHUBBUB_TIMEOUT_DETECTION_CTRL1), \
615-
SR(DCHUBBUB_TIMEOUT_DETECTION_CTRL2)
615+
SR(DCHUBBUB_TIMEOUT_DETECTION_CTRL2), \
616+
SR(DCHUBBUB_CTRL_STATUS)
616617

617618
/* DCCG */
618619

0 commit comments

Comments
 (0)