Skip to contentSkip to conversation

DC Patches Oct 27, 2022

PATCH New Alex Hung 1 participant 19 messages Oct 27, 2022

Subsystems (4)
lore
Share & tools
lore

Alex Hung

author
#0 lore raw

cover DC Patches Oct 27, 2022

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

* Investigate tool reported FCLK P-state deviations
* Fix null pointer issues found in emulation
* Add DSC delay factor workaround
* Round up DST_after_scaler to nearest int
* Use forced DSC bpp in DML
* Fix DCN32 DSC delay calculation
* Use min transition for SubVP into MPO
* Add a debug option HBR2CP2520 over TPS4
* Stop waiting for vblank during pipe programming
* Modify checks to enable TPS3 pattern when required
* Remove rate check from pixel rate divider update
* Check validation passed after applying pipe split changes
* Update DML formula
* Don't enable ODM + MPO
* Include virtual signal to set k1 and k2 values
* Reinit DPG when exiting dynamic ODM

Cc Daniel Wheeler <[email protected]>

Alvin Lee (2):
drm/amd/display: Don't enable ODM + MPO drm/amd/display: Use min transition for SubVP into MPO

Anthony Koo (1):
drm/amd/display: [FW Promotion] Release 0.0.141.0

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

Charlene Liu (2):
drm/amd/display: Update DML formula drm/amd/display: Fix null pointer issues found in emulation

Dillon Varone (2):
drm/amd/display: Reinit DPG when exiting dynamic ODM drm/amd/display: Check validation passed after applying pipe split
changes

Eric Bernstein (1):
drm/amd/display: Include virtual signal to set k1 and k2 values

George Shen (4):
drm/amd/display: Fix DCN32 DSC delay calculation drm/amd/display: Use forced DSC bpp in DML drm/amd/display: Round up DST_after_scaler to nearest int drm/amd/display: Add DSC delay factor workaround

Iswara Nagulendran (1):
drm/amd/display: Modify checks to enable TPS3 pattern when required

Leo Chen (1):
drm/amd/display: Add a debug option HBR2CP2520 over TPS4

Martin Leung (1):
drm/amd/display: Stop waiting for vblank during pipe programming

Nevenko Stupar (1):
drm/amd/display: Investigate tool reported FCLK P-state deviations

Taimur Hassan (1):
drm/amd/display: Remove rate check from pixel rate divider update

 drivers/gpu/drm/amd/display/dc/core/dc.c      | 43 +++++++++----------
 drivers/gpu/drm/amd/display/dc/dc.h           |  4 +-
 drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c |  6 ++-
 .../drm/amd/display/dc/dcn20/dcn20_hwseq.c    | 24 ++++++++++-
 .../drm/amd/display/dc/dcn31/dcn31_hwseq.c    |  6 ++-
 .../drm/amd/display/dc/dcn31/dcn31_resource.c |  2 +
 .../drm/amd/display/dc/dcn314/dcn314_dccg.c   |  2 +-
 .../amd/display/dc/dcn314/dcn314_resource.c   |  2 +
 .../amd/display/dc/dcn315/dcn315_resource.c   |  2 +
 .../amd/display/dc/dcn316/dcn316_resource.c   |  2 +
 .../drm/amd/display/dc/dcn32/dcn32_hwseq.c    |  6 +--
 .../drm/amd/display/dc/dcn32/dcn32_resource.c |  2 +
 .../dc/dml/dcn31/display_mode_vba_31.c        |  3 +-
 .../dc/dml/dcn314/display_mode_vba_314.c      |  3 +-
 .../drm/amd/display/dc/dml/dcn32/dcn32_fpu.c  | 14 +++---
 .../dc/dml/dcn32/display_mode_vba_32.c        | 10 +++--
 .../dc/dml/dcn32/display_mode_vba_util_32.c   |  7 +--
 .../dc/dml/dcn32/display_mode_vba_util_32.h   |  3 +-
 .../dc/dml/dcn32/display_rq_dlg_calc_32.c     |  4 +-
 .../amd/display/dc/dml/dcn321/dcn321_fpu.c    |  5 ++-
 .../amd/display/dc/dml/display_mode_structs.h |  3 ++
 .../drm/amd/display/dc/dml/display_mode_vba.c |  2 +-
 .../gpu/drm/amd/display/dmub/inc/dmub_cmd.h   |  6 +++
 23 files changed, 108 insertions(+), 53 deletions(-)
Signature · 1 line
2.38.1
author
#1 lore raw

PATCH 1/18 drm/amd/display: Reinit DPG when exiting dynamic ODM

From: Dillon Varone <[email protected]>

[WHY]
DPG must be returned to initialized state when pipe is disabled.

[HOW]
Reinit DPG on unused pipes when exiting dynamic ODM.

---
 .../drm/amd/display/dc/dcn20/dcn20_hwseq.c    | 23 +++++++++++++++++++
 1 file changed, 23 insertions(+)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +23 -0
index feff834d5410..b465a83bde6f 100644
@@ -1079,6 +1079,29 @@ void dcn20_blank_pixel_data(
 				0);
 	}
 
