From 02feab823760cf08272b12901776e117616f1047 Mon Sep 17 00:00:00 2001 From: Imre Deak Date: Thu, 19 Feb 2026 20:28:20 +0200 Subject: [PATCH] drm/i915/dp_tunnel: Simplify detection of link BW change update_tunnel_state() checks whether a tunnel state change (e.g. available tunnel bandwidth) affects the list of valid modes for the sink connected through the tunnel. If so, its caller sends a hotplug event so userspace can re-enumerate the modes. A change in tunnel bandwidth does not affect the mode list if the bandwidth was above the sink's DPRX bandwidth both before and after the update, since in that case the effective bandwidth remains limited by the DPRX. As get_current_link_bw() via intel_dp_max_link_data_rate() already returns bandwidth values clamped to the DPRX limit, the condition for detecting a mode list change can be simplified to: old_bw != new_bw Remove the explicit checks for whether the bandwidth was below the maximum DPRX bandwidth before and after the update, and rely on the clamped bandwidth values instead. Reviewed-by: Arun R Murthy Signed-off-by: Imre Deak Link: https://patch.msgid.link/20260219182823.926702-3-imre.deak@intel.com --- drivers/gpu/drm/i915/display/intel_dp_tunnel.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dp_tunnel.c b/drivers/gpu/drm/i915/display/intel_dp_tunnel.c index 633706274c9c..b95fdafa3d36 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_tunnel.c +++ b/drivers/gpu/drm/i915/display/intel_dp_tunnel.c @@ -54,30 +54,23 @@ static int kbytes_to_mbits(int kbytes) return DIV_ROUND_UP(kbytes * 8, 1000); } -static int get_current_link_bw(struct intel_dp *intel_dp, - bool *below_dprx_bw) +static int get_current_link_bw(struct intel_dp *intel_dp) { int rate = intel_dp_max_common_rate(intel_dp); int lane_count = intel_dp_max_common_lane_count(intel_dp); - int bw; - bw = intel_dp_max_link_data_rate(intel_dp, rate, lane_count); - *below_dprx_bw = bw < drm_dp_max_dprx_data_rate(rate, lane_count); - - return bw; + return intel_dp_max_link_data_rate(intel_dp, rate, lane_count); } static int update_tunnel_state(struct intel_dp *intel_dp) { struct intel_display *display = to_intel_display(intel_dp); struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base; - bool old_bw_below_dprx; - bool new_bw_below_dprx; int old_bw; int new_bw; int ret; - old_bw = get_current_link_bw(intel_dp, &old_bw_below_dprx); + old_bw = get_current_link_bw(intel_dp); ret = drm_dp_tunnel_update_state(intel_dp->tunnel); if (ret < 0) { @@ -96,11 +89,10 @@ static int update_tunnel_state(struct intel_dp *intel_dp) intel_dp_update_sink_caps(intel_dp); - new_bw = get_current_link_bw(intel_dp, &new_bw_below_dprx); + new_bw = get_current_link_bw(intel_dp); /* Suppress the notification if the mode list can't change due to bw. */ - if (old_bw_below_dprx == new_bw_below_dprx && - !new_bw_below_dprx) + if (old_bw == new_bw) return 0; drm_dbg_kms(display->drm,