Skip to contentSkip to conversation

DC Patches Feb 27th, 2023

PATCH In review Qingqing Zhuo 2 participants 22 messages Feb 22, 2023 – Feb 27, 2023

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

cover DC Patches Feb 27th, 2023

This DC patchset brings improvements in multiple areas. In summary, we highlight:
- Correct DML calculation
- Extend Freesync over Pcon support
- Fixes in pstate hang and more
- Code cleanup for dc_link.h and dc_link.c

Cc Daniel Wheeler <[email protected]>

Alex Hung (1):
drm/amd/display: fix shift-out-of-bounds in CalculateVMAndRowBytes

Alvin Lee (1):
drm/amd/display: DAL to program DISPCLK WDIVIDER if PMFW doesn't

Aric Cyr (6):
drm/amd/display: Reduce CPU busy-waiting for long delays Revert "drm/amd/display: Do not set DRR on pipe commit" Revert "drm/amd/display: Fix FreeSync active bit issue" drm/amd/display: Do not update DRR while BW optimizations pending drm/amd/display: Only wait for blank completion if OTG active drm/amd/display: Promote DAL to 3.2.224

Ayush Gupta (1):
drm/amd/display: populate subvp cmd info only for the top pipe

Hersen Wu (1):
drm/amd/display: dcn32/321 dsc_pg_control not executed properly

Jasdeep Dhillon (1):
drm/amd/display: Updating Video Format Fall Back Policy.

Mustapha Ghaddar (2):
drm/amd/display: Allocation at stream Enable drm/amd/display: Update BW ALLOCATION Function declaration

Paul Hsieh (1):
drm/amd/display: Correct DML calculation as HW SpreadSheet

Ryan Lin (1):
drm/amd/display: Ext displays with dock can't recognized after resume

Samson Tam (1):
drm/amd/display: enable DPG when disabling plane for phantom pipe

Sung Joon Kim (1):
drm/amd/display: Extend Freesync over PCon support for more devices

Wenjing Liu (2):
drm/amd/display: merge dc_link.h into dc.h and dc_types.h drm/amd/display: remove empty dc_link.c

Yihan Zhu (1):
drm/amd/display: update pixel format in DP hw sequence

 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  17 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c |   2 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_hdcp.c    |   1 +
 .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c |   2 +
 .../gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c  |   4 +-
 .../display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c  |  41 +-
 drivers/gpu/drm/amd/display/dc/core/dc.c      | 253 +++-----
 drivers/gpu/drm/amd/display/dc/core/dc_link.c |  27 -
 .../drm/amd/display/dc/core/dc_link_exports.c |  87 +++
 drivers/gpu/drm/amd/display/dc/dc.h           | 556 +++++++++++++++++-
 drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c  |   3 +-
 drivers/gpu/drm/amd/display/dc/dc_dp_types.h  | 107 ++++
 drivers/gpu/drm/amd/display/dc/dc_hw_types.h  |  14 +
 drivers/gpu/drm/amd/display/dc/dc_link.h      |   8 +-
 drivers/gpu/drm/amd/display/dc/dc_types.h     | 104 ++++
 drivers/gpu/drm/amd/display/dc/dce/dce_aux.c  |   9 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.c |   2 +-
 drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c |   2 +-
 drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c |   2 +-
 drivers/gpu/drm/amd/display/dc/dce/dmub_psr.h |   5 +-
 .../display/dc/dce110/dce110_hw_sequencer.c   |   2 +-
 .../amd/display/dc/dcn10/dcn10_hw_sequencer.c |   2 +-
 .../drm/amd/display/dc/dcn20/dcn20_hwseq.c    |   9 +
 .../dc/dcn30/dcn30_dio_stream_encoder.c       |   1 +
 .../drm/amd/display/dc/dcn30/dcn30_hwseq.c    |  10 +-
 .../dc/dcn31/dcn31_hpo_dp_link_encoder.c      |   1 -
 .../dc/dcn31/dcn31_hpo_dp_stream_encoder.c    |   2 +-
 .../dc/dcn314/dcn314_dio_stream_encoder.c     |   6 +
 .../dc/dcn32/dcn32_hpo_dp_link_encoder.c      |   1 -
 .../drm/amd/display/dc/dcn32/dcn32_hwseq.c    |  21 +-
 .../drm/amd/display/dc/dcn32/dcn32_resource.c |   1 +
 .../amd/display/dc/dcn321/dcn321_resource.c   |   1 +
 .../dc/dml/dcn30/display_mode_vba_30.c        |   6 +-
 .../dc/dml/dcn31/display_mode_vba_31.c        | 299 ++++++----
 .../dc/dml/dcn314/display_mode_vba_314.c      | 299 ++++++----
 .../dc/dml/dcn32/display_mode_vba_32.c        |   1 -
 .../gpu/drm/amd/display/dc/inc/hw/hw_shared.h |  14 -
 .../drm/amd/display/dc/inc/hw/link_encoder.h  |  52 --
 .../amd/display/dc/inc/hw/stream_encoder.h    |   1 -
 drivers/gpu/drm/amd/display/dc/inc/link.h     |   1 -
 .../display/dc/link/accessories/link_dp_cts.c |  17 -
 .../drm/amd/display/dc/link/link_detection.c  |  99 ++++
 .../gpu/drm/amd/display/dc/link/link_dpms.c   |  15 +-
 .../amd/display/dc/link/protocols/link_ddc.h  |   1 +
 .../dc/link/protocols/link_dp_capability.c    |  10 +-
 .../display/dc/link/protocols/link_dp_dpia.c  |   1 -
 .../dc/link/protocols/link_dp_dpia_bw.c       |  38 +-
 .../dc/link/protocols/link_dp_dpia_bw.h       |  14 +-
 .../dc/link/protocols/link_dp_training.c      |   7 +-
 .../dc/link/protocols/link_dp_training_dpia.c |   3 +-
 .../link/protocols/link_edp_panel_control.c   |   4 +-
 .../amd/display/include/link_service_types.h  |  26 -
 .../amd/display/modules/freesync/freesync.c   |  12 +-
 .../drm/amd/display/modules/inc/mod_hdcp.h    |   1 +
 54 files changed, 1618 insertions(+), 606 deletions(-)
 delete mode 100644 drivers/gpu/drm/amd/display/dc/core/dc_link.c
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/20 drm/amd/display: Ext displays with dock can't recognized after resume

From: Ryan Lin <[email protected]>

[Why]
Needs to set the default value of the LTTPR timeout after resume.

[How]
Set the default (3.2ms) timeout at resuming if the sink supports LTTPR

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c      | 10 ++++++++++
 .../gpu/drm/amd/display/dc/link/protocols/link_ddc.h   |  1 +
 .../amd/display/dc/link/protocols/link_dp_capability.c |  2 --
 3 files changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +10 -0
index 84d056b6ec60..8be9fb8ada55 100644
@@ -41,6 +41,8 @@
 #include "dpcd_defs.h"
 #include "link/protocols/link_dpcd.h"
 #include "link_service_types.h"
+#include "link/protocols/link_dp_capability.h"
+#include "link/protocols/link_ddc.h"
 
 #include "vid.h"
 #include "amdgpu.h"
@@ -2302,6 +2304,14 @@ static void s3_handle_mst(struct drm_device *dev, bool suspend)
 		if (suspend) {
 			drm_dp_mst_topology_mgr_suspend(mgr);
 		} else {
+			/* if extended timeout is supported in hardware,
+			 * default to LTTPR timeout (3.2ms) first as a W/A for DP link layer
+			 * CTS 4.2.1.1 regression introduced by CTS specs requirement update.
+			 */
+			try_to_configure_aux_timeout(aconnector->dc_link->ddc, LINK_AUX_DEFAULT_LTTPR_TIMEOUT_PERIOD);
+			if (!dp_is_lttpr_present(aconnector->dc_link))
+				try_to_configure_aux_timeout(aconnector->dc_link->ddc, LINK_AUX_DEFAULT_TIMEOUT_PERIOD);
+
 			ret = drm_dp_mst_topology_mgr_resume(mgr, true);
 			if (ret < 0) {
 				dm_helpers_dp_mst_stop_top_mgr(aconnector->dc_link->ctx,
drivers/gpu/drm/amd/display/dc/link/protocols/link_ddc.h +1 -0
index 86e9d2e886d6..aaa5064408ba 100644
@@ -33,6 +33,7 @@
 #define DPVGA_DONGLE_AUX_DEFER_WA_DELAY 40
 #define I2C_OVER_AUX_DEFER_WA_DELAY_1MS 1
 #define LINK_AUX_DEFAULT_LTTPR_TIMEOUT_PERIOD 3200 /*us*/
+#define LINK_AUX_DEFAULT_TIMEOUT_PERIOD 552 /*us*/
 
 #define EDID_SEGMENT_SIZE 256
 
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_capability.c +0 -2
index 4874d1bf1dcb..d4370856f164 100644
@@ -60,8 +60,6 @@
 #define MIN(X, Y) ((X) < (Y) ? (X) : (Y))
 #endif
 
-#define LINK_AUX_DEFAULT_TIMEOUT_PERIOD 552 /*us*/
-
 struct dp_lt_fallback_entry {
 	enum dc_lane_count lane_count;
 	enum dc_link_rate link_rate;
Signature · 1 line
2.34.1
#2 lore raw

PATCH 2/20 drm/amd/display: fix shift-out-of-bounds in CalculateVMAndRowBytes

In reply to Qingqing Zhuo

From: Alex Hung <[email protected]>

[WHY]
When PTEBufferSizeInRequests is zero, UBSAN reports the following warning because dml_log2 returns an unexpected negative value:

shift exponent 4294966273 is too large for 32-bit type 'int'

[HOW]

In the case PTEBufferSizeInRequests is zero, skip the dml_log2() and assign the result directly.

---
 .../gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c   | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c +4 -1
index 379729b02847..c3d75e56410c 100644
@@ -1802,7 +1802,10 @@ static unsigned int CalculateVMAndRowBytes(
 	}
 
 	if (SurfaceTiling == dm_sw_linear) {
-		*dpte_row_height = dml_min(128, 1 << (unsigned int) dml_floor(dml_log2(PTEBufferSizeInRequests * *PixelPTEReqWidth / Pitch), 1));
+		if (PTEBufferSizeInRequests == 0)
+			*dpte_row_height = 1;
+		else
+			*dpte_row_height = dml_min(128, 1 << (unsigned int) dml_floor(dml_log2(PTEBufferSizeInRequests * *PixelPTEReqWidth / Pitch), 1));
 		*dpte_row_width_ub = (dml_ceil(((double) SwathWidth - 1) / *PixelPTEReqWidth, 1) + 1) * *PixelPTEReqWidth;
 		*PixelPTEBytesPerRow = *dpte_row_width_ub / *PixelPTEReqWidth * *PTERequestSize;
 	} else if (ScanDirection != dm_vert) {
Signature · 1 line
2.34.1
#3 lore raw

PATCH 3/20 drm/amd/display: Reduce CPU busy-waiting for long delays

In reply to Qingqing Zhuo

From: Aric Cyr <[email protected]>

[WHY]
udelay should not be used for long waits since it keeps CPU active, wasting power.

[HOW]
Use fsleep where acceptable to allow CPU cores to be parked by the scheduler.

---
 drivers/gpu/drm/amd/display/dc/dce/dce_aux.c             | 9 ++-------
 drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.c            | 2 +-
 drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c            | 2 +-
 drivers/gpu/drm/amd/display/dc/link/link_dpms.c          | 4 ++--
 .../amd/display/dc/link/protocols/link_dp_capability.c   | 8 ++++----
 .../drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c  | 2 +-
 .../drm/amd/display/dc/link/protocols/link_dp_training.c | 7 ++-----
 .../display/dc/link/protocols/link_dp_training_dpia.c    | 2 +-
 .../display/dc/link/protocols/link_edp_panel_control.c   | 4 ++--
 9 files changed, 16 insertions(+), 24 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dce_aux.c +2 -7
index 140297c8ff55..739298d2dff3 100644
@@ -832,13 +832,8 @@ bool dce_aux_transfer_with_retries(struct ddc_service *ddc,
 									LOG_FLAG_I2cAux_DceAux,
 									"dce_aux_transfer_with_retries: payload->defer_delay=%u",
 									payload->defer_delay);
-						if (payload->defer_delay > 1) {
-							msleep(payload->defer_delay);
-							defer_time_in_ms += payload->defer_delay;
-						} else if (payload->defer_delay <= 1) {
-							udelay(payload->defer_delay * 1000);
-							defer_time_in_ms += payload->defer_delay;
-						}
+						fsleep(payload->defer_delay * 1000);
+						defer_time_in_ms += payload->defer_delay;
 					}
 				}
 				break;
drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.c +1 -1
index d3cc5ec46956..e74266cc0098 100644
@@ -586,7 +586,7 @@ static void dcn10_dmcu_set_psr_enable(struct dmcu *dmcu, bool enable, bool wait)
 				if (state == PSR_STATE0)
 					break;
 			}
-			udelay(500);
+			fsleep(500);
 		}
 
 		/* assert if max retry hit */
drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c +1 -1
index 1e2d2cbe2c37..19440bdf6344 100644
@@ -215,7 +215,7 @@ static void dmub_psr_enable(struct dmub_psr *dmub, bool enable, bool wait, uint8
 					break;
 			}
 
-			udelay(500);
+			fsleep(500);
 		}
 
 		/* assert if max retry hit */
