Skip to content

Commit 71ae580

Browse files
Jake Wangalexdeucher
authored andcommitted
drm/amd/display: Ensure DCN save after VM setup
[Why] DM initializes VM context after DMCUB initialization. This results in loss of DCN_VM_CONTEXT registers after z10. [How] Notify DMCUB when VM setup is complete, and have DMCUB save init registers. v2: squash in CONFIG_DRM_AMD_DC_DCN3_1 fix Reviewed-by: Nicholas Kazlauskas <[email protected]> Acked-by: Wayne Lin <[email protected]> Signed-off-by: Jake Wang <[email protected]> Tested-by: Daniel Wheeler <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent f924f3a commit 71ae580

File tree

8 files changed

+30
-0
lines changed

8 files changed

+30
-0
lines changed

drivers/gpu/drm/amd/display/dc/core/dc.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,6 +1530,12 @@ void dc_z10_restore(struct dc *dc)
15301530
if (dc->hwss.z10_restore)
15311531
dc->hwss.z10_restore(dc);
15321532
}
1533+
1534+
void dc_z10_save_init(struct dc *dc)
1535+
{
1536+
if (dc->hwss.z10_save_init)
1537+
dc->hwss.z10_save_init(dc);
1538+
}
15331539
#endif
15341540
/*
15351541
* Applies given context to HW and copy it into current context.

drivers/gpu/drm/amd/display/dc/core/dc_vm_helper.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ int dc_setup_system_context(struct dc *dc, struct dc_phy_addr_space_config *pa_c
4747
*/
4848
memcpy(&dc->vm_pa_config, pa_config, sizeof(struct dc_phy_addr_space_config));
4949
dc->vm_pa_config.valid = true;
50+
#if defined(CONFIG_DRM_AMD_DC_DCN)
51+
dc_z10_save_init(dc);
52+
#endif
5053
}
5154

5255
return num_vmids;

drivers/gpu/drm/amd/display/dc/dc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,6 +1338,7 @@ void dc_hardware_release(struct dc *dc);
13381338
bool dc_set_psr_allow_active(struct dc *dc, bool enable);
13391339
#if defined(CONFIG_DRM_AMD_DC_DCN)
13401340
void dc_z10_restore(struct dc *dc);
1341+
void dc_z10_save_init(struct dc *dc);
13411342
#endif
13421343

13431344
bool dc_enable_dmub_notifications(struct dc *dc);

drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hwseq.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,18 @@ void dcn31_update_info_frame(struct pipe_ctx *pipe_ctx)
404404
&pipe_ctx->stream_res.encoder_info_frame);
405405
}
406406
}
407+
void dcn31_z10_save_init(struct dc *dc)
408+
{
409+
union dmub_rb_cmd cmd;
410+
411+
memset(&cmd, 0, sizeof(cmd));
412+
cmd.dcn_restore.header.type = DMUB_CMD__IDLE_OPT;
413+
cmd.dcn_restore.header.sub_type = DMUB_CMD__IDLE_OPT_DCN_SAVE_INIT;
414+
415+
dc_dmub_srv_cmd_queue(dc->ctx->dmub_srv, &cmd);
416+
dc_dmub_srv_cmd_execute(dc->ctx->dmub_srv);
417+
dc_dmub_srv_wait_idle(dc->ctx->dmub_srv);
418+
}
407419

408420
void dcn31_z10_restore(struct dc *dc)
409421
{

drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hwseq.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ void dcn31_enable_power_gating_plane(
4444
void dcn31_update_info_frame(struct pipe_ctx *pipe_ctx);
4545

4646
void dcn31_z10_restore(struct dc *dc);
47+
void dcn31_z10_save_init(struct dc *dc);
4748

4849
void dcn31_hubp_pg_control(struct dce_hwseq *hws, unsigned int hubp_inst, bool power_on);
4950
int dcn31_init_sys_ctx(struct dce_hwseq *hws, struct dc *dc, struct dc_phy_addr_space_config *pa_config);

drivers/gpu/drm/amd/display/dc/dcn31/dcn31_init.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ static const struct hw_sequencer_funcs dcn31_funcs = {
9797
.set_abm_immediate_disable = dcn21_set_abm_immediate_disable,
9898
.set_pipe = dcn21_set_pipe,
9999
.z10_restore = dcn31_z10_restore,
100+
.z10_save_init = dcn31_z10_save_init,
100101
.is_abm_supported = dcn31_is_abm_supported,
101102
.set_disp_pattern_generator = dcn30_set_disp_pattern_generator,
102103
.update_visual_confirm_color = dcn20_update_visual_confirm_color,

drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ struct hw_sequencer_funcs {
237237
int width, int height, int offset);
238238

239239
void (*z10_restore)(struct dc *dc);
240+
void (*z10_save_init)(struct dc *dc);
240241

241242
void (*update_visual_confirm_color)(struct dc *dc,
242243
struct pipe_ctx *pipe_ctx,

drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,11 @@ enum dmub_cmd_idle_opt_type {
856856
* DCN hardware restore.
857857
*/
858858
DMUB_CMD__IDLE_OPT_DCN_RESTORE = 0,
859+
860+
/**
861+
* DCN hardware save.
862+
*/
863+
DMUB_CMD__IDLE_OPT_DCN_SAVE_INIT = 1
859864
};
860865

861866
/**

0 commit comments

Comments
 (0)