Skip to content

Commit 91888b5

Browse files
committed
drm/i915/dp: Add support for DP tunnel BW allocation
Add support to enable the DP tunnel BW allocation mode. Follow-up patches will call the required helpers added here to prepare for a modeset on a link with DP tunnels, the last change in the patchset actually enabling BWA. With BWA enabled, the driver will expose the full mode list a display supports, regardless of any BW limitation on a shared (Thunderbolt) link. Such BW limits will be checked against only during a modeset, when the driver has the full knowledge of each display's BW requirement. If the link BW changes in a way that a connector's modelist may also change, userspace will get a hotplug notification for all the connectors sharing the same link (so it can adjust the mode used for a display). The BW limitation can change at any point, asynchronously to modesets on a given connector, so a modeset can fail even though the atomic check for it passed. In such scenarios userspace will get a bad link notification and in response is supposed to retry the modeset. v2: - Fix old vs. new connector state in intel_dp_tunnel_atomic_check_state(). (Ville) - Fix propagating the error from intel_dp_tunnel_atomic_compute_stream_bw(). (Ville) - Move tunnel==NULL checks from driver to DRM core helpers. (Ville) - Simplify return flow from intel_dp_tunnel_detect(). (Ville) - s/dp_tunnel_state/inherited_dp_tunnels (Ville) - Simplify struct intel_dp_tunnel_inherited_state. (Ville) - Unconstify object pointers (vs. states) where possible. (Ville) - Init crtc_state while declaring it in check_group_state(). (Ville) - Join obj->base.id, obj->name arg lines in debug prints to reduce LOC. (Ville) - Add/rework intel_dp_tunnel_atomic_alloc_bw() to prepare for moving the BW allocation from encoder hooks up to intel_atomic_commit_tail() later in the patchset. - Disable BW alloc mode during system suspend. - Allocate the required BW for all tunnels during system resume. - Add intel_dp_tunnel_atomic_clear_stream_bw() instead of the open-coded sequence in a follow-up patch. - Add function documentation to all exported functions. - Add CONFIG_USB4 dependency to CONFIG_DRM_I915_DP_TUNNEL. v3: - Rebase on intel_dp_get_active_pipes() change in previous patch. Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Uma Shankar <uma.shankar@intel.com> Signed-off-by: Imre Deak <imre.deak@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240226185246.1276018-4-imre.deak@intel.com
1 parent 199c7d7 commit 91888b5

8 files changed

Lines changed: 974 additions & 0 deletions

File tree

drivers/gpu/drm/i915/Kconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,20 @@ config DRM_I915_PXP
155155
protected session and manage the status of the alive software session,
156156
as well as its life cycle.
157157

158+
config DRM_I915_DP_TUNNEL
159+
bool "Enable DP tunnel support"
160+
depends on DRM_I915
161+
depends on USB4
162+
select DRM_DISPLAY_DP_TUNNEL
163+
default y
164+
help
165+
Choose this option to detect DP tunnels and enable the Bandwidth
166+
Allocation mode for such tunnels. This allows using the maximum
167+
resolution allowed by the link BW on all displays sharing the
168+
link BW, for instance on a Thunderbolt link.
169+
170+
If in doubt, say "Y".
171+
158172
menu "drm/i915 Debugging"
159173
depends on DRM_I915
160174
depends on EXPERT

drivers/gpu/drm/i915/Kconfig.debug

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ config DRM_I915_DEBUG
2828
select STACKDEPOT
2929
select STACKTRACE
3030
select DRM_DP_AUX_CHARDEV
31+
select DRM_DISPLAY_DEBUG_DP_TUNNEL_STATE if DRM_I915_DP_TUNNEL
3132
select X86_MSR # used by igt/pm_rpm
3233
select DRM_VGEM # used by igt/prime_vgem (dmabuf interop checks)
3334
select DRM_DEBUG_MM if DRM=y

drivers/gpu/drm/i915/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,9 @@ i915-y += \
369369
display/vlv_dsi.o \
370370
display/vlv_dsi_pll.o
371371

372+
i915-$(CONFIG_DRM_I915_DP_TUNNEL) += \
373+
display/intel_dp_tunnel.o
374+
372375
i915-y += \
373376
i915_perf.o
374377

drivers/gpu/drm/i915/display/intel_atomic.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
* See intel_atomic_plane.c for the plane-specific atomic functionality.
3030
*/
3131

32+
#include <drm/display/drm_dp_tunnel.h>
3233
#include <drm/drm_atomic.h>
3334
#include <drm/drm_atomic_helper.h>
3435
#include <drm/drm_fourcc.h>
@@ -38,6 +39,7 @@
3839
#include "intel_atomic.h"
3940
#include "intel_cdclk.h"
4041
#include "intel_display_types.h"
42+
#include "intel_dp_tunnel.h"
4143
#include "intel_global_state.h"
4244
#include "intel_hdcp.h"
4345
#include "intel_psr.h"

drivers/gpu/drm/i915/display/intel_display_core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,7 @@ struct intel_display {
524524
} wq;
525525

526526
/* Grouping using named structs. Keep sorted. */
527+
struct drm_dp_tunnel_mgr *dp_tunnel_mgr;
527528
struct intel_audio audio;
528529
struct intel_dpll dpll;
529530
struct intel_fbc *fbc[I915_MAX_FBCS];

drivers/gpu/drm/i915/display/intel_display_types.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
#include <drm/display/drm_dp_dual_mode_helper.h>
3535
#include <drm/display/drm_dp_mst_helper.h>
36+
#include <drm/display/drm_dp_tunnel.h>
3637
#include <drm/display/drm_dsc.h>
3738
#include <drm/drm_atomic.h>
3839
#include <drm/drm_crtc.h>
@@ -682,6 +683,8 @@ struct intel_atomic_state {
682683

683684
struct intel_shared_dpll_state shared_dpll[I915_NUM_PLLS];
684685

686+
struct intel_dp_tunnel_inherited_state *inherited_dp_tunnels;
687+
685688
/*
686689
* Current watermarks can't be trusted during hardware readout, so
687690
* don't bother calculating intermediate watermarks.
@@ -1379,6 +1382,9 @@ struct intel_crtc_state {
13791382
struct drm_dsc_config config;
13801383
} dsc;
13811384

1385+
/* DP tunnel used for BW allocation. */
1386+
struct drm_dp_tunnel_ref dp_tunnel_ref;
1387+
13821388
/* HSW+ linetime watermarks */
13831389
u16 linetime;
13841390
u16 ips_linetime;
@@ -1789,6 +1795,9 @@ struct intel_dp {
17891795
/* connector directly attached - won't be use for modeset in mst world */
17901796
struct intel_connector *attached_connector;
17911797

1798+
struct drm_dp_tunnel *tunnel;
1799+
bool tunnel_suspended:1;
1800+
17921801
/* mst connector list */
17931802
struct intel_dp_mst_encoder *mst_encoders[I915_MAX_PIPES];
17941803
struct drm_dp_mst_topology_mgr mst_mgr;

0 commit comments

Comments
 (0)