]> git.hungrycats.org Git - linux/commit
drm/amd/display: Add KUnit tests for color LUT functions
authorAlex Hung <alex.hung@amd.com>
Thu, 14 May 2026 18:35:33 +0000 (12:35 -0600)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 3 Jun 2026 17:40:08 +0000 (13:40 -0400)
commitf602089acd9c55bdf4e04cf25462307c26eb9c8c
tree07295b0e4b5c0494f779dd478f9d4de35ba24653
parentc2572d535be4847f8caba58b4ee8446b4ee15b57
drm/amd/display: Add KUnit tests for color LUT functions

[Why]
Add KUnit tests for three color management functions in
amdgpu_dm_color.c: amdgpu_dm_verify_lut_sizes,
amdgpu_dm_atomic_lut3d, and __set_colorop_3dlut.

[How]
Export amdgpu_dm_verify_lut_sizes with EXPORT_IF_KUNIT. Change
amdgpu_dm_atomic_lut3d and __set_colorop_3dlut from static to
STATIC_IFN_KUNIT and export them with EXPORT_IF_KUNIT. Add their
prototypes to amdgpu_dm_color.h inside the KUnit guard block.

Implement 14 test cases in amdgpu_dm_color_test.c:
- 8 tests for amdgpu_dm_verify_lut_sizes covering null LUTs,
  valid and invalid degamma/gamma sizes, both valid, and priority
- 3 tests for amdgpu_dm_atomic_lut3d covering zero size clearing
  initialized state, nonzero setting state bits and mode flags,
  and LUT data forwarding to tetrahedral_17
- 3 tests for __set_colorop_3dlut covering zero size returning
  -EINVAL and clearing initialized state, nonzero returning 0
  and setting state bits, and 32-bit LUT data forwarding to
  tetrahedral_17

Assisted-by: Copilot:Claude-Sonnet-4.6
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Ray Wu <ray.wu@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.h
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_color_test.c