drm/amd/display: Fix writeback_info is not removed
authorAlex Hung <alex.hung@amd.com>
Fri, 1 Dec 2023 13:25:35 +0000 (06:25 -0700)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 6 Dec 2023 20:22:35 +0000 (15:22 -0500)
[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.

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 8e7bc4a30f271b8d5ce95ad101d88cb035a61622..3dd9f4ab2261f5d43761ffeee1d11ae93551c3ae 100644 (file)
@@ -516,11 +516,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;