drm/amd/display: Copy ctx to current_context instead of assign
authorHarry Wentland <harry.wentland@amd.com>
Thu, 6 Apr 2017 22:57:05 +0000 (18:57 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 26 Sep 2017 21:24:16 +0000 (17:24 -0400)
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc.c

index e8499e7445959e18fb2fa9ea51c6941e12bd91ae..0d870e9c7c99a82c37ba5ab5a98c4333308ef272 100644 (file)
@@ -906,13 +906,13 @@ bool dc_post_update_surfaces_to_stream(struct dc *dc)
        resource_validate_ctx_copy_construct(core_dc->current_context, context);
 
        post_surface_trace(dc);
-
        for (i = 0; i < context->res_ctx.pool->pipe_count; i++)
                if (context->res_ctx.pipe_ctx[i].stream == NULL) {
                        context->res_ctx.pipe_ctx[i].pipe_idx = i;
                        core_dc->hwss.power_down_front_end(
                                        core_dc, &context->res_ctx.pipe_ctx[i]);
                }
+
        if (!core_dc->res_pool->funcs->validate_bandwidth(core_dc, context)) {
                BREAK_TO_DEBUGGER();
                return false;
@@ -920,11 +920,10 @@ bool dc_post_update_surfaces_to_stream(struct dc *dc)
 
        core_dc->hwss.set_bandwidth(core_dc, context, true);
 
-       resource_validate_ctx_destruct(core_dc->current_context);
-       if (core_dc->current_context)
-               dm_free(core_dc->current_context);
+       resource_validate_ctx_copy_construct(context, core_dc->current_context);
 
-       core_dc->current_context = context;
+       resource_validate_ctx_destruct(context);
+       dm_free(context);
 
        return true;
 }