]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
drm/amd/display: Optimize remove_duplicates() from O(N^2) to O(N)
authorKuan-Wei Chiu <visitorckw@gmail.com>
Tue, 9 Sep 2025 09:20:57 +0000 (17:20 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 23 Sep 2025 14:36:53 +0000 (10:36 -0400)
commit43f06e8165c4f6e16ab32ede845171ac66d4eaaa
treeb0cc75df5b32a420a5b53e725e42bb7686d6f461
parent51cb93aa0c4a9bb126b76f6e9fd640d88de25cee
drm/amd/display: Optimize remove_duplicates() from O(N^2) to O(N)

Replace the previous O(N^2) implementation of remove_duplicates() with
a O(N) version using a fast/slow pointer approach. The new version
keeps only the first occurrence of each element and compacts the array
in place, improving efficiency without changing functionality.

Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
Reviewed-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_pmo/dml2_pmo_dcn3.c