The new FIXED_MATRIX colorop was introduced to DRM and this is now the
first operation of the AMD color pipeline, but KUnit tests weren't
updated accordingly. Add the new colorop as expected when testing
colorops of the AMD color pipeline. Also fix the colorop sequence in
comments.

Fixes: 941222175d21 ("drm/amd/display: Implement fixed matrix colorop color 
space mapping")
Signed-off-by: Melissa Wen <[email protected]>
---
 .../amdgpu_dm/tests/amdgpu_dm_color_test.c    | 50 +++++++++++++------
 1 file changed, 35 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_color_test.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_color_test.c
index 8c2f7ab5f8d3..d2ae35bf550f 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_color_test.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_color_test.c
@@ -2495,6 +2495,7 @@ dm_test_colorop_pipeline_setup(struct kunit *test,
 static void dm_test_update_plane_color_mgmt_colorop_bypass_pipeline(struct 
kunit *test)
 {
        static const enum drm_colorop_type types[] = {
+               DRM_COLOROP_FIXED_MATRIX,
                DRM_COLOROP_1D_CURVE,
                DRM_COLOROP_MULTIPLIER,
                DRM_COLOROP_CTM_3X4,
@@ -2508,6 +2509,7 @@ static void 
dm_test_update_plane_color_mgmt_colorop_bypass_pipeline(struct kunit
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
+               DRM_COLOROP_1D_CURVE_SRGB_EOTF,
                DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF,
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
@@ -2515,7 +2517,7 @@ static void 
dm_test_update_plane_color_mgmt_colorop_bypass_pipeline(struct kunit
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
        };
        static const bool bypass[] = {
-               true, true, true, true, true, true, true, true,
+               true, true, true, true, true, true, true, true, true,
        };
        struct dm_test_color_update_fixture f = 
dm_test_color_update_setup(test);
 
@@ -2532,16 +2534,20 @@ static void 
dm_test_update_plane_color_mgmt_colorop_bypass_pipeline(struct kunit
 }
 
 /**
- * dm_test_update_plane_color_mgmt_colorop_missing_multiplier - missing second 
op falls back
+ * dm_test_update_plane_color_mgmt_colorop_missing_multiplier - missing 
multiplier op falls back
  * @test: KUnit test context
  */
 static void dm_test_update_plane_color_mgmt_colorop_missing_multiplier(struct 
kunit *test)
 {
-       static const enum drm_colorop_type types[] = { DRM_COLOROP_1D_CURVE };
+       static const enum drm_colorop_type types[] = {
+               DRM_COLOROP_FIXED_MATRIX,
+               DRM_COLOROP_1D_CURVE
+       };
        static const enum drm_colorop_curve_1d_type curves[] = {
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
+               DRM_COLOROP_1D_CURVE_SRGB_EOTF,
        };
-       static const bool bypass[] = { true };
+       static const bool bypass[] = { true, true };
        struct dm_test_color_update_fixture f = 
dm_test_color_update_setup(test);
 
        f.dm_plane_state->base.color_pipeline =
@@ -2555,20 +2561,22 @@ static void 
dm_test_update_plane_color_mgmt_colorop_missing_multiplier(struct ku
 }
 
 /**
- * dm_test_update_plane_color_mgmt_colorop_missing_3x4 - missing third op 
falls back
+ * dm_test_update_plane_color_mgmt_colorop_missing_3x4 - missing 3x4 op falls 
back
  * @test: KUnit test context
  */
 static void dm_test_update_plane_color_mgmt_colorop_missing_3x4(struct kunit 
*test)
 {
        static const enum drm_colorop_type types[] = {
+               DRM_COLOROP_FIXED_MATRIX,
                DRM_COLOROP_1D_CURVE,
                DRM_COLOROP_MULTIPLIER,
        };
        static const enum drm_colorop_curve_1d_type curves[] = {
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
+               DRM_COLOROP_1D_CURVE_SRGB_EOTF,
        };
-       static const bool bypass[] = { true, true };
+       static const bool bypass[] = { true, true, true };
        struct dm_test_color_update_fixture f = 
dm_test_color_update_setup(test);
 
        f.dm_plane_state->base.color_pipeline =
@@ -2591,6 +2599,7 @@ static void 
dm_test_update_plane_color_mgmt_colorop_missing_3x4(struct kunit *te
 static void dm_test_update_plane_color_mgmt_colorop_truncated(struct kunit 
*test)
 {
        static const enum drm_colorop_type types[] = {
+               DRM_COLOROP_FIXED_MATRIX,
                DRM_COLOROP_1D_CURVE,
                DRM_COLOROP_MULTIPLIER,
                DRM_COLOROP_CTM_3X4,
@@ -2603,13 +2612,14 @@ static void 
dm_test_update_plane_color_mgmt_colorop_truncated(struct kunit *test
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
+               DRM_COLOROP_1D_CURVE_SRGB_EOTF,
                DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF,
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
        };
        static const bool bypass[] = {
-               true, true, true, true, true, true, true,
+               true, true, true, true, true, true, true, true,
        };
        struct dm_test_color_update_fixture f = 
dm_test_color_update_setup(test);
        struct dc_plane_state *dc_plane_state = f.dc_plane_state;
@@ -2639,6 +2649,7 @@ static void 
dm_test_update_plane_color_mgmt_colorop_truncated(struct kunit *test
 static void dm_test_update_plane_color_mgmt_colorop_no_3dlut_hw(struct kunit 
*test)
 {
        static const enum drm_colorop_type types[] = {
+               DRM_COLOROP_FIXED_MATRIX,
                DRM_COLOROP_1D_CURVE,
                DRM_COLOROP_MULTIPLIER,
                DRM_COLOROP_CTM_3X4,
@@ -2657,9 +2668,10 @@ static void 
dm_test_update_plane_color_mgmt_colorop_no_3dlut_hw(struct kunit *te
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
+               DRM_COLOROP_1D_CURVE_SRGB_EOTF,
        };
        static const bool bypass[] = {
-               true, true, true, true, true, false, true, true,
+               true, true, true, true, true, true, false, true, true,
        };
        struct dm_test_color_update_fixture f = 
dm_test_color_update_setup(test);
 
@@ -2683,6 +2695,7 @@ static void 
dm_test_update_plane_color_mgmt_colorop_no_3dlut_hw(struct kunit *te
 static void dm_test_update_plane_color_mgmt_colorop_shaper(struct kunit *test)
 {
        static const enum drm_colorop_type types[] = {
+               DRM_COLOROP_FIXED_MATRIX,
                DRM_COLOROP_1D_CURVE,
                DRM_COLOROP_MULTIPLIER,
                DRM_COLOROP_CTM_3X4,
@@ -2696,6 +2709,7 @@ static void 
dm_test_update_plane_color_mgmt_colorop_shaper(struct kunit *test)
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
+               DRM_COLOROP_1D_CURVE_SRGB_EOTF,
                DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF,
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
@@ -2703,7 +2717,7 @@ static void 
dm_test_update_plane_color_mgmt_colorop_shaper(struct kunit *test)
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
        };
        static const bool bypass[] = {
-               true, true, true, false, false, true, true, true,
+               true, true, true, true, false, false, true, true, true,
        };
        struct dm_test_color_update_fixture f = 
dm_test_color_update_setup(test);
        struct drm_colorop_state *shaper_lut_state;
@@ -2715,7 +2729,7 @@ static void 
dm_test_update_plane_color_mgmt_colorop_shaper(struct kunit *test)
        f.dm_plane_state->base.color_pipeline =
                dm_test_colorop_pipeline_setup(test, &f, types, curves, bypass,
                                               ARRAY_SIZE(types));
-       shaper_lut_state = f.state->colorops[4].new_state;
+       shaper_lut_state = f.state->colorops[5].new_state;
        blob = kunit_kzalloc(test, sizeof(*blob), GFP_KERNEL);
        KUNIT_ASSERT_NOT_NULL(test, blob);
        blob->length = MAX_COLOR_LUT_ENTRIES * sizeof(struct drm_color_lut32);
@@ -2738,6 +2752,7 @@ static void 
dm_test_update_plane_color_mgmt_colorop_shaper(struct kunit *test)
 static void dm_test_update_plane_color_mgmt_colorop_3dlut(struct kunit *test)
 {
        static const enum drm_colorop_type types[] = {
+               DRM_COLOROP_FIXED_MATRIX,
                DRM_COLOROP_1D_CURVE,
                DRM_COLOROP_MULTIPLIER,
                DRM_COLOROP_CTM_3X4,
@@ -2751,6 +2766,7 @@ static void 
dm_test_update_plane_color_mgmt_colorop_3dlut(struct kunit *test)
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
+               DRM_COLOROP_1D_CURVE_SRGB_EOTF,
                DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF,
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
@@ -2758,7 +2774,7 @@ static void 
dm_test_update_plane_color_mgmt_colorop_3dlut(struct kunit *test)
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
        };
        static const bool bypass[] = {
-               true, true, true, true, true, false, true, true,
+               true, true, true, true, true, true, false, true, true,
        };
        struct dm_test_color_update_fixture f = 
dm_test_color_update_setup(test);
        struct drm_colorop_state *lut3d_state;
@@ -2770,7 +2786,7 @@ static void 
dm_test_update_plane_color_mgmt_colorop_3dlut(struct kunit *test)
        f.dm_plane_state->base.color_pipeline =
                dm_test_colorop_pipeline_setup(test, &f, types, curves, bypass,
                                               ARRAY_SIZE(types));
-       lut3d_state = f.state->colorops[5].new_state;
+       lut3d_state = f.state->colorops[6].new_state;
        blob = kunit_kzalloc(test, sizeof(*blob), GFP_KERNEL);
        KUNIT_ASSERT_NOT_NULL(test, blob);
        blob->length = 5 * sizeof(struct drm_color_lut32);
@@ -2795,6 +2811,7 @@ static void 
dm_test_update_plane_color_mgmt_colorop_3dlut(struct kunit *test)
 static void dm_test_update_plane_color_mgmt_colorop_3dlut_no_data(struct kunit 
*test)
 {
        static const enum drm_colorop_type types[] = {
+               DRM_COLOROP_FIXED_MATRIX,
                DRM_COLOROP_1D_CURVE,
                DRM_COLOROP_MULTIPLIER,
                DRM_COLOROP_CTM_3X4,
@@ -2808,6 +2825,7 @@ static void 
dm_test_update_plane_color_mgmt_colorop_3dlut_no_data(struct kunit *
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
+               DRM_COLOROP_1D_CURVE_SRGB_EOTF,
                DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF,
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
@@ -2815,7 +2833,7 @@ static void 
dm_test_update_plane_color_mgmt_colorop_3dlut_no_data(struct kunit *
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
        };
        static const bool bypass[] = {
-               true, true, true, true, true, false, true, true,
+               true, true, true, true, true, true, false, true, true,
        };
        struct dm_test_color_update_fixture f = 
dm_test_color_update_setup(test);
        struct drm_plane_state *plane_state = &f.dm_plane_state->base;
@@ -2839,6 +2857,7 @@ static void 
dm_test_update_plane_color_mgmt_colorop_3dlut_no_data(struct kunit *
 static void dm_test_update_plane_color_mgmt_colorop_blend(struct kunit *test)
 {
        static const enum drm_colorop_type types[] = {
+               DRM_COLOROP_FIXED_MATRIX,
                DRM_COLOROP_1D_CURVE,
                DRM_COLOROP_MULTIPLIER,
                DRM_COLOROP_CTM_3X4,
@@ -2851,8 +2870,9 @@ static void 
dm_test_update_plane_color_mgmt_colorop_blend(struct kunit *test)
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
                DRM_COLOROP_1D_CURVE_SRGB_EOTF,
+               DRM_COLOROP_1D_CURVE_SRGB_EOTF,
        };
-       static const bool bypass[] = { true, true, true, false, false };
+       static const bool bypass[] = { true, true, true, true, false, false };
        struct dm_test_color_update_fixture f = 
dm_test_color_update_setup(test);
        struct drm_colorop_state *blend_lut_state;
        struct drm_plane_state *plane_state = &f.dm_plane_state->base;
@@ -2862,7 +2882,7 @@ static void 
dm_test_update_plane_color_mgmt_colorop_blend(struct kunit *test)
        f.dm_plane_state->base.color_pipeline =
                dm_test_colorop_pipeline_setup(test, &f, types, curves, bypass,
                                               ARRAY_SIZE(types));
-       blend_lut_state = f.state->colorops[4].new_state;
+       blend_lut_state = f.state->colorops[5].new_state;
        blob = kunit_kzalloc(test, sizeof(*blob), GFP_KERNEL);
        KUNIT_ASSERT_NOT_NULL(test, blob);
        blob->length = MAX_COLOR_LUT_ENTRIES * sizeof(struct drm_color_lut32);
-- 
2.53.0

Reply via email to