drivers/gpu/drm/amd/display/dc/link/link_dpms.c +2 -2
index 257e1c3ba00a..180c92a9f117 100644
@@ -1153,7 +1153,7 @@ static bool poll_for_allocation_change_trigger(struct dc_link *link)
 			break;
 		}
 
-		msleep(5);
+		fsleep(5000);
 	}
 
 	if (result == ACT_FAILED) {
@@ -1640,7 +1640,7 @@ static bool write_128b_132b_sst_payload_allocation_table(
 			}
 		}
 		retries++;
-		msleep(5);
+		fsleep(5000);
 	}
 
 	if (!result && retries == max_retries) {
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_capability.c +4 -4
index d4370856f164..0f2c59807079 100644
@@ -1005,7 +1005,7 @@ static enum dc_status wake_up_aux_channel(struct dc_link *link)
 		 * signal and may need up to 1 ms before being able to reply.
 		 */
 		if (status != DC_OK || dpcd_power_state == DP_SET_POWER_D3) {
-			udelay(1000);
+			fsleep(1000);
 			aux_channel_retry_cnt++;
 		}
 	}
@@ -2121,7 +2121,7 @@ static bool dp_verify_link_cap(
 
 		if (status == LINK_TRAINING_SUCCESS) {
 			success = true;
-			udelay(1000);
+			fsleep(1000);
 			if (dc_link_dp_read_hpd_rx_irq_data(link, &irq_data) == DC_OK &&
 					dc_link_check_link_loss_status(
 							link,
@@ -2171,7 +2171,7 @@ bool dp_verify_link_cap_with_retries(
 			success = true;
 			break;
 		}
-		msleep(10);
+		fsleep(10 * 1000);
 	}
 
 	dp_trace_lt_fail_count_update(link, fail_count, true);
@@ -2231,7 +2231,7 @@ bool dc_link_is_dp_sink_present(struct dc_link *link)
 		gpio_result = dal_gpio_get_value(ddc->pin_clock, &clock_pin);
 		ASSERT(gpio_result == GPIO_RESULT_OK);
 		if (clock_pin)
-			udelay(1000);
+			fsleep(1000);
 		else
 			break;
 	} while (retry++ < 3);
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c +1 -1
index f69e681b3b5b..fcb82bb855ed 100644
@@ -424,7 +424,7 @@ int dc_link_dp_dpia_handle_usb4_bandwidth_allocation_for_link(struct dc_link *li
 				timeout--;
 			else
 				break;
-			udelay(10 * 1000);
+			fsleep(10 * 1000);
 		} while (!get_cm_response_ready_flag(link));
 
 		if (!timeout)
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.c +2 -5
index b48d4d822991..5e613ea2cd3f 100644
@@ -258,10 +258,7 @@ void dp_wait_for_training_aux_rd_interval(
 	struct dc_link *link,
 	uint32_t wait_in_micro_secs)
 {
-	if (wait_in_micro_secs > 1000)
-		msleep(wait_in_micro_secs/1000);
-	else
-		udelay(wait_in_micro_secs);
+	fsleep(wait_in_micro_secs);
 
 	DC_LOG_HW_LINK_TRAINING("%s:\n wait = %d\n",
 		__func__,
@@ -970,7 +967,7 @@ static void dpcd_exit_training_mode(struct dc_link *link, enum dp_link_encoding
 			if ((core_link_read_dpcd(link, DP_SINK_STATUS, &sink_status, 1) == DC_OK) &&
 					(sink_status & DP_INTRA_HOP_AUX_REPLY_INDICATION) == 0)
 				break;
-			udelay(1000);
+			fsleep(1000);
 		}
 	}
 }
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training_dpia.c +1 -1
index e60da0532c53..9715fa754d56 100644
@@ -1035,7 +1035,7 @@ enum link_training_result dc_link_dpia_perform_link_training(
 	 * falling back to lower bandwidth settings possible.
 	 */
 	if (result == LINK_TRAINING_SUCCESS) {
-		msleep(5);
+		fsleep(5000);
 		if (!link->is_automated)
 			result = dp_check_link_loss_status(link, &lt_settings);
 	} else if (result == LINK_TRAINING_ABORT)
drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c +2 -2
index 97e02b5b21ae..da7f83835f78 100644
@@ -325,7 +325,7 @@ bool dc_link_wait_for_t12(struct dc_link *link)
 void link_edp_add_delay_for_T9(struct dc_link *link)
 {
 	if (link && link->panel_config.pps.extra_delay_backlight_off > 0)
-		udelay(link->panel_config.pps.extra_delay_backlight_off * 1000);
+		fsleep(link->panel_config.pps.extra_delay_backlight_off * 1000);
 }
 
 bool link_edp_receiver_ready_T9(struct dc_link *link)
@@ -383,7 +383,7 @@ bool link_edp_receiver_ready_T7(struct dc_link *link)
 	}
 
 	if (link && link->panel_config.pps.extra_t7_ms > 0)
-		udelay(link->panel_config.pps.extra_t7_ms * 1000);
+		fsleep(link->panel_config.pps.extra_t7_ms * 1000);
 
 	return result;
 }
Signature · 1 line
2.34.1
#4 lore raw

PATCH 4/20 drm/amd/display: Updating Video Format Fall Back Policy.

In reply to Qingqing Zhuo

From: Jasdeep Dhillon <[email protected]>

[WHY]
Adding 1920x1080 as fail safe mode for Video Format Fall Back Policy.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c      | 5 +++++
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c | 1 +
 drivers/gpu/drm/amd/display/modules/inc/mod_hdcp.h     | 1 +
 3 files changed, 7 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +5 -0
index 8be9fb8ada55..790d4910c009 100644
@@ -7160,12 +7160,17 @@ static int amdgpu_dm_connector_get_modes(struct drm_connector *connector)
 			to_amdgpu_dm_connector(connector);
 	struct drm_encoder *encoder;
 	struct edid *edid = amdgpu_dm_connector->edid;
+	struct dc_link_settings *verified_link_cap =
+			&amdgpu_dm_connector->dc_link->verified_link_cap;
 
 	encoder = amdgpu_dm_connector_to_encoder(connector);
 
 	if (!drm_edid_is_valid(edid)) {
 		amdgpu_dm_connector->num_modes =
 				drm_add_modes_noedid(connector, 640, 480);
+		if (link_dp_get_encoding_format(verified_link_cap) == DP_128b_132b_ENCODING)
+			amdgpu_dm_connector->num_modes +=
+				drm_add_modes_noedid(connector, 1920, 1080);
 	} else {
 		amdgpu_dm_connector_ddc_get_modes(connector, edid);
 		amdgpu_dm_connector_add_common_modes(encoder, connector);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c +1 -0
index 8e572f07ec47..125012426a92 100644
@@ -559,6 +559,7 @@ static void update_config(void *handle, struct cp_psp_stream_config *config)
 	link->dp.rev = aconnector->dc_link->dpcd_caps.dpcd_rev.raw;
 	link->dp.assr_enabled = config->assr_enabled;
 	link->dp.mst_enabled = config->mst_enabled;
+	link->dp.dp2_enabled = config->dp2_enabled;
 	link->dp.usb4_enabled = config->usb4_enabled;
 	display->adjust.disable = MOD_HDCP_DISPLAY_DISABLE_AUTHENTICATION;
 	link->adjust.auth_delay = 0;
drivers/gpu/drm/amd/display/modules/inc/mod_hdcp.h +1 -0
index 3348bb97ef81..a4d344a4db9e 100644
@@ -104,6 +104,7 @@ struct mod_hdcp_displayport {
 	uint8_t rev;
 	uint8_t assr_enabled;
 	uint8_t mst_enabled;
+	uint8_t dp2_enabled;
 	uint8_t usb4_enabled;
 };
 
Signature · 1 line
2.34.1
#5 lore raw

PATCH 5/20 Revert "drm/amd/display: Do not set DRR on pipe commit"

In reply to Qingqing Zhuo

From: Aric Cyr <[email protected]>

This reverts commit 723a86ab744043dadf9ff40b34be81efa78895e5.

[Why & How]
Original change causes a regression. Revert until fix is available.

---
 drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c +3 -0
index df787fcf8e86..3b4d4d68359b 100644
@@ -998,5 +998,8 @@ void dcn30_prepare_bandwidth(struct dc *dc,
 			dc->clk_mgr->funcs->set_max_memclk(dc->clk_mgr, dc->clk_mgr->bw_params->clk_table.entries[dc->clk_mgr->bw_params->clk_table.num_entries - 1].memclk_mhz);
 
 	dcn20_prepare_bandwidth(dc, context);
+
+	dc_dmub_srv_p_state_delegate(dc,
+		context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching, context);
 }
 
Signature · 1 line
2.34.1
#6 lore raw

PATCH 6/20 drm/amd/display: Allocation at stream Enable

In reply to Qingqing Zhuo

From: Mustapha Ghaddar <[email protected]>

[WHY & HOW]
After we allocate BW at plug, we will de-alloc and allocate only what stream needs at stream_enable()

[HOW]
Introduce bw allocation check at link_enable() for DPIA links

---
 drivers/gpu/drm/amd/display/dc/dc_link.h      |  2 ++
 .../gpu/drm/amd/display/dc/link/link_dpms.c   | 11 +++++--
 .../dc/link/protocols/link_dp_dpia_bw.c       | 33 ++++++++++++++++++-
 .../dc/link/protocols/link_dp_dpia_bw.h       | 14 +++++++-
 4 files changed, 56 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/dc_link.h +2 -0
index cecd807f5ed8..bfe0f6877d9e 100644
@@ -293,6 +293,8 @@ struct dc_link {
 
 	struct dc_panel_config panel_config;
 	struct phy_state phy_state;
+	// BW ALLOCATON USB4 ONLY
+	struct dc_dpia_bw_alloc dpia_bw_alloc_config;
 };
 
 
drivers/gpu/drm/amd/display/dc/link/link_dpms.c +9 -2
index 180c92a9f117..a1214e5606dd 100644
@@ -46,6 +46,7 @@
 #include "protocols/link_dp_capability.h"
 #include "protocols/link_dp_training.h"
 #include "protocols/link_edp_panel_control.h"
+#include "protocols/link_dp_dpia_bw.h"
 
 #include "dm_helpers.h"
 #include "link_enc_cfg.h"
@@ -2044,11 +2045,17 @@ static enum dc_status enable_link_dp(struct dc_state *state,
 		}
 	}
 
-	/* Train with fallback when enabling DPIA link. Conventional links are
+	/*
+	 * If the link is DP-over-USB4 do the following:
+	 * - Train with fallback when enabling DPIA link. Conventional links are
 	 * trained with fallback during sink detection.
+	 * - Allocate only what the stream needs for bw in Gbps. Inform the CM
+	 * in case stream needs more or less bw from what has been allocated
+	 * earlier at plug time.
 	 */
-	if (link->ep_type == DISPLAY_ENDPOINT_USB4_DPIA)
+	if (link->ep_type == DISPLAY_ENDPOINT_USB4_DPIA) {
 		do_fallback = true;
+	}
 
 	/*
 	 * Temporary w/a to get DP2.0 link rates to work with SST.
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c +32 -1
index fcb82bb855ed..9d3df69fc340 100644
@@ -246,7 +246,7 @@ static bool get_cm_response_ready_flag(struct dc_link *link)
 // ------------------------------------------------------------------
 //					PUBLIC FUNCTIONS
 // ------------------------------------------------------------------
-bool set_dptx_usb4_bw_alloc_support(struct dc_link *link)
+bool link_dp_dpia_set_dptx_usb4_bw_alloc_support(struct dc_link *link)
 {
 	bool ret = false;
 	uint8_t response = 0,
@@ -439,3 +439,34 @@ int dc_link_dp_dpia_handle_usb4_bandwidth_allocation_for_link(struct dc_link *li
 out:
 	return ret;
 }
+int link_dp_dpia_allocate_usb4_bandwidth_for_stream(struct dc_link *link, int req_bw)
+{
+	int ret = 0;
+	uint8_t timeout = 10;
+
+	if (!get_bw_alloc_proceed_flag(link))
+		goto out;
+
+	/*
+	 * Sometimes stream uses same timing parameters as the already
+	 * allocated max sink bw so no need to re-alloc
+	 */
+	if (req_bw != link->dpia_bw_alloc_config.sink_allocated_bw) {
+		dc_link_set_usb4_req_bw_req(link, req_bw);
+		do {
+			if (!timeout > 0)
+				timeout--;
+			else
+				break;
+			udelay(10 * 1000);
+		} while (!get_cm_response_ready_flag(link));
+
+		if (!timeout)
+			ret = 0;// ERROR TIMEOUT waiting for response for allocating bw
+		else if (link->dpia_bw_alloc_config.sink_allocated_bw > 0)
+			ret = get_host_router_total_bw(link, HOST_ROUTER_BW_ALLOCATED);
+	}
+
+out:
+	return ret;
+}
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.h +13 -1
index c2c3049adcd1..46d141a1366f 100644
@@ -42,6 +42,18 @@ enum bw_type {
  *
  * return: SUCCESS or FAILURE
  */
-bool set_dptx_usb4_bw_alloc_support(struct dc_link *link);
+bool link_dp_dpia_set_dptx_usb4_bw_alloc_support(struct dc_link *link);
+
+/*
+ * Allocates only what the stream needs for bw, so if:
+ * If (stream_req_bw < or > already_allocated_bw_at_HPD)
+ * => Deallocate Max Bw & then allocate only what the stream needs
+ *
+ * @link: pointer to the dc_link struct instance
+ * @req_bw: Bw requested by the stream
+ *
+ * return: allocated bw else return 0
+ */
+int link_dp_dpia_allocate_usb4_bandwidth_for_stream(struct dc_link *link, int req_bw);
 
 #endif /* DC_INC_LINK_DP_DPIA_BW_H_ */
Signature · 1 line
2.34.1
#7 lore raw

PATCH 7/20 drm/amd/display: dcn32/321 dsc_pg_control not executed properly

In reply to Qingqing Zhuo

From: Hersen Wu <[email protected]>

[why]
during boot up or resume from s3, hw default value of domain_power_forceon is 1. when program domain_power_gate to 1 to power down hw block, hw will not change to power off due to domain_power_forceon = 1.

[how]
enable_power_gating_plane(true) should be executed to set domain_power_forceon to 0 before dsc_pg_control. dsc_pg_control is already called by dcn3x_init_hw--> init_pipes--> dsc_pg_control. no need be programmed with dcn3x_init_hw one more time.
to trigger dchub, dsc block power state change, need program dc_ip_request_cntl to notify hw block.

---
 .../drm/amd/display/dc/dcn20/dcn20_hwseq.c    |  9 +++++++++
 .../drm/amd/display/dc/dcn30/dcn30_hwseq.c    |  5 -----
 .../drm/amd/display/dc/dcn32/dcn32_hwseq.c    | 19 +++++++++++++------
 3 files changed, 22 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +9 -0
index b83873a3a534..8b5181f3d13a 100644
@@ -190,10 +190,15 @@ void dcn20_enable_power_gating_plane(
 	bool enable)
 {
 	bool force_on = true; /* disable power gating */
+	uint32_t org_ip_request_cntl = 0;
 
 	if (enable)
 		force_on = false;
 
+	REG_GET(DC_IP_REQUEST_CNTL, IP_REQUEST_EN, &org_ip_request_cntl);
+	if (org_ip_request_cntl == 0)
+		REG_SET(DC_IP_REQUEST_CNTL, 0, IP_REQUEST_EN, 1);
+
 	/* DCHUBP0/1/2/3/4/5 */
 	REG_UPDATE(DOMAIN0_PG_CONFIG, DOMAIN0_POWER_FORCEON, force_on);
 	REG_UPDATE(DOMAIN2_PG_CONFIG, DOMAIN2_POWER_FORCEON, force_on);
@@ -224,6 +229,10 @@ void dcn20_enable_power_gating_plane(
 		REG_UPDATE(DOMAIN20_PG_CONFIG, DOMAIN20_POWER_FORCEON, force_on);
 	if (REG(DOMAIN21_PG_CONFIG))
 		REG_UPDATE(DOMAIN21_PG_CONFIG, DOMAIN21_POWER_FORCEON, force_on);
+
+	if (org_ip_request_cntl == 0)
+		REG_SET(DC_IP_REQUEST_CNTL, 0, IP_REQUEST_EN, 0);
+
 }
 
 void dcn20_dccg_init(struct dce_hwseq *hws)
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c +0 -5
index 3b4d4d68359b..0f7de972c80a 100644
@@ -534,11 +534,6 @@ void dcn30_init_hw(struct dc *dc)
 		}
 	}
 
