Skip to contentSkip to conversation

DC Patches December 5 2022

PATCH New Stylon Wang 1 participant 15 messages Nov 30, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover DC Patches December 5 2022

This DC patchset brings improvements in multiple areas. In summary, we have:

* Improvements on PSR-SU
* Improvements and fixes on DML calculation
* Fix on Dynamic Refresh Rate for DCN 3.1.4
* Fix on DC commit streams
* Fix on DDC GPIO pin
* Fix on Sub-ViewPort
* Fix on DSC
* Enable DP HDMI 2.1 PCON
* Fix on seamless boot
* Fix on OTG programming
* Fix on DTB clock

Cc Daniel Wheeler <[email protected]>

Alvin Lee (1):
drm/amd/display: Ensure commit_streams returns the DC return code

Aric Cyr (1):
drm/amd/display: 3.2.215

Aurabindo Pillai (1):
drm/amd/display: trigger timing sync only if TG is running

Charlene Liu (1):
drm/amd/display: correct static_screen_event_mask

Chris Park (1):
drm/amd/display: Remove DTB DTO on CLK update

David Galiffi (1):
drm/amd/display: Enable dp_hdmi21_pcon support

Dillon Varone (3):
drm/amd/display: Disable uclk pstate for subvp pipes drm/amd/display: Bypass DET swath fill check for max clocks drm/amd/display: set optimized required for comp buf changes

Dmytro Laktyushkin (1):
drm/amd/display: prevent seamless boot on displays that don't have the
preferred dig

Michael Strauss (1):
drm/amd/display: Fix DCN2.1 default DSC clocks

Nicholas Kazlauskas (1):
drm/amd/display: Add debug option to skip PSR CRTC disable

Paul Hsieh (1):
drm/amd/display: read invalid ddc pin status cause engine busy

Zhongwei (1):
drm/amd/display: correct DML calc error of UrgentLatency

 .../display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c  | 37 -----------------
 drivers/gpu/drm/amd/display/dc/core/dc.c      |  5 ++-
 drivers/gpu/drm/amd/display/dc/core/dc_link.c |  2 +-
 drivers/gpu/drm/amd/display/dc/dc.h           |  3 +-
 .../amd/display/dc/dcn10/dcn10_hw_sequencer.c |  6 +++
 .../drm/amd/display/dc/dcn20/dcn20_hwseq.c    |  7 +++-
 .../amd/display/dc/dcn301/dcn301_resource.c   |  2 +
 .../amd/display/dc/dcn302/dcn302_resource.c   |  2 +
 .../amd/display/dc/dcn303/dcn303_resource.c   |  2 +
 .../drm/amd/display/dc/dcn31/dcn31_hwseq.c    | 40 +++++++++++++++++++
 .../drm/amd/display/dc/dcn31/dcn31_hwseq.h    |  4 ++
 .../gpu/drm/amd/display/dc/dcn31/dcn31_init.c |  4 +-
 .../gpu/drm/amd/display/dc/dcn31/dcn31_optc.c | 29 +++++++++++++-
 .../gpu/drm/amd/display/dc/dcn31/dcn31_optc.h |  5 ++-
 .../drm/amd/display/dc/dcn314/dcn314_init.c   |  4 +-
 .../drm/amd/display/dc/dcn314/dcn314_optc.c   |  2 +-
 .../amd/display/dc/dcn314/dcn314_resource.c   |  1 +
 .../drm/amd/display/dc/dcn32/dcn32_hwseq.c    | 10 ++---
 .../amd/display/dc/dcn321/dcn321_resource.c   |  2 +-
 .../drm/amd/display/dc/dml/dcn20/dcn20_fpu.c  |  6 +--
 .../dc/dml/dcn30/display_mode_vba_30.c        |  2 +-
 .../dc/dml/dcn31/display_mode_vba_31.c        |  2 +-
 .../dc/dml/dcn314/display_mode_vba_314.c      |  2 +-
 .../dc/dml/dcn32/display_mode_vba_32.c        |  3 +-
 .../display/dc/gpio/dcn32/hw_factory_dcn32.c  |  4 +-
 25 files changed, 122 insertions(+), 64 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/14 drm/amd/display: Remove DTB DTO on CLK update

From: Chris Park <[email protected]>

[Why]
DTB DTO is programmed more correctly during link enable. Programming them on CLK update which may arrive frequently and sporadically per flip throws off DTB DTO.

[How]
Remove DTB DTO programming on clock update.

