Skip to contentSkip to conversation

DC Patches October 5, 2026

PATCH In review [email protected] 2 participants 21 messages Oct 7 – Oct 13

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

cover DC Patches October 5, 2026

From: Ivan Lipski <[email protected]>

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

- Refactor DC IP request control in HWSS.
- Fix rotate 90 degrees surface corruption issue.
- Refactor DPP root clock control in HWSS.
- Fix upsampling and linear scaling.
- Use aux hw inst if no ddc pin exists.
- Directly include compiler_attributes.h.
- Fix frac_urg_bw conversion to correct U0.10 format.
- Do full link training during HDR/SDR seamless switch.
- Fix SPL format handling for linear scaling and upsampling.
- Update DCN42 cstate latencies.
- Invalidate the DRR shadow after a hardware re-init.
- Program HDR visual confirm based on per pipe info.
- Split link_set_dsc_on_stream into encoder and DSC components.
- Add new config_dsc hwseq function for DCN60.
- Program DSC prior to OTG enable starting DCN60.
- Improve mandatory pstate optimization and check.
- Disable HUBP/DPP power gating on DCN42.

Cc Dan Wheeler <[email protected]>

Alvin Lee (2):
drm/amd/display: Use aux hw inst if no ddc pin exists drm/amd/display: Program HDR visual confirm based on per pipe info

Aric Cyr (1):
drm/amd/display: Invalidate the DRR shadow after a hardware re-init

Charlene Liu (1):
drm/amd/display: Fix rotate 90 degrees surface corruption issue

Dillon Varone (1):
drm/amd/display: Improve mandatory pstate optimization and check

Dominik Kaszewski (1):
drm/amd/display: Directly include compiler_attributes.h

George Shen (3):
drm/amd/display: Split link_set_dsc_on_stream into encoder and DSC
components
drm/amd/display: Add new config_dsc hwseq function for dcn60 drm/amd/display: Program DSC prior to OTG enable starting DCN60

Ivan Lipski (1):
drm/amd/display: Fix FreeSync caps tests after common EDID VSDB switch

Karthi Kandasamy (1):
drm/amd/display: Do full link training during HDR/SDR seamless switch

Leo Chen (1):
drm/amd/display: Disable HUBP/DPP power gating on DCN42

Ovidiu Bunea (2):
drm/amd/display: Fix frac_urg_bw conversion to correct U0.10 format drm/amd/display: Update DCN42 cstate latencies

Rafal Ostrowski (2):
drm/amd/display: HWSS Refactor - DC IP request control drm/amd/display: HWSS Refactor - DPP root clock control

Sridevi Arvindekar (2):
drm/amd/display: Fix upsampling for linear scaling of subsampled YUV drm/amd/display: Fix linear scaling and upsampling

Taimur Hassan (1):
drm/amd/display: Promote DC to 3.2.402

 .../tests/amdgpu_dm_connector_test.c          |  30 +-
 drivers/gpu/drm/amd/display/dc/Makefile       |   1 +
 drivers/gpu/drm/amd/display/dc/core/dc.c      |  43 ++-
 .../drm/amd/display/dc/core/dc_hw_sequencer.c |  93 ++++--
 .../gpu/drm/amd/display/dc/core/dc_resource.c |  19 --
 .../amd/display/dc/core/dc_resource_helper.c  |  46 +++
 drivers/gpu/drm/amd/display/dc/dc.h           |   2 +-
 drivers/gpu/drm/amd/display/dc/dc_fused_io.c  |   4 +-
 .../gpu/drm/amd/display/dc/dc_memory_pool.c   |   1 +
 .../gpu/drm/amd/display/dc/dc_memory_pool.h   |   2 +
 .../gpu/drm/amd/display/dc/dc_spl_translate.c |  22 +-
 .../amd/display/dc/dccg/dcn314/dcn314_dccg.c  |   4 +-
 .../amd/display/dc/dccg/dcn35/dcn35_dccg.c    |  21 +-
 .../amd/display/dc/dccg/dcn35/dcn35_dccg.h    |   3 +-
 .../amd/display/dc/dccg/dcn42/dcn42_dccg.c    |   2 +-
 .../dml21/inc/bounding_boxes/dcn42_soc_bb.h   |   8 +-
 .../src/dml2_core/dml2_core_dcn4_calcs.c      |   7 +-
 .../dml2_core/dml2_core_dcn5_calcs_dchub.c    |   5 +-
 .../dml2_core/dml2_core_dcn6_calcs_dchub.c    |  10 +-
 .../dml21/src/dml2_dpmm/dml2_dpmm_dcn4.c      |  20 +-
 .../dml21/src/dml2_dpmm/dml2_dpmm_dcn5.c      |  13 +-
 .../dml2_pmo/dml2_pmo_dcn6_stage_optimizers.c |  97 +++---
 .../src/inc/dml2_internal_shared_types.h      |   2 +-
 .../drm/amd/display/dc/dpp/dcn10/dcn10_dpp.c  |   4 +-
 .../drm/amd/display/dc/dpp/dcn10/dcn10_dpp.h  |   3 +-
 .../drm/amd/display/dc/dpp/dcn20/dcn20_dpp.c  |   4 +-
 .../amd/display/dc/dpp/dcn201/dcn201_dpp.c    |   4 +-
 .../drm/amd/display/dc/dpp/dcn30/dcn30_dpp.c  |  76 ++++-
 .../drm/amd/display/dc/dpp/dcn30/dcn30_dpp.h  |   9 +-
 .../amd/display/dc/dpp/dcn401/dcn401_dpp.c    |   4 +-
 .../amd/display/dc/dpp/dcn401/dcn401_dpp.h    |   3 +-
 .../display/dc/dpp/dcn401/dcn401_dpp_dscl.c   |   8 +-
 .../drm/amd/display/dc/dpp/dcn42/dcn42_dpp.c  |   4 +-
 .../drm/amd/display/dc/dpp/dcn50/dcn50_dpp.c  |   4 +-
 .../drm/amd/display/dc/dpp/dcn50/dcn50_dpp.h  |   3 +-
 .../drm/amd/display/dc/dpp/dcn60/dcn60_dpp.c  |  38 ++-
 .../drm/amd/display/dc/dpp/dcn60/dcn60_dpp.h  |  15 +-
 .../amd/display/dc/dpp/dcn60/dcn60_dpp_dscl.c |  13 +-
 .../display/dc/hubbub/dcn31/dcn31_hubbub.c    |   9 +-
 .../amd/display/dc/hwss/dce110/dce110_hwseq.c |  13 +-
 .../amd/display/dc/hwss/dcn10/dcn10_hwseq.c   |  28 +-
 .../amd/display/dc/hwss/dcn20/dcn20_hwseq.c   |  23 +-
 .../amd/display/dc/hwss/dcn31/dcn31_hwseq.c   |  21 +-
 .../amd/display/dc/hwss/dcn314/dcn314_hwseq.c |  20 +-
 .../amd/display/dc/hwss/dcn314/dcn314_hwseq.h |   2 +
 .../amd/display/dc/hwss/dcn314/dcn314_init.c  |   1 +
 .../amd/display/dc/hwss/dcn32/dcn32_hwseq.c   |   7 +-
 .../amd/display/dc/hwss/dcn35/dcn35_hwseq.c   |  24 +-
 .../amd/display/dc/hwss/dcn35/dcn35_hwseq.h   |   2 +
 .../amd/display/dc/hwss/dcn35/dcn35_init.c    |   1 +
 .../amd/display/dc/hwss/dcn351/dcn351_init.c  |   1 +
 .../amd/display/dc/hwss/dcn401/dcn401_hwseq.c |  27 +-
 .../amd/display/dc/hwss/dcn401/dcn401_hwseq.h |   2 +-
 .../amd/display/dc/hwss/dcn42/dcn42_hwseq.c   |   6 +-
 .../amd/display/dc/hwss/dcn42/dcn42_init.c    |   1 +
 .../amd/display/dc/hwss/dcn50/dcn50_hwseq.c   |   3 +-
 .../amd/display/dc/hwss/dcn60/dcn60_hwseq.c   | 101 ++++++-
 .../amd/display/dc/hwss/dcn60/dcn60_hwseq.h   |   1 +
 .../amd/display/dc/hwss/dcn60/dcn60_init.c    |   1 +
 .../drm/amd/display/dc/hwss/hw_sequencer.h    |   9 +-
 .../display/dc/hwss/hw_sequencer_private.h    |   5 +-
 drivers/gpu/drm/amd/display/dc/inc/hw/dccg.h  |   6 +-
 drivers/gpu/drm/amd/display/dc/inc/hw/dpp.h   |   3 +-
 .../gpu/drm/amd/display/dc/link/link_dpms.c   | 282 +++++++++++-------
 drivers/gpu/drm/amd/display/dc/os_types.h     |   1 -
 .../dc/resource/dcn42/dcn42_resource.c        |   4 +-
 .../dc/resource/dcn60/dcn60_resource.h        |   6 +
 drivers/gpu/drm/amd/display/dc/sspl/dc_spl.c  |  52 ++--
 68 files changed, 874 insertions(+), 435 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/display/dc/core/dc_resource_helper.c
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/19 drm/amd/display: HWSS Refactor - DC IP request control

From: Rafal Ostrowski <[email protected]>

[WHY]
Refactor DC_IP_REQUEST_CNTL to follow BLS rules: replace struct dc *dc with dce_hwseq handle in parameter structure and vtable signature, and add comprehensive hardware access guards.

[HOW]
- Update struct dc_ip_request_cntl_params to store struct dce_hwseq *hws instead of struct dc *dc.
- Update hwseq_private_funcs.dc_ip_request_cntl signature and dcn401 implementation to take (struct dce_hwseq *hws, bool enable).
- Add null checks for hws context, registers, shifts, and masks in dcn401_dc_ip_request_cntl.
- Update hwss_dc_ip_request_cntl executor and hwss_add_dc_ip_request_cntl builder.

---
 .../gpu/drm/amd/display/dc/core/dc_hw_sequencer.c    | 12 +++++++-----
 .../drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c    |  6 +++---
 .../drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.h    |  2 +-
 drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h   |  2 +-
 .../drm/amd/display/dc/hwss/hw_sequencer_private.h   |  2 +-
 5 files changed, 13 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +7 -5
index da98afee558f..7b93f57aff85 100644
@@ -4051,12 +4051,10 @@ void hwss_dpp_root_clock_control(union block_sequence_params *params)
 
 void hwss_dc_ip_request_cntl(union block_sequence_params *params)
 {
-	struct dc *dc = params->dc_ip_request_cntl_params.dc;
+	struct dce_hwseq *hws = params->dc_ip_request_cntl_params.hws;
 	bool enable = params->dc_ip_request_cntl_params.enable;
-	struct dce_hwseq *hws = dc->hwseq;
 
-	if (hws->funcs.dc_ip_request_cntl)
-		hws->funcs.dc_ip_request_cntl(dc, enable);
+	hws->funcs.dc_ip_request_cntl(hws, enable);
 }
 
 void hwss_dccg_update_dpp_dto(union block_sequence_params *params)
@@ -4964,9 +4962,13 @@ void hwss_add_dc_ip_request_cntl(struct block_sequence_state *seq_state,
 		struct dc *dc,
 		bool enable)
 {
+	if (!seq_state || !seq_state->steps || !seq_state->num_steps || !dc ||
+			!dc->hwseq || !dc->hwseq->funcs.dc_ip_request_cntl)
+		return;
+
 	if (*seq_state->num_steps < MAX_HWSS_BLOCK_SEQUENCE_SIZE) {
 		seq_state->steps[*seq_state->num_steps].func = DC_IP_REQUEST_CNTL;
-		seq_state->steps[*seq_state->num_steps].params.dc_ip_request_cntl_params.dc = dc;
+		seq_state->steps[*seq_state->num_steps].params.dc_ip_request_cntl_params.hws = dc->hwseq;
 		seq_state->steps[*seq_state->num_steps].params.dc_ip_request_cntl_params.enable = enable;
 		(*seq_state->num_steps)++;
 	}
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c +3 -3
index 0abdfc55290c..efff09784f45 100644
@@ -3598,10 +3598,10 @@ void dcn401_post_unlock_reset_opp_sequence(
 	}
 }
 
-void dcn401_dc_ip_request_cntl(struct dc *dc, bool enable)
+void dcn401_dc_ip_request_cntl(struct dce_hwseq *hws, bool enable)
 {
-	struct dce_hwseq *hws = dc->hwseq;
-
+	if (!hws || !hws->ctx || !hws->regs || !hws->shifts || !hws->masks)
+		return;
 	if (REG(DC_IP_REQUEST_CNTL))
 		REG_SET(DC_IP_REQUEST_CNTL, 0, IP_REQUEST_EN, enable ? 1 : 0);
 }
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.h +1 -1
index ecaeb192bca3..9df72e980e7a 100644
@@ -185,7 +185,7 @@ void dcn401_post_unlock_reset_opp_sequence(
 		struct pipe_ctx *opp_head,
 		struct block_sequence_state *seq_state);
 