+	if (!blank && dc->debug.enable_single_display_2to1_odm_policy) {
+		/* when exiting dynamic ODM need to reinit DPG state for unused pipes */
+		struct pipe_ctx *old_odm_pipe = dc->current_state->res_ctx.pipe_ctx[pipe_ctx->pipe_idx].next_odm_pipe;
+
+		odm_pipe = pipe_ctx->next_odm_pipe;
+
+		while (old_odm_pipe) {
+			if (!odm_pipe || old_odm_pipe->pipe_idx != odm_pipe->pipe_idx)
+				dc->hwss.set_disp_pattern_generator(dc,
+						old_odm_pipe,
+						CONTROLLER_DP_TEST_PATTERN_VIDEOMODE,
+						CONTROLLER_DP_COLOR_SPACE_UDEFINED,
+						COLOR_DEPTH_888,
+						NULL,
+						0,
+						0,
+						0);
+			old_odm_pipe = old_odm_pipe->next_odm_pipe;
+			if (odm_pipe)
+				odm_pipe = odm_pipe->next_odm_pipe;
+		}
+	}
+
 	if (!blank)
 		if (stream_res->abm) {
 			dc->hwss.set_pipe(pipe_ctx);
Signature · 1 line
2.38.1
author
#2 lore raw

PATCH 2/18 drm/amd/display: Include virtual signal to set k1 and k2 values

In reply to Alex Hung

From: Eric Bernstein <[email protected]>

---
 drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c +1 -1
index cf5bd9713f54..aeb4822cebc8 100644
@@ -1186,7 +1186,7 @@ unsigned int dcn32_calculate_dccg_k1_k2_values(struct pipe_ctx *pipe_ctx, unsign
 			*k2_div = PIXEL_RATE_DIV_BY_2;
 		else
 			*k2_div = PIXEL_RATE_DIV_BY_4;
-	} else if (dc_is_dp_signal(pipe_ctx->stream->signal)) {
+	} else if (dc_is_dp_signal(pipe_ctx->stream->signal) || dc_is_virtual_signal(pipe_ctx->stream->signal)) {
 		if (two_pix_per_container) {
 			*k1_div = PIXEL_RATE_DIV_BY_1;
 			*k2_div = PIXEL_RATE_DIV_BY_2;
Signature · 1 line
2.38.1
author
#3 lore raw

PATCH 3/18 drm/amd/display: Don't enable ODM + MPO

In reply to Alex Hung

From: Alvin Lee <[email protected]>

[Description]
Driver doesn't support ODM + MPO

---
 drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c +0 -4
index aeb4822cebc8..5e0018efe055 100644
@@ -989,10 +989,6 @@ void dcn32_init_hw(struct dc *dc)
 		dc_dmub_srv_query_caps_cmd(dc->ctx->dmub_srv->dmub);
 		dc->caps.dmub_caps.psr = dc->ctx->dmub_srv->dmub->feature_caps.psr;
 	}
-
-	/* Enable support for ODM and windowed MPO if policy flag is set */
-	if (dc->debug.enable_single_display_2to1_odm_policy)
-		dc->config.enable_windowed_mpo_odm = true;
 }
 
 static int calc_mpc_flow_ctrl_cnt(const struct dc_stream_state *stream,
Signature · 1 line
2.38.1
author
#4 lore raw

PATCH 4/18 drm/amd/display: Update DML formula

In reply to Alex Hung

From: Charlene Liu <[email protected]>

[why]
This is to update SW DML implementation.

---
 drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c | 3 ++-
 .../gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c   | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c +2 -1
index b612edb14417..45ab0ce50860 100644
@@ -1052,7 +1052,8 @@ static bool CalculatePrefetchSchedule(
 	else
 		bytes_pp = myPipe->BytePerPixelY + myPipe->BytePerPixelC;
 	/*rev 99*/
-	prefetch_bw_pr = dml_min(1, bytes_pp * myPipe->PixelClock / (double) myPipe->DPPPerPlane);
+	prefetch_bw_pr = bytes_pp * myPipe->PixelClock / (double) myPipe->DPPPerPlane;
+	prefetch_bw_pr = dml_min(1, myPipe->VRatio) * prefetch_bw_pr;
 	max_Tsw = dml_max(PrefetchSourceLinesY, PrefetchSourceLinesC) * LineTime;
 	prefetch_sw_bytes = PrefetchSourceLinesY * swath_width_luma_ub * myPipe->BytePerPixelY + PrefetchSourceLinesC * swath_width_chroma_ub * myPipe->BytePerPixelC;
 	prefetch_bw_oto = dml_max(bytes_pp * myPipe->PixelClock / myPipe->DPPPerPlane, prefetch_sw_bytes / (dml_max(PrefetchSourceLinesY, PrefetchSourceLinesC) * LineTime));
drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c +2 -1
index 0d12fd079cd6..53e3e7364ec6 100644
@@ -1074,7 +1074,8 @@ static bool CalculatePrefetchSchedule(
 	else
 		bytes_pp = myPipe->BytePerPixelY + myPipe->BytePerPixelC;
 	/*rev 99*/
-	prefetch_bw_pr = dml_min(1, bytes_pp * myPipe->PixelClock / (double) myPipe->DPPPerPlane);
+	prefetch_bw_pr = bytes_pp * myPipe->PixelClock / (double) myPipe->DPPPerPlane;
+	prefetch_bw_pr = dml_min(1, myPipe->VRatio) * prefetch_bw_pr;
 	max_Tsw = dml_max(PrefetchSourceLinesY, PrefetchSourceLinesC) * LineTime;
 	prefetch_sw_bytes = PrefetchSourceLinesY * swath_width_luma_ub * myPipe->BytePerPixelY + PrefetchSourceLinesC * swath_width_chroma_ub * myPipe->BytePerPixelC;
 	prefetch_bw_oto = dml_max(bytes_pp * myPipe->PixelClock / myPipe->DPPPerPlane, prefetch_sw_bytes / (dml_max(PrefetchSourceLinesY, PrefetchSourceLinesC) * LineTime));
Signature · 1 line
2.38.1
author
#5 lore raw

PATCH 5/18 drm/amd/display: Check validation passed after applying pipe split changes

In reply to Alex Hung

From: Dillon Varone <[email protected]>

[WHY?]
Validation can fail for configurations that were previously supported, by only changing parameters such as the DET allocations, which is currently unexpected.

[HOW?]
Add a check that validation passes after applying pipe split related changes.

---
 drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c +6 -4
index b6cd10f3181c..9c03f62b9d19 100644
@@ -1736,10 +1736,12 @@ bool dcn32_internal_validate_bw(struct dc *dc,
 		 * ensure all the params are calculated correctly. We do not need to run the
 		 * pipe split check again after this call (pipes are already split / merged).
 		 * */
-		if (!fast_validate) {
-			context->bw_ctx.dml.soc.allow_for_pstate_or_stutter_in_vblank_final =
-						dm_prefetch_support_uclk_fclk_and_stutter_if_possible;
-			vlevel = dml_get_voltage_level(&context->bw_ctx.dml, pipes, pipe_cnt);
+		context->bw_ctx.dml.soc.allow_for_pstate_or_stutter_in_vblank_final =
+					dm_prefetch_support_uclk_fclk_and_stutter_if_possible;
+		vlevel = dml_get_voltage_level(&context->bw_ctx.dml, pipes, pipe_cnt);
+		if (vlevel == context->bw_ctx.dml.soc.num_states) {
+			/* failed after DET size changes */
+			goto validate_fail;
 		}
 	}
 	*vlevel_out = vlevel;
Signature · 1 line
2.38.1
author
#6 lore raw

PATCH 6/18 drm/amd/display: Remove rate check from pixel rate divider update

In reply to Alex Hung

From: Taimur Hassan <[email protected]>

[Why]
This check is not needed, and can cause CRC mismatch.

[How]
Remove check and early exit from divider update.

---
 drivers/gpu/drm/amd/display/dc/dcn314/dcn314_dccg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_dccg.c +1 -1
index 1bd7e0f327d8..367cb6e6d074 100644
@@ -97,7 +97,7 @@ static void dccg314_set_pixel_rate_div(
 	enum pixel_rate_div cur_k1 = PIXEL_RATE_DIV_NA, cur_k2 = PIXEL_RATE_DIV_NA;
 
 	dccg314_get_pixel_rate_div(dccg, otg_inst, &cur_k1, &cur_k2);
-	if (k1 == PIXEL_RATE_DIV_NA || k2 == PIXEL_RATE_DIV_NA || (k1 == cur_k1 && k2 == cur_k2))
+	if (k1 == cur_k1 && k2 == cur_k2)
 		return;
 
 	switch (otg_inst) {
Signature · 1 line
2.38.1
author
#7 lore raw

PATCH 7/18 drm/amd/display: Modify checks to enable TPS3 pattern when required

In reply to Alex Hung

From: Iswara Nagulendran <[email protected]>

[HOW&WHY]
Checking if both DSC and FEC supported from sink and source before going with TPS3 pattern during link training.

---
 drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c +5 -1
index bec5e9f787fc..cda1592c3a5b 100644
@@ -399,7 +399,11 @@ static bool dmub_psr_copy_settings(struct dmub_psr *dmub,
 		link->psr_settings.force_ffu_mode = 0;
 	copy_settings_data->force_ffu_mode = link->psr_settings.force_ffu_mode;
 
-	if (link->fec_state == dc_link_fec_enabled &&
+	if (((link->dpcd_caps.fec_cap.bits.FEC_CAPABLE &&
+		!link->dc->debug.disable_fec) &&
+		(link->dpcd_caps.dsc_caps.dsc_basic_caps.fields.dsc_support.DSC_SUPPORT &&
+		!link->panel_config.dsc.disable_dsc_edp &&
+		link->dc->caps.edp_dsc_support)) &&
 		link->dpcd_caps.sink_dev_id == DP_DEVICE_ID_38EC11 &&
 		(!memcmp(link->dpcd_caps.sink_dev_id_str, DP_SINK_DEVICE_STR_ID_1,
 			sizeof(DP_SINK_DEVICE_STR_ID_1)) ||
Signature · 1 line
2.38.1
author
#8 lore raw

PATCH 8/18 drm/amd/display: Stop waiting for vblank during pipe programming

In reply to Alex Hung

From: Martin Leung <[email protected]>

[why and how]
This line was originally removed for a compliance issue, but then reverted as it caused a fringe underflow case.

However, the addition of this line caused a underflow regression when subVP is on, and it needs to be removed again. We plan to fix subvp underflow and then re-add in this line. After that, we will investigate what to do next for the compliance issue.

---
 drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +0 -1
index b465a83bde6f..f3334f513eb4 100644
@@ -1663,7 +1663,6 @@ static void dcn20_program_pipe(
 				pipe_ctx->pipe_dlg_param.vupdate_width);
 
 		if (pipe_ctx->stream->mall_stream_config.type != SUBVP_PHANTOM) {
-			pipe_ctx->stream_res.tg->funcs->wait_for_state(pipe_ctx->stream_res.tg, CRTC_STATE_VBLANK);
 			pipe_ctx->stream_res.tg->funcs->wait_for_state(pipe_ctx->stream_res.tg, CRTC_STATE_VACTIVE);
 		}
 
Signature · 1 line
2.38.1
author
#9 lore raw

PATCH 9/18 drm/amd/display: Add a debug option HBR2CP2520 over TPS4

In reply to Alex Hung

From: Leo Chen <[email protected]>

[Why & How] There are cases when we may need to override the hardcoded TPS4 test pattern. Added parameters and config option to be able to allow this.

---
 drivers/gpu/drm/amd/display/dc/dc.h                     | 1 +
 drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c   | 2 ++
 drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c | 2 ++
 drivers/gpu/drm/amd/display/dc/dcn315/dcn315_resource.c | 2 ++
 drivers/gpu/drm/amd/display/dc/dcn316/dcn316_resource.c | 2 ++
 drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c   | 2 ++
 6 files changed, 11 insertions(+)
drivers/gpu/drm/amd/display/dc/dc.h +1 -0
index d9f510b4e848..dc0d51396626 100644
@@ -393,6 +393,7 @@ struct dc_config {
 	bool disable_dmcu;
 	bool enable_4to1MPC;
 	bool enable_windowed_mpo_odm;
+	bool forceHBR2CP2520; // Used for switching between test patterns TPS4 and CP2520
 	uint32_t allow_edp_hotplug_detection;
 	bool clamp_min_dcfclk;
 	uint64_t vblank_alignment_dto_params;
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c +2 -0
index 8729d6305996..8f5e89cb9d3e 100644
@@ -1902,6 +1902,8 @@ static bool dcn31_resource_construct(
 	dc->caps.max_slave_rgb_planes = 2;
 	dc->caps.post_blend_color_processing = true;
 	dc->caps.force_dp_tps4_for_cp2520 = true;
+	if (dc->config.forceHBR2CP2520)
+		dc->caps.force_dp_tps4_for_cp2520 = false;
 	dc->caps.dp_hpo = true;
 	dc->caps.dp_hdmi21_pcon_support = true;
 	dc->caps.edp_dsc_support = true;
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c +2 -0
index 85e2d87a8e44..3b3e093e9447 100644
@@ -1770,6 +1770,8 @@ static bool dcn314_resource_construct(
 	dc->caps.max_slave_rgb_planes = 2;
 	dc->caps.post_blend_color_processing = true;
 	dc->caps.force_dp_tps4_for_cp2520 = true;
+	if (dc->config.forceHBR2CP2520)
+		dc->caps.force_dp_tps4_for_cp2520 = false;
 	dc->caps.dp_hpo = true;
 	dc->caps.dp_hdmi21_pcon_support = true;
 	dc->caps.edp_dsc_support = true;
drivers/gpu/drm/amd/display/dc/dcn315/dcn315_resource.c +2 -0
index 31cbc5762eab..96a3d41febff 100644
@@ -1783,6 +1783,8 @@ static bool dcn315_resource_construct(
 	dc->caps.max_slave_rgb_planes = 2;
 	dc->caps.post_blend_color_processing = true;
 	dc->caps.force_dp_tps4_for_cp2520 = true;
+	if (dc->config.forceHBR2CP2520)
+		dc->caps.force_dp_tps4_for_cp2520 = false;
 	dc->caps.dp_hpo = true;
 	dc->caps.dp_hdmi21_pcon_support = true;
 	dc->caps.edp_dsc_support = true;
drivers/gpu/drm/amd/display/dc/dcn316/dcn316_resource.c +2 -0
index af3eddc0cf32..2f643cdaf59f 100644
@@ -1785,6 +1785,8 @@ static bool dcn316_resource_construct(
 	dc->caps.max_slave_rgb_planes = 2;
 	dc->caps.post_blend_color_processing = true;
 	dc->caps.force_dp_tps4_for_cp2520 = true;
+	if (dc->config.forceHBR2CP2520)
+		dc->caps.force_dp_tps4_for_cp2520 = false;
 	dc->caps.dp_hpo = true;
 	dc->caps.dp_hdmi21_pcon_support = true;
 	dc->caps.edp_dsc_support = true;
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c +2 -0
index 287b7fa9bf41..4ba9a8662185 100644
@@ -2126,6 +2126,8 @@ static bool dcn32_resource_construct(
 	dc->caps.max_slave_rgb_planes = 2;
 	dc->caps.post_blend_color_processing = true;
 	dc->caps.force_dp_tps4_for_cp2520 = true;
+	if (dc->config.forceHBR2CP2520)
+		dc->caps.force_dp_tps4_for_cp2520 = false;
 	dc->caps.dp_hpo = true;
 	dc->caps.dp_hdmi21_pcon_support = true;
 	dc->caps.edp_dsc_support = true;
Signature · 1 line
2.38.1
author
#10 lore raw

PATCH 10/18 drm/amd/display: [FW Promotion] Release 0.0.141.0

In reply to Alex Hung

From: Anthony Koo <[email protected]>

- Add flag as a status read back that indicates back to back flips detected during psr.

---
 drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h +6 -0
index bc9344af1995..9df330c86a55 100644
@@ -225,6 +225,12 @@ union dmub_psr_debug_flags {
 		 * Use TPS3 signal when restore main link.
 		 */
 		uint32_t force_wakeup_by_tps3 : 1;
+
+		/**
+		 * Back to back flip, therefore cannot power down PHY
+		 */
+		uint32_t back_to_back_flip : 1;
+
 	} bitfields;
 
 	/**
Signature · 1 line
2.38.1
author
#11 lore raw

PATCH 11/18 drm/amd/display: Use min transition for SubVP into MPO

In reply to Alex Hung

From: Alvin Lee <[email protected]>

[Description]
- For SubVP transitioning into MPO, we want to use a minimal transition to prevent transient underflow
- Transitioning a phantom pipe directly into a "real" pipe can result in underflow due to the HUBP still having it's "phantom" programming when HUBP is unblanked (have to wait for next VUPDATE of the new OTG)
- Also ensure subvp pipe lock is acquired early enough for programming in dc_commit_state_no_check
- When disabling phantom planes, enable phantom OTG first so the disable gets the double buffer update

---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 43 +++++++++++-------------
 1 file changed, 20 insertions(+), 23 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +20 -23
index d446e6098948..da808996e21d 100644
@@ -1054,6 +1054,7 @@ static void disable_dangling_plane(struct dc *dc, struct dc_state *context)
 	int i, j;
 	struct dc_state *dangling_context = dc_create_state(dc);
 	struct dc_state *current_ctx;
+	struct pipe_ctx *pipe;
 
 	if (dangling_context == NULL)
 		return;
@@ -1096,6 +1097,16 @@ static void disable_dangling_plane(struct dc *dc, struct dc_state *context)
 		}
 
 		if (should_disable && old_stream) {
+			pipe = &dc->current_state->res_ctx.pipe_ctx[i];
+			/* When disabling plane for a phantom pipe, we must turn on the
+			 * phantom OTG so the disable programming gets the double buffer
+			 * update. Otherwise the pipe will be left in a partially disabled
+			 * state that can result in underflow or hang when enabling it
+			 * again for different use.
+			 */
+			if (old_stream->mall_stream_config.type == SUBVP_PHANTOM) {
+				pipe->stream_res.tg->funcs->enable_crtc(pipe->stream_res.tg);
+			}
 			dc_rem_all_planes_for_stream(dc, old_stream, dangling_context);
 			disable_all_writeback_pipes_for_stream(dc, old_stream, dangling_context);
 
@@ -1749,6 +1760,12 @@ static enum dc_status dc_commit_state_no_check(struct dc *dc, struct dc_state *c
 		context->stream_count == 0)
 		dc->hwss.prepare_bandwidth(dc, context);
 
+	/* When SubVP is active, all HW programming must be done while
+	 * SubVP lock is acquired
+	 */
+	if (dc->hwss.subvp_pipe_control_lock)
+		dc->hwss.subvp_pipe_control_lock(dc, context, true, true, NULL, subvp_prev_use);
+
 	if (dc->debug.enable_double_buffered_dsc_pg_support)
 		dc->hwss.update_dsc_pg(dc, context, false);
 
@@ -1776,9 +1793,6 @@ static enum dc_status dc_commit_state_no_check(struct dc *dc, struct dc_state *c
 		dc->hwss.wait_for_mpcc_disconnect(dc, dc->res_pool, pipe);
 	}
 
-	if (dc->hwss.subvp_pipe_control_lock)
-		dc->hwss.subvp_pipe_control_lock(dc, context, true, true, NULL, subvp_prev_use);
-
 	result = dc->hwss.apply_ctx_to_hw(dc, context);
 
 	if (result != DC_OK) {
@@ -3675,7 +3689,6 @@ static bool could_mpcc_tree_change_for_active_pipes(struct dc *dc,
 
 	struct dc_stream_status *cur_stream_status = stream_get_status(dc->current_state, stream);
 	bool force_minimal_pipe_splitting = false;
-	uint32_t i;
 
 	*is_plane_addition = false;
 
@@ -3707,27 +3720,11 @@ static bool could_mpcc_tree_change_for_active_pipes(struct dc *dc,
 		}
 	}
 
-	/* For SubVP pipe split case when adding MPO video
-	 * we need to add a minimal transition. In this case
-	 * there will be 2 streams (1 main stream, 1 phantom
-	 * stream).
+	/* For SubVP when adding MPO video we need to add a minimal transition.
 	 */
-	if (cur_stream_status &&
-			dc->current_state->stream_count == 2 &&
-			stream->mall_stream_config.type == SUBVP_MAIN) {
-		bool is_pipe_split = false;
-
-		for (i = 0; i < dc->res_pool->pipe_count; i++) {
-			if (dc->current_state->res_ctx.pipe_ctx[i].stream == stream &&
-					(dc->current_state->res_ctx.pipe_ctx[i].bottom_pipe ||
-					dc->current_state->res_ctx.pipe_ctx[i].next_odm_pipe)) {
-				is_pipe_split = true;
-				break;
-			}
-		}
-
+	if (cur_stream_status && stream->mall_stream_config.type == SUBVP_MAIN) {
 		/* determine if minimal transition is required due to SubVP*/
-		if (surface_count > 0 && is_pipe_split) {
+		if (surface_count > 0) {
 			if (cur_stream_status->plane_count > surface_count) {
 				force_minimal_pipe_splitting = true;
 			} else if (cur_stream_status->plane_count < surface_count) {
Signature · 1 line
2.38.1
author
#12 lore raw

PATCH 12/18 drm/amd/display: Fix DCN32 DSC delay calculation

In reply to Alex Hung

From: George Shen <[email protected]>

[Why]
DCN32 DSC delay calculation had an unintentional integer division, resulting in a mismatch against the DML spreadsheet.

[How]
Cast numerator to double before performing the division.

---
 .../gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c +1 -1
index ad66e241f9ae..4a3e7a5d2758 100644
@@ -1746,7 +1746,7 @@ unsigned int dml32_DSCDelayRequirement(bool DSCEnabled,
 		}
 
 		DSCDelayRequirement_val = DSCDelayRequirement_val + (HTotal - HActive) *
-				dml_ceil(DSCDelayRequirement_val / HActive, 1);
+				dml_ceil((double)DSCDelayRequirement_val / HActive, 1);
 
 		DSCDelayRequirement_val = DSCDelayRequirement_val * PixelClock / PixelClockBackEnd;
 
Signature · 1 line
2.38.1
author
#13 lore raw

PATCH 13/18 drm/amd/display: Use forced DSC bpp in DML

In reply to Alex Hung

From: George Shen <[email protected]>

[Why]
DSC config is calculated separately from DML calculations. DML should use these separately calculated DSC params. The issue is that the calculated bpp is not properly propagated into DML.

[How]
Correctly used forced_bpp value in DML.

---
 drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c | 2 +-
 drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.c          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c +1 -1
index 5b91660a6496..60351b2891d0 100644
@@ -1627,7 +1627,7 @@ static void mode_support_configuration(struct vba_vars_st *v,
 				&& !mode_lib->vba.MSOOrODMSplitWithNonDPLink
 				&& !mode_lib->vba.NotEnoughLanesForMSO
 				&& mode_lib->vba.LinkCapacitySupport[i] == true && !mode_lib->vba.P2IWith420
-				&& !mode_lib->vba.DSCOnlyIfNecessaryWithBPP
+				//&& !mode_lib->vba.DSCOnlyIfNecessaryWithBPP
 				&& !mode_lib->vba.DSC422NativeNotSupported
 				&& !mode_lib->vba.MPCCombineMethodIncompatible
 				&& mode_lib->vba.ODMCombine2To1SupportCheckOK[i] == true
drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.c +1 -1
index 03924aed8d5c..8e6585dab20e 100644
@@ -625,7 +625,7 @@ static void fetch_pipe_params(struct display_mode_lib *mode_lib)
 		mode_lib->vba.skip_dio_check[mode_lib->vba.NumberOfActivePlanes] =
 				dout->is_virtual;
 
-		if (!dout->dsc_enable)
+		if (dout->dsc_enable)
 			mode_lib->vba.ForcedOutputLinkBPP[mode_lib->vba.NumberOfActivePlanes] = dout->output_bpp;
 		else
 			mode_lib->vba.ForcedOutputLinkBPP[mode_lib->vba.NumberOfActivePlanes] = 0.0;
Signature · 1 line
2.38.1
author
#14 lore raw

PATCH 14/18 drm/amd/display: Round up DST_after_scaler to nearest int

In reply to Alex Hung

From: George Shen <[email protected]>

[Why]
The DST_after_scaler value that DML spreadsheet outputs is generally the driver value round up to the nearest int.

---
 .../gpu/drm/amd/display/dc/dml/dcn32/display_rq_dlg_calc_32.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dml/dcn32/display_rq_dlg_calc_32.c +2 -2
index a1276f6b9581..395ae8761980 100644
@@ -291,8 +291,8 @@ void dml32_rq_dlg_get_dlg_reg(struct display_mode_lib *mode_lib,
 
 	dml_print("DML_DLG: %s: vready_after_vcount0 = %d\n", __func__, dlg_regs->vready_after_vcount0);
 
-	dst_x_after_scaler = get_dst_x_after_scaler(mode_lib, e2e_pipe_param, num_pipes, pipe_idx);
-	dst_y_after_scaler = get_dst_y_after_scaler(mode_lib, e2e_pipe_param, num_pipes, pipe_idx);
+	dst_x_after_scaler = dml_ceil(get_dst_x_after_scaler(mode_lib, e2e_pipe_param, num_pipes, pipe_idx), 1);
+	dst_y_after_scaler = dml_ceil(get_dst_y_after_scaler(mode_lib, e2e_pipe_param, num_pipes, pipe_idx), 1);
 
 	// do some adjustment on the dst_after scaler to account for odm combine mode
 	dml_print("DML_DLG: %s: input dst_x_after_scaler   = %d\n", __func__, dst_x_after_scaler);
Signature · 1 line
2.38.1
author
#15 lore raw

PATCH 15/18 drm/amd/display: Add DSC delay factor workaround

In reply to Alex Hung

From: George Shen <[email protected]>

[Why]
Certain 4K high refresh rate modes requiring DSC are exhibiting top of screen underflow corruption. Increasing the DSC delay by a factor of 6 percent stops the underflow for most use cases.

[How]
Multiply DSC delay requirement in DML by a factor. Add debug option to make this DSC delay factor configurable.

---
 drivers/gpu/drm/amd/display/dc/dc.h                          | 1 +
 drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c         | 4 +++-
 .../gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c   | 5 +++--
 .../drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c  | 5 +++--
 .../drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.h  | 3 ++-
 drivers/gpu/drm/amd/display/dc/dml/dcn321/dcn321_fpu.c       | 5 ++++-
 drivers/gpu/drm/amd/display/dc/dml/display_mode_structs.h    | 3 +++
 7 files changed, 19 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/display/dc/dc.h +1 -0
index dc0d51396626..fb33540323bd 100644
@@ -863,6 +863,7 @@ struct dc_debug_options {
 	bool enable_double_buffered_dsc_pg_support;
 	bool enable_dp_dig_pixel_rate_div_policy;
 	enum lttpr_mode lttpr_mode_override;
+	unsigned int dsc_delay_factor_wa_x1000;
 };
 
 struct gpu_info_soc_bounding_box_v1_0;
drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c +3 -1
index 9c03f62b9d19..0d704e302d03 100644
@@ -2346,9 +2346,11 @@ void dcn32_update_bw_bounding_box_fpu(struct dc *dc, struct clk_bw_params *bw_pa
 
 		if (dc->ctx->dc_bios->vram_info.dram_channel_width_bytes)
 			dcn3_2_soc.dram_channel_width_bytes = dc->ctx->dc_bios->vram_info.dram_channel_width_bytes;
-
 	}
 
+	/* DML DSC delay factor workaround */
+	dcn3_2_ip.dsc_delay_factor_wa = dc->debug.dsc_delay_factor_wa_x1000 / 1000.0;
+
 	/* Override dispclk_dppclk_vco_speed_mhz from Clk Mgr */
 	dcn3_2_soc.dispclk_dppclk_vco_speed_mhz = dc->clk_mgr->dentist_vco_freq_khz / 1000.0;
 	dc->dml.soc.dispclk_dppclk_vco_speed_mhz = dc->clk_mgr->dentist_vco_freq_khz / 1000.0;
drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c +3 -2
index 60351b2891d0..47ff0a8bd105 100644
@@ -367,7 +367,7 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
 				mode_lib->vba.OutputBpp[k], mode_lib->vba.HActive[k], mode_lib->vba.HTotal[k],
 				mode_lib->vba.NumberOfDSCSlices[k], mode_lib->vba.OutputFormat[k],
 				mode_lib->vba.Output[k], mode_lib->vba.PixelClock[k],
-				mode_lib->vba.PixelClockBackEnd[k]);
+				mode_lib->vba.PixelClockBackEnd[k], mode_lib->vba.ip.dsc_delay_factor_wa);
 	}
 
 	for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k)
@@ -2475,7 +2475,8 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
 					mode_lib->vba.OutputBppPerState[i][k], mode_lib->vba.HActive[k],
 					mode_lib->vba.HTotal[k], mode_lib->vba.NumberOfDSCSlices[k],
 					mode_lib->vba.OutputFormat[k], mode_lib->vba.Output[k],
-					mode_lib->vba.PixelClock[k], mode_lib->vba.PixelClockBackEnd[k]);
+					mode_lib->vba.PixelClock[k], mode_lib->vba.PixelClockBackEnd[k],
+					mode_lib->vba.ip.dsc_delay_factor_wa);
 		}
 
 		for (k = 0; k <= mode_lib->vba.NumberOfActiveSurfaces - 1; k++) {
drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c +3 -2
index 4a3e7a5d2758..968924c491c1 100644
@@ -1726,7 +1726,8 @@ unsigned int dml32_DSCDelayRequirement(bool DSCEnabled,
 		enum output_format_class  OutputFormat,
 		enum output_encoder_class Output,
 		double PixelClock,
-		double PixelClockBackEnd)
+		double PixelClockBackEnd,
+		double dsc_delay_factor_wa)
 {
 	unsigned int DSCDelayRequirement_val;
 
@@ -1764,7 +1765,7 @@ unsigned int dml32_DSCDelayRequirement(bool DSCEnabled,
 	dml_print("DML::%s: DSCDelayRequirement_val = %d\n", __func__, DSCDelayRequirement_val);
 #endif
 
-	return DSCDelayRequirement_val;
+	return dml_ceil(DSCDelayRequirement_val * dsc_delay_factor_wa, 1);
 }
 
 void dml32_CalculateSurfaceSizeInMall(
drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.h +2 -1
index 55cead0d4237..2c3827546ac7 100644
@@ -327,7 +327,8 @@ unsigned int dml32_DSCDelayRequirement(bool DSCEnabled,
 		enum output_format_class  OutputFormat,
 		enum output_encoder_class Output,
 		double PixelClock,
-		double PixelClockBackEnd);
+		double PixelClockBackEnd,
+		double dsc_delay_factor_wa);
 
 void dml32_CalculateSurfaceSizeInMall(
 		unsigned int NumberOfActiveSurfaces,
drivers/gpu/drm/amd/display/dc/dml/dcn321/dcn321_fpu.c +4 -1
index 7352f7514410..ec0486efab14 100644
@@ -29,6 +29,7 @@
 #include "dcn321_fpu.h"
 #include "dcn32/dcn32_resource.h"
 #include "dcn321/dcn321_resource.h"
+#include "dml/dcn32/display_mode_vba_util_32.h"
 
 #define DCN3_2_DEFAULT_DET_SIZE 256
 
@@ -538,9 +539,11 @@ void dcn321_update_bw_bounding_box_fpu(struct dc *dc, struct clk_bw_params *bw_p
 
 		if (dc->ctx->dc_bios->vram_info.dram_channel_width_bytes)
 			dcn3_21_soc.dram_channel_width_bytes = dc->ctx->dc_bios->vram_info.dram_channel_width_bytes;
-
 	}
 
+	/* DML DSC delay factor workaround */
+	dcn3_21_ip.dsc_delay_factor_wa = dc->debug.dsc_delay_factor_wa_x1000 / 1000.0;
+
 	/* Override dispclk_dppclk_vco_speed_mhz from Clk Mgr */
 	dcn3_21_soc.dispclk_dppclk_vco_speed_mhz = dc->clk_mgr->dentist_vco_freq_khz / 1000.0;
 	dc->dml.soc.dispclk_dppclk_vco_speed_mhz = dc->clk_mgr->dentist_vco_freq_khz / 1000.0;
drivers/gpu/drm/amd/display/dc/dml/display_mode_structs.h +3 -0
index f33a8879b05a..d7be01ac0751 100644
@@ -364,6 +364,9 @@ struct _vcs_dpi_ip_params_st {
 	unsigned int max_num_dp2p0_outputs;
 	unsigned int max_num_dp2p0_streams;
 	unsigned int VBlankNomDefaultUS;
+
+	/* DM workarounds */
+	double dsc_delay_factor_wa; // TODO: Remove after implementing root cause fix
 };
 
 struct _vcs_dpi_display_xfc_params_st {
Signature · 1 line
2.38.1
author
#16 lore raw

PATCH 16/18 drm/amd/display: Fix null pointer issues found in emulation

In reply to Alex Hung

From: Charlene Liu <[email protected]>

[why]
fix null point issues found in emulation

---
 drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hwseq.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hwseq.c +4 -2
index bdf101547484..165c920ca776 100644
@@ -89,7 +89,8 @@ static void enable_memory_low_power(struct dc *dc)
 		REG_UPDATE(MMHUBBUB_MEM_PWR_CNTL, VGA_MEM_PWR_FORCE, 1);
 	}
 
-	if (dc->debug.enable_mem_low_power.bits.mpc)
+	if (dc->debug.enable_mem_low_power.bits.mpc &&
+		dc->res_pool->mpc->funcs->set_mpc_mem_lp_mode)
 		dc->res_pool->mpc->funcs->set_mpc_mem_lp_mode(dc->res_pool->mpc);
 
 
@@ -141,7 +142,8 @@ void dcn31_init_hw(struct dc *dc)
 
 	if (!dcb->funcs->is_accelerated_mode(dcb)) {
 		hws->funcs.bios_golden_init(dc);
-		hws->funcs.disable_vga(dc->hwseq);
+		if (hws->funcs.disable_vga)
+			hws->funcs.disable_vga(dc->hwseq);
 	}
 	// Initialize the dccg
 	if (res_pool->dccg->funcs->dccg_init)
Signature · 1 line
2.38.1
author
#17 lore raw

PATCH 17/18 drm/amd/display: Investigate tool reported FCLK P-state deviations

In reply to Alex Hung

From: Nevenko Stupar <[email protected]>

[Why]
Fix for some of the tool reported modes for FCLK P-state deviations and UCLK P-state deviations that are coming from DSC terms and/or Scaling terms causing MinActiveFCLKChangeLatencySupported and MaxActiveDRAMClockChangeLatencySupported incorrectly calculated in DML for these configurations.

---
 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 47ff0a8bd105..3d184679f129 100644
@@ -364,7 +364,8 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
 	for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
 		v->DSCDelay[k] = dml32_DSCDelayRequirement(mode_lib->vba.DSCEnabled[k],
 				mode_lib->vba.ODMCombineEnabled[k], mode_lib->vba.DSCInputBitPerComponent[k],
-				mode_lib->vba.OutputBpp[k], mode_lib->vba.HActive[k], mode_lib->vba.HTotal[k],
+				mode_lib->vba.OutputBppPerState[mode_lib->vba.VoltageLevel][k],
+				mode_lib->vba.HActive[k], mode_lib->vba.HTotal[k],
 				mode_lib->vba.NumberOfDSCSlices[k], mode_lib->vba.OutputFormat[k],
 				mode_lib->vba.Output[k], mode_lib->vba.PixelClock[k],
 				mode_lib->vba.PixelClockBackEnd[k], mode_lib->vba.ip.dsc_delay_factor_wa);
Signature · 1 line
2.38.1
author
#18 lore raw

PATCH 18/18 drm/amd/display: 3.2.210

In reply to Alex Hung

From: Aric Cyr <[email protected]>

DC version 3.2.210 brings along the following:

- Investigate tool reported FCLK P-state deviations
- Fix null pointer issues found in emulation
- Add DSC delay factor workaround
- Round up DST_after_scaler to nearest int
- Use forced DSC bpp in DML
- Fix DCN32 DSC delay calculation
- Use min transition for SubVP into MPO
- Add a debug option HBR2CP2520 over TPS4
- Stop waiting for vblank during pipe programming
- Modify checks to enable TPS3 pattern when required
- Remove rate check from pixel rate divider update
- Check validation passed after applying pipe split changes
- Update DML formula
- Don't enable ODM + MPO
- Include virtual signal to set k1 and k2 values
- Reinit DPG when exiting dynamic ODM

---
 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 fb33540323bd..223c0a920f2a 100644
@@ -47,7 +47,7 @@ struct aux_payload;
 struct set_config_cmd_payload;
 struct dmub_notification;
 
-#define DC_VER "3.2.209"
+#define DC_VER "3.2.210"
 
 #define MAX_SURFACES 3
 #define MAX_PLANES 6
Signature · 1 line
2.38.1