---
 .../display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c  | 37 -------------------
 .../amd/display/dc/dcn321/dcn321_resource.c   |  2 +-
 2 files changed, 1 insertion(+), 38 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c +0 -37
index 9eb9fe5b8d2c..200fcec19186 100644
@@ -233,41 +233,6 @@ void dcn32_init_clocks(struct clk_mgr *clk_mgr_base)
 	DC_FP_END();
 }
 
-static void dcn32_update_clocks_update_dtb_dto(struct clk_mgr_internal *clk_mgr,
-			struct dc_state *context,
-			int ref_dtbclk_khz)
-{
-	struct dccg *dccg = clk_mgr->dccg;
-	uint32_t tg_mask = 0;
-	int i;
-
-	for (i = 0; i < clk_mgr->base.ctx->dc->res_pool->pipe_count; i++) {
-		struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
-		struct dtbclk_dto_params dto_params = {0};
-
-		/* use mask to program DTO once per tg */
-		if (pipe_ctx->stream_res.tg &&
-				!(tg_mask & (1 << pipe_ctx->stream_res.tg->inst))) {
-			tg_mask |= (1 << pipe_ctx->stream_res.tg->inst);
-
-			dto_params.otg_inst = pipe_ctx->stream_res.tg->inst;
-			dto_params.ref_dtbclk_khz = ref_dtbclk_khz;
-
-			if (is_dp_128b_132b_signal(pipe_ctx)) {
-				dto_params.pixclk_khz = pipe_ctx->stream->phy_pix_clk;
-
-				if (pipe_ctx->stream_res.audio != NULL)
-					dto_params.req_audio_dtbclk_khz = 24000;
-			}
-			if (dc_is_hdmi_signal(pipe_ctx->stream->signal))
-				dto_params.is_hdmi = true;
-
-			dccg->funcs->set_dtbclk_dto(clk_mgr->dccg, &dto_params);
-			//dccg->funcs->set_audio_dtbclk_dto(clk_mgr->dccg, &dto_params);
-		}
-	}
-}
-
 /* Since DPPCLK request to PMFW needs to be exact (due to DPP DTO programming),
  * update DPPCLK to be the exact frequency that will be set after the DPPCLK
  * divider is updated. This will prevent rounding issues that could cause DPP
@@ -447,8 +412,6 @@ static void dcn32_update_clocks(struct clk_mgr *clk_mgr_base,
 		/* DCCG requires KHz precision for DTBCLK */
 		clk_mgr_base->clks.ref_dtbclk_khz =
 				dcn32_smu_set_hard_min_by_freq(clk_mgr, PPCLK_DTBCLK, khz_to_mhz_ceil(new_clocks->ref_dtbclk_khz));
