]> www.infradead.org Git - users/willy/xarray.git/commitdiff
drm/amd/display: Query all entries in assignment table during updates.
authorJimmy Kizito <Jimmy.Kizito@amd.com>
Thu, 4 Nov 2021 20:52:13 +0000 (16:52 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 17 Nov 2021 21:58:10 +0000 (16:58 -0500)
[Why]
Stream ordering and count can vary from one state to the next. Only
checking a subset of entries in the encoder assignment table can lead to
invalid encoder assignments.

[How]
Check all entries in encoder assignment table when querying it.

Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Anson Jacob <Anson.Jacob@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Jimmy Kizito <Jimmy.Kizito@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc_link_enc_cfg.c

index b96e301f64f293679e9d9840b8aab9bcc0407d68..787aaa661a29d48355e0c723012b773ad4b4d171 100644 (file)
@@ -232,7 +232,7 @@ static struct link_encoder *get_link_enc_used_by_link(
                .link_id = link->link_id,
                .ep_type = link->ep_type};
 
-       for (i = 0; i < state->stream_count; i++) {
+       for (i = 0; i < MAX_PIPES; i++) {
                struct link_enc_assignment assignment = state->res_ctx.link_enc_cfg_ctx.link_enc_assignments[i];
 
                if (assignment.valid == true && are_ep_ids_equal(&assignment.ep_id, &ep_id))
@@ -538,6 +538,7 @@ bool link_enc_cfg_validate(struct dc *dc, struct dc_state *state)
        uint8_t dig_stream_count = 0;
        int matching_stream_ptrs = 0;
        int eng_ids_per_ep_id[MAX_PIPES] = {0};
+       int valid_bitmap = 0;
 
        /* (1) No. valid entries same as stream count. */
        for (i = 0; i < MAX_PIPES; i++) {
@@ -619,5 +620,15 @@ bool link_enc_cfg_validate(struct dc *dc, struct dc_state *state)
        is_valid = valid_entries && valid_stream_ptrs && valid_uniqueness && valid_avail && valid_streams;
        ASSERT(is_valid);
 
+       if (is_valid == false) {
+               valid_bitmap =
+                       (valid_entries & 0x1) |
+                       ((valid_stream_ptrs & 0x1) << 1) |
+                       ((valid_uniqueness & 0x1) << 2) |
+                       ((valid_avail & 0x1) << 3) |
+                       ((valid_streams & 0x1) << 4);
+               dm_error("Invalid link encoder assignments: 0x%x\n", valid_bitmap);
+       }
+
        return is_valid;
 }