-void dcn401_dc_ip_request_cntl(struct dc *dc, bool enable);
+void dcn401_dc_ip_request_cntl(struct dce_hwseq *hws, bool enable);
 
 void dcn401_enable_plane_sequence(struct dc *dc, struct pipe_ctx *pipe_ctx,
 				 struct dc_state *context,
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h +1 -1
index 7800b0501c39..bd005aaf9317 100644
@@ -711,7 +711,7 @@ struct dpp_root_clock_control_params {
 };
 
 struct dc_ip_request_cntl_params {
-	struct dc *dc;
+	struct dce_hwseq *hws;
 	bool enable;
 };
 
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer_private.h +1 -1
index 9586029dcec1..b2e63363066f 100644
@@ -225,7 +225,7 @@ struct hwseq_private_funcs {
 			struct hubp *primary_hubp);
 	void (*wait_for_pipe_update_if_needed)(struct dc *dc, struct pipe_ctx *pipe_ctx, bool is_surface_update_only);
 	void (*set_wait_for_update_needed_for_pipe)(struct dc *dc, struct pipe_ctx *pipe_ctx);
-	void (*dc_ip_request_cntl)(struct dc *dc, bool enable);
+	void (*dc_ip_request_cntl)(struct dce_hwseq *hws, bool enable);
 	void (*program_cm_hist)(struct dc *dc,
 		struct pipe_ctx *pipe_ctx,
 		const struct dc_plane_state *plane_state);
Signature · 1 line
2.43.0
#2 lore raw

PATCH 2/19 drm/amd/display: Fix rotate 90 degrees surface corruption issue

In reply to [email protected]

From: Charlene Liu <[email protected]>

[Why&How]
Incorrect dcc_control mode causes visual corruption in vertical mode.

For vertical scan with req128_vert_wc clear, use dcc_control__256_64_64 when the vertical segment order is non-contiguous and dcc_control__256_256_xxx otherwise.

---
 .../gpu/drm/amd/display/dc/hubbub/dcn31/dcn31_hubbub.c   | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/hubbub/dcn31/dcn31_hubbub.c +6 -3
index 8dd4b7b9ba36..786843362061 100644
@@ -838,9 +838,12 @@ static bool hubbub31_get_dcc_compression_cap(struct hubbub *hubbub,
 		else
 			dcc_control = dcc_control__256_64_64;
 	} else if (input->scan == SCAN_DIRECTION_VERTICAL) {
-		if (!req128_vert_wc)
-			dcc_control = dcc_control__256_256_xxx;
-		else if (segment_order_vert == segment_order__contiguous)
+		if (!req128_vert_wc) {
+			if (segment_order_vert == segment_order__non_contiguous)
+				dcc_control = dcc_control__256_64_64;
+			else
+				dcc_control = dcc_control__256_256_xxx;
+		} else if (segment_order_vert == segment_order__contiguous)
 			dcc_control = dcc_control__128_128_xxx;
 		else
 			dcc_control = dcc_control__256_64_64;
Signature · 1 line
2.43.0
#3 lore raw

PATCH 3/19 drm/amd/display: HWSS Refactor - DPP root clock control

In reply to [email protected]

From: Rafal Ostrowski <[email protected]>

[WHY]
DPP_ROOT_CLOCK_CONTROL carried a dce_hwseq handle and re-evaluated dc->debug in the executor, mixing build-time policy with execution. DCCG DPP root clock gating also read dc->debug directly, so the policy lived in several layers and could diverge.

[HOW]
- Store struct dccg *dccg in struct dpp_root_clock_control_params. The executor calls dccg->funcs->dpp_root_clock_control on the captured instance without looking up dc or policy.
- Add is_dpp_root_clock_control_supported(root_clock_optimization_dpp, clock_on) to hwseq_private_funcs as a pure ASIC policy: DCN314 needs the optimization for both directions, DCN35/351/42 only for gating.
- Add hwss_is_dpp_root_clock_control_allowed() as the single qualification point for the BLS builder and legacy HWSS call-sites. Without an ASIC hook it applies the DCN35 rule. The hwseq dpp_root_clock_control wrappers become pass-through.
- The builder skips the step instead of emitting a no-op when the hwseq hook is absent or the policy rejects the direction.
- Add root_clock_optimization_dpp to struct dccg as a mirror of dc->debug.root_clock_optimization.bits.dpp. dc core syncs it for all ASICs after resource pool creation and before every init_hw, so DM overrides applied after dc_create are honored. DCCG35/42 no longer read dc->debug for the DPP bit; the RCG allow check moves from dccg35_set_dppclk_rcg to its callers.
- Validate builder and executor inputs, including physical DPP index bounds for harvested configurations.
- Update BLS/DCCG documentation, golden serialization, DML2.1 stub headers and unit tests in core, dccg and hwss.

---
 .../drm/amd/display/dc/core/dc_hw_sequencer.c | 61 ++++++++++++++++---
 .../amd/display/dc/dccg/dcn314/dcn314_dccg.c  |  4 +-
 .../amd/display/dc/dccg/dcn35/dcn35_dccg.c    | 21 ++++---
 .../amd/display/dc/dccg/dcn35/dcn35_dccg.h    |  3 +-
 .../amd/display/dc/dccg/dcn42/dcn42_dccg.c    |  2 +-
 .../amd/display/dc/hwss/dcn10/dcn10_hwseq.c   |  6 +-
 .../amd/display/dc/hwss/dcn20/dcn20_hwseq.c   |  3 +-
 .../amd/display/dc/hwss/dcn314/dcn314_hwseq.c | 12 ++--
 .../amd/display/dc/hwss/dcn314/dcn314_hwseq.h |  2 +
 .../amd/display/dc/hwss/dcn314/dcn314_init.c  |  1 +
 .../amd/display/dc/hwss/dcn35/dcn35_hwseq.c   | 17 ++++--
 .../amd/display/dc/hwss/dcn35/dcn35_hwseq.h   |  2 +
 .../amd/display/dc/hwss/dcn35/dcn35_init.c    |  1 +
 .../amd/display/dc/hwss/dcn351/dcn351_init.c  |  1 +
 .../amd/display/dc/hwss/dcn401/dcn401_hwseq.c |  3 +-
 .../amd/display/dc/hwss/dcn42/dcn42_hwseq.c   |  6 +-
 .../amd/display/dc/hwss/dcn42/dcn42_init.c    |  1 +
 .../drm/amd/display/dc/hwss/hw_sequencer.h    |  5 +-
 .../display/dc/hwss/hw_sequencer_private.h    |  3 +
 drivers/gpu/drm/amd/display/dc/inc/hw/dccg.h  |  6 +-
 20 files changed, 117 insertions(+), 43 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +51 -10
index 7b93f57aff85..430dc7a220ef 100644
@@ -4041,12 +4041,12 @@ void hwss_dpp_reset(union block_sequence_params *params)
 
 void hwss_dpp_root_clock_control(union block_sequence_params *params)
 {
-	struct dce_hwseq *hws = params->dpp_root_clock_control_params.hws;
+	struct dccg *dccg = params->dpp_root_clock_control_params.dccg;
 	unsigned int dpp_inst = params->dpp_root_clock_control_params.dpp_inst;
 	bool clock_on = params->dpp_root_clock_control_params.clock_on;
+	bool root_clock_optimization_dpp = params->dpp_root_clock_control_params.root_clock_optimization_dpp;
 
-	if (hws->funcs.dpp_root_clock_control)
-		hws->funcs.dpp_root_clock_control(hws, dpp_inst, clock_on);
+	dccg->funcs->dpp_root_clock_control(dccg, dpp_inst, clock_on, root_clock_optimization_dpp);
 }
 
 void hwss_dc_ip_request_cntl(union block_sequence_params *params)
@@ -5433,18 +5433,59 @@ void hwss_add_dccg_set_ref_dscclk(struct block_sequence_state *seq_state,
 	}
 }
 
+bool hwss_is_dpp_root_clock_control_allowed(struct dce_hwseq *hws, bool clock_on)
+{
+	bool root_clock_optimization_dpp;
+
+	if (!hws || !hws->ctx || !hws->ctx->dc)
+		return false;
+
+	root_clock_optimization_dpp = hws->ctx->dc->debug.root_clock_optimization.bits.dpp;
+
+	if (hws->funcs.is_dpp_root_clock_control_supported)
+		return hws->funcs.is_dpp_root_clock_control_supported(
+				root_clock_optimization_dpp, clock_on);
+
+	/* Without ASIC policy only gating depends on the optimization */
+	return root_clock_optimization_dpp || clock_on;
+}
+
 void hwss_add_dpp_root_clock_control(struct block_sequence_state *seq_state,
 		struct dce_hwseq *hws,
 		unsigned int dpp_inst,
 		bool clock_on)
 {
-	if (*seq_state->num_steps < MAX_HWSS_BLOCK_SEQUENCE_SIZE) {
-		seq_state->steps[*seq_state->num_steps].func = DPP_ROOT_CLOCK_CONTROL;
-		seq_state->steps[*seq_state->num_steps].params.dpp_root_clock_control_params.hws = hws;
-		seq_state->steps[*seq_state->num_steps].params.dpp_root_clock_control_params.dpp_inst = dpp_inst;
-		seq_state->steps[*seq_state->num_steps].params.dpp_root_clock_control_params.clock_on = clock_on;
-		(*seq_state->num_steps)++;
-	}
+	struct dc *dc;
+	struct dccg *dccg;
+
+	if (!seq_state || !seq_state->steps || !seq_state->num_steps ||
+			*seq_state->num_steps >= MAX_HWSS_BLOCK_SEQUENCE_SIZE)
+		return;
+
+	if (!hws || !hws->funcs.dpp_root_clock_control || !hws->ctx || !hws->ctx->dc)
+		return;
+
+	dc = hws->ctx->dc;
+
+	if (!dc->res_pool || !dc->res_pool->dccg)
+		return;
+
+	dccg = dc->res_pool->dccg;
+
+	if (!dccg->funcs || !dccg->funcs->dpp_root_clock_control ||
+			dpp_inst >= ARRAY_SIZE(dccg->dpp_clock_gated))
+		return;
+
+	if (!hwss_is_dpp_root_clock_control_allowed(hws, clock_on))
+		return;
+
+	seq_state->steps[*seq_state->num_steps].func = DPP_ROOT_CLOCK_CONTROL;
+	seq_state->steps[*seq_state->num_steps].params.dpp_root_clock_control_params.dccg = dccg;
+	seq_state->steps[*seq_state->num_steps].params.dpp_root_clock_control_params.dpp_inst = dpp_inst;
+	seq_state->steps[*seq_state->num_steps].params.dpp_root_clock_control_params.clock_on = clock_on;
+	seq_state->steps[*seq_state->num_steps].params.dpp_root_clock_control_params.root_clock_optimization_dpp =
+			dc->debug.root_clock_optimization.bits.dpp;
+	(*seq_state->num_steps)++;
 }
 
 void hwss_add_dpp_pg_control(struct block_sequence_state *seq_state,
drivers/gpu/drm/amd/display/dc/dccg/dcn314/dcn314_dccg.c +3 -1
index a71851779b37..7bfe7be2bc1f 100644
@@ -352,10 +352,12 @@ static void dccg314_set_valid_pixel_rate(
 static void dccg314_dpp_root_clock_control(
 		struct dccg *dccg,
 		unsigned int dpp_inst,
-		bool clock_on)
+		bool clock_on,
+		bool root_clock_optimization_dpp)
 {
 	struct dcn_dccg *dccg_dcn = TO_DCN_DCCG(dccg);
 
+	(void)root_clock_optimization_dpp;
 	if (dccg->dpp_clock_gated[dpp_inst] != clock_on)
 		return;
 
drivers/gpu/drm/amd/display/dc/dccg/dcn35/dcn35_dccg.c +12 -9
index ba624f442915..6dce2a4beca2 100644
@@ -395,9 +395,6 @@ static void dccg35_set_dppclk_rcg(struct dccg *dccg, int inst, bool allow_rcg)
 {
 	struct dcn_dccg *dccg_dcn = TO_DCN_DCCG(dccg);
 
-	if (!dccg->ctx->dc->debug.root_clock_optimization.bits.dpp && allow_rcg)
-		return;
-
 	switch (inst) {
 	case 0:
 		REG_UPDATE(DCCG_GATE_DISABLE_CNTL6, DPPCLK0_ROOT_GATE_DISABLE, allow_rcg ? 0 : 1);
@@ -1145,7 +1142,8 @@ static void dccg35_disable_dpp_clk_new(
 	REG_SET_2(DPPCLK_DTO_PARAM[inst], 0,
 			  DPPCLK0_DTO_PHASE, 0,
 			  DPPCLK0_DTO_MODULO, 1);
-	dccg35_set_dppclk_rcg(dccg, inst, true);
+	if (dccg->ctx->dc->debug.root_clock_optimization.bits.dpp)
+		dccg35_set_dppclk_rcg(dccg, inst, true);
 }
 
 static void dccg35_disable_dscclk_new(struct dccg *dccg,
@@ -1301,7 +1299,8 @@ void dccg35_update_dpp_dto(struct dccg *dccg, int dpp_inst, int req_dppclk)
 		dcn35_set_dppclk_enable(dccg, dpp_inst, true);
 	} else {
 		dcn35_set_dppclk_enable(dccg, dpp_inst, false);
-		dccg35_set_dppclk_rcg(dccg, dpp_inst, true);
+		if (dccg->ctx->dc->debug.root_clock_optimization.bits.dpp)
+			dccg35_set_dppclk_rcg(dccg, dpp_inst, true);
 	}
 	udelay(10);
 	dccg->pipe_dppclk_khz[dpp_inst] = req_dppclk;
@@ -1868,7 +1867,8 @@ static void dccg35_set_valid_pixel_rate(
 	dccg35_set_dtbclk_dto(dccg, &dto_params);
 }
 
-void dccg35_dpp_root_clock_control(struct dccg *dccg, unsigned int dpp_inst, bool clock_on)
+void dccg35_dpp_root_clock_control(struct dccg *dccg, unsigned int dpp_inst, bool clock_on,
+		bool root_clock_optimization_dpp)
 {
 	struct dcn_dccg *dccg_dcn = TO_DCN_DCCG(dccg);
 
@@ -1890,7 +1890,8 @@ void dccg35_dpp_root_clock_control(struct dccg *dccg, unsigned int dpp_inst, boo
 			  DPPCLK0_DTO_PHASE, 0,
 			  DPPCLK0_DTO_MODULO, 1);
 		/*we have this in hwss: disable_plane*/
-		dccg35_set_dppclk_rcg(dccg, dpp_inst, true);
+		if (root_clock_optimization_dpp)
+			dccg35_set_dppclk_rcg(dccg, dpp_inst, true);
 	}
 
 	// wait for clock to fully ramp
@@ -2505,7 +2506,8 @@ static void dccg35_update_dpp_dto_cb(struct dccg *dccg, int dpp_inst,
 static void dccg35_dpp_root_clock_control_cb(
 	struct dccg *dccg,
 	unsigned int dpp_inst,
-	bool power_on)
+	bool power_on,
+	bool root_clock_optimization_dpp)
 {
 	if (dccg->dpp_clock_gated[dpp_inst] == power_on)
 		return;
@@ -2514,7 +2516,8 @@ static void dccg35_dpp_root_clock_control_cb(
 	 * Since clock source is not passed restore to refclock on ungate
 	 * Redundant as gating when enabled is acheived through update_dpp_dto
 	 */
-	dccg35_set_dppclk_rcg(dccg, dpp_inst, !power_on);
+	if (power_on || root_clock_optimization_dpp)
+		dccg35_set_dppclk_rcg(dccg, dpp_inst, !power_on);
 
 	dccg->dpp_clock_gated[dpp_inst] = !power_on;
 }
drivers/gpu/drm/amd/display/dc/dccg/dcn35/dcn35_dccg.h +2 -1
index 58f4c1e998b3..7dbb0c90d352 100644
@@ -260,7 +260,8 @@ void dccg35_set_dpstreamclk_root_clock_gating(struct dccg *dccg, int dp_hpo_inst
 
 void dccg35_set_hdmistreamclk_root_clock_gating(struct dccg *dccg, bool enable);
 
-void dccg35_dpp_root_clock_control(struct dccg *dccg, unsigned int dpp_inst, bool clock_on);
+void dccg35_dpp_root_clock_control(struct dccg *dccg, unsigned int dpp_inst, bool clock_on,
+		bool root_clock_optimization_dpp);
 
 void dccg35_disable_symclk32_se(struct dccg *dccg, int hpo_se_inst);
 
drivers/gpu/drm/amd/display/dc/dccg/dcn42/dcn42_dccg.c +1 -1
index cf6fffc2b26e..96c01ddeed61 100644
@@ -304,7 +304,7 @@ static void dccg42_init(struct dccg *dccg)
 
 	if (dccg->ctx->dc->debug.root_clock_optimization.bits.dpp) {
 		for (i = 0; i < res_pool->pipe_count; i++) {
-			dccg35_dpp_root_clock_control(dccg, i, true);
+			dccg35_dpp_root_clock_control(dccg, i, true, true);
 		}
 	}
 }
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c +4 -2
index 771555ec1431..c42e493720bc 100644
@@ -1059,7 +1059,8 @@ static void power_on_plane_resources(
 {
 	DC_LOGGER_INIT(hws->ctx);
 
-	if (hws->funcs.dpp_root_clock_control)
+	if (hws->funcs.dpp_root_clock_control &&
+	    hwss_is_dpp_root_clock_control_allowed(hws, true))
 		hws->funcs.dpp_root_clock_control(hws, plane_id, true);
 
 	if (REG(DC_IP_REQUEST_CNTL)) {
@@ -1566,7 +1567,8 @@ void dcn10_plane_atomic_power_down(struct dc *dc,
 				"Power gated front end %d\n", hubp->inst);
 	}
 
-	if (hws->funcs.dpp_root_clock_control)
+	if (hws->funcs.dpp_root_clock_control &&
+	    hwss_is_dpp_root_clock_control_allowed(hws, false))
 		hws->funcs.dpp_root_clock_control(hws, dpp->inst, false);
 }
 
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c +2 -1
index e8b9495c799f..27b886e78998 100644
@@ -1303,7 +1303,8 @@ static void dcn20_power_on_plane_resources(
 
 	DC_LOGGER_INIT(hws->ctx->logger);
 
-	if (hws->funcs.dpp_root_clock_control)
+	if (hws->funcs.dpp_root_clock_control &&
+	    hwss_is_dpp_root_clock_control_allowed(hws, true))
 		hws->funcs.dpp_root_clock_control(hws, pipe_ctx->plane_res.dpp->inst, true);
 
 	if (REG(DC_IP_REQUEST_CNTL)) {
drivers/gpu/drm/amd/display/dc/hwss/dcn314/dcn314_hwseq.c +8 -4
index 93d8483d6f80..583007c1fee3 100644
@@ -465,14 +465,18 @@ void dcn314_resync_fifo_dccg_dio(struct dce_hwseq *hws, struct dc *dc, struct dc
 	}
 }
 
-void dcn314_dpp_root_clock_control(struct dce_hwseq *hws, unsigned int dpp_inst, bool clock_on)
+bool dcn314_is_dpp_root_clock_control_supported(bool root_clock_optimization_dpp, bool clock_on)
 {
-	if (!hws->ctx->dc->debug.root_clock_optimization.bits.dpp)
-		return;
+	(void)clock_on;
+	return root_clock_optimization_dpp;
+}
 
+void dcn314_dpp_root_clock_control(struct dce_hwseq *hws, unsigned int dpp_inst, bool clock_on)
+{
 	if (hws->ctx->dc->res_pool->dccg->funcs->dpp_root_clock_control)
 		hws->ctx->dc->res_pool->dccg->funcs->dpp_root_clock_control(
-			hws->ctx->dc->res_pool->dccg, dpp_inst, clock_on);
+			hws->ctx->dc->res_pool->dccg, dpp_inst, clock_on,
+			hws->ctx->dc->debug.root_clock_optimization.bits.dpp);
 }
 
 static void apply_symclk_on_tx_off_wa(struct dc_link *link)
drivers/gpu/drm/amd/display/dc/hwss/dcn314/dcn314_hwseq.h +2 -0
index 6c072d0274ea..e33237fb74be 100644
@@ -45,6 +45,8 @@ void dcn314_resync_fifo_dccg_dio(struct dce_hwseq *hws, struct dc *dc, struct dc
 
 void dcn314_dpp_root_clock_control(struct dce_hwseq *hws, unsigned int dpp_inst, bool clock_on);
 
+bool dcn314_is_dpp_root_clock_control_supported(bool root_clock_optimization_dpp, bool clock_on);
+
 void dcn314_disable_link_output(struct dc_link *link, const struct link_resource *link_res, enum signal_type signal);
 
 void dcn314_dpp_pg_control(struct dce_hwseq *hws, unsigned int dpp_inst, bool power_on);
drivers/gpu/drm/amd/display/dc/hwss/dcn314/dcn314_init.c +1 -0
index 2b04598b0935..69b020e2c4b2 100644
@@ -145,6 +145,7 @@ static const struct hwseq_private_funcs dcn314_private_funcs = {
 	.plane_atomic_power_down = dcn10_plane_atomic_power_down,
 	.enable_power_gating_plane = dcn314_enable_power_gating_plane,
 	.dpp_root_clock_control = dcn314_dpp_root_clock_control,
+	.is_dpp_root_clock_control_supported = dcn314_is_dpp_root_clock_control_supported,
 	.hubp_pg_control = dcn31_hubp_pg_control,
 	.dpp_pg_control = dcn314_dpp_pg_control,
 	.program_all_writeback_pipes_in_tree = dcn30_program_all_writeback_pipes_in_tree,
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c +11 -6
index 23c09801f12f..fbf4d0f95c5c 100644
@@ -496,14 +496,17 @@ void dcn35_update_odm(struct dc *dc, struct dc_state *context, struct pipe_ctx *
 	}
 }
 
-void dcn35_dpp_root_clock_control(struct dce_hwseq *hws, unsigned int dpp_inst, bool clock_on)
+bool dcn35_is_dpp_root_clock_control_supported(bool root_clock_optimization_dpp, bool clock_on)
 {
-	if (!hws->ctx->dc->debug.root_clock_optimization.bits.dpp && !clock_on)
-		return;
+	return root_clock_optimization_dpp || clock_on;
+}
 
+void dcn35_dpp_root_clock_control(struct dce_hwseq *hws, unsigned int dpp_inst, bool clock_on)
+{
 	if (hws->ctx->dc->res_pool->dccg->funcs->dpp_root_clock_control) {
 		hws->ctx->dc->res_pool->dccg->funcs->dpp_root_clock_control(
-			hws->ctx->dc->res_pool->dccg, dpp_inst, clock_on);
+			hws->ctx->dc->res_pool->dccg, dpp_inst, clock_on,
+			hws->ctx->dc->debug.root_clock_optimization.bits.dpp);
 	}
 }
 
@@ -1365,7 +1368,8 @@ void dcn35_root_clock_control(struct dc *dc,
 		for (i = 0; i < dc->res_pool->pipe_count; i++) {
 			if (update_state->pg_pipe_res_update[PG_HUBP][i] &&
 				update_state->pg_pipe_res_update[PG_DPP][i]) {
-				if (dc->hwseq->funcs.dpp_root_clock_control)
+				if (dc->hwseq->funcs.dpp_root_clock_control &&
+				    hwss_is_dpp_root_clock_control_allowed(dc->hwseq, power_on))
 					dc->hwseq->funcs.dpp_root_clock_control(dc->hwseq, i, power_on);
 			}
 			if (update_state->pg_pipe_res_update[PG_DPSTREAM][i])
@@ -1398,7 +1402,8 @@ void dcn35_root_clock_control(struct dc *dc,
 		for (i = 0; i < dc->res_pool->pipe_count; i++) {
 			if (update_state->pg_pipe_res_update[PG_HUBP][i] &&
 				update_state->pg_pipe_res_update[PG_DPP][i]) {
-				if (dc->hwseq->funcs.dpp_root_clock_control)
+				if (dc->hwseq->funcs.dpp_root_clock_control &&
+				    hwss_is_dpp_root_clock_control_allowed(dc->hwseq, power_on))
 					dc->hwseq->funcs.dpp_root_clock_control(dc->hwseq, i, power_on);
 			}
 			if (update_state->pg_pipe_res_update[PG_DPSTREAM][i])
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.h +2 -0
index 96b836b2ae71..0ae2f44cfb9f 100644
@@ -39,6 +39,8 @@ void dcn35_dsc_pg_control(struct dce_hwseq *hws, unsigned int dsc_inst, bool pow
 
 void dcn35_dpp_root_clock_control(struct dce_hwseq *hws, unsigned int dpp_inst, bool clock_on);
 
+bool dcn35_is_dpp_root_clock_control_supported(bool root_clock_optimization_dpp, bool clock_on);
+
 void dcn35_dpstream_root_clock_control(struct dce_hwseq *hws, unsigned int dp_hpo_inst, bool clock_on);
 
 void dcn35_hdmistream_root_clock_control(struct dce_hwseq *hws, bool clock_on);
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_init.c +1 -0
index f8c8ab12bdf9..2119a8e000e9 100644
@@ -163,6 +163,7 @@ static const struct hwseq_private_funcs dcn35_private_funcs = {
 	//.plane_atomic_disable = dcn20_plane_atomic_disable,/*todo*/
 	//.hubp_pg_control = dcn35_hubp_pg_control,
 	.dpp_root_clock_control = dcn35_dpp_root_clock_control,
+	.is_dpp_root_clock_control_supported = dcn35_is_dpp_root_clock_control_supported,
 	.dpstream_root_clock_control = dcn35_dpstream_root_clock_control,
 	.hdmistream_root_clock_control = dcn35_hdmistream_root_clock_control,
 	.physymclk_root_clock_control = dcn35_physymclk_root_clock_control,
drivers/gpu/drm/amd/display/dc/hwss/dcn351/dcn351_init.c +1 -0
index 82a8d87f9428..0e148c6e5c50 100644
@@ -152,6 +152,7 @@ static const struct hwseq_private_funcs dcn351_private_funcs = {
 	//.plane_atomic_disable = dcn20_plane_atomic_disable,/*todo*/
 	//.hubp_pg_control = dcn35_hubp_pg_control,
 	.dpp_root_clock_control = dcn35_dpp_root_clock_control,
+	.is_dpp_root_clock_control_supported = dcn35_is_dpp_root_clock_control_supported,
 	.dpstream_root_clock_control = dcn35_dpstream_root_clock_control,
 	.hdmistream_root_clock_control = dcn35_hdmistream_root_clock_control,
 	.physymclk_root_clock_control = dcn35_physymclk_root_clock_control,
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c +2 -1
index efff09784f45..d237061236af 100644
@@ -3130,7 +3130,8 @@ void dcn401_plane_atomic_power_down(struct dc *dc,
 	DC_LOG_DEBUG(
 			"Power gated front end %d\n", hubp->inst);
 
-	if (hws->funcs.dpp_root_clock_control)
+	if (hws->funcs.dpp_root_clock_control &&
+	    hwss_is_dpp_root_clock_control_allowed(hws, false))
 		hws->funcs.dpp_root_clock_control(hws, dpp->inst, false);
 }
 
drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_hwseq.c +4 -2
index 34bfe62296e6..b1cc09df5e63 100644
@@ -1117,7 +1117,8 @@ void dcn42_root_clock_control(struct dc *dc,
 		for (i = 0; i < dc->res_pool->pipe_count; i++) {
 			if (update_state->pg_pipe_res_update[PG_HUBP][i] &&
 				update_state->pg_pipe_res_update[PG_DPP][i]) {
-				if (dc->hwseq->funcs.dpp_root_clock_control)
+				if (dc->hwseq->funcs.dpp_root_clock_control &&
+				    hwss_is_dpp_root_clock_control_allowed(dc->hwseq, power_on))
 					dc->hwseq->funcs.dpp_root_clock_control(dc->hwseq, i, power_on);
 			}
 			if (update_state->pg_pipe_res_update[PG_DPSTREAM][i])
@@ -1150,7 +1151,8 @@ void dcn42_root_clock_control(struct dc *dc,
 		for (i = 0; i < dc->res_pool->pipe_count; i++) {
 			if (update_state->pg_pipe_res_update[PG_HUBP][i] &&
 				update_state->pg_pipe_res_update[PG_DPP][i]) {
-				if (dc->hwseq->funcs.dpp_root_clock_control)
+				if (dc->hwseq->funcs.dpp_root_clock_control &&
+				    hwss_is_dpp_root_clock_control_allowed(dc->hwseq, power_on))
 					dc->hwseq->funcs.dpp_root_clock_control(dc->hwseq, i, power_on);
 			}
 			if (update_state->pg_pipe_res_update[PG_DPSTREAM][i])
drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_init.c +1 -0
index 775da50e945e..6711283afcd7 100644
@@ -163,6 +163,7 @@ static const struct hwseq_private_funcs dcn42_private_funcs = {
 	.reset_back_end_for_pipe = dcn401_reset_back_end_for_pipe,
 	.program_cm_hist = dcn42_program_cm_hist,
 	.dpp_root_clock_control = dcn35_dpp_root_clock_control,
+	.is_dpp_root_clock_control_supported = dcn35_is_dpp_root_clock_control_supported,
 	.dpstream_root_clock_control = dcn35_dpstream_root_clock_control,
 	.hdmistream_root_clock_control = dcn35_hdmistream_root_clock_control,
 	.physymclk_root_clock_control = dcn35_physymclk_root_clock_control,
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h +4 -1
index bd005aaf9317..7e7054608d74 100644
@@ -705,9 +705,10 @@ struct dpp_reset_params {
 };
 
 struct dpp_root_clock_control_params {
-	struct dce_hwseq *hws;
+	struct dccg *dccg;
 	unsigned int dpp_inst;
 	bool clock_on;
+	bool root_clock_optimization_dpp;
 };
 
 struct dc_ip_request_cntl_params {
@@ -2455,6 +2456,8 @@ void hwss_add_dccg_set_ref_dscclk(struct block_sequence_state *seq_state,
 		int dsc_inst,
 		bool *is_ungated);
 
+bool hwss_is_dpp_root_clock_control_allowed(struct dce_hwseq *hws, bool clock_on);
+
 void hwss_add_dpp_root_clock_control(struct block_sequence_state *seq_state,
 		struct dce_hwseq *hws,
 		unsigned int dpp_inst,
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer_private.h +3 -0
index b2e63363066f..9c5e9abf5a95 100644
@@ -135,6 +135,9 @@ struct hwseq_private_funcs {
 			struct dce_hwseq *hws,
 			unsigned int dpp_inst,
 			bool clock_on);
+	bool (*is_dpp_root_clock_control_supported)(
+			bool root_clock_optimization_dpp,
+			bool clock_on);
 	void (*dpstream_root_clock_control)(
 			struct dce_hwseq *hws,
 			unsigned int dpp_inst,
drivers/gpu/drm/amd/display/dc/inc/hw/dccg.h +2 -4
index 1fe703e866fc..8538b16c9748 100644
@@ -314,10 +314,8 @@ struct dccg_funcs {
 	void (*trigger_dio_fifo_resync)(
 			struct dccg *dccg);
 
-	void (*dpp_root_clock_control)(
-			struct dccg *dccg,
-			unsigned int dpp_inst,
-			bool clock_on);
+	void (*dpp_root_clock_control)(struct dccg *dccg, unsigned int dpp_inst, bool clock_on,
+			bool root_clock_optimization_dpp);
 
 	void (*enable_symclk_se)(
 			struct dccg *dccg,
Signature · 1 line
2.43.0
#4 lore raw

PATCH 4/19 drm/amd/display: Fix upsampling for linear scaling of subsampled YUV

In reply to [email protected]

From: Sridevi Arvindekar <[email protected]>

[Why]
When a subsampled YUV surface is scaled in linear space, the chroma planes are interpolated before being upsampled to 4:4:4, producing incorrect chroma on the scaled output.

[How]
Enable the CNVC chroma upsampler for these cases:
- resource_is_upsp_required() selects the mode from the surface format
- DPP programs the pre-CSC matrix
- DCN60 programs the CNVC_UPSP coefficients
- SPL and DSCL treat a pipe with upsp enabled as 4:4:4 RGB

---
 drivers/gpu/drm/amd/display/dc/Makefile       |  1 +
 .../drm/amd/display/dc/core/dc_hw_sequencer.c |  4 +-
 .../gpu/drm/amd/display/dc/core/dc_resource.c | 19 -----
 .../amd/display/dc/core/dc_resource_helper.c  | 46 +++++++++++
 .../gpu/drm/amd/display/dc/dc_spl_translate.c | 22 ++++--
 .../drm/amd/display/dc/dpp/dcn10/dcn10_dpp.c  |  4 +-
 .../drm/amd/display/dc/dpp/dcn10/dcn10_dpp.h  |  3 +-
 .../drm/amd/display/dc/dpp/dcn20/dcn20_dpp.c  |  4 +-
 .../amd/display/dc/dpp/dcn201/dcn201_dpp.c    |  4 +-
 .../drm/amd/display/dc/dpp/dcn30/dcn30_dpp.c  | 76 ++++++++++++++++++-
 .../drm/amd/display/dc/dpp/dcn30/dcn30_dpp.h  |  9 ++-
 .../amd/display/dc/dpp/dcn401/dcn401_dpp.c    |  4 +-
 .../amd/display/dc/dpp/dcn401/dcn401_dpp.h    |  3 +-
 .../display/dc/dpp/dcn401/dcn401_dpp_dscl.c   |  8 +-
 .../drm/amd/display/dc/dpp/dcn42/dcn42_dpp.c  |  4 +-
 .../drm/amd/display/dc/dpp/dcn50/dcn50_dpp.c  |  4 +-
 .../drm/amd/display/dc/dpp/dcn50/dcn50_dpp.h  |  3 +-
 .../drm/amd/display/dc/dpp/dcn60/dcn60_dpp.c  | 38 ++++++++--
 .../drm/amd/display/dc/dpp/dcn60/dcn60_dpp.h  | 15 ++--
 .../amd/display/dc/dpp/dcn60/dcn60_dpp_dscl.c | 13 ++--
 .../amd/display/dc/hwss/dcn10/dcn10_hwseq.c   |  3 +-
 .../amd/display/dc/hwss/dcn20/dcn20_hwseq.c   |  3 +-
 .../amd/display/dc/hwss/dcn50/dcn50_hwseq.c   |  3 +-
 .../drm/amd/display/dc/hwss/hw_sequencer.h    |  1 +
 drivers/gpu/drm/amd/display/dc/inc/hw/dpp.h   |  3 +-
 .../dc/resource/dcn60/dcn60_resource.h        |  6 ++
 26 files changed, 237 insertions(+), 66 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/display/dc/core/dc_resource_helper.c
drivers/gpu/drm/amd/display/dc/Makefile +1 -0
index f868999515dd..1cbf284bb2fd 100644
@@ -75,6 +75,7 @@ FILES += core/dc_hw_sequencer.o
 FILES += core/dc_link_enc_cfg.o
 FILES += core/dc_link_exports.o
 FILES += core/dc_resource.o
+FILES += core/dc_resource_helper.o
 FILES += core/dc_sink.o
 FILES += core/dc_stat.o
 FILES += core/dc_state.o
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +3 -1
index 430dc7a220ef..f881a3be6f0a 100644
@@ -2964,7 +2964,8 @@ void hwss_setup_dpp(union block_sequence_params *params)
 				EXPANSION_MODE_ZERO,
 				p->input_csc_color_matrix,
 				p->color_space,
-				NULL);
+				NULL,
+				p->upsp_mode);
 	}
 }
 
@@ -5722,6 +5723,7 @@ void hwss_add_dpp_setup_dpp(struct block_sequence_state *seq_state,
 		p->format = plane_state->format;
 		p->input_csc_color_matrix = plane_state->input_csc_color_matrix;
 		p->color_space = plane_state->color_space;
+		p->upsp_mode = resource_is_upsp_required(plane_state->format, plane_state->scaling_linearity);
 		(*seq_state->num_steps)++;
 	}
 }
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +0 -19
index 187486d978da..fa44c68b3340 100644
@@ -1557,25 +1557,6 @@ void resource_build_test_pattern_params(struct resource_context *res_ctx,
 	}
 }
 
-enum upsp_mode resource_is_upsp_required(enum surface_pixel_format format,
-		enum dc_scaling_linearity scaling_linearity)
-{
-	bool scaling_in_linear = (scaling_linearity == DC_SCALING_LINEARITY_LINEAR);
-	bool is_420_format = (format >= SURFACE_PIXEL_FORMAT_VIDEO_BEGIN &&
-			format <= SURFACE_PIXEL_FORMAT_VIDEO_420_10bpc_YCrCb);
-	bool is_422_format = (format > SURFACE_PIXEL_FORMAT_VIDEO_420_10bpc_YCrCb &&
-			format < SURFACE_PIXEL_FORMAT_SUBSAMPLE_END);
-
-	/* UPSP (chroma upsampling) is only needed when subsampled YUV is scaled in
-	 * linear space.
-	 */
-	if (scaling_in_linear && is_420_format)
-		return UPSP_HORIZONTAL_VERTICAL_UPSAMPLING;
-	if (scaling_in_linear && is_422_format)
-		return UPSP_HORIZONTAL_UPSAMPLING_ONLY;
-	return UPSP_BYPASS;
-}
-
 bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx)
 {
 	const struct dc_plane_state *plane_state = pipe_ctx->plane_state;
drivers/gpu/drm/amd/display/dc/core/dc_resource_helper.c new file +46 -0

46 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dc_spl_translate.c +14 -8
index 76c0d62031b6..00e121bb8ef7 100644
@@ -209,21 +209,27 @@ void translate_SPL_in_params_from_pipe_ctx(struct pipe_ctx *pipe_ctx, struct spl
 		}
 	}
 	// Translate linear light scaling preference
-	if (pipe_ctx->stream->ctx->dc->debug.force_lls > 0)
+	if (pipe_ctx->stream->ctx->dc->debug.force_lls > 0) {
 		spl_in->lls_pref = pipe_ctx->stream->ctx->dc->debug.force_lls;
-	else
+		spl_in->upsp_mode = pipe_ctx->plane_res.scl_data.upsp;
+	} else {
 		if ((plane_state->ctx->dce_version == DCN_VERSION_4_01) ||
 			(plane_state->ctx->dce_version == DCN_VERSION_4_2) ||
-			(plane_state->ctx->dce_version == DCN_VERSION_4_2B))
+			(plane_state->ctx->dce_version == DCN_VERSION_4_2B)) {
 			spl_in->lls_pref = LLS_PREF_DONT_CARE;
-		else
+			spl_in->upsp_mode = UPSP_BYPASS;
+		} else {
 			set_linear_light_scaling_preference(plane_state, spl_in);
-	/* Translate upsampling mode*/
-	spl_in->upsp_mode = pipe_ctx->plane_res.scl_data.upsp;
+			/* Translate upsampling mode*/
+			spl_in->upsp_mode = pipe_ctx->plane_res.scl_data.upsp;
+		}
+	}
 	/* Translate chroma subsampling offset ( cositing ) */
-	if (pipe_ctx->stream->ctx->dc->debug.force_cositing)
+	if (pipe_ctx->stream->ctx->dc->debug.force_cositing) {
 		spl_in->basic_in.cositing = pipe_ctx->stream->ctx->dc->debug.force_cositing - 1;
-	else
+		if (spl_in->upsp_mode && spl_in->basic_in.cositing == CHROMA_COSITING_NONE)
+			spl_in->basic_in.cositing = CHROMA_COSITING_TOPLEFT;
+	} else
 		spl_in->basic_in.cositing = plane_state->cositing;
 	/* Translate transfer function */
 	spl_in->basic_in.tf_type = (enum spl_transfer_func_type) plane_state->in_transfer_func.type;
drivers/gpu/drm/amd/display/dc/dpp/dcn10/dcn10_dpp.c +3 -1
index ef605e0a75e3..de420cdf1514 100644
@@ -286,9 +286,11 @@ void dpp1_cnv_setup (
 		enum expansion_mode mode,
 		struct dc_csc_transform input_csc_color_matrix,
 		enum dc_color_space input_color_space,
-		struct cnv_alpha_2bit_lut *alpha_2bit_lut)
+		struct cnv_alpha_2bit_lut *alpha_2bit_lut,
+		enum upsp_mode upsp_mode)
 {
 	(void)alpha_2bit_lut;
+	(void)upsp_mode;
 	uint32_t pixel_format;
 	uint32_t alpha_en;
 	enum pixel_format_description fmt ;
drivers/gpu/drm/amd/display/dc/dpp/dcn10/dcn10_dpp.h +2 -1
index 890d04b1ddaf..b04d5fa2cd32 100644
@@ -1501,7 +1501,8 @@ void dpp1_cnv_setup (
 		enum expansion_mode mode,
 		struct dc_csc_transform input_csc_color_matrix,
 		enum dc_color_space input_color_space,
-		struct cnv_alpha_2bit_lut *alpha_2bit_lut);
+		struct cnv_alpha_2bit_lut *alpha_2bit_lut,
+		enum upsp_mode upsp_mode);
 
 void dpp1_dppclk_control(
 		struct dpp *dpp_base,
drivers/gpu/drm/amd/display/dc/dpp/dcn20/dcn20_dpp.c +3 -1
index 8d5000790904..0f3b1717563b 100644
@@ -103,8 +103,10 @@ static void dpp2_cnv_setup (
 		enum expansion_mode mode,
 		struct dc_csc_transform input_csc_color_matrix,
 		enum dc_color_space input_color_space,
-		struct cnv_alpha_2bit_lut *alpha_2bit_lut)
+		struct cnv_alpha_2bit_lut *alpha_2bit_lut,
+		enum upsp_mode upsp_mode)
 {
+	(void)upsp_mode;
 	struct dcn20_dpp *dpp = TO_DCN20_DPP(dpp_base);
 	uint32_t pixel_format = 0;
 	uint32_t alpha_en = 1;
drivers/gpu/drm/amd/display/dc/dpp/dcn201/dcn201_dpp.c +3 -1
index d78ab3ffd95d..a2079db62f63 100644
@@ -47,8 +47,10 @@ static void dpp201_cnv_setup(
 		enum expansion_mode mode,
 		struct dc_csc_transform input_csc_color_matrix,
 		enum dc_color_space input_color_space,
-		struct cnv_alpha_2bit_lut *alpha_2bit_lut)
+		struct cnv_alpha_2bit_lut *alpha_2bit_lut,
+		enum upsp_mode upsp_mode)
 {
+	(void)upsp_mode;
 	struct dcn201_dpp *dpp = TO_DCN201_DPP(dpp_base);
 	uint32_t pixel_format = 0;
 	uint32_t alpha_en = 1;
drivers/gpu/drm/amd/display/dc/dpp/dcn30/dcn30_dpp.c +75 -1

89 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dpp/dcn30/dcn30_dpp.h +8 -1
index f397e8222ac9..349a1b9ee916 100644
@@ -629,7 +629,8 @@ void dpp3_cnv_setup(
 		enum expansion_mode mode,
 		struct dc_csc_transform input_csc_color_matrix,
 		enum dc_color_space input_color_space,
-		struct cnv_alpha_2bit_lut *alpha_2bit_lut);
+		struct cnv_alpha_2bit_lut *alpha_2bit_lut,
+		enum upsp_mode upsp_mode);
 
 void dpp3_program_CM_bias(
 		struct dpp *dpp_base,
@@ -650,6 +651,12 @@ void dpp3_set_cursor_attributes(
 		struct dpp *dpp_base,
 		struct dc_cursor_attributes *cursor_attributes);
 
+void dpp3_program_pre_csc(
+		struct dpp *dpp_base,
+		enum dc_color_space color_space,
+		enum dcn10_input_csc_select input_select,
+		const struct out_csc_color_matrix *tbl_entry);
+
 void dpp3_program_post_csc(
 		struct dpp *dpp_base,
 		enum dc_color_space color_space,
drivers/gpu/drm/amd/display/dc/dpp/dcn401/dcn401_dpp.c +3 -1
index 8e0fa7be34ee..7a3a7678c71a 100644
@@ -58,8 +58,10 @@ void dpp401_dpp_setup(
 	enum expansion_mode mode,
 	struct dc_csc_transform input_csc_color_matrix,
 	enum dc_color_space input_color_space,
-	struct cnv_alpha_2bit_lut *alpha_2bit_lut)
+	struct cnv_alpha_2bit_lut *alpha_2bit_lut,
+	enum upsp_mode upsp_mode)
 {
+	(void)upsp_mode;
 	struct dcn401_dpp *dpp = TO_DCN401_DPP(dpp_base);
 	uint32_t pixel_format = 0;
 	uint32_t alpha_en = 1;
drivers/gpu/drm/amd/display/dc/dpp/dcn401/dcn401_dpp.h +2 -1
index e34d291de37b..f1530e8805cb 100644
@@ -712,7 +712,8 @@ void dpp401_dpp_setup(
 	enum expansion_mode mode,
 	struct dc_csc_transform input_csc_color_matrix,
 	enum dc_color_space input_color_space,
-	struct cnv_alpha_2bit_lut *alpha_2bit_lut);
+	struct cnv_alpha_2bit_lut *alpha_2bit_lut,
+	enum upsp_mode upsp_mode);
 
 void dpp401_set_cursor_attributes(
 	struct dpp *dpp_base,
drivers/gpu/drm/amd/display/dc/dpp/dcn401/dcn401_dpp_dscl.c +5 -3
index 81f287c89562..6e85890e44f7 100644
@@ -478,8 +478,9 @@ enum lb_memory_config dpp401_dscl_find_lb_memory_config(struct dcn401_dpp *dpp,
 	int ceil_vratio_c = dc_fixpt_ceil(scl_data->ratios.vert_c);
 
 	if (dpp->base.ctx->dc->debug.use_max_lb) {
-		if (scl_data->format == PIXEL_FORMAT_420BPP8
+		if ((scl_data->format == PIXEL_FORMAT_420BPP8
 				|| scl_data->format == PIXEL_FORMAT_420BPP10)
+				&& !scl_data->upsp)
 			return LB_MEMORY_CONFIG_3;
 		return LB_MEMORY_CONFIG_0;
 	}
@@ -498,8 +499,9 @@ enum lb_memory_config dpp401_dscl_find_lb_memory_config(struct dcn401_dpp *dpp,
 			&& dpp401_dscl_is_lb_conf_valid(ceil_vratio_c, num_part_c, vtaps_c))
 		return LB_MEMORY_CONFIG_2;
 
-	if (scl_data->format == PIXEL_FORMAT_420BPP8
-			|| scl_data->format == PIXEL_FORMAT_420BPP10) {
+	if ((scl_data->format == PIXEL_FORMAT_420BPP8
+			|| scl_data->format == PIXEL_FORMAT_420BPP10)
+			&& !scl_data->upsp) {
 		dpp->base.caps->dscl_calc_lb_num_partitions(
 				scl_data, LB_MEMORY_CONFIG_3, &num_part_y, &num_part_c);
 
drivers/gpu/drm/amd/display/dc/dpp/dcn42/dcn42_dpp.c +3 -1
index eed86f5ae731..2ce0694e3725 100644
@@ -118,8 +118,10 @@ static void dpp42_dpp_setup(
 	enum expansion_mode mode,
 	struct dc_csc_transform input_csc_color_matrix,
 	enum dc_color_space input_color_space,
-	struct cnv_alpha_2bit_lut *alpha_2bit_lut)
+	struct cnv_alpha_2bit_lut *alpha_2bit_lut,
+	enum upsp_mode upsp_mode)
 {
+	(void)upsp_mode;
 	struct dcn401_dpp *dpp = TO_DCN401_DPP(dpp_base);
 	uint32_t pixel_format = 0;
 	uint32_t alpha_en = 1;
drivers/gpu/drm/amd/display/dc/dpp/dcn50/dcn50_dpp.c +3 -1
index 38739ed048fa..5382fc656169 100644
@@ -90,8 +90,10 @@ void dpp50_dpp_setup(
 	enum expansion_mode mode,
 	struct dc_csc_transform input_csc_color_matrix,
 	enum dc_color_space input_color_space,
-	struct cnv_alpha_2bit_lut *alpha_2bit_lut)
+	struct cnv_alpha_2bit_lut *alpha_2bit_lut,
+	enum upsp_mode upsp_mode)
 {
+	(void)upsp_mode;
 	struct dcn50_dpp *dpp = TO_DCN50_DPP(dpp_base);
 	uint32_t pixel_format = 0;
 	uint32_t alpha_en = 1;
drivers/gpu/drm/amd/display/dc/dpp/dcn50/dcn50_dpp.h +2 -1
index c81e910ae095..fb9ed75ae901 100644
@@ -77,7 +77,8 @@ void dpp50_dpp_setup(
 	enum expansion_mode mode,
 	struct dc_csc_transform input_csc_color_matrix,
 	enum dc_color_space input_color_space,
-	struct cnv_alpha_2bit_lut *alpha_2bit_lut);
+	struct cnv_alpha_2bit_lut *alpha_2bit_lut,
+	enum upsp_mode upsp_mode);
 
 void dpp50_set_pregam_state(
 	struct dpp *dpp_base,
drivers/gpu/drm/amd/display/dc/dpp/dcn60/dcn60_dpp.c +31 -7
index be2effb14fc3..4218863d2a04 100644
@@ -24,7 +24,8 @@ void dpp60_dpp_setup(
 	enum expansion_mode mode,
 	struct dc_csc_transform input_csc_color_matrix,
 	enum dc_color_space input_color_space,
-	struct cnv_alpha_2bit_lut *alpha_2bit_lut)
+	struct cnv_alpha_2bit_lut *alpha_2bit_lut,
+	enum upsp_mode upsp_mode)
 {
 	struct dcn60_dpp *dpp = TO_DCN60_DPP(dpp_base);
 	uint32_t pixel_format = 8;
@@ -249,25 +250,47 @@ void dpp60_dpp_setup(
 		PRE_REALPHA_EN, realpha_en,
 		PRE_REALPHA_ABLND_EN, realpha_ablnd_en);
 
-	if (format < SURFACE_PIXEL_FORMAT_VIDEO_BEGIN ||
-			format >= SURFACE_PIXEL_FORMAT_SUBSAMPLE_END ||
-			color_space != COLOR_SPACE_SRGB) {
-		/* If input adjustment exists, program the ICSC with those values. */
+	// color matrix applied PreCSC for upsp mode
+	if (upsp_mode) {
 		if (input_csc_color_matrix.enable_adjustment == true) {
 			for (i = 0; i < 12; i++)
 				tbl_entry.regval[i] = input_csc_color_matrix.matrix[i];
 
 			tbl_entry.color_space = input_color_space;
 
+			// Re-use post csc function to program pre csc as
+			// the programming is same for both
 			if (dpp3_should_bypass_post_csc_for_colorspace(color_space))
 				select = INPUT_CSC_SELECT_BYPASS;
 			else
 				select = INPUT_CSC_SELECT_ICSC;
 
-			dpp3_program_post_csc(dpp_base, color_space, select,
+			dpp3_program_pre_csc(dpp_base, color_space, select,
 				&tbl_entry);
 		} else {
-			dpp3_program_post_csc(dpp_base, color_space, select, NULL);
+			dpp3_program_pre_csc(dpp_base, color_space, select, NULL);
+		}
+	} else {
+		if (format < SURFACE_PIXEL_FORMAT_VIDEO_BEGIN ||
+			format >= SURFACE_PIXEL_FORMAT_SUBSAMPLE_END ||
+			color_space != COLOR_SPACE_SRGB) {
+			/* If input adjustment exists, program the ICSC with those values. */
+			if (input_csc_color_matrix.enable_adjustment == true) {
+				for (i = 0; i < 12; i++)
+					tbl_entry.regval[i] = input_csc_color_matrix.matrix[i];
+
+				tbl_entry.color_space = input_color_space;
+
+				if (dpp3_should_bypass_post_csc_for_colorspace(color_space))
+					select = INPUT_CSC_SELECT_BYPASS;
+				else
+					select = INPUT_CSC_SELECT_ICSC;
+
+				dpp3_program_post_csc(dpp_base, color_space,
+						select, &tbl_entry);
+			} else {
+				dpp3_program_post_csc(dpp_base, color_space, select, NULL);
+			}
 		}
 	}
 }
@@ -317,6 +340,7 @@ static struct dpp_funcs dcn60_dpp_funcs = {
 	.dpp_cm_hist_read			= dpp42_dpp_cm_hist_read,
 	.dpp_read_reg_state			= dpp30_read_reg_state,
 	.dpp_set_pregam_state		= dpp50_set_pregam_state,
+	.dpp_program_upsp			= dpp60_dscl_program_upsp
 };
 
 static struct dpp_caps dcn60_dpp_cap = {
drivers/gpu/drm/amd/display/dc/dpp/dcn60/dcn60_dpp.h +8 -7
index 5d09fcd04553..f12a6061e5fb 100644
@@ -448,12 +448,12 @@
 #define DPP_REG_VARIABLE_LIST_DCN60 \
 	DPP_REG_VARIABLE_LIST_DCN50; \
 	uint32_t SCL_BLACK_COLOR; \
-	uint32_t UPSP_MODE; \
-	uint32_t UPSP_V_COEF_P0; \
-	uint32_t UPSP_V_COEF_P1; \
-	uint32_t UPSP_H_COEF_P0; \
-	uint32_t UPSP_H_COEF_P1; \
-	uint32_t UPSP_CLAMP
+	uint32_t CNVC_UPSP_MODE; \
+	uint32_t CNVC_UPSP_V_COEF_P0; \
+	uint32_t CNVC_UPSP_V_COEF_P1; \
+	uint32_t CNVC_UPSP_H_COEF_P0; \
+	uint32_t CNVC_UPSP_H_COEF_P1; \
+	uint32_t CNVC_UPSP_CLAMP
 
 struct dcn60_dpp_registers {
 	DPP_REG_VARIABLE_LIST_DCN60;
@@ -490,7 +490,8 @@ void dpp60_dpp_setup(
 	enum expansion_mode mode,
 	struct dc_csc_transform input_csc_color_matrix,
 	enum dc_color_space input_color_space,
-	struct cnv_alpha_2bit_lut *alpha_2bit_lut);
+	struct cnv_alpha_2bit_lut *alpha_2bit_lut,
+	enum upsp_mode upsp_mode);
 
 void dpp60_full_bypass(struct dpp *dpp_base);
 
drivers/gpu/drm/amd/display/dc/dpp/dcn60/dcn60_dpp_dscl.c +7 -6
index 0898148ba704..f030b2a0a1f4 100644
@@ -187,6 +187,7 @@ void dpp60_dscl_set_scaler_manual_scale(struct dpp *dpp_base,
 		v_num_taps_c = scl_data->dscl_prog_data.taps.v_taps_c;
 		h_num_taps = scl_data->dscl_prog_data.taps.h_taps;
 		h_num_taps_c = scl_data->dscl_prog_data.taps.h_taps_c;
+		ycbcr = ycbcr && !scl_data->dscl_prog_data.upsp_mode;
 	}
 
 	/* Unconditionally power on DSCL - can be in light sleep otherwise. */
@@ -280,7 +281,7 @@ void dpp60_dscl_program_upsp(struct dpp *dpp_base,
 {
 	struct dcn60_dpp *dpp = TO_DCN60_DPP(dpp_base);
 
-	REG_SET_8(UPSP_MODE, 0,
+	REG_SET_8(CNVC_UPSP_MODE, 0,
 			UPSP_MODE, dscl_prog_data->upsp_mode,
 			UPSP_V_NUM_TAPS, dscl_prog_data->upsp_v_num_taps,
 			UPSP_V_INIT_INT, dscl_prog_data->upsp_v_init_int,
@@ -289,27 +290,27 @@ void dpp60_dscl_program_upsp(struct dpp *dpp_base,
 			UPSP_H_INIT_INT, dscl_prog_data->upsp_h_init_int,
 			UPSP_H_INIT_FRAC, dscl_prog_data->upsp_h_init_frac,
 			UPSP_BOUNDARY_MODE, dscl_prog_data->upsp_boundary_mode);
-	REG_SET_4(UPSP_V_COEF_P0, 0,
+	REG_SET_4(CNVC_UPSP_V_COEF_P0, 0,
 			UPSP_V_COEF_TAP0_P0, dscl_prog_data->upsp_v_coef_tap0_p0,
 			UPSP_V_COEF_TAP1_P0, dscl_prog_data->upsp_v_coef_tap1_p0,
 			UPSP_V_COEF_TAP2_P0, dscl_prog_data->upsp_v_coef_tap2_p0,
 			UPSP_V_COEF_TAP3_P0, dscl_prog_data->upsp_v_coef_tap3_p0);
-	REG_SET_4(UPSP_V_COEF_P1, 0,
+	REG_SET_4(CNVC_UPSP_V_COEF_P1, 0,
 			UPSP_V_COEF_TAP0_P1, dscl_prog_data->upsp_v_coef_tap0_p1,
 			UPSP_V_COEF_TAP1_P1, dscl_prog_data->upsp_v_coef_tap1_p1,
 			UPSP_V_COEF_TAP2_P1, dscl_prog_data->upsp_v_coef_tap2_p1,
 			UPSP_V_COEF_TAP3_P1, dscl_prog_data->upsp_v_coef_tap3_p1);
-	REG_SET_4(UPSP_H_COEF_P0, 0,
+	REG_SET_4(CNVC_UPSP_H_COEF_P0, 0,
 			UPSP_H_COEF_TAP0_P0, dscl_prog_data->upsp_h_coef_tap0_p0,
 			UPSP_H_COEF_TAP1_P0, dscl_prog_data->upsp_h_coef_tap1_p0,
 			UPSP_H_COEF_TAP2_P0, dscl_prog_data->upsp_h_coef_tap2_p0,
 			UPSP_H_COEF_TAP3_P0, dscl_prog_data->upsp_h_coef_tap3_p0);
-	REG_SET_4(UPSP_H_COEF_P1, 0,
+	REG_SET_4(CNVC_UPSP_H_COEF_P1, 0,
 			UPSP_H_COEF_TAP0_P1, dscl_prog_data->upsp_h_coef_tap0_p1,
 			UPSP_H_COEF_TAP1_P1, dscl_prog_data->upsp_h_coef_tap1_p1,
 			UPSP_H_COEF_TAP2_P1, dscl_prog_data->upsp_h_coef_tap2_p1,
 			UPSP_H_COEF_TAP3_P1, dscl_prog_data->upsp_h_coef_tap3_p1);
-	REG_SET_2(UPSP_CLAMP, 0,
+	REG_SET_2(CNVC_UPSP_CLAMP, 0,
 			UPSP_CLAMP_MAX, dscl_prog_data->upsp_clamp_max,
 			UPSP_CLAMP_MIN, dscl_prog_data->upsp_clamp_min);
 }
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c +2 -1
index c42e493720bc..2ab247d9748b 100644
@@ -2943,7 +2943,8 @@ static void dcn10_update_dpp(struct dpp *dpp, struct dc_plane_state *plane_state
 			EXPANSION_MODE_ZERO,
 			plane_state->input_csc_color_matrix,
 			plane_state->color_space,
-			NULL);
+			NULL,
+			0);
 
 	//set scale and bias registers
 	build_prescale_params(&bns_params, plane_state);
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c +2 -1
index 27b886e78998..6b8c5b1e436c 100644
@@ -1787,7 +1787,8 @@ void dcn20_update_dchubp_dpp(
 				EXPANSION_MODE_ZERO,
 				plane_state->input_csc_color_matrix,
 				plane_state->color_space,
-				NULL);
+				NULL,
+				pipe_ctx->plane_res.scl_data.upsp);
 
 		if (dpp->funcs->set_cursor_matrix) {
 			dpp->funcs->set_cursor_matrix(dpp,
drivers/gpu/drm/amd/display/dc/hwss/dcn50/dcn50_hwseq.c +2 -1
index 7a82aaa6d1d6..151ec838f613 100644
@@ -153,7 +153,8 @@ void dcn50_update_dchubp_dpp(
 			EXPANSION_MODE_ZERO,
 			plane_state->input_csc_color_matrix,
 			plane_state->color_space,
-			NULL);
+			NULL,
+			pipe_ctx->plane_res.scl_data.upsp);
 
 		if (dpp->funcs->set_cursor_matrix) {
 			dpp->funcs->set_cursor_matrix(dpp,
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h +1 -0
index 7e7054608d74..7de59001453c 100644
@@ -155,6 +155,7 @@ struct setup_dpp_params {
 	enum surface_pixel_format format;
 	struct dc_csc_transform input_csc_color_matrix;
 	enum dc_color_space color_space;
+	enum upsp_mode upsp_mode;
 };
 
 struct program_bias_and_scale_params {
drivers/gpu/drm/amd/display/dc/inc/hw/dpp.h +2 -1
index 71244d3b6c90..562176e8d7d1 100644
@@ -314,7 +314,8 @@ struct dpp_funcs {
 			enum expansion_mode mode,
 			struct dc_csc_transform input_csc_color_matrix,
 			enum dc_color_space input_color_space,
-			struct cnv_alpha_2bit_lut *alpha_2bit_lut);
+			struct cnv_alpha_2bit_lut *alpha_2bit_lut,
+			enum upsp_mode upsp_mode);
 
 	void (*dpp_full_bypass)(struct dpp *dpp_base);
 
drivers/gpu/drm/amd/display/dc/resource/dcn60/dcn60_resource.h +6 -0
index b1a802f9f4b4..34cfdc6eb8e5 100644
@@ -370,6 +370,12 @@ bool dcn50_program_mcache_pipe_config(struct dc_state *context,
 	SRI_ARR(CM_TEST_DEBUG_DATA, CM, id),                                     \
 	SRI_ARR(FORMAT_CONTROL, CNVC_CFG, id),                                   \
 	SRI_ARR(CNVC_SURFACE_PIXEL_FORMAT, CNVC_CFG, id),                        \
+	SRI_ARR(CNVC_UPSP_CLAMP, CNVC_CFG, id),                                  \
+	SRI_ARR(CNVC_UPSP_MODE, CNVC_CFG, id),                                   \
+	SRI_ARR(CNVC_UPSP_H_COEF_P0, CNVC_CFG, id),                              \
+	SRI_ARR(CNVC_UPSP_H_COEF_P1, CNVC_CFG, id),                              \
+	SRI_ARR(CNVC_UPSP_V_COEF_P0, CNVC_CFG, id),                              \
+	SRI_ARR(CNVC_UPSP_V_COEF_P1, CNVC_CFG, id),                              \
 	SRI_ARR(CURSOR0_CONTROL, CM_CUR, id),                                    \
 	SRI_ARR(CURSOR0_COLOR0, CM_CUR, id),                                     \
 	SRI_ARR(CURSOR0_COLOR1, CM_CUR, id),                                     \
Signature · 1 line
2.43.0
#5 lore raw

PATCH 5/19 drm/amd/display: Use aux hw inst if no ddc pin exists

In reply to [email protected]

From: Alvin Lee <[email protected]>

[Description]
On newer products no DDC / I2C pins exist for DP. In this case instance "ddc line" using aux hw inst, matching the i2c scenario where we must rely on I2C over aux.

---
 drivers/gpu/drm/amd/display/dc/dc_fused_io.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc_fused_io.c +3 -1
index 923f70724419..1c58223acce1 100644
@@ -131,7 +131,9 @@ bool dm_atomic_write_poll_read_aux(
 	if (!link)
 		return false;
 
-	const uint32_t ddc_line = link->ddc->ddc_pin->pin_data->en;
+	/* If no DDC pins exist, then use the aux hw inst instead. Same logic as in dm_atomic_write_poll_read_i2c */
+	const uint32_t ddc_line = link->no_ddc_pin ?
+			link->aux_hw_inst : link->ddc->ddc_pin->pin_data->en;
 	union dmub_rb_cmd commands[3] = { 0 };
 	const bool converted = op_aux_convert(&commands[0], write, FUSED_REQUEST_WRITE, ddc_line)
 			&& op_aux_convert(&commands[1], poll, FUSED_REQUEST_POLL, ddc_line)
Signature · 1 line
2.43.0
#6 lore raw

PATCH 6/19 drm/amd/display: Directly include compiler_attributes.h

In reply to [email protected]

From: Dominik Kaszewski <[email protected]>

[Why & How]
External improvements will allow DC to directly include Linux Kernel headers without the os_types.h proxy. As a test, dc_memory_pool can directly include compiler_attributes.h for __must_check and _aligned.

---
 drivers/gpu/drm/amd/display/dc/dc_memory_pool.c | 1 +
 drivers/gpu/drm/amd/display/dc/dc_memory_pool.h | 2 ++
 drivers/gpu/drm/amd/display/dc/os_types.h       | 1 -
 3 files changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc_memory_pool.c +1 -0
index 8a5a72f4cc88..e3db3a43550f 100644
@@ -17,6 +17,7 @@
 #include "dc_memory_pool.h"
 
 #include <linux/atomic.h>
+#include <linux/compiler_attributes.h>
 
 enum {
 	DC_MEMORY_POOL_SENTINEL = -1,
drivers/gpu/drm/amd/display/dc/dc_memory_pool.h +2 -0
index 0ec305813d66..e0d3beb60ef4 100644
@@ -19,6 +19,8 @@
 
 #include "os_types.h"
 
+#include <linux/compiler_attributes.h>
+
 /**
  * Non-resizable lock-free memory pool with fixed capacity.
  *
drivers/gpu/drm/amd/display/dc/os_types.h +0 -1
index 27d4a96b958f..339372293a98 100644
@@ -27,7 +27,6 @@
 #ifndef _OS_TYPES_H_
 #define _OS_TYPES_H_
 
-#include <linux/compiler_attributes.h>
 #include <linux/slab.h>
 #include <linux/kgdb.h>
 #include <linux/delay.h>
Signature · 1 line
2.43.0
#7 lore raw

PATCH 7/19 drm/amd/display: Fix frac_urg_bw conversion to correct U0.10 format

In reply to [email protected]

From: Ovidiu Bunea <[email protected]>

[why * how]
DCHUBBUB_ARB_FRAC_URG_BW_* registers only have 10 programmable bits that are formatted in U0.10 fixed point. Multiplying the fraction by 1000 is incorrect, and understates the fraction by 2.34%.

Rounding or truncating is not correct either since it can cut off 0.1% of the fraction which has direct implications on the assumed deadlines and TTU, albeit minor.

Scale the fraction by the correct 1024 value, use ceiling to ensure the assumed fraction is maintained, and clamp to 1023 since the register field is only 10 bits wide. Clamping from 1024 -> 1023 only impacts modes at > 99.9% fractions.

---
 .../src/dml2_core/dml2_core_dcn4_calcs.c      |  7 ++++---
 .../dml2_core/dml2_core_dcn5_calcs_dchub.c    |  5 +++--
 .../dml2_core/dml2_core_dcn6_calcs_dchub.c    |  5 +++--
 .../dml21/src/dml2_dpmm/dml2_dpmm_dcn4.c      | 20 ++++++++++---------
 .../dml21/src/dml2_dpmm/dml2_dpmm_dcn5.c      | 13 ++++++------
 5 files changed, 28 insertions(+), 22 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn4_calcs.c +4 -3
index 2d43a35c4c42..a4a77e375d9f 100644
@@ -12315,6 +12315,7 @@ static unsigned int dml_get_plane_idx(const struct dml2_core_internal_display_mo
 static void rq_dlg_get_wm_regs(const struct dml2_display_cfg *display_cfg, const struct dml2_core_internal_display_mode_lib *mode_lib, struct dml2_dchub_watermark_regs *wm_regs)
 {
 	double refclk_freq_in_mhz = (display_cfg->overrides.hw.dlg_ref_clk_mhz > 0) ? (double)display_cfg->overrides.hw.dlg_ref_clk_mhz : mode_lib->soc.dchub_refclk_mhz;
+	unsigned int u0_10_fixed_point_scale = 1U << 10;
 
 	wm_regs->fclk_pstate = (unsigned int)(mode_lib->mp.Watermark.FCLKChangeWatermark * refclk_freq_in_mhz);
 	wm_regs->sr_enter = (unsigned int)(mode_lib->mp.Watermark.StutterEnterPlusExitWatermark * refclk_freq_in_mhz);
@@ -12327,9 +12328,9 @@ static void rq_dlg_get_wm_regs(const struct dml2_display_cfg *display_cfg, const
 	wm_regs->usr = (unsigned int)(mode_lib->mp.Watermark.USRRetrainingWatermark * refclk_freq_in_mhz);
 	wm_regs->refcyc_per_trip_to_mem = (unsigned int)(mode_lib->mp.UrgentLatency * refclk_freq_in_mhz);
 	wm_regs->refcyc_per_meta_trip_to_mem = (unsigned int)(mode_lib->mp.MetaTripToMemory * refclk_freq_in_mhz);
-	wm_regs->frac_urg_bw_flip = (unsigned int)(mode_lib->mp.FractionOfUrgentBandwidthImmediateFlip * 1000);
-	wm_regs->frac_urg_bw_nom = (unsigned int)(mode_lib->mp.FractionOfUrgentBandwidth * 1000);
-	wm_regs->frac_urg_bw_mall = (unsigned int)(mode_lib->mp.FractionOfUrgentBandwidthMALL * 1000);
+	wm_regs->frac_urg_bw_flip = (unsigned int)math_min2(math_ceil(mode_lib->mp.FractionOfUrgentBandwidthImmediateFlip * u0_10_fixed_point_scale), u0_10_fixed_point_scale - 1);
+	wm_regs->frac_urg_bw_nom = (unsigned int)math_min2(math_ceil(mode_lib->mp.FractionOfUrgentBandwidth * u0_10_fixed_point_scale), u0_10_fixed_point_scale - 1);
+	wm_regs->frac_urg_bw_mall = (unsigned int)math_min2(math_ceil(mode_lib->mp.FractionOfUrgentBandwidthMALL * u0_10_fixed_point_scale), u0_10_fixed_point_scale - 1);
 }
 
 static unsigned int log_and_substract_if_non_zero(unsigned int a, unsigned int subtrahend)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn5_calcs_dchub.c +3 -2
index f407afefb37f..262b8e098343 100644
@@ -5344,6 +5344,7 @@ void dcn5_adjust_pixel_clock_for_progressive_to_interlace_unit(const struct dml2
 static void dcn5_rq_dlg_get_wm_regs(const struct dml2_display_cfg *display_cfg, const struct dml2_core_internal_display_mode_lib *mode_lib, const struct dml2_utm_soc_bb *utm_soc_bb, struct dml2_dchub_watermark_regs *wm_regs)
 {
 	double refclk_freq_in_mhz = (display_cfg->overrides.hw.dlg_ref_clk_mhz > 0) ? (double)display_cfg->overrides.hw.dlg_ref_clk_mhz : utm_soc_bb->dchub_refclk_mhz;
+	unsigned int u0_10_fixed_point_scale = 1U << 10;
 
 	wm_regs->fclk_pstate = (int unsigned)(mode_lib->mp.Watermark.FCLKChangeWatermark * refclk_freq_in_mhz);
 	wm_regs->sr_enter = (int unsigned)(mode_lib->mp.Watermark.StutterEnterPlusExitWatermark * refclk_freq_in_mhz);
@@ -5356,8 +5357,8 @@ static void dcn5_rq_dlg_get_wm_regs(const struct dml2_display_cfg *display_cfg,
 	wm_regs->usr = (int unsigned)(mode_lib->mp.Watermark.USRRetrainingWatermark * refclk_freq_in_mhz);
 	wm_regs->refcyc_per_trip_to_mem = (unsigned int)(mode_lib->mp.UrgentLatency * refclk_freq_in_mhz);
 	wm_regs->refcyc_per_meta_trip_to_mem = (unsigned int)(mode_lib->mp.MetaTripToMemory * refclk_freq_in_mhz);
-	wm_regs->frac_urg_bw_flip = (unsigned int)(mode_lib->mp.FractionOfUrgentBandwidthImmediateFlip * 1000);
-	wm_regs->frac_urg_bw_nom = (unsigned int)(mode_lib->mp.FractionOfUrgentBandwidth * 1000);
+	wm_regs->frac_urg_bw_flip = (unsigned int)math_min2(math_ceil(mode_lib->mp.FractionOfUrgentBandwidthImmediateFlip * u0_10_fixed_point_scale), u0_10_fixed_point_scale - 1);
+	wm_regs->frac_urg_bw_nom = (unsigned int)math_min2(math_ceil(mode_lib->mp.FractionOfUrgentBandwidth * u0_10_fixed_point_scale), u0_10_fixed_point_scale - 1);
 }
 
 void dcn5_get_mcif_arb_params(const struct dml2_core_internal_display_mode_lib *mode_lib, struct dml2_mcif_global_register_set *out)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs_dchub.c +3 -2
index 6ad41846a73a..ce6eb94230c1 100644
@@ -1059,6 +1059,7 @@ static void dcn6_rq_dlg_get_dlg_reg(
 static void dcn6_rq_dlg_get_wm_regs(const struct dml2_display_cfg *display_cfg, const struct dml2_core_internal_display_mode_lib *mode_lib, const struct dml2_utm_soc_bb *utm_soc_bb, struct dml2_dchub_watermark_regs *wm_regs)
 {
 	double refclk_freq_in_mhz = (display_cfg->overrides.hw.dlg_ref_clk_mhz > 0) ? (double)display_cfg->overrides.hw.dlg_ref_clk_mhz : utm_soc_bb->dchub_refclk_mhz;
+	unsigned int u0_10_fixed_point_scale = 1U << 10;
 
 	wm_regs->fclk_pstate = (int unsigned)(mode_lib->mp.Watermark.FCLKChangeWatermark * refclk_freq_in_mhz);
 	wm_regs->sr_enter = (int unsigned)(mode_lib->mp.Watermark.StutterEnterPlusExitWatermark * refclk_freq_in_mhz);
@@ -1074,8 +1075,8 @@ static void dcn6_rq_dlg_get_wm_regs(const struct dml2_display_cfg *display_cfg,
 	wm_regs->usr = (int unsigned)(mode_lib->mp.Watermark.USRRetrainingWatermark * refclk_freq_in_mhz);
 	wm_regs->refcyc_per_trip_to_mem = (unsigned int)(mode_lib->mp.UrgentLatency * refclk_freq_in_mhz);
 	wm_regs->refcyc_per_meta_trip_to_mem = (unsigned int)(mode_lib->mp.MetaTripToMemory * refclk_freq_in_mhz);
-	wm_regs->frac_urg_bw_flip = (unsigned int)(mode_lib->mp.FractionOfUrgentBandwidthImmediateFlip * 1000);
-	wm_regs->frac_urg_bw_nom = (unsigned int)(mode_lib->mp.FractionOfUrgentBandwidth * 1000);
+	wm_regs->frac_urg_bw_flip = (unsigned int)math_min2(math_ceil(mode_lib->mp.FractionOfUrgentBandwidthImmediateFlip * u0_10_fixed_point_scale), u0_10_fixed_point_scale - 1);
+	wm_regs->frac_urg_bw_nom = (unsigned int)math_min2(math_ceil(mode_lib->mp.FractionOfUrgentBandwidth * u0_10_fixed_point_scale), u0_10_fixed_point_scale - 1);
 }
 
 void dcn6_get_pipe_regs(const struct dml2_display_cfg *display_cfg,
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_dpmm/dml2_dpmm_dcn4.c +11 -9
index 54a1f9c13dbf..7fa50ccfcfd1 100644
@@ -898,6 +898,7 @@ bool dpmm_dcn4_map_watermarks(struct dml2_dpmm_map_watermarks_params_in_out *in_
 	struct dml2_dchub_global_register_set *dchubbub_regs = &in_out->programming->global_regs;
 
 	double refclk_freq_in_mhz = (display_cfg->overrides.hw.dlg_ref_clk_mhz > 0) ? (double)display_cfg->overrides.hw.dlg_ref_clk_mhz : mode_lib->soc.dchub_refclk_mhz;
+	unsigned int u0_10_fixed_point_scale = 1U << 10;
 
 	/* set A */
 	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_A].fclk_pstate = (int unsigned)(mode_lib->mp.Watermark.FCLKChangeWatermark * refclk_freq_in_mhz);
@@ -911,9 +912,9 @@ bool dpmm_dcn4_map_watermarks(struct dml2_dpmm_map_watermarks_params_in_out *in_
 	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_A].usr = (int unsigned)(mode_lib->mp.Watermark.USRRetrainingWatermark * refclk_freq_in_mhz);
 	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_A].refcyc_per_trip_to_mem = (unsigned int)(mode_lib->mp.Watermark.UrgentWatermark * refclk_freq_in_mhz);
 	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_A].refcyc_per_meta_trip_to_mem = (unsigned int)(mode_lib->mp.Watermark.UrgentWatermark * refclk_freq_in_mhz);
-	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_A].frac_urg_bw_flip = (unsigned int)(mode_lib->mp.FractionOfUrgentBandwidthImmediateFlip * 1000);
-	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_A].frac_urg_bw_nom = (unsigned int)(mode_lib->mp.FractionOfUrgentBandwidth * 1000);
-	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_A].frac_urg_bw_mall = (unsigned int)(mode_lib->mp.FractionOfUrgentBandwidthMALL * 1000);
+	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_A].frac_urg_bw_flip = (unsigned int)math_min2(math_ceil(mode_lib->mp.FractionOfUrgentBandwidthImmediateFlip * u0_10_fixed_point_scale), u0_10_fixed_point_scale - 1);
+	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_A].frac_urg_bw_nom = (unsigned int)math_min2(math_ceil(mode_lib->mp.FractionOfUrgentBandwidth * u0_10_fixed_point_scale), u0_10_fixed_point_scale - 1);
+	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_A].frac_urg_bw_mall = (unsigned int)math_min2(math_ceil(mode_lib->mp.FractionOfUrgentBandwidthMALL * u0_10_fixed_point_scale), u0_10_fixed_point_scale - 1);
 
 	/* set B */
 	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_B].fclk_pstate = (int unsigned)(mode_lib->mp.Watermark.FCLKChangeWatermark * refclk_freq_in_mhz);
@@ -927,9 +928,9 @@ bool dpmm_dcn4_map_watermarks(struct dml2_dpmm_map_watermarks_params_in_out *in_
 	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_B].usr = (int unsigned)(mode_lib->mp.Watermark.USRRetrainingWatermark * refclk_freq_in_mhz);
 	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_B].refcyc_per_trip_to_mem = (unsigned int)(mode_lib->mp.Watermark.UrgentWatermark * refclk_freq_in_mhz);
 	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_B].refcyc_per_meta_trip_to_mem = (unsigned int)(mode_lib->mp.Watermark.UrgentWatermark * refclk_freq_in_mhz);
-	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_B].frac_urg_bw_flip = (unsigned int)(mode_lib->mp.FractionOfUrgentBandwidthImmediateFlip * 1000);
-	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_B].frac_urg_bw_nom = (unsigned int)(mode_lib->mp.FractionOfUrgentBandwidth * 1000);
-	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_B].frac_urg_bw_mall = (unsigned int)(mode_lib->mp.FractionOfUrgentBandwidthMALL * 1000);
+	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_B].frac_urg_bw_flip = (unsigned int)math_min2(math_ceil(mode_lib->mp.FractionOfUrgentBandwidthImmediateFlip * u0_10_fixed_point_scale), u0_10_fixed_point_scale - 1);
+	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_B].frac_urg_bw_nom = (unsigned int)math_min2(math_ceil(mode_lib->mp.FractionOfUrgentBandwidth * u0_10_fixed_point_scale), u0_10_fixed_point_scale - 1);
+	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_B].frac_urg_bw_mall = (unsigned int)math_min2(math_ceil(mode_lib->mp.FractionOfUrgentBandwidthMALL * u0_10_fixed_point_scale), u0_10_fixed_point_scale - 1);
 
 	dchubbub_regs->num_watermark_sets = 2;
 
@@ -944,6 +945,7 @@ bool dpmm_dcn42_map_watermarks(struct dml2_dpmm_map_watermarks_params_in_out *in
 	struct dml2_dchub_global_register_set *dchubbub_regs = &in_out->programming->global_regs;
 
 	double refclk_freq_in_mhz = (display_cfg->overrides.hw.dlg_ref_clk_mhz > 0) ? (double)display_cfg->overrides.hw.dlg_ref_clk_mhz : mode_lib->soc.dchub_refclk_mhz;
+	unsigned int u0_10_fixed_point_scale = 1U << 10;
 
 	/* set A */
 	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_A].fclk_pstate = (int unsigned)(mode_lib->mp.Watermark.FCLKChangeWatermark * refclk_freq_in_mhz);
@@ -957,9 +959,9 @@ bool dpmm_dcn42_map_watermarks(struct dml2_dpmm_map_watermarks_params_in_out *in
 	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_A].usr = (int unsigned)(mode_lib->mp.Watermark.USRRetrainingWatermark * refclk_freq_in_mhz);
 	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_A].refcyc_per_trip_to_mem = (unsigned int)(mode_lib->mp.Watermark.UrgentWatermark * refclk_freq_in_mhz);
 	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_A].refcyc_per_meta_trip_to_mem = (unsigned int)(mode_lib->mp.Watermark.UrgentWatermark * refclk_freq_in_mhz);
-	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_A].frac_urg_bw_flip = (unsigned int)(mode_lib->mp.FractionOfUrgentBandwidthImmediateFlip * 1000);
-	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_A].frac_urg_bw_nom = (unsigned int)(mode_lib->mp.FractionOfUrgentBandwidth * 1000);
-	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_A].frac_urg_bw_mall = (unsigned int)(mode_lib->mp.FractionOfUrgentBandwidthMALL * 1000);
+	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_A].frac_urg_bw_flip = (unsigned int)math_min2(math_ceil(mode_lib->mp.FractionOfUrgentBandwidthImmediateFlip * u0_10_fixed_point_scale), u0_10_fixed_point_scale - 1);
+	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_A].frac_urg_bw_nom = (unsigned int)math_min2(math_ceil(mode_lib->mp.FractionOfUrgentBandwidth * u0_10_fixed_point_scale), u0_10_fixed_point_scale - 1);
+	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_A].frac_urg_bw_mall = (unsigned int)math_min2(math_ceil(mode_lib->mp.FractionOfUrgentBandwidthMALL * u0_10_fixed_point_scale), u0_10_fixed_point_scale - 1);
 
 	/* set B */
 	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_B] = dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_A];
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_dpmm/dml2_dpmm_dcn5.c +7 -6
index f6230f8f9127..e607d763f5a3 100644
@@ -397,6 +397,7 @@ bool dpmm_dcn5_map_watermarks(struct dml2_dpmm_map_watermarks_params_in_out *in_
 	struct dml2_mcif_global_register_set *mcif_regs = &in_out->programming->mcif_global_regs;
 
 	double refclk_freq_in_mhz = (display_cfg->overrides.hw.dlg_ref_clk_mhz > 0) ? (double)display_cfg->overrides.hw.dlg_ref_clk_mhz : in_out->core->utm_soc_bb->dchub_refclk_mhz;
+	unsigned int u0_10_fixed_point_scale = 1U << 10;
 
 	/* set A */
 	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_A].fclk_pstate = (int unsigned)(mode_lib->mp.Watermark.FCLKChangeWatermark * refclk_freq_in_mhz);
@@ -410,9 +411,9 @@ bool dpmm_dcn5_map_watermarks(struct dml2_dpmm_map_watermarks_params_in_out *in_
 	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_A].usr = (int unsigned)(mode_lib->mp.Watermark.USRRetrainingWatermark * refclk_freq_in_mhz);
 	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_A].refcyc_per_trip_to_mem = (unsigned int)(mode_lib->mp.Watermark.UrgentWatermark * refclk_freq_in_mhz);
 	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_A].refcyc_per_meta_trip_to_mem = (unsigned int)(mode_lib->mp.Watermark.UrgentWatermark * refclk_freq_in_mhz);
-	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_A].frac_urg_bw_flip = (unsigned int)(mode_lib->mp.FractionOfUrgentBandwidthImmediateFlip * 1000);
-	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_A].frac_urg_bw_nom = (unsigned int)(mode_lib->mp.FractionOfUrgentBandwidth * 1000);
-	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_A].frac_urg_bw_mall = (unsigned int)(mode_lib->mp.FractionOfUrgentBandwidthMALL * 1000);
+	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_A].frac_urg_bw_flip = (unsigned int)math_min2(math_ceil(mode_lib->mp.FractionOfUrgentBandwidthImmediateFlip * u0_10_fixed_point_scale), u0_10_fixed_point_scale - 1);
+	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_A].frac_urg_bw_nom = (unsigned int)math_min2(math_ceil(mode_lib->mp.FractionOfUrgentBandwidth * u0_10_fixed_point_scale), u0_10_fixed_point_scale - 1);
+	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_A].frac_urg_bw_mall = (unsigned int)math_min2(math_ceil(mode_lib->mp.FractionOfUrgentBandwidthMALL * u0_10_fixed_point_scale), u0_10_fixed_point_scale - 1);
 
 	/* set B */
 	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_B].fclk_pstate = (int unsigned)(mode_lib->mp.Watermark.FCLKChangeWatermark * refclk_freq_in_mhz);
