drm/amd/display: Fix writeback_info never got updated
authorAlex Hung <alex.hung@amd.com>
Fri, 5 May 2023 20:14:38 +0000 (14:14 -0600)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 3 Oct 2023 19:42:20 +0000 (15:42 -0400)
[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.

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 8b7f138bce0f3da2f5e9e97b200807655fc40d4d..76ed7a6fd92d6112a2573de0cbecbf7d04fb6901 100644 (file)
@@ -558,18 +558,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],