]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amd/display: Add HPO encoder support to Replay
authorOvidiu Bunea <Ovidiu.Bunea@amd.com>
Thu, 27 Mar 2025 20:36:17 +0000 (16:36 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 15 Jul 2025 18:07:52 +0000 (14:07 -0400)
[why & how]
UHBR link rate capable eDPs will use HPO for encoding. Need to pass
HPO stream and link encoder instances to DMCUB for Replay FSM to
know which instances to use.

Reviewed-by: Charlene Liu <charlene.liu@amd.com>
Signed-off-by: Ovidiu Bunea <Ovidiu.Bunea@amd.com>
Signed-off-by: Ivan Lipski <ivan.lipski@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dce/dmub_replay.c
drivers/gpu/drm/amd/display/dc/dce/dmub_replay.h
drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h

index 5d77d0912ee9d2fcf64a9ac4cbf34c9b0d5273f6..e7a318e26d38ace2678f8233bdf2a48441a79bbf 100644 (file)
@@ -4,6 +4,7 @@
 
 #include "dc.h"
 #include "dc_dmub_srv.h"
+#include "dc_dp_types.h"
 #include "dmub/dmub_srv.h"
 #include "core_types.h"
 #include "dmub_replay.h"
@@ -43,21 +44,45 @@ static void dmub_replay_get_state(struct dmub_replay *dmub, enum replay_state *s
 /*
  * Enable/Disable Replay.
  */
-static void dmub_replay_enable(struct dmub_replay *dmub, bool enable, bool wait, uint8_t panel_inst)
+static void dmub_replay_enable(struct dmub_replay *dmub, bool enable, bool wait, uint8_t panel_inst,
+                              struct dc_link *link)
 {
        union dmub_rb_cmd cmd;
        struct dc_context *dc = dmub->ctx;
        uint32_t retry_count;
        enum replay_state state = REPLAY_STATE_0;
+       struct pipe_ctx *pipe_ctx = NULL;
+       struct resource_context *res_ctx = &link->ctx->dc->current_state->res_ctx;
+       uint8_t i;
 
        memset(&cmd, 0, sizeof(cmd));
        cmd.replay_enable.header.type = DMUB_CMD__REPLAY;
        cmd.replay_enable.data.panel_inst = panel_inst;
 
        cmd.replay_enable.header.sub_type = DMUB_CMD__REPLAY_ENABLE;
-       if (enable)
+       if (enable) {
                cmd.replay_enable.data.enable = REPLAY_ENABLE;
-       else
+               // hpo stream/link encoder assignments are not static, need to update everytime we try to enable replay
+               if (link->cur_link_settings.link_rate >= LINK_RATE_UHBR10) {
+                       for (i = 0; i < MAX_PIPES; i++) {
+                               if (res_ctx &&
+                                       res_ctx->pipe_ctx[i].stream &&
+                                       res_ctx->pipe_ctx[i].stream->link &&
+                                       res_ctx->pipe_ctx[i].stream->link == link &&
+                                       res_ctx->pipe_ctx[i].stream->link->connector_signal == SIGNAL_TYPE_EDP) {
+                                       pipe_ctx = &res_ctx->pipe_ctx[i];
+                                       //TODO: refactor for multi edp support
+                                       break;
+                               }
+                       }
+
+                       if (!pipe_ctx)
+                               return;
+
+                       cmd.replay_enable.data.hpo_stream_enc_inst = pipe_ctx->stream_res.hpo_dp_stream_enc->inst;
+                       cmd.replay_enable.data.hpo_link_enc_inst = pipe_ctx->link_res.hpo_dp_link_enc->inst;
+               }
+       } else
                cmd.replay_enable.data.enable = REPLAY_DISABLE;
 
        cmd.replay_enable.header.payload_bytes = sizeof(struct dmub_rb_cmd_replay_enable_data);
@@ -149,6 +174,17 @@ static bool dmub_replay_copy_settings(struct dmub_replay *dmub,
        copy_settings_data->digbe_inst                          = replay_context->digbe_inst;
        copy_settings_data->digfe_inst                          = replay_context->digfe_inst;
 
+       if (link->cur_link_settings.link_rate >= LINK_RATE_UHBR10) {
+               if (pipe_ctx->stream_res.hpo_dp_stream_enc)
+                       copy_settings_data->hpo_stream_enc_inst = pipe_ctx->stream_res.hpo_dp_stream_enc->inst;
+               else
+                       copy_settings_data->hpo_stream_enc_inst = 0;
+               if (pipe_ctx->link_res.hpo_dp_link_enc)
+                       copy_settings_data->hpo_link_enc_inst = pipe_ctx->link_res.hpo_dp_link_enc->inst;
+               else
+                       copy_settings_data->hpo_link_enc_inst = 0;
+       }
+
        if (pipe_ctx->plane_res.dpp)
                copy_settings_data->dpp_inst                    = pipe_ctx->plane_res.dpp->inst;
        else
index e6346c0ffc0e444392c09b421404cd3c50284ba7..ccbe385e132c47033f0c2b3f284af736644dadb2 100644 (file)
@@ -19,7 +19,7 @@ struct dmub_replay_funcs {
        void (*replay_get_state)(struct dmub_replay *dmub, enum replay_state *state,
                uint8_t panel_inst);
        void (*replay_enable)(struct dmub_replay *dmub, bool enable, bool wait,
-               uint8_t panel_inst);
+               uint8_t panel_inst, struct dc_link *link);
        bool (*replay_copy_settings)(struct dmub_replay *dmub, struct dc_link *link,
                struct replay_context *replay_context, uint8_t panel_inst);
        void (*replay_set_power_opt)(struct dmub_replay *dmub, unsigned int power_opt,
index 035795042a01d73295a3e008f30a9fee8c061898..a4258b5b77be88339c7931218981c6c61b5cc3ff 100644 (file)
@@ -937,7 +937,7 @@ bool edp_set_replay_allow_active(struct dc_link *link, const bool *allow_active,
                // TODO: Handle mux change case if force_static is set
                // If force_static is set, just change the replay_allow_active state directly
                if (replay != NULL && link->replay_settings.replay_feature_enabled)
-                       replay->funcs->replay_enable(replay, *allow_active, wait, panel_inst);
+                       replay->funcs->replay_enable(replay, *allow_active, wait, panel_inst, link);
                link->replay_settings.replay_allow_active = *allow_active;
        }
 
index fed2d3999305563ac44df2c6c01d5d06df789e1e..c587b3441e07091b9875f09f53c752561484b285 100644 (file)
@@ -4047,6 +4047,14 @@ struct dmub_cmd_replay_copy_settings_data {
         * DIG BE HW instance.
         */
        uint8_t digbe_inst;
+       /**
+        * @hpo_stream_enc_inst: HPO stream encoder instance
+        */
+       uint8_t hpo_stream_enc_inst;
+       /**
+        * @hpo_link_enc_inst: HPO link encoder instance
+        */
+       uint8_t hpo_link_enc_inst;
        /**
         * AUX HW instance.
         */
@@ -4091,6 +4099,11 @@ struct dmub_cmd_replay_copy_settings_data {
         * Use for AUX-less ALPM LFPS wake operation
         */
        struct dmub_alpm_auxless_data auxless_alpm_data;
+
+       /**
+        * @pad: Align structure to 4 byte boundary.
+        */
+       uint8_t pad[2];
 };
 
 /**
@@ -4146,6 +4159,18 @@ struct dmub_rb_cmd_replay_enable_data {
         * This does not support HDMI/DP2 for now.
         */
        uint8_t phy_rate;
+       /**
+        * @hpo_stream_enc_inst: HPO stream encoder instance
+        */
+       uint8_t hpo_stream_enc_inst;
+       /**
+        * @hpo_link_enc_inst: HPO link encoder instance
+        */
+       uint8_t hpo_link_enc_inst;
+       /**
+        * @pad: Align structure to 4 byte boundary.
+        */
+       uint8_t pad[2];
 };
 
 /**