Commit 3f238a6b authored by Alvin Lee's avatar Alvin Lee Committed by Alex Deucher
Browse files

drm/amd/display: Update FAMS2 config cmd



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: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Reviewed-by: default avatarDillon Varone <dillon.varone@amd.com>
Signed-off-by: default avatarAlvin Lee <Alvin.Lee2@amd.com>
Signed-off-by: default avatarRodrigo Siqueira <rodrigo.siqueira@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 357ef5b3
Loading
Loading
Loading
Loading
+19 −6
Original line number Diff line number Diff line
@@ -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);
+1 −0
Original line number Diff line number Diff line
@@ -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;
};