drm/amd/display: extend HPD debounce to DVI/DP SST with per-EDID policy
Subsystems (3)
RFC PATCH 1/1 drm/amd/display: extend HPD debounce to DVI/DP SST with per-EDID policy
From: Ivan Lipski <[email protected]>
[Why]
Some sinks perform rapid "autoscan" HPD re-assertions right after a disconnect or when entering a power saving mode. These appear as a quick disconnect->reconnect with an identical EDID. Since there is no HPD filter, these quick reconnects are seen as hotplug events, which can unintentionally wake a system with DPMS off.
An example: https://gitlab.freedesktop.org/drm/amd/-/issues/2876
The existing debounce only covered HDMI and used a single connector-wide delay driven by the module parameter. However, a monitor that needs a debounce delay on HDMI may not need one on DisplayPort (and vice versa), so the delay should be differentiated per connector type. Well-behaved monitors should also carry no debounce cost or regression risk by default.
[How]
- Extend HPD debounce eligibility to HDMI, DVI, and DisplayPort SST, and rename the shared connector fields, work, and cached sink from hdmi_* to generic hpd_*. eDP and MST remain intentionally excluded.
- Move the per-monitor delay into struct dc_panel_patch as two fields, hdmi_hpd_debounce_delay_ms and dp_hpd_debounce_delay_ms, so a delay can be set for a specific monitor and specific connector type via apply_edid_quirks().
- Add a quirk for the MSI MPG 274U (drm_edid_encode_panel_id('M', 'S', 'I', 0x3CF0)) that enables a 1500ms DP debounce (experimentally chosen a while ago), leaving HDMI untouched.
- Rework the amdgpu_hpd_debounce_delay_ms module parameter into a tristate policy:
- -1 = auto (default): debounce only known-problematic panels via EDID quirks, using the per-panel, per-connector-type delay
- 0 = force off on all connectors (ignores EDID quirks)
- >0 = force on for all eligible connectors, using this delay in ms
Auto keeps debounce targeted to quirked panels; explicit enable/disable to be used for triaging.
- Factor the eligibility and policy decision into a hpd_debounce_delay_ms() helper that returns the resolved delay (or 0 to skip), keeping handle_hpd_irq_helper() readable.
---
Initially Nick proposed expanding HPD Debounce to non-HDMI connectors, so adding Nick's SOB.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 22 ++-- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 12 +- .../display/amdgpu_dm/amdgpu_dm_connector.c | 31 +++--- .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 6 + .../drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c | 104 ++++++++++++------ .../drm/amd/display/amdgpu_dm/amdgpu_dm_irq.h | 2 +- drivers/gpu/drm/amd/display/dc/dc_types.h | 2 + 8 files changed, 116 insertions(+), 65 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -1
@@ -266,7 +266,7 @@ extern int amdgpu_wbrf;extern int amdgpu_user_queue;extern int amdgpu_ptl; -extern uint amdgpu_hdmi_hpd_debounce_delay_ms; +extern int amdgpu_hpd_debounce_delay_ms;#define AMDGPU_SG_THRESHOLD (256*1024*1024)#define AMDGPU_WAIT_IDLE_TIMEOUT_IN_MS 3000
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +15 -7
@@ -245,7 +245,7 @@ int amdgpu_damage_clips = -1; /* auto */int amdgpu_umsch_mm_fwlog;int amdgpu_rebar =-1 ;/* auto */ int amdgpu_user_queue =-1 ; -uint amdgpu_hdmi_hpd_debounce_delay_ms; +int amdgpu_hpd_debounce_delay_ms =-1 ;/* auto */ int amdgpu_ptl =-1 ;/* auto */ DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS, 0,
@@ -1104,14 +1104,22 @@ MODULE_PARM_DESC(user_queue, "Enable user queues (-1 = auto (default), 0 = disabmodule_param_named (user_queue, amdgpu_user_queue, int,0444 );/* -* DOC: hdmi_hpd_debounce_delay_ms (uint) -* HDMI HPD disconnect debounce delay in milliseconds. +* DOC: hpd_debounce_delay_ms (int) +* HDMI/DVI/DP SST HPD disconnect debounce policy. eDP and MST are not affected. * -* Used to filter short disconnect->reconnect HPD toggles some HDMI sinks -* generate while entering/leaving power save. Set to 0 to disable by default. +* Some sinks briefly toggle HPD (a quick disconnect->reconnect with an +* identical EDID) when entering/leaving power save. Since there is no HPD +* filter, these are seen as hotplug events and can wake a DPMS-off system. +* Debounce coalesces them by delaying disconnect processing and comparing the +* EDID after the delay. +* +* - -1 = auto (default): debounce only known-problematic panels via EDID +* quirks, using a per-panel, per-connector-type delay +* - 0 = force off on all connectors (ignores EDID quirks) +* - >0 = force on for all eligible connectors, using this delay in milliseconds */ -MODULE_PARM_DESC (hdmi_hpd_debounce_delay_ms,"HDMI HPD disconnect debounce delay in milliseconds (0 to disable (by default), 1500 is common)" ); -module_param_named (hdmi_hpd_debounce_delay_ms, amdgpu_hdmi_hpd_debounce_delay_ms, uint,0644 ); +MODULE_PARM_DESC (hpd_debounce_delay_ms,"HDMI/DVI/DP SST HPD disconnect debounce delay in milliseconds (-1 = auto/per-EDID-quirk (default), 0 = force off, >0 = force on with this delay, 1500 is common)" ); +module_param_named (hpd_debounce_delay_ms, amdgpu_hpd_debounce_delay_ms, int,0644 );/** * DOC: ptl (int)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +6 -6
@@ -61,9 +61,9 @@ enum amd_vsdb_panel_type {#define AMDGPU_HDR_MULT_DEFAULT (0x100000000LL)/* -* Maximum HDMI HPD debounce delay in milliseconds +* Maximum HDMI/DVI/DP SST HPD debounce delay in milliseconds */ -#define AMDGPU_DM_MAX_HDMI_HPD_DEBOUNCE_MS 5000 +#define AMDGPU_DM_MAX_HPD_DEBOUNCE_MS 5000/* #include "include/amdgpu_dal_power_if.h" #include "amdgpu_dm_irq.h"
@@ -884,10 +884,10 @@ struct amdgpu_dm_connector {enum adaptive_sync_type as_type;struct amdgpu_hdmi_vsdb_info vsdb_info; -/* HDMI HPD debounce support */ -unsigned int hdmi_hpd_debounce_delay_ms; -struct delayed_work hdmi_hpd_debounce_work; -struct dc_sink *hdmi_prev_sink; +/* HDMI/DVI/DP SST HPD debounce support */ +int hpd_debounce_override; +struct delayed_work hpd_debounce_work; +struct dc_sink *hpd_prev_sink;/* HDMI compliance automation */ bool hdmi_comp_auto;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c +14 -17
@@ -1806,13 +1806,11 @@ static void amdgpu_dm_connector_destroy(struct drm_connector *connector)if (aconnector->mst_mgr.dev)drm_dp_mst_topology_mgr_destroy (&aconnector->mst_mgr); -/* Cancel and flush any pending HDMI HPD debounce work */ -if (aconnector->hdmi_hpd_debounce_delay_ms) { -cancel_delayed_work_sync (&aconnector->hdmi_hpd_debounce_work); -if (aconnector->hdmi_prev_sink) { -dc_sink_release (aconnector->hdmi_prev_sink); - aconnector->hdmi_prev_sink =NULL ; - } +/* Cancel and flush any pending HPD debounce work */ +cancel_delayed_work_sync (&aconnector->hpd_debounce_work); +if (aconnector->hpd_prev_sink) { +dc_sink_release (aconnector->hpd_prev_sink); + aconnector->hpd_prev_sink =NULL ; }if (aconnector->bl_idx !=-1 ) {
@@ -2896,17 +2894,16 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm,mutex_init (&aconnector->handle_mst_msg_ready);/* -* If HDMI HPD debounce delay is set, use the minimum between selected -* value and AMDGPU_DM_MAX_HDMI_HPD_DEBOUNCE_MS +* Global HPD debounce policy from the module parameter: +* < 0 : auto -> per-panel decision via EDID quirks +* = 0 : force off on all connectors (ignores quirks) +* > 0 : force on for all eligible connectors (clamped to the maximum) */ -if (amdgpu_hdmi_hpd_debounce_delay_ms) { - aconnector->hdmi_hpd_debounce_delay_ms =min (amdgpu_hdmi_hpd_debounce_delay_ms, -AMDGPU_DM_MAX_HDMI_HPD_DEBOUNCE_MS ); -INIT_DELAYED_WORK (&aconnector->hdmi_hpd_debounce_work, amdgpu_dm_hdmi_hpd_debounce_work); - aconnector->hdmi_prev_sink =NULL ; - }else { - aconnector->hdmi_hpd_debounce_delay_ms =0 ; - } + aconnector->hpd_debounce_override = amdgpu_hpd_debounce_delay_ms >0 ? +min (amdgpu_hpd_debounce_delay_ms,AMDGPU_DM_MAX_HPD_DEBOUNCE_MS ) : + amdgpu_hpd_debounce_delay_ms; + aconnector->hpd_prev_sink =NULL ; +INIT_DELAYED_WORK (&aconnector->hpd_debounce_work, amdgpu_dm_hpd_debounce_work); dm->hdmi_frl_status_polling_delay_ms =200 ;INIT_DELAYED_WORK (&dm->hdmi_frl_status_polling_work, hdmi_frl_status_polling_work);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +6 -0
@@ -137,6 +137,12 @@ STATIC_IFN_KUNIT void apply_edid_quirks(struct dc_link *link, struct edid *edid,drm_dbg_driver (dev,"Skip PHY SSC reduction on panel id %X\n" , panel_id); link->wa_flags.skip_phy_ssc_reduction = true;break ; +/* Workaround for monitors that toggle HPD on DisplayPort entering deep sleep */ +case drm_edid_encode_panel_id ('M' ,'S' ,'I' ,0x3CF0 ): +drm_dbg_driver (dev,"Enabling DP HPD debounce on panel id %X\n" , panel_id); + edid_caps->panel_patch.dp_hpd_debounce_delay_ms = +min (1500U ,AMDGPU_DM_MAX_HPD_DEBOUNCE_MS ); +break ;default :return ; }
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c +71 -33
171 lines not on this page · raw message
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.h +1 -1
@@ -113,7 +113,7 @@ void amdgpu_dm_irq_resume_late(struct amdgpu_device *adev);struct hpd_rx_irq_offload_work_queue *amdgpu_dm_hpd_rx_irq_create_workqueue (struct amdgpu_device *adev);void amdgpu_dm_hpd_rx_irq_work_suspend (struct amdgpu_display_manager *dm);int amdgpu_dm_register_hpd_handlers (struct amdgpu_device *adev); -void amdgpu_dm_hdmi_hpd_debounce_work (struct work_struct *work); +void amdgpu_dm_hpd_debounce_work (struct work_struct *work);/* IRQ handlers */ struct amdgpu_crtc *amdgpu_dm_get_crtc_by_otg_inst(struct amdgpu_device *adev,
drivers/gpu/drm/amd/display/dc/dc_types.h +2 -0
@@ -193,6 +193,8 @@ struct dc_panel_patch {bool oled_optimize_display_on;unsigned int force_mst_blocked_discovery;unsigned int wait_after_dpcd_poweroff_ms; +unsigned int hdmi_hpd_debounce_delay_ms; +unsigned int dp_hpd_debounce_delay_ms; };/**
Signature · 1 line
2.43.0