]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amd/display: Update FAMS2 config cmd
authorAlvin Lee <Alvin.Lee2@amd.com>
Fri, 29 Nov 2024 16:53:38 +0000 (11:53 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 18 Dec 2024 17:18:26 +0000 (12:18 -0500)
The FAMS2 stream and sub-state have been separated into
2 different commands. Update the cmd function to send
one command each for the stream and sub-state.

Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Reviewed-by: Dillon Varone <dillon.varone@amd.com>
Signed-off-by: Alvin Lee <Alvin.Lee2@amd.com>
Signed-off-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c
drivers/gpu/drm/amd/display/dc/inc/core_types.h

index 775c58637f46ca4fa5edba5f851523e58d3a5da0..4127a4a2f1e0ba49023b2e75d3cf49a0e0543b77 100644 (file)
@@ -1694,10 +1694,10 @@ void dc_dmub_srv_fams2_update_config(struct dc *dc,
 {
        uint8_t num_cmds = 1;
        uint32_t i;
-       union dmub_rb_cmd cmd[MAX_STREAMS + 1];
+       union dmub_rb_cmd cmd[2 * MAX_STREAMS + 1];
        struct dmub_rb_cmd_fams2 *global_cmd = &cmd[0].fams2_config;
 
-       memset(cmd, 0, sizeof(union dmub_rb_cmd) * (MAX_STREAMS + 1));
+       memset(cmd, 0, sizeof(union dmub_rb_cmd) * (2 * MAX_STREAMS + 1));
        /* fill in generic command header */
        global_cmd->header.type = DMUB_CMD__FW_ASSISTED_MCLK_SWITCH;
        global_cmd->header.sub_type = DMUB_CMD__FAMS2_CONFIG;
@@ -1715,16 +1715,29 @@ void dc_dmub_srv_fams2_update_config(struct dc *dc,
                /* construct per-stream configs */
                for (i = 0; i < context->bw_ctx.bw.dcn.fams2_global_config.num_streams; i++) {
                        struct dmub_rb_cmd_fams2 *stream_cmd = &cmd[i+1].fams2_config;
+                       struct dmub_rb_cmd_fams2 *sub_state_cmd = &cmd[i+1+context->bw_ctx.bw.dcn.fams2_global_config.num_streams].fams2_config;
 
                        /* configure command header */
                        stream_cmd->header.type = DMUB_CMD__FW_ASSISTED_MCLK_SWITCH;
                        stream_cmd->header.sub_type = DMUB_CMD__FAMS2_CONFIG;
                        stream_cmd->header.payload_bytes = sizeof(struct dmub_rb_cmd_fams2) - sizeof(struct dmub_cmd_header);
                        stream_cmd->header.multi_cmd_pending = 1;
+                       sub_state_cmd->header.type = DMUB_CMD__FW_ASSISTED_MCLK_SWITCH;
+                       sub_state_cmd->header.sub_type = DMUB_CMD__FAMS2_CONFIG;
+                       sub_state_cmd->header.payload_bytes = sizeof(struct dmub_rb_cmd_fams2) - sizeof(struct dmub_cmd_header);
+                       sub_state_cmd->header.multi_cmd_pending = 1;
                        /* copy stream static state */
-                       memcpy(&stream_cmd->config.stream,
+                       memcpy(&stream_cmd->config.stream_v1.base,
                                        &context->bw_ctx.bw.dcn.fams2_stream_params[i],
-                                       sizeof(struct dmub_fams2_stream_static_state));
+                                       sizeof(struct dmub_fams2_cmd_stream_static_base_state));
+                       // TODO: Use the below memcpy call instead of the above once DML is updated
+                       /*memcpy(&stream_cmd->config.stream_v1.base,
+                                       &context->bw_ctx.bw.dcn.fams2_stream_params[i].base,
+                                       sizeof(struct dmub_fams2_cmd_stream_static_base_state));*/
+                       /* copy stream sub state */
+                       memcpy(&stream_cmd->config.stream_v1.sub_state,
+                                       &context->bw_ctx.bw.dcn.fams2_stream_params[i].sub_state,
+                                       sizeof(union dmub_fams2_cmd_stream_static_sub_state));
                }
        }
 
@@ -1735,8 +1748,8 @@ void dc_dmub_srv_fams2_update_config(struct dc *dc,
        if (enable && context->bw_ctx.bw.dcn.fams2_global_config.features.bits.enable) {
                /* set multi pending for global, and unset for last stream cmd */
                global_cmd->header.multi_cmd_pending = 1;
-               cmd[context->bw_ctx.bw.dcn.fams2_global_config.num_streams].fams2_config.header.multi_cmd_pending = 0;
-               num_cmds += context->bw_ctx.bw.dcn.fams2_global_config.num_streams;
+               cmd[2 * context->bw_ctx.bw.dcn.fams2_global_config.num_streams].fams2_config.header.multi_cmd_pending = 0;
+               num_cmds += 2 * context->bw_ctx.bw.dcn.fams2_global_config.num_streams;
        }
 
        dm_execute_dmub_cmd_list(dc->ctx, num_cmds, cmd, DM_DMUB_WAIT_TYPE_WAIT);
index 9bdef5ff0584e7f68d4a89d67318a0d237dea820..785baffd33adb6cb11a836a4dd6edf676c4eda5c 100644 (file)
@@ -540,6 +540,7 @@ struct dcn_bw_output {
        struct dml2_mcache_surface_allocation mcache_allocations[DML2_MAX_PLANES];
        struct dmub_cmd_fams2_global_config fams2_global_config;
        struct dmub_fams2_stream_static_state fams2_stream_params[DML2_MAX_PLANES];
+       /*struct dmub_fams2_stream_static_state_v1 fams2_stream_params[DML2_MAX_PLANES];*/ // TODO: Update to this once DML is updated
        struct dml2_display_arb_regs arb_regs;
 };