]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/display: Add drm helper to check pr optimization support
authorAnimesh Manna <animesh.manna@intel.com>
Mon, 30 Mar 2026 13:36:18 +0000 (19:06 +0530)
committerAnimesh Manna <animesh.manna@intel.com>
Tue, 7 Apr 2026 09:56:54 +0000 (15:26 +0530)
Add api to check panel replay optimization supported or not to
drm-core DP tunneling framework which can be used by other driver
as well.

v2: Split generic drm changes from Intel specific changes. [Jouni]

Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Suggested-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Animesh Manna <animesh.manna@intel.com>
Acked-by: Maarten Lankhorst <dev@lankhorst.se>
Link: https://patch.msgid.link/20260330133620.3750559-2-animesh.manna@intel.com
drivers/gpu/drm/display/drm_dp_tunnel.c
include/drm/display/drm_dp_tunnel.h

index 6519b42447285b58892ac07a3570cf6c457e4c27..08dc5d26b2c5ecb38298b5dccdb1e198a353a462 100644 (file)
@@ -149,6 +149,7 @@ struct drm_dp_tunnel {
        bool bw_alloc_enabled:1;
        bool has_io_error:1;
        bool destroyed:1;
+       bool pr_optimization_support:1;
 };
 
 struct drm_dp_tunnel_group_state;
@@ -508,6 +509,8 @@ create_tunnel(struct drm_dp_tunnel_mgr *mgr,
 
        tunnel->bw_alloc_supported = tunnel_reg_bw_alloc_supported(regs);
        tunnel->bw_alloc_enabled = tunnel_reg_bw_alloc_enabled(regs);
+       tunnel->pr_optimization_support = tunnel_reg(regs, DP_TUNNELING_CAPABILITIES) &
+                                         DP_PANEL_REPLAY_OPTIMIZATION_SUPPORT;
 
        if (!add_tunnel_to_group(mgr, drv_group_id, tunnel)) {
                kfree(tunnel);
@@ -1036,6 +1039,20 @@ bool drm_dp_tunnel_bw_alloc_is_enabled(const struct drm_dp_tunnel *tunnel)
 }
 EXPORT_SYMBOL(drm_dp_tunnel_bw_alloc_is_enabled);
 
+/**
+ * drm_dp_tunnel_pr_optimization_supported - Query the PR BW optimization support
+ * @tunnel: Tunnel object
+ *
+ * Query if the PR BW optimization is supported for @tunnel.
+ *
+ * Returns %true if the PR BW optimiation is supported for @tunnel.
+ */
+bool drm_dp_tunnel_pr_optimization_supported(const struct drm_dp_tunnel *tunnel)
+{
+       return tunnel && tunnel->pr_optimization_support;
+}
+EXPORT_SYMBOL(drm_dp_tunnel_pr_optimization_supported);
+
 static int clear_bw_req_state(struct drm_dp_aux *aux)
 {
        u8 bw_req_mask = DP_BW_REQUEST_SUCCEEDED | DP_BW_REQUEST_FAILED;
index 87212c84791505fe6a0ecb2042728b5efdc9da7c..4aa3ce9fd82946197c7ecb56676692da94b570aa 100644 (file)
@@ -53,6 +53,7 @@ int drm_dp_tunnel_destroy(struct drm_dp_tunnel *tunnel);
 int drm_dp_tunnel_enable_bw_alloc(struct drm_dp_tunnel *tunnel);
 int drm_dp_tunnel_disable_bw_alloc(struct drm_dp_tunnel *tunnel);
 bool drm_dp_tunnel_bw_alloc_is_enabled(const struct drm_dp_tunnel *tunnel);
+bool drm_dp_tunnel_pr_optimization_supported(const struct drm_dp_tunnel *tunnel);
 int drm_dp_tunnel_alloc_bw(struct drm_dp_tunnel *tunnel, int bw);
 int drm_dp_tunnel_get_allocated_bw(struct drm_dp_tunnel *tunnel);
 int drm_dp_tunnel_update_state(struct drm_dp_tunnel *tunnel);
@@ -140,6 +141,11 @@ static inline bool drm_dp_tunnel_bw_alloc_is_enabled(const struct drm_dp_tunnel
        return false;
 }
 
+static inline bool drm_dp_tunnel_pr_optimization_supported(const struct drm_dp_tunnel *tunnel)
+{
+       return false;
+}
+
 static inline int
 drm_dp_tunnel_alloc_bw(struct drm_dp_tunnel *tunnel, int bw)
 {