-	/* Power gate DSCs */
-	for (i = 0; i < res_pool->res_cap->num_dsc; i++)
-		if (hws->funcs.dsc_pg_control != NULL)
-			hws->funcs.dsc_pg_control(hws, res_pool->dscs[i]->inst, false);
-
 	/* we want to turn off all dp displays before doing detection */
 	link_blank_all_dp_displays(dc);
 
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c +13 -6
index 16f892125b6f..f667f2a6f686 100644
@@ -131,10 +131,15 @@ void dcn32_enable_power_gating_plane(
 	bool enable)
 {
 	bool force_on = true; /* disable power gating */
+	uint32_t org_ip_request_cntl = 0;
 
 	if (enable)
 		force_on = false;
 
+	REG_GET(DC_IP_REQUEST_CNTL, IP_REQUEST_EN, &org_ip_request_cntl);
+	if (org_ip_request_cntl == 0)
+		REG_SET(DC_IP_REQUEST_CNTL, 0, IP_REQUEST_EN, 1);
+
 	/* DCHUBP0/1/2/3 */
 	REG_UPDATE(DOMAIN0_PG_CONFIG, DOMAIN_POWER_FORCEON, force_on);
 	REG_UPDATE(DOMAIN1_PG_CONFIG, DOMAIN_POWER_FORCEON, force_on);
@@ -146,6 +151,9 @@ void dcn32_enable_power_gating_plane(
 	REG_UPDATE(DOMAIN17_PG_CONFIG, DOMAIN_POWER_FORCEON, force_on);
 	REG_UPDATE(DOMAIN18_PG_CONFIG, DOMAIN_POWER_FORCEON, force_on);
 	REG_UPDATE(DOMAIN19_PG_CONFIG, DOMAIN_POWER_FORCEON, force_on);
+
+	if (org_ip_request_cntl == 0)
+		REG_SET(DC_IP_REQUEST_CNTL, 0, IP_REQUEST_EN, 0);
 }
 
 void dcn32_hubp_pg_control(struct dce_hwseq *hws, unsigned int hubp_inst, bool power_on)
@@ -786,10 +794,11 @@ void dcn32_init_hw(struct dc *dc)
 		}
 	}
 
-	/* Power gate DSCs */
-	for (i = 0; i < res_pool->res_cap->num_dsc; i++)
-		if (hws->funcs.dsc_pg_control != NULL)
-			hws->funcs.dsc_pg_control(hws, res_pool->dscs[i]->inst, false);
+	/* enable_power_gating_plane before dsc_pg_control because
+	 * FORCEON = 1 with hw default value on bootup, resume from s3
+	 */
+	if (hws->funcs.enable_power_gating_plane)
+		hws->funcs.enable_power_gating_plane(dc->hwseq, true);
 
 	/* we want to turn off all dp displays before doing detection */
 	link_blank_all_dp_displays(dc);
@@ -886,8 +895,6 @@ void dcn32_init_hw(struct dc *dc)
 
 		REG_UPDATE(DCFCLK_CNTL, DCFCLK_GATE_DIS, 0);
 	}
-	if (hws->funcs.enable_power_gating_plane)
-		hws->funcs.enable_power_gating_plane(dc->hwseq, true);
 
 	if (!dcb->funcs->is_accelerated_mode(dcb) && dc->res_pool->hubbub->funcs->init_watermarks)
 		dc->res_pool->hubbub->funcs->init_watermarks(dc->res_pool->hubbub);
Signature · 1 line
2.34.1
#8 lore raw

PATCH 8/20 drm/amd/display: populate subvp cmd info only for the top pipe

In reply to Qingqing Zhuo

From: Ayush Gupta <[email protected]>

[Why]
System restart observed while changing the display resolution to 8k with extended mode. Sytem restart was caused by a page fault.

[How]
When the driver populates subvp info it did it for both the pipes using vblank which caused an outof bounds array access causing the page fault. added checks to allow the top pipe only to fix this issue.

---
 drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c +2 -1
