drm/amd/display: fix up construction of scratch_val_ctx
authorDmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Mon, 5 Dec 2016 23:03:04 +0000 (18:03 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 26 Sep 2017 21:04:41 +0000 (17:04 -0400)
Signed-off-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc.c
drivers/gpu/drm/amd/display/dc/inc/core_types.h

index 522ef70475643d03b7cbaebf97f7a44484e3f569..8e1d695fcb771251894a4105f01c2c12198ffb89 100644 (file)
@@ -450,11 +450,6 @@ static void destruct(struct core_dc *dc)
 {
        resource_validate_ctx_destruct(dc->current_context);
 
-       dm_free(dc->temp_flip_context);
-       dc->temp_flip_context = NULL;
-       dm_free(dc->scratch_val_ctx);
-       dc->scratch_val_ctx = NULL;
-
        destroy_links(dc);
 
        dc_destroy_resource_pool(dc);
@@ -473,6 +468,10 @@ static void destruct(struct core_dc *dc)
 
        dm_free(dc->current_context);
        dc->current_context = NULL;
+       dm_free(dc->temp_flip_context);
+       dc->temp_flip_context = NULL;
+       dm_free(dc->scratch_val_ctx);
+       dc->scratch_val_ctx = NULL;
 
        dm_free(dc->ctx);
        dc->ctx = NULL;
@@ -492,7 +491,7 @@ static bool construct(struct core_dc *dc,
 
        dc->current_context = dm_alloc(sizeof(*dc->current_context));
        dc->temp_flip_context = dm_alloc(sizeof(*dc->temp_flip_context));
-       dc->scratch_val_ctx = dm_alloc(sizeof(*dc->temp_flip_context));
+       dc->scratch_val_ctx = dm_alloc(sizeof(*dc->scratch_val_ctx));
 
        if (!dc->current_context || !dc->temp_flip_context) {
                dm_error("%s: failed to create validate ctx\n", __func__);
@@ -1220,6 +1219,7 @@ bool dc_pre_update_surfaces_to_target(
                        goto unexpected_fail;
                }
                resource_validate_ctx_destruct(context);
+               ASSERT(core_dc->scratch_val_ctx == temp_context);
                core_dc->scratch_val_ctx = context;
                context = temp_context;
        }
index 0418e3e02c7a3bf6ceba56a0a5d5c61892b8f91f..3cf9bfb6decd70ea91223b845a828d2eac45bb87 100644 (file)
@@ -312,7 +312,7 @@ struct validate_context {
 
        /* The output from BW and WM calculations. */
        struct bw_calcs_output bw_results;
-       /* Note: this is a big structure, do *not* put on stack! */
+       /* Note: these are big structures, do *not* put on stack! */
        struct dm_pp_display_configuration pp_display_cfg;
 };