Skip to content

Commit 8a51cc0

Browse files
charliu-AMDENGalexdeucher
authored andcommitted
drm/amd/display: Add logging resource checks
[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>
1 parent aa36d89 commit 8a51cc0

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

drivers/gpu/drm/amd/display/dc/core/dc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3522,7 +3522,7 @@ static void commit_planes_for_stream(struct dc *dc,
35223522
top_pipe_to_program = resource_get_otg_master_for_stream(
35233523
&context->res_ctx,
35243524
stream);
3525-
3525+
ASSERT(top_pipe_to_program != NULL);
35263526
for (i = 0; i < dc->res_pool->pipe_count; i++) {
35273527
struct pipe_ctx *old_pipe = &dc->current_state->res_ctx.pipe_ctx[i];
35283528

@@ -4345,6 +4345,8 @@ static bool should_commit_minimal_transition_for_windowed_mpo_odm(struct dc *dc,
43454345

43464346
cur_pipe = resource_get_otg_master_for_stream(&dc->current_state->res_ctx, stream);
43474347
new_pipe = resource_get_otg_master_for_stream(&context->res_ctx, stream);
4348+
if (!cur_pipe || !new_pipe)
4349+
return false;
43484350
cur_is_odm_in_use = resource_get_odm_slice_count(cur_pipe) > 1;
43494351
new_is_odm_in_use = resource_get_odm_slice_count(new_pipe) > 1;
43504352
if (cur_is_odm_in_use == new_is_odm_in_use)

drivers/gpu/drm/amd/display/dc/core/dc_resource.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2194,6 +2194,10 @@ void resource_log_pipe_topology_update(struct dc *dc, struct dc_state *state)
21942194
for (stream_idx = 0; stream_idx < state->stream_count; stream_idx++) {
21952195
otg_master = resource_get_otg_master_for_stream(
21962196
&state->res_ctx, state->streams[stream_idx]);
2197+
if (!otg_master || otg_master->stream_res.tg == NULL) {
2198+
DC_LOG_DC("topology update: otg_master NULL stream_idx %d!\n", stream_idx);
2199+
return;
2200+
}
21972201
slice_count = resource_get_opp_heads_for_otg_master(otg_master,
21982202
&state->res_ctx, opp_heads);
21992203
for (slice_idx = 0; slice_idx < slice_count; slice_idx++) {

drivers/gpu/drm/amd/display/dc/core/dc_state.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,9 @@ bool dc_state_add_plane(
434434

435435
otg_master_pipe = resource_get_otg_master_for_stream(
436436
&state->res_ctx, stream);
437-
added = resource_append_dpp_pipes_for_plane_composition(state,
438-
dc->current_state, pool, otg_master_pipe, plane_state);
437+
if (otg_master_pipe)
438+
added = resource_append_dpp_pipes_for_plane_composition(state,
439+
dc->current_state, pool, otg_master_pipe, plane_state);
439440

440441
if (added) {
441442
stream_status->plane_states[stream_status->plane_count] =

0 commit comments

Comments
 (0)