-
-		dcn32_update_clocks_update_dtb_dto(clk_mgr, context, clk_mgr_base->clks.ref_dtbclk_khz);
 	}
 
 	if (dc->config.forced_clocks == false || (force_reset && safe_to_lower)) {
drivers/gpu/drm/amd/display/dc/dcn321/dcn321_resource.c +1 -1
index 3406e7735357..d1f36df03c2e 100644
@@ -743,7 +743,7 @@ static const struct dc_debug_options debug_defaults_diags = {
 	.dmub_command_table = true,
 	.enable_tri_buf = true,
 	.use_max_lb = true,
-	.force_disable_subvp = true
+	.force_disable_subvp = true,
 };
 
 
Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/14 drm/amd/display: trigger timing sync only if TG is running

In reply to Stylon Wang

From: Aurabindo Pillai <[email protected]>

[Why&How]
If the timing generator isnt running, it does not make sense to trigger a sync on the corresponding OTG. Check this condition before starting. Otherwise, this will cause error like:

*ERROR* GSL: Timeout on reset trigger!

Fixes 8c7924bdb0fe ("drm/amd/display: Disable phantom OTG after enable for plane disable")
---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +6 -0
index 355ffed7380b..c8ec11839b4d 100644
@@ -2216,6 +2216,12 @@ void dcn10_enable_vblanks_synchronization(
 		opp = grouped_pipes[i]->stream_res.opp;
 		tg = grouped_pipes[i]->stream_res.tg;
 		tg->funcs->get_otg_active_size(tg, &width, &height);
+
+		if (!tg->funcs->is_tg_enabled(tg)) {
+			DC_SYNC_INFO("Skipping timing sync on disabled OTG\n");
+			return;
+		}
+
 		if (opp->funcs->opp_program_dpg_dimensions)
 			opp->funcs->opp_program_dpg_dimensions(opp, width, 2*(height) + 1);
 	}
Signature · 1 line
2.25.1
#3 lore raw

PATCH 3/14 drm/amd/display: prevent seamless boot on displays that don't have the preferred dig

In reply to Stylon Wang

From: Dmytro Laktyushkin <[email protected]>

Seamless boot requires VBIOS to select dig matching to link order wise. A significant amount of dal logic makes assumption we are using preferred dig for eDP and if this isn't the case then seamless boot is not supported.

---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc.c +3 -0
index 87994ae0a397..486d18290b9f 100644
@@ -1556,6 +1556,9 @@ bool dc_validate_boot_timing(const struct dc *dc,
 	if (tg_inst >= dc->res_pool->timing_generator_count)
 		return false;
 
+	if (tg_inst != link->link_enc->preferred_engine)
+		return false;
+
 	tg = dc->res_pool->timing_generators[tg_inst];
 
 	if (!tg->funcs->get_hw_timing)
Signature · 1 line
2.25.1
#4 lore raw

PATCH 4/14 drm/amd/display: Enable dp_hdmi21_pcon support

In reply to Stylon Wang

From: David Galiffi <[email protected]>

[Why]
It is not enabled for DCN3.0.1, 3.0.2, 3.0.3.

[How]
Add dc->caps.dp_hdmi21_pcon_support = true to these DCN versions.

---
 drivers/gpu/drm/amd/display/dc/dcn301/dcn301_resource.c | 2 ++
 drivers/gpu/drm/amd/display/dc/dcn302/dcn302_resource.c | 2 ++
 drivers/gpu/drm/amd/display/dc/dcn303/dcn303_resource.c | 2 ++
 3 files changed, 6 insertions(+)
drivers/gpu/drm/amd/display/dc/dcn301/dcn301_resource.c +2 -0
index 480145f09246..8cf10351f271 100644
@@ -1493,6 +1493,8 @@ static bool dcn301_resource_construct(
 	dc->caps.color.mpc.ogam_rom_caps.hlg = 0;
 	dc->caps.color.mpc.ocsc = 1;
 
+	dc->caps.dp_hdmi21_pcon_support = true;
+
 	/* read VBIOS LTTPR caps */
 	if (ctx->dc_bios->funcs->get_lttpr_caps) {
 		enum bp_result bp_query_result;
drivers/gpu/drm/amd/display/dc/dcn302/dcn302_resource.c +2 -0
index 7d11c2a43cbe..47cffd0e6830 100644
@@ -1281,6 +1281,8 @@ static bool dcn302_resource_construct(
 	dc->caps.color.mpc.ogam_rom_caps.hlg = 0;
 	dc->caps.color.mpc.ocsc = 1;
 
+	dc->caps.dp_hdmi21_pcon_support = true;
+
 	/* read VBIOS LTTPR caps */
 	if (ctx->dc_bios->funcs->get_lttpr_caps) {
 		enum bp_result bp_query_result;
drivers/gpu/drm/amd/display/dc/dcn303/dcn303_resource.c +2 -0
index 92393b04cc44..c14d35894b2e 100644
@@ -1212,6 +1212,8 @@ static bool dcn303_resource_construct(
 	dc->caps.color.mpc.ogam_rom_caps.hlg = 0;
 	dc->caps.color.mpc.ocsc = 1;
 
+	dc->caps.dp_hdmi21_pcon_support = true;
+
 	/* read VBIOS LTTPR caps */
 	if (ctx->dc_bios->funcs->get_lttpr_caps) {
 		enum bp_result bp_query_result;
Signature · 1 line
2.25.1
#5 lore raw

PATCH 5/14 drm/amd/display: Fix DCN2.1 default DSC clocks

In reply to Stylon Wang

From: Michael Strauss <[email protected]>

[WHY]
Low dscclk in high vlevels blocks some DSC modes.

[HOW]
Update dscclk to 1/3 of dispclk.

---
 drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.c +3 -3
index c4eca10587a6..c26da3bb2892 100644
@@ -565,7 +565,7 @@ struct _vcs_dpi_soc_bounding_box_st dcn2_1_soc = {
 				.dppclk_mhz = 847.06,
 				.phyclk_mhz = 810.0,
 				.socclk_mhz = 953.0,
-				.dscclk_mhz = 489.0,
+				.dscclk_mhz = 300.0,
 				.dram_speed_mts = 2400.0,
 			},
 			{
@@ -576,7 +576,7 @@ struct _vcs_dpi_soc_bounding_box_st dcn2_1_soc = {
 				.dppclk_mhz = 960.00,
 				.phyclk_mhz = 810.0,
 				.socclk_mhz = 278.0,
-				.dscclk_mhz = 287.67,
+				.dscclk_mhz = 342.86,
 				.dram_speed_mts = 2666.0,
 			},
 			{
@@ -587,7 +587,7 @@ struct _vcs_dpi_soc_bounding_box_st dcn2_1_soc = {
 				.dppclk_mhz = 1028.57,
 				.phyclk_mhz = 810.0,
 				.socclk_mhz = 715.0,
-				.dscclk_mhz = 318.334,
+				.dscclk_mhz = 369.23,
 				.dram_speed_mts = 3200.0,
 			},
 			{
Signature · 1 line
2.25.1
#6 lore raw

PATCH 6/14 drm/amd/display: Disable uclk pstate for subvp pipes

In reply to Stylon Wang

From: Dillon Varone <[email protected]>

[Description]
When subvp is in use, main pipes should block unintended natural uclk pstate changes to prevent disruption to the state machine.

---
 drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c +5 -5
index c9b2343947be..b8767be1e4c5 100644
@@ -703,11 +703,7 @@ void dcn32_subvp_update_force_pstate(struct dc *dc, struct dc_state *context)
 	for (i = 0; i < dc->res_pool->pipe_count; i++) {
 		struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
 
-		// For SubVP + DRR, also force disallow on the DRR pipe
-		// (We will force allow in the DMUB sequence -- some DRR timings by default won't allow P-State so we have
-		// to force once the vblank is stretched).
-		if (pipe->stream && pipe->plane_state && (pipe->stream->mall_stream_config.type == SUBVP_MAIN ||
-				(pipe->stream->mall_stream_config.type == SUBVP_NONE && pipe->stream->ignore_msa_timing_param))) {
+		if (pipe->stream && pipe->plane_state && (pipe->stream->mall_stream_config.type == SUBVP_MAIN)) {
 			struct hubp *hubp = pipe->plane_res.hubp;
 
 			if (hubp && hubp->funcs->hubp_update_force_pstate_disallow)
@@ -785,6 +781,10 @@ void dcn32_program_mall_pipe_config(struct dc *dc, struct dc_state *context)
 	if (hws && hws->funcs.update_mall_sel)
 		hws->funcs.update_mall_sel(dc, context);
 
+	//update subvp force pstate
+	if (hws && hws->funcs.subvp_update_force_pstate)
+		dc->hwseq->funcs.subvp_update_force_pstate(dc, context);
+
 	// Program FORCE_ONE_ROW_FOR_FRAME and CURSOR_REQ_MODE for main subvp pipes
 	for (i = 0; i < dc->res_pool->pipe_count; i++) {
 		struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
Signature · 1 line
2.25.1
#7 lore raw

PATCH 7/14 drm/amd/display: Bypass DET swath fill check for max clocks

In reply to Stylon Wang

From: Dillon Varone <[email protected]>

[Description]
If validating for max voltage level (therefore max clocks) always pass over the DET swath fill latency hiding check.

---
 drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c +2 -1
index 820042f6aaca..4b8f5fa0f0ad 100644
@@ -1683,8 +1683,9 @@ static void mode_support_configuration(struct vba_vars_st *v,
 				&& mode_lib->vba.PTEBufferSizeNotExceeded[i][j] == true
 				&& mode_lib->vba.DCCMetaBufferSizeNotExceeded[i][j] == true
 				&& mode_lib->vba.NonsupportedDSCInputBPC == false
-				&& mode_lib->vba.NotEnoughDETSwathFillLatencyHidingPerState[i][j] == false
 				&& !mode_lib->vba.ExceededMALLSize
+				&& (mode_lib->vba.NotEnoughDETSwathFillLatencyHidingPerState[i][j] == false
+				|| i == v->soc.num_states - 1)
 				&& ((mode_lib->vba.HostVMEnable == false
 				&& !mode_lib->vba.ImmediateFlipRequiredFinal)
 				|| mode_lib->vba.ImmediateFlipSupportedForState[i][j])
Signature · 1 line
2.25.1
#8 lore raw

PATCH 8/14 drm/amd/display: read invalid ddc pin status cause engine busy

In reply to Stylon Wang

From: Paul Hsieh <[email protected]>

[Why]
There is no DDC_6 pin on new asic cause the mapping table is incorrect. When app try to access DDC_VGA port, driver read an invalid ddc pin status and report engine busy.

[How]
Add dummy DDC_6 pin to align gpio structure.

---
 drivers/gpu/drm/amd/display/dc/gpio/dcn32/hw_factory_dcn32.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/gpio/dcn32/hw_factory_dcn32.c +2 -2
index 0ea52ba5ac82..9fd8b269dd79 100644
@@ -256,8 +256,8 @@ static const struct hw_factory_funcs funcs = {
  */
 void dal_hw_factory_dcn32_init(struct hw_factory *factory)
 {
-	factory->number_of_pins[GPIO_ID_DDC_DATA] = 6;
-	factory->number_of_pins[GPIO_ID_DDC_CLOCK] = 6;
+	factory->number_of_pins[GPIO_ID_DDC_DATA] = 8;
+	factory->number_of_pins[GPIO_ID_DDC_CLOCK] = 8;
 	factory->number_of_pins[GPIO_ID_GENERIC] = 4;
 	factory->number_of_pins[GPIO_ID_HPD] = 5;
 	factory->number_of_pins[GPIO_ID_GPIO_PAD] = 28;
Signature · 1 line
2.25.1
#9 lore raw

PATCH 9/14 drm/amd/display: Ensure commit_streams returns the DC return code

In reply to Stylon Wang

From: Alvin Lee <[email protected]>

[Description]
- Ensure dc_commit_streams returns the correct return code so any failures can be handled properly in DM layer
- If set timings fail and we have to remove MPO planes, do so unconditionally but make sure to mark for removal so we report the VSYNC and prevent timeout
- Failure to remove MPO plane results in set timings failure due to lack of resources

---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +1 -1
index 486d18290b9f..0cb8d1f934d1 100644
@@ -1988,7 +1988,7 @@ enum dc_status dc_commit_streams(struct dc *dc,
 
 	DC_LOG_DC("%s Finished.\n", __func__);
 
-	return (res == DC_OK);
+	return res;
 }
 
 /* TODO: When the transition to the new commit sequence is done, remove this
Signature · 1 line
2.25.1
#10 lore raw

PATCH 10/14 drm/amd/display: correct static_screen_event_mask

In reply to Stylon Wang

From: Charlene Liu <[email protected]>

[why]
HW register bit define changed.

---
 .../drm/amd/display/dc/dcn31/dcn31_hwseq.c    | 40 +++++++++++++++++++
 .../drm/amd/display/dc/dcn31/dcn31_hwseq.h    |  4 ++
 .../gpu/drm/amd/display/dc/dcn31/dcn31_init.c |  4 +-
 .../gpu/drm/amd/display/dc/dcn31/dcn31_optc.c | 29 +++++++++++++-
 .../gpu/drm/amd/display/dc/dcn31/dcn31_optc.h |  5 ++-
 .../drm/amd/display/dc/dcn314/dcn314_init.c   |  4 +-
 .../drm/amd/display/dc/dcn314/dcn314_optc.c   |  2 +-
 7 files changed, 81 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hwseq.c +40 -0
index 165c920ca776..4226a051df41 100644
@@ -623,3 +623,43 @@ void dcn31_setup_hpo_hw_control(const struct dce_hwseq *hws, bool enable)
 	if (hws->ctx->dc->debug.hpo_optimization)
 		REG_UPDATE(HPO_TOP_HW_CONTROL, HPO_IO_EN, !!enable);
 }
+void dcn31_set_drr(struct pipe_ctx **pipe_ctx,
+		int num_pipes, struct dc_crtc_timing_adjust adjust)
+{
+	int i = 0;
+	struct drr_params params = {0};
+	unsigned int event_triggers = 0x2;/*Bit[1]: OTG_TRIG_A*/
+	unsigned int num_frames = 2;
+	params.vertical_total_max = adjust.v_total_max;
+	params.vertical_total_min = adjust.v_total_min;
+	params.vertical_total_mid = adjust.v_total_mid;
+	params.vertical_total_mid_frame_num = adjust.v_total_mid_frame_num;
+	for (i = 0; i < num_pipes; i++) {
+		if ((pipe_ctx[i]->stream_res.tg != NULL) && pipe_ctx[i]->stream_res.tg->funcs) {
+			if (pipe_ctx[i]->stream_res.tg->funcs->set_drr)
+				pipe_ctx[i]->stream_res.tg->funcs->set_drr(
+					pipe_ctx[i]->stream_res.tg, &params);
+			if (adjust.v_total_max != 0 && adjust.v_total_min != 0)
+				if (pipe_ctx[i]->stream_res.tg->funcs->set_static_screen_control)
+					pipe_ctx[i]->stream_res.tg->funcs->set_static_screen_control(
+						pipe_ctx[i]->stream_res.tg,
+						event_triggers, num_frames);
+		}
+	}
+}
+void dcn31_set_static_screen_control(struct pipe_ctx **pipe_ctx,
+		int num_pipes, const struct dc_static_screen_params *params)
+{
+	unsigned int i;
+	unsigned int triggers = 0;
+	if (params->triggers.surface_update)
+		triggers |= 0x600;/*bit 9 and bit10 : 110 0000 0000*/
+	if (params->triggers.cursor_update)
+		triggers |= 0x10;/*bit4*/
+	if (params->triggers.force_trigger)
+		triggers |= 0x1;
+	for (i = 0; i < num_pipes; i++)
+		pipe_ctx[i]->stream_res.tg->funcs->
+			set_static_screen_control(pipe_ctx[i]->stream_res.tg,
+					triggers, params->num_frames);
+}
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hwseq.h +4 -0
index edfc01d6ad73..e7e03a8722e0 100644
@@ -56,4 +56,8 @@ bool dcn31_is_abm_supported(struct dc *dc,
 void dcn31_init_pipes(struct dc *dc, struct dc_state *context);
 void dcn31_setup_hpo_hw_control(const struct dce_hwseq *hws, bool enable);
 
+void dcn31_set_static_screen_control(struct pipe_ctx **pipe_ctx,
+		int num_pipes, const struct dc_static_screen_params *params);
+void dcn31_set_drr(struct pipe_ctx **pipe_ctx,
+		int num_pipes, struct dc_crtc_timing_adjust adjust);
 #endif /* __DC_HWSS_DCN31_H__ */
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_init.c +2 -2
index 3a32810bbe38..7c2da70ffe21 100644
@@ -64,9 +64,9 @@ static const struct hw_sequencer_funcs dcn31_funcs = {
 	.prepare_bandwidth = dcn20_prepare_bandwidth,
 	.optimize_bandwidth = dcn20_optimize_bandwidth,
 	.update_bandwidth = dcn20_update_bandwidth,
-	.set_drr = dcn10_set_drr,
+	.set_drr = dcn31_set_drr,
 	.get_position = dcn10_get_position,
-	.set_static_screen_control = dcn10_set_static_screen_control,
+	.set_static_screen_control = dcn31_set_static_screen_control,
 	.setup_stereo = dcn10_setup_stereo,
 	.set_avmute = dcn30_set_avmute,
 	.log_hw_state = dcn10_log_hw_state,
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_optc.c +28 -1
index 63a677c8ee27..fe449f7aa771 100644
@@ -40,6 +40,7 @@
 #define FN(reg_name, field_name) \
 	optc1->tg_shift->field_name, optc1->tg_mask->field_name
 
+#define STATIC_SCREEN_EVENT_MASK_DRR_DOUBLE_BUFFER_UPDATE_EN 0x2000 /*bit 13*/
 static void optc31_set_odm_combine(struct timing_generator *optc, int *opp_id, int opp_cnt,
 		struct dc_crtc_timing *timing)
 {
@@ -231,6 +232,32 @@ void optc3_init_odm(struct timing_generator *optc)
 			OPTC_MEM_SEL, 0);
 	optc1->opp_count = 1;
 }
+void optc31_set_static_screen_control(
+	struct timing_generator *optc,
+	uint32_t event_triggers,
+	uint32_t num_frames)
+{
+	struct optc *optc1 = DCN10TG_FROM_TG(optc);
+	uint32_t framecount;
+	uint32_t events;
+
+	if (num_frames > 0xFF)
+		num_frames = 0xFF;
+	REG_GET_2(OTG_STATIC_SCREEN_CONTROL,
+			OTG_STATIC_SCREEN_EVENT_MASK, &events,
+			OTG_STATIC_SCREEN_FRAME_COUNT, &framecount);
+
+	if (events == event_triggers && num_frames == framecount)
+		return;
+	if ((event_triggers & STATIC_SCREEN_EVENT_MASK_DRR_DOUBLE_BUFFER_UPDATE_EN)
+			!= 0)
+		event_triggers = event_triggers &
+		~STATIC_SCREEN_EVENT_MASK_DRR_DOUBLE_BUFFER_UPDATE_EN;
+
+	REG_UPDATE_2(OTG_STATIC_SCREEN_CONTROL,
+			OTG_STATIC_SCREEN_EVENT_MASK, event_triggers,
+			OTG_STATIC_SCREEN_FRAME_COUNT, num_frames);
+}
 
 static struct timing_generator_funcs dcn31_tg_funcs = {
 		.validate_timing = optc1_validate_timing,
@@ -266,7 +293,7 @@ static struct timing_generator_funcs dcn31_tg_funcs = {
 		.set_drr = optc31_set_drr,
 		.get_last_used_drr_vtotal = optc2_get_last_used_drr_vtotal,
 		.set_vtotal_min_max = optc1_set_vtotal_min_max,
-		.set_static_screen_control = optc1_set_static_screen_control,
+		.set_static_screen_control = optc31_set_static_screen_control,
 		.program_stereo = optc1_program_stereo,
 		.is_stereo_left_eye = optc1_is_stereo_left_eye,
 		.tg_init = optc3_tg_init,
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_optc.h +4 -1
index 30b81a448ce2..5fc6c63580d7 100644
@@ -263,5 +263,8 @@ bool optc31_immediate_disable_crtc(struct timing_generator *optc);
 void optc31_set_drr(struct timing_generator *optc, const struct drr_params *params);
 
 void optc3_init_odm(struct timing_generator *optc);
-
+void optc31_set_static_screen_control(
+	struct timing_generator *optc,
+	uint32_t event_triggers,
+	uint32_t num_frames);
 #endif /* __DC_OPTC_DCN31_H__ */
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_init.c +2 -2
index 5b6c2d94ec71..31feb4b0edee 100644
@@ -66,9 +66,9 @@ static const struct hw_sequencer_funcs dcn314_funcs = {
 	.prepare_bandwidth = dcn20_prepare_bandwidth,
 	.optimize_bandwidth = dcn20_optimize_bandwidth,
 	.update_bandwidth = dcn20_update_bandwidth,
-	.set_drr = dcn10_set_drr,
+	.set_drr = dcn31_set_drr,
 	.get_position = dcn10_get_position,
-	.set_static_screen_control = dcn10_set_static_screen_control,
+	.set_static_screen_control = dcn31_set_static_screen_control,
 	.setup_stereo = dcn10_setup_stereo,
 	.set_avmute = dcn30_set_avmute,
 	.log_hw_state = dcn10_log_hw_state,
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_optc.c +1 -1
index f246aab23050..41edbd64ea21 100644
@@ -228,7 +228,7 @@ static struct timing_generator_funcs dcn314_tg_funcs = {
 		.set_drr = optc31_set_drr,
 		.get_last_used_drr_vtotal = optc2_get_last_used_drr_vtotal,
 		.set_vtotal_min_max = optc1_set_vtotal_min_max,
-		.set_static_screen_control = optc1_set_static_screen_control,
+		.set_static_screen_control = optc31_set_static_screen_control,
 		.program_stereo = optc1_program_stereo,
 		.is_stereo_left_eye = optc1_is_stereo_left_eye,
 		.tg_init = optc3_tg_init,
Signature · 1 line
2.25.1
#11 lore raw

PATCH 11/14 drm/amd/display: correct DML calc error of UrgentLatency

In reply to Stylon Wang

From: Zhongwei <[email protected]>

[Why]
The input UrgentLatency in CalculateUrgentBurstFactor of prefect check is wrong.

[How]
Correct to the correct one to keep same as HW formula

---
 drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c  | 2 +-
 drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c  | 2 +-
 .../gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c +1 -1
index 479e2c1a1301..379729b02847 100644
@@ -4851,7 +4851,7 @@ void dml30_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
 							v->SwathHeightYThisState[k],
 							v->SwathHeightCThisState[k],
 							v->HTotal[k] / v->PixelClock[k],
-							v->UrgentLatency,
+							v->UrgLatency[i],
 							v->CursorBufferSize,
 							v->CursorWidth[k][0],
 							v->CursorBPP[k][0],
drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c +1 -1
index 4e45c6d9ecdc..ec351c8418cb 100644
@@ -5082,7 +5082,7 @@ void dml31_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
 							v->SwathHeightYThisState[k],
 							v->SwathHeightCThisState[k],
 							v->HTotal[k] / v->PixelClock[k],
-							v->UrgentLatency,
+							v->UrgLatency[i],
 							v->CursorBufferSize,
 							v->CursorWidth[k][0],
 							v->CursorBPP[k][0],
drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c +1 -1
index 41f0b4c1c72f..950669f2c10d 100644
@@ -5179,7 +5179,7 @@ void dml314_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_
 							v->SwathHeightYThisState[k],
 							v->SwathHeightCThisState[k],
 							v->HTotal[k] / v->PixelClock[k],
-							v->UrgentLatency,
+							v->UrgLatency[i],
 							v->CursorBufferSize,
 							v->CursorWidth[k][0],
 							v->CursorBPP[k][0],
Signature · 1 line
2.25.1
#12 lore raw

PATCH 12/14 drm/amd/display: Add debug option to skip PSR CRTC disable

In reply to Stylon Wang

From: Nicholas Kazlauskas <[email protected]>

[Why]
It's currently tied to Z10 support, and is required for Z10, but we can still support Z10 display off without PSR.

We currently need to skip the PSR CRTC disable to prevent stuttering and underflow from occuring during PSR-SU.

[How]
Add a debug option to allow specifying this separately.

---
 drivers/gpu/drm/amd/display/dc/core/dc_link.c           | 2 +-
 drivers/gpu/drm/amd/display/dc/dc.h                     | 1 +
 drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +1 -1
index 5304e9daf90a..342e906ae26e 100644
@@ -3378,7 +3378,7 @@ bool dc_link_setup_psr(struct dc_link *link,
 		case FAMILY_YELLOW_CARP:
 		case AMDGPU_FAMILY_GC_10_3_6:
 		case AMDGPU_FAMILY_GC_11_0_1:
-			if (dc->debug.disable_z10)
+			if (dc->debug.disable_z10 || dc->debug.psr_skip_crtc_disable)
 				psr_context->psr_level.bits.SKIP_CRTC_DISABLE = true;
 			break;
 		default:
drivers/gpu/drm/amd/display/dc/dc.h +1 -0
index 4a7c0356d9c7..3cb8cf065204 100644
@@ -844,6 +844,7 @@ struct dc_debug_options {
 	int crb_alloc_policy_min_disp_count;
 	bool disable_z10;
 	bool enable_z9_disable_interface;
+	bool psr_skip_crtc_disable;
 	union dpia_debug_options dpia_debug;
 	bool disable_fixed_vs_aux_timeout_wa;
 	bool force_disable_subvp;
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c +1 -0
index 4fffc7bb8088..f9ea1e86707f 100644
@@ -886,6 +886,7 @@ static const struct dc_plane_cap plane_cap = {
 static const struct dc_debug_options debug_defaults_drv = {
 	.disable_z10 = false,
 	.enable_z9_disable_interface = true,
+	.psr_skip_crtc_disable = true,
 	.disable_dmcu = true,
 	.force_abm_enable = false,
 	.timing_trace = false,
Signature · 1 line
2.25.1
#13 lore raw

PATCH 13/14 drm/amd/display: set optimized required for comp buf changes

In reply to Stylon Wang

From: Dillon Varone <[email protected]>

[Description]
When compressed buffer allocation changes, optimized required flag should be set to trigger an update in optimize bandwidth.

---
 drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +5 -2
index bc4a303cd864..6291a241158a 100644
@@ -2011,10 +2011,13 @@ void dcn20_prepare_bandwidth(
 
 	/* decrease compbuf size */
 	if (hubbub->funcs->program_compbuf_size) {
-		if (context->bw_ctx.dml.ip.min_comp_buffer_size_kbytes)
+		if (context->bw_ctx.dml.ip.min_comp_buffer_size_kbytes) {
 			compbuf_size_kb = context->bw_ctx.dml.ip.min_comp_buffer_size_kbytes;
-		else
+			dc->wm_optimized_required |= (compbuf_size_kb != dc->current_state->bw_ctx.dml.ip.min_comp_buffer_size_kbytes);
+		} else {
 			compbuf_size_kb = context->bw_ctx.bw.dcn.compbuf_size_kb;
+			dc->wm_optimized_required |= (compbuf_size_kb != dc->current_state->bw_ctx.bw.dcn.compbuf_size_kb);
+		}
 
 		hubbub->funcs->program_compbuf_size(hubbub, compbuf_size_kb, false);
 	}
Signature · 1 line
2.25.1
#14 lore raw

PATCH 14/14 drm/amd/display: 3.2.215

In reply to Stylon Wang

From: Aric Cyr <[email protected]>

---
 drivers/gpu/drm/amd/display/dc/dc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc.h +1 -1
index 3cb8cf065204..85ebeaa2de18 100644
@@ -47,7 +47,7 @@ struct aux_payload;
 struct set_config_cmd_payload;
 struct dmub_notification;
 
-#define DC_VER "3.2.214"
+#define DC_VER "3.2.215"
 
 #define MAX_SURFACES 3
 #define MAX_PLANES 6
Signature · 1 line
2.25.1