drm/amd/display: Deep copy dml2_context when copying dc_state
authorDillon Varone <dillon.varone@amd.com>
Wed, 13 Dec 2023 21:39:22 +0000 (16:39 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 19 Dec 2023 19:59:03 +0000 (14:59 -0500)
[WHY&HOW]
dml2_context should be deep copied from src to dst dc_state.

Reviewed-by: George Shen <george.shen@amd.com>
Acked-by: Wayne Lin <wayne.lin@amd.com>
Signed-off-by: Dillon Varone <dillon.varone@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/core/dc_state.c

index 66a70a60c479a16ab77bde91b9a01e92e6507935..dd52cab7ecdf89d7450964b3c9ef8e3c40736656 100644 (file)
@@ -212,10 +212,14 @@ struct dc_state *dc_state_create(struct dc *dc)
 void dc_state_copy(struct dc_state *dst_state, struct dc_state *src_state)
 {
        struct kref refcount = dst_state->refcount;
+#ifdef CONFIG_DRM_AMD_DC_FP
+       struct dml2_context *dst_dml2 = dst_state->bw_ctx.dml2;
+#endif
 
        dc_state_copy_internal(dst_state, src_state);
 
 #ifdef CONFIG_DRM_AMD_DC_FP
+       dst_state->bw_ctx.dml2 = dst_dml2;
        if (src_state->bw_ctx.dml2)
                dml2_copy(dst_state->bw_ctx.dml2, src_state->bw_ctx.dml2);
 #endif