drm/amd/display: Fix writeback_info never got updated
authorAlex Hung <alex.hung@amd.com>
Fri, 1 Dec 2023 13:25:33 +0000 (06:25 -0700)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 6 Dec 2023 20:22:35 +0000 (15:22 -0500)
[WHY]
wb_enabled field is set to false before it is used, and the following
code will never be executed.

[HOW]
Setting wb_enable to false after all removal work is completed.

Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
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 e71d622098d7f5f19e621ef61032d29441ceddb7..8e7bc4a30f271b8d5ce95ad101d88cb035a61622 100644 (file)
@@ -509,18 +509,13 @@ bool dc_stream_remove_writeback(struct dc *dc,
                return false;
        }
 
-//     stream->writeback_info[dwb_pipe_inst].wb_enabled = false;
-       for (i = 0; i < stream->num_wb_info; i++) {
-               /*dynamic update*/
-               if (stream->writeback_info[i].wb_enabled &&
-                       stream->writeback_info[i].dwb_pipe_inst == dwb_pipe_inst) {
-                       stream->writeback_info[i].wb_enabled = false;
-               }
-       }
-
        /* remove writeback info for disabled writeback pipes from stream */
        for (i = 0, j = 0; i < stream->num_wb_info; i++) {
                if (stream->writeback_info[i].wb_enabled) {
+
+                       if (stream->writeback_info[i].dwb_pipe_inst == dwb_pipe_inst)
+                               stream->writeback_info[i].wb_enabled = false;
+
                        if (j < i)
                                /* trim the array */
                                memcpy(&stream->writeback_info[j], &stream->writeback_info[i],