Skip to contentSkip to conversation

DC Patches September 22th, 2026

PATCH In review Fangzhi Zuo 2 participants 38 messages Sep 24 – Nov 6

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

cover DC Patches September 22th, 2026

This DC patchset brings improvements in multiple areas.

- Stabilizes public lifecycle APIs, and adds DCN42/DCN60 support.
- Adds DCN60 clock overrides, DCN42 PMO/P-state support,
QoS handling for invalid PMFW tables, urgent-watermark overrides, and improved self-refresh timing.
- Improve HDMI 2.1 reliability
- Enables DMUB hardware cursor offload and improves cursor/cache behavior.

Cc Dan Wheeler <[email protected]>

Alvin Lee (3):
drm/amd/display: Disable gamcor light sleep before gamcor program drm/amd/display: Add temporary programming for port control in dc_init drm/amd/display: Don't round up cursor width to nearest 64

Ashwin Santhosh (2):
drm/amd/display: Program OPP formatter for plane-less ODM segments drm/amd/display: Promote DC to 3.2.400

Charlene Liu (2):
drm/amd/display: avoid to write signal specific for tmds drm/amd/display: Fix zero dlg_reg write to program_ext_vblank

Cheng, Tony (1):
drm/amd/display: Keep public DC lifecycle APIs stable beside Core 2

Clay King (1):
drm/amd/display: adjust floating point format for gamut remap when
needed

Dillon Varone (2):
drm/amd/display: Add dcn60 revision specific clock overrides drm/amd/display: Fix VTG programming for dcn60

Dmytro Laktyushkin (1):
drm/amd/display: Enable dcn42 pstate pmo

Dominik Kaszewski (1):
drm/amd/display: Add missing message to static_assert

Fangzhi Zuo (2):
drm/amd/display: Serialize HDMI FRL status polling against link detect drm/amd/display: Skip HDMI FRL status polling while link is down

Fudongwang (1):
drm/amd/display: Change default SR z8 exit/enter value

Ilya Bakoulin (1):
drm/amd/display: Fix HDMI2.2 LT timeout duration

Ivan Lipski (1):
drm/amd/display: Enable DMUB HW cursor offload

Jackson He (1):
drm/amd/display: Remove unused copyright notice

Nicholas Kazlauskas (1):
drm/amd/display: Update default clocks for DCN60 lite3 variant

Ovidiu Bunea (1):
drm/amd/display: Add urgent watermark override for DCN42

Piotr Maziarz (6):
drm/amd/display: Flatten OPP_SET_DISP_PATTERN_GENERATOR parameters drm/amd/display: Remove OPP_SET_MPCC_DISCONNECT_PENDING drm/amd/display: Rename HUBBUB_FORCE_PSTATE_CHANGE_CONTROL wait field drm/amd/display: Drop disallow_self_refresh_applied output param drm/amd/display: Dispatch HUBBUB_SOFT_RESET through hubbub_funcs drm/amd/display: Remove dead self-refresh BLS steps

Ray Wu (2):
drm/amd/display: map PWM brightness through custom backlight curve drm/amd/display: Attach blend mode property for alpha planes

Relja Vojvodic (1):
drm/amd/display: Block DSC Padding on DP

Tony Cheng (1):
drm/amd/display: Move struct dtbclk_dto_params to dc_hw_types.h

Wenjing Liu (3):
drm/amd/display: Synchronize UTM overrides with SMU drm/amd/display: Consolidate bandwidth overrides drm/amd/display: Fix DCN60 UTM QoS override for invalid PMFW table

 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |   5 +
 .../display/amdgpu_dm/amdgpu_dm_backlight.c   |  90 +++++++-
 .../display/amdgpu_dm/amdgpu_dm_connector.c   |  35 +--
 .../amd/display/amdgpu_dm/amdgpu_dm_plane.c   |  38 +++-
 .../tests/amdgpu_dm_connector_test.c          |   1 +
 drivers/gpu/drm/amd/display/dc/Makefile       |   3 +
 .../display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c  | 181 ++++++++++++---
 drivers/gpu/drm/amd/display/dc/core/dc.c      |  30 ++-
 .../drm/amd/display/dc/core/dc_hw_sequencer.c | 146 +++----------
 .../gpu/drm/amd/display/dc/core/dc_resource.c |   2 +-
 .../drm/amd/display/dc/core2/CMakeLists.txt   |  10 +
 .../gpu/drm/amd/display/dc/core2/dc_core2.c   |  34 +++
 .../gpu/drm/amd/display/dc/core2/dc_core2.h   |  19 ++
 .../drm/amd/display/dc/core2/dc_core2_init.c  |  13 ++
 .../drm/amd/display/dc/core2/dc_core2_init.h  |  10 +
 drivers/gpu/drm/amd/display/dc/dc.h           |   5 +-
 .../display/dc/dc_api_dispatch/CMakeLists.txt |   9 +
 .../amd/display/dc/dc_api_dispatch/api_shim.c |  32 +++
 .../amd/display/dc/dc_api_dispatch/api_shim.h |  19 ++
 drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c  |   9 +-
 drivers/gpu/drm/amd/display/dc/dc_hw_types.h  |   9 +
 .../gpu/drm/amd/display/dc/dc_memory_pool.c   |  10 +-
 .../amd/display/dc/dml/dcn314/dcn314_fpu.c    |   4 +-
 drivers/gpu/drm/amd/display/dc/dpp/Makefile   |   2 +-
 .../drm/amd/display/dc/dpp/dcn30/dcn30_dpp.h  |  22 ++
 .../amd/display/dc/dpp/dcn30/dcn30_dpp_cm.c   |  10 +-
 .../drm/amd/display/dc/dpp/dcn60/dcn60_dpp.c  |   2 +-
 .../drm/amd/display/dc/dpp/dcn60/dcn60_dpp.h  |   3 +
 .../amd/display/dc/dpp/dcn60/dcn60_dpp_cm.c   | 124 +++++++++++
 .../dc/gpio/dcn42/hw_translate_dcn42.c.orig   | 206 ------------------
 .../display/dc/hubbub/dcn401/dcn401_hubbub.c  |   1 +
 .../display/dc/hubbub/dcn42/dcn42_hubbub.c    |  42 ++--
 .../display/dc/hubbub/dcn42/dcn42_hubbub.h    |   7 +-
 .../display/dc/hubbub/dcn60/dcn60_hubbub.c    |   9 +
 .../amd/display/dc/hubp/dcn60/dcn60_hubp.c    |   5 +-
 .../amd/display/dc/hwss/dcn20/dcn20_hwseq.c   |  10 +-
 .../amd/display/dc/hwss/dcn201/dcn201_hwseq.c |   3 +-
 .../amd/display/dc/hwss/dcn30/dcn30_hwseq.c   |   4 +-
 .../amd/display/dc/hwss/dcn32/dcn32_hwseq.c   |   6 +-
 .../amd/display/dc/hwss/dcn401/dcn401_hwseq.c |  50 ++++-
 .../amd/display/dc/hwss/dcn60/dcn60_hwseq.c   |   5 +
 .../drm/amd/display/dc/hwss/hw_sequencer.h    |  51 +----
 .../amd/display/dc/inc/dc_core_interface.h    |  31 +++
 .../amd/display/dc/inc/hw/clk_mgr_internal.h  |   9 +
 drivers/gpu/drm/amd/display/dc/inc/hw/dccg.h  |   9 -
 .../gpu/drm/amd/display/dc/inc/hw/dchubbub.h  |   4 +
 drivers/gpu/drm/amd/display/dc/inc/hw/opp.h   |   3 +-
 .../gpu/drm/amd/display/dc/link/link_dpms.c   |   2 +
 .../amd/display/dc/link/protocols/link_ddc.c  |   8 +-
 .../amd/display/dc/link/protocols/link_ddc.h  |   1 +
 .../display/dc/link/protocols/link_hdmi_frl.c |  58 ++---
 .../drm/amd/display/dc/opp/dcn20/dcn20_opp.c  |   5 +-
 .../drm/amd/display/dc/opp/dcn20/dcn20_opp.h  |   3 +-
 .../amd/display/dc/optc/dcn60/dcn60_optc.c    |  83 ++++++-
 .../dc/resource/dcn42b/dcn42b_resource.c      |   2 +
 .../dc/resource/dcn60/dcn60_resource.c        |   2 +
 .../drm/amd/display/dc/sspl/spl_os_types.h    |   1 -
 57 files changed, 965 insertions(+), 532 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/display/dc/core2/CMakeLists.txt
 create mode 100644 drivers/gpu/drm/amd/display/dc/core2/dc_core2.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/core2/dc_core2.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/core2/dc_core2_init.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/core2/dc_core2_init.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/dc_api_dispatch/CMakeLists.txt
 create mode 100644 drivers/gpu/drm/amd/display/dc/dc_api_dispatch/api_shim.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/dc_api_dispatch/api_shim.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/dpp/dcn60/dcn60_dpp_cm.c
 delete mode 100644 drivers/gpu/drm/amd/display/dc/gpio/dcn42/hw_translate_dcn42.c.orig
 create mode 100644 drivers/gpu/drm/amd/display/dc/inc/dc_core_interface.h
Signature · 1 line
2.53.0
#1 lore raw

PATCH 1/34 drm/amd/display: Move struct dtbclk_dto_params to dc_hw_types.h

From: Tony Cheng <[email protected]>

This can simplify includes

Assisted-by Cursor:composer-2.5
---
 drivers/gpu/drm/amd/display/dc/dc_hw_types.h | 9 +++++++++
 drivers/gpu/drm/amd/display/dc/inc/hw/dccg.h | 9 ---------
 2 files changed, 9 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/display/dc/dc_hw_types.h +9 -0
index 40cd4e5d1340..baf6091bb52d 100644
@@ -1086,6 +1086,15 @@ struct dc_crtc_timing_adjust {
 	uint8_t timing_adjust_pending;
 };
 
