From 5a19fd061bbd67549c3a5025205b94a8c30c1f10 Mon Sep 17 00:00:00 2001 From: Clara Wong Date: Wed, 24 Jun 2026 11:25:09 -0400 Subject: [PATCH] drm/amd/display: Reduce DML reinitialization when params don't change [WHY] Reinitializing DML causes an extra ~8s delay in gaming mode preset switches on some systems [HOW] Don't reinitialize DML unless params/caps have changed Reviewed-by: Austin Zheng Reviewed-by: Taimur Hassan Signed-off-by: Clara Wong Signed-off-by: Wayne Lin Tested-by: Dan Wheeler Signed-off-by: Alex Deucher --- .../display/dc/dml2_0/dml21/dml21_wrapper_fpu.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/dml21_wrapper_fpu.c b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/dml21_wrapper_fpu.c index a975d36ce15d..4e3d54c92e32 100644 --- a/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/dml21_wrapper_fpu.c +++ b/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/dml21_wrapper_fpu.c @@ -45,7 +45,22 @@ void dml21_init(const struct dc *in_dc, struct dml2_context *dml_ctx, const stru void dml21_reinit(const struct dc *in_dc, struct dml2_context *dml_ctx, const struct dml2_configuration_options *config) { - dml21_init(in_dc, dml_ctx, config); + struct dml2_instance *dml2 = dml_ctx->v21.dml_init.dml2_instance; + + dml21_populate_configuration_options(in_dc, dml_ctx, config); + + dml21_populate_dml_init_params(&dml_ctx->v21.dml_init, &dml_ctx->config, in_dc); + + // Skip full re-initialization if soc_bb, ip_caps and pmo_options are unchanged + if (memcmp(&dml2->soc_bbox, &dml_ctx->v21.dml_init.soc_bb, + sizeof(struct dml2_soc_bb)) == 0 && + memcmp(&dml2->ip_caps, &dml_ctx->v21.dml_init.ip_caps, + sizeof(struct dml2_ip_capabilities)) == 0 && + memcmp(&dml2->pmo_options, &dml_ctx->v21.dml_init.options.pmo_options, + sizeof(struct dml2_pmo_options)) == 0) + return; + + dml2_initialize_instance(&dml_ctx->v21.dml_init); } static void dml21_calculate_rq_and_dlg_params(const struct dc *dc, struct dc_state *context, struct resource_context *out_new_hw_state,