]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/amd/display: Add logging resource checks
authorCharlene Liu <charlene.liu@amd.com>
Thu, 28 Dec 2023 18:19:33 +0000 (13:19 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 18 Jan 2024 21:30:40 +0000 (16:30 -0500)
[Why]
When mapping resources, resources could be unavailable.

Cc: Mario Limonciello <mario.limonciello@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Reviewed-by: Sung joon Kim <sungjoon.kim@amd.com>
Acked-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Charlene Liu <charlene.liu@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.c
drivers/gpu/drm/amd/display/dc/core/dc_resource.c
drivers/gpu/drm/amd/display/dc/core/dc_state.c

index 69e726630241dc41fd26c0f3f7f76d84443959da..aa7c02ba948e9ce63aa84eb7518f9c73c80d107a 100644 (file)
@@ -3522,7 +3522,7 @@ static void commit_planes_for_stream(struct dc *dc,
        top_pipe_to_program = resource_get_otg_master_for_stream(
                                &context->res_ctx,
                                stream);
-
+       ASSERT(top_pipe_to_program != NULL);
        for (i = 0; i < dc->res_pool->pipe_count; i++) {
                struct pipe_ctx *old_pipe = &dc->current_state->res_ctx.pipe_ctx[i];
 
@@ -4345,6 +4345,8 @@ static bool should_commit_minimal_transition_for_windowed_mpo_odm(struct dc *dc,
 
        cur_pipe = resource_get_otg_master_for_stream(&dc->current_state->res_ctx, stream);
        new_pipe = resource_get_otg_master_for_stream(&context->res_ctx, stream);
+       if (!cur_pipe || !new_pipe)
+               return false;
        cur_is_odm_in_use = resource_get_odm_slice_count(cur_pipe) > 1;
        new_is_odm_in_use = resource_get_odm_slice_count(new_pipe) > 1;
        if (cur_is_odm_in_use == new_is_odm_in_use)
index f2abc1096ffb61b769d6de879d701dbcfcc2298b..9fbdb09697fd5ea16abe86e4f970e80fb764ff7f 100644 (file)
@@ -2194,6 +2194,10 @@ void resource_log_pipe_topology_update(struct dc *dc, struct dc_state *state)
        for (stream_idx = 0; stream_idx < state->stream_count; stream_idx++) {
                otg_master = resource_get_otg_master_for_stream(
                                &state->res_ctx, state->streams[stream_idx]);
+               if (!otg_master || otg_master->stream_res.tg == NULL) {
+                       DC_LOG_DC("topology update: otg_master NULL stream_idx %d!\n", stream_idx);
+                       return;
+               }
                slice_count = resource_get_opp_heads_for_otg_master(otg_master,
                                &state->res_ctx, opp_heads);
                for (slice_idx = 0; slice_idx < slice_count; slice_idx++) {
index 56feee0ff01b1ef168c64d183454964e06de0e35..88c6436b28b69ca7f4791bdc47404cd5f73a5f83 100644 (file)
@@ -434,8 +434,9 @@ bool dc_state_add_plane(
 
        otg_master_pipe = resource_get_otg_master_for_stream(
                        &state->res_ctx, stream);
-       added = resource_append_dpp_pipes_for_plane_composition(state,
-                       dc->current_state, pool, otg_master_pipe, plane_state);
+       if (otg_master_pipe)
+               added = resource_append_dpp_pipes_for_plane_composition(state,
+                               dc->current_state, pool, otg_master_pipe, plane_state);
 
        if (added) {
                stream_status->plane_states[stream_status->plane_count] =