drm/amd/display: Fix writeback_info is not removed
authorAlex Hung <alex.hung@amd.com>
Fri, 19 May 2023 23:14:30 +0000 (17:14 -0600)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 3 Oct 2023 19:42:32 +0000 (15:42 -0400)
[WHY]
Counter j was not updated to present the num of writeback_info when
writeback pipes are removed.

[HOW]
update j (num of writeback info) under the correct condition.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc_stream.c

index 76ed7a6fd92d6112a2573de0cbecbf7d04fb6901..2bfe8d98507e15ac743202f38576f52d27c6b04f 100644 (file)
@@ -565,11 +565,12 @@ bool dc_stream_remove_writeback(struct dc *dc,
                        if (stream->writeback_info[i].dwb_pipe_inst == dwb_pipe_inst)
                                stream->writeback_info[i].wb_enabled = false;
 
-                       if (j < i)
-                               /* trim the array */
+                       /* trim the array */
+                       if (j < i) {
                                memcpy(&stream->writeback_info[j], &stream->writeback_info[i],
                                                sizeof(struct dc_writeback_info));
-                       j++;
+                               j++;
+                       }
                }
        }
        stream->num_wb_info = j;