From: Alex Hung <[email protected]>

[WHAT]
Reduce the two KUnit tests for amdgpu_dm_plane_get_plane_formats() to
one.

[HOW]
Allocate a second plane cap with the DCN universal type in the existing
test and check the overlay format count against it, then drop the
standalone test.

Assisted-by: Copilot:Claude-Opus-5
Reviewed-by: Bhawanpreet Lakha <[email protected]>
Signed-off-by: Alex Hung <[email protected]>
Signed-off-by: George Zhang <[email protected]>
---
 .../amdgpu_dm/tests/amdgpu_dm_plane_test.c    | 39 ++++++-------------
 1 file changed, 11 insertions(+), 28 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c
index f60bb6239e53..8fcde1e55a31 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c
@@ -258,18 +258,23 @@ static void dm_test_modifier_gfx9_swizzle_mode(struct 
kunit *test)
  * dm_test_get_plane_formats() - Verify plane format counts for key plane 
types.
  * @test: KUnit test context.
  *
- * Verify if returned format counts match primary, overlay, and cursor planes.
+ * Verify if returned format counts match primary, overlay, and cursor planes,
+ * and if an overlay with a DCN universal plane cap reports the RGB list
+ * instead of the overlay-only list.
  */
 static void dm_test_get_plane_formats(struct kunit *test)
 {
        struct drm_plane *plane;
        struct dc_plane_cap *cap;
+       struct dc_plane_cap *universal_cap;
        uint32_t formats[32] = {0};
 
        plane = kunit_kzalloc(test, sizeof(*plane), GFP_KERNEL);
        cap = kunit_kzalloc(test, sizeof(*cap), GFP_KERNEL);
+       universal_cap = kunit_kzalloc(test, sizeof(*universal_cap), GFP_KERNEL);
        KUNIT_ASSERT_NOT_NULL(test, plane);
        KUNIT_ASSERT_NOT_NULL(test, cap);
+       KUNIT_ASSERT_NOT_NULL(test, universal_cap);
 
        plane->type = DRM_PLANE_TYPE_PRIMARY;
        KUNIT_EXPECT_EQ(test, amdgpu_dm_plane_get_plane_formats(plane, NULL, 
formats, 32), 14);
@@ -282,6 +287,11 @@ static void dm_test_get_plane_formats(struct kunit *test)
        plane->type = DRM_PLANE_TYPE_OVERLAY;
        KUNIT_EXPECT_EQ(test, amdgpu_dm_plane_get_plane_formats(plane, NULL, 
formats, 32), 9);
 
+       universal_cap->type = DC_PLANE_TYPE_DCN_UNIVERSAL;
+       KUNIT_EXPECT_EQ(test,
+                       amdgpu_dm_plane_get_plane_formats(plane, universal_cap, 
formats, 32),
+                       14);
+
        plane->type = DRM_PLANE_TYPE_CURSOR;
        KUNIT_EXPECT_EQ(test, amdgpu_dm_plane_get_plane_formats(plane, NULL, 
formats, 32), 1);
 }
@@ -1307,32 +1317,6 @@ static u64 dm_test_gfx11_dcc_4k_modifier(u32 
pipe_xor_bits, u32 pkrs, u32 tile)
               AMD_FMT_MOD_SET(DCC_MAX_COMPRESSED_BLOCK, 
AMD_FMT_MOD_DCC_BLOCK_64B);
 }
 
-/**
- * dm_test_get_plane_formats_overlay_universal_cap() - Verify universal 
overlay.
- * @test: KUnit test context.
- *
- * Verify if an overlay plane with a DCN universal plane cap reports the RGB
- * format list instead of the overlay-only list.
- */
-static void dm_test_get_plane_formats_overlay_universal_cap(struct kunit *test)
-{
-       struct drm_plane *plane;
-       struct dc_plane_cap *cap;
-       u32 formats[32] = {0};
-
-       plane = kunit_kzalloc(test, sizeof(*plane), GFP_KERNEL);
-       cap = kunit_kzalloc(test, sizeof(*cap), GFP_KERNEL);
-       KUNIT_ASSERT_NOT_NULL(test, plane);
-       KUNIT_ASSERT_NOT_NULL(test, cap);
-
-       plane->type = DRM_PLANE_TYPE_OVERLAY;
-       cap->type = DC_PLANE_TYPE_DCN_UNIVERSAL;
-
-       KUNIT_EXPECT_EQ(test,
-                       amdgpu_dm_plane_get_plane_formats(plane, cap, formats, 
32),
-                       14);
-}
-
 /**
  * dm_test_get_plane_modifiers_gfx9() - Verify GFX9 modifier list generation.
  * @test: KUnit test context.
@@ -3968,7 +3952,6 @@ static struct kunit_case amdgpu_dm_plane_test_cases[] = {
        KUNIT_CASE(dm_test_modifier_gfx9_swizzle_mode),
        /* amdgpu_dm_plane_get_plane_formats() */
        KUNIT_CASE(dm_test_get_plane_formats),
-       KUNIT_CASE(dm_test_get_plane_formats_overlay_universal_cap),
        /* amdgpu_dm_plane_get_plane_modifiers() */
        KUNIT_CASE(dm_test_get_plane_modifiers),
        KUNIT_CASE(dm_test_get_plane_modifiers_gfx6),
-- 
2.55.0

Reply via email to