+struct dtbclk_dto_params {
+	const struct dc_crtc_timing *timing;
+	int otg_inst;
+	int pixclk_khz;
+	int req_audio_dtbclk_khz;
+	int num_odm_segments;
+	int ref_dtbclk_khz;
+	bool is_hdmi;
+};
 
 /* Passed on init */
 enum vram_type {
drivers/gpu/drm/amd/display/dc/inc/hw/dccg.h +0 -9
index 4b7c55eeb0c6..1fe703e866fc 100644
@@ -201,15 +201,6 @@ struct dccg {
 	//int audio_dtbclk_khz;/* TODO needs to be removed */
 	//int ref_dtbclk_khz;/* TODO needs to be removed */
 };
-struct dtbclk_dto_params {
-	const struct dc_crtc_timing *timing;
-	int otg_inst;
-	int pixclk_khz;
-	int req_audio_dtbclk_khz;
-	int num_odm_segments;
-	int ref_dtbclk_khz;
-	bool is_hdmi;
-};
 
 struct dccg_funcs {
 	void (*update_dpp_dto)(struct dccg *dccg,
Signature · 1 line
2.53.0
#2 lore raw

PATCH 2/34 drm/amd/display: Synchronize UTM overrides with SMU

In reply to Fangzhi Zuo

From: Wenjing Liu <[email protected]>

[Why]
Keep the display QoS model and firmware table consistent when test overrides are enabled.

[How]
Serialize the overridden QoS values into a dedicated transfer buffer and send the table after clock initialization.

---
 .../display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c  | 125 ++++++++++++++++--
 .../amd/display/dc/inc/hw/clk_mgr_internal.h  |   9 ++
 2 files changed, 123 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c +114 -11
index d6db6168c3da..00d96232a013 100644
@@ -120,6 +120,9 @@ static const struct clk_mgr_mask clk_mgr_mask_dcn60 = {
 #define TO_DCN60_CLK_MGR(clk_mgr)\
 	container_of(clk_mgr, struct dcn60_clk_mgr, base)
 
+/* Temporary UTM override used to unblock DCN6 testing. */
+static bool dcn60_should_apply_temp_utm_override = true;
+
 static bool dcn60_is_ppclk_dpm_enabled(struct clk_mgr_internal *clk_mgr, PPCLK_e clk)
 {
 	bool ppclk_dpm_enabled = false;
@@ -627,6 +630,74 @@ static void dcn60_override_clk_table(struct clk_limit_table *clk_table)
 	(void)clk_table;
 }
 
+/**
+ * dcn60_copy_utm_qos_model_to_soc_table - Convert a UTM QoS model to the PMFW table format.
+ * @dchub: overridden DCN6 UTM QoS model
+ * @utm_table: GPU-visible PMFW UTM table to populate
+ */
+static void dcn60_copy_utm_qos_model_to_soc_table(
+		const struct utm_qos_model_dchub_v3 *dchub,
+		SocUtmTable_t *utm_table)
+{
+	unsigned int load_level_count = dchub->load_level_count;
+	unsigned int sop_count = dchub->sop_count;
+	unsigned int ll, sop;
+
+	if (load_level_count > UTM_QOS_MODEL_V3_MAX_LOAD_LEVEL_COUNT)
+		load_level_count = UTM_QOS_MODEL_V3_MAX_LOAD_LEVEL_COUNT;
+
+	if (sop_count > UTM_QOS_MODEL_V3_MAX_SOP_COUNT)
+		sop_count = UTM_QOS_MODEL_V3_MAX_SOP_COUNT;
+
+	memset(utm_table, 0, sizeof(*utm_table));
+	utm_table->Header.LoadLevelCount = load_level_count;
+	utm_table->Header.SopCount = sop_count;
+
+	for (ll = 0; ll < load_level_count; ll++) {
+		for (sop = 0; sop < sop_count; sop++) {
+			const struct utm_qos_model_dchub_v3_sop_entry *src =
+					&dchub->sops[ll][sop];
+			SocUtmSopEntry_t *dst = &utm_table->Sops[ll][sop];
+
+			dst->UrgentRampPs = src->urgent_ramp_ps;
+			dst->TripPs = src->t_trip_ps;
+			dst->MetaTripToMemPs = src->meta_trip_to_mem_ps;
+			dst->MaxReqLatencyUrgPs = src->max_req_latency_urg_ps;
+			dst->AvgReqLatencyUrgPs = src->avg_req_latency_urg_ps;
+			dst->MaxReqLatencyNonUrgPs = src->max_req_latency_non_urg_ps;
+			dst->AvgReqLatencyNonUrgPs = src->avg_req_latency_non_urg_ps;
+			dst->DfResponseTimePs = src->df_response_time_ps;
+			dst->UrgentBandwidthKBps = src->urgent_bandwidth_KBps;
+			dst->NominalBandwidthKBps = src->nominal_bandwidth_KBps;
+			dst->LsdmaBandwidthKBps = src->lsdma_bandwidth_KBps;
+		}
+	}
+}
+
+/**
+ * dcn60_override_utm_qos_model - Override the UTM QoS model.
+ * @bw_params: clock manager bandwidth parameters
+ */
+static void dcn60_override_utm_qos_model(struct clk_bw_params *bw_params)
+{
+	struct utm_qos_model *qos_model;
+	struct utm_qos_model_dchub_v3 *dchub;
+
+	if (!bw_params->utm_qos_model
+			|| bw_params->utm_qos_model->version != utm_qos_model_version_v3
+			|| !bw_params->utm_qos_model->dchub_v3)
+		return;
+
+	qos_model = (struct utm_qos_model *)bw_params->utm_qos_model;
+	dchub = (struct utm_qos_model_dchub_v3 *)qos_model->dchub_v3;
+
+	dcn6_test_initialize_utm_qos_model_v3(qos_model, dchub);
+
+	// Override for lsdma here is redundant with the above call, but this may need to outlive
+	// the test_initialize call for debug purposes so keep it here for now.
+	dcn6_test_override_lsdma_bandwidth_v3(dchub);
+}
+
 static void dcn60_override_bw_params(struct clk_mgr_internal *clk_mgr,
 		struct clk_bw_params *bw_params)
 {
@@ -654,17 +725,8 @@ static void dcn60_override_bw_params(struct clk_mgr_internal *clk_mgr,
 
 	bw_params->dc_mode_softmax_memclk = bw_params->dc_mode_limit.memclk_mhz;
 
-	/* Override as needed - temporary for debug only. */
-	if (bw_params->utm_qos_model && bw_params->utm_qos_model->dchub_v3) {
-		dcn6_test_initialize_utm_qos_model_v3(
-				(struct utm_qos_model *)bw_params->utm_qos_model,
-				(struct utm_qos_model_dchub_v3 *)bw_params->utm_qos_model->dchub_v3);
-
-		// Override for lsdma here is redundant with the above call, but this may need to outlive
-		// the test_initialize call for debug purposes so keep it here for now.
-		dcn6_test_override_lsdma_bandwidth_v3(
-				(struct utm_qos_model_dchub_v3 *)bw_params->utm_qos_model->dchub_v3);
-	}
+	if (dcn60_should_apply_temp_utm_override)
+		dcn60_override_utm_qos_model(bw_params);
 }
 
 /**
@@ -922,6 +984,32 @@ static void dcn60_clock_read_ss_info(struct clk_mgr_internal *clk_mgr)
 	}
 }
 
+/**
+ * dcn60_update_smu_utm_table - Send the current UTM QoS model to SMU.
+ * @clk_mgr: clock manager instance
+ *
+ * Return: true if SMU accepted the UTM table, false otherwise
+ */
+static bool dcn60_update_smu_utm_table(struct clk_mgr_internal *clk_mgr)
+{
+	const struct utm_qos_model *qos_model = clk_mgr->base.bw_params->utm_qos_model;
+	const struct utm_qos_model_dchub_v3 *dchub;
+	SocUtmTable_t *utm_table;
+
+	if (!qos_model
+			|| qos_model->version != utm_qos_model_version_v3
+			|| !qos_model->dchub_v3
+			|| !clk_mgr->utm_override_table)
+		return false;
+
+	dchub = qos_model->dchub_v3;
+	utm_table = (SocUtmTable_t *)clk_mgr->utm_override_table;
+
+	dcn60_copy_utm_qos_model_to_soc_table(dchub, utm_table);
+	return dcn60_smu_set_soc_utm_table(clk_mgr,
+			clk_mgr->utm_override_table_addr);
+}
+
 void dcn60_init_clocks(struct clk_mgr *clk_mgr_base)
 {
 	struct clk_mgr_internal *clk_mgr = TO_CLK_MGR_INTERNAL(clk_mgr_base);
@@ -947,6 +1035,11 @@ void dcn60_init_clocks(struct clk_mgr *clk_mgr_base)
 	if (clk_mgr->dpm_present)
 		clk_mgr_base->ctx->dc->res_pool->funcs->update_bw_bounding_box(
 				clk_mgr_base->ctx->dc, clk_mgr_base->bw_params);
+
+	if (clk_mgr->dpm_present
+			&& dcn60_should_apply_temp_utm_override
+			&& !dcn60_update_smu_utm_table(clk_mgr))
+		DC_LOG_ERROR("Failed to transfer UTM override table to SMU.\n");
 }
 
 
@@ -1751,6 +1844,12 @@ struct clk_mgr_internal *dcn60_clk_mgr_construct(
 	if (!clk_mgr->dal_init_table)
 		goto fail;
 
+	clk_mgr->utm_override_table = dm_helpers_allocate_gpu_mem(clk_mgr->base.ctx,
+			DC_MEM_ALLOC_TYPE_GART, sizeof(SocUtmTable_t),
+			&clk_mgr->utm_override_table_addr);
+	if (!clk_mgr->utm_override_table)
+		goto fail;
+
 	return &clk_mgr60->base;
 
 fail:
@@ -1764,6 +1863,10 @@ void dcn60_clk_mgr_destroy(struct clk_mgr_internal *clk_mgr)
 {
 	kfree(clk_mgr->base.bw_params);
 
+	if (clk_mgr->utm_override_table)
+		dm_helpers_free_gpu_mem(clk_mgr->base.ctx, DC_MEM_ALLOC_TYPE_GART,
+				clk_mgr->utm_override_table);
+
 	if (clk_mgr->dal_init_table)
 		dm_helpers_free_gpu_mem(clk_mgr->base.ctx, DC_MEM_ALLOC_TYPE_GART,
 				(void *)clk_mgr->dal_init_table);
drivers/gpu/drm/amd/display/dc/inc/hw/clk_mgr_internal.h +9 -0
index d735eb1e7f43..68fd92258e8c 100644
@@ -541,6 +541,15 @@ struct clk_mgr_internal {
 	const void *dal_init_table;
 	long long dal_init_table_addr;
 
+	/**
+	 * @utm_override_table:
+	 *
+	 * GPU-accessible DRAM buffer for the UTM table transferred to SMU via
+	 * DALSMC_MSG_TransferTableDram2Smu(TABLE_SOC_UTM).
+	 */
+	void *utm_override_table;
+	long long utm_override_table_addr;
+
 	bool dpm_present;
 	bool pme_trigger_pending;
 };
Signature · 1 line
2.53.0
#3 lore raw

PATCH 3/34 drm/amd/display: Consolidate bandwidth overrides

In reply to Fangzhi Zuo

From: Wenjing Liu <[email protected]>

[Why]
Bandwidth overrides must be applied in a defined order so debug settings are reflected in the final parameters.

[How]
Group clock adjustments with the clock table override and derive the final mode limits after all clock table changes.

---
 .../display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c  | 75 ++++++++++---------
 1 file changed, 41 insertions(+), 34 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c +41 -34
index 00d96232a013..4cca1db2a79a 100644
@@ -484,18 +484,19 @@ static int dcn60_get_dtb_ref_freq_khz(struct clk_mgr *clk_mgr_base)
 
 /**
  * dcn60_override_dc_mode_limit - Override DC mode limits from the clock table.
- * @dc_limit: output DC mode limit to populate
- * @clk_table: clock table already populated (and possibly overridden)
+ * @clk_mgr: clock manager instance
+ * @bw_params: bandwidth parameters containing the clock table and DC limits
  *
  * Sets the DC mode max frequency for each clock to the highest populated DPM
  * level in the clock table. Deriving the limit from the clock table (rather
  * than the raw DAL init table) ensures any overrides applied to the clock
  * levels are respected.
  */
-static void dcn60_override_dc_mode_limit(
-		struct clk_limit_table_entry *dc_limit,
-		const struct clk_limit_table *clk_table)
+static void dcn60_override_dc_mode_limit(struct clk_mgr_internal *clk_mgr,
+		struct clk_bw_params *bw_params)
 {
+	struct clk_limit_table_entry *dc_limit = &bw_params->dc_mode_limit;
+	const struct clk_limit_table *clk_table = &bw_params->clk_table;
 	const struct clk_limit_table_entry *entries = clk_table->entries;
 	const struct clk_limit_num_entries *num_entries = &clk_table->num_entries_per_clk;
 
@@ -513,6 +514,11 @@ static void dcn60_override_dc_mode_limit(
 			entries[num_entries->num_memclk_levels - 1].memclk_mhz : 0;
 	dc_limit->fclk_mhz    = num_entries->num_fclk_levels ?
 			entries[num_entries->num_fclk_levels - 1].fclk_mhz : 0;
+
+	if (clk_mgr->base.ctx->dc->debug.disable_dtb_ref_clk_switch)
+		dc_limit->dtbclk_mhz = 0;
+
+	bw_params->dc_mode_softmax_memclk = dc_limit->memclk_mhz;
 }
 
 static unsigned int dcn60_get_dc_mode_limit_mhz(const DpmClock_t *dpm_clk)
@@ -618,16 +624,40 @@ static void dcn60_populate_clk_table(struct clk_mgr_internal *clk_mgr,
 
 /**
  * dcn60_override_clk_table - Override the clock table with hardcoded values.
+ * @clk_mgr: clock manager instance
  * @clk_table: clock table to override
  *
  * Temporary debug/bring-up override that replaces the DPM clock levels
  * populated from the DAL init table (see dcn60_populate_clk_table) with a
- * fixed set of hardcoded values. Implement any override as needed.
+ * fixed set of hardcoded values, then applies the configured minimum clock
+ * floors.
  */
-static void dcn60_override_clk_table(struct clk_limit_table *clk_table)
+static void dcn60_override_clk_table(struct clk_mgr_internal *clk_mgr,
+		struct clk_limit_table *clk_table)
 {
-	/* Override as needed */
-	(void)clk_table;
+	unsigned int i;
+
+	if (clk_mgr->base.ctx->dc->debug.min_disp_clk_khz) {
+		unsigned int min_disp_clk_mhz =
+			khz_to_mhz_ceil(clk_mgr->base.ctx->dc->debug.min_disp_clk_khz);
+
+		for (i = 0; i < clk_table->num_entries_per_clk.num_dispclk_levels; i++)
+			if (clk_table->entries[i].dispclk_mhz
+					< min_disp_clk_mhz)
+				clk_table->entries[i].dispclk_mhz
+					= min_disp_clk_mhz;
+	}
+
+	if (clk_mgr->base.ctx->dc->debug.min_dpp_clk_khz) {
+		unsigned int min_dpp_clk_mhz =
+			khz_to_mhz_ceil(clk_mgr->base.ctx->dc->debug.min_dpp_clk_khz);
+
+		for (i = 0; i < clk_table->num_entries_per_clk.num_dppclk_levels; i++)
+			if (clk_table->entries[i].dppclk_mhz
+					< min_dpp_clk_mhz)
+				clk_table->entries[i].dppclk_mhz
+					= min_dpp_clk_mhz;
+	}
 }
 
 /**
@@ -701,29 +731,8 @@ static void dcn60_override_utm_qos_model(struct clk_bw_params *bw_params)
 static void dcn60_override_bw_params(struct clk_mgr_internal *clk_mgr,
 		struct clk_bw_params *bw_params)
 {
-	struct clk_limit_table *clk_table = &bw_params->clk_table;
-	unsigned int i;
-
-	if (clk_mgr->base.ctx->dc->debug.min_disp_clk_khz) {
-		for (i = 0; i < clk_table->num_entries_per_clk.num_dispclk_levels; i++)
-			if (clk_table->entries[i].dispclk_mhz
-					< (unsigned int)khz_to_mhz_ceil(clk_mgr->base.ctx->dc->debug.min_disp_clk_khz))
-				clk_table->entries[i].dispclk_mhz
-					= (unsigned int)khz_to_mhz_ceil(clk_mgr->base.ctx->dc->debug.min_disp_clk_khz);
-	}
-
-	if (clk_mgr->base.ctx->dc->debug.min_dpp_clk_khz) {
-		for (i = 0; i < clk_table->num_entries_per_clk.num_dppclk_levels; i++)
-			if (clk_table->entries[i].dppclk_mhz
-					< (unsigned int)khz_to_mhz_ceil(clk_mgr->base.ctx->dc->debug.min_dpp_clk_khz))
-				clk_table->entries[i].dppclk_mhz
-					= (unsigned int)khz_to_mhz_ceil(clk_mgr->base.ctx->dc->debug.min_dpp_clk_khz);
-	}
-
-	if (clk_mgr->base.ctx->dc->debug.disable_dtb_ref_clk_switch)
-		bw_params->dc_mode_limit.dtbclk_mhz = 0;
-
-	bw_params->dc_mode_softmax_memclk = bw_params->dc_mode_limit.memclk_mhz;
+	dcn60_override_clk_table(clk_mgr, &bw_params->clk_table);
+	dcn60_override_dc_mode_limit(clk_mgr, bw_params);
 
 	if (dcn60_should_apply_temp_utm_override)
 		dcn60_override_utm_qos_model(bw_params);
@@ -812,8 +821,6 @@ static bool dcn60_fetch_dal_init_table(struct clk_mgr_internal *clk_mgr)
 	dcn60_populate_utm_qos_model(clk_mgr, &bw_params->utm_qos_model, init_table);
 
 	dcn60_override_bw_params(clk_mgr, bw_params);
-	dcn60_override_clk_table(&bw_params->clk_table);
-	dcn60_override_dc_mode_limit(&bw_params->dc_mode_limit, &bw_params->clk_table);
 
 	return true;
 }
Signature · 1 line
2.53.0
#4 lore raw

PATCH 4/34 drm/amd/display: Fix DCN60 UTM QoS override for invalid PMFW table

In reply to Fangzhi Zuo

From: Wenjing Liu <[email protected]>

[Why]
The QoS model override for a display IP block was silently skipped whenever the firmware-populated table was invalid.

[How]
Always re-point the bandwidth params at the driver's own persistent QoS model storage before applying the override, instead of returning early when the firmware-populated model is NULL.

---
 .../display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c  | 20 +++++++++----------
 1 file changed, 9 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c +9 -11
index 4cca1db2a79a..04891ae776b6 100644
@@ -706,20 +706,18 @@ static void dcn60_copy_utm_qos_model_to_soc_table(
 
 /**
  * dcn60_override_utm_qos_model - Override the UTM QoS model.
+ * @clk_mgr: clock manager instance
  * @bw_params: clock manager bandwidth parameters
  */
-static void dcn60_override_utm_qos_model(struct clk_bw_params *bw_params)
+static void dcn60_override_utm_qos_model(struct clk_mgr_internal *clk_mgr,
+		struct clk_bw_params *bw_params)
 {
-	struct utm_qos_model *qos_model;
-	struct utm_qos_model_dchub_v3 *dchub;
-
-	if (!bw_params->utm_qos_model
-			|| bw_params->utm_qos_model->version != utm_qos_model_version_v3
-			|| !bw_params->utm_qos_model->dchub_v3)
-		return;
+	struct dcn60_clk_mgr *dcn60_clk_mgr =
+			container_of(clk_mgr, struct dcn60_clk_mgr, base);
+	struct utm_qos_model *qos_model = &dcn60_clk_mgr->utm_qos_model;
+	struct utm_qos_model_dchub_v3 *dchub = &dcn60_clk_mgr->dchub_v3;
 
-	qos_model = (struct utm_qos_model *)bw_params->utm_qos_model;
-	dchub = (struct utm_qos_model_dchub_v3 *)qos_model->dchub_v3;
+	bw_params->utm_qos_model = qos_model;
 
 	dcn6_test_initialize_utm_qos_model_v3(qos_model, dchub);
 
@@ -735,7 +733,7 @@ static void dcn60_override_bw_params(struct clk_mgr_internal *clk_mgr,
 	dcn60_override_dc_mode_limit(clk_mgr, bw_params);
 
 	if (dcn60_should_apply_temp_utm_override)
-		dcn60_override_utm_qos_model(bw_params);
+		dcn60_override_utm_qos_model(clk_mgr, bw_params);
 }
 
 /**
Signature · 1 line
2.53.0
#5 lore raw

PATCH 5/34 drm/amd/display: Serialize HDMI FRL status polling against link detect

In reply to Fangzhi Zuo

[WHY]
The HDMI FRL status polling work can run concurrently with link detect after an unplug/replug. Both paths access the same link through DDC and may perform FRL link training, while the polling path also reads link state without holding dc_lock.

[HOW]
Use mutex_trylock() to serialize the complete link walk, FRL status polling, and retraining sequence with dc_lock. If the lock is busy, defer the background poll to the next 200ms cycle instead of blocking an active detect, modeset, or flip.

---
 .../display/amdgpu_dm/amdgpu_dm_connector.c   | 35 +++++++++++--------
 1 file changed, 21 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c +21 -14
index 7ebf7216b499..3255f5b2dde6 100644
@@ -3109,26 +3109,33 @@ void hdmi_frl_status_polling_work(struct work_struct *work)
 	struct dc *dc = dm->dc;
 	struct dc_link *dc_link;
 	bool link_update = false;
+	bool link_detected;
 
-	for (int i = 0; i < MAX_LINKS; i++) {
-		dc_link = dc->links[i];
+	/* Defer to the next cycle rather than block on a busy dc_lock. */
+	if (mutex_trylock(&dm->dc_lock)) {
+		for (int i = 0; i < MAX_LINKS; i++) {
+			dc_link = dc->links[i];
 
+			if (!dc_link || !dc_link->local_sink)
+				continue;
 
-		if (!dc_link || !dc_link->local_sink)
-			continue;
-
-		if (!dc_is_hdmi_signal(dc_link->connector_signal))
-			continue;
+			if (!dc_is_hdmi_signal(dc_link->connector_signal))
+				continue;
 
-		if (dc_link->frl_link_settings.frl_link_rate == 0)
-			continue;
+			if (dc_link->frl_link_settings.frl_link_rate == 0)
+				continue;
 
-		link_update = dc_link_frl_poll_status_flag(dc_link);
-		if (link_update) {
-			mutex_lock(&dm->dc_lock);
-			dc_link_detect(dc_link, DETECT_REASON_RETRAIN);
-			mutex_unlock(&dm->dc_lock);
+		link_update =
+			dc_link_frl_poll_status_flag(dc_link);
+			if (link_update) {
+				link_detected =
+					dc_link_detect(
+						dc_link, DETECT_REASON_RETRAIN);
+				if (!link_detected)
+					DRM_ERROR("HDMI FRL retrain failed\n");
+			}
 		}
+		mutex_unlock(&dm->dc_lock);
 	}
 
 	queue_delayed_work(dm->hdmi_frl_status_polling_wq,
Signature · 1 line
2.53.0
#6 lore raw

PATCH 6/34 drm/amd/display: Add missing message to static_assert

In reply to Fangzhi Zuo

From: Dominik Kaszewski <[email protected]>

[Why & How]
static_assert requires a message in older standards.

---
 drivers/gpu/drm/amd/display/dc/dc_memory_pool.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dc_memory_pool.c +8 -2
index 904f8c4a4783..6557bc9221f3 100644
@@ -58,8 +58,14 @@ struct dc_memory_pool {
 	char _reserved2[PAGE_SIZE - sizeof(atomic64_t)];
 };
 
-static_assert(sizeof(struct dc_memory_pool) == 2 * PAGE_SIZE);
-static_assert(offsetof(struct dc_memory_pool, free_head) == PAGE_SIZE);
+static_assert(
+		sizeof(struct dc_memory_pool) == 2 * PAGE_SIZE,
+		"dc_memory_pool size should be 2 pages"
+);
+static_assert(
+		offsetof(struct dc_memory_pool, free_head) == PAGE_SIZE,
+		"dc_memory_pool free_head should be aligned to page"
+);
 
 static size_t divide_ceiling(size_t x, size_t d)
 {
Signature · 1 line
2.53.0
#7 lore raw

PATCH 7/34 drm/amd/display: Add dcn60 revision specific clock overrides

In reply to Fangzhi Zuo

From: Dillon Varone <[email protected]>

[WHY&HOW]
Not all revisions require the same clock overrides.

---
 .../gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c    | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c +4 -2
index 04891ae776b6..26972c220e34 100644
@@ -729,8 +729,10 @@ static void dcn60_override_utm_qos_model(struct clk_mgr_internal *clk_mgr,
 static void dcn60_override_bw_params(struct clk_mgr_internal *clk_mgr,
 		struct clk_bw_params *bw_params)
 {
-	dcn60_override_clk_table(clk_mgr, &bw_params->clk_table);
-	dcn60_override_dc_mode_limit(clk_mgr, bw_params);
+	if (!ASICREV_IS_DCN6_VARIANT_LITE3(clk_mgr->base.ctx->asic_id.hw_internal_rev)) {
+		dcn60_override_clk_table(clk_mgr, &bw_params->clk_table);
+		dcn60_override_dc_mode_limit(clk_mgr, bw_params);
+	}
 
 	if (dcn60_should_apply_temp_utm_override)
 		dcn60_override_utm_qos_model(clk_mgr, bw_params);
Signature · 1 line
2.53.0
#8 lore raw

PATCH 8/34 drm/amd/display: Change default SR z8 exit/enter value

In reply to Fangzhi Zuo

From: Fudongwang <[email protected]>

[WHY+HOW]
According to HW, change default z8 enter/exist for dcn314. SR Z8 exit = 268, change to 390.
SR Z8 enter = 393, change to 601.

---
 drivers/gpu/drm/amd/display/dc/dml/dcn314/dcn314_fpu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dml/dcn314/dcn314_fpu.c +2 -2
index 2f9ae79da731..1854137d5b9e 100644
@@ -150,8 +150,8 @@ static struct _vcs_dpi_soc_bounding_box_st dcn3_14_soc = {
 	.num_states = 5,
 	.sr_exit_time_us = 16.5,
 	.sr_enter_plus_exit_time_us = 18.5,
-	.sr_exit_z8_time_us = 268.0,
-	.sr_enter_plus_exit_z8_time_us = 393.0,
+	.sr_exit_z8_time_us = 390.0,
+	.sr_enter_plus_exit_z8_time_us = 601.0,
 	.writeback_latency_us = 12.0,
 	.dram_channel_width_bytes = 4,
 	.round_trip_ping_latency_dcfclk_cycles = 106,
Signature · 1 line
2.53.0
#9 lore raw

PATCH 9/34 drm/amd/display: Keep public DC lifecycle APIs stable beside Core 2

In reply to Fangzhi Zuo

From: "Cheng, Tony" <[email protected]>

DMs still call dc_hardware_init and dc_hardware_release while Core 2 lands next to legacy. Those entry points live in dc/dc_api_dispatch:
LEGACY calls the old bodies directly, CORE2 uses core2_funcs. dc_create allocates struct dc2 and returns the inner dc (TO_DC2). The shim only records selection; dc_construct still constructs Core2. No dispatch fields on public struct dc, and no architect spec edits.

TO_DC2 is a typed upcast (struct dc is the first member of struct dc2). Shim headers are included for UNIT_TEST as well as production so TO_DC2 is defined when core_gtest compiles dc.c.

Assisted-by Cursor:cursor
---
 drivers/gpu/drm/amd/display/dc/Makefile       |  3 ++
 drivers/gpu/drm/amd/display/dc/core/dc.c      | 30 ++++++++++++----
 .../drm/amd/display/dc/core2/CMakeLists.txt   | 10 ++++++
 .../gpu/drm/amd/display/dc/core2/dc_core2.c   | 34 +++++++++++++++++++
 .../gpu/drm/amd/display/dc/core2/dc_core2.h   | 19 +++++++++++
 .../drm/amd/display/dc/core2/dc_core2_init.c  | 13 +++++++
 .../drm/amd/display/dc/core2/dc_core2_init.h  | 10 ++++++
 drivers/gpu/drm/amd/display/dc/dc.h           |  2 ++
 .../display/dc/dc_api_dispatch/CMakeLists.txt |  9 +++++
 .../amd/display/dc/dc_api_dispatch/api_shim.c | 32 +++++++++++++++++
 .../amd/display/dc/dc_api_dispatch/api_shim.h | 19 +++++++++++
 .../amd/display/dc/inc/dc_core_interface.h    | 31 +++++++++++++++++
 12 files changed, 206 insertions(+), 6 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/display/dc/core2/CMakeLists.txt
 create mode 100644 drivers/gpu/drm/amd/display/dc/core2/dc_core2.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/core2/dc_core2.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/core2/dc_core2_init.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/core2/dc_core2_init.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/dc_api_dispatch/CMakeLists.txt
 create mode 100644 drivers/gpu/drm/amd/display/dc/dc_api_dispatch/api_shim.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/dc_api_dispatch/api_shim.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/inc/dc_core_interface.h
drivers/gpu/drm/amd/display/dc/Makefile +3 -0
index 99aa8f75de7b..f868999515dd 100644
@@ -69,6 +69,7 @@ FILES += dc_fused_io.o
 FILES += dc_helper.o
 FILES += dc_memory_pool.o
 FILES += core/dc.o
+FILES += dc_api_dispatch/api_shim.o
 FILES += core/dc_debug.o
 FILES += core/dc_hw_sequencer.o
 FILES += core/dc_link_enc_cfg.o
@@ -80,6 +81,8 @@ FILES += core/dc_state.o
 FILES += core/dc_stream.o
 FILES += core/dc_surface.o
 FILES += core/dc_vm_helper.o
+FILES += core2/dc_core2.o
+FILES += core2/dc_core2_init.o
 
 AMD_DISPLAY_FILES += $(addprefix $(AMDDALPATH)/dc/, $(FILES))
 
drivers/gpu/drm/amd/display/dc/core/dc.c +24 -6
index 369569e3b701..17db12fe8022 100644
@@ -90,6 +90,8 @@
 #endif
 
 #include "dce/dmub_outbox.h"
+#include "dc_api_dispatch/api_shim.h"
+#include "core2/dc_core2.h"
 
 #define CTX \
 	dc->ctx
@@ -982,6 +984,8 @@ static void dc_destruct(struct dc *dc)
 	kfree(dc->vm_helper);
 	dc->vm_helper = NULL;
 
+	if (TO_DC2(dc)->selection == DC2_SELECTION_CORE2)
+		core2_destruct(dc);
 }
 
 static bool dc_construct_ctx(struct dc *dc,
@@ -1179,6 +1183,10 @@ static bool dc_construct(struct dc *dc,
 		goto fail;
 	}
 
+	api_shim_construct(dc, init_params);
+	if (TO_DC2(dc)->selection == DC2_SELECTION_CORE2)
+		core2_construct(dc);
+
 	return true;
 
 fail:
@@ -1565,7 +1573,8 @@ static void disable_vbios_mode_if_required(
 
 struct dc *dc_create(const struct dc_init_data *init_params)
 {
-	struct dc *dc = kvzalloc_obj(*dc);
+	struct dc2 *dc2 = kvzalloc_obj(*dc2);
+	struct dc *dc = dc2 ? &dc2->dc : NULL;
 	unsigned int full_pipe_count;
 
 	if (!dc)
@@ -1613,7 +1622,7 @@ struct dc *dc_create(const struct dc_init_data *init_params)
 
 destruct_dc:
 	dc_destruct(dc);
-	kvfree(dc);
+	kvfree(TO_DC2(dc));
 	return NULL;
 }
 
@@ -1639,7 +1648,7 @@ static void detect_edp_presence(struct dc *dc)
 	}
 }
 
-void dc_hardware_init(struct dc *dc)
+void legacy_hardware_init(struct dc *dc)
 {
 
 	detect_edp_presence(dc);
@@ -1662,7 +1671,7 @@ void dc_deinit_callbacks(struct dc *dc)
 void dc_destroy(struct dc **dc)
 {
 	dc_destruct(*dc);
-	kvfree(*dc);
+	kvfree(TO_DC2(*dc));
 	*dc = NULL;
 }
 
@@ -6676,8 +6685,7 @@ bool dc_is_plane_eligible_for_idle_optimizations(struct dc *dc,
 	return false;
 }
 
-/* cleanup on driver unload */
-void dc_hardware_release(struct dc *dc)
+void legacy_hardware_release(struct dc *dc)
 {
 	dc_mclk_switch_using_fw_based_vblank_stretch_shut_down(dc);
 
@@ -6685,6 +6693,16 @@ void dc_hardware_release(struct dc *dc)
 		dc->hwss.hardware_release(dc);
 }
 
+static const struct dc2_funcs dc2_legacy_funcs_table = {
+	.hardware_init = legacy_hardware_init,
+	.hardware_release = legacy_hardware_release,
+};
+
+const struct dc2_funcs *dc2_legacy_funcs(void)
+{
+	return &dc2_legacy_funcs_table;
+}
+
 void dc_mclk_switch_using_fw_based_vblank_stretch_shut_down(struct dc *dc)
 {
 	if (dc->current_state)
drivers/gpu/drm/amd/display/dc/core2/CMakeLists.txt new file +10 -0
new file mode 100644
index 000000000000..c20602c351b5
@@ -0,0 +1,10 @@
+#
+# @file  CMakeLists.txt
+# @brief Core 2 sources. Subdirectory files are listed relative to this dir.
+# @copyright Copyright © 2026 Advanced Micro Devices, Inc. All rights reserved.
+#
+
+dal3_subdirectory_sources(
+  dc_core2.c
+  dc_core2_init.c
+  )
drivers/gpu/drm/amd/display/dc/core2/dc_core2.c new file +34 -0
new file mode 100644
index 000000000000..f496e4d66575
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright 2026 Advanced Micro Devices, Inc.
+ */
+
+#include "dm_services.h"
+#include "dc.h"
+#include "core2/dc_core2.h"
+#include "core2/dc_core2_init.h"
+
+static void core2_hardware_release(struct dc *dc)
+{
+	dc2_legacy_funcs()->hardware_release(dc);
+}
+
+static const struct dc2_funcs core2_funcs_table = {
+	.hardware_init = core2_hardware_init,
+	.hardware_release = core2_hardware_release,
+};
+
+const struct dc2_funcs *core2_funcs(void)
+{
+	return &core2_funcs_table;
+}
+
+void core2_construct(struct dc *dc)
+{
+	(void)dc;
+}
+
+void core2_destruct(struct dc *dc)
+{
+	(void)dc;
+}
drivers/gpu/drm/amd/display/dc/core2/dc_core2.h new file +19 -0
new file mode 100644
index 000000000000..a761e85a9973
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright 2026 Advanced Micro Devices, Inc.
+ */
+
+#pragma once
+
+#include "inc/dc_core_interface.h"
+
+struct dc;
+
+struct dc_core2 {
+	const struct dc2_funcs *legacy_funcs;
+};
+
+/* Core2-local; selection lives in the API shim, not here. */
+const struct dc2_funcs *core2_funcs(void);
+void core2_construct(struct dc *dc);
+void core2_destruct(struct dc *dc);
drivers/gpu/drm/amd/display/dc/core2/dc_core2_init.c new file +13 -0
new file mode 100644
index 000000000000..d4777cdbd569
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright 2026 Advanced Micro Devices, Inc.
+ */
+
+#include "dm_services.h"
+#include "dc.h"
+#include "core2/dc_core2_init.h"
+
+void core2_hardware_init(struct dc *dc)
+{
+	dc2_legacy_funcs()->hardware_init(dc);
+}
drivers/gpu/drm/amd/display/dc/core2/dc_core2_init.h new file +10 -0
new file mode 100644
index 000000000000..a4fa0365cd4f
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright 2026 Advanced Micro Devices, Inc.
+ */
+
+#pragma once
+
+struct dc;
+
+void core2_hardware_init(struct dc *dc);
drivers/gpu/drm/amd/display/dc/dc.h +2 -0
index c8e6e949ce79..9c8e55715e47 100644
@@ -51,6 +51,7 @@
 #include "dml/dml1_frl_cap_chk.h"
 
 #include "sspl/dc_spl_types.h"
+#include "inc/dc_core_interface.h"
 
 struct abm_save_restore;
 
@@ -1389,6 +1390,7 @@ struct dc_init_data {
 	uint32_t *nbio_reg_offsets;
 	uint32_t *clk_reg_offsets;
 	void *bb_from_dmub;
+	enum dc2_selection dc2_selection;
 };
 
 struct dc_callback_init {
drivers/gpu/drm/amd/display/dc/dc_api_dispatch/CMakeLists.txt new file +9 -0
new file mode 100644
index 000000000000..1654558a844d
@@ -0,0 +1,9 @@
+#
+# @file  CMakeLists.txt
+# @brief DC API dispatch / public shim. Subdirectory files are listed relative to this dir.
+# @copyright Copyright © 2026 Advanced Micro Devices, Inc. All rights reserved.
+#
+
+dal3_subdirectory_sources(
+  api_shim.c
+  )
drivers/gpu/drm/amd/display/dc/dc_api_dispatch/api_shim.c new file +32 -0
new file mode 100644
index 000000000000..3dcfde8308c5
@@ -0,0 +1,32 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright 2026 Advanced Micro Devices, Inc.
+ */
+
+#include "dm_services.h"
+#include "dc.h"
+#include "dc_api_dispatch/api_shim.h"
+#include "core2/dc_core2.h"
+#include "inc/dc_core_interface.h"
+
+void api_shim_construct(struct dc *dc, const struct dc_init_data *init_params)
+{
+	/* DM override today; ASIC allow-list later. Owned only by this shim. */
+	TO_DC2(dc)->selection = init_params->dc2_selection;
+}
+
+void dc_hardware_init(struct dc *dc)
+{
+	if (TO_DC2(dc)->selection == DC2_SELECTION_CORE2)
+		core2_funcs()->hardware_init(dc);
+	else
+		legacy_hardware_init(dc);
+}
+
+void dc_hardware_release(struct dc *dc)
+{
+	if (TO_DC2(dc)->selection == DC2_SELECTION_CORE2)
+		core2_funcs()->hardware_release(dc);
+	else
+		legacy_hardware_release(dc);
+}
drivers/gpu/drm/amd/display/dc/dc_api_dispatch/api_shim.h new file +19 -0
new file mode 100644
index 000000000000..fee03a5dd596
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright 2026 Advanced Micro Devices, Inc.
+ */
+
+#pragma once
+
+#include "dc.h"
+#include "inc/dc_core_interface.h"
+
+struct dc2 {
+	/* First member: TO_DC2 is a typed upcast, not container_of. */
+	struct dc dc;
+	enum dc2_selection selection;
+};
+
+#define TO_DC2(ptr) ((struct dc2 *)(ptr))
+
+void api_shim_construct(struct dc *dc, const struct dc_init_data *init_params);
drivers/gpu/drm/amd/display/dc/inc/dc_core_interface.h new file +31 -0
new file mode 100644
index 000000000000..35a6218c1285
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright 2026 Advanced Micro Devices, Inc.
+ */
+
+#pragma once
+
+struct dc;
+
+/*
+ * Construction-time Core implementation selection. Zero is LEGACY so existing
+ * callers that leave dc uninitialized keep production behavior.
+ */
+enum dc2_selection {
+	DC2_SELECTION_LEGACY = 0,
+	DC2_SELECTION_CORE2,
+};
+
+enum dc2_hw_ownership {
+	DC2_HW_OWNERSHIP_RELEASED = 0,
+	DC2_HW_OWNERSHIP_OWNED,
+};
+
+struct dc2_funcs {
+	void (*hardware_init)(struct dc *dc);
+	void (*hardware_release)(struct dc *dc);
+};
+
+void legacy_hardware_init(struct dc *dc);
+void legacy_hardware_release(struct dc *dc);
+const struct dc2_funcs *dc2_legacy_funcs(void);
Signature · 1 line
2.53.0
#10 lore raw

Re: [PATCH 09/34] drm/amd/display: Keep public DC lifecycle APIs stable beside Core 2

Quoted 32 lines · Fangzhi Zuo

From: "Cheng, Tony" <[email protected]>

DMs still call dc_hardware_init and dc_hardware_release while Core 2 lands next to legacy. Those entry points live in dc/dc_api_dispatch:
LEGACY calls the old bodies directly, CORE2 uses core2_funcs. dc_create allocates struct dc2 and returns the inner dc (TO_DC2). The shim only records selection; dc_construct still constructs Core2. No dispatch fields on public struct dc, and no architect spec edits.

TO_DC2 is a typed upcast (struct dc is the first member of struct dc2). Shim headers are included for UNIT_TEST as well as production so TO_DC2 is defined when core_gtest compiles dc.c.

Assisted-by Cursor:cursor
---
 drivers/gpu/drm/amd/display/dc/Makefile       |  3 ++
 drivers/gpu/drm/amd/display/dc/core/dc.c      | 30 ++++++++++++----
 .../drm/amd/display/dc/core2/CMakeLists.txt   | 10 ++++++
 .../gpu/drm/amd/display/dc/core2/dc_core2.c   | 34 +++++++++++++++++++
 .../gpu/drm/amd/display/dc/core2/dc_core2.h   | 19 +++++++++++
 .../drm/amd/display/dc/core2/dc_core2_init.c  | 13 +++++++
 .../drm/amd/display/dc/core2/dc_core2_init.h  | 10 ++++++
 drivers/gpu/drm/amd/display/dc/dc.h           |  2 ++
 .../display/dc/dc_api_dispatch/CMakeLists.txt |  9 +++++
 .../amd/display/dc/dc_api_dispatch/api_shim.c | 32 +++++++++++++++++
 .../amd/display/dc/dc_api_dispatch/api_shim.h | 19 +++++++++++
 .../amd/display/dc/inc/dc_core_interface.h    | 31 +++++++++++++++++
 12 files changed, 206 insertions(+), 6 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/display/dc/core2/CMakeLists.txt
Quoted 8 lines
 create mode 100644 drivers/gpu/drm/amd/display/dc/core2/dc_core2.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/core2/dc_core2.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/core2/dc_core2_init.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/core2/dc_core2_init.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/dc_api_dispatch/CMakeLists.txt
 create mode 100644 drivers/gpu/drm/amd/display/dc/dc_api_dispatch/api_shim.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/dc_api_dispatch/api_shim.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/inc/dc_core_interface.h

This patch appears to be causing the following build errors I'm getting with W=1 C=1 builds. Per my AI agent:

Found it — definitively. It's sparse, not GCC.

Your build runs make C=1/C=2 (the CHECK lines). I reproduced the exact failure with your sparse (v0.6.5-rc1):

# same include spelling twice  → #pragma once works
direct.c       → OK
# once direct, once via a "../" path to the same file → FAILS
sub/../real/hdr.h:2: error: redefinition of unsigned int enum e_test

That is precisely the kernel situation. In the amdgpu build, every display include path carries an amdgpu/../display/... prefix. dc_core_interface.h gets reached twice inside one translation unit via two differently-spelled paths (through dc.h and through api_shim.h/dc_core2.h). GCC canonicalizes the .. and dedups by real path/inode — so CC [M] succeeds (I proved a full build exits 0). Sparse does not canonicalize .., treats them as two files, processes the enum twice → redefinition of unsigned int enum dc2_selection.

So the chain is:
- Root cause: the four files this AMD commit added are the only ones in amd/display using #pragma once; the rest use #ifndef guards. #pragma once is fragile under sparse's path handling, which is exactly why the subsystem avoids it.
- Trigger: your build invokes sparse (C=), which GCC-only builds don't exercise — that's why I couldn't reproduce it earlier and why CC passes while CHECK fails.

Fix

Convert the new headers from #pragma once to standard #ifndef include guards (matches subsystem convention, upstreamable, keeps sparse working). The enum redefinition comes specifically from dc/inc/dc_core_interface.h (the only one double-included in a single TU), but for consistency the same four files are:

- dc/inc/dc_core_interface.h ← the one causing the error
- dc/dc_api_dispatch/api_shim.h
- dc/core2/dc_core2.h
- dc/core2/dc_core2_init.h

/jeff

#11 lore raw

Re: [PATCH 09/34] drm/amd/display: Keep public DC lifecycle APIs stable beside Core 2

Quoted 79 lines · Jeff Johnson
Quoted 32 lines · Fangzhi Zuo

From: "Cheng, Tony" <[email protected]>

DMs still call dc_hardware_init and dc_hardware_release while Core 2 lands next to legacy. Those entry points live in dc/dc_api_dispatch:
LEGACY calls the old bodies directly, CORE2 uses core2_funcs. dc_create allocates struct dc2 and returns the inner dc (TO_DC2). The shim only records selection; dc_construct still constructs Core2. No dispatch fields on public struct dc, and no architect spec edits.

TO_DC2 is a typed upcast (struct dc is the first member of struct dc2). Shim headers are included for UNIT_TEST as well as production so TO_DC2 is defined when core_gtest compiles dc.c.

Assisted-by Cursor:cursor
---
 drivers/gpu/drm/amd/display/dc/Makefile       |  3 ++
 drivers/gpu/drm/amd/display/dc/core/dc.c      | 30 ++++++++++++----
 .../drm/amd/display/dc/core2/CMakeLists.txt   | 10 ++++++
 .../gpu/drm/amd/display/dc/core2/dc_core2.c   | 34 +++++++++++++++++++
 .../gpu/drm/amd/display/dc/core2/dc_core2.h   | 19 +++++++++++
 .../drm/amd/display/dc/core2/dc_core2_init.c  | 13 +++++++
 .../drm/amd/display/dc/core2/dc_core2_init.h  | 10 ++++++
 drivers/gpu/drm/amd/display/dc/dc.h           |  2 ++
 .../display/dc/dc_api_dispatch/CMakeLists.txt |  9 +++++
 .../amd/display/dc/dc_api_dispatch/api_shim.c | 32 +++++++++++++++++
 .../amd/display/dc/dc_api_dispatch/api_shim.h | 19 +++++++++++
 .../amd/display/dc/inc/dc_core_interface.h    | 31 +++++++++++++++++
 12 files changed, 206 insertions(+), 6 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/display/dc/core2/CMakeLists.txt
Quoted 8 lines
 create mode 100644 drivers/gpu/drm/amd/display/dc/core2/dc_core2.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/core2/dc_core2.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/core2/dc_core2_init.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/core2/dc_core2_init.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/dc_api_dispatch/CMakeLists.txt
 create mode 100644 drivers/gpu/drm/amd/display/dc/dc_api_dispatch/api_shim.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/dc_api_dispatch/api_shim.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/inc/dc_core_interface.h

This patch appears to be causing the following build errors I'm getting with W=1 C=1 builds. Per my AI agent:

Found it — definitively. It's sparse, not GCC.

Your build runs make C=1/C=2 (the CHECK lines). I reproduced the exact failure with your sparse (v0.6.5-rc1):

# same include spelling twice  → #pragma once works
direct.c       → OK
# once direct, once via a "../" path to the same file → FAILS
sub/../real/hdr.h:2: error: redefinition of unsigned int enum e_test

That is precisely the kernel situation. In the amdgpu build, every display include path carries an amdgpu/../display/... prefix. dc_core_interface.h gets reached twice inside one translation unit via two differently-spelled paths (through dc.h and through api_shim.h/dc_core2.h). GCC canonicalizes the .. and dedups by real path/inode — so CC [M] succeeds (I proved a full build exits 0). Sparse does not canonicalize .., treats them as two files, processes the enum twice → redefinition of unsigned int enum dc2_selection.

So the chain is:
- Root cause: the four files this AMD commit added are the only ones in amd/display using #pragma once; the rest use #ifndef guards. #pragma once is fragile under sparse's path handling, which is exactly why the subsystem avoids it.
- Trigger: your build invokes sparse (C=), which GCC-only builds don't exercise — that's why I couldn't reproduce it earlier and why CC passes while CHECK fails.

Fix

Convert the new headers from #pragma once to standard #ifndef include guards (matches subsystem convention, upstreamable, keeps sparse working). The enum redefinition comes specifically from dc/inc/dc_core_interface.h (the only one double-included in a single TU), but for consistency the same four files are:

Quoted 6 lines

- dc/inc/dc_core_interface.h ← the one causing the error
- dc/dc_api_dispatch/api_shim.h
- dc/core2/dc_core2.h
- dc/core2/dc_core2_init.h

/jeff

Additional information for my agent:
The four new headers it adds use #pragma once instead of the #ifndef include guards used everywhere else in drivers/gpu/drm/amd/display/. dc/inc/dc_core_interface.h is included more than once within a single translation unit (via dc.h and again via api_shim.h/dc_core2.h). In the amdgpu build every display include path is spelled -I.../amdgpu/../display/..., so the header is reached through two paths that differ textually by a .. component.

GCC canonicalizes .. and dedups by real path, so CC builds cleanly. Sparse (tested v0.6.5) does not canonicalize .. for #pragma once, treats the two spellings as different files, and processes the file twice:

dc_core_interface.h:14: error: redefinition of unsigned int enum dc2_selection

#12 lore raw

Re: [PATCH 09/34] drm/amd/display: Keep public DC lifecycle APIs stable beside Core 2

Quoted 96 lines · Jeff Johnson
Quoted 79 lines · Jeff Johnson
Quoted 32 lines · Fangzhi Zuo

From: "Cheng, Tony" <[email protected]>

DMs still call dc_hardware_init and dc_hardware_release while Core 2 lands next to legacy. Those entry points live in dc/dc_api_dispatch:
LEGACY calls the old bodies directly, CORE2 uses core2_funcs. dc_create allocates struct dc2 and returns the inner dc (TO_DC2). The shim only records selection; dc_construct still constructs Core2. No dispatch fields on public struct dc, and no architect spec edits.

TO_DC2 is a typed upcast (struct dc is the first member of struct dc2). Shim headers are included for UNIT_TEST as well as production so TO_DC2 is defined when core_gtest compiles dc.c.

Assisted-by Cursor:cursor
---
 drivers/gpu/drm/amd/display/dc/Makefile       |  3 ++
 drivers/gpu/drm/amd/display/dc/core/dc.c      | 30 ++++++++++++----
 .../drm/amd/display/dc/core2/CMakeLists.txt   | 10 ++++++
 .../gpu/drm/amd/display/dc/core2/dc_core2.c   | 34 +++++++++++++++++++
 .../gpu/drm/amd/display/dc/core2/dc_core2.h   | 19 +++++++++++
 .../drm/amd/display/dc/core2/dc_core2_init.c  | 13 +++++++
 .../drm/amd/display/dc/core2/dc_core2_init.h  | 10 ++++++
 drivers/gpu/drm/amd/display/dc/dc.h           |  2 ++
 .../display/dc/dc_api_dispatch/CMakeLists.txt |  9 +++++
 .../amd/display/dc/dc_api_dispatch/api_shim.c | 32 +++++++++++++++++
 .../amd/display/dc/dc_api_dispatch/api_shim.h | 19 +++++++++++
 .../amd/display/dc/inc/dc_core_interface.h    | 31 +++++++++++++++++
 12 files changed, 206 insertions(+), 6 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/display/dc/core2/CMakeLists.txt
Quoted 8 lines
 create mode 100644 drivers/gpu/drm/amd/display/dc/core2/dc_core2.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/core2/dc_core2.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/core2/dc_core2_init.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/core2/dc_core2_init.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/dc_api_dispatch/CMakeLists.txt
 create mode 100644 drivers/gpu/drm/amd/display/dc/dc_api_dispatch/api_shim.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/dc_api_dispatch/api_shim.h
 create mode 100644 drivers/gpu/drm/amd/display/dc/inc/dc_core_interface.h

This patch appears to be causing the following build errors I'm getting with W=1 C=1 builds. Per my AI agent:

Found it — definitively. It's sparse, not GCC.

Your build runs make C=1/C=2 (the CHECK lines). I reproduced the exact failure with your sparse (v0.6.5-rc1):

# same include spelling twice  → #pragma once works
direct.c       → OK
# once direct, once via a "../" path to the same file → FAILS
sub/../real/hdr.h:2: error: redefinition of unsigned int enum e_test

That is precisely the kernel situation. In the amdgpu build, every display include path carries an amdgpu/../display/... prefix. dc_core_interface.h gets reached twice inside one translation unit via two differently-spelled paths (through dc.h and through api_shim.h/dc_core2.h). GCC canonicalizes the .. and dedups by real path/inode — so CC [M] succeeds (I proved a full build exits 0). Sparse does not canonicalize .., treats them as two files, processes the enum twice → redefinition of unsigned int enum dc2_selection.

So the chain is:
- Root cause: the four files this AMD commit added are the only ones in amd/display using #pragma once; the rest use #ifndef guards. #pragma once is fragile under sparse's path handling, which is exactly why the subsystem avoids it.
- Trigger: your build invokes sparse (C=), which GCC-only builds don't exercise — that's why I couldn't reproduce it earlier and why CC passes while CHECK fails.

Fix

Convert the new headers from #pragma once to standard #ifndef include guards (matches subsystem convention, upstreamable, keeps sparse working). The enum redefinition comes specifically from dc/inc/dc_core_interface.h (the only one double-included in a single TU), but for consistency the same four files are:

Quoted 6 lines

- dc/inc/dc_core_interface.h ← the one causing the error
- dc/dc_api_dispatch/api_shim.h
- dc/core2/dc_core2.h
- dc/core2/dc_core2_init.h

/jeff

Additional information for my agent:
The four new headers it adds use #pragma once instead of the #ifndef include guards used everywhere else in drivers/gpu/drm/amd/display/. dc/inc/dc_core_interface.h is included more than once within a single translation unit (via dc.h and again via api_shim.h/dc_core2.h). In the amdgpu build every display include path is spelled -I.../amdgpu/../display/..., so the header is reached through two paths that differ textually by a .. component.

Quoted 6 lines

GCC canonicalizes .. and dedups by real path, so CC builds cleanly. Sparse (tested v0.6.5) does not canonicalize .. for #pragma once, treats the two spellings as different files, and processes the file twice:

dc_core_interface.h:14: error: redefinition of unsigned int enum dc2_selection

Since I was blocked I had my agent create a patch:
https://lore.kernel.org/all/[email protected]

#13 lore raw

PATCH 10/34 drm/amd/display: Disable gamcor light sleep before gamcor program

In reply to Fangzhi Zuo

From: Alvin Lee <[email protected]>

[Description]
- Gamcor light sleep must be disabled before gamcor programming
- Mirror the programming sequence for DSCL light sleep
- Create a dcn60 version for gamcor programming
- Make dcn30 helper functions public so they can be called from the new dcn60 function

---
 drivers/gpu/drm/amd/display/dc/dpp/Makefile   |   2 +-
 .../drm/amd/display/dc/dpp/dcn30/dcn30_dpp.h  |  22 ++++
 .../amd/display/dc/dpp/dcn30/dcn30_dpp_cm.c   |  10 +-
 .../drm/amd/display/dc/dpp/dcn60/dcn60_dpp.c  |   2 +-
 .../drm/amd/display/dc/dpp/dcn60/dcn60_dpp.h  |   3 +
 .../amd/display/dc/dpp/dcn60/dcn60_dpp_cm.c   | 124 ++++++++++++++++++
 6 files changed, 156 insertions(+), 7 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/display/dc/dpp/dcn60/dcn60_dpp_cm.c
drivers/gpu/drm/amd/display/dc/dpp/Makefile +1 -1
index f5da45aacfca..2aaa0e8a8bd6 100644
@@ -99,7 +99,7 @@ AMD_DISPLAY_FILES += $(AMD_DAL_DPP_DCN50)
 
 ###############################################################################
 
-DPP_DCN60 = dcn60_dpp.o dcn60_dpp_dscl.o
+DPP_DCN60 = dcn60_dpp.o dcn60_dpp_dscl.o dcn60_dpp_cm.o
 
 AMD_DAL_DPP_DCN60 = $(addprefix $(AMDDALPATH)/dc/dpp/dcn60/,$(DPP_DCN60))
 
drivers/gpu/drm/amd/display/dc/dpp/dcn30/dcn30_dpp.h +22 -0
index 6a61b99d6a79..f397e8222ac9 100644
@@ -587,6 +587,28 @@ bool dpp3_construct(struct dcn3_dpp *dpp3,
 bool dpp3_program_gamcor_lut(
 	struct dpp *dpp_base, const struct pwl_params *params);
 
+struct dcn3_xfer_func_reg;
+
+void dpp3_enable_cm_block(
+	struct dpp *dpp_base);
+
+enum dc_lut_mode dpp30_get_gamcor_current(
+	struct dpp *dpp_base);
+
+void dpp3_program_gammcor_lut(
+	struct dpp *dpp_base,
+	const struct pwl_result_data *rgb,
+	uint32_t num,
+	bool is_ram_a);
+
+void dpp3_gamcor_reg_field(
+	struct dcn3_dpp *dpp,
+	struct dcn3_xfer_func_reg *reg);
+
+void dpp3_configure_gamcor_lut(
+	struct dpp *dpp_base,
+	bool is_ram_a);
+
 void dpp3_program_CM_dealpha(
 		struct dpp *dpp_base,
 		uint32_t enable, uint32_t additive_blending);
drivers/gpu/drm/amd/display/dc/dpp/dcn30/dcn30_dpp_cm.c +5 -5
index 083ab6acb687..86f47d33ec64 100644
@@ -42,7 +42,7 @@
 #define FN(reg_name, field_name) \
 	dpp->tf_shift->field_name, dpp->tf_mask->field_name
 
-static void dpp3_enable_cm_block(
+void dpp3_enable_cm_block(
 		struct dpp *dpp_base)
 {
 	struct dcn3_dpp *dpp = TO_DCN30_DPP(dpp_base);
@@ -56,7 +56,7 @@ static void dpp3_enable_cm_block(
 	REG_UPDATE(CM_CONTROL, CM_BYPASS, cm_bypass_mode);
 }
 
-static enum dc_lut_mode dpp30_get_gamcor_current(struct dpp *dpp_base)
+enum dc_lut_mode dpp30_get_gamcor_current(struct dpp *dpp_base)
 {
 	enum dc_lut_mode mode = LUT_BYPASS;
 	uint32_t state_mode;
@@ -76,7 +76,7 @@ static enum dc_lut_mode dpp30_get_gamcor_current(struct dpp *dpp_base)
 	return mode;
 }
 
-static void dpp3_program_gammcor_lut(
+void dpp3_program_gammcor_lut(
 		struct dpp *dpp_base,
 		const struct pwl_result_data *rgb,
 		uint32_t num,
@@ -171,7 +171,7 @@ void dpp3_program_cm_bias(
 			CM_BIAS_CB_B, bias_params->cm_bias_cb_b);
 }
 
-static void dpp3_gamcor_reg_field(
+void dpp3_gamcor_reg_field(
 		struct dcn3_dpp *dpp,
 		struct dcn3_xfer_func_reg *reg)
 {
@@ -204,7 +204,7 @@ static void dpp3_gamcor_reg_field(
 	reg->masks.exp_resion_start_segment = dpp->tf_mask->CM_GAMCOR_RAMA_EXP_REGION_START_SEGMENT_B;
 }
 
-static void dpp3_configure_gamcor_lut(
+void dpp3_configure_gamcor_lut(
 		struct dpp *dpp_base,
 		bool is_ram_a)
 {
drivers/gpu/drm/amd/display/dc/dpp/dcn60/dcn60_dpp.c +1 -1
index f02aebcedd70..be2effb14fc3 100644
@@ -294,7 +294,7 @@ void dpp60_full_bypass(struct dpp *dpp_base)
 }
 
 static struct dpp_funcs dcn60_dpp_funcs = {
-	.dpp_program_gamcor_lut		= dpp3_program_gamcor_lut,
+	.dpp_program_gamcor_lut		= dpp6_program_gamcor_lut,
 	.dpp_read_state				= dpp401_read_state,
 	.dpp_reset					= dpp_reset,
 	.dpp_set_scaler				= dpp60_dscl_set_scaler_manual_scale,
drivers/gpu/drm/amd/display/dc/dpp/dcn60/dcn60_dpp.h +3 -0
index a0cc57e79ff7..5d09fcd04553 100644
@@ -518,5 +518,8 @@ bool dpp60_construct(struct dcn60_dpp *dpp60,
 	const struct dcn60_dpp_shift *tf_shift,
 	const struct dcn60_dpp_mask *tf_mask);
 
+bool dpp6_program_gamcor_lut(
+	struct dpp *dpp_base, const struct pwl_params *params);
+
 
 #endif /* __DCN60_DPP_H__ */
drivers/gpu/drm/amd/display/dc/dpp/dcn60/dcn60_dpp_cm.c new file +124 -0

124 lines not on this page · raw message

Signature · 1 line
2.53.0
#14 lore raw

PATCH 11/34 drm/amd/display: Skip HDMI FRL status polling while link is down

In reply to Fangzhi Zuo

[WHY]
Hotplugging an HDMI FRL sink can wedge DMCUB when a poll-driven retrain lands on a link whose PHY has just been torn down. The status polling path can program PHY EQ on the disabled PHY, after which the sink SCDC reads back version 0 and the display fails to light up.

[HOW]
Skip FRL status polling unless the link is actively driving a stream. The check runs under dc_lock, so it is serialized with link detection and modesets while the PHY is being torn down.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c | 6 ++++--
 .../amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c  | 1 +
 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c +4 -2
index 3255f5b2dde6..5c43bffd36ac 100644
@@ -3125,8 +3125,10 @@ void hdmi_frl_status_polling_work(struct work_struct *work)
 			if (dc_link->frl_link_settings.frl_link_rate == 0)
 				continue;
 
-		link_update =
-			dc_link_frl_poll_status_flag(dc_link);
+			if (!dc_link->link_status.link_active)
+				continue;
+
+			link_update = dc_link_frl_poll_status_flag(dc_link);
 			if (link_update) {
 				link_detected =
 					dc_link_detect(
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c +1 -0
index bd55d943e4e5..94eec1da3a4e 100644
@@ -9026,6 +9026,7 @@ static struct dc_link *dm_test_frl_add_hdmi_link(struct kunit *test, struct dm_t
 	KUNIT_ASSERT_NOT_NULL(test, link->local_sink);
 	link->connector_signal = SIGNAL_TYPE_HDMI_TYPE_A;
 	link->frl_link_settings.frl_link_rate = HDMI_FRL_LINK_RATE_3GBPS;
+	link->link_status.link_active = true;
 
 	return link;
 }
Signature · 1 line
2.53.0
#15 lore raw

PATCH 12/34 drm/amd/display: Program OPP formatter for plane-less ODM segments

In reply to Fangzhi Zuo

From: Ashwin Santhosh <[email protected]>

why:
When a display is disabled the surviving DSC stream is committed with no planes but the dynamic ODM policy still expands it to a four to one combine. The added plane-less segments skip program_pipe so their OPP formatter is never configured. The DPG blank then feeds an unprogrammed formatter and the OPTC input underflows which flashes grey on screen.

how:
Program the OPP formatter for each plane-less OPP head in update_odm and update_odm_sequence the same way program_pipe does for planed pipes. Both function pointers are checked for null before calling. Every ODM segment now feeds valid data to the OPTC so the four to one combine no longer underflows.

---
 .../amd/display/dc/hwss/dcn401/dcn401_hwseq.c | 30 +++++++++++++++++++
 1 file changed, 30 insertions(+)
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c +30 -0
index 7780f37c615c..1d53240cd736 100644
@@ -1740,6 +1740,22 @@ void dcn401_update_odm(struct dc *dc, struct dc_state *context,
 				opp_heads[i]->stream_res.opp,
 				opp_heads[i]->stream->timing.pixel_encoding,
 				resource_is_pipe_type(opp_heads[i], OTG_MASTER));
+
+		// Plane-less OPP heads are skipped by program_pipe, where the OPP
+		// formatter is normally configured, so set it up for them here.
+		if (!opp_heads[i]->plane_state &&
+				opp_heads[i]->stream_res.opp->funcs->opp_set_dyn_expansion &&
+				opp_heads[i]->stream_res.opp->funcs->opp_program_fmt) {
+			opp_heads[i]->stream_res.opp->funcs->opp_set_dyn_expansion(
+					opp_heads[i]->stream_res.opp,
+					COLOR_SPACE_YCBCR601,
+					opp_heads[i]->stream->timing.display_color_depth,
+					opp_heads[i]->stream->signal);
+			opp_heads[i]->stream_res.opp->funcs->opp_program_fmt(
+					opp_heads[i]->stream_res.opp,
+					&opp_heads[i]->stream->bit_depth_params,
+					&opp_heads[i]->stream->clamping);
+		}
 	}
 
 	update_dsc_for_odm_change(dc, context, otg_master);
@@ -1876,6 +1892,20 @@ void dcn401_update_odm_sequence(struct dc *dc, struct dc_state *context,
 		/* Add OPP program left edge extra pixel operation */
 		hwss_add_opp_program_left_edge_extra_pixel(seq_state, opp_heads[i]->stream_res.opp,
 			opp_heads[i]->stream->timing.pixel_encoding, resource_is_pipe_type(opp_heads[i], OTG_MASTER));
+
+		//Plane-less OPP heads are skipped by program_pipe, where the OPP
+		// formatter is normally configured, so set it up for them here.
+		if (!opp_heads[i]->plane_state &&
+				opp_heads[i]->stream_res.opp->funcs->opp_set_dyn_expansion &&
+				opp_heads[i]->stream_res.opp->funcs->opp_program_fmt) {
+			hwss_add_opp_set_dyn_expansion(seq_state, opp_heads[i]->stream_res.opp,
+				COLOR_SPACE_YCBCR601,
+				opp_heads[i]->stream->timing.display_color_depth,
+				opp_heads[i]->stream->signal);
+			hwss_add_opp_program_fmt(seq_state, opp_heads[i]->stream_res.opp,
+				&opp_heads[i]->stream->bit_depth_params,
+				&opp_heads[i]->stream->clamping);
+		}
 	}
 
 	/* Add DSC update operations to sequence */
Signature · 1 line
2.53.0
#16 lore raw

PATCH 13/34 drm/amd/display: Remove unused copyright notice

In reply to Fangzhi Zuo

From: Jackson He <[email protected]>

[Why & How]
The copyright notice was carried over from code related to kernel floating-point support. The associated DC_FP_START() and DC_FP_END() macros are not present in SPL, so the notice is no longer applicable.

Remove the unused copyright notice from spl_os_types.h.

---
 drivers/gpu/drm/amd/display/dc/sspl/spl_os_types.h | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/display/dc/sspl/spl_os_types.h +0 -1
index 26553cd6890f..75ccf00f4389 100644
@@ -1,7 +1,6 @@
 /* SPDX-License-Identifier: MIT */
 
 /* Copyright 2024 Advanced Micro Devices, Inc. */
-/* Copyright 2019 Raptor Engineering, LLC */
 
 #ifndef _SPL_OS_TYPES_H_
 #define _SPL_OS_TYPES_H_
Signature · 1 line
2.53.0
#17 lore raw

PATCH 14/34 drm/amd/display: Enable DMUB HW cursor offload

In reply to Fangzhi Zuo

From: Ivan Lipski <[email protected]>

[why & how]
DCN60 supports cursor offload to DMU.

Request cursor offload in amdgpu_dm_init and initialize it after DMUB is up (dc_dmub_srv_cursor_offload_init), which should be picked up by all the ASICs that support cursor offload in the dcnX_resouce.c.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +++
 drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c      | 9 ++++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3 -0
index 16d1278996f8..b6d7be0c15bc 100644
@@ -723,6 +723,9 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
 
 	dc_hardware_init(adev->dm.dc);
 
+	/* Enable cursor offload if the ASIC supports it. */
+	dc_dmub_srv_cursor_offload_init(adev->dm.dc);
+
 	/* GOP/vBIOS may leave an OPTC enabled for a display present at power-on
 	 * but no longer driven (e.g. an external DP unplugged at boot). Such a
 	 * dangling pipe keeps DCN out of idle and blocks s0i3. Power it down
drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c +8 -1
index d9af53f720f7..37248ecc3c08 100644
@@ -1250,9 +1250,16 @@ void dc_dmub_srv_subvp_save_surf_addr(const struct dc_dmub_srv *dc_dmub_srv, con
 void dc_dmub_srv_cursor_offload_init(struct dc *dc)
 {
 	struct dmub_rb_cmd_cursor_offload_init *init;
-	struct dc_dmub_srv *dc_dmub_srv = dc->ctx->dmub_srv;
+	struct dc_dmub_srv *dc_dmub_srv;
 	union dmub_rb_cmd cmd;
 
+	if (!dc || !dc->ctx)
+		return;
+
+	dc_dmub_srv = dc->ctx->dmub_srv;
+	if (!dc_dmub_srv || !dc_dmub_srv->dmub)
+		return;
+
 	if (!dc->config.enable_cursor_offload)
 		return;
 
Signature · 1 line
2.53.0
#18 lore raw

PATCH 15/34 drm/amd/display: Add temporary programming for port control in dc_init

In reply to Fangzhi Zuo

From: Alvin Lee <[email protected]>

[Description]
Add the POR setting for SDP_PORT_CONTROL into dc init sequence. This is temporary until the initialization moves into pre-OS DMCUB.

---
 .../gpu/drm/amd/display/dc/hubbub/dcn60/dcn60_hubbub.c    | 8 ++++++++
 drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.c   | 5 +++++
 drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h          | 2 ++
 3 files changed, 15 insertions(+)
drivers/gpu/drm/amd/display/dc/hubbub/dcn60/dcn60_hubbub.c +8 -0
index 639c71cf1123..843a0da4bdd7 100644
@@ -1905,6 +1905,13 @@ static void hubbub60_override_utm_client_qc_profile(struct hubbub *hubbub, uint8
 	}
 }
 
+static void hubbub60_set_sdpif_port_control(struct hubbub *hubbub, bool ignore_cstate_req)
+{
+	struct dcn20_hubbub *hubbub2 = TO_DCN20_HUBBUB(hubbub);
+
+	REG_UPDATE(DCHUBBUB_SDPIF_CFG0, SDPIF_PORT_CONTROL, ignore_cstate_req);
+}
+
 static const struct hubbub_funcs hubbub60_funcs = {
 	.update_dchub = hubbub2_update_dchub,
 	.init_dchub_sys_ctx = hubbub60_init_dchub_sys_ctx,
@@ -1970,6 +1977,7 @@ static const struct hubbub_funcs hubbub60_funcs = {
 		.reset_display_qos_profile =
 			hubbub60_reset_display_qos_profile,
 	},
+	.set_sdpif_port_control = hubbub60_set_sdpif_port_control,
 };
 
 void hubbub60_construct(struct dcn20_hubbub *hubbub2,
drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.c +5 -0
index ef1c10bc9bfa..d515b9cbc934 100644
@@ -885,6 +885,11 @@ void dcn60_init_hw(struct dc *dc)
 		dc->res_pool->hubbub->funcs->override_utm_client_qc_profile(dc->res_pool->hubbub, dc->debug.utm_client_qc_profiles[1], 1);
 		dc->res_pool->hubbub->funcs->override_utm_client_qc_profile(dc->res_pool->hubbub, dc->debug.utm_client_qc_profiles[2], 2);
 	}
+		/* Temporary init for SDP port control in driver.
+		 * Remove once programming is in pre-OS DMU init.
+		 */
+	if (dc->res_pool->hubbub->funcs->set_sdpif_port_control)
+		dc->res_pool->hubbub->funcs->set_sdpif_port_control(dc->res_pool->hubbub, false);
 
 	// Get DMCUB capabilities
 	if (dc->ctx->dmub_srv) {
drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h +2 -0
index 8d1024a875a7..d68232f10f3e 100644
@@ -226,6 +226,8 @@ struct hubbub_funcs {
 
 	void (*hubbub_read_reg_state)(struct hubbub *hubbub, struct dcn_hubbub_reg_state *hubbub_reg_state);
 
+	void (*set_sdpif_port_control)(struct hubbub *hubbub, bool ignore_cstate_req);
+
 	/**
 	 * @program_det_size:
 	 *
Signature · 1 line
2.53.0
#19 lore raw

PATCH 16/34 drm/amd/display: map PWM brightness through custom backlight curve

In reply to Fangzhi Zuo

From: Ray Wu <[email protected]>

[Why/How]
On the PWM path, convert the userspace brightness to an input signal and derive the target luminance from the custom backlight curve, then pass the resulting millipercent to the power module.

This keeps PWM programming and backlight curve mapping in the power module, aligning the Linux path with the Windows behavior.

Fixes 3c108046e1d6 ("drm/amd/display: Add power module on Linux")
Assisted-by Cursor:Claude-Opus-4.8
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  2 +
 .../display/amdgpu_dm/amdgpu_dm_backlight.c   | 90 ++++++++++++++++---
 2 files changed, 80 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -0
index b6d7be0c15bc..96eb9ea3f497 100644
@@ -456,6 +456,8 @@ STATIC_IFN_KUNIT int amdgpu_dm_init_power_module(struct amdgpu_display_manager *
 		init_data[i].use_custom_backlight_caps = false;
 		init_data[i].custom_backlight_caps_config_no = 0;
 		init_data[i].use_linear_backlight_curve = false;
+		if (amdgpu_dc_debug_mask & DC_DISABLE_CUSTOM_BRIGHTNESS_CURVE)
+			init_data[i].use_linear_backlight_curve = true;
 		init_data[i].def_varibright_enable = 0;
 		init_data[i].varibright_level = 0;
 		/*
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.c +78 -12

132 lines not on this page · raw message

Signature · 1 line
2.53.0
#20 lore raw

PATCH 17/34 drm/amd/display: Flatten OPP_SET_DISP_PATTERN_GENERATOR parameters

In reply to Fangzhi Zuo

From: Piotr Maziarz <[email protected]>

[WHY]
opp2_set_disp_pattern_generator read debug.disable_dynamic_expansion_for_test_pattern through opp->ctx->dc while the sequence was executing. A block sequence operation must take its inputs from a flat parameter list resolved during the build phase, so this hid an input from the recorded sequence and left the FMT_DYNAMIC_EXP_CNTL branch unreachable from the OPP unit tests.

[HOW]
Added disable_dyn_exp_for_test_pattern to opp_funcs::opp_set_disp_pattern_generator and to opp_set_disp_pattern_generator_params, and updated every caller to pass dc->debug.disable_dynamic_expansion_for_test_pattern explicitly. Updated the unit test mocks and the core_gtest dumper, and extended opp_gtest to cover both values of the new flag.

---
 .../drm/amd/display/dc/core/dc_hw_sequencer.c | 38 ++++++++++++-------
 .../amd/display/dc/hwss/dcn20/dcn20_hwseq.c   | 10 +++--
 .../amd/display/dc/hwss/dcn201/dcn201_hwseq.c |  3 +-
 .../amd/display/dc/hwss/dcn30/dcn30_hwseq.c   |  4 +-
 .../amd/display/dc/hwss/dcn32/dcn32_hwseq.c   |  6 ++-
 .../amd/display/dc/hwss/dcn401/dcn401_hwseq.c |  9 +++--
 .../drm/amd/display/dc/hwss/hw_sequencer.h    |  4 +-
 drivers/gpu/drm/amd/display/dc/inc/hw/opp.h   |  3 +-
 .../drm/amd/display/dc/opp/dcn20/dcn20_opp.c  |  5 ++-
 .../drm/amd/display/dc/opp/dcn20/dcn20_opp.h  |  3 +-
 10 files changed, 54 insertions(+), 31 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +24 -14
index 28897addb553..e1d6e31af657 100644
@@ -3537,10 +3537,12 @@ void hwss_opp_set_disp_pattern_generator(union block_sequence_params *params)
 	int width = params->opp_set_disp_pattern_generator_params.width;
 	int height = params->opp_set_disp_pattern_generator_params.height;
 	int offset = params->opp_set_disp_pattern_generator_params.offset;
+	bool disable_dyn_exp =
+		params->opp_set_disp_pattern_generator_params.disable_dyn_exp_for_test_pattern;
 
 	if (opp && opp->funcs->opp_set_disp_pattern_generator) {
 		opp->funcs->opp_set_disp_pattern_generator(opp, test_pattern, color_space,
-			color_depth, solid_color, width, height, offset);
+			color_depth, solid_color, width, height, offset, disable_dyn_exp);
 	}
 }
 
@@ -4862,19 +4864,27 @@ void hwss_add_opp_set_disp_pattern_generator(struct block_sequence_state *seq_st
 		bool use_solid_color,
 		int width,
 		int height,
-		int offset)
-{
-	if (*seq_state->num_steps < MAX_HWSS_BLOCK_SEQUENCE_SIZE) {
-		seq_state->steps[*seq_state->num_steps].func = OPP_SET_DISP_PATTERN_GENERATOR;
-		seq_state->steps[*seq_state->num_steps].params.opp_set_disp_pattern_generator_params.opp = opp;
-		seq_state->steps[*seq_state->num_steps].params.opp_set_disp_pattern_generator_params.test_pattern = test_pattern;
-		seq_state->steps[*seq_state->num_steps].params.opp_set_disp_pattern_generator_params.color_space = color_space;
-		seq_state->steps[*seq_state->num_steps].params.opp_set_disp_pattern_generator_params.color_depth = color_depth;
-		seq_state->steps[*seq_state->num_steps].params.opp_set_disp_pattern_generator_params.solid_color = solid_color;
-		seq_state->steps[*seq_state->num_steps].params.opp_set_disp_pattern_generator_params.use_solid_color = use_solid_color;
-		seq_state->steps[*seq_state->num_steps].params.opp_set_disp_pattern_generator_params.width = width;
-		seq_state->steps[*seq_state->num_steps].params.opp_set_disp_pattern_generator_params.height = height;
-		seq_state->steps[*seq_state->num_steps].params.opp_set_disp_pattern_generator_params.offset = offset;
+		int offset,
+		bool disable_dyn_exp_for_test_pattern)
+{
+	if (*seq_state->num_steps < MAX_HWSS_BLOCK_SEQUENCE_SIZE) {
+		struct block_sequence *step = &seq_state->steps[*seq_state->num_steps];
+		union block_sequence_params *step_params = &step->params;
+		struct opp_set_disp_pattern_generator_params *pattern_params =
+			&step_params->opp_set_disp_pattern_generator_params;
+
+		step->func = OPP_SET_DISP_PATTERN_GENERATOR;
+		pattern_params->opp = opp;
+		pattern_params->test_pattern = test_pattern;
+		pattern_params->color_space = color_space;
+		pattern_params->color_depth = color_depth;
+		pattern_params->solid_color = solid_color;
+		pattern_params->use_solid_color = use_solid_color;
+		pattern_params->width = width;
+		pattern_params->height = height;
+		pattern_params->offset = offset;
+		pattern_params->disable_dyn_exp_for_test_pattern =
+				disable_dyn_exp_for_test_pattern;
 		(*seq_state->num_steps)++;
 	}
 }
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c +6 -4
index 45a4a7707507..f408589072d7 100644
@@ -458,7 +458,8 @@ void dcn20_init_blank(
 			&black_color,
 			otg_active_width,
 			otg_active_height,
-			0);
+			0,
+			dc->debug.disable_dynamic_expansion_for_test_pattern);
 
 	if (num_opps == 2) {
 		bottom_opp->funcs->opp_set_disp_pattern_generator(
@@ -469,7 +470,8 @@ void dcn20_init_blank(
 				&black_color,
 				otg_active_width,
 				otg_active_height,
-				0);
+				0,
+				dc->debug.disable_dynamic_expansion_for_test_pattern);
 	}
 
 	hws->funcs.wait_for_blank_complete(opp);
@@ -3339,7 +3341,7 @@ void dcn20_set_disp_pattern_generator(const struct dc *dc,
 		const struct tg_color *solid_color,
 		int width, int height, int offset)
 {
-	(void)dc;
 	pipe_ctx->stream_res.opp->funcs->opp_set_disp_pattern_generator(pipe_ctx->stream_res.opp, test_pattern,
-			color_space, color_depth, solid_color, width, height, offset);
+			color_space, color_depth, solid_color, width, height, offset,
+			dc->debug.disable_dynamic_expansion_for_test_pattern);
 }
drivers/gpu/drm/amd/display/dc/hwss/dcn201/dcn201_hwseq.c +2 -1
index c22587188c98..d34f63432c6b 100644
@@ -214,7 +214,8 @@ void dcn201_init_blank(
 			&black_color,
 			otg_active_width,
 			otg_active_height,
-			0);
+			0,
+			dc->debug.disable_dynamic_expansion_for_test_pattern);
 
 	hws->funcs.wait_for_blank_complete(opp);
 }
drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.c +2 -2
index 79f40b483caf..35d5cce0a791 100644
@@ -1245,9 +1245,9 @@ void dcn30_set_disp_pattern_generator(const struct dc *dc,
 		const struct tg_color *solid_color,
 		int width, int height, int offset)
 {
-	(void)dc;
 	pipe_ctx->stream_res.opp->funcs->opp_set_disp_pattern_generator(pipe_ctx->stream_res.opp, test_pattern,
-			color_space, color_depth, solid_color, width, height, offset);
+			color_space, color_depth, solid_color, width, height, offset,
+			dc->debug.disable_dynamic_expansion_for_test_pattern);
 }
 
 void dcn30_prepare_bandwidth(struct dc *dc,
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c +4 -2
index 5de38b86cb54..8e45ad4191c7 100644
@@ -1754,7 +1754,8 @@ void dcn32_init_blank(
 				&black_color,
 				otg_active_width,
 				otg_active_height,
-				0);
+				0,
+				dc->debug.disable_dynamic_expansion_for_test_pattern);
 
 	if (num_opps == 2) {
 		if (bottom_opp && bottom_opp->funcs->opp_set_disp_pattern_generator) {
@@ -1766,7 +1767,8 @@ void dcn32_init_blank(
 					&black_color,
 					otg_active_width,
 					otg_active_height,
-					0);
+					0,
+					dc->debug.disable_dynamic_expansion_for_test_pattern);
 			hws->funcs.wait_for_blank_complete(bottom_opp);
 		}
 	}
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c +6 -3
index 1d53240cd736..c82f941f42ec 100644
@@ -2575,7 +2575,8 @@ void dcn401_program_pipe_sequence(
 			false,
 			pipe_ctx->stream_res.test_pattern_params.width,
 			pipe_ctx->stream_res.test_pattern_params.height,
-			pipe_ctx->stream_res.test_pattern_params.offset);
+			pipe_ctx->stream_res.test_pattern_params.offset,
+			dc->debug.disable_dynamic_expansion_for_test_pattern);
 	}
 
 	if (pipe_ctx->plane_state
@@ -3364,7 +3365,8 @@ void dcn401_blank_pixel_data_sequence(
 			true,
 			odm_slice_src.width,
 			odm_slice_src.height,
-			odm_slice_src.x);
+			odm_slice_src.x,
+			dc->debug.disable_dynamic_expansion_for_test_pattern);
 
 		odm_pipe = odm_pipe->next_odm_pipe;
 	}
@@ -3381,7 +3383,8 @@ void dcn401_blank_pixel_data_sequence(
 		true,
 		odm_slice_src.width,
 		odm_slice_src.height,
-		odm_slice_src.x);
+		odm_slice_src.x,
+		dc->debug.disable_dynamic_expansion_for_test_pattern);
 
 	/* Handle ABM level setting when not blanking */
 	if (!blank) {
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h +3 -1
index 7c5f88bf44c7..d7ab21c5a1e4 100644
@@ -429,6 +429,7 @@ struct opp_set_disp_pattern_generator_params {
 	int width;
 	int height;
 	int offset;
+	bool disable_dyn_exp_for_test_pattern;
 };
 
 struct set_abm_pipe_params {
@@ -2349,7 +2350,8 @@ void hwss_add_opp_set_disp_pattern_generator(struct block_sequence_state *seq_st
 		bool use_solid_color,
 		int width,
 		int height,
-		int offset);
+		int offset,
+		bool disable_dyn_exp_for_test_pattern);
 
 void hwss_add_opp_program_bit_depth_reduction(struct block_sequence_state *seq_state,
 		struct output_pixel_processor *opp,
drivers/gpu/drm/amd/display/dc/inc/hw/opp.h +2 -1
index f2d16d88b0bc..73aaa2629315 100644
@@ -340,7 +340,8 @@ struct opp_funcs {
 			const struct tg_color *solid_color,
 			int width,
 			int height,
-			int offset);
+			int offset,
+			bool disable_dyn_exp_for_test_pattern);
 
 	void (*opp_program_dpg_dimensions)(
 				struct output_pixel_processor *opp,
drivers/gpu/drm/amd/display/dc/opp/dcn20/dcn20_opp.c +3 -2
index 8486175a3b56..544ff2bf7100 100644
@@ -47,7 +47,8 @@ void opp2_set_disp_pattern_generator(
 		const struct tg_color *solid_color,
 		int width,
 		int height,
-		int offset)
+		int offset,
+		bool disable_dyn_exp_for_test_pattern)
 {
 	struct dcn20_opp *oppn20 = TO_DCN20_OPP(opp);
 	enum test_pattern_color_format bit_depth;
@@ -89,7 +90,7 @@ void opp2_set_disp_pattern_generator(
 	break;
 	}
 
-	if (opp->ctx->dc->debug.disable_dynamic_expansion_for_test_pattern) {
+	if (disable_dyn_exp_for_test_pattern) {
 		switch (test_pattern) {
 		case CONTROLLER_DP_TEST_PATTERN_COLORSQUARES:
 		case CONTROLLER_DP_TEST_PATTERN_COLORSQUARES_CEA:
drivers/gpu/drm/amd/display/dc/opp/dcn20/dcn20_opp.h +2 -1
index 8944fa6c8f79..62e8d5078ffb 100644
@@ -152,7 +152,8 @@ void opp2_set_disp_pattern_generator(
 	const struct tg_color *solid_color,
 	int width,
 	int height,
-	int offset);
+	int offset,
+	bool disable_dyn_exp_for_test_pattern);
 
 void opp2_program_dpg_dimensions(
 		struct output_pixel_processor *opp,
Signature · 1 line
2.53.0
#21 lore raw

PATCH 18/34 drm/amd/display: Remove OPP_SET_MPCC_DISCONNECT_PENDING

In reply to Fangzhi Zuo

From: Piotr Maziarz <[email protected]>

[WHY]
The operation wrote no hardware register. Its executor only set opp->mpcc_disconnect_pending, a driver side flag, which breaks the rule that a block sequence step programs a hardware block rather than mutating logical objects. It was also split across phases: written while the pre-unlock sequence executed, then read and cleared while the post-unlock sequence was still being built.

[HOW]
Deleted the enum value, the params struct, the add helper, the executor and the dispatch case. dcn401_plane_atomic_disconnect_sequence now sets the flag during the build phase, matching what dcn10, dcn20, dcn201, dcn35, dcn3ag and dcn42b already do. Updated the operation specs and the core_gtest dumper.

---
 .../drm/amd/display/dc/core/dc_hw_sequencer.c | 24 -------------------
 .../amd/display/dc/hwss/dcn401/dcn401_hwseq.c |  6 +++--
 .../drm/amd/display/dc/hwss/hw_sequencer.h    | 13 ----------
 3 files changed, 4 insertions(+), 39 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +0 -24
index e1d6e31af657..5e41792c622a 100644
@@ -1888,9 +1888,6 @@ void hwss_execute_sequence(struct dc *dc,
 		case MPC_REMOVE_MPCC:
 			hwss_mpc_remove_mpcc(params);
 			break;
-		case OPP_SET_MPCC_DISCONNECT_PENDING:
-			hwss_opp_set_mpcc_disconnect_pending(params);
-			break;
 		case DC_SET_OPTIMIZED_REQUIRED:
 			hwss_dc_set_optimized_required(params);
 			break;
@@ -3581,15 +3578,6 @@ void hwss_mpc_remove_mpcc(union block_sequence_params *params)
 	mpc->funcs->remove_mpcc(mpc, mpc_tree_params, mpcc_to_remove);
 }
 
-void hwss_opp_set_mpcc_disconnect_pending(union block_sequence_params *params)
-{
-	struct output_pixel_processor *opp = params->opp_set_mpcc_disconnect_pending_params.opp;
-	int mpcc_inst = params->opp_set_mpcc_disconnect_pending_params.mpcc_inst;
-	bool pending = params->opp_set_mpcc_disconnect_pending_params.pending;
-
-	opp->mpcc_disconnect_pending[mpcc_inst] = pending;
-}
-
 void hwss_dc_set_optimized_required(union block_sequence_params *params)
 {
 	struct dc *dc = params->dc_set_optimized_required_params.dc;
@@ -4773,18 +4761,6 @@ void hwss_add_mpc_remove_mpcc(struct block_sequence_state *seq_state,
 	}
 }
 
-void hwss_add_opp_set_mpcc_disconnect_pending(struct block_sequence_state *seq_state,
-		struct output_pixel_processor *opp, int mpcc_inst, bool pending)
-{
-	if (*seq_state->num_steps < MAX_HWSS_BLOCK_SEQUENCE_SIZE) {
-		seq_state->steps[*seq_state->num_steps].func = OPP_SET_MPCC_DISCONNECT_PENDING;
-		seq_state->steps[*seq_state->num_steps].params.opp_set_mpcc_disconnect_pending_params.opp = opp;
-		seq_state->steps[*seq_state->num_steps].params.opp_set_mpcc_disconnect_pending_params.mpcc_inst = mpcc_inst;
-		seq_state->steps[*seq_state->num_steps].params.opp_set_mpcc_disconnect_pending_params.pending = pending;
-		(*seq_state->num_steps)++;
-	}
-}
-
 void hwss_add_hubp_disconnect(struct block_sequence_state *seq_state,
 		struct hubp *hubp)
 {
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c +4 -2
index c82f941f42ec..b7680326f495 100644
@@ -3301,8 +3301,10 @@ void dcn401_plane_atomic_disconnect_sequence(struct dc *dc,
 	// Phantom pipes have OTG disabled by default, so MPCC_STATUS will never assert idle,
 	// so don't wait for MPCC_IDLE in the programming sequence
 	if (dc_state_get_pipe_subvp_type(state, pipe_ctx) != SUBVP_PHANTOM) {
-		/* Step 2: Set MPCC disconnect pending flag */
-		hwss_add_opp_set_mpcc_disconnect_pending(seq_state, opp, pipe_ctx->plane_res.mpcc_inst, true);
+		/* Step 2: Set MPCC disconnect pending flag. Set here rather than as a sequence step
+		 * because the post-unlock build phase reads it to decide what to emit.
+		 */
+		opp->mpcc_disconnect_pending[pipe_ctx->plane_res.mpcc_inst] = true;
 	}
 
 	/* Step 3: Set optimized required flag */
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h +0 -13
index d7ab21c5a1e4..9ad18c9dcff9 100644
@@ -486,12 +486,6 @@ struct mpc_remove_mpcc_params {
 	struct mpcc *mpcc_to_remove;
 };
 
-struct opp_set_mpcc_disconnect_pending_params {
-	struct output_pixel_processor *opp;
-	int mpcc_inst;
-	bool pending;
-};
-
 struct dc_set_optimized_required_params {
 	struct dc *dc;
 	bool optimized_required;
@@ -1128,7 +1122,6 @@ union block_sequence_params {
 	struct set_abm_immediate_disable_params set_abm_immediate_disable_params;
 	struct set_disp_pattern_generator_params set_disp_pattern_generator_params;
 	struct mpc_remove_mpcc_params mpc_remove_mpcc_params;
-	struct opp_set_mpcc_disconnect_pending_params opp_set_mpcc_disconnect_pending_params;
 	struct dc_set_optimized_required_params dc_set_optimized_required_params;
 	struct hubp_disconnect_params hubp_disconnect_params;
 	struct hubbub_force_pstate_change_control_params hubbub_force_pstate_change_control_params;
@@ -1299,7 +1292,6 @@ enum block_sequence_func {
 	ABM_SET_LEVEL,
 	ABM_SET_IMMEDIATE_DISABLE,
 	MPC_REMOVE_MPCC,
-	OPP_SET_MPCC_DISCONNECT_PENDING,
 	DC_SET_OPTIMIZED_REQUIRED,
 	HUBP_DISCONNECT,
 	HUBBUB_FORCE_PSTATE_CHANGE_CONTROL,
@@ -2007,8 +1999,6 @@ void hwss_set_abm_immediate_disable(union block_sequence_params *params);
 
 void hwss_mpc_remove_mpcc(union block_sequence_params *params);
 
-void hwss_opp_set_mpcc_disconnect_pending(union block_sequence_params *params);
-
 void hwss_dc_set_optimized_required(union block_sequence_params *params);
 
 void hwss_hubp_disconnect(union block_sequence_params *params);
@@ -2323,9 +2313,6 @@ void hwss_add_dsc_calculate_and_set_config(struct block_sequence_state *seq_stat
 void hwss_add_mpc_remove_mpcc(struct block_sequence_state *seq_state,
 		struct mpc *mpc, struct mpc_tree *mpc_tree_params, struct mpcc *mpcc_to_remove);
 
-void hwss_add_opp_set_mpcc_disconnect_pending(struct block_sequence_state *seq_state,
-		struct output_pixel_processor *opp, int mpcc_inst, bool pending);
-
 void hwss_add_hubp_disconnect(struct block_sequence_state *seq_state,
 		struct hubp *hubp);
 
Signature · 1 line
2.53.0
#22 lore raw

PATCH 19/34 drm/amd/display: Rename HUBBUB_FORCE_PSTATE_CHANGE_CONTROL wait field

In reply to Fangzhi Zuo

From: Piotr Maziarz <[email protected]>

[WHY]
hubbub_force_pstate_change_control_params::wait was passed as the allow argument of hubbub_funcs::force_pstate_change_control, which drives DCHUBBUB_ARB_ALLOW_PSTATE_CHANGE_FORCE_VALUE. Sitting three lines above a udelay(500), the name read as a timing control and invited the wrong conclusion about what the field does.

[HOW]
Renamed the field to allow and updated the add helper signature, the executor, the core_gtest dumper and comparator, and the affected core_golden entry. No functional change.

---
 .../drm/amd/display/dc/core/dc_hw_sequencer.c   | 17 ++++++++++-------
 .../gpu/drm/amd/display/dc/hwss/hw_sequencer.h  |  4 ++--
 2 files changed, 12 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +10 -7
index 5e41792c622a..e2cc5ab40b3b 100644
@@ -2775,13 +2775,16 @@ void hwss_add_hubp_program_mcache_id(struct block_sequence_state *seq_state,
 void hwss_add_hubbub_force_pstate_change_control(struct block_sequence_state *seq_state,
 		struct hubbub *hubbub,
 		bool enable,
-		bool wait)
+		bool allow)
 {
 	if (*seq_state->num_steps < MAX_HWSS_BLOCK_SEQUENCE_SIZE) {
-		seq_state->steps[*seq_state->num_steps].params.hubbub_force_pstate_change_control_params.hubbub = hubbub;
-		seq_state->steps[*seq_state->num_steps].params.hubbub_force_pstate_change_control_params.enable = enable;
-		seq_state->steps[*seq_state->num_steps].params.hubbub_force_pstate_change_control_params.wait = wait;
-		seq_state->steps[*seq_state->num_steps].func = HUBBUB_FORCE_PSTATE_CHANGE_CONTROL;
+		struct block_sequence *step = &seq_state->steps[*seq_state->num_steps];
+		union block_sequence_params *step_params = &step->params;
+
+		step_params->hubbub_force_pstate_change_control_params.hubbub = hubbub;
+		step_params->hubbub_force_pstate_change_control_params.enable = enable;
+		step_params->hubbub_force_pstate_change_control_params.allow = allow;
+		step->func = HUBBUB_FORCE_PSTATE_CHANGE_CONTROL;
 		(*seq_state->num_steps)++;
 	}
 }
@@ -3598,10 +3601,10 @@ void hwss_hubbub_force_pstate_change_control(union block_sequence_params *params
 {
 	struct hubbub *hubbub = params->hubbub_force_pstate_change_control_params.hubbub;
 	bool enable = params->hubbub_force_pstate_change_control_params.enable;
-	bool wait = params->hubbub_force_pstate_change_control_params.wait;
+	bool allow = params->hubbub_force_pstate_change_control_params.allow;
 
 	if (hubbub->funcs->force_pstate_change_control) {
-		hubbub->funcs->force_pstate_change_control(hubbub, enable, wait);
+		hubbub->funcs->force_pstate_change_control(hubbub, enable, allow);
 		/* Add delay when enabling pstate change control */
 		if (enable)
 			udelay(500);
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h +2 -2
index 9ad18c9dcff9..6f3ec43bf3b0 100644
@@ -498,7 +498,7 @@ struct hubp_disconnect_params {
 struct hubbub_force_pstate_change_control_params {
 	struct hubbub *hubbub;
 	bool enable;
-	bool wait;
+	bool allow;
 };
 
 struct tg_enable_crtc_params {
@@ -2276,7 +2276,7 @@ void hwss_add_hubp_program_mcache_id(struct block_sequence_state *seq_state,
 		struct hubp *hubp, struct dml2_hubp_pipe_mcache_regs *mcache_regs);
 
 void hwss_add_hubbub_force_pstate_change_control(struct block_sequence_state *seq_state,
-		struct hubbub *hubbub, bool enable, bool wait);
+		struct hubbub *hubbub, bool enable, bool allow);
 
 void hwss_add_hubp_program_det_segments(struct block_sequence_state *seq_state,
 		struct hubbub *hubbub, unsigned int hubp_inst, unsigned int det_size);
Signature · 1 line
2.53.0
#23 lore raw

PATCH 20/34 drm/amd/display: Drop disallow_self_refresh_applied output param

In reply to Fangzhi Zuo

From: Piotr Maziarz <[email protected]>

[WHY]
Besides programming the hubbub, the HUBBUB_ALLOW_SELF_REFRESH_CONTROL executor wrote through an output pointer into hwseq->wa_state to record that the MPO stutter workaround had been applied. That bookkeeping has no relationship to the register write and makes the operation mutate a logical object while the sequence runs.

[HOW]
Removed the pointer from hubbub_allow_self_refresh_control_params and from the add helper, leaving the executor a plain pass through to hubbub->funcs->allow_self_refresh_control. hwss_build_post_unlock_full_sequence now sets the workaround flag itself, inside the same condition that decides to emit the step. TG_GET_FRAME_COUNT is left as is: its out parameter is the read back register value, and reading it after the write matches the legacy implementations.

---
 .../drm/amd/display/dc/core/dc_hw_sequencer.c    | 16 ++++++++--------
 .../gpu/drm/amd/display/dc/hwss/hw_sequencer.h   |  4 +---
 2 files changed, 9 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +8 -8
index e2cc5ab40b3b..e6d10e3bd6e9 100644
@@ -1165,14 +1165,19 @@ void hwss_build_post_unlock_full_sequence(struct dc *dc,
 			dc->current_state->stream_status[0].plane_count == 1 &&
 			context->stream_status[0].plane_count > 1) {
 
-		hwss_add_hubbub_allow_self_refresh_control(&seq_state, dc->res_pool->hubbub, false,
-			&hwseq->wa_state.disallow_self_refresh_during_multi_plane_transition_applied);
+		hwss_add_hubbub_allow_self_refresh_control(&seq_state, dc->res_pool->hubbub, false);
 
 		/* Get frame count for WA state tracking - this needs to be done immediately after the above call */
 		if (dc->res_pool->timing_generators[0]->funcs->get_frame_count) {
 			hwss_add_tg_get_frame_count(&seq_state, dc->res_pool->timing_generators[0],
 				&hwseq->wa_state.disallow_self_refresh_during_multi_plane_transition_applied_on_frame);
 		}
+
+		/*
+		 * Set here rather than as a sequence step: the executor must not
+		 * write to logical objects.
+		 */
+		hwseq->wa_state.disallow_self_refresh_during_multi_plane_transition_applied = true;
 	}
 }
 
@@ -3685,9 +3690,6 @@ void hwss_hubbub_allow_self_refresh_control(union block_sequence_params *params)
 	bool allow = params->hubbub_allow_self_refresh_control_params.allow;
 
 	hubbub->funcs->allow_self_refresh_control(hubbub, allow);
-
-	if (!allow && params->hubbub_allow_self_refresh_control_params.disallow_self_refresh_applied)
-		*params->hubbub_allow_self_refresh_control_params.disallow_self_refresh_applied = true;
 }
 
 void hwss_tg_get_frame_count(union block_sequence_params *params)
@@ -5881,14 +5883,12 @@ void hwss_add_hubbub_apply_dedcn21_147_wa(struct block_sequence_state *seq_state
 
 void hwss_add_hubbub_allow_self_refresh_control(struct block_sequence_state *seq_state,
 		struct hubbub *hubbub,
-		bool allow,
-		bool *disallow_self_refresh_applied)
+		bool allow)
 {
 	if (*seq_state->num_steps < MAX_HWSS_BLOCK_SEQUENCE_SIZE) {
 		seq_state->steps[*seq_state->num_steps].func = HUBBUB_ALLOW_SELF_REFRESH_CONTROL;
 		seq_state->steps[*seq_state->num_steps].params.hubbub_allow_self_refresh_control_params.hubbub = hubbub;
 		seq_state->steps[*seq_state->num_steps].params.hubbub_allow_self_refresh_control_params.allow = allow;
-		seq_state->steps[*seq_state->num_steps].params.hubbub_allow_self_refresh_control_params.disallow_self_refresh_applied = disallow_self_refresh_applied;
 		(*seq_state->num_steps)++;
 	}
 }
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h +1 -3
index 6f3ec43bf3b0..821cd0de7271 100644
@@ -528,7 +528,6 @@ struct hubbub_apply_dedcn21_147_wa_params {
 struct hubbub_allow_self_refresh_control_params {
 	struct hubbub *hubbub;
 	bool allow;
-	bool *disallow_self_refresh_applied;
 };
 
 struct tg_get_frame_count_params {
@@ -2665,8 +2664,7 @@ void hwss_add_hubbub_apply_dedcn21_147_wa(struct block_sequence_state *seq_state
 
 void hwss_add_hubbub_allow_self_refresh_control(struct block_sequence_state *seq_state,
 		struct hubbub *hubbub,
-		bool allow,
-		bool *disallow_self_refresh_applied);
+		bool allow);
 
 void hwss_add_tg_get_frame_count(struct block_sequence_state *seq_state,
 		struct timing_generator *tg,
Signature · 1 line
2.53.0
#24 lore raw

PATCH 21/34 drm/amd/display: Dispatch HUBBUB_SOFT_RESET through hubbub_funcs

In reply to Fangzhi Zuo

From: Piotr Maziarz <[email protected]>

[WHY]
hubbub_soft_reset_params carried the callee itself as a function pointer, so the step was not fully described by its parameters. The core_gtest dumper could only record hubbub and reset, which means two sequences calling different functions compare equal. It also forced dcn401_hwseq to name the dcn10 symbol hubbub1_soft_reset directly, because hubbub_funcs had no slot for a soft reset.

[HOW]
Added soft_reset to hubbub_funcs and pointed hubbub4_01_funcs, hubbub42_funcs and hubbub60_funcs at hubbub1_soft_reset, the same way allow_self_refresh_control is already shared. Dropped the function pointer from the params struct and the add helper, and had the executor call hubbub->funcs->soft_reset. The dcn10_hubbub.h include in dcn401_hwseq.c is no longer needed.

---
 drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c       | 6 ++----
 .../gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.c    | 1 +
 drivers/gpu/drm/amd/display/dc/hubbub/dcn42/dcn42_hubbub.c  | 1 +
 drivers/gpu/drm/amd/display/dc/hubbub/dcn60/dcn60_hubbub.c  | 1 +
 drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c   | 5 ++---
 drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h          | 2 --
 drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h            | 2 ++
 7 files changed, 9 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +2 -4
index e6d10e3bd6e9..ccf5ed47ce62 100644
@@ -3822,8 +3822,8 @@ void hwss_hubbub_soft_reset(union block_sequence_params *params)
 	struct hubbub *hubbub = params->hubbub_soft_reset_params.hubbub;
 	bool reset = params->hubbub_soft_reset_params.reset;
 
-	if (hubbub)
-		params->hubbub_soft_reset_params.hubbub_soft_reset(hubbub, reset);
+	if (hubbub->funcs->soft_reset)
+		hubbub->funcs->soft_reset(hubbub, reset);
 }
 
 void hwss_hubbub_perfmon_reset(union block_sequence_params *params)
@@ -5176,13 +5176,11 @@ void hwss_add_hubp_disable_control(struct block_sequence_state *seq_state,
 
 void hwss_add_hubbub_soft_reset(struct block_sequence_state *seq_state,
 		struct hubbub *hubbub,
-		void (*hubbub_soft_reset)(struct hubbub *hubbub, bool reset),
 		bool reset)
 {
 	if (*seq_state->num_steps < MAX_HWSS_BLOCK_SEQUENCE_SIZE) {
 		seq_state->steps[*seq_state->num_steps].func = HUBBUB_SOFT_RESET;
 		seq_state->steps[*seq_state->num_steps].params.hubbub_soft_reset_params.hubbub = hubbub;
-		seq_state->steps[*seq_state->num_steps].params.hubbub_soft_reset_params.hubbub_soft_reset = hubbub_soft_reset;
 		seq_state->steps[*seq_state->num_steps].params.hubbub_soft_reset_params.reset = reset;
 		(*seq_state->num_steps)++;
 	}
drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.c +1 -0
index d948525bc09e..957e8f5a6475 100644
@@ -1239,6 +1239,7 @@ static const struct hubbub_funcs hubbub4_01_funcs = {
 	.allow_self_refresh_control = hubbub1_allow_self_refresh_control,
 	.is_allow_self_refresh_enabled = hubbub1_is_allow_self_refresh_enabled,
 	.verify_allow_pstate_change_high = NULL,
+	.soft_reset = hubbub1_soft_reset,
 	.force_wm_propagate_to_pipes = hubbub32_force_wm_propagate_to_pipes,
 	.force_pstate_change_control = hubbub3_force_pstate_change_control,
 	.init_watermarks = hubbub401_init_watermarks,
drivers/gpu/drm/amd/display/dc/hubbub/dcn42/dcn42_hubbub.c +1 -0
index b8657de84d31..036276c17562 100644
@@ -530,6 +530,7 @@ static const struct hubbub_funcs hubbub42_funcs = {
 	.program_watermarks = hubbub42_program_watermarks,
 	.allow_self_refresh_control = hubbub42_allow_self_refresh_control,
 	.is_allow_self_refresh_enabled = hubbub1_is_allow_self_refresh_enabled,
+	.soft_reset = hubbub1_soft_reset,
 	.force_wm_propagate_to_pipes = hubbub32_force_wm_propagate_to_pipes,
 	.force_pstate_change_control = hubbub3_force_pstate_change_control,
 	.init_watermarks = hubbub35_init_watermarks,
drivers/gpu/drm/amd/display/dc/hubbub/dcn60/dcn60_hubbub.c +1 -0
index 843a0da4bdd7..07282b78972a 100644
@@ -1926,6 +1926,7 @@ static const struct hubbub_funcs hubbub60_funcs = {
 	.allow_self_refresh_control = hubbub1_allow_self_refresh_control,
 	.is_allow_self_refresh_enabled = hubbub1_is_allow_self_refresh_enabled,
 	.verify_allow_pstate_change_high = NULL,
+	.soft_reset = hubbub1_soft_reset,
 	.force_wm_propagate_to_pipes = hubbub60_force_wm_propagate_to_pipes,
 	.force_pstate_change_control = hubbub3_force_pstate_change_control,
 	.init_watermarks = hubbub60_init_watermarks,
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c +2 -3
index b7680326f495..73f969fd1b33 100644
@@ -30,7 +30,6 @@
 
 #include "dce/dmub_hw_lock_mgr.h"
 #include "dcn10/dcn10_cm_common.h"
-#include "dcn10/dcn10_hubbub.h"
 #include "dcn20/dcn20_optc.h"
 #include "dcn20/dcn20_hwseq.h"
 #include "dcn30/dcn30_cm_common.h"
@@ -4161,7 +4160,7 @@ bool dcn401_hw_wa_force_recovery_sequence(struct dc *dc,
 	}
 
 	/* Step 2: DCHUBBUB_GLOBAL_SOFT_RESET=1 */
-	hwss_add_hubbub_soft_reset(seq_state, dc->res_pool->hubbub, hubbub1_soft_reset, true);
+	hwss_add_hubbub_soft_reset(seq_state, dc->res_pool->hubbub, true);
 
 	/* Step 3: Set HUBP_DISABLE=1 for all active pipes */
 	for (i = 0; i < dc->res_pool->pipe_count; i++) {
@@ -4186,7 +4185,7 @@ bool dcn401_hw_wa_force_recovery_sequence(struct dc *dc,
 	}
 
 	/* Step 5: DCHUBBUB_GLOBAL_SOFT_RESET=0 */
-	hwss_add_hubbub_soft_reset(seq_state, dc->res_pool->hubbub, hubbub1_soft_reset, false);
+	hwss_add_hubbub_soft_reset(seq_state, dc->res_pool->hubbub, false);
 
 	/* Step 6: Set HUBP_BLANK_EN=0 for all active pipes */
 	for (i = 0; i < dc->res_pool->pipe_count; i++) {
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h +0 -2
index 821cd0de7271..9c32418be8f2 100644
@@ -602,7 +602,6 @@ struct hubp_disable_control_params {
 
 struct hubbub_soft_reset_params {
 	struct hubbub *hubbub;
-	void (*hubbub_soft_reset)(struct hubbub *hubbub, bool reset);
 	bool reset;
 };
 
@@ -2416,7 +2415,6 @@ void hwss_add_hubp_disable_control(struct block_sequence_state *seq_state,
 
 void hwss_add_hubbub_soft_reset(struct block_sequence_state *seq_state,
 		struct hubbub *hubbub,
-		void (*hubbub_soft_reset)(struct hubbub *hubbub, bool reset),
 		bool reset);
 
 void hwss_add_hubbub_perfmon_reset(struct block_sequence_state *seq_state,
drivers/gpu/drm/amd/display/dc/inc/hw/dchubbub.h +2 -0
index d68232f10f3e..b33273b61abd 100644
@@ -216,6 +216,8 @@ struct hubbub_funcs {
 
 	void (*apply_DEDCN21_147_wa)(struct hubbub *hubbub);
 
+	void (*soft_reset)(struct hubbub *hubbub, bool reset);
+
 	void (*force_wm_propagate_to_pipes)(struct hubbub *hubbub);
 
 	void (*hubbub_read_state)(struct hubbub *hubbub, struct dcn_hubbub_state *hubbub_state);
Signature · 1 line
2.53.0
#25 lore raw

PATCH 22/34 drm/amd/display: Remove dead self-refresh BLS steps

In reply to Fangzhi Zuo

From: Piotr Maziarz <[email protected]>

[WHY]
The DCN10 post-unlock BLS path still emitted self-refresh suppression steps that are dead for this flow. Keeping them also left non-compliant BLS enums and documentation behind after the architecture cleanup.

[HOW]
Removed the dead DCN10 BLS producer path, dropped the associated BLS enums, params, helpers, dispatcher cases, unit-test dumper cases, and updated the BLS documentation. Kept the shared dcn10_update_pending_status consumer because later DCN generations still use it.

---
 .../drm/amd/display/dc/core/dc_hw_sequencer.c | 65 -------------------
 .../drm/amd/display/dc/hwss/hw_sequencer.h    | 26 --------
 2 files changed, 91 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +0 -65
index ccf5ed47ce62..21a62ca4c8dc 100644
@@ -1160,25 +1160,6 @@ void hwss_build_post_unlock_full_sequence(struct dc *dc,
 	if (hwseq && hwseq->wa.DEGVIDCN21)
 		hwss_add_hubbub_apply_dedcn21_147_wa(&seq_state, dc->res_pool->hubbub);
 
-	/* Handle stutter underflow WA during MPO transitions */
-	if (hwseq && hwseq->wa.disallow_self_refresh_during_multi_plane_transition &&
-			dc->current_state->stream_status[0].plane_count == 1 &&
-			context->stream_status[0].plane_count > 1) {
-
-		hwss_add_hubbub_allow_self_refresh_control(&seq_state, dc->res_pool->hubbub, false);
-
-		/* Get frame count for WA state tracking - this needs to be done immediately after the above call */
-		if (dc->res_pool->timing_generators[0]->funcs->get_frame_count) {
-			hwss_add_tg_get_frame_count(&seq_state, dc->res_pool->timing_generators[0],
-				&hwseq->wa_state.disallow_self_refresh_during_multi_plane_transition_applied_on_frame);
-		}
-
-		/*
-		 * Set here rather than as a sequence step: the executor must not
-		 * write to logical objects.
-		 */
-		hwseq->wa_state.disallow_self_refresh_during_multi_plane_transition_applied = true;
-	}
 }
 
 static uint32_t get_dcc_meta_propagation_delay(struct dc *dc, struct pipe_ctx *pipe_ctx)
@@ -1924,12 +1905,6 @@ void hwss_execute_sequence(struct dc *dc,
 		case HUBBUB_APPLY_DEDCN21_147_WA:
 			hwss_hubbub_apply_dedcn21_147_wa(params);
 			break;
-		case HUBBUB_ALLOW_SELF_REFRESH_CONTROL:
-			hwss_hubbub_allow_self_refresh_control(params);
-			break;
-		case TG_GET_FRAME_COUNT:
-			hwss_tg_get_frame_count(params);
-			break;
 		case MPC_SET_DWB_MUX:
 			hwss_mpc_set_dwb_mux(params);
 			break;
@@ -3684,22 +3659,6 @@ void hwss_hubbub_apply_dedcn21_147_wa(union block_sequence_params *params)
 	hubbub->funcs->apply_DEDCN21_147_wa(hubbub);
 }
 
-void hwss_hubbub_allow_self_refresh_control(union block_sequence_params *params)
-{
-	struct hubbub *hubbub = params->hubbub_allow_self_refresh_control_params.hubbub;
-	bool allow = params->hubbub_allow_self_refresh_control_params.allow;
-
-	hubbub->funcs->allow_self_refresh_control(hubbub, allow);
-}
-
-void hwss_tg_get_frame_count(union block_sequence_params *params)
-{
-	struct timing_generator *tg = params->tg_get_frame_count_params.tg;
-	unsigned int *frame_count = params->tg_get_frame_count_params.frame_count;
-
-	*frame_count = tg->funcs->get_frame_count(tg);
-}
-
 void hwss_mpc_set_dwb_mux(union block_sequence_params *params)
 {
 	struct mpc *mpc = params->mpc_set_dwb_mux_params.mpc;
@@ -5879,30 +5838,6 @@ void hwss_add_hubbub_apply_dedcn21_147_wa(struct block_sequence_state *seq_state
 	}
 }
 
-void hwss_add_hubbub_allow_self_refresh_control(struct block_sequence_state *seq_state,
-		struct hubbub *hubbub,
-		bool allow)
-{
-	if (*seq_state->num_steps < MAX_HWSS_BLOCK_SEQUENCE_SIZE) {
-		seq_state->steps[*seq_state->num_steps].func = HUBBUB_ALLOW_SELF_REFRESH_CONTROL;
-		seq_state->steps[*seq_state->num_steps].params.hubbub_allow_self_refresh_control_params.hubbub = hubbub;
-		seq_state->steps[*seq_state->num_steps].params.hubbub_allow_self_refresh_control_params.allow = allow;
-		(*seq_state->num_steps)++;
-	}
-}
-
-void hwss_add_tg_get_frame_count(struct block_sequence_state *seq_state,
-		struct timing_generator *tg,
-		unsigned int *frame_count)
-{
-	if (*seq_state->num_steps < MAX_HWSS_BLOCK_SEQUENCE_SIZE) {
-		seq_state->steps[*seq_state->num_steps].func = TG_GET_FRAME_COUNT;
-		seq_state->steps[*seq_state->num_steps].params.tg_get_frame_count_params.tg = tg;
-		seq_state->steps[*seq_state->num_steps].params.tg_get_frame_count_params.frame_count = frame_count;
-		(*seq_state->num_steps)++;
-	}
-}
-
 void hwss_add_cursor_lock(struct block_sequence_state *seq_state,
 		struct dc *dc,
 		struct pipe_ctx *pipe_ctx,
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h +0 -26
index 9c32418be8f2..c0c098b5bcaa 100644
@@ -525,16 +525,6 @@ struct hubbub_apply_dedcn21_147_wa_params {
 	struct hubbub *hubbub;
 };
 
-struct hubbub_allow_self_refresh_control_params {
-	struct hubbub *hubbub;
-	bool allow;
-};
-
-struct tg_get_frame_count_params {
-	struct timing_generator *tg;
-	unsigned int *frame_count;
-};
-
 struct mpc_set_dwb_mux_params {
 	struct mpc *mpc;
 	int dwb_id;
@@ -1128,8 +1118,6 @@ union block_sequence_params {
 	struct tg_wait_double_buffer_pending_params tg_wait_double_buffer_pending_params;
 	struct update_force_pstate_params update_force_pstate_params;
 	struct hubbub_apply_dedcn21_147_wa_params hubbub_apply_dedcn21_147_wa_params;
-	struct hubbub_allow_self_refresh_control_params hubbub_allow_self_refresh_control_params;
-	struct tg_get_frame_count_params tg_get_frame_count_params;
 	struct mpc_set_dwb_mux_params mpc_set_dwb_mux_params;
 	struct mpc_disable_dwb_mux_params mpc_disable_dwb_mux_params;
 	struct mcif_wb_config_buf_params mcif_wb_config_buf_params;
@@ -1301,8 +1289,6 @@ enum block_sequence_func {
 	UPDATE_FORCE_PSTATE,
 	PROGRAM_MALL_PIPE_CONFIG,
 	HUBBUB_APPLY_DEDCN21_147_WA,
-	HUBBUB_ALLOW_SELF_REFRESH_CONTROL,
-	TG_GET_FRAME_COUNT,
 	MPC_SET_DWB_MUX,
 	MPC_DISABLE_DWB_MUX,
 	MCIF_WB_CONFIG_BUF,
@@ -2018,10 +2004,6 @@ void hwss_update_force_pstate(union block_sequence_params *params);
 
 void hwss_hubbub_apply_dedcn21_147_wa(union block_sequence_params *params);
 
-void hwss_hubbub_allow_self_refresh_control(union block_sequence_params *params);
-
-void hwss_tg_get_frame_count(union block_sequence_params *params);
-
 void hwss_mpc_set_dwb_mux(union block_sequence_params *params);
 
 void hwss_mpc_disable_dwb_mux(union block_sequence_params *params);
@@ -2660,14 +2642,6 @@ void hwss_add_update_force_pstate(struct block_sequence_state *seq_state,
 void hwss_add_hubbub_apply_dedcn21_147_wa(struct block_sequence_state *seq_state,
 		struct hubbub *hubbub);
 
-void hwss_add_hubbub_allow_self_refresh_control(struct block_sequence_state *seq_state,
-		struct hubbub *hubbub,
-		bool allow);
-
-void hwss_add_tg_get_frame_count(struct block_sequence_state *seq_state,
-		struct timing_generator *tg,
-		unsigned int *frame_count);
-
 void hwss_add_tg_set_dsc_config(struct block_sequence_state *seq_state,
 		struct timing_generator *tg,
 		struct dsc_optc_config *dsc_optc_cfg,
Signature · 1 line
2.53.0
#26 lore raw

PATCH 23/34 drm/amd/display: avoid to write signal specific for tmds

In reply to Fangzhi Zuo

From: Charlene Liu <[email protected]>

[why]
some panel will generate HPD if receive invalid the action.

---
 drivers/gpu/drm/amd/display/dc/link/link_dpms.c          | 2 ++
 drivers/gpu/drm/amd/display/dc/link/protocols/link_ddc.c | 8 +++++---
 drivers/gpu/drm/amd/display/dc/link/protocols/link_ddc.h | 1 +
 3 files changed, 8 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/link/link_dpms.c +2 -0
index 48b086d15ab0..c009d0fb14ca 100644
@@ -1898,6 +1898,7 @@ static void enable_link_hdmi(struct pipe_ctx *pipe_ctx)
 		write_scdc_data(
 			stream->link->ddc,
 			stream->phy_pix_clk,
+			dc_is_hdmi_frl_signal(pipe_ctx->stream->signal),
 			(stream->timing.flags.LTE_340MCSC_SCRAMBLE != 0));
 
 	if (dc->debug.enable_hdmi_idcc) {
@@ -2438,6 +2439,7 @@ enum dc_status link_set_dpms_off(struct pipe_ctx *pipe_ctx)
 		write_scdc_data(
 			link->ddc,
 			165000,//vbios only handles 165Mhz.
+			dc_is_hdmi_frl_signal(stream->signal),
 			false);
 		if (masked_chip_caps == AMD_EXT_DISPLAY_PATH_CAPS__HDMI20_TISN65DP159RSBT) {
 			/* DP159, Retimer settings */
drivers/gpu/drm/amd/display/dc/link/protocols/link_ddc.c +5 -3
index 6123b10977bf..d87f6f377d06 100644
@@ -570,6 +570,7 @@ struct ddc *get_ddc_pin(struct ddc_service *ddc_service)
 
 void write_scdc_data(struct ddc_service *ddc_service,
 		uint32_t pix_clk,
+		bool is_frl,
 		bool lte_340_scramble)
 {
 	bool over_340_mhz = pix_clk > 340000 ? 1 : 0;
@@ -583,9 +584,10 @@ void write_scdc_data(struct ddc_service *ddc_service,
 		(ddc_service->link->local_sink->edid_caps.panel_patch.skip_scdc_overwrite ||
 		!ddc_service->link->local_sink->edid_caps.scdc_present))
 		return;
-	hdmi_frl_LTS_clear_Link_Setting(ddc_service);
-	hdmi_frl_LTS_clear_Update_flag(ddc_service);
-
+	if (is_frl) {
+		hdmi_frl_LTS_clear_Link_Setting(ddc_service);
+		hdmi_frl_LTS_clear_Update_flag(ddc_service);
+	}
 	link_query_ddc_data(ddc_service, slave_address, &offset,
 			sizeof(offset), &sink_version, sizeof(sink_version));
 	if (sink_version == 1) {
drivers/gpu/drm/amd/display/dc/link/protocols/link_ddc.h +1 -0
index fdd8a3dce97f..200823954fc6 100644
@@ -91,6 +91,7 @@ uint32_t link_get_fixed_vs_pe_retimer_write_address(struct dc_link *link);
 void write_scdc_data(
 		struct ddc_service *ddc_service,
 		uint32_t pix_clk,
+		bool is_frl,
 		bool lte_340_scramble);
 
 void read_scdc_data(
Signature · 1 line
2.53.0
#27 lore raw

PATCH 24/34 drm/amd/display: Fix HDMI2.2 LT timeout duration

In reply to Fangzhi Zuo

From: Ilya Bakoulin <[email protected]>

[Why/How]
Current method of keeping track of the LT timeout can cause the actual elapsed time to creep past the spec-defined limits.

Adjust the behavior to make timeouts more consistent.

---
 .../display/dc/link/protocols/link_hdmi_frl.c | 58 +++++++++++--------
 1 file changed, 33 insertions(+), 25 deletions(-)
drivers/gpu/drm/amd/display/dc/link/protocols/link_hdmi_frl.c +33 -25
index 7f930097da18..2f1b8c0bc8f8 100644
@@ -442,9 +442,9 @@ static enum link_result hdmi_frl_perform_link_training(struct ddc_service *ddc_s
 	union hdmi_scdc_status_flags_data status_data = {0};
 	union hdmi_scdc_source_test_req test_req = {0};
 	union hdmi_scdc_LTP_req_data ltp_req = {0};
-	uint16_t num_polls = 0;
-	uint16_t max_polls = 105;
-	unsigned long long wait_time_ns = 2000000;
+	unsigned long long poll_timeout_ns = 200 * 1000 * 1000;
+	unsigned long long wait_time_ns = 2 * 1000 * 1000;
+	unsigned long long num_polls = 0;
 	struct hpo_frl_link_encoder *hpo_frl_link_enc = ddc_service->link->hpo_frl_link_enc;
 	struct link_encoder *dio_link_enc = ddc_service->link->link_enc;
 	uint8_t sink_version = 0;
@@ -452,7 +452,6 @@ static enum link_result hdmi_frl_perform_link_training(struct ddc_service *ddc_s
 	uint8_t current_FFE = 0;
 	bool override_FFE = false;
 	bool flt_no_timeout = false;
-	unsigned long long flt_poll_cur_time = 0, flt_poll_last_time = 0, flt_poll_elapsed_time_ns = 0;
 
 	DC_LOGGER_INIT(ddc_service->link->ctx->logger);
 	FRL_INFO("FRL LINK TRAINING:  Starting FRL Link Training.\n");
@@ -483,18 +482,22 @@ static enum link_result hdmi_frl_perform_link_training(struct ddc_service *ddc_s
 	offset = HDMI_SCDC_STATUS_FLAGS;
 
 	/*LTS:2: Check FLT Ready, poll for 200ms */
-	while (num_polls < max_polls) {
-		flt_poll_cur_time = dm_get_timestamp(ddc_service->ctx);
-		flt_poll_elapsed_time_ns = dm_get_elapse_time_in_ns(ddc_service->ctx, flt_poll_cur_time, flt_poll_last_time);
-		if (flt_poll_elapsed_time_ns < wait_time_ns)
+	unsigned long long flt_poll_start = dm_get_timestamp(ddc_service->ctx);
+	unsigned long long flt_poll_curr = flt_poll_start;
+	unsigned long long elapsed = 0;
+
+	do {
+		flt_poll_curr = dm_get_timestamp(ddc_service->ctx);
+					elapsed = dm_get_elapse_time_in_ns(ddc_service->ctx,
+						flt_poll_curr, flt_poll_start);
+		if (elapsed < (num_polls * wait_time_ns))
 			continue;
-		flt_poll_last_time = dm_get_timestamp(ddc_service->ctx);
 		num_polls++;
 
 		link_query_ddc_data(ddc_service, slave_address,
 				&offset, sizeof(offset), &status_data.byte,
 				sizeof(status_data.byte));
-		FRL_INFO("FRL LINK TRAINING:  Read FLT_READY = %d.  num_polls = %d\n",
+		FRL_INFO("FRL LINK TRAINING:  Read FLT_READY = %d.  num_polls = %llu\n",
 				status_data.fields.FLT_READY, num_polls);
 		if (status_data.fields.FLT_READY) {
 			/* Spec recommends to clear update flag, but QD980 has problem */
@@ -506,7 +509,7 @@ static enum link_result hdmi_frl_perform_link_training(struct ddc_service *ddc_s
 					link_settings);
 			break;
 		}
-	}
+	} while (elapsed < poll_timeout_ns);
 
 	/*Test Condition - FLT_no_timeout avoid link training*/
 	offset = HDMI_SCDC_SOURCE_TEST_REQ;
@@ -531,15 +534,19 @@ static enum link_result hdmi_frl_perform_link_training(struct ddc_service *ddc_s
 		/*Start FLT Timer = 200 ms, or 300ms if link rate >= 16Gbps*/
 		num_polls = 0;
 		if (link_settings->frl_link_rate >= HDMI_FRL_LINK_RATE_16GBPS)
-			max_polls = 155;
-
-		while (num_polls < max_polls) {
-			flt_poll_cur_time = dm_get_timestamp(ddc_service->ctx);
-			flt_poll_elapsed_time_ns = dm_get_elapse_time_in_ns(ddc_service->ctx, flt_poll_cur_time, flt_poll_last_time);
-			if (flt_poll_elapsed_time_ns < wait_time_ns)
+			poll_timeout_ns = 300 * 1000 * 1000;
+		if (flt_no_timeout)
+			poll_timeout_ns = 1000 * 1000 * 1000;
+
+		flt_poll_start = dm_get_timestamp(ddc_service->ctx);
+		uint8_t prev_flt_update = 0;
+
+		do {
+			flt_poll_curr = dm_get_timestamp(ddc_service->ctx);
+					elapsed = dm_get_elapse_time_in_ns(ddc_service->ctx,
+						flt_poll_curr, flt_poll_start);
+			if (elapsed < (num_polls * wait_time_ns))
 				continue;
-			flt_poll_last_time = flt_poll_cur_time;
-
 			num_polls++;
 
 			offset = HDMI_SCDC_UPDATE_0;
@@ -548,8 +555,12 @@ static enum link_result hdmi_frl_perform_link_training(struct ddc_service *ddc_s
 							&offset, sizeof(offset), &scdc_update.byte[0],
 							sizeof(scdc_update.byte[0]));
 
-			FRL_INFO("FRL LINK TRAINING:  Read FLT_UPDATE = %d.  num_polls = %d\n",
-					scdc_update.fields.FLT_UPDATE, num_polls);
+			if (prev_flt_update != scdc_update.fields.FLT_UPDATE) {
+				FRL_INFO("FRL LINK TRAINING: FLT_UPDATE=%d polls=%llu\n",
+						scdc_update.fields.FLT_UPDATE, num_polls);
+				prev_flt_update = scdc_update.fields.FLT_UPDATE;
+			}
+
 			/*Set TxFFE = TxFFE0*/
 			/*Program FFE_Levels - scdc_config has this field at 0 */
 			if (override_FFE) {
@@ -680,11 +691,8 @@ static enum link_result hdmi_frl_perform_link_training(struct ddc_service *ddc_s
 				/* Workaround for DEDCN3AG-111
 				 * HDMI-FRL Incorrect Serialization Order for LTP4
 				 */
-				if (flt_no_timeout) {
-					return LINK_RESULT_SUCCESS;
-				}
 			}
-		}
+		} while (elapsed < poll_timeout_ns);
 		FRL_INFO("FRL LINK TRAINING:  FAILED - Timeout waiting for FLT_UPDATE to be set by sink.\n");
 		write_buffer[0] = HDMI_SCDC_CONFIG_1;
 		/*FRL_RATE*/
Signature · 1 line
2.53.0
#28 lore raw

PATCH 25/34 drm/amd/display: Fix VTG programming for dcn60

In reply to Fangzhi Zuo

From: Dillon Varone <[email protected]>

[WHY&HOW]
VTG params should be corrected based on HW expectation:
- FP2 = v_bp - vstartup_start (if vstartup is after vsync), else 0
- vcount_init = OTG SOF position from vsync (0) or vtotal depending on vstartup position

---
 .../amd/display/dc/optc/dcn60/dcn60_optc.c    | 83 ++++++++++++++++++-
 1 file changed, 82 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/optc/dcn60/dcn60_optc.c +82 -1
index bfeb3c8fc8f5..1257a540bc59 100644
@@ -23,6 +23,87 @@
 #define FN(reg_name, field_name) \
 	optc1->tg_shift->field_name, optc1->tg_mask->field_name
 
+/*
+ * apply_front_porch_workaround
+ *
+ * fixed keep Front porch at minimum 2 for Interlaced mode or 1 for progressive.
+ */
+static void apply_front_porch_workaround(
+	struct dc_crtc_timing *timing)
+{
+	if (timing->flags.INTERLACE == 1) {
+		if (timing->v_front_porch < 2)
+			timing->v_front_porch = 2;
+	} else {
+		if (timing->v_front_porch < 1)
+			timing->v_front_porch = 1;
+	}
+}
+
+/**
+ * optc60_set_vtg_params - Set Vertical Timing Generator (VTG) parameters
+ *
+ * @optc: timing_generator struct used to extract the optc parameters
+ * @dc_crtc_timing: Timing parameters configured
+ * @program_fp2: Boolean value indicating if FP2 will be programmed or not
+ *
+ * OTG is responsible for generating the global sync signals, including
+ * vertical timing information for each HUBP in the dcfclk domain. Each VTG is
+ * associated with one OTG that provides HUBP with vertical timing information
+ * (i.e., there is 1:1 correspondence between OTG and VTG). This function is
+ * responsible for setting the OTG parameters to the VTG during the pipe
+ * programming.
+ */
+static void optc60_set_vtg_params(struct timing_generator *optc,
+		const struct dc_crtc_timing *dc_crtc_timing, bool program_fp2)
+{
+	struct dc_crtc_timing patched_crtc_timing;
+	uint32_t v_bp;
+	uint32_t v_init;
+	uint32_t v_fp2;
+	bool vstartup_after_vsync;
+
+	struct optc *optc1 = DCN10TG_FROM_TG(optc);
+
+	patched_crtc_timing = *dc_crtc_timing;
+	apply_front_porch_workaround(&patched_crtc_timing);
+
+	/* v_bp (end of blank): lines from vsync (0) to end of blank */
+	v_bp = patched_crtc_timing.v_total - patched_crtc_timing.v_front_porch -
+			patched_crtc_timing.v_border_bottom -
+			patched_crtc_timing.v_addressable -
+			patched_crtc_timing.v_border_top;
+
+	vstartup_after_vsync = (uint32_t)optc1->vstartup_start < v_bp;
+
+	/* if vstartup is before vsync, fp2 is the offset, otherwise 0 */
+	v_fp2 = !vstartup_after_vsync ?
+			optc1->vstartup_start - v_bp :
+			0;
+
+	/* vcount_init should be OTG SOF (vstartup) position from vsync (0) or
+	 * vtotal depending on the position of vstartup.
+	 */
+	v_init = !vstartup_after_vsync ?
+			patched_crtc_timing.v_total - v_fp2 - 1 : // OTG SOF before VSYNC
+			patched_crtc_timing.v_total - 1; // OTG SOF is VSYNC
+
+	/* Interlace */
+	if (REG(OTG_INTERLACE_CONTROL)) {
+		if (patched_crtc_timing.flags.INTERLACE == 1) {
+			v_init = v_init / 2;
+			if ((uint32_t)((optc1->vstartup_start/2)*2) > v_bp)
+				v_fp2 = v_fp2 / 2;
+		}
+	}
+
+	if (program_fp2)
+		REG_UPDATE_2(CONTROL,
+				VTG0_FP2, v_fp2,
+				VTG0_VCOUNT_INIT, v_init);
+	else
+		REG_UPDATE(CONTROL, VTG0_VCOUNT_INIT, v_init);
+}
 static const struct timing_generator_funcs dcn60_tg_funcs = {
 		.validate_timing = optc1_validate_timing,
 		.program_timing = optc1_program_timing,
@@ -78,7 +159,7 @@ static const struct timing_generator_funcs dcn60_tg_funcs = {
 		.set_vtotal_change_limit = optc3_set_vtotal_change_limit,
 		.set_gsl = optc2_set_gsl,
 		.set_gsl_source_select = NULL,
-		.set_vtg_params = optc1_set_vtg_params,
+		.set_vtg_params = optc60_set_vtg_params,
 		.program_manual_trigger = optc2_program_manual_trigger,
 		.setup_manual_trigger = optc2_setup_manual_trigger,
 		.get_hw_timing = optc1_get_hw_timing,
Signature · 1 line
2.53.0
#29 lore raw

PATCH 26/34 drm/amd/display: Add urgent watermark override for DCN42

In reply to Fangzhi Zuo

From: Ovidiu Bunea <[email protected]>

[why & how]
Out-of-urgent bandwidth delivery to DCN is very poor under workloads. Even after asserting urgent, empirical data shows urgent return BW delays of up to 100 μs. Override the value when programming watermarks to avoid modifying mode support. Maintain the DML's calculated value as a floor.

---
 drivers/gpu/drm/amd/display/dc/dc.h           |  1 +
 .../display/dc/hubbub/dcn42/dcn42_hubbub.c    | 41 +++++++++++--------
 2 files changed, 26 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/display/dc/dc.h +1 -0
index 9c8e55715e47..b7c04d7cea3b 100644
@@ -1314,6 +1314,7 @@ struct dc_debug_options {
 	unsigned int auxless_alpm_lfps_t1t2_us;
 	short auxless_alpm_lfps_t1t2_offset_us;
 	bool disable_stutter_for_wm_program;
+	unsigned int urgent_watermark_override;
 	bool enable_block_sequence_programming;
 	uint32_t custom_psp_footer_size;
 	bool disable_deferred_minimal_transitions;
drivers/gpu/drm/amd/display/dc/hubbub/dcn42/dcn42_hubbub.c +25 -16

73 lines not on this page · raw message

Signature · 1 line
2.53.0
#30 lore raw

PATCH 27/34 drm/amd/display: Attach blend mode property for alpha planes

In reply to Fangzhi Zuo

From: Ray Wu <[email protected]>

[Why & How]
drm_mode_config_validate() warns when a plane exposes an alpha-capable pixel format without a blend_mode_property. amdgpu DM only created that property for overlay planes, so PRIMARY and CURSOR triggered the warning on every probe and reload in kernel 7.2.

Create the blend mode property for every plane that advertises an alpha format. Keep overlay-only alpha_property. Cursor advertises only pre-multiplied blend mode because native cursor programming is pre-multiplied.

Assisted-by Cursor:Claude-Opus-4.8
---
 .../amd/display/amdgpu_dm/amdgpu_dm_plane.c   | 38 +++++++++++++++----
 1 file changed, 31 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c +31 -7
index 6c1b2407f2da..590a015fc7ec 100644
@@ -2222,6 +2222,21 @@ static const struct drm_plane_funcs dm_plane_funcs = {
 #endif
 };
 
+static bool amdgpu_dm_plane_exposes_alpha_format(const struct drm_plane *plane)
+{
+	unsigned int i;
+
+	for (i = 0; i < plane->format_count; i++) {
+		const struct drm_format_info *fmt =
+			drm_format_info(plane->format_types[i]);
+
+		if (fmt && fmt->has_alpha)
+			return true;
+	}
+
+	return false;
+}
+
 int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
 				struct drm_plane *plane,
 				unsigned long possible_crtcs,
@@ -2252,14 +2267,8 @@ int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
 		return res;
 
 	if (plane->type == DRM_PLANE_TYPE_OVERLAY &&
-	    plane_cap && plane_cap->per_pixel_alpha) {
-		unsigned int blend_caps = BIT(DRM_MODE_BLEND_PIXEL_NONE) |
-					  BIT(DRM_MODE_BLEND_PREMULTI) |
-					  BIT(DRM_MODE_BLEND_COVERAGE);
-
+	    plane_cap && plane_cap->per_pixel_alpha)
 		drm_plane_create_alpha_property(plane);
-		drm_plane_create_blend_mode_property(plane, blend_caps);
-	}
 
 	if (plane->type == DRM_PLANE_TYPE_PRIMARY) {
 		/*
@@ -2279,6 +2288,21 @@ int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
 		drm_plane_create_zpos_immutable_property(plane, 255);
 	}
 
+	/*
+	 * drm_mode_config_validate() warns about planes exposing a pixel format
+	 * with alpha but no blend mode property, so attach one to every plane
+	 * advertising such a format.
+	 */
+	if (amdgpu_dm_plane_exposes_alpha_format(plane)) {
+		unsigned int blend_caps = BIT(DRM_MODE_BLEND_PREMULTI);
+
+		if (plane->type != DRM_PLANE_TYPE_CURSOR)
+			blend_caps |= BIT(DRM_MODE_BLEND_PIXEL_NONE) |
+				      BIT(DRM_MODE_BLEND_COVERAGE);
+
+		drm_plane_create_blend_mode_property(plane, blend_caps);
+	}
+
 	if ((plane->type == DRM_PLANE_TYPE_PRIMARY ||
 	     plane->type == DRM_PLANE_TYPE_OVERLAY) &&
 	    plane_cap &&
Signature · 1 line
2.53.0
#31 lore raw

PATCH 28/34 drm/amd/display: Fix zero dlg_reg write to program_ext_vblank

In reply to Fangzhi Zuo

From: Charlene Liu <[email protected]>

[why]
fix some non initialized reg_offset
allow z8_only to program_ext_vblank

[CLEANED]
for dml2.1, dlg_reg moved inside hubp_reg
add current_compbuf_size check ensure HW state reached.

Partial application: DCN42 register-list additions only.
References: commit d5f3d9c1b8f6 ("drm/amd/display: Add DCN42B code to DC")
References: commit 002f32db0d42 ("drm/amd/display: Fix dcn401_optimize_bandwidth")

---
 drivers/gpu/drm/amd/display/dc/hubbub/dcn42/dcn42_hubbub.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/hubbub/dcn42/dcn42_hubbub.h +6 -1
index 926ddc156a2b..f74d5690c89d 100644
@@ -114,7 +114,12 @@
 	SR(DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_Z8_C),\
 	SR(DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_Z8_D),\
 	SR(DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_Z8_D),\
-	SR(DCHUBBUB_ARB_QOS_FORCE)
+	SR(DCHUBBUB_ARB_QOS_FORCE),\
+	SR(DCHUBBUB_TEST_DEBUG_INDEX),\
+	SR(DCHUBBUB_TEST_DEBUG_DATA),\
+	SR(DCHUBBUB_CTRL_STATUS),\
+	SR(DCHUBBUB_TIMEOUT_DETECTION_CTRL1),\
+	SR(DCHUBBUB_TIMEOUT_DETECTION_CTRL2)\
 
 #define HUBBUB_MASK_SH_LIST_DCN4_2(mask_sh)\
 	HUBBUB_MASK_SH_LIST_DCN32(mask_sh), \
Signature · 1 line
2.53.0
#32 lore raw

PATCH 29/34 drm/amd/display: Block DSC Padding on DP

In reply to Fangzhi Zuo

From: Relja Vojvodic <[email protected]>

[Why & How]
- BSOD was found on a DP config due to incomplete DSC padding implementation for DP
- Block DSC padding on DP until fully implemented

---
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +1 -1
index 549f9885b762..7e42790ad575 100644
@@ -4886,7 +4886,7 @@ static void calculate_timing_params_for_dsc_with_padding(struct pipe_ctx *pipe_c
 #if defined(CONFIG_DRM_AMD_DC_FP)
 	uint32_t hactive;
 	uint32_t ceil_slice_width;
-	if (stream && stream->timing.flags.DSC) {
+	if (stream && stream->timing.flags.DSC && stream->signal == SIGNAL_TYPE_HDMI_FRL) {
 		hactive = stream->timing.h_addressable + stream->timing.h_border_left + stream->timing.h_border_right;
 
 		/* Assume if determined slices does not divide Hactive evenly, Hborrow is needed for padding*/
Signature · 1 line
2.53.0
#33 lore raw

PATCH 30/34 drm/amd/display: Enable dcn42 pstate pmo

In reply to Fangzhi Zuo

From: Dmytro Laktyushkin <[email protected]>

Set a flag to enable pstate pmo, we want to always allow pstate support on dcn42

Partial application: DCN42B resource constructor only.
References: commit 67728572cb57 ("drm/amd/display: Enable dcn42 pstate pmo")

---
 .../gpu/drm/amd/display/dc/resource/dcn42b/dcn42b_resource.c    | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/dc/resource/dcn42b/dcn42b_resource.c +2 -0
index b31f8cbd5f4c..cff4607f3658 100644
@@ -2437,6 +2437,8 @@ static bool dcn42b_resource_construct(
 	/* SPL */
 	dc->caps.scl_caps.sharpener_support = true;
 
+	dc->dml2_options.pmo.force_mandatory_uclk_pstate_support = true;
+
 	return true;
 
 create_fail:
Signature · 1 line
2.53.0
#34 lore raw

PATCH 31/34 drm/amd/display: Update default clocks for DCN60 lite3 variant

In reply to Fangzhi Zuo

From: Nicholas Kazlauskas <[email protected]>

[Why]
These are important for getting correct DP and audio output. The wrong pixel clock will be used otherwise. [How]
Update the default clocks for the DCN60 lite3 variant.

---
 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c +3 -2
index 26972c220e34..9ce378b821dc 100644
@@ -1804,6 +1804,7 @@ struct clk_mgr_internal *dcn60_clk_mgr_construct(
 {
 	struct dcn60_clk_mgr *clk_mgr60 = kzalloc(sizeof(struct dcn60_clk_mgr), GFP_KERNEL);
 	struct clk_mgr_internal *clk_mgr;
+	bool variant_clocks = ASICREV_IS_DCN6_VARIANT_LITE3(ctx->asic_id.hw_internal_rev);
 
 	if (!clk_mgr60)
 		return NULL;
@@ -1828,14 +1829,14 @@ struct clk_mgr_internal *dcn60_clk_mgr_construct(
 	 * dcn60_dump_clk_registers from 4 * dentist_vco_freq_khz /
 	 * dprefclk DID divider
 	 */
-	clk_mgr->base.dprefclk_khz = 720000;
+	clk_mgr->base.dprefclk_khz = variant_clocks ? 607407 : 720000;
 
 		/* integer part is now VCO frequency in kHz */
 		clk_mgr->base.dentist_vco_freq_khz = dcn60_get_vco_frequency_from_reg(clk_mgr);
 
 		/* in case we don't get a value from the register, use default */
 		if (clk_mgr->base.dentist_vco_freq_khz == 0)
-			clk_mgr->base.dentist_vco_freq_khz = 4500000;
+			clk_mgr->base.dentist_vco_freq_khz = variant_clocks ? 4100000 : 4500000;
 
 	clk_mgr->dfs_bypass_enabled = false;
 
Signature · 1 line
2.53.0
#35 lore raw

PATCH 32/34 drm/amd/display: Don't round up cursor width to nearest 64

In reply to Fangzhi Zuo

From: Alvin Lee <[email protected]>

[Description]
Rounding up cursor width was only used to calculate total size in previous generations. Do not use the rounded up cursor width in hardware programming.

---
 drivers/gpu/drm/amd/display/dc/hubp/dcn60/dcn60_hubp.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/hubp/dcn60/dcn60_hubp.c +1 -4
index 4af60e473bd9..7c2ff310ea99 100644
@@ -189,9 +189,6 @@ void hubp60_cursor_set_attributes(
 	enum cursor_lines_per_chunk lpc = hubp2_get_lines_per_chunk(
 		attr->width, attr->color_format);
 
-	//Round cursor width up to next multiple of 64
-	uint32_t cursor_width = ((attr->width + 63) / 64) * 64;
-
 	hubp->curs_attr = *attr;
 
 	if (!hubp->cursor_offload) {
@@ -201,7 +198,7 @@ void hubp60_cursor_set_attributes(
 			CURSOR_SURFACE_ADDRESS, attr->address.low_part);
 
 		REG_UPDATE_2(CURSOR_SIZE,
-			CURSOR_WIDTH, cursor_width,
+			CURSOR_WIDTH, attr->width,
 			CURSOR_HEIGHT, attr->height);
 
 		REG_UPDATE_4(CURSOR_CONTROL,
Signature · 1 line
2.53.0
#36 lore raw

PATCH 33/34 drm/amd/display: adjust floating point format for gamut remap when needed

In reply to Fangzhi Zuo

From: Clay King <[email protected]>

[Why]
The MPCCs different gamut remap matrices allow for S2D13 and S3D12 floating point formats, but only S2D13 is used. There may be cases where more integer bits are required.

[How]
Switch to S3D12 if any entries in the remap matrix cannot fit in S2D13. Otherwise, prefer the extra precision of S2D13. Communicate the max value that hw can support to dm via dc color caps.

---
 .../dc/gpio/dcn42/hw_translate_dcn42.c.orig   | 206 ------------------
 .../dc/resource/dcn60/dcn60_resource.c        |   2 +
 2 files changed, 2 insertions(+), 206 deletions(-)
 delete mode 100644 drivers/gpu/drm/amd/display/dc/gpio/dcn42/hw_translate_dcn42.c.orig
drivers/gpu/drm/amd/display/dc/gpio/dcn42/hw_translate_dcn42.c.orig deleted +0 -206
deleted file mode 100644
index e7e1d9979876..000000000000
@@ -1,206 +0,0 @@
-// SPDX-License-Identifier: MIT
-//
-// Copyright 2026 Advanced Micro Devices, Inc.
-
-#include "hw_translate_dcn42.h"
-
-#include "dm_services.h"
-#include "include/gpio_types.h"
-#include "../hw_translate.h"
-
-
-#include "dcn/dcn_4_2_0_offset.h"
-#include "dcn/dcn_4_2_0_sh_mask.h"
-#include "dpcs/dpcs_4_0_0_offset.h"
-#include "dpcs/dpcs_4_0_0_sh_mask.h"
-
-#define DCN_BASE__INST0_SEG2                       0x000034C0
-
-/* begin *********************
- * macros to expend register list macro defined in HW object header file */
-
-/* DCN */
-#define block HPD
-#define reg_num 0
-
-#undef BASE_INNER
-#define BASE_INNER(seg) DCN_BASE__INST0_SEG ## seg
-
-#define BASE(seg) BASE_INNER(seg)
-
-#undef REG
-#define REG(reg_name)\
-		(BASE(reg ## reg_name ## _BASE_IDX) + reg ## reg_name)
-#define SF_HPD(reg_name, field_name, post_fix)\
-	.field_name = reg_name ## __ ## field_name ## post_fix
-
-
-/* macros to expend register list macro defined in HW object header file
- * end *********************/
-
-
-static bool offset_to_id(
-	uint32_t offset,
-	uint32_t mask,
-	enum gpio_id *id,
-	uint32_t *en)
-{
-	(void)mask;
-	switch (offset) {
-	/* HPD */
-	case REG(HPD0_DC_HPD_INT_STATUS):
-		*id = GPIO_ID_HPD;
-		*en = GPIO_HPD_1;
-		return true;
-	case REG(HPD1_DC_HPD_INT_STATUS):
-		*id = GPIO_ID_HPD;
-		*en = GPIO_HPD_2;
-		return true;
-	case REG(HPD2_DC_HPD_INT_STATUS):
-		*id = GPIO_ID_HPD;
-		*en = GPIO_HPD_3;
-		return true;
-	case REG(HPD3_DC_HPD_INT_STATUS):
-		*id = GPIO_ID_HPD;
-		*en = GPIO_HPD_4;
-		return true;
-	case REG(HPD4_DC_HPD_INT_STATUS):
-		*id = GPIO_ID_HPD;
-		*en = GPIO_HPD_5;
-		return true;
-	/* DDC */
-	/* we don't care about the GPIO_ID for DDC
-	 * in DdcHandle it will use GPIO_ID_DDC_DATA/GPIO_ID_DDC_CLOCK
-	 * directly in the create method
-	 */
-	case REG(DC_GPIO_DDC1_A):
-		*en = GPIO_DDC_LINE_DDC1;
-		return true;
-	case REG(DC_GPIO_DDC2_A):
-		*en = GPIO_DDC_LINE_DDC2;
-		return true;
-	case REG(DC_GPIO_DDC3_A):
-		*en = GPIO_DDC_LINE_DDC3;
-		return true;
-	case REG(DC_GPIO_DDC4_A):
-		*en = GPIO_DDC_LINE_DDC4;
-		return true;
-	case REG(DC_GPIO_DDC5_A):
-		*en = GPIO_DDC_LINE_DDC5;
-		return true;
-	case REG(DC_GPIO_DDCVGA_A):
-		*en = GPIO_DDC_LINE_DDC_VGA;
-		return true;
-	default:
-		ASSERT_CRITICAL(false);
-		return false;
-	}
-}
-
-
-static bool id_to_offset(
-	enum gpio_id id,
-	uint32_t en,
-	struct gpio_pin_info *info)
-{
-	bool result = true;
-
-	switch (id) {
-	case GPIO_ID_DDC_DATA:
-		info->mask = DC_GPIO_DDC1_A__DC_GPIO_DDC1DATA_A_MASK;
-		switch (en) {
-		case GPIO_DDC_LINE_DDC1:
-			info->offset = REG(DC_GPIO_DDC1_A);
-		break;
-		case GPIO_DDC_LINE_DDC2:
-			info->offset = REG(DC_GPIO_DDC2_A);
-		break;
-		case GPIO_DDC_LINE_DDC3:
-			info->offset = REG(DC_GPIO_DDC3_A);
-		break;
-		case GPIO_DDC_LINE_DDC4:
-			info->offset = REG(DC_GPIO_DDC4_A);
-		break;
-		case GPIO_DDC_LINE_DDC5:
-			info->offset = REG(DC_GPIO_DDC5_A);
-		break;
-		case GPIO_DDC_LINE_DDC_VGA:
-			info->offset = REG(DC_GPIO_DDCVGA_A);
-		break;
-		case GPIO_DDC_LINE_I2C_PAD:
-		default:
-			ASSERT_CRITICAL(false);
-			result = false;
-		}
-	break;
-	case GPIO_ID_DDC_CLOCK:
-		info->mask = DC_GPIO_DDC1_A__DC_GPIO_DDC1CLK_A_MASK;
-		switch (en) {
-		case GPIO_DDC_LINE_DDC1:
-			info->offset = REG(DC_GPIO_DDC1_A);
-		break;
-		case GPIO_DDC_LINE_DDC2:
-			info->offset = REG(DC_GPIO_DDC2_A);
-		break;
-		case GPIO_DDC_LINE_DDC3:
-			info->offset = REG(DC_GPIO_DDC3_A);
-		break;
-		case GPIO_DDC_LINE_DDC4:
-			info->offset = REG(DC_GPIO_DDC4_A);
-		break;
-		case GPIO_DDC_LINE_DDC5:
-			info->offset = REG(DC_GPIO_DDC5_A);
-		break;
-		case GPIO_DDC_LINE_DDC_VGA:
-			info->offset = REG(DC_GPIO_DDCVGA_A);
-		break;
-		case GPIO_DDC_LINE_I2C_PAD:
-		default:
-			ASSERT_CRITICAL(false);
-			result = false;
-		}
-	break;
-	case GPIO_ID_SYNC:
-	case GPIO_ID_VIP_PAD:
-	default:
-		ASSERT_CRITICAL(false);
-		result = false;
-	}
-
-	if (result) {
-		info->offset_y = info->offset + 2;
-		info->offset_en = info->offset + 1;
-		info->offset_mask = info->offset - 1;
-
-		info->mask_y = info->mask;
-		info->mask_en = info->mask;
-		info->mask_mask = info->mask;
-	}
-
-	return result;
-}
-
-
-/* function table */
-static const struct hw_translate_funcs funcs = {
-	.offset_to_id = offset_to_id,
-	.id_to_offset = id_to_offset,
-};
-
-
-/*
- * dal_hw_translate_dcn42_init
- *
- * @brief
- * Initialize Hw translate function pointers.
- *
- * @param
- * struct hw_translate *tr - [out] struct of function pointers
- *
- */
-void dal_hw_translate_dcn42_init(struct hw_translate *tr)
-{
-	tr->funcs = &funcs;
-}
-
-
drivers/gpu/drm/amd/display/dc/resource/dcn60/dcn60_resource.c +2 -0
index 4e043343a819..3b70e97c0a6a 100644
@@ -12,6 +12,7 @@
 
 #include "resource.h"
 #include "include/irq_service_interface.h"
+#include "basics/conversion.h"
 
 #include "dcn20/dcn20_resource.h"
 #include "dcn30/dcn30_resource.h"
@@ -2100,6 +2101,7 @@ static bool dcn60_resource_construct(
 	dc->caps.color.mpc.ogam_rom_caps.hlg = 0;
 	dc->caps.color.mpc.ocsc = 1;
 	dc->caps.color.mpc.preblend = true;
+	dc->caps.color.mpc.max_gamut_remap_coeff = dc_fixpt_from_fraction(S3D12_MAX, DIVIDER);
 	/* HACK: Force FRL support until BIOS is ready. */
 	dc->config.force_hdmi21_frl_enc_enable = true;
 	dc->config.use_spl = true;
Signature · 1 line
2.53.0
#37 lore raw

PATCH 34/34 drm/amd/display: Promote DC to 3.2.400

In reply to Fangzhi Zuo

From: Ashwin Santhosh <[email protected]>

This DC patchset brings improvements in multiple areas.
- Stabilizes public lifecycle APIs, and adds DCN42/DCN60 support.
- Adds DCN60 clock overrides, DCN42 PMO/P-state support,
QoS handling for invalid PMFW tables, urgent-watermark overrides, and improved self-refresh timing.
- Improve HDMI 2.1 reliability
- Enables DMUB hardware cursor offload and improves cursor/cache behavior.

---
 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 b7c04d7cea3b..96b1c900dc97 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.399"
+#define DC_VER "3.2.400"
 
 /**
  * MAX_SURFACES - representative of the upper bound of surfaces that can be piped to a single CRTC
Signature · 1 line
2.53.0