index c2092775ca88..7f27e29fae11 100644
@@ -750,7 +750,8 @@ void dc_dmub_setup_subvp_dmub_command(struct dc *dc,
 					!pipe->top_pipe && !pipe->prev_odm_pipe &&
 					pipe->stream->mall_stream_config.type == SUBVP_MAIN) {
 				populate_subvp_cmd_pipe_info(dc, context, &cmd, pipe, cmd_pipe_index++);
-			} else if (pipe->plane_state && pipe->stream->mall_stream_config.type == SUBVP_NONE) {
+			} else if (pipe->plane_state && pipe->stream->mall_stream_config.type == SUBVP_NONE &&
+				    !pipe->top_pipe && !pipe->prev_odm_pipe) {
 				// Don't need to check for ActiveDRAMClockChangeMargin < 0, not valid in cases where
 				// we run through DML without calculating "natural" P-state support
 				populate_subvp_cmd_vblank_pipe_info(dc, context, &cmd, pipe, cmd_pipe_index++);
Signature · 1 line
2.34.1
#9 lore raw

PATCH 9/20 drm/amd/display: update pixel format in DP hw sequence

In reply to Qingqing Zhuo

From: Yihan Zhu <[email protected]>

[WHY]
DP 420 formats do not light up because the pixel processing mode of the DP_FORMAT is misprogrammed

[HOW]
Added appropriate programming for DP pixel format

---
 .../drm/amd/display/dc/dcn314/dcn314_dio_stream_encoder.c   | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_dio_stream_encoder.c +6 -0
index 962a2c02b422..742e43cb8880 100644
@@ -296,12 +296,14 @@ static void enc314_stream_encoder_dp_unblank(
 		uint32_t n_vid = 0x8000;
 		uint32_t m_vid;
 		uint32_t n_multiply = 0;
+		uint32_t pix_per_cycle = 0;
 		uint64_t m_vid_l = n_vid;
 
 		/* YCbCr 4:2:0 : Computed VID_M will be 2X the input rate */
 		if (is_two_pixels_per_containter(&param->timing) || param->opp_cnt > 1) {
 			/*this logic should be the same in get_pixel_clock_parameters() */
 			n_multiply = 1;
+			pix_per_cycle = 1;
 		}
 		/* M / N = Fstream / Flink
 		 * m_vid / n_vid = pixel rate / link rate
@@ -329,6 +331,10 @@ static void enc314_stream_encoder_dp_unblank(
 		REG_UPDATE_2(DP_VID_TIMING,
 				DP_VID_M_N_GEN_EN, 1,
 				DP_VID_N_MUL, n_multiply);
+
+		REG_UPDATE(DP_PIXEL_FORMAT,
+				DP_PIXEL_PER_CYCLE_PROCESSING_MODE,
+				pix_per_cycle);
 	}
 
 	/* make sure stream is disabled before resetting steer fifo */
Signature · 1 line
2.34.1
#10 lore raw

PATCH 10/20 drm/amd/display: Extend Freesync over PCon support for more devices

In reply to Qingqing Zhuo

From: Sung Joon Kim <[email protected]>

[why]
More branch devices are able to support Freesync over PCon so include them in the list of supporting devices.

[how]
Add more compatible PCon devices in the whitelist for Freesync over Pcon.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +2 -0
index 6fdc2027c2b4..1583157da355 100644
@@ -1149,6 +1149,8 @@ static bool dm_is_freesync_pcon_whitelist(const uint32_t branch_dev_id)
 
 	switch (branch_dev_id) {
 	case DP_BRANCH_DEVICE_ID_0060AD:
+	case DP_BRANCH_DEVICE_ID_00E04C:
+	case DP_BRANCH_DEVICE_ID_90CC24:
 		ret_val = true;
 		break;
 	default:
Signature · 1 line
2.34.1
#11 lore raw

PATCH 11/20 drm/amd/display: DAL to program DISPCLK WDIVIDER if PMFW doesn't

In reply to Qingqing Zhuo

From: Alvin Lee <[email protected]>

[Why & How]
- If for any reason PMFW fails to set the expected (or valid) DISPCLK WDIVIDER, then DAL will program DENTIST DISPCLK WDIVIDER to correct for this issue

---
 .../display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c  | 41 ++++++++++++++-----
 drivers/gpu/drm/amd/display/dc/dc.h           |  1 +
 .../drm/amd/display/dc/dcn32/dcn32_resource.c |  1 +
 .../amd/display/dc/dcn321/dcn321_resource.c   |  1 +
 4 files changed, 34 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c +31 -10
index 61768bf726f8..e686d6610fd4 100644
@@ -257,25 +257,24 @@ static void dcn32_update_dppclk_dispclk_freq(struct clk_mgr_internal *clk_mgr, s
 
 static void dcn32_update_clocks_update_dentist(
 		struct clk_mgr_internal *clk_mgr,
-		struct dc_state *context,
-		uint32_t old_dispclk_khz)
+		struct dc_state *context)
 {
 	uint32_t new_disp_divider = 0;
-	uint32_t old_disp_divider = 0;
 	uint32_t new_dispclk_wdivider = 0;
 	uint32_t old_dispclk_wdivider = 0;
 	uint32_t i;
+	uint32_t dentist_dispclk_wdivider_readback = 0;
+	struct dc *dc = clk_mgr->base.ctx->dc;
 
-	if (old_dispclk_khz == 0 || clk_mgr->base.clks.dispclk_khz == 0)
+	if (clk_mgr->base.clks.dispclk_khz == 0)
 		return;
 
 	new_disp_divider = DENTIST_DIVIDER_RANGE_SCALE_FACTOR
 			* clk_mgr->base.dentist_vco_freq_khz / clk_mgr->base.clks.dispclk_khz;
-	old_disp_divider = DENTIST_DIVIDER_RANGE_SCALE_FACTOR
-			* clk_mgr->base.dentist_vco_freq_khz / old_dispclk_khz;
 
 	new_dispclk_wdivider = dentist_get_did_from_divider(new_disp_divider);
-	old_dispclk_wdivider = dentist_get_did_from_divider(old_disp_divider);
+	REG_GET(DENTIST_DISPCLK_CNTL,
+			DENTIST_DISPCLK_WDIVIDER, &old_dispclk_wdivider);
 
 	/* When changing divider to or from 127, some extra programming is required to prevent corruption */
 	if (old_dispclk_wdivider == 127 && new_dispclk_wdivider != 127) {
@@ -314,6 +313,17 @@ static void dcn32_update_clocks_update_dentist(
 		if (clk_mgr->smu_present)
 			dcn32_smu_set_hard_min_by_freq(clk_mgr, PPCLK_DISPCLK, khz_to_mhz_ceil(temp_dispclk_khz));
 
+		if (dc->debug.override_dispclk_programming) {
+			REG_GET(DENTIST_DISPCLK_CNTL,
+					DENTIST_DISPCLK_WDIVIDER, &dentist_dispclk_wdivider_readback);
+
+			if (dentist_dispclk_wdivider_readback != 126) {
+				REG_UPDATE(DENTIST_DISPCLK_CNTL,
+						DENTIST_DISPCLK_WDIVIDER, 126);
+				REG_WAIT(DENTIST_DISPCLK_CNTL, DENTIST_DISPCLK_CHG_DONE, 1, 50, 2000);
+			}
+		}
+
 		for (i = 0; i < clk_mgr->base.ctx->dc->res_pool->pipe_count; i++) {
 			struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
 			struct dccg *dccg = clk_mgr->base.ctx->dc->res_pool->dccg;
@@ -341,6 +351,18 @@ static void dcn32_update_clocks_update_dentist(
 	/* do requested DISPCLK updates*/
 	if (clk_mgr->smu_present)
 		dcn32_smu_set_hard_min_by_freq(clk_mgr, PPCLK_DISPCLK, khz_to_mhz_ceil(clk_mgr->base.clks.dispclk_khz));
+
+	if (dc->debug.override_dispclk_programming) {
+		REG_GET(DENTIST_DISPCLK_CNTL,
+				DENTIST_DISPCLK_WDIVIDER, &dentist_dispclk_wdivider_readback);
+
+		if (dentist_dispclk_wdivider_readback > new_dispclk_wdivider) {
+			REG_UPDATE(DENTIST_DISPCLK_CNTL,
+					DENTIST_DISPCLK_WDIVIDER, new_dispclk_wdivider);
+			REG_WAIT(DENTIST_DISPCLK_CNTL, DENTIST_DISPCLK_CHG_DONE, 1, 50, 2000);
+		}
+	}
+
 }
 
 static void dcn32_update_clocks(struct clk_mgr *clk_mgr_base,
@@ -361,7 +383,6 @@ static void dcn32_update_clocks(struct clk_mgr *clk_mgr_base,
 	bool p_state_change_support;
 	bool fclk_p_state_change_support;
 	int total_plane_count;
-	int old_dispclk_khz = clk_mgr_base->clks.dispclk_khz;
 
 	if (dc->work_arounds.skip_clock_update)
 		return;
@@ -504,13 +525,13 @@ static void dcn32_update_clocks(struct clk_mgr *clk_mgr_base,
 		if (dpp_clock_lowered) {
 			/* if clock is being lowered, increase DTO before lowering refclk */
 			dcn20_update_clocks_update_dpp_dto(clk_mgr, context, safe_to_lower);
-			dcn32_update_clocks_update_dentist(clk_mgr, context, old_dispclk_khz);
+			dcn32_update_clocks_update_dentist(clk_mgr, context);
 			if (clk_mgr->smu_present)
 				dcn32_smu_set_hard_min_by_freq(clk_mgr, PPCLK_DPPCLK, khz_to_mhz_ceil(clk_mgr_base->clks.dppclk_khz));
 		} else {
 			/* if clock is being raised, increase refclk before lowering DTO */
 			if (update_dppclk || update_dispclk)
-				dcn32_update_clocks_update_dentist(clk_mgr, context, old_dispclk_khz);
+				dcn32_update_clocks_update_dentist(clk_mgr, context);
 			/* There is a check inside dcn20_update_clocks_update_dpp_dto which ensures
 			 * that we do not lower dto when it is not safe to lower. We do not need to
 			 * compare the current and new dppclk before calling this function.
drivers/gpu/drm/amd/display/dc/dc.h +1 -0
index 1fde43378689..8a62f3e93e35 100644
@@ -874,6 +874,7 @@ struct dc_debug_options {
 	bool disable_unbounded_requesting;
 	bool dig_fifo_off_in_blank;
 	bool temp_mst_deallocation_sequence;
+	bool override_dispclk_programming;
 };
 
 struct gpu_info_soc_bounding_box_v1_0;
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c +1 -0
index 74e50c09bb62..16efb86232d8 100644
@@ -726,6 +726,7 @@ static const struct dc_debug_options debug_defaults_drv = {
 	.alloc_extra_way_for_cursor = true,
 	.min_prefetch_in_strobe_ns = 60000, // 60us
 	.disable_unbounded_requesting = false,
+	.override_dispclk_programming = true,
 };
 
 static const struct dc_debug_options debug_defaults_diags = {
drivers/gpu/drm/amd/display/dc/dcn321/dcn321_resource.c +1 -0
index 55f918b44077..deaa4769be10 100644
@@ -724,6 +724,7 @@ static const struct dc_debug_options debug_defaults_drv = {
 	.alloc_extra_way_for_cursor = true,
 	.min_prefetch_in_strobe_ns = 60000, // 60us
 	.disable_unbounded_requesting = false,
+	.override_dispclk_programming = true,
 };
 
 static const struct dc_debug_options debug_defaults_diags = {
Signature · 1 line
2.34.1
#12 lore raw

PATCH 12/20 Revert "drm/amd/display: Fix FreeSync active bit issue"

In reply to Qingqing Zhuo

From: Aric Cyr <[email protected]>

This reverts commit 768ba5d529ae198c3a7cbcb1cbacb8c99dc77f07.

[Why & How]
Original change causes black screen. Revert until fix is available.

---
 .../gpu/drm/amd/display/modules/freesync/freesync.c  | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/display/modules/freesync/freesync.c +3 -9
index 2be45b314922..315da61ee897 100644
@@ -955,26 +955,20 @@ void mod_freesync_build_vrr_infopacket(struct mod_freesync *mod_freesync,
 	 * Check if Freesync is supported. Return if false. If true,
 	 * set the corresponding bit in the info packet
 	 */
-	bool freesync_on_desktop;
-	bool fams_enable;
-
-	fams_enable = stream->ctx->dc->current_state->bw_ctx.bw.dcn.clk.fw_based_mclk_switching;
-	freesync_on_desktop = stream->freesync_on_desktop && fams_enable;
-
 	if (!vrr->send_info_frame)
 		return;
 
 	switch (packet_type) {
 	case PACKET_TYPE_FS_V3:
-		build_vrr_infopacket_v3(stream->signal, vrr, app_tf, infopacket, freesync_on_desktop);
+		build_vrr_infopacket_v3(stream->signal, vrr, app_tf, infopacket, stream->freesync_on_desktop);
 		break;
 	case PACKET_TYPE_FS_V2:
-		build_vrr_infopacket_v2(stream->signal, vrr, app_tf, infopacket, freesync_on_desktop);
+		build_vrr_infopacket_v2(stream->signal, vrr, app_tf, infopacket, stream->freesync_on_desktop);
 		break;
 	case PACKET_TYPE_VRR:
 	case PACKET_TYPE_FS_V1:
 	default:
-		build_vrr_infopacket_v1(stream->signal, vrr, infopacket, freesync_on_desktop);
+		build_vrr_infopacket_v1(stream->signal, vrr, infopacket, stream->freesync_on_desktop);
 	}
 
 	if (true == pack_sdp_v1_3 &&
Signature · 1 line
2.34.1
#13 lore raw

PATCH 13/20 drm/amd/display: Do not update DRR while BW optimizations pending

In reply to Qingqing Zhuo

From: Aric Cyr <[email protected]>

[why]
While bandwidth optimizations are pending, it's possible a pstate change will occur. During this time, VSYNC handler should not also try to update DRR parameters causing pstate hang

[how]
Do not adjust DRR if optimize bandwidth is set.

---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 48 ++++++++++++++----------
 1 file changed, 29 insertions(+), 19 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +29 -19
index 1c218c526650..cfb6f4eefce9 100644
@@ -399,6 +399,13 @@ bool dc_stream_adjust_vmin_vmax(struct dc *dc,
 {
 	int i;
 
+	/*
+	 * Don't adjust DRR while there's bandwidth optimizations pending to
+	 * avoid conflicting with firmware updates.
+	 */
+	if (dc->optimized_required || dc->wm_optimized_required)
+		return false;
+
 	stream->adjust.v_total_max = adjust->v_total_max;
 	stream->adjust.v_total_mid = adjust->v_total_mid;
 	stream->adjust.v_total_mid_frame_num = adjust->v_total_mid_frame_num;
@@ -2134,27 +2141,33 @@ void dc_post_update_surfaces_to_stream(struct dc *dc)
 
 	post_surface_trace(dc);
 
-	if (dc->ctx->dce_version >= DCE_VERSION_MAX)
-		TRACE_DCN_CLOCK_STATE(&context->bw_ctx.bw.dcn.clk);
-	else
+	/*
+	 * Only relevant for DCN behavior where we can guarantee the optimization
+	 * is safe to apply - retain the legacy behavior for DCE.
+	 */
+
+	if (dc->ctx->dce_version < DCE_VERSION_MAX)
 		TRACE_DCE_CLOCK_STATE(&context->bw_ctx.bw.dce);
+	else {
+		TRACE_DCN_CLOCK_STATE(&context->bw_ctx.bw.dcn.clk);
 
-	if (is_flip_pending_in_pipes(dc, context))
-		return;
+		if (is_flip_pending_in_pipes(dc, context))
+			return;
 
-	for (i = 0; i < dc->res_pool->pipe_count; i++)
-		if (context->res_ctx.pipe_ctx[i].stream == NULL ||
-		    context->res_ctx.pipe_ctx[i].plane_state == NULL) {
-			context->res_ctx.pipe_ctx[i].pipe_idx = i;
-			dc->hwss.disable_plane(dc, &context->res_ctx.pipe_ctx[i]);
-		}
+		for (i = 0; i < dc->res_pool->pipe_count; i++)
+			if (context->res_ctx.pipe_ctx[i].stream == NULL ||
+					context->res_ctx.pipe_ctx[i].plane_state == NULL) {
+				context->res_ctx.pipe_ctx[i].pipe_idx = i;
+				dc->hwss.disable_plane(dc, &context->res_ctx.pipe_ctx[i]);
+			}
 
-	process_deferred_updates(dc);
+		process_deferred_updates(dc);
 
-	dc->hwss.optimize_bandwidth(dc, context);
+		dc->hwss.optimize_bandwidth(dc, context);
 
-	if (dc->debug.enable_double_buffered_dsc_pg_support)
-		dc->hwss.update_dsc_pg(dc, context, true);
+		if (dc->debug.enable_double_buffered_dsc_pg_support)
+			dc->hwss.update_dsc_pg(dc, context, true);
+	}
 
 	dc->optimized_required = false;
 	dc->wm_optimized_required = false;
@@ -4123,12 +4136,9 @@ void dc_commit_updates_for_stream(struct dc *dc,
 			if (new_pipe->plane_state && new_pipe->plane_state != old_pipe->plane_state)
 				new_pipe->plane_state->force_full_update = true;
 		}
-	} else if (update_type == UPDATE_TYPE_FAST && dc_ctx->dce_version >= DCE_VERSION_MAX) {
+	} else if (update_type == UPDATE_TYPE_FAST) {
 		/*
 		 * Previous frame finished and HW is ready for optimization.
-		 *
-		 * Only relevant for DCN behavior where we can guarantee the optimization
-		 * is safe to apply - retain the legacy behavior for DCE.
 		 */
 		dc_post_update_surfaces_to_stream(dc);
 	}
Signature · 1 line
2.34.1
#14 lore raw

PATCH 14/20 drm/amd/display: Update BW ALLOCATION Function declaration

In reply to Qingqing Zhuo

From: Mustapha Ghaddar <[email protected]>

[WHY & HOW]
Update the declaration to give a better idea of what the function does.

---
 drivers/gpu/drm/amd/display/dc/dc_link.h                    | 6 +++---
 .../gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/dc_link.h +3 -3
index bfe0f6877d9e..80e18c770cda 100644
@@ -549,8 +549,8 @@ void dc_link_edp_panel_backlight_power_on(struct dc_link *link,
 void dc_link_set_usb4_req_bw_req(struct dc_link *link, int req_bw);
 
 /*
- * CB function for when the status of the Req above is complete. We will
- * find out the result of allocating on CM and update structs accordingly
+ * Handle function for when the status of the Request above is complete.
+ * We will find out the result of allocating on CM and update structs.
  *
  * @link: pointer to the dc_link struct instance
  * @bw: Allocated or Estimated BW depending on the result
@@ -558,7 +558,7 @@ void dc_link_set_usb4_req_bw_req(struct dc_link *link, int req_bw);
  *
  * return: none
  */
-void dc_link_get_usb4_req_bw_resp(struct dc_link *link, uint8_t bw, uint8_t result);
+void dc_link_handle_usb4_bw_alloc_response(struct dc_link *link, uint8_t bw, uint8_t result);
 
 /*
  * Handle the USB4 BW Allocation related functionality here:
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c +1 -1
index 9d3df69fc340..72ff0ae44d01 100644
@@ -300,7 +300,7 @@ bool link_dp_dpia_set_dptx_usb4_bw_alloc_support(struct dc_link *link)
 out:
 	return ret;
 }
-void dc_link_get_usb4_req_bw_resp(struct dc_link *link, uint8_t bw, uint8_t result)
+void dc_link_handle_usb4_bw_alloc_response(struct dc_link *link, uint8_t bw, uint8_t result)
 {
 	if (!get_bw_alloc_proceed_flag((link)))
 		return;
Signature · 1 line
2.34.1
#15 lore raw

PATCH 15/20 drm/amd/display: merge dc_link.h into dc.h and dc_types.h

In reply to Qingqing Zhuo

From: Wenjing Liu <[email protected]>

[why]
Remove the need to include dc_link.h separately. dc.h should contain everything needed on DM side.

[How]
Merge dc_link.h into dc.h and dc_types.h so DM only needs to include dc.h to use all link public functions.

---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |   2 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c |   2 +-
 .../gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c  |   4 +-
 drivers/gpu/drm/amd/display/dc/core/dc.c      | 156 +----
 .../drm/amd/display/dc/core/dc_link_exports.c |  87 +++
 drivers/gpu/drm/amd/display/dc/dc.h           | 553 +++++++++++++++++-
 drivers/gpu/drm/amd/display/dc/dc_dp_types.h  | 107 ++++
 drivers/gpu/drm/amd/display/dc/dc_hw_types.h  |  14 +
 drivers/gpu/drm/amd/display/dc/dc_types.h     | 104 ++++
 drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c |   2 +-
 drivers/gpu/drm/amd/display/dc/dce/dmub_psr.h |   5 +-
 .../display/dc/dce110/dce110_hw_sequencer.c   |   2 +-
 .../amd/display/dc/dcn10/dcn10_hw_sequencer.c |   2 +-
 .../dc/dcn30/dcn30_dio_stream_encoder.c       |   1 +
 .../drm/amd/display/dc/dcn30/dcn30_hwseq.c    |   2 +-
 .../dc/dcn31/dcn31_hpo_dp_link_encoder.c      |   1 -
 .../dc/dcn31/dcn31_hpo_dp_stream_encoder.c    |   2 +-
 .../dc/dcn32/dcn32_hpo_dp_link_encoder.c      |   1 -
 .../drm/amd/display/dc/dcn32/dcn32_hwseq.c    |   2 +-
 .../dc/dml/dcn30/display_mode_vba_30.c        |   1 -
 .../dc/dml/dcn31/display_mode_vba_31.c        |   1 -
 .../dc/dml/dcn314/display_mode_vba_314.c      |   1 -
 .../dc/dml/dcn32/display_mode_vba_32.c        |   1 -
 .../gpu/drm/amd/display/dc/inc/hw/hw_shared.h |  14 -
 .../drm/amd/display/dc/inc/hw/link_encoder.h  |  52 --
 .../amd/display/dc/inc/hw/stream_encoder.h    |   1 -
 drivers/gpu/drm/amd/display/dc/inc/link.h     |   1 -
 .../display/dc/link/accessories/link_dp_cts.c |  17 -
 .../drm/amd/display/dc/link/link_detection.c  |  99 ++++
 .../display/dc/link/protocols/link_dp_dpia.c  |   1 -
 .../dc/link/protocols/link_dp_dpia_bw.c       |   1 -
 .../dc/link/protocols/link_dp_training_dpia.c |   1 -
 .../amd/display/include/link_service_types.h  |  26 -
 33 files changed, 978 insertions(+), 288 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -1
index 790d4910c009..e656c8f02e7c 100644
@@ -2273,7 +2273,7 @@ static int dm_late_init(void *handle)
 		struct dc_link *edp_links[MAX_NUM_EDP];
 		int edp_num;
 
-		get_edp_links(adev->dm.dc, edp_links, &edp_num);
+		dc_get_edp_links(adev->dm.dc, edp_links, &edp_num);
 		for (i = 0; i < edp_num; i++) {
 			if (!dmub_init_abm_config(adev->dm.dc->res_pool, params, i))
 				return -EINVAL;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +1 -1
index 09a3efa517da..4a5dae578d97 100644
@@ -724,7 +724,7 @@ static ssize_t dp_phy_test_pattern_debugfs_write(struct file *f, const char __us
 	for (i = 0; i < (unsigned int)(link_training_settings.link_settings.lane_count); i++)
 		link_training_settings.hw_lane_settings[i] = link->cur_lane_setting[i];
 
-	dc_link_set_test_pattern(
+	dc_link_dp_set_test_pattern(
 		link,
 		test_pattern,
 		DP_TEST_PATTERN_COLOR_SPACE_RGB,
drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c +2 -2
index 69691daf4dbb..73a45ec27f90 100644
@@ -104,7 +104,7 @@ void clk_mgr_exit_optimized_pwr_state(const struct dc *dc, struct clk_mgr *clk_m
 	int edp_num;
 	unsigned int panel_inst;
 
-	get_edp_links(dc, edp_links, &edp_num);
+	dc_get_edp_links(dc, edp_links, &edp_num);
 	if (dc->hwss.exit_optimized_pwr_state)
 		dc->hwss.exit_optimized_pwr_state(dc, dc->current_state);
 
@@ -129,7 +129,7 @@ void clk_mgr_optimize_pwr_state(const struct dc *dc, struct clk_mgr *clk_mgr)
 	int edp_num;
 	unsigned int panel_inst;
 
-	get_edp_links(dc, edp_links, &edp_num);
+	dc_get_edp_links(dc, edp_links, &edp_num);
 	if (edp_num) {
 		for (panel_inst = 0; panel_inst < edp_num; panel_inst++) {
 			edp_link = edp_links[panel_inst];
drivers/gpu/drm/amd/display/dc/core/dc.c +2 -154

180 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/core/dc_link_exports.c +87 -0

96 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dc.h +551 -2

586 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dc_dp_types.h +107 -0

111 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dc_hw_types.h +14 -0
index cc3d6fb39364..a583a72845fe 100644
@@ -1085,5 +1085,19 @@ struct tg_color {
 	uint16_t color_b_cb;
 };
 
+enum symclk_state {
+	SYMCLK_OFF_TX_OFF,
+	SYMCLK_ON_TX_ON,
+	SYMCLK_ON_TX_OFF,
+};
+
+struct phy_state {
+	struct {
+		uint8_t otg		: 1;
+		uint8_t reserved	: 7;
+	} symclk_ref_cnts;
+	enum symclk_state symclk_state;
+};
+
 #endif /* DC_HW_TYPES_H */
 
drivers/gpu/drm/amd/display/dc/dc_types.h +104 -0

114 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c +1 -1
index fb0dec4ed3a6..9fc48208c2e4 100644
@@ -148,7 +148,7 @@ static bool dmub_abm_set_level(struct abm *abm, uint32_t level)
 	int edp_num;
 	uint8_t panel_mask = 0;
 
-	get_edp_links(dc->dc, edp_links, &edp_num);
+	dc_get_edp_links(dc->dc, edp_links, &edp_num);
 
 	for (i = 0; i < edp_num; i++) {
 		if (edp_links[i]->link_status.link_active)
drivers/gpu/drm/amd/display/dc/dce/dmub_psr.h +3 -2
index 74005b9d352a..289e42070ece 100644
@@ -26,8 +26,9 @@
 #ifndef _DMUB_PSR_H_
 #define _DMUB_PSR_H_
 
-#include "os_types.h"
-#include "dc_link.h"
+#include "dc_types.h"
+struct dc_link;
+struct dmub_psr_funcs;
 
 struct dmub_psr {
 	struct dc_context *ctx;
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +1 -1
index fb3fd5b7c78b..e1814f1cba5a 100644
@@ -1741,7 +1741,7 @@ void dce110_enable_accelerated_mode(struct dc *dc, struct dc_state *context)
 
 
 	get_edp_links_with_sink(dc, edp_links_with_sink, &edp_with_sink_num);
-	get_edp_links(dc, edp_links, &edp_num);
+	dc_get_edp_links(dc, edp_links, &edp_num);
 
 	if (hws->funcs.init_pipes)
 		hws->funcs.init_pipes(dc, context);
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +1 -1
index a1a29c508394..5b34066ffcf6 100644
@@ -1638,7 +1638,7 @@ void dcn10_power_down_on_boot(struct dc *dc)
 	int edp_num;
 	int i = 0;
 
-	get_edp_links(dc, edp_links, &edp_num);
+	dc_get_edp_links(dc, edp_links, &edp_num);
 	if (edp_num)
 		edp_link = edp_links[0];
 
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dio_stream_encoder.c +1 -0
index 5f9079d3943a..9d08127d209b 100644
@@ -28,6 +28,7 @@
 #include "dcn30_dio_stream_encoder.h"
 #include "reg_helper.h"
 #include "hw_shared.h"
+#include "dc.h"
 #include "core_types.h"
 #include <linux/delay.h>
 
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c +1 -1
index 0f7de972c80a..73de15a20d13 100644
@@ -562,7 +562,7 @@ void dcn30_init_hw(struct dc *dc)
 		struct dc_link *edp_links[MAX_NUM_EDP];
 		struct dc_link *edp_link = NULL;
 
-		get_edp_links(dc, edp_links, &edp_num);
+		dc_get_edp_links(dc, edp_links, &edp_num);
 		if (edp_num)
 			edp_link = edp_links[0];
 		if (edp_link && edp_link->link_enc->funcs->is_dig_enabled &&
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hpo_dp_link_encoder.c +0 -1
index 0b317ed31f91..5b7ad38f85e0 100644
@@ -26,7 +26,6 @@
 #include "dc_bios_types.h"
 #include "dcn31_hpo_dp_link_encoder.h"
 #include "reg_helper.h"
-#include "dc_link.h"
 #include "stream_encoder.h"
 
 #define DC_LOGGER \
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hpo_dp_stream_encoder.c +1 -1
index d76f55a12eb4..0278bae50a9d 100644
@@ -26,7 +26,7 @@
 #include "dc_bios_types.h"
 #include "dcn31_hpo_dp_stream_encoder.h"
 #include "reg_helper.h"
-#include "dc_link.h"
+#include "dc.h"
 
 #define DC_LOGGER \
 		enc3->base.ctx->logger
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hpo_dp_link_encoder.c +0 -1
index 4dbad8d4b4fc..8af01f579690 100644
@@ -26,7 +26,6 @@
 #include "dcn31/dcn31_hpo_dp_link_encoder.h"
 #include "dcn32_hpo_dp_link_encoder.h"
 #include "reg_helper.h"
-#include "dc_link.h"
 #include "stream_encoder.h"
 
 #define DC_LOGGER \
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c +1 -1
index f667f2a6f686..4ba7a10dd7ec 100644
@@ -837,7 +837,7 @@ void dcn32_init_hw(struct dc *dc)
 		struct dc_link *edp_links[MAX_NUM_EDP];
 		struct dc_link *edp_link;
 
-		get_edp_links(dc, edp_links, &edp_num);
+		dc_get_edp_links(dc, edp_links, &edp_num);
 		if (edp_num) {
 			for (i = 0; i < edp_num; i++) {
 				edp_link = edp_links[i];
drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c +0 -1
index c3d75e56410c..899105da0433 100644
@@ -25,7 +25,6 @@
 
 #ifdef CONFIG_DRM_AMD_DC_DCN
 #include "dc.h"
-#include "dc_link.h"
 #include "../display_mode_lib.h"
 #include "display_mode_vba_30.h"
 #include "../dml_inline_defs.h"
drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c +0 -1
index 27f488405335..2b57f5b2362a 100644
@@ -24,7 +24,6 @@
  */
 
 #include "dc.h"
-#include "dc_link.h"
 #include "../display_mode_lib.h"
 #include "../dcn30/display_mode_vba_30.h"
 #include "display_mode_vba_31.h"
drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c +0 -1
index c843b394aeb4..461ab6d2030e 100644
@@ -27,7 +27,6 @@
 #define UNIT_TEST 0
 #if !UNIT_TEST
 #include "dc.h"
-#include "dc_link.h"
 #endif
 #include "../display_mode_lib.h"
 #include "display_mode_vba_314.h"
drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c +0 -1
index 3b2a014ccf8f..f2499811e269 100644
@@ -24,7 +24,6 @@
  */
 
 #include "dc.h"
-#include "dc_link.h"
 #include "../display_mode_lib.h"
 #include "display_mode_vba_32.h"
 #include "../dml_inline_defs.h"
drivers/gpu/drm/amd/display/dc/inc/hw/hw_shared.h +0 -14
index a819f0f97c5f..b95ae9596c3b 100644
@@ -275,20 +275,6 @@ enum dc_lut_mode {
 	LUT_RAM_B
 };
 
-enum symclk_state {
-	SYMCLK_OFF_TX_OFF,
-	SYMCLK_ON_TX_ON,
-	SYMCLK_ON_TX_OFF,
-};
-
-struct phy_state {
-	struct {
-		uint8_t otg		: 1;
-		uint8_t reserved	: 7;
-	} symclk_ref_cnts;
-	enum symclk_state symclk_state;
-};
-
 /**
  * speakersToChannels
  *
drivers/gpu/drm/amd/display/dc/inc/hw/link_encoder.h +0 -52

58 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/inc/hw/stream_encoder.h +0 -1
index bb5ad70d4266..c4fbbf08ef86 100644
@@ -30,7 +30,6 @@
 
 #include "audio_types.h"
 #include "hw_shared.h"
-#include "dc_link.h"
 
 struct dc_bios;
 struct dc_context;
drivers/gpu/drm/amd/display/dc/inc/link.h +0 -1
index e70fa0059223..6a346a41f07b 100644
@@ -38,7 +38,6 @@
  * into this file and prefix it with "link_".
  */
 #include "core_types.h"
-#include "dc_link.h"
 
 struct link_init_data {
 	const struct dc *dc;
drivers/gpu/drm/amd/display/dc/link/accessories/link_dp_cts.c +0 -17
index 942300e0bd92..7f36d733bfca 100644
@@ -1027,20 +1027,3 @@ void dc_link_set_preferred_training_settings(struct dc *dc,
 	if (skip_immediate_retrain == false)
 		dc_link_set_preferred_link_settings(dc, &link->preferred_link_setting, link);
 }
-
-void dc_link_set_test_pattern(struct dc_link *link,
-		enum dp_test_pattern test_pattern,
-		enum dp_test_pattern_color_space test_pattern_color_space,
-		const struct link_training_settings *p_link_settings,
-		const unsigned char *p_custom_pattern,
-		unsigned int cust_pattern_size)
-{
-	if (link != NULL)
-		dc_link_dp_set_test_pattern(
-			link,
-			test_pattern,
-			test_pattern_color_space,
-			p_link_settings,
-			p_custom_pattern,
-			cust_pattern_size);
-}
drivers/gpu/drm/amd/display/dc/link/link_detection.c +99 -0

102 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia.c +0 -1
index 32f48a48e9dd..cbfa9343ffaf 100644
@@ -26,7 +26,6 @@
 
 #include "dc.h"
 #include "inc/core_status.h"
-#include "dc_link.h"
 #include "dpcd_defs.h"
 
 #include "link_dp_dpia.h"
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c +0 -1
index 72ff0ae44d01..7b32fd010f11 100644
@@ -27,7 +27,6 @@
 //				USB4 DPIA BANDWIDTH ALLOCATION LOGIC
 /*********************************************************************/
 #include "dc.h"
-#include "dc_link.h"
 #include "link_dp_dpia_bw.h"
 #include "drm_dp_helper_dc.h"
 #include "link_dpcd.h"
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training_dpia.c +0 -1
index 9715fa754d56..7711fda42261 100644
@@ -29,7 +29,6 @@
 #include "link_dp_training_dpia.h"
 #include "dc.h"
 #include "inc/core_status.h"
-#include "dc_link.h"
 #include "dpcd_defs.h"
 
 #include "link_dp_dpia.h"
drivers/gpu/drm/amd/display/include/link_service_types.h +0 -26
index 18b9173d5a96..cd870af5fd25 100644
@@ -34,10 +34,6 @@
 struct ddc;
 struct irq_manager;
 
-enum {
-	MAX_CONTROLLER_NUM = 6
-};
-
 enum dp_power_state {
 	DP_POWER_STATE_D0 = 1,
 	DP_POWER_STATE_D3
@@ -60,28 +56,6 @@ enum {
 	DATA_EFFICIENCY_128b_132b_x10000 = 9646, /* 96.71% data efficiency x 99.75% downspread factor */
 };
 
-enum link_training_result {
-	LINK_TRAINING_SUCCESS,
-	LINK_TRAINING_CR_FAIL_LANE0,
-	LINK_TRAINING_CR_FAIL_LANE1,
-	LINK_TRAINING_CR_FAIL_LANE23,
-	/* CR DONE bit is cleared during EQ step */
-	LINK_TRAINING_EQ_FAIL_CR,
-	/* CR DONE bit is cleared but LANE0_CR_DONE is set during EQ step */
-	LINK_TRAINING_EQ_FAIL_CR_PARTIAL,
-	/* other failure during EQ step */
-	LINK_TRAINING_EQ_FAIL_EQ,
-	LINK_TRAINING_LQA_FAIL,
-	/* one of the CR,EQ or symbol lock is dropped */
-	LINK_TRAINING_LINK_LOSS,
-	/* Abort link training (because sink unplugged) */
-	LINK_TRAINING_ABORT,
-	DP_128b_132b_LT_FAILED,
-	DP_128b_132b_MAX_LOOP_COUNT_REACHED,
-	DP_128b_132b_CHANNEL_EQ_DONE_TIMEOUT,
-	DP_128b_132b_CDS_DONE_TIMEOUT,
-};
-
 enum lttpr_mode {
 	LTTPR_MODE_UNKNOWN,
 	LTTPR_MODE_NON_LTTPR,
Signature · 1 line
2.34.1
#16 lore raw

PATCH 16/20 drm/amd/display: Correct DML calculation as HW SpreadSheet

In reply to Qingqing Zhuo

From: Paul Hsieh <[email protected]>

[Why]
In 2560x1440@240p eDP panel, some use cases will enable MPC combine with RGB MPO then underflow happened. This case is not allow from HW SpreadSheet.

[How]
Correct eDP, DP and DP2 output bpp calculation as HW SpreadSheet

---
 .../dc/dml/dcn31/display_mode_vba_31.c        | 298 ++++++++++++------
 .../dc/dml/dcn314/display_mode_vba_314.c      | 298 ++++++++++++------
 2 files changed, 392 insertions(+), 204 deletions(-)
drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c +196 -102
index 2b57f5b2362a..536a63624595 100644
@@ -4307,11 +4307,11 @@ void dml31_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
 							v->AudioSampleRate[k],
 							v->AudioSampleLayout[k],
 							v->ODMCombineEnablePerState[i][k]);
-				} else if (v->Output[k] == dm_dp || v->Output[k] == dm_edp) {
+				} else if (v->Output[k] == dm_dp || v->Output[k] == dm_edp || v->Output[k] == dm_dp2p0) {
 					if (v->DSCEnable[k] == true) {
 						v->RequiresDSC[i][k] = true;
 						v->LinkDSCEnable = true;
-						if (v->Output[k] == dm_dp) {
+						if (v->Output[k] == dm_dp || v->Output[k] == dm_dp2p0) {
 							v->RequiresFEC[i][k] = true;
 						} else {
 							v->RequiresFEC[i][k] = false;
@@ -4319,107 +4319,201 @@ void dml31_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
 					} else {
 						v->RequiresDSC[i][k] = false;
 						v->LinkDSCEnable = false;
-						v->RequiresFEC[i][k] = false;
-					}
-
-					v->Outbpp = BPP_INVALID;
-					if (v->PHYCLKPerState[i] >= 270.0) {
-						v->Outbpp = TruncToValidBPP(
-								(1.0 - v->Downspreading / 100.0) * 2700,
-								v->OutputLinkDPLanes[k],
-								v->HTotal[k],
-								v->HActive[k],
-								v->PixelClockBackEnd[k],
-								v->ForcedOutputLinkBPP[k],
-								v->LinkDSCEnable,
-								v->Output[k],
-								v->OutputFormat[k],
-								v->DSCInputBitPerComponent[k],
-								v->NumberOfDSCSlices[k],
-								v->AudioSampleRate[k],
-								v->AudioSampleLayout[k],
-								v->ODMCombineEnablePerState[i][k]);
-						v->OutputBppPerState[i][k] = v->Outbpp;
-						// TODO: Need some other way to handle this nonsense
-						// v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " HBR"
-					}
-					if (v->Outbpp == BPP_INVALID && v->PHYCLKPerState[i] >= 540.0) {
-						v->Outbpp = TruncToValidBPP(
-								(1.0 - v->Downspreading / 100.0) * 5400,
-								v->OutputLinkDPLanes[k],
-								v->HTotal[k],
-								v->HActive[k],
-								v->PixelClockBackEnd[k],
-								v->ForcedOutputLinkBPP[k],
-								v->LinkDSCEnable,
-								v->Output[k],
-								v->OutputFormat[k],
-								v->DSCInputBitPerComponent[k],
-								v->NumberOfDSCSlices[k],
-								v->AudioSampleRate[k],
-								v->AudioSampleLayout[k],
-								v->ODMCombineEnablePerState[i][k]);
-						v->OutputBppPerState[i][k] = v->Outbpp;
-						// TODO: Need some other way to handle this nonsense
-						// v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " HBR2"
-					}
-					if (v->Outbpp == BPP_INVALID && v->PHYCLKPerState[i] >= 810.0) {
-						v->Outbpp = TruncToValidBPP(
-								(1.0 - v->Downspreading / 100.0) * 8100,
-								v->OutputLinkDPLanes[k],
-								v->HTotal[k],
-								v->HActive[k],
-								v->PixelClockBackEnd[k],
-								v->ForcedOutputLinkBPP[k],
-								v->LinkDSCEnable,
-								v->Output[k],
-								v->OutputFormat[k],
-								v->DSCInputBitPerComponent[k],
-								v->NumberOfDSCSlices[k],
-								v->AudioSampleRate[k],
-								v->AudioSampleLayout[k],
-								v->ODMCombineEnablePerState[i][k]);
-						v->OutputBppPerState[i][k] = v->Outbpp;
-						// TODO: Need some other way to handle this nonsense
-						// v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " HBR3"
-					}
-					if (v->Outbpp == BPP_INVALID && v->PHYCLKD18PerState[i] >= 10000.0 / 18) {
-						v->Outbpp = TruncToValidBPP(
-								(1.0 - v->Downspreading / 100.0) * 10000,
-								4,
-								v->HTotal[k],
-								v->HActive[k],
-								v->PixelClockBackEnd[k],
-								v->ForcedOutputLinkBPP[k],
-								v->LinkDSCEnable,
-								v->Output[k],
-								v->OutputFormat[k],
-								v->DSCInputBitPerComponent[k],
-								v->NumberOfDSCSlices[k],
-								v->AudioSampleRate[k],
-								v->AudioSampleLayout[k],
-								v->ODMCombineEnablePerState[i][k]);
-						v->OutputBppPerState[i][k] = v->Outbpp;
-						//v->OutputTypeAndRatePerState[i][k] = v->Output[k] & "10x4";
+						if (v->Output[k] == dm_dp2p0) {
+							v->RequiresFEC[i][k] = true;
+						} else {
+							v->RequiresFEC[i][k] = false;
+						}
 					}
-					if (v->Outbpp == BPP_INVALID && v->PHYCLKD18PerState[i] >= 12000.0 / 18) {
-						v->Outbpp = TruncToValidBPP(
-								12000,
-								4,
-								v->HTotal[k],
-								v->HActive[k],
-								v->PixelClockBackEnd[k],
-								v->ForcedOutputLinkBPP[k],
-								v->LinkDSCEnable,
-								v->Output[k],
-								v->OutputFormat[k],
-								v->DSCInputBitPerComponent[k],
-								v->NumberOfDSCSlices[k],
-								v->AudioSampleRate[k],
-								v->AudioSampleLayout[k],
-								v->ODMCombineEnablePerState[i][k]);
-						v->OutputBppPerState[i][k] = v->Outbpp;
-						//v->OutputTypeAndRatePerState[i][k] = v->Output[k] & "12x4";
+					if (v->Output[k] == dm_dp2p0) {
+						v->Outbpp = BPP_INVALID;
+						if ((v->OutputLinkDPRate[k] == dm_dp_rate_na || v->OutputLinkDPRate[k] == dm_dp_rate_uhbr10) &&
+							v->PHYCLKD18PerState[k] >= 10000.0 / 18.0) {
+							v->Outbpp = TruncToValidBPP(
+									(1.0 - v->Downspreading / 100.0) * 10000,
+									v->OutputLinkDPLanes[k],
+									v->HTotal[k],
+									v->HActive[k],
+									v->PixelClockBackEnd[k],
+									v->ForcedOutputLinkBPP[k],
+									v->LinkDSCEnable,
+									v->Output[k],
+									v->OutputFormat[k],
+									v->DSCInputBitPerComponent[k],
+									v->NumberOfDSCSlices[k],
+									v->AudioSampleRate[k],
+									v->AudioSampleLayout[k],
+									v->ODMCombineEnablePerState[i][k]);
+							if (v->Outbpp == BPP_INVALID && v->PHYCLKD18PerState[k] < 13500.0 / 18.0 &&
+								v->DSCEnable[k] == true && v->ForcedOutputLinkBPP[k] == 0) {
+								v->RequiresDSC[i][k] = true;
+								v->LinkDSCEnable = true;
+								v->Outbpp = TruncToValidBPP(
+										(1.0 - v->Downspreading / 100.0) * 10000,
+										v->OutputLinkDPLanes[k],
+										v->HTotal[k],
+										v->HActive[k],
+										v->PixelClockBackEnd[k],
+										v->ForcedOutputLinkBPP[k],
+										v->LinkDSCEnable,
+										v->Output[k],
+										v->OutputFormat[k],
+										v->DSCInputBitPerComponent[k],
+										v->NumberOfDSCSlices[k],
+										v->AudioSampleRate[k],
+										v->AudioSampleLayout[k],
+										v->ODMCombineEnablePerState[i][k]);
+							}
+							v->OutputBppPerState[i][k] = v->Outbpp;
+							// TODO: Need some other way to handle this nonsense
+							// v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " UHBR10"
+						}
+						if (v->Outbpp == BPP_INVALID &&
+							(v->OutputLinkDPRate[k] == dm_dp_rate_na || v->OutputLinkDPRate[k] == dm_dp_rate_uhbr13p5) &&
+							v->PHYCLKD18PerState[k] >= 13500.0 / 18.0) {
+							v->Outbpp = TruncToValidBPP(
+									(1.0 - v->Downspreading / 100.0) * 13500,
+									v->OutputLinkDPLanes[k],
+									v->HTotal[k],
+									v->HActive[k],
+									v->PixelClockBackEnd[k],
+									v->ForcedOutputLinkBPP[k],
+									v->LinkDSCEnable,
+									v->Output[k],
+									v->OutputFormat[k],
+									v->DSCInputBitPerComponent[k],
+									v->NumberOfDSCSlices[k],
+									v->AudioSampleRate[k],
+									v->AudioSampleLayout[k],
+									v->ODMCombineEnablePerState[i][k]);
+							if (v->Outbpp == BPP_INVALID && v->PHYCLKD18PerState[k] < 20000.0 / 18.0 &&
+								v->DSCEnable[k] == true && v->ForcedOutputLinkBPP[k] == 0) {
+								v->RequiresDSC[i][k] = true;
+								v->LinkDSCEnable = true;
+								v->Outbpp = TruncToValidBPP(
+										(1.0 - v->Downspreading / 100.0) * 13500,
+										v->OutputLinkDPLanes[k],
+										v->HTotal[k],
+										v->HActive[k],
+										v->PixelClockBackEnd[k],
+										v->ForcedOutputLinkBPP[k],
+										v->LinkDSCEnable,
+										v->Output[k],
+										v->OutputFormat[k],
+										v->DSCInputBitPerComponent[k],
+										v->NumberOfDSCSlices[k],
+										v->AudioSampleRate[k],
+										v->AudioSampleLayout[k],
+										v->ODMCombineEnablePerState[i][k]);
+							}
+							v->OutputBppPerState[i][k] = v->Outbpp;
+							// TODO: Need some other way to handle this nonsense
+							// v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " UHBR13p5"
+						}
+						if (v->Outbpp == BPP_INVALID &&
+							(v->OutputLinkDPRate[k] == dm_dp_rate_na || v->OutputLinkDPRate[k] == dm_dp_rate_uhbr20) &&
+							v->PHYCLKD18PerState[k] >= 20000.0 / 18.0) {
+							v->Outbpp = TruncToValidBPP(
+									(1.0 - v->Downspreading / 100.0) * 20000,
+									v->OutputLinkDPLanes[k],
+									v->HTotal[k],
+									v->HActive[k],
+									v->PixelClockBackEnd[k],
+									v->ForcedOutputLinkBPP[k],
+									v->LinkDSCEnable,
+									v->Output[k],
+									v->OutputFormat[k],
+									v->DSCInputBitPerComponent[k],
+									v->NumberOfDSCSlices[k],
+									v->AudioSampleRate[k],
+									v->AudioSampleLayout[k],
+									v->ODMCombineEnablePerState[i][k]);
+							if (v->Outbpp == BPP_INVALID && v->DSCEnable[k] == true &&
+								v->ForcedOutputLinkBPP[k] == 0) {
+								v->RequiresDSC[i][k] = true;
+								v->LinkDSCEnable = true;
+								v->Outbpp = TruncToValidBPP(
+										(1.0 - v->Downspreading / 100.0) * 20000,
+										v->OutputLinkDPLanes[k],
+										v->HTotal[k],
+										v->HActive[k],
+										v->PixelClockBackEnd[k],
+										v->ForcedOutputLinkBPP[k],
+										v->LinkDSCEnable,
+										v->Output[k],
+										v->OutputFormat[k],
+										v->DSCInputBitPerComponent[k],
+										v->NumberOfDSCSlices[k],
+										v->AudioSampleRate[k],
+										v->AudioSampleLayout[k],
+										v->ODMCombineEnablePerState[i][k]);
+							}
+							v->OutputBppPerState[i][k] = v->Outbpp;
+							// TODO: Need some other way to handle this nonsense
+							// v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " UHBR20"
+						}
+					} else {
+						v->Outbpp = BPP_INVALID;
+						if (v->PHYCLKPerState[i] >= 270.0) {
+							v->Outbpp = TruncToValidBPP(
+									(1.0 - v->Downspreading / 100.0) * 2700,
+									v->OutputLinkDPLanes[k],
+									v->HTotal[k],
+									v->HActive[k],
+									v->PixelClockBackEnd[k],
+									v->ForcedOutputLinkBPP[k],
+									v->LinkDSCEnable,
+									v->Output[k],
+									v->OutputFormat[k],
+									v->DSCInputBitPerComponent[k],
+									v->NumberOfDSCSlices[k],
+									v->AudioSampleRate[k],
+									v->AudioSampleLayout[k],
+									v->ODMCombineEnablePerState[i][k]);
+							v->OutputBppPerState[i][k] = v->Outbpp;
+							// TODO: Need some other way to handle this nonsense
+							// v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " HBR"
+						}
+						if (v->Outbpp == BPP_INVALID && v->PHYCLKPerState[i] >= 540.0) {
+							v->Outbpp = TruncToValidBPP(
+									(1.0 - v->Downspreading / 100.0) * 5400,
+									v->OutputLinkDPLanes[k],
+									v->HTotal[k],
+									v->HActive[k],
+									v->PixelClockBackEnd[k],
+									v->ForcedOutputLinkBPP[k],
+									v->LinkDSCEnable,
+									v->Output[k],
+									v->OutputFormat[k],
+									v->DSCInputBitPerComponent[k],
+									v->NumberOfDSCSlices[k],
+									v->AudioSampleRate[k],
+									v->AudioSampleLayout[k],
+									v->ODMCombineEnablePerState[i][k]);
+							v->OutputBppPerState[i][k] = v->Outbpp;
+							// TODO: Need some other way to handle this nonsense
+							// v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " HBR2"
+						}
+						if (v->Outbpp == BPP_INVALID && v->PHYCLKPerState[i] >= 810.0) {
+							v->Outbpp = TruncToValidBPP(
+									(1.0 - v->Downspreading / 100.0) * 8100,
+									v->OutputLinkDPLanes[k],
+									v->HTotal[k],
+									v->HActive[k],
+									v->PixelClockBackEnd[k],
+									v->ForcedOutputLinkBPP[k],
+									v->LinkDSCEnable,
+									v->Output[k],
+									v->OutputFormat[k],
+									v->DSCInputBitPerComponent[k],
+									v->NumberOfDSCSlices[k],
+									v->AudioSampleRate[k],
+									v->AudioSampleLayout[k],
+									v->ODMCombineEnablePerState[i][k]);
+							v->OutputBppPerState[i][k] = v->Outbpp;
+							// TODO: Need some other way to handle this nonsense
+							// v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " HBR3"
+						}
 					}
 				}
 			} else {
drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c +196 -102

314 lines not on this page · raw message

Signature · 1 line
2.34.1
#17 lore raw

PATCH 17/20 drm/amd/display: remove empty dc_link.c

In reply to Qingqing Zhuo

From: Wenjing Liu <[email protected]>

[why]
We kept an empty dc_link.c file due to external build dependency. Now the last build dependency has been removed. We can safely delete this file.

---
 drivers/gpu/drm/amd/display/dc/core/dc_link.c | 27 -------------------
 1 file changed, 27 deletions(-)
 delete mode 100644 drivers/gpu/drm/amd/display/dc/core/dc_link.c
drivers/gpu/drm/amd/display/dc/core/dc_link.c deleted +0 -27
deleted file mode 100644
index c26e7258a91c..000000000000
@@ -1,27 +0,0 @@
-/*
- * Copyright 2012-15 Advanced Micro Devices, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors: AMD
- *
- */
-
-// TODO - remove this file after external build dependencies is resolved.
-/* NOTE: This file is pending to be removed, do not add new code to this file */
\ No newline at end of file
Signature · 1 line
2.34.1
#18 lore raw

PATCH 18/20 drm/amd/display: enable DPG when disabling plane for phantom pipe

In reply to Qingqing Zhuo

From: Samson Tam <[email protected]>

[Why]
In disable_dangling_plane, for phantom pipes, we enable OTG so disable programming gets the double buffer update. But this causes an underflow to occur.

[How]
Enable DPG prior to enabling OTG.

---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 47 +++++++++++++++++++++++-
 1 file changed, 46 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +46 -1
index ca048e38c4d4..8d7b2e5516b0 100644
@@ -73,6 +73,8 @@
 
 #include "dc_trace.h"
 
+#include "hw_sequencer_private.h"
+
 #include "dce/dmub_outbox.h"
 
 #define CTX \
@@ -1063,6 +1065,44 @@ static void apply_ctx_interdependent_lock(struct dc *dc, struct dc_state *contex
 	}
 }
 
+static void phantom_pipe_blank(
+		struct dc *dc,
+		struct timing_generator *tg,
+		int width,
+		int height)
+{
+	struct dce_hwseq *hws = dc->hwseq;
+	enum dc_color_space color_space;
+	struct tg_color black_color = {0};
+	struct output_pixel_processor *opp = NULL;
+	uint32_t num_opps, opp_id_src0, opp_id_src1;
+	uint32_t otg_active_width, otg_active_height;
+
+	/* program opp dpg blank color */
+	color_space = COLOR_SPACE_SRGB;
+	color_space_to_black_color(dc, color_space, &black_color);
+
+	otg_active_width = width;
+	otg_active_height = height;
+
+	/* get the OPTC source */
+	tg->funcs->get_optc_source(tg, &num_opps, &opp_id_src0, &opp_id_src1);
+	ASSERT(opp_id_src0 < dc->res_pool->res_cap->num_opp);
+	opp = dc->res_pool->opps[opp_id_src0];
+
+	opp->funcs->opp_set_disp_pattern_generator(
+			opp,
+			CONTROLLER_DP_TEST_PATTERN_SOLID_COLOR,
+			CONTROLLER_DP_COLOR_SPACE_UDEFINED,
+			COLOR_DEPTH_UNDEFINED,
+			&black_color,
+			otg_active_width,
+			otg_active_height,
+			0);
+
+	hws->funcs.wait_for_blank_complete(opp);
+}
+
 static void disable_dangling_plane(struct dc *dc, struct dc_state *context)
 {
 	int i, j;
@@ -1121,8 +1161,13 @@ static void disable_dangling_plane(struct dc *dc, struct dc_state *context)
 			 * again for different use.
 			 */
 			if (old_stream->mall_stream_config.type == SUBVP_PHANTOM) {
-				if (tg->funcs->enable_crtc)
+				if (tg->funcs->enable_crtc) {
+					int main_pipe_width, main_pipe_height;
+					main_pipe_width = old_stream->mall_stream_config.paired_stream->dst.width;
+					main_pipe_height = old_stream->mall_stream_config.paired_stream->dst.height;
+					phantom_pipe_blank(dc, tg, main_pipe_width, main_pipe_height);
 					tg->funcs->enable_crtc(tg);
+				}
 			}
 			dc_rem_all_planes_for_stream(dc, old_stream, dangling_context);
 			disable_all_writeback_pipes_for_stream(dc, old_stream, dangling_context);
Signature · 1 line
2.34.1
#19 lore raw

PATCH 19/20 drm/amd/display: Only wait for blank completion if OTG active

In reply to Qingqing Zhuo

From: Aric Cyr <[email protected]>

[why]
If OTG is not active, waiting for blank completion will always fail and timeout resulting in unnecessary driver delays.

[how]
Check that OTG is enabled before waiting for blank.

---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +3 -1
index 8d7b2e5516b0..65b3c3052628 100644
@@ -1100,7 +1100,8 @@ static void phantom_pipe_blank(
 			otg_active_height,
 			0);
 
-	hws->funcs.wait_for_blank_complete(opp);
+	if (tg->funcs->is_tg_enabled(tg))
+		hws->funcs.wait_for_blank_complete(opp);
 }
 
 static void disable_dangling_plane(struct dc *dc, struct dc_state *context)
@@ -1163,6 +1164,7 @@ static void disable_dangling_plane(struct dc *dc, struct dc_state *context)
 			if (old_stream->mall_stream_config.type == SUBVP_PHANTOM) {
 				if (tg->funcs->enable_crtc) {
 					int main_pipe_width, main_pipe_height;
+
 					main_pipe_width = old_stream->mall_stream_config.paired_stream->dst.width;
 					main_pipe_height = old_stream->mall_stream_config.paired_stream->dst.height;
 					phantom_pipe_blank(dc, tg, main_pipe_width, main_pipe_height);
Signature · 1 line
2.34.1
#20 lore raw

PATCH 20/20 drm/amd/display: Promote DAL to 3.2.224

In reply to Qingqing Zhuo

From: Aric Cyr <[email protected]>

This version brings along the following:
- Correct DML calculation
- Extend Freesync over Pcon support
- Fixes in pstate hang and more
- Code cleanup for dc_link.h and dc_link.c

---
 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 c84554933dc2..36dbe11256ac 100644
@@ -47,7 +47,7 @@ struct aux_payload;
 struct set_config_cmd_payload;
 struct dmub_notification;
 
-#define DC_VER "3.2.223"
+#define DC_VER "3.2.224"
 
 #define MAX_SURFACES 3
 #define MAX_PLANES 6
Signature · 1 line
2.34.1
Tested-by on the v1 series
#21 lore raw
In reply to Qingqing Zhuo

[Public]

Hi all,

This week this patchset was tested on the following systems:

Lenovo Thinkpad T14s Gen2, with AMD Ryzen 5 5650U
Lenovo Thinkpad T13s Gen4 with AMD Ryzen 5 6600U
Reference AMD RX6800

These systems were tested on the following display types:
eDP, (1080p 60hz [5650U]) (1920x1200 60hz [6600U]) (2560x1600 120hz[6600U]) VGA and DVI (1680x1050 60HZ [DP to VGA/DVI, USB-C to DVI/VGA]) DP/HDMI/USB-C (1440p 170hz, 4k 60hz, 4k 144hz [Includes USB-C to DP/HDMI adapters])

MST tested with Startech MST14DP123DP and 2x 4k 60Hz displays
DSC tested with Cable Matters 101075 (DP to 3x DP), and 201375 (USB-C to 3x DP) with 3x 4k60 displays HP Hook G2 with 1 and 2 4k60 Displays

The testing is a mix of automated and manual tests. Manual testing includes (but is not limited to):
Changing display configurations and settings
Benchmark testing
Feature testing (Freesync, etc.)

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

The patchset consists of the amd-staging-drm-next branch (Head commit aaac77ad65330444aa506614529bb7883e024d9e -> Revert "drm: hide unregistered connectors from GETCONNECTOR IOCTL") with new patches added on top of it. This branch is used for both Ubuntu and Chrome OS testing (ChromeOS on a bi-weekly basis).

Tested on Ubuntu 22.04.1 and Chrome OS

Thank you,

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

-----Original Message-----
From: Zhuo, Qingqing (Lillian) <[email protected]>
Sent: February 22, 2023 1:40 AM
To: [email protected]
Cc: Wentland, Harry <[email protected]>; Li, Sun peng (Leo) <[email protected]>; Lakha, Bhawanpreet <[email protected]>; Siqueira, Rodrigo <[email protected]>; Pillai, Aurabindo <[email protected]>; Zhuo, Qingqing (Lillian) <[email protected]>; Li, Roman <[email protected]>; Lin, Wayne <[email protected]>; Wang, Chao-kai (Stylon) <[email protected]>; Chiu, Solomon <[email protected]>; Kotarac, Pavle <[email protected]>; Gutierrez, Agustin <[email protected]>; Wheeler, Daniel <[email protected]>
Subject: [PATCH 00/20] DC Patches Feb 27th, 2023

This DC patchset brings improvements in multiple areas. In summary, we highlight:
- Correct DML calculation
- Extend Freesync over Pcon support
- Fixes in pstate hang and more
- Code cleanup for dc_link.h and dc_link.c

Cc Daniel Wheeler <[email protected]>

Alex Hung (1):
drm/amd/display: fix shift-out-of-bounds in CalculateVMAndRowBytes

Alvin Lee (1):
drm/amd/display: DAL to program DISPCLK WDIVIDER if PMFW doesn't

Aric Cyr (6):
drm/amd/display: Reduce CPU busy-waiting for long delays Revert "drm/amd/display: Do not set DRR on pipe commit" Revert "drm/amd/display: Fix FreeSync active bit issue" drm/amd/display: Do not update DRR while BW optimizations pending drm/amd/display: Only wait for blank completion if OTG active drm/amd/display: Promote DAL to 3.2.224

Ayush Gupta (1):
drm/amd/display: populate subvp cmd info only for the top pipe

Hersen Wu (1):
drm/amd/display: dcn32/321 dsc_pg_control not executed properly

Jasdeep Dhillon (1):
drm/amd/display: Updating Video Format Fall Back Policy.

Mustapha Ghaddar (2):
drm/amd/display: Allocation at stream Enable drm/amd/display: Update BW ALLOCATION Function declaration

Paul Hsieh (1):
drm/amd/display: Correct DML calculation as HW SpreadSheet

Ryan Lin (1):
drm/amd/display: Ext displays with dock can't recognized after resume

Samson Tam (1):
drm/amd/display: enable DPG when disabling plane for phantom pipe

Sung Joon Kim (1):
drm/amd/display: Extend Freesync over PCon support for more devices

Wenjing Liu (2):
drm/amd/display: merge dc_link.h into dc.h and dc_types.h drm/amd/display: remove empty dc_link.c

Yihan Zhu (1):
drm/amd/display: update pixel format in DP hw sequence

 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  17 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c |   2 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_hdcp.c    |   1 +
 .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c |   2 +
 .../gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c  |   4 +-
 .../display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c  |  41 +-
 drivers/gpu/drm/amd/display/dc/core/dc.c      | 253 +++-----
 drivers/gpu/drm/amd/display/dc/core/dc_link.c |  27 -  .../drm/amd/display/dc/core/dc_link_exports.c |  87 +++
 drivers/gpu/drm/amd/display/dc/dc.h           | 556 +++++++++++++++++-
 drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c  |   3 +-
 drivers/gpu/drm/amd/display/dc/dc_dp_types.h  | 107 ++++  drivers/gpu/drm/amd/display/dc/dc_hw_types.h  |  14 +
 drivers/gpu/drm/amd/display/dc/dc_link.h      |   8 +-
 drivers/gpu/drm/amd/display/dc/dc_types.h     | 104 ++++
 drivers/gpu/drm/amd/display/dc/dce/dce_aux.c  |   9 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.c |   2 +-
 drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c |   2 +-
 drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c |   2 +-
 drivers/gpu/drm/amd/display/dc/dce/dmub_psr.h |   5 +-
 .../display/dc/dce110/dce110_hw_sequencer.c   |   2 +-
 .../amd/display/dc/dcn10/dcn10_hw_sequencer.c |   2 +-
 .../drm/amd/display/dc/dcn20/dcn20_hwseq.c    |   9 +
 .../dc/dcn30/dcn30_dio_stream_encoder.c       |   1 +
 .../drm/amd/display/dc/dcn30/dcn30_hwseq.c    |  10 +-
 .../dc/dcn31/dcn31_hpo_dp_link_encoder.c      |   1 -
 .../dc/dcn31/dcn31_hpo_dp_stream_encoder.c    |   2 +-
 .../dc/dcn314/dcn314_dio_stream_encoder.c     |   6 +
 .../dc/dcn32/dcn32_hpo_dp_link_encoder.c      |   1 -
 .../drm/amd/display/dc/dcn32/dcn32_hwseq.c    |  21 +-
 .../drm/amd/display/dc/dcn32/dcn32_resource.c |   1 +
 .../amd/display/dc/dcn321/dcn321_resource.c   |   1 +
 .../dc/dml/dcn30/display_mode_vba_30.c        |   6 +-
 .../dc/dml/dcn31/display_mode_vba_31.c        | 299 ++++++----
 .../dc/dml/dcn314/display_mode_vba_314.c      | 299 ++++++----
 .../dc/dml/dcn32/display_mode_vba_32.c        |   1 -
 .../gpu/drm/amd/display/dc/inc/hw/hw_shared.h |  14 -  .../drm/amd/display/dc/inc/hw/link_encoder.h  |  52 --
 .../amd/display/dc/inc/hw/stream_encoder.h    |   1 -
 drivers/gpu/drm/amd/display/dc/inc/link.h     |   1 -
 .../display/dc/link/accessories/link_dp_cts.c |  17 -  .../drm/amd/display/dc/link/link_detection.c  |  99 ++++
 .../gpu/drm/amd/display/dc/link/link_dpms.c   |  15 +-
 .../amd/display/dc/link/protocols/link_ddc.h  |   1 +
 .../dc/link/protocols/link_dp_capability.c    |  10 +-
 .../display/dc/link/protocols/link_dp_dpia.c  |   1 -
 .../dc/link/protocols/link_dp_dpia_bw.c       |  38 +-
 .../dc/link/protocols/link_dp_dpia_bw.h       |  14 +-
 .../dc/link/protocols/link_dp_training.c      |   7 +-
 .../dc/link/protocols/link_dp_training_dpia.c |   3 +-
 .../link/protocols/link_edp_panel_control.c   |   4 +-
 .../amd/display/include/link_service_types.h  |  26 -
 .../amd/display/modules/freesync/freesync.c   |  12 +-
 .../drm/amd/display/modules/inc/mod_hdcp.h    |   1 +
 54 files changed, 1618 insertions(+), 606 deletions(-)  delete mode 100644 drivers/gpu/drm/amd/display/dc/core/dc_link.c

--
2.34.1