@@ -426,9 +427,9 @@ bool dpmm_dcn5_map_watermarks(struct dml2_dpmm_map_watermarks_params_in_out *in_
 	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_B].usr = (int unsigned)(mode_lib->mp.Watermark.USRRetrainingWatermark * refclk_freq_in_mhz);
 	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_B].refcyc_per_trip_to_mem = (unsigned int)(mode_lib->mp.Watermark.UrgentWatermark * refclk_freq_in_mhz);
 	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_B].refcyc_per_meta_trip_to_mem = (unsigned int)(mode_lib->mp.Watermark.UrgentWatermark * refclk_freq_in_mhz);
-	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_B].frac_urg_bw_flip = (unsigned int)(mode_lib->mp.FractionOfUrgentBandwidthImmediateFlip * 1000);
-	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_B].frac_urg_bw_nom = (unsigned int)(mode_lib->mp.FractionOfUrgentBandwidth * 1000);
-	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_B].frac_urg_bw_mall = (unsigned int)(mode_lib->mp.FractionOfUrgentBandwidthMALL * 1000);
+	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_B].frac_urg_bw_flip = (unsigned int)math_min2(math_ceil(mode_lib->mp.FractionOfUrgentBandwidthImmediateFlip * u0_10_fixed_point_scale), u0_10_fixed_point_scale - 1);
+	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_B].frac_urg_bw_nom = (unsigned int)math_min2(math_ceil(mode_lib->mp.FractionOfUrgentBandwidth * u0_10_fixed_point_scale), u0_10_fixed_point_scale - 1);
+	dchubbub_regs->wm_regs[DML2_DCHUB_WATERMARK_SET_B].frac_urg_bw_mall = (unsigned int)math_min2(math_ceil(mode_lib->mp.FractionOfUrgentBandwidthMALL * u0_10_fixed_point_scale), u0_10_fixed_point_scale - 1);
 
 	dchubbub_regs->num_watermark_sets = 2;
 
Signature · 1 line
2.43.0
#8 lore raw

PATCH 8/19 drm/amd/display: Do full link training during HDR/SDR seamless switch

In reply to [email protected]

From: Karthi Kandasamy <[email protected]>

[Why]
The forced_psr_active gates added across hwseq skipped backlight, ABM, CRTC/OTG, PHY link output and DPMS teardown whenever seamless switch happens. This meant the link was not fully retrained during an HDR/SDR switch, going beyond the intended scope of just preventing the frozen frame from being disrupted.

[How]
Removed the forced_psr_active conditionals from early return, the dpms_on gate, the disable_link_output gates, and the reset_back_end_for_pipe dpms_off/abm/disable_crtc/enable_optc_clock skips and hwseq,
restoring their unconditional behavior so full link training runs during the HDR/SDR switch even with seamless switch

---
 .../amd/display/dc/hwss/dce110/dce110_hwseq.c | 13 +++---------
 .../amd/display/dc/hwss/dcn10/dcn10_hwseq.c   | 19 ++++++-----------
 .../amd/display/dc/hwss/dcn20/dcn20_hwseq.c   | 17 +++++----------
 .../amd/display/dc/hwss/dcn31/dcn31_hwseq.c   | 21 ++++++-------------
 .../amd/display/dc/hwss/dcn314/dcn314_hwseq.c |  8 +++----
 .../amd/display/dc/hwss/dcn32/dcn32_hwseq.c   |  7 ++-----
 .../amd/display/dc/hwss/dcn35/dcn35_hwseq.c   |  7 ++-----
 .../amd/display/dc/hwss/dcn60/dcn60_hwseq.c   |  4 +---
 8 files changed, 28 insertions(+), 68 deletions(-)
drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c +3 -10
index 7b3aa02dda63..1abb28504aec 100644
@@ -1285,8 +1285,6 @@ void dce110_blank_stream(struct pipe_ctx *pipe_ctx)
 		return;
 
 	if (link->local_sink && link->local_sink->sink_signal == SIGNAL_TYPE_EDP) {
-		if (link->forced_psr_active)
-			return;
 		if (!link->skip_implict_edp_power_control && hws)
 			hws->funcs.edp_backlight_control(link, false);
 		link->dc->hwss.set_abm_immediate_disable(pipe_ctx);
@@ -1815,9 +1813,7 @@ enum dc_status dce110_apply_single_controller_ctx_to_hw(
 			dc->link_srv->set_dsc_enable(pipe_ctx, true);
 	}
 
-	if (!stream->dpms_off &&
-	    !(link->connector_signal == SIGNAL_TYPE_EDP &&
-	      link->forced_psr_active))
+	if (!stream->dpms_off)
 		dc->link_srv->set_dpms_on(context, pipe_ctx);
 
 	/* DCN3.1 FPGA Workaround
@@ -3607,11 +3603,8 @@ void dce110_disable_link_output(struct dc_link *link,
 	else if (dmcu != NULL && dmcu->funcs->lock_phy)
 		dmcu->funcs->lock_phy(dmcu);
 
-	if (!(signal == SIGNAL_TYPE_EDP &&
-			link->forced_psr_active)) {
-		link_hwss->disable_link_output(link, link_res, signal);
-		link->phy_state.symclk_state = SYMCLK_OFF_TX_OFF;
-	}
+	link_hwss->disable_link_output(link, link_res, signal);
+	link->phy_state.symclk_state = SYMCLK_OFF_TX_OFF;
 	/*
 	 * Add the logic to extract BOTH power up and power down sequences
 	 * from enable/disable link output and only call edp panel control
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c +6 -13
index 2ab247d9748b..f1d14b97977f 100644
@@ -1350,12 +1350,7 @@ static void dcn10_reset_back_end_for_pipe(
 	 * screen only, the dpms_off would be true but
 	 * VBIOS lit up eDP, so check link status too.
 	 */
-	if (link->connector_signal == SIGNAL_TYPE_EDP &&
-	    link->forced_psr_active) {
-		/* forced psr is active for seamless switch; skip dpms-off. */
-		if (pipe_ctx->stream_res.audio)
-			dc->hwss.disable_audio_stream(pipe_ctx);
-	} else if (!pipe_ctx->stream->dpms_off || link->link_status.link_active)
+	if (!pipe_ctx->stream->dpms_off || link->link_status.link_active)
 		dc->link_srv->set_dpms_off(pipe_ctx);
 	else if (pipe_ctx->stream_res.audio)
 		dc->hwss.disable_audio_stream(pipe_ctx);
@@ -1379,15 +1374,13 @@ static void dcn10_reset_back_end_for_pipe(
 	 * parent pipe.
 	 */
 	if (pipe_ctx->top_pipe == NULL) {
-		if (!(link->connector_signal == SIGNAL_TYPE_EDP &&
-			link->forced_psr_active)) {
-			if (pipe_ctx->stream_res.abm)
-				dc->hwss.set_abm_immediate_disable(pipe_ctx);
 
-			pipe_ctx->stream_res.tg->funcs->disable_crtc(pipe_ctx->stream_res.tg);
+		if (pipe_ctx->stream_res.abm)
+			dc->hwss.set_abm_immediate_disable(pipe_ctx);
 
-			pipe_ctx->stream_res.tg->funcs->enable_optc_clock(pipe_ctx->stream_res.tg, false);
-		}
+		pipe_ctx->stream_res.tg->funcs->disable_crtc(pipe_ctx->stream_res.tg);
+
+		pipe_ctx->stream_res.tg->funcs->enable_optc_clock(pipe_ctx->stream_res.tg, false);
 		set_drr_and_clear_adjust_pending(pipe_ctx, pipe_ctx->stream, NULL);
 		if (dc_is_hdmi_tmds_signal(pipe_ctx->stream->signal))
 			pipe_ctx->stream->link->phy_state.symclk_ref_cnts.otg = 0;
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c +5 -12
index 6b8c5b1e436c..b0cc1f2506ba 100644
@@ -2914,12 +2914,7 @@ void dcn20_reset_back_end_for_pipe(
 	 * screen only, the dpms_off would be true but
 	 * VBIOS lit up eDP, so check link status too.
 	 */
-	if (link->connector_signal == SIGNAL_TYPE_EDP &&
-	    link->forced_psr_active) {
-		/* forced psr is active for seamless switch; skip dpms-off. */
-		if (pipe_ctx->stream_res.audio)
-			dc->hwss.disable_audio_stream(pipe_ctx);
-	} else if (!pipe_ctx->stream->dpms_off || link->link_status.link_active)
+	if (!pipe_ctx->stream->dpms_off || link->link_status.link_active)
 		dc->link_srv->set_dpms_off(pipe_ctx);
 	else if (pipe_ctx->stream_res.audio)
 		dc->hwss.disable_audio_stream(pipe_ctx);
@@ -2944,14 +2939,12 @@ void dcn20_reset_back_end_for_pipe(
 	 * parent pipe.
 	 */
 	if (pipe_ctx->top_pipe == NULL) {
-		if (!(link->connector_signal == SIGNAL_TYPE_EDP &&
-				link->forced_psr_active)) {
-			dc->hwss.set_abm_immediate_disable(pipe_ctx);
 
-			pipe_ctx->stream_res.tg->funcs->disable_crtc(pipe_ctx->stream_res.tg);
+		dc->hwss.set_abm_immediate_disable(pipe_ctx);
 
-			pipe_ctx->stream_res.tg->funcs->enable_optc_clock(pipe_ctx->stream_res.tg, false);
-		}
+		pipe_ctx->stream_res.tg->funcs->disable_crtc(pipe_ctx->stream_res.tg);
+
+		pipe_ctx->stream_res.tg->funcs->enable_optc_clock(pipe_ctx->stream_res.tg, false);
 		if (pipe_ctx->stream_res.tg->funcs->set_odm_bypass)
 			pipe_ctx->stream_res.tg->funcs->set_odm_bypass(
 					pipe_ctx->stream_res.tg, &pipe_ctx->stream->timing);
drivers/gpu/drm/amd/display/dc/hwss/dcn31/dcn31_hwseq.c +6 -15
index 823ef06c64f5..b6f3c0480ab6 100644
@@ -537,11 +537,9 @@ static void dcn31_reset_back_end_for_pipe(
 	}
 	ASSERT(!pipe_ctx->top_pipe);
 
-	link = pipe_ctx->stream->link;
+	dc->hwss.set_abm_immediate_disable(pipe_ctx);
 
-	if (!(link->connector_signal == SIGNAL_TYPE_EDP &&
-	      link->forced_psr_active))
-		dc->hwss.set_abm_immediate_disable(pipe_ctx);
+	link = pipe_ctx->stream->link;
 
 	if (dc->hwseq)
 		dc->hwseq->wa_state.skip_blank_stream = false;
@@ -557,11 +555,9 @@ static void dcn31_reset_back_end_for_pipe(
 			pipe_ctx->stream_res.tg,
 			OPTC_DSC_DISABLED, 0, 0);
 
-	if (!(link->connector_signal == SIGNAL_TYPE_EDP &&
-	      link->forced_psr_active)) {
-		pipe_ctx->stream_res.tg->funcs->disable_crtc(pipe_ctx->stream_res.tg);
-		pipe_ctx->stream_res.tg->funcs->enable_optc_clock(pipe_ctx->stream_res.tg, false);
-	}
+	pipe_ctx->stream_res.tg->funcs->disable_crtc(pipe_ctx->stream_res.tg);
+
+	pipe_ctx->stream_res.tg->funcs->enable_optc_clock(pipe_ctx->stream_res.tg, false);
 	if (pipe_ctx->stream_res.tg->funcs->set_odm_bypass)
 		pipe_ctx->stream_res.tg->funcs->set_odm_bypass(
 				pipe_ctx->stream_res.tg, &pipe_ctx->stream->timing);
@@ -590,12 +586,7 @@ static void dcn31_reset_back_end_for_pipe(
 	 * screen only, the dpms_off would be true but
 	 * VBIOS lit up eDP, so check link status too.
 	 */
-	if (link->connector_signal == SIGNAL_TYPE_EDP &&
-	    link->forced_psr_active) {
-		/* forced psr is active for seamless switch; skip dpms-off. */
-		if (pipe_ctx->stream_res.audio)
-			dc->hwss.disable_audio_stream(pipe_ctx);
-	} else if (!pipe_ctx->stream->dpms_off || link->link_status.link_active)
+	if (!pipe_ctx->stream->dpms_off || link->link_status.link_active)
 		dc->link_srv->set_dpms_off(pipe_ctx);
 	else if (pipe_ctx->stream_res.audio)
 		dc->hwss.disable_audio_stream(pipe_ctx);
drivers/gpu/drm/amd/display/dc/hwss/dcn314/dcn314_hwseq.c +3 -5
index 583007c1fee3..de7dde2b036b 100644
@@ -531,11 +531,9 @@ void dcn314_disable_link_output(struct dc_link *link,
 		link->dc->hwss.edp_backlight_control(link, false);
 	else if (dmcu != NULL && dmcu->funcs->lock_phy)
 		dmcu->funcs->lock_phy(dmcu);
-	if (!(signal == SIGNAL_TYPE_EDP &&
-		link->forced_psr_active)) {
-		link_hwss->disable_link_output(link, link_res, signal);
-		link->phy_state.symclk_state = SYMCLK_OFF_TX_OFF;
-	}
+
+	link_hwss->disable_link_output(link, link_res, signal);
+	link->phy_state.symclk_state = SYMCLK_OFF_TX_OFF;
 	/*
 	 * Add the logic to extract BOTH power up and power down sequences
 	 * from enable/disable link output and only call edp panel control
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c +2 -5
index e7bf865755d4..9135b01fe388 100644
@@ -1463,11 +1463,8 @@ void dcn32_disable_link_output(struct dc_link *link,
 	else if (dmcu != NULL && dmcu->funcs->lock_phy)
 		dmcu->funcs->lock_phy(dmcu);
 
-	if (!(signal == SIGNAL_TYPE_EDP &&
-		link->forced_psr_active)) {
-		link_hwss->disable_link_output(link, link_res, signal);
-		link->phy_state.symclk_state = SYMCLK_OFF_TX_OFF;
-	}
+	link_hwss->disable_link_output(link, link_res, signal);
+	link->phy_state.symclk_state = SYMCLK_OFF_TX_OFF;
 	/*
 	 * Add the logic to extract BOTH power up and power down sequences
 	 * from enable/disable link output and only call edp panel control
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c +2 -5
index fbf4d0f95c5c..aa047b5b4939 100644
@@ -1849,11 +1849,8 @@ void dcn35_disable_link_output(struct dc_link *link,
 		disable_link_output_symclk_on_tx_off(link, DP_UNKNOWN_ENCODING);
 		link->phy_state.symclk_state = SYMCLK_ON_TX_OFF;
 	} else {
-		if (!(signal == SIGNAL_TYPE_EDP &&
-		      link->forced_psr_active)) {
-			link_hwss->disable_link_output(link, link_res, signal);
-			link->phy_state.symclk_state = SYMCLK_OFF_TX_OFF;
-		}
+		link_hwss->disable_link_output(link, link_res, signal);
+		link->phy_state.symclk_state = SYMCLK_OFF_TX_OFF;
 	}
 	/*
 	 * Add the logic to extract BOTH power up and power down sequences
drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.c +1 -3
index d515b9cbc934..f8254dfe1ce7 100644
@@ -413,9 +413,7 @@ enum dc_status dcn60_apply_single_controller_ctx_to_hw(
 			dc_is_virtual_signal(pipe_ctx->stream->signal)))
 			dc->link_srv->set_dsc_enable(pipe_ctx, true);
 	}
-	if (!stream->dpms_off &&
-	    !(link->connector_signal == SIGNAL_TYPE_EDP &&
-	      link->forced_psr_active))
+	if (!stream->dpms_off)
 		dc->link_srv->set_dpms_on(context, pipe_ctx);
 
 	/* DCN3.1 FPGA Workaround
Signature · 1 line
2.43.0
#9 lore raw

PATCH 9/19 drm/amd/display: Fix linear scaling and upsampling

In reply to [email protected]

From: Sridevi Arvindekar <[email protected]>

[Why/How]
For upsampling/linear scaling case, SPL needs to consider format to be rgb and not yuv.

---
 drivers/gpu/drm/amd/display/dc/sspl/dc_spl.c | 52 +++++++++++---------
 1 file changed, 30 insertions(+), 22 deletions(-)
drivers/gpu/drm/amd/display/dc/sspl/dc_spl.c +30 -22
index f14e3069acfd..1b7ce1a8c59d 100644
@@ -487,15 +487,17 @@ static void spl_calculate_scaling_ratios(struct spl_in *spl_in,
 	spl_scratch->scl_data.ratios.horz_c = spl_scratch->scl_data.ratios.horz;
 	spl_scratch->scl_data.ratios.vert_c = spl_scratch->scl_data.ratios.vert;
 
-	if (spl_is_yuv420(spl_in->basic_in.format)) {
-		spl_scratch->scl_data.ratios.horz_c.value /= 2;
-		spl_scratch->scl_data.ratios.vert_c.value /= 2;
-	} else if (spl_is_yuv422(spl_in->basic_in.format)) {
-		if (spl_in->basic_in.rotation == SPL_ROTATION_ANGLE_90 ||
-			spl_in->basic_in.rotation == SPL_ROTATION_ANGLE_270)
-			spl_scratch->scl_data.ratios.vert_c.value /= 2;
-		else
+	if (!spl_in->upsp_mode) {
+		if (spl_is_yuv420(spl_in->basic_in.format)) {
 			spl_scratch->scl_data.ratios.horz_c.value /= 2;
+			spl_scratch->scl_data.ratios.vert_c.value /= 2;
+		} else if (spl_is_yuv422(spl_in->basic_in.format)) {
+			if (spl_in->basic_in.rotation == SPL_ROTATION_ANGLE_90 ||
+				spl_in->basic_in.rotation == SPL_ROTATION_ANGLE_270)
+				spl_scratch->scl_data.ratios.vert_c.value /= 2;
+			else
+				spl_scratch->scl_data.ratios.horz_c.value /= 2;
+		}
 	}
 	spl_scratch->scl_data.ratios.horz = spl_fixpt_truncate(
 			spl_scratch->scl_data.ratios.horz, 19);
@@ -669,7 +671,8 @@ static void spl_calculate_inits_and_viewports(struct spl_in *spl_in,
 			&flip_vert_scan_dir,
 			&flip_horz_scan_dir);
 
-	if (spl_is_subsampled_format(spl_in->basic_in.format)) {
+	if (spl_is_subsampled_format(spl_in->basic_in.format) &&
+			!spl_in->upsp_mode) {
 		/* this gives the direction of the cositing (negative will move
 		 * left, right otherwise)
 		 */
@@ -804,6 +807,9 @@ static enum scl_mode spl_get_dscl_mode(const struct spl_in *spl_in,
 			&& !enable_isharp)
 		return SCL_MODE_SCALING_444_BYPASS;
 
+	if (spl_in->upsp_mode)
+		return SCL_MODE_SCALING_444_RGB_ENABLE;
+
 	if (!spl_is_subsampled_format(pixel_format)) {
 		if (spl_is_video_format(pixel_format))
 			return SCL_MODE_SCALING_444_YCBCR_ENABLE;
@@ -824,9 +830,9 @@ static enum scl_mode spl_get_dscl_mode(const struct spl_in *spl_in,
 }
 
 static void spl_choose_lls_policy(enum spl_pixel_format format,
-	enum linear_light_scaling *lls_pref)
+	enum linear_light_scaling *lls_pref, enum upsp_mode upsp_mode)
 {
-	if (spl_is_subsampled_format(format))
+	if (spl_is_subsampled_format(format) && !upsp_mode)
 		*lls_pref = LLS_PREF_NO;
 	else /* RGB or YUV444 */
 		*lls_pref = LLS_PREF_YES;
@@ -858,7 +864,7 @@ static bool enable_easf(struct spl_in *spl_in, struct spl_scratch *spl_scratch)
 	 */
 	if (spl_in->lls_pref == LLS_PREF_DONT_CARE)
 		spl_choose_lls_policy(spl_in->basic_in.format,
-			&spl_in->lls_pref);
+			&spl_in->lls_pref, spl_in->upsp_mode);
 
 	/* Check for linear scaling or EASF preferred */
 	if (spl_in->lls_pref != LLS_PREF_YES && !spl_in->prefer_easf)
@@ -1009,8 +1015,8 @@ static bool spl_get_optimal_number_of_taps(
 	unsigned int min_taps_y, min_taps_c;
 	enum lb_memory_config lb_config;
 	bool skip_easf          = false;
-	bool is_horz_subsampled = spl_is_subsampled_format(spl_in->basic_in.format);
-	bool is_vert_subsampled = spl_is_yuv420(spl_in->basic_in.format);
+	bool is_horz_subsampled = (spl_is_subsampled_format(spl_in->basic_in.format) && !spl_in->upsp_mode);
+	bool is_vert_subsampled = (spl_is_yuv420(spl_in->basic_in.format) && !spl_in->upsp_mode);
 
 	if (spl_scratch->scl_data.viewport.width > spl_scratch->scl_data.h_active &&
 		max_downscale_src_width != 0 &&
@@ -1043,7 +1049,8 @@ static bool spl_get_optimal_number_of_taps(
 		spl_get_taps_non_adaptive_scaler(spl_scratch, in_taps, is_horz_subsampled, is_vert_subsampled);
 	}
 	else {
-		if (spl_is_subsampled_format(spl_in->basic_in.format)) {
+		if (spl_is_subsampled_format(spl_in->basic_in.format) &&
+				!spl_in->upsp_mode) {
 			spl_scratch->scl_data.taps.h_taps = 6;
 			spl_scratch->scl_data.taps.v_taps = 6;
 			spl_scratch->scl_data.taps.h_taps_c = 4;
@@ -1213,9 +1220,10 @@ static bool spl_get_optimal_number_of_taps(
 }
 
 static void spl_set_black_color_data(enum spl_pixel_format format,
-			struct scl_black_color *scl_black_color)
+		struct scl_black_color *scl_black_color,
+		enum upsp_mode upsp_mode)
 {
-	bool ycbcr = spl_is_video_format(format);
+	bool ycbcr = (spl_is_video_format(format) && !upsp_mode);
 	if (ycbcr)	{
 		scl_black_color->offset_rgb_y = BLACK_OFFSET_RGB_Y;
 		scl_black_color->offset_rgb_cbcr = BLACK_OFFSET_CBCR;
@@ -1298,8 +1306,8 @@ static void spl_set_dscl_prog_data(struct spl_in *spl_in, struct spl_scratch *sp
 		enable_easf);
 
 	// SCL_BLACK_COLOR
-	spl_set_black_color_data(spl_in->basic_in.format, scl_black_color);
-
+	spl_set_black_color_data(spl_in->basic_in.format, scl_black_color,
+			spl_in->upsp_mode);
 	/* Manually calculate scale ratio and init values */
 	spl_set_manual_ratio_init_data(dscl_prog_data, data);
 
@@ -1358,7 +1366,7 @@ static void spl_calculate_c0_c3_hdr(struct dscl_prog_data *dscl_prog_data, uint3
 static void spl_set_easf_data(struct spl_scratch *spl_scratch, struct spl_out *spl_out, bool enable_easf_v,
 	bool enable_easf_h, enum linear_light_scaling lls_pref,
 	enum spl_pixel_format format, enum system_setup setup,
-	uint32_t sdr_white_level_nits)
+	uint32_t sdr_white_level_nits, enum upsp_mode upsp_mode)
 {
 	struct dscl_prog_data *dscl_prog_data = spl_out->dscl_prog_data;
 	if (enable_easf_v) {
@@ -1689,7 +1697,7 @@ static void spl_set_easf_data(struct spl_scratch *spl_scratch, struct spl_out *s
 			0x0;	// fp1.5.10, C3 coefficient
 	}
 
-	if (spl_is_subsampled_format(format)) { /* TODO: 0 = RGB, 1 = YUV */
+	if (spl_is_subsampled_format(format) && !upsp_mode) { /* TODO: 0 = RGB, 1 = YU//V */
 		dscl_prog_data->easf_matrix_mode = 1;
 		/*
 		 * 2-bit, BF3 chroma mode correction calculation mode
@@ -2073,7 +2081,7 @@ bool SPL_NAMESPACE(spl_calculate_scaler_params(struct spl_in *spl_in, struct spl
 
 	// Set EASF
 	spl_set_easf_data(&spl_scratch, spl_out, enable_easf_v, enable_easf_h, spl_in->lls_pref,
-		spl_in->basic_in.format, setup, spl_in->sdr_white_level_nits);
+		spl_in->basic_in.format, setup, spl_in->sdr_white_level_nits, spl_in->upsp_mode);
 
 	// Set iSHARP
 	vratio = spl_fixpt_ceil(spl_scratch.scl_data.ratios.vert);
Signature · 1 line
2.43.0
#10 lore raw

PATCH 10/19 drm/amd/display: Update DCN42 cstate latencies

In reply to [email protected]

From: Ovidiu Bunea <[email protected]>

[WHY]
New cstate exit latency measurements from DCN IPSE for DCN42.

[HOW]
Update stutter latencies in the DCN42 soc bb:
- LPDDR5: exit 13.5us, enter plus exit 15.5us
- DDR5: exit 23.0us, enter plus exit 25.0us

Pstate change latency is already 36us for both.

---
 .../dc/dml2_0/dml21/inc/bounding_boxes/dcn42_soc_bb.h     | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/inc/bounding_boxes/dcn42_soc_bb.h +4 -4
index 04c5f09499ac..139e0152fcd6 100644
@@ -192,8 +192,8 @@ static const struct dml2_soc_bb dml2_socbb_dcn42 = {
 		.dram_clk_change_blackout_us = 36,
 		.fclk_change_blackout_us = 0,
 		.g7_ppt_blackout_us = 0,
-		.stutter_enter_plus_exit_latency_us = 14,
-		.stutter_exit_latency_us = 12,
+		.stutter_enter_plus_exit_latency_us = 15.5,
+		.stutter_exit_latency_us = 13.5,
 		.z8_stutter_enter_plus_exit_latency_us = 300,
 		.z8_stutter_exit_latency_us = 200,
 	},
@@ -224,8 +224,8 @@ static struct dml2_soc_power_management_parameters dcn42_ddr5_power_management_p
 	.dram_clk_change_blackout_us = 36,
 	.fclk_change_blackout_us = 0,
 	.g7_ppt_blackout_us = 0,
-	.stutter_enter_plus_exit_latency_us = 23.5,
-	.stutter_exit_latency_us = 21.5,
+	.stutter_enter_plus_exit_latency_us = 25.0,
+	.stutter_exit_latency_us = 23.0,
 	.z8_stutter_enter_plus_exit_latency_us = 300,
 	.z8_stutter_exit_latency_us = 200,
 };
Signature · 1 line
2.43.0
#11 lore raw

PATCH 11/19 drm/amd/display: Invalidate the DRR shadow after a hardware re-init

In reply to [email protected]

From: Aric Cyr <[email protected]>

[Why]
dc_stream_adjust_vmin_vmax() skips hardware programming when stream->adjust already matches the request and timing_adjust_pending is clear. That treats stream->adjust as a faithful shadow of the OTG, but dc_set_power_state(D0) calls init_hw(),
which returns OTG_V_TOTAL_MIN/MAX and the static screen triggers to their reset defaults without touching any stream. After an S3/S4 resume or a GPU reset the shadow claims hardware is current when it is not.

A resume that reuses the same stream object also short-circuits dc_commit_streams() on !streams_changed(), so enable_stream_timing() never runs either and nothing reprograms DRR. Replay then fails to arm:
the static screen trigger is at its reset value and the coasting vtotal no longer matches the OTG.

The max_v_total overflow path has a second problem. When OTG v_count halt is not allowed it stores the new values and marks the adjustment pending even though nothing was programmed, and no later call with the same values can clear that flag.

[How]
Add invalidate_drr_adjust() to mark every stream in current_state as having a pending timing adjustment, and call it once hardware has been re-initialized in dc_set_power_state(),
so the next dc_stream_adjust_vmin_vmax() reprograms the OTG.

Hoist the max_v_total check above the point where stream->adjust is updated and return early when v_count halt is not allowed, leaving the shadow describing the OTG instead of latching a flag nothing can clear. On the paths that do update stream->adjust, set the flag up front and clear it only after set_long_vtotal() or set_drr() has actually run.

---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 43 +++++++++++++++++++-----
 1 file changed, 34 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +34 -9
index ef876a24afc2..05e8fcc710e3 100644
@@ -446,6 +446,21 @@ static bool set_long_vtotal(struct dc *dc, struct dc_stream_state *stream, struc
 	return false;
 }
 
+/* A hardware re-init resets the OTG DRR registers while stream->adjust keeps the
+ * pre-reset values, so those values represent has to be marked stale.
+ */
+static void invalidate_drr_adjust(struct dc *dc)
+{
+	int i;
+
+	if (!dc->current_state)
+		return;
+
+	for (i = 0; i < dc->current_state->stream_count; i++)
+		if (dc->current_state->streams[i])
+			dc->current_state->streams[i]->adjust.timing_adjust_pending = true;
+}
+
 /**
  * dc_stream_get_last_used_drr_vtotal - Looks up the pipe context of
  * dc_stream_state and gets the last VTOTAL used by DRR (Dynamic Refresh Rate)
@@ -1343,6 +1358,9 @@ bool dc_stream_adjust_vmin_vmax(struct dc *dc,
 {
 	int i;
 	bool drr_unchanged;
+	bool exceeds_max_v_total = dc->caps.max_v_total != 0 &&
+			(adjust->v_total_max > dc->caps.max_v_total ||
+			 adjust->v_total_min > dc->caps.max_v_total);
 
 	/*
 	 * Don't adjust DRR while there's bandwidth optimizations pending to
@@ -1370,6 +1388,12 @@ bool dc_stream_adjust_vmin_vmax(struct dc *dc,
 	if (drr_unchanged)
 		return true;
 
+	/* leave stream->adjust describing the OTG rather than latching
+	 * a pending adjustment that no later call can ever clear.
+	 */
+	if (exceeds_max_v_total && !adjust->allow_otg_v_count_halt)
+		return false;
+
 	dc_exit_ips_for_hw_access(dc);
 
 	stream->adjust.v_total_max = adjust->v_total_max;
@@ -1377,16 +1401,15 @@ bool dc_stream_adjust_vmin_vmax(struct dc *dc,
 	stream->adjust.v_total_mid_frame_num = adjust->v_total_mid_frame_num;
 	stream->adjust.v_total_min = adjust->v_total_min;
 	stream->adjust.allow_otg_v_count_halt = adjust->allow_otg_v_count_halt;
+	/* Only cleared once the new values have actually reached an OTG. */
+	stream->adjust.timing_adjust_pending = true;
 
-	if (dc->caps.max_v_total != 0 &&
-		(adjust->v_total_max > dc->caps.max_v_total || adjust->v_total_min > dc->caps.max_v_total)) {
-		if (adjust->allow_otg_v_count_halt) {
-			stream->adjust.timing_adjust_pending = false;
-			return set_long_vtotal(dc, stream, adjust);
-		}
-		/* Nothing reached hw, so stream->adjust no longer describes the OTG. */
-		stream->adjust.timing_adjust_pending = true;
-		return false;
+	if (exceeds_max_v_total) {
+		if (!set_long_vtotal(dc, stream, adjust))
+			return false;
+
+		stream->adjust.timing_adjust_pending = false;
+		return true;
 	}
 
 	for (i = 0; i < MAX_PIPES; i++) {
@@ -6310,6 +6333,8 @@ void dc_set_power_state(struct dc *dc, enum dc_acpi_cm_power_state power_state)
 
 		dc->hwss.init_hw(dc);
 
+		invalidate_drr_adjust(dc);
+
 		if (dc->hwss.init_sys_ctx != NULL &&
 			dc->vm_pa_config.valid) {
 			dc->hwss.init_sys_ctx(dc->hwseq, dc, &dc->vm_pa_config);
Signature · 1 line
2.43.0
#12 lore raw

PATCH 12/19 drm/amd/display: Program HDR visual confirm based on per pipe info

In reply to [email protected]

From: Alvin Lee <[email protected]>

[Description]
HDR visual confirm should be programmed based on per-pipe info, not top pipe info. There exists scenarios where an HDR app has a desktop plane still active (due to SW cursor) which is ARGB8888. Taking the top pipe info will give the wrong visual confirm color.

---
 .../drm/amd/display/dc/core/dc_hw_sequencer.c    | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +5 -11
index f881a3be6f0a..d6177463c0a0 100644
@@ -450,18 +450,12 @@ void get_hdr_visual_confirm_color(
 	uint32_t color_value = MAX_TG_COLOR_VALUE;
 	bool is_sdr = false;
 
-	/* Determine the overscan color based on the top-most (desktop) plane's context */
-	struct pipe_ctx *top_pipe_ctx  = pipe_ctx;
-
-	while (top_pipe_ctx->top_pipe != NULL)
-		top_pipe_ctx = top_pipe_ctx->top_pipe;
-
-	switch (top_pipe_ctx->plane_res.scl_data.format) {
+	switch (pipe_ctx->plane_res.scl_data.format) {
 	case PIXEL_FORMAT_ARGB2101010:
-		if (top_pipe_ctx->stream->out_transfer_func.tf == TRANSFER_FUNCTION_PQ) {
+		if (pipe_ctx->stream->out_transfer_func.tf == TRANSFER_FUNCTION_PQ) {
 			/* HDR10, ARGB2101010 - set border color to red */
 			color->color_r_cr = (uint16_t)color_value;
-		} else if (top_pipe_ctx->stream->out_transfer_func.tf == TRANSFER_FUNCTION_GAMMA22) {
+		} else if (pipe_ctx->stream->out_transfer_func.tf == TRANSFER_FUNCTION_GAMMA22) {
 			/* FreeSync 2 ARGB2101010 - set border color to pink */
 			color->color_r_cr = (uint16_t)color_value;
 			color->color_b_cb = (uint16_t)color_value;
@@ -469,10 +463,10 @@ void get_hdr_visual_confirm_color(
 			is_sdr = true;
 		break;
 	case PIXEL_FORMAT_FP16:
-		if (top_pipe_ctx->stream->out_transfer_func.tf == TRANSFER_FUNCTION_PQ) {
+		if (pipe_ctx->stream->out_transfer_func.tf == TRANSFER_FUNCTION_PQ) {
 			/* HDR10, FP16 - set border color to blue */
 			color->color_b_cb = (uint16_t)color_value;
-		} else if (top_pipe_ctx->stream->out_transfer_func.tf == TRANSFER_FUNCTION_GAMMA22) {
+		} else if (pipe_ctx->stream->out_transfer_func.tf == TRANSFER_FUNCTION_GAMMA22) {
 			/* FreeSync 2 HDR - set border color to green */
 			color->color_g_y = (uint16_t)color_value;
 		} else
Signature · 1 line
2.43.0
#13 lore raw

PATCH 13/19 drm/amd/display: Split link_set_dsc_on_stream into encoder and DSC components

In reply to [email protected]

From: George Shen <[email protected]>

[Why]
DSC block programming should be independent from link programming. This should be refactored such that DSC block programming is in HWSS.

[How]
The first step to the refactor is to split the existing logic into the encoder portion and the DSC block portion.

---
 .../gpu/drm/amd/display/dc/link/link_dpms.c   | 275 ++++++++++--------
 1 file changed, 159 insertions(+), 116 deletions(-)
drivers/gpu/drm/amd/display/dc/link/link_dpms.c +159 -116
index 0d3b65d40807..ef577e0e5215 100644
@@ -717,21 +717,94 @@ static bool dp_set_hblank_reduction_on_rx(struct pipe_ctx *pipe_ctx)
 	return result;
 }
 
+/* TODO - There is overlapping functionality between link_set_dsc_pps_packet,
+ * and set_encoder_dsc_config, the two functions should be refactored to avoid code duplication.
+ */
+static void set_encoder_dsc_config(struct pipe_ctx *pipe_ctx,
+		struct dsc_config *dsc_cfg,
+		struct dsc_optc_config *dsc_optc_cfg,
+		bool enable)
+{
+	struct dc *dc = pipe_ctx->stream->ctx->dc;
+	struct display_stream_compressor *dsc = pipe_ctx->stream_res.dsc;
+	struct dc_stream_state *stream = pipe_ctx->stream;
+	enum optc_dsc_mode optc_dsc_mode;
+	int odm_count = 1;
+	struct pipe_ctx *odm_pipe;
+	DC_LOGGER_INIT(dsc->ctx->logger);
 
-/* The stream with these settings can be sent (unblanked) only after DSC was enabled on RX first,
- * i.e. after dp_enable_dsc_on_rx() had been called
+	for (odm_pipe = pipe_ctx->next_odm_pipe; odm_pipe; odm_pipe = odm_pipe->next_odm_pipe)
+		odm_count++;
+
+	if (enable) {
+		optc_dsc_mode = dsc_optc_cfg->is_pixel_format_444 ?
+				OPTC_DSC_ENABLED_444 : OPTC_DSC_ENABLED_NATIVE_SUBSAMPLED;
+
+		if (dc_is_dp_signal(stream->signal) && !dp_is_128b_132b_signal(pipe_ctx)) {
+			DC_LOG_DSC("Setting stream encoder DSC config for engine %d:", (int)pipe_ctx->stream_res.stream_enc->id);
+			dsc_optc_config_log(dsc, dsc_optc_cfg);
+			if (pipe_ctx->stream_res.stream_enc->funcs->dp_set_dsc_config)
+				pipe_ctx->stream_res.stream_enc->funcs->dp_set_dsc_config(pipe_ctx->stream_res.stream_enc,
+										optc_dsc_mode,
+										dsc_optc_cfg->bytes_per_pixel,
+										dsc_optc_cfg->slice_width);
+
+			/* PPS SDP is set elsewhere because it has to be done after DIG FE is connected to DIG BE */
+		} else if (dc_is_hdmi_frl_signal(stream->signal)) {
+			uint8_t dsc_packed_pps[128];
+			struct dc_crtc_timing patched_crtc_timing = stream->timing;
+
+			DC_LOG_DSC("Setting stream encoder DSC config for engine %d:", (int)pipe_ctx->stream_res.hpo_frl_stream_enc->id);
+			dsc_optc_config_log(dsc, dsc_optc_cfg);
+			dsc_cfg->dc_dsc_cfg.num_slices_h *= odm_count;
+			dsc_cfg->pic_width *= odm_count;
+			dsc_cfg->dsc_padding = pipe_ctx->dsc_padding_params.dsc_hactive_padding;
+			if (dc->debug.enable_hblank_borrow)
+				dsc_cfg->pic_width = stream->timing.h_addressable;
+			dsc->funcs->dsc_get_packed_pps(dsc, dsc_cfg, &dsc_packed_pps[0]);
+			pipe_ctx->stream_res.hpo_frl_stream_enc->funcs->hdmi_frl_set_dsc_config(
+					pipe_ctx->stream_res.hpo_frl_stream_enc, &patched_crtc_timing, &dsc_packed_pps[0]);
+		}
+
+		return;
+	}
+
+	if (dc_is_dp_signal(stream->signal)) {
+		if (dp_is_128b_132b_signal(pipe_ctx))
+			pipe_ctx->stream_res.hpo_dp_stream_enc->funcs->dp_set_dsc_pps_info_packet(
+										pipe_ctx->stream_res.hpo_dp_stream_enc,
+										false,
+										NULL,
+										true);
+		else {
+			if (pipe_ctx->stream_res.stream_enc->funcs->dp_set_dsc_config)
+				pipe_ctx->stream_res.stream_enc->funcs->dp_set_dsc_config(
+							pipe_ctx->stream_res.stream_enc,
+							OPTC_DSC_DISABLED, 0, 0);
+			pipe_ctx->stream_res.stream_enc->funcs->dp_set_dsc_pps_info_packet(
+							pipe_ctx->stream_res.stream_enc, false, NULL, true);
+		}
+	} else if (dc_is_hdmi_frl_signal(stream->signal)) {
+		pipe_ctx->stream_res.hpo_frl_stream_enc->funcs->hdmi_frl_set_dsc_config(
+				pipe_ctx->stream_res.hpo_frl_stream_enc, &stream->timing, NULL);
+	}
+}
+
+/* Legacy implementation of DSC configuration sequence. DSC HW block programming
+ * is independent of stream encoder and link configuration operations, and should
+ * be configured separately during front-end programming, not within link DPMS sequences.
  */
-void link_set_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable)
+static bool configure_dsc_hw_block(struct pipe_ctx *pipe_ctx, bool enable,
+		struct dsc_config *dsc_cfg, struct dsc_optc_config *dsc_optc_cfg)
 {
-	/* TODO: Move this to HWSS as this is hardware programming sequence not a
-	 * link layer sequence
-	 */
 	struct display_stream_compressor *dsc = pipe_ctx->stream_res.dsc;
 	struct dc *dc = pipe_ctx->stream->ctx->dc;
 	struct dc_stream_state *stream = pipe_ctx->stream;
 	struct pipe_ctx *odm_pipe;
-	int opp_cnt = 1;
 	struct dccg *dccg = dc->res_pool->dccg;
+	int opp_cnt = 1;
+	DC_LOGGER_INIT(dsc->ctx->logger);
+
 	/* It has been found that when DSCCLK is lower than 16Mhz, we will get DCN
 	 * register access hung. When DSCCLk is based on refclk, DSCCLk is always a
 	 * fixed value higher than 16Mhz so the issue doesn't occur. When DSCCLK is
@@ -741,35 +814,34 @@ void link_set_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable)
 	 * based on fixed value refclk when timing is smaller than 3x16Mhz (i.e
 	 * 48Mhz) pixel clock to avoid hitting this problem.
 	 */
-	bool should_use_dto_dscclk = (dccg->funcs->set_dto_dscclk != NULL) &&
+	bool should_use_dto_dscclk = dccg->funcs->set_dto_dscclk &&
 			stream->timing.pix_clk_100hz > 480000;
-	DC_LOGGER_INIT(dsc->ctx->logger);
 
 	for (odm_pipe = pipe_ctx->next_odm_pipe; odm_pipe; odm_pipe = odm_pipe->next_odm_pipe)
 		opp_cnt++;
 
 	if (enable) {
-		struct dsc_config dsc_cfg;
-		struct dsc_optc_config dsc_optc_cfg = {0};
 		enum optc_dsc_mode optc_dsc_mode;
+		memset(dsc_cfg, 0, sizeof(*dsc_cfg));
+		memset(dsc_optc_cfg, 0, sizeof(*dsc_optc_cfg));
 
 		/* Enable DSC hw block */
-		dsc_cfg.pic_width = (stream->timing.h_addressable + pipe_ctx->dsc_padding_params.dsc_hactive_padding +
+		dsc_cfg->pic_width = (stream->timing.h_addressable + pipe_ctx->dsc_padding_params.dsc_hactive_padding +
 				stream->timing.h_border_left + stream->timing.h_border_right) / opp_cnt;
-		dsc_cfg.pic_height = stream->timing.v_addressable + stream->timing.v_border_top + stream->timing.v_border_bottom;
-		dsc_cfg.pixel_encoding = stream->timing.pixel_encoding;
-		dsc_cfg.color_depth = stream->timing.display_color_depth;
-		dsc_cfg.is_odm = pipe_ctx->next_odm_pipe ? true : false;
-		dsc_cfg.dc_dsc_cfg = stream->timing.dsc_cfg;
-		ASSERT(dsc_cfg.dc_dsc_cfg.num_slices_h % opp_cnt == 0);
-		dsc_cfg.dc_dsc_cfg.num_slices_h /= opp_cnt;
-		dsc_cfg.dsc_padding = 0;
+		dsc_cfg->pic_height = stream->timing.v_addressable + stream->timing.v_border_top + stream->timing.v_border_bottom;
+		dsc_cfg->pixel_encoding = stream->timing.pixel_encoding;
+		dsc_cfg->color_depth = stream->timing.display_color_depth;
+		dsc_cfg->is_odm = pipe_ctx->next_odm_pipe != NULL;
+		dsc_cfg->dc_dsc_cfg = stream->timing.dsc_cfg;
+		ASSERT(dsc_cfg->dc_dsc_cfg.num_slices_h % opp_cnt == 0);
+		dsc_cfg->dc_dsc_cfg.num_slices_h /= opp_cnt;
+		dsc_cfg->dsc_padding = 0;
 
 		if (should_use_dto_dscclk)
-			dccg->funcs->set_dto_dscclk(dccg, dsc->inst, dsc_cfg.dc_dsc_cfg.num_slices_h);
-		if (!dsc->funcs->dsc_prepare_config(dsc, &dsc_cfg, &dsc_optc_cfg)) {
+			dccg->funcs->set_dto_dscclk(dccg, dsc->inst, dsc_cfg->dc_dsc_cfg.num_slices_h);
+		if (!dsc->funcs->dsc_prepare_config(dsc, dsc_cfg, dsc_optc_cfg)) {
 			ASSERT(false);
-			return;
+			return false;
 		}
 		dsc->funcs->dsc_set_config(dsc);
 		dsc->funcs->dsc_enable(dsc, pipe_ctx->stream_res.opp->inst);
@@ -778,113 +850,84 @@ void link_set_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable)
 
 			ASSERT(odm_dsc);
 			if (!odm_dsc)
-				return;
+				return false;
 			if (should_use_dto_dscclk)
-				dccg->funcs->set_dto_dscclk(dccg, odm_dsc->inst, dsc_cfg.dc_dsc_cfg.num_slices_h);
-			if (!odm_dsc->funcs->dsc_prepare_config(odm_dsc, &dsc_cfg, &dsc_optc_cfg)) {
+				dccg->funcs->set_dto_dscclk(dccg, odm_dsc->inst,
+						dsc_cfg->dc_dsc_cfg.num_slices_h);
+			if (!odm_dsc->funcs->dsc_prepare_config(odm_dsc, dsc_cfg, dsc_optc_cfg)) {
 				ASSERT(false);
-				return;
+				return false;
 			}
 			odm_dsc->funcs->dsc_set_config(odm_dsc);
 			odm_dsc->funcs->dsc_enable(odm_dsc, odm_pipe->stream_res.opp->inst);
 		}
-		dsc_cfg.dc_dsc_cfg.num_slices_h *= opp_cnt;
-		dsc_cfg.pic_width *= opp_cnt;
-		dsc_cfg.dsc_padding = pipe_ctx->dsc_padding_params.dsc_hactive_padding;
+		optc_dsc_mode = dsc_optc_cfg->is_pixel_format_444 ? OPTC_DSC_ENABLED_444 : OPTC_DSC_ENABLED_NATIVE_SUBSAMPLED;
 
-		optc_dsc_mode = dsc_optc_cfg.is_pixel_format_444 ? OPTC_DSC_ENABLED_444 : OPTC_DSC_ENABLED_NATIVE_SUBSAMPLED;
+		/* Enable DSC in OPTC */
+		DC_LOG_DSC("Setting optc DSC config for tg instance %d:", pipe_ctx->stream_res.tg->inst);
+		dsc_optc_config_log(dsc, dsc_optc_cfg);
+		pipe_ctx->stream_res.tg->funcs->set_dsc_config(pipe_ctx->stream_res.tg,
+							optc_dsc_mode,
+							dsc_optc_cfg->bytes_per_pixel,
+							dsc_optc_cfg->slice_width);
+		return true;
+	}
 
-		/* Enable DSC in encoder */
-		if (dc_is_dp_signal(stream->signal) && !dp_is_128b_132b_signal(pipe_ctx)) {
-			DC_LOG_DSC("Setting stream encoder DSC config for engine %d:", (int)pipe_ctx->stream_res.stream_enc->id);
-			dsc_optc_config_log(dsc, &dsc_optc_cfg);
-			if (pipe_ctx->stream_res.stream_enc->funcs->dp_set_dsc_config)
-				pipe_ctx->stream_res.stream_enc->funcs->dp_set_dsc_config(pipe_ctx->stream_res.stream_enc,
-										optc_dsc_mode,
-										dsc_optc_cfg.bytes_per_pixel,
-										dsc_optc_cfg.slice_width);
+	/* disable DSC in OPTC */
+	pipe_ctx->stream_res.tg->funcs->set_dsc_config(
+			pipe_ctx->stream_res.tg,
+			OPTC_DSC_DISABLED, 0, 0);
 
-			/* PPS SDP is set elsewhere because it has to be done after DIG FE is connected to DIG BE */
-		}
-		else if (dc_is_hdmi_frl_signal(stream->signal)) {
-			uint8_t dsc_packed_pps[128];
-			struct dc_crtc_timing patched_crtc_timing = stream->timing;
+	for (odm_pipe = pipe_ctx; odm_pipe; odm_pipe = odm_pipe->next_odm_pipe) {
+		odm_pipe->stream_res.dsc->funcs->dsc_disconnect(odm_pipe->stream_res.dsc);
 
-			DC_LOG_DSC("Setting stream encoder DSC config for engine %d:", (int)pipe_ctx->stream_res.hpo_frl_stream_enc->id);
-			dsc_optc_config_log(dsc, &dsc_optc_cfg);
+		/*
+		 * dsc_disconnect is a double buffered register.
+		 * by the time we call dsc_disable, dsc may still remain
+		 * connected to OPP. In this case OPTC will no longer
+		 * get correct pixel data because DSCC is off. However
+		 * we also can't wait for the  disconnect pending
+		 * complete, because this function can be called
+		 * with/without OTG master lock acquired. When the lock
+		 * is acquired we will never get pending complete until
+		 * we release the lock later. So there is no easy way to
+		 * solve this problem especially when the lock is
+		 * acquired. DSC is a front end hw block it should be
+		 * programmed as part of front end sequence, where the
+		 * commit sequence without lock and update sequence
+		 * with lock are completely separated. However because
+		 * we are programming dsc as part of back end link
+		 * programming sequence, we don't know if front end OPTC
+		 * master lock is acquired. The back end should be
+		 * agnostic to front end lock. DSC programming shouldn't
+		 * belong to this sequence.
+		 */
+		odm_pipe->stream_res.dsc->funcs->dsc_disable(odm_pipe->stream_res.dsc);
+		if (dccg->funcs->set_ref_dscclk)
+			dccg->funcs->set_ref_dscclk(dccg, odm_pipe->stream_res.dsc->inst);
+	}
+	return true;
+}
 
-			/* if we are borrowing from hblank, h_addressable and  pic_width need to be adjusted */
-			if (dc->debug.enable_hblank_borrow) {
-				dsc_cfg.pic_width = stream->timing.h_addressable;
-			}
+/* The stream with these settings can be sent (unblanked) only after DSC was enabled on RX first,
+ * i.e. after dp_enable_dsc_on_rx() had been called
+ */
+void link_set_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable)
+{
+	struct dsc_config dsc_cfg = {0};
+	struct dsc_optc_config dsc_optc_cfg = {0};
 
-			dsc->funcs->dsc_get_packed_pps(dsc, &dsc_cfg, &dsc_packed_pps[0]);
-			pipe_ctx->stream_res.hpo_frl_stream_enc->funcs->hdmi_frl_set_dsc_config(
-					pipe_ctx->stream_res.hpo_frl_stream_enc, &patched_crtc_timing, &dsc_packed_pps[0]);
-		}
+	if (!pipe_ctx->stream_res.dsc) {
+		ASSERT(false);
+		return;
+	}
 
-		/* Enable DSC in OPTC */
-		DC_LOG_DSC("Setting optc DSC config for tg instance %d:", pipe_ctx->stream_res.tg->inst);
-		dsc_optc_config_log(dsc, &dsc_optc_cfg);
-		pipe_ctx->stream_res.tg->funcs->set_dsc_config(pipe_ctx->stream_res.tg,
-							optc_dsc_mode,
-							dsc_optc_cfg.bytes_per_pixel,
-							dsc_optc_cfg.slice_width);
+	if (enable) {
+		if (configure_dsc_hw_block(pipe_ctx, true, &dsc_cfg, &dsc_optc_cfg))
+			set_encoder_dsc_config(pipe_ctx, &dsc_cfg, &dsc_optc_cfg, true);
 	} else {
-		/* disable DSC in OPTC */
-		pipe_ctx->stream_res.tg->funcs->set_dsc_config(
-				pipe_ctx->stream_res.tg,
-				OPTC_DSC_DISABLED, 0, 0);
-
-		/* disable DSC in stream encoder */
-		if (dc_is_dp_signal(stream->signal)) {
-			if (dp_is_128b_132b_signal(pipe_ctx))
-				pipe_ctx->stream_res.hpo_dp_stream_enc->funcs->dp_set_dsc_pps_info_packet(
-										pipe_ctx->stream_res.hpo_dp_stream_enc,
-										false,
-										NULL,
-										true);
-			else {
-				if (pipe_ctx->stream_res.stream_enc->funcs->dp_set_dsc_config)
-					pipe_ctx->stream_res.stream_enc->funcs->dp_set_dsc_config(
-							pipe_ctx->stream_res.stream_enc,
-							OPTC_DSC_DISABLED, 0, 0);
-				pipe_ctx->stream_res.stream_enc->funcs->dp_set_dsc_pps_info_packet(
-							pipe_ctx->stream_res.stream_enc, false, NULL, true);
-			}
-		}
-		else if (dc_is_hdmi_frl_signal(stream->signal))
-			pipe_ctx->stream_res.hpo_frl_stream_enc->funcs->hdmi_frl_set_dsc_config(
-					pipe_ctx->stream_res.hpo_frl_stream_enc, &stream->timing, NULL);
-
-		/* disable DSC block */
-		for (odm_pipe = pipe_ctx; odm_pipe; odm_pipe = odm_pipe->next_odm_pipe) {
-			odm_pipe->stream_res.dsc->funcs->dsc_disconnect(odm_pipe->stream_res.dsc);
-			/*
-			 * TODO - dsc_disconnect is a double buffered register.
-			 * by the time we call dsc_disable, dsc may still remain
-			 * connected to OPP. In this case OPTC will no longer
-			 * get correct pixel data because DSCC is off. However
-			 * we also can't wait for the  disconnect pending
-			 * complete, because this function can be called
-			 * with/without OTG master lock acquired. When the lock
-			 * is acquired we will never get pending complete until
-			 * we release the lock later. So there is no easy way to
-			 * solve this problem especially when the lock is
-			 * acquired. DSC is a front end hw block it should be
-			 * programmed as part of front end sequence, where the
-			 * commit sequence without lock and update sequence
-			 * with lock are completely separated. However because
-			 * we are programming dsc as part of back end link
-			 * programming sequence, we don't know if front end OPTC
-			 * master lock is acquired. The back end should be
-			 * agnostic to front end lock. DSC programming shouldn't
-			 * belong to this sequence.
-			 */
-			odm_pipe->stream_res.dsc->funcs->dsc_disable(odm_pipe->stream_res.dsc);
-			if (dccg->funcs->set_ref_dscclk)
-				dccg->funcs->set_ref_dscclk(dccg, odm_pipe->stream_res.dsc->inst);
-		}
+		set_encoder_dsc_config(pipe_ctx, &dsc_cfg, &dsc_optc_cfg, false);
+		configure_dsc_hw_block(pipe_ctx, false, &dsc_cfg, &dsc_optc_cfg);
 	}
 }
 
Signature · 1 line
2.43.0
#14 lore raw

PATCH 14/19 drm/amd/display: Add new config_dsc hwseq function for dcn60

In reply to [email protected]

From: George Shen <[email protected]>

[Why]
The current DSC block programming sequence is intertwined with the stream encoder DSC-related programming. Logically, the programming of the DSC (front end) and stream encoder (back end) blocks should be independent of each other.

[How]
Create a new hwseq function config_dsc to handle the DSC block programming sequence.

---
 .../amd/display/dc/hwss/dcn60/dcn60_hwseq.c   | 95 +++++++++++++++++++
 .../amd/display/dc/hwss/dcn60/dcn60_hwseq.h   |  1 +
 .../amd/display/dc/hwss/dcn60/dcn60_init.c    |  1 +
 .../drm/amd/display/dc/hwss/hw_sequencer.h    |  1 +
 4 files changed, 98 insertions(+)
drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.c +95 -0
index f8254dfe1ce7..e2dddbc170f8 100644
@@ -53,6 +53,101 @@
 #define FN(reg_name, field_name) \
 	hws->shifts->field_name, hws->masks->field_name
 
+bool dcn60_configure_dsc(struct pipe_ctx *pipe_ctx, bool enable)
+{
+	struct display_stream_compressor *dsc = pipe_ctx->stream_res.dsc;
+	struct dc *dc = pipe_ctx->stream->ctx->dc;
+	struct dc_stream_state *stream = pipe_ctx->stream;
+	struct pipe_ctx *odm_pipe;
+	struct dccg *dccg = dc->res_pool->dccg;
+	struct dsc_config dsc_cfg = {0};
+	struct dsc_optc_config dsc_optc_cfg = {0};
+	uint32_t odm_count = 1;
+
+	/* It has been found that when DSCCLK is lower than 16Mhz, we will get DCN
+	 * register access hung. When DSCCLk is based on refclk, DSCCLk is always a
+	 * fixed value higher than 16Mhz so the issue doesn't occur. When DSCCLK is
+	 * generated by DTO, DSCCLK would be based on 1/3 dispclk. For small timings
+	 * with DSC such as 480p60Hz, the dispclk could be low enough to trigger
+	 * this problem. We are implementing a workaround here to keep using dscclk
+	 * based on fixed value refclk when timing is smaller than 3x16Mhz (i.e
+	 * 48Mhz) pixel clock to avoid hitting this problem.
+	 */
+	bool use_dto = dccg->funcs->set_dto_dscclk && stream->timing.pix_clk_100hz > 480000;
+
+	if (!dsc)
+		return false;
+
+	for (odm_pipe = pipe_ctx->next_odm_pipe; odm_pipe; odm_pipe = odm_pipe->next_odm_pipe)
+		odm_count++;
+
+	if (enable) {
+		dsc_cfg.pic_width = (stream->timing.h_addressable +
+				pipe_ctx->dsc_padding_params.dsc_hactive_padding +
+				stream->timing.h_border_left + stream->timing.h_border_right) / odm_count;
+		dsc_cfg.pic_height = stream->timing.v_addressable +
+				stream->timing.v_border_top + stream->timing.v_border_bottom;
+		dsc_cfg.pixel_encoding = stream->timing.pixel_encoding;
+		dsc_cfg.color_depth = stream->timing.display_color_depth;
+		dsc_cfg.is_odm = pipe_ctx->next_odm_pipe != NULL;
+		dsc_cfg.dc_dsc_cfg = stream->timing.dsc_cfg;
+		ASSERT(dsc_cfg.dc_dsc_cfg.num_slices_h % odm_count == 0);
+		dsc_cfg.dc_dsc_cfg.num_slices_h /= odm_count;
+
+		if (use_dto)
+			dccg->funcs->set_dto_dscclk(dccg, dsc->inst,
+					(uint32_t)dsc_cfg.dc_dsc_cfg.num_slices_h);
+		if (!dsc->funcs->dsc_prepare_config(dsc, &dsc_cfg, &dsc_optc_cfg)) {
+			ASSERT(false);
+			return false;
+		}
+		dsc->funcs->dsc_set_config(dsc);
+		dsc->funcs->dsc_enable(dsc, (int)pipe_ctx->stream_res.opp->inst);
+
+		for (odm_pipe = pipe_ctx->next_odm_pipe; odm_pipe; odm_pipe = odm_pipe->next_odm_pipe) {
+			struct display_stream_compressor *odm_dsc = odm_pipe->stream_res.dsc;
+
+			ASSERT(odm_dsc);
+			if (!odm_dsc)
+				return false;
+			if (use_dto)
+				dccg->funcs->set_dto_dscclk(dccg, odm_dsc->inst,
+						(uint32_t)dsc_cfg.dc_dsc_cfg.num_slices_h);
+			if (!odm_dsc->funcs->dsc_prepare_config(odm_dsc, &dsc_cfg, &dsc_optc_cfg)) {
+				ASSERT(false);
+				return false;
+			}
+			odm_dsc->funcs->dsc_set_config(odm_dsc);
+			odm_dsc->funcs->dsc_enable(odm_dsc, (int)odm_pipe->stream_res.opp->inst);
+		}
+
+		{
+			enum optc_dsc_mode mode = dsc_optc_cfg.is_pixel_format_444 ?
+					OPTC_DSC_ENABLED_444 : OPTC_DSC_ENABLED_NATIVE_SUBSAMPLED;
+
+			pipe_ctx->stream_res.tg->funcs->set_dsc_config(
+					pipe_ctx->stream_res.tg, mode,
+					dsc_optc_cfg.bytes_per_pixel, dsc_optc_cfg.slice_width);
+		}
+		return true;
+	}
+
+	pipe_ctx->stream_res.tg->funcs->set_dsc_config(
+			pipe_ctx->stream_res.tg, OPTC_DSC_DISABLED, 0, 0);
+
+	for (odm_pipe = pipe_ctx; odm_pipe; odm_pipe = odm_pipe->next_odm_pipe) {
+		struct display_stream_compressor *odm_dsc = odm_pipe->stream_res.dsc;
+
+		if (!odm_dsc)
+			continue;
+		odm_dsc->funcs->dsc_disconnect(odm_dsc);
+		odm_dsc->funcs->dsc_disable(odm_dsc);
+		if (dccg->funcs->set_ref_dscclk)
+			dccg->funcs->set_ref_dscclk(dccg, (uint32_t)odm_dsc->inst);
+	}
+	return true;
+}
+
 bool dcn60_set_rmcm_luts(struct set_input_transfer_func_params *params)
 {
 	struct dpp *dpp_base = params->dpp;
drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.h +1 -0
index b880988ff1fc..44eb30608feb 100644
@@ -31,5 +31,6 @@ void dcn60_program_perfmon(struct dc *dc, struct dc_state *context);
 bool dcn60_apply_idle_power_optimizations(struct dc *dc, bool enable);
 
 bool dcn60_set_rmcm_luts(struct set_input_transfer_func_params *params);
+bool dcn60_configure_dsc(struct pipe_ctx *pipe_ctx, bool enable);
 
 #endif /* __DC_HWSS_DCN60_H__ */
drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_init.c +1 -0
index 80125c3596ce..7b488753fe50 100644
@@ -25,6 +25,7 @@ static const struct hw_sequencer_funcs dcn60_funcs = {
 	.wait_for_pending_cleared = dcn10_wait_for_pending_cleared,
 	.post_unlock_program_front_end = dcn50_post_unlock_program_front_end,
 	.update_plane_addr = dcn20_update_plane_addr,
+	.configure_dsc = dcn60_configure_dsc,
 	.prepare_plane_addr_update = dcn20_prepare_plane_addr_update,
 	.update_dchub = dcn10_update_dchub,
 	.update_pending_status = dcn10_update_pending_status,
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h +1 -0
index 7de59001453c..8f4ed80385fc 100644
@@ -1413,6 +1413,7 @@ struct hw_sequencer_funcs {
 			struct dc_state *context);
 	void (*update_plane_addr)(const struct dc *dc,
 			struct pipe_ctx *pipe_ctx);
+	bool (*configure_dsc)(struct pipe_ctx *pipe_ctx, bool enable);
 	void (*prepare_plane_addr_update)(const struct dc *dc,
 			struct pipe_ctx *pipe_ctx,
 			struct dc_plane_address *addr_to_program,
Signature · 1 line
2.43.0
#15 lore raw

PATCH 15/19 drm/amd/display: Program DSC prior to OTG enable starting DCN60

In reply to [email protected]

From: George Shen <[email protected]>

[Why]
Current DSC enable sequence is intertwined with the DPMS on sequence. The sequence has become unnecessarily confusing, and resulted in cases where DSC is programmed unexpectedly, or in an incorrect sequence.

Current sequence enables OTG before DSC. After discussing with HW team, there should be no issue with enabling DSC first before OTG.

[How]
Starting with DCN60, skip DSC HW programming in the DPMS sequences.

Add enable DSC function call prior to OTG enable, and similarly for the disable case.

---
 .../amd/display/dc/hwss/dcn401/dcn401_hwseq.c | 18 ++++++++++++++++++
 .../amd/display/dc/hwss/dcn60/dcn60_hwseq.c   |  2 ++
 .../gpu/drm/amd/display/dc/link/link_dpms.c   | 19 ++++++++++++++-----
 3 files changed, 34 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c +18 -0
index d237061236af..a843e216a6b0 100644
@@ -818,6 +818,15 @@ enum dc_status dcn401_enable_stream_timing(
 
 	hws->funcs.blank_pixel_data(dc, pipe_ctx, true);
 
+	/* Legacy code path will enable DSC during DPMS on sequence. Since DSC
+	 * HW block programming is independent from link and stream encoder operations, it
+	 * has moved to hwss and should be called when enabling/disabling OTG.
+	 */
+	if (stream->timing.flags.DSC && pipe_ctx->stream_res.dsc) {
+		if (dc->hwss.configure_dsc)
+			dc->hwss.configure_dsc(pipe_ctx, true);
+	}
+
 	/* VTG is  within DCHUB command block. DCFCLK is always on */
 	if (false == pipe_ctx->stream_res.tg->funcs->enable_crtc(pipe_ctx->stream_res.tg)) {
 		BREAK_TO_DEBUGGER();
@@ -2116,6 +2125,15 @@ void dcn401_reset_back_end_for_pipe(
 
 			pipe_ctx->stream_res.tg->funcs->disable_crtc(pipe_ctx->stream_res.tg);
 
+			/* Legacy code path will enable DSC during DPMS on sequence. Since DSC
+			 * HW block programming is independent from backend operations, it
+			 * has moved to hwss and should be called when enabling/disabling OTG.
+			 */
+			if (pipe_ctx->stream_res.dsc) {
+				if (dc->hwss.configure_dsc)
+					dc->hwss.configure_dsc(pipe_ctx, false);
+			}
+
 			pipe_ctx->stream_res.tg->funcs->enable_optc_clock(pipe_ctx->stream_res.tg, false);
 		}
 		if (pipe_ctx->stream_res.tg->funcs->set_odm_bypass)
drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.c +2 -0
index e2dddbc170f8..c5fab430b7f7 100644
@@ -125,6 +125,7 @@ bool dcn60_configure_dsc(struct pipe_ctx *pipe_ctx, bool enable)
 			enum optc_dsc_mode mode = dsc_optc_cfg.is_pixel_format_444 ?
 					OPTC_DSC_ENABLED_444 : OPTC_DSC_ENABLED_NATIVE_SUBSAMPLED;
 
+			DC_LOG_DSC("Setting optc DSC config for tg instance %d:", pipe_ctx->stream_res.tg->inst);
 			pipe_ctx->stream_res.tg->funcs->set_dsc_config(
 					pipe_ctx->stream_res.tg, mode,
 					dsc_optc_cfg.bytes_per_pixel, dsc_optc_cfg.slice_width);
@@ -132,6 +133,7 @@ bool dcn60_configure_dsc(struct pipe_ctx *pipe_ctx, bool enable)
 		return true;
 	}
 
+	DC_LOG_DSC("Setting optc DSC config for tg instance %d:", pipe_ctx->stream_res.tg->inst);
 	pipe_ctx->stream_res.tg->funcs->set_dsc_config(
 			pipe_ctx->stream_res.tg, OPTC_DSC_DISABLED, 0, 0);
 
drivers/gpu/drm/amd/display/dc/link/link_dpms.c +14 -5
index ef577e0e5215..42a47d12d1f3 100644
@@ -914,6 +914,7 @@ static bool configure_dsc_hw_block(struct pipe_ctx *pipe_ctx, bool enable,
  */
 void link_set_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable)
 {
+	struct dc *dc = pipe_ctx->stream->ctx->dc;
 	struct dsc_config dsc_cfg = {0};
 	struct dsc_optc_config dsc_optc_cfg = {0};
 
@@ -922,12 +923,20 @@ void link_set_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable)
 		return;
 	}
 
-	if (enable) {
-		if (configure_dsc_hw_block(pipe_ctx, true, &dsc_cfg, &dsc_optc_cfg))
-			set_encoder_dsc_config(pipe_ctx, &dsc_cfg, &dsc_optc_cfg, true);
-	} else {
+	if (dc->hwss.configure_dsc) {
+		/* If the hwss configure_dsc function is supported, then DSC will be programmed
+		 * in the same sequence of OTG enable/disable. Thus, we don't need to configure
+		 * the DSC hw block here.
+		 */
 		set_encoder_dsc_config(pipe_ctx, &dsc_cfg, &dsc_optc_cfg, false);
-		configure_dsc_hw_block(pipe_ctx, false, &dsc_cfg, &dsc_optc_cfg);
+	} else {
+		if (enable) {
+			if (configure_dsc_hw_block(pipe_ctx, true, &dsc_cfg, &dsc_optc_cfg))
+				set_encoder_dsc_config(pipe_ctx, &dsc_cfg, &dsc_optc_cfg, true);
+		} else {
+			set_encoder_dsc_config(pipe_ctx, &dsc_cfg, &dsc_optc_cfg, false);
+			configure_dsc_hw_block(pipe_ctx, false, &dsc_cfg, &dsc_optc_cfg);
+		}
 	}
 }
 
Signature · 1 line
2.43.0
#16 lore raw

PATCH 16/19 drm/amd/display: Improve mandatory pstate optimization and check

In reply to [email protected]

From: Dillon Varone <[email protected]>

[WHY&HOW]
Improves the optimization heuristic for "ideal" disallow time to clamp to a number more likely to pass the mandatory pstate checks.

Fixes core calculations to account for reserved time when considering the allow time for mandatory pstate checks.

---
 .../dml2_core/dml2_core_dcn6_calcs_dchub.c    |  5 +-
 .../dml2_pmo/dml2_pmo_dcn6_stage_optimizers.c | 97 +++++++++++--------
 .../src/inc/dml2_internal_shared_types.h      |  2 +-
 3 files changed, 62 insertions(+), 42 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs_dchub.c +3 -2
index ce6eb94230c1..485ad96f64b1 100644
@@ -1753,8 +1753,9 @@ void dcn6_calculate_pstate_schedule_windows(
 		det_fill_delay_otg_vlines = (int)(math_ceil(det_fill_delay_us[k] / otg_vline_time_us[k]));
 		reserved_vblank_otg_vlines = (int)(math_ceil(reserved_vblank_us[k] / otg_vline_time_us[k]));
 
-		allow_start_otg_vlines = v_blank_end[k] + det_fill_delay_otg_vlines;
-		allow_end_otg_vlines = v_blank_start[k] - (blackout_otg_vlines - reserved_vblank_otg_vlines);
+		/* for vactive only, make relative to vblank end */
+		allow_start_otg_vlines = det_fill_delay_otg_vlines;
+		allow_end_otg_vlines = v_blank_start[k] - v_blank_end[k] - (blackout_otg_vlines - reserved_vblank_otg_vlines);
 
 		/* Convert them back to time since the start of a frame */
 		allow_start_us[k] = allow_start_otg_vlines * otg_vline_time_us[k];
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_pmo/dml2_pmo_dcn6_stage_optimizers.c +58 -39

152 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/inc/dml2_internal_shared_types.h +1 -1
index dc9d4be9d7f7..6f527760071c 100644
@@ -643,7 +643,7 @@ struct dml2_optimization_worksheet {
 	} dcfclk_vmin;
 
 	struct {
-		bool is_attempted;
+		unsigned int index;
 	} fclk_ppt_temp_read_pstate;
 
 	/*
Signature · 1 line
2.43.0
#17 lore raw

PATCH 17/19 drm/amd/display: Disable HUBP/DPP power gating on DCN42

In reply to [email protected]

From: Leo Chen <[email protected]>

[Why]
Driver-controlled HUBP and DPP power gating can cause display underflow on DCN42.

[How]
Set disable_hubp_power_gate and disable_dpp_power_gate in the DCN42 driver debug defaults as a temporary workaround.

---
 .../gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.c    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.c +2 -2
index 7c271dd264c9..a7fdffca8cb9 100644
@@ -745,8 +745,8 @@ static const struct dc_debug_options debug_defaults_drv = {
 	.clock_trace = true,
 	.disable_pplib_clock_request = false,
 	.ignore_pg = false,
-	.disable_dpp_power_gate = false,
-	.disable_hubp_power_gate = false,
+	.disable_dpp_power_gate = true,
+	.disable_hubp_power_gate = true,
 	.disable_optc_power_gate = true,
 	.disable_dsc_power_gate = false,
 	.disable_dio_power_gate = true,
Signature · 1 line
2.43.0
#18 lore raw

PATCH 18/19 drm/amd/display: Promote DC to 3.2.402

In reply to [email protected]

From: Taimur Hassan <[email protected]>

This version brings along the following updates:

- Refactor DC IP request control in HWSS.
- Fix rotate 90 degrees surface corruption issue.
- Refactor DPP root clock control in HWSS.
- Fix upsampling and linear scaling.
- Use aux hw inst if no ddc pin exists.
- Directly include compiler_attributes.h.
- Fix frac_urg_bw conversion to correct U0.10 format.
- Do full link training during HDR/SDR seamless switch.
- Fix SPL format handling for linear scaling and upsampling.
- Update DCN42 cstate latencies.
- Invalidate the DRR shadow after a hardware re-init.
- Program HDR visual confirm based on per pipe info.
- Split link_set_dsc_on_stream into encoder and DSC components.
- Add new config_dsc hwseq function for DCN60.
- Program DSC prior to OTG enable starting DCN60.
- Improve mandatory pstate optimization and check.
- Disable HUBP/DPP power gating on DCN42.

---
 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 d3c484f45333..9cc90c406d86 100644
@@ -68,7 +68,7 @@ struct dcn_dsc_reg_state;
 struct dcn_optc_reg_state;
 struct dcn_dccg_reg_state;
 
-#define DC_VER "3.2.401"
+#define DC_VER "3.2.402"
 
 /**
  * MAX_SURFACES - representative of the upper bound of surfaces that can be piped to a single CRTC
Signature · 1 line
2.43.0
#19 lore raw

PATCH 19/19 drm/amd/display: Fix FreeSync caps tests after common EDID VSDB switch

In reply to [email protected]

From: Ivan Lipski <[email protected]>

[Why&How]
The HDMI and PCON whitelist paths now take their FreeSync range from get_amd_vsdb(), which reads the VSDB parsed by the common DRM EDID code. dm_test_fs_edid_amd_vsdb() builds a VSDB with no refresh range and only the replay feature bit, so both tests saw no FreeSync data and failed.

Add a refresh rate range to the helper, emitting the v1 min_vfreq and v3 max_vfreq_ext bytes, and set the FreeSync feature bit in the two tests that need it.

Fixes e46eeba0c74c ("drm/amd/display: Use HDMI FreeSync range from common EDID parser")
Assisted-by Copilot:claude-opus-5
---
 .../tests/amdgpu_dm_connector_test.c          | 30 ++++++++++---------
 1 file changed, 16 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c +16 -14
index 56fd133bc405..de3a0b9c961a 100644
@@ -9359,14 +9359,14 @@ dm_test_fs_edid_displayid(struct kunit *test, u8 min_vfreq, u8 max_vfreq)
 	return dm_test_fs_edid_alloc(test, ext);
 }
 
-
 /*
  * A CTA-861 extension carrying a 15-byte AMD VSDB v3 payload, which
  * drm_parse_amd_vsdb() turns into connector->display_info.amd_vsdb and
  * get_amd_vsdb() then reads back.
  */
 static const struct drm_edid *
-dm_test_fs_edid_amd_vsdb(struct kunit *test, u8 feature_caps)
+dm_test_fs_edid_amd_vsdb(struct kunit *test, u8 feature_caps,
+			 u8 min_vfreq, u16 max_vfreq)
 {
 	u8 ext[EDID_LENGTH] = {0};
 
@@ -9377,6 +9377,9 @@ dm_test_fs_edid_amd_vsdb(struct kunit *test, u8 feature_caps)
 	ext[5] = 0x1a;			/* AMD IEEE OUI, LSB first */
 	ext[8] = 0x03;			/* AMD VSDB payload version */
 	ext[9] = feature_caps;
+	ext[10] = min_vfreq;
+	ext[18] = max_vfreq & 0xff;	/* v3 max refresh rate, low bits */
+	ext[19] = (max_vfreq >> 8) & 0x3; /* v3 max refresh rate, high bits */
 
 	return dm_test_fs_edid_alloc(test, ext);
 }
@@ -9394,8 +9397,7 @@ struct dm_test_fs_caps_ctx {
  * Build a connector that clears every guard at the top of
  * amdgpu_dm_update_freesync_caps(): a reset connector state, a dc_sink whose
  * dc_context reports a VRR capable DCE version, and a non-NULL freesync
- * module. The resource pool carries no DMCU, so tests that need the AMD VSDB
- * parser to succeed install one.
+ * module.
  */
 static struct dm_test_fs_caps_ctx *
 dm_test_fs_caps_ctx_alloc(struct kunit *test, enum signal_type sink_signal)
@@ -9539,7 +9541,7 @@ static void dm_test_fs_caps_edp_replay_mode(struct kunit *test)
 {
 	struct dm_test_fs_caps_ctx *ctx =
 		dm_test_fs_caps_ctx_alloc(test, SIGNAL_TYPE_EDP);
-	const struct drm_edid *drm_edid = dm_test_fs_edid_amd_vsdb(test, 0x40);
+	const struct drm_edid *drm_edid = dm_test_fs_edid_amd_vsdb(test, 0x40, 0, 0);
 
 	amdgpu_dm_update_freesync_caps(&ctx->aconnector->base, drm_edid, false);
 
@@ -9552,16 +9554,15 @@ static void dm_test_fs_caps_edp_replay_mode(struct kunit *test)
  * dm_test_fs_caps_hdmi_vsdb - Test the HDMI AMD VSDB refresh range
  * @test: The KUnit test context
  *
- * On HDMI the CEA extension is handed to the DMCU parser, whose reported
- * 24-60Hz range is copied to the connector and published as the monitor range.
- * The DMCU does not report an EDID FreeSync VCP code, so the connector is not
- * marked FreeSync-capable.
+ * On HDMI the 24-60Hz range of the AMD VSDB parsed by the common EDID code is
+ * copied to the connector and published as the monitor range. The VSDB carries
+ * no EDID FreeSync VCP code, so the connector is not marked FreeSync-capable.
  */
 static void dm_test_fs_caps_hdmi_vsdb(struct kunit *test)
 {
 	struct dm_test_fs_caps_ctx *ctx =
 		dm_test_fs_caps_ctx_alloc(test, SIGNAL_TYPE_HDMI_TYPE_A);
-	const struct drm_edid *drm_edid = dm_test_fs_edid_amd_vsdb(test, 0x40);
+	const struct drm_edid *drm_edid = dm_test_fs_edid_amd_vsdb(test, 0x1, 24, 60);
 	struct drm_connector *connector = &ctx->aconnector->base;
 
 	amdgpu_dm_update_freesync_caps(connector, drm_edid, false);
@@ -9575,16 +9576,16 @@ static void dm_test_fs_caps_hdmi_vsdb(struct kunit *test)
 }
 
 /**
- * dm_test_fs_caps_hdmi_no_vsdb - Test an HDMI sink with no AMD VSDB
+ * dm_test_fs_caps_hdmi_no_vsdb - Test an HDMI sink with no FreeSync VSDB
  * @test: The KUnit test context
  *
- * Without a DMCU the CEA parse fails, so no refresh range is recorded.
+ * An AMD VSDB without the FreeSync feature bit records no refresh range.
  */
 static void dm_test_fs_caps_hdmi_no_vsdb(struct kunit *test)
 {
 	struct dm_test_fs_caps_ctx *ctx =
 		dm_test_fs_caps_ctx_alloc(test, SIGNAL_TYPE_HDMI_TYPE_A);
-	const struct drm_edid *drm_edid = dm_test_fs_edid_amd_vsdb(test, 0x40);
+	const struct drm_edid *drm_edid = dm_test_fs_edid_amd_vsdb(test, 0x40, 0, 0);
 
 	amdgpu_dm_update_freesync_caps(&ctx->aconnector->base, drm_edid, false);
 
@@ -9605,8 +9606,9 @@ static void dm_test_fs_caps_pcon_whitelist(struct kunit *test)
 {
 	struct dm_test_fs_caps_ctx *ctx =
 		dm_test_fs_caps_ctx_alloc(test, SIGNAL_TYPE_DISPLAY_PORT);
-	const struct drm_edid *drm_edid = dm_test_fs_edid_amd_vsdb(test, 0x40);
+	const struct drm_edid *drm_edid = dm_test_fs_edid_amd_vsdb(test, 0x1, 24, 60);
 	struct dpcd_caps *dpcd;
+
 	dpcd = &ctx->link->dpcd_caps;
 	dpcd->dongle_type = DISPLAY_DONGLE_DP_HDMI_CONVERTER;
 	dpcd->adaptive_sync_caps.dp_adap_sync_caps.bits.ADAPTIVE_SYNC_SDP_SUPPORT = 1;
Signature · 1 line
2.43.0
Tested-by on the v1 series
#20 lore raw
In reply to [email protected]

Public

Hi all,

This week this patchset was tested on 4 systems, two dGPU and two APU based, and tested across multiple display and connection types.

APU
* Single Display eDP -> 1080p 60hz, 1920x1200 165hz, 3840x2400 60hz
* Single Display DP (SST DSC) -> 4k144hz, 4k240hz
* Multi display -> eDP + DP/HDMI/USB-C -> 1080p 60hz eDP + 4k 144hz, 4k 240hz (Includes USB-C to DP/HDMI adapters)
* Thunderbolt -> LG Ultrafine 5k
* MST DSC -> Cable Matters 101075 (DP to 3x DP) with 3x 4k60hz displays, HP Hook G2 with 2x 4k60hz displays
* USB 4 -> HP Hook G4, Lenovo Thunderbolt Dock, both with 2x 4k60hz DP and 1x 4k60hz HDMI displays
* SST PCON -> Club3D CAC-1085 + 1x 4k 144hz, FRL3, at a max resolution supported by the dongle of 4k 120hz YUV420 12bpc.
* MST PCON -> 1x 4k 144hz, FRL3, at a max resolution supported by the adapter of 4k 120hz RGB 8bpc.

DGPU
* Single Display DP (SST DSC) -> 4k144hz, 4k240hz
* Multiple Display DP -> 4k240hz + 4k144hz
* MST (Startech MST14DP123DP [DP to 3x DP] and 2x 4k 60hz displays)
* MST DSC (with Cable Matters 101075 [DP to 3x DP] with 3x 4k60hz displays)

The testing is a mix of automated and manual tests. Manual testing includes (but is not limited to)
* Changing display configurations and settings
* Video/Audio playback
* Benchmark testing
* Suspend/Resume testing
* Feature testing (Freesync, HDCP, etc.)

Automated testing includes (but is not limited to)
* Script testing (scripts to automate some of the manual checks)
* IGT testing

The testing is mainly tested on the following displays, but occasionally there are tests with other displays
* Samsung G8 Neo 4k240hz
* Samsung QN55QN95B 4k 120hz
* Acer XV322QKKV 4k144hz
* HP U27 4k Wireless 4k60hz
* LG 27UD58B 4k60hz
* LG 32UN650WA 4k60hz
* LG Ultrafine 5k 5k60hz
* AU Optronics B140HAN01.1 1080p 60hz eDP
* AU Optronics B160UAN01.J 1920x1200 165hz eDP
* Samsung ATNA60YV02-0 3840x2400 60Hz OLED eDP

The patchset consists of the amd-staging-drm-next branch (Head commit -> e593ef9bdb11cee9c13bfdf2bd4e49355c85eff1 -> drm/amd/display: only clear the hotplug sources the ASIC has) with new patches added on top of it.

Tested on Ubuntu 26.04, on Gnome Wayland.

Thank you,

Dan Wheeler
Sr. Technologist | AMD
SW Display
------------------------------------------------------------------------------------------------------------------
1 Commerce Valley Dr E, Thornhill, ON L3T 7X6
amd.com

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Wednesday, October 7, 2026 1:00 PM
To: [email protected]
Cc: Wentland, Harry <[email protected]>; Li, Sun peng (Leo) <[email protected]>; Pillai, Aurabindo <[email protected]>; Li, Roman <[email protected]>; Lin, Wayne <[email protected]>; Chung, ChiaHsuan (Tom) <[email protected]>; Zuo, Jerry <[email protected]>; Wheeler, Daniel <[email protected]>; Wu, Ray <[email protected]>; LIPSKI, IVAN <[email protected]>; Hung, Alex <[email protected]>; Lin, Ping Lei <[email protected]>; Chen, Chen-Yu <[email protected]>
Subject: [PATCH 00/19] DC Patches October 5, 2026

From: Ivan Lipski <[email protected]>

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

- Refactor DC IP request control in HWSS.
- Fix rotate 90 degrees surface corruption issue.
- Refactor DPP root clock control in HWSS.
- Fix upsampling and linear scaling.
- Use aux hw inst if no ddc pin exists.
- Directly include compiler_attributes.h.
- Fix frac_urg_bw conversion to correct U0.10 format.
- Do full link training during HDR/SDR seamless switch.
- Fix SPL format handling for linear scaling and upsampling.
- Update DCN42 cstate latencies.
- Invalidate the DRR shadow after a hardware re-init.
- Program HDR visual confirm based on per pipe info.
- Split link_set_dsc_on_stream into encoder and DSC components.
- Add new config_dsc hwseq function for DCN60.
- Program DSC prior to OTG enable starting DCN60.
- Improve mandatory pstate optimization and check.
- Disable HUBP/DPP power gating on DCN42.

Cc Dan Wheeler <[email protected]>

Alvin Lee (2):
drm/amd/display: Use aux hw inst if no ddc pin exists drm/amd/display: Program HDR visual confirm based on per pipe info

Aric Cyr (1):
drm/amd/display: Invalidate the DRR shadow after a hardware re-init

Charlene Liu (1):
drm/amd/display: Fix rotate 90 degrees surface corruption issue

Dillon Varone (1):
drm/amd/display: Improve mandatory pstate optimization and check

Dominik Kaszewski (1):
drm/amd/display: Directly include compiler_attributes.h

George Shen (3):
drm/amd/display: Split link_set_dsc_on_stream into encoder and DSC
components
drm/amd/display: Add new config_dsc hwseq function for dcn60 drm/amd/display: Program DSC prior to OTG enable starting DCN60

Ivan Lipski (1):
drm/amd/display: Fix FreeSync caps tests after common EDID VSDB switch

Karthi Kandasamy (1):
drm/amd/display: Do full link training during HDR/SDR seamless switch

Leo Chen (1):
drm/amd/display: Disable HUBP/DPP power gating on DCN42

Ovidiu Bunea (2):
drm/amd/display: Fix frac_urg_bw conversion to correct U0.10 format drm/amd/display: Update DCN42 cstate latencies

Rafal Ostrowski (2):
drm/amd/display: HWSS Refactor - DC IP request control drm/amd/display: HWSS Refactor - DPP root clock control

Sridevi Arvindekar (2):
drm/amd/display: Fix upsampling for linear scaling of subsampled YUV drm/amd/display: Fix linear scaling and upsampling

Taimur Hassan (1):
drm/amd/display: Promote DC to 3.2.402

 .../tests/amdgpu_dm_connector_test.c          |  30 +-
 drivers/gpu/drm/amd/display/dc/Makefile       |   1 +
 drivers/gpu/drm/amd/display/dc/core/dc.c      |  43 ++-
 .../drm/amd/display/dc/core/dc_hw_sequencer.c |  93 ++++--  .../gpu/drm/amd/display/dc/core/dc_resource.c |  19 --  .../amd/display/dc/core/dc_resource_helper.c  |  46 +++
 drivers/gpu/drm/amd/display/dc/dc.h           |   2 +-
 drivers/gpu/drm/amd/display/dc/dc_fused_io.c  |   4 +-
 .../gpu/drm/amd/display/dc/dc_memory_pool.c   |   1 +
 .../gpu/drm/amd/display/dc/dc_memory_pool.h   |   2 +
 .../gpu/drm/amd/display/dc/dc_spl_translate.c |  22 +-
 .../amd/display/dc/dccg/dcn314/dcn314_dccg.c  |   4 +-
 .../amd/display/dc/dccg/dcn35/dcn35_dccg.c    |  21 +-
 .../amd/display/dc/dccg/dcn35/dcn35_dccg.h    |   3 +-
 .../amd/display/dc/dccg/dcn42/dcn42_dccg.c    |   2 +-
 .../dml21/inc/bounding_boxes/dcn42_soc_bb.h   |   8 +-
 .../src/dml2_core/dml2_core_dcn4_calcs.c      |   7 +-
 .../dml2_core/dml2_core_dcn5_calcs_dchub.c    |   5 +-
 .../dml2_core/dml2_core_dcn6_calcs_dchub.c    |  10 +-
 .../dml21/src/dml2_dpmm/dml2_dpmm_dcn4.c      |  20 +-
 .../dml21/src/dml2_dpmm/dml2_dpmm_dcn5.c      |  13 +-
 .../dml2_pmo/dml2_pmo_dcn6_stage_optimizers.c |  97 +++---
 .../src/inc/dml2_internal_shared_types.h      |   2 +-
 .../drm/amd/display/dc/dpp/dcn10/dcn10_dpp.c  |   4 +-
 .../drm/amd/display/dc/dpp/dcn10/dcn10_dpp.h  |   3 +-
 .../drm/amd/display/dc/dpp/dcn20/dcn20_dpp.c  |   4 +-
 .../amd/display/dc/dpp/dcn201/dcn201_dpp.c    |   4 +-
 .../drm/amd/display/dc/dpp/dcn30/dcn30_dpp.c  |  76 ++++-
 .../drm/amd/display/dc/dpp/dcn30/dcn30_dpp.h  |   9 +-
 .../amd/display/dc/dpp/dcn401/dcn401_dpp.c    |   4 +-
 .../amd/display/dc/dpp/dcn401/dcn401_dpp.h    |   3 +-
 .../display/dc/dpp/dcn401/dcn401_dpp_dscl.c   |   8 +-
 .../drm/amd/display/dc/dpp/dcn42/dcn42_dpp.c  |   4 +-
 .../drm/amd/display/dc/dpp/dcn50/dcn50_dpp.c  |   4 +-
 .../drm/amd/display/dc/dpp/dcn50/dcn50_dpp.h  |   3 +-
 .../drm/amd/display/dc/dpp/dcn60/dcn60_dpp.c  |  38 ++-  .../drm/amd/display/dc/dpp/dcn60/dcn60_dpp.h  |  15 +-  .../amd/display/dc/dpp/dcn60/dcn60_dpp_dscl.c |  13 +-
 .../display/dc/hubbub/dcn31/dcn31_hubbub.c    |   9 +-
 .../amd/display/dc/hwss/dce110/dce110_hwseq.c |  13 +-
 .../amd/display/dc/hwss/dcn10/dcn10_hwseq.c   |  28 +-
 .../amd/display/dc/hwss/dcn20/dcn20_hwseq.c   |  23 +-
 .../amd/display/dc/hwss/dcn31/dcn31_hwseq.c   |  21 +-
 .../amd/display/dc/hwss/dcn314/dcn314_hwseq.c |  20 +-
 .../amd/display/dc/hwss/dcn314/dcn314_hwseq.h |   2 +
 .../amd/display/dc/hwss/dcn314/dcn314_init.c  |   1 +
 .../amd/display/dc/hwss/dcn32/dcn32_hwseq.c   |   7 +-
 .../amd/display/dc/hwss/dcn35/dcn35_hwseq.c   |  24 +-
 .../amd/display/dc/hwss/dcn35/dcn35_hwseq.h   |   2 +
 .../amd/display/dc/hwss/dcn35/dcn35_init.c    |   1 +
 .../amd/display/dc/hwss/dcn351/dcn351_init.c  |   1 +
 .../amd/display/dc/hwss/dcn401/dcn401_hwseq.c |  27 +-
 .../amd/display/dc/hwss/dcn401/dcn401_hwseq.h |   2 +-
 .../amd/display/dc/hwss/dcn42/dcn42_hwseq.c   |   6 +-
 .../amd/display/dc/hwss/dcn42/dcn42_init.c    |   1 +
 .../amd/display/dc/hwss/dcn50/dcn50_hwseq.c   |   3 +-
 .../amd/display/dc/hwss/dcn60/dcn60_hwseq.c   | 101 ++++++-
 .../amd/display/dc/hwss/dcn60/dcn60_hwseq.h   |   1 +
 .../amd/display/dc/hwss/dcn60/dcn60_init.c    |   1 +
 .../drm/amd/display/dc/hwss/hw_sequencer.h    |   9 +-
 .../display/dc/hwss/hw_sequencer_private.h    |   5 +-
 drivers/gpu/drm/amd/display/dc/inc/hw/dccg.h  |   6 +-
 drivers/gpu/drm/amd/display/dc/inc/hw/dpp.h   |   3 +-
 .../gpu/drm/amd/display/dc/link/link_dpms.c   | 282 +++++++++++-------
 drivers/gpu/drm/amd/display/dc/os_types.h     |   1 -
 .../dc/resource/dcn42/dcn42_resource.c        |   4 +-
 .../dc/resource/dcn60/dcn60_resource.h        |   6 +
 drivers/gpu/drm/amd/display/dc/sspl/dc_spl.c  |  52 ++--
 68 files changed, 874 insertions(+), 435 deletions(-)  create mode 100644 drivers/gpu/drm/amd/display/dc/core/dc_resource_helper.c

--
2.43.0