From: Dominik Kowalski <[email protected]>

[Why]
DPMS-v2 replaces pipe_ctx with link_dpms_ctx, aiming to narrow its
reach and responsibilities, enabling more precise and safe design.

[How]
* Add link_tx in dedicated file as new vtable for DPMS-v2 to call
* Add link_dpms_ctx in core_types
* Place link_dpms_ctx in dc_link
* No initialization or other use logic yet, TBD

Signed-off-by: Dominik Kowalski <[email protected]>
Signed-off-by: James Lin <[email protected]>
---
 drivers/gpu/drm/amd/display/dc/dc.h           |  2 +
 .../gpu/drm/amd/display/dc/inc/core_types.h   | 58 ++++++++++++++++++
 drivers/gpu/drm/amd/display/dc/inc/link_tx.h  | 59 +++++++++++++++++++
 3 files changed, 119 insertions(+)
 create mode 100644 drivers/gpu/drm/amd/display/dc/inc/link_tx.h

diff --git a/drivers/gpu/drm/amd/display/dc/dc.h 
b/drivers/gpu/drm/amd/display/dc/dc.h
index 01f549010d07..c9bdfba11a01 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -556,6 +556,7 @@ struct dc_update_descriptor {
 struct dc;
 struct dc_plane_state;
 struct dc_state;
+struct link_dpms_ctx;
 
 struct dc_cap_funcs {
        bool (*get_dcc_compression_cap)(const struct dc *dc,
@@ -1931,6 +1932,7 @@ struct dc_scratch_space {
        void *priv;
 
        struct ddc_service *ddc;
+       struct link_dpms_ctx *dpms_ctx;
 
        enum dp_panel_mode panel_mode;
        bool panel_mode_initialized;
diff --git a/drivers/gpu/drm/amd/display/dc/inc/core_types.h 
b/drivers/gpu/drm/amd/display/dc/inc/core_types.h
index 695eaa5cbf65..1d6bb41312b7 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/core_types.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/core_types.h
@@ -31,6 +31,7 @@
 #include "dcn_calcs.h"
 #include "ddc_service_types.h"
 #include "dc_bios_types.h"
+#include "dsc/dsc.h"
 #include "mem_input.h"
 #include "hubp.h"
 #include "hw/dchubbub.h"
@@ -807,4 +808,61 @@ struct dc_update_scratch_space {
        int intermediate_count;
 };
 
+/**
+ * Snapshot of fields from dc_stream_state relevant to link_set_dpms_on_v2().
+ *
+ * Removes dependency on mutable stream object, which would otherwise create
+ * synchronization hazards.
+ */
+struct link_dpms_stream_descriptor {
+       // TODO: Implement
+       int dummy;
+};
+
+/**
+ * DPMS operation context variables.
+ *
+ * This struct is owned by dc_link, sharing its lifetime.
+ * The caller populates the context with update details and validates it.
+ * No other code aside from DPMS sequence itself is allowed to modify it during
+ * execution, while DPMS serialization prevents concurrent reuse.
+ *
+ * This struct is used by top-level link_set_dpms_on/off_v2() and the sequence
+ * steps link_dpms_step_xxx(). The step functions unpack relevant values
+ * and pass them directly as arguments into TX and HWSS. This is done to make
+ * TX and HWSS independent from DPMS, while preventing them from backtracking
+ * to shared state like DC and its state structs.
+ */
+struct link_dpms_ctx {
+       /**
+        * Mutable link state.
+        *
+        * Steps use it to record protocol results and evaluate preconditions.
+        * Should not be used to access dc_state, dc_stream_state, pipe_ctx.
+        */
+       struct dc_link *link;
+
+       /**
+        * Snapshot of relevant fields from dc_stream_state.
+        *
+        * Removes dependency on mutable stream object.
+        */
+       struct link_dpms_stream_descriptor stream_descriptor;
+
+       /**
+        * Stable validated link configuration.
+        *
+        * If unable to reach desired state, DPMS reports failure instead
+        * of rewriting alternative configuration.
+        */
+       struct link_config link_config;
+
+       /**
+        * Source-side link HW transmitter.
+        *
+        * This is sole interface used to program all protocol operations.
+        */
+       const struct link_tx *tx;
+};
+
 #endif /* _CORE_TYPES_H_ */
diff --git a/drivers/gpu/drm/amd/display/dc/inc/link_tx.h 
b/drivers/gpu/drm/amd/display/dc/inc/link_tx.h
new file mode 100644
index 000000000000..3b671eea15ef
--- /dev/null
+++ b/drivers/gpu/drm/amd/display/dc/inc/link_tx.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2026 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
+ *
+ */
+#ifndef LINK_TX_H
+#define LINK_TX_H
+
+#include "dc/inc/core_types.h"
+#include "dc/inc/core_status.h"
+
+struct dc_link;
+struct link_resource;
+struct link_tx;
+struct link_tx_funcs;
+
+/**
+ * Private DPMS v2 context, opaque type forward-declared only.
+ */
+struct link_tx_v2_ctx;
+
+struct link_tx {
+       const struct link_tx_funcs *funcs;
+       struct dc_link *link;
+       struct link_tx_v2_ctx *ctx;
+};
+
+/**
+ * Virtual table of function pointers for link protocol programming.
+ *
+ * Analogous to HWSS, but takes link_tx instead of pipe_ctx, as the latter
+ * was deemed too broad and open, resulting in synchronization hazards.
+ */
+struct link_tx_funcs {
+       // TODO: Implement
+       void (*destroy)(struct link_tx *tx);
+};
+
+#endif
+
-- 
2.43.0

Reply via email to