Check that amdgpu_colorop_tf_to_dc_tf() maps the gamma 2.4 and 2.6
curves and their inverses to TRANSFER_FUNCTION_GAMMA24 and
TRANSFER_FUNCTION_GAMMA26.

Check that the degamma and blend masks include gamma 2.4 and 2.6, and
that the shaper mask includes their inverses. Update the
*_no_extra_bits cases for the new mask values.

Signed-off-by: Harry Wentland <[email protected]>
---
 .../amdgpu_dm/tests/amdgpu_dm_color_test.c    | 18 +++++++
 .../amdgpu_dm/tests/amdgpu_dm_colorop_test.c  | 54 +++++++++++++++++--
 2 files changed, 69 insertions(+), 3 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 7ad8c56cbcf3..7a2c137f2967 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
@@ -330,6 +330,22 @@ static void dm_test_colorop_tf_to_dc_tf_gamma22(struct 
kunit *test)
                        (int)TRANSFER_FUNCTION_GAMMA22);
 }
 
+static void dm_test_colorop_tf_to_dc_tf_gamma24(struct kunit *test)
+{
+       KUNIT_EXPECT_EQ(test, 
(int)amdgpu_colorop_tf_to_dc_tf(DRM_COLOROP_1D_CURVE_GAMMA24),
+                       (int)TRANSFER_FUNCTION_GAMMA24);
+       KUNIT_EXPECT_EQ(test, 
(int)amdgpu_colorop_tf_to_dc_tf(DRM_COLOROP_1D_CURVE_GAMMA24_INV),
+                       (int)TRANSFER_FUNCTION_GAMMA24);
+}
+
+static void dm_test_colorop_tf_to_dc_tf_gamma26(struct kunit *test)
+{
+       KUNIT_EXPECT_EQ(test, 
(int)amdgpu_colorop_tf_to_dc_tf(DRM_COLOROP_1D_CURVE_GAMMA26),
+                       (int)TRANSFER_FUNCTION_GAMMA26);
+       KUNIT_EXPECT_EQ(test, 
(int)amdgpu_colorop_tf_to_dc_tf(DRM_COLOROP_1D_CURVE_GAMMA26_INV),
+                       (int)TRANSFER_FUNCTION_GAMMA26);
+}
+
 static void dm_test_colorop_tf_to_dc_tf_default(struct kunit *test)
 {
        KUNIT_EXPECT_EQ(test, 
(int)amdgpu_colorop_tf_to_dc_tf(DRM_COLOROP_1D_CURVE_COUNT),
@@ -2928,6 +2944,8 @@ static struct kunit_case dm_color_test_cases[] = {
        KUNIT_CASE(dm_test_colorop_tf_to_dc_tf_pq),
        KUNIT_CASE(dm_test_colorop_tf_to_dc_tf_bt2020),
        KUNIT_CASE(dm_test_colorop_tf_to_dc_tf_gamma22),
+       KUNIT_CASE(dm_test_colorop_tf_to_dc_tf_gamma24),
+       KUNIT_CASE(dm_test_colorop_tf_to_dc_tf_gamma26),
        KUNIT_CASE(dm_test_colorop_tf_to_dc_tf_default),
        /* __drm_lut_to_dc_gamma */
        KUNIT_CASE(dm_test_drm_lut_to_dc_gamma_legacy_zero),
diff --git 
a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_colorop_test.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_colorop_test.c
index 27cd4b8500e8..9195a2c827ab 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_colorop_test.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_colorop_test.c
@@ -40,12 +40,26 @@ static void dm_test_supported_degam_tfs_has_gamma22(struct 
kunit *test)
                          BIT(DRM_COLOROP_1D_CURVE_GAMMA22));
 }
 
+static void dm_test_supported_degam_tfs_has_gamma24(struct kunit *test)
+{
+       KUNIT_EXPECT_TRUE(test, amdgpu_dm_supported_degam_tfs &
+                         BIT(DRM_COLOROP_1D_CURVE_GAMMA24));
+}
+
+static void dm_test_supported_degam_tfs_has_gamma26(struct kunit *test)
+{
+       KUNIT_EXPECT_TRUE(test, amdgpu_dm_supported_degam_tfs &
+                         BIT(DRM_COLOROP_1D_CURVE_GAMMA26));
+}
+
 static void dm_test_supported_degam_tfs_no_extra_bits(struct kunit *test)
 {
        u64 expected = BIT(DRM_COLOROP_1D_CURVE_SRGB_EOTF) |
                       BIT(DRM_COLOROP_1D_CURVE_PQ_125_EOTF) |
                       BIT(DRM_COLOROP_1D_CURVE_BT2020_INV_OETF) |
-                      BIT(DRM_COLOROP_1D_CURVE_GAMMA22);
+                      BIT(DRM_COLOROP_1D_CURVE_GAMMA22) |
+                      BIT(DRM_COLOROP_1D_CURVE_GAMMA24) |
+                      BIT(DRM_COLOROP_1D_CURVE_GAMMA26);
 
        KUNIT_EXPECT_EQ(test, amdgpu_dm_supported_degam_tfs, expected);
 }
@@ -76,12 +90,26 @@ static void 
dm_test_supported_shaper_tfs_has_gamma22_inv(struct kunit *test)
                          BIT(DRM_COLOROP_1D_CURVE_GAMMA22_INV));
 }
 
+static void dm_test_supported_shaper_tfs_has_gamma24_inv(struct kunit *test)
+{
+       KUNIT_EXPECT_TRUE(test, amdgpu_dm_supported_shaper_tfs &
+                         BIT(DRM_COLOROP_1D_CURVE_GAMMA24_INV));
+}
+
+static void dm_test_supported_shaper_tfs_has_gamma26_inv(struct kunit *test)
+{
+       KUNIT_EXPECT_TRUE(test, amdgpu_dm_supported_shaper_tfs &
+                         BIT(DRM_COLOROP_1D_CURVE_GAMMA26_INV));
+}
+
 static void dm_test_supported_shaper_tfs_no_extra_bits(struct kunit *test)
 {
        u64 expected = BIT(DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF) |
                       BIT(DRM_COLOROP_1D_CURVE_PQ_125_INV_EOTF) |
                       BIT(DRM_COLOROP_1D_CURVE_BT2020_OETF) |
-                      BIT(DRM_COLOROP_1D_CURVE_GAMMA22_INV);
+                      BIT(DRM_COLOROP_1D_CURVE_GAMMA22_INV) |
+                      BIT(DRM_COLOROP_1D_CURVE_GAMMA24_INV) |
+                      BIT(DRM_COLOROP_1D_CURVE_GAMMA26_INV);
 
        KUNIT_EXPECT_EQ(test, amdgpu_dm_supported_shaper_tfs, expected);
 }
@@ -112,12 +140,26 @@ static void dm_test_supported_blnd_tfs_has_gamma22(struct 
kunit *test)
                          BIT(DRM_COLOROP_1D_CURVE_GAMMA22));
 }
 
+static void dm_test_supported_blnd_tfs_has_gamma24(struct kunit *test)
+{
+       KUNIT_EXPECT_TRUE(test, amdgpu_dm_supported_blnd_tfs &
+                         BIT(DRM_COLOROP_1D_CURVE_GAMMA24));
+}
+
+static void dm_test_supported_blnd_tfs_has_gamma26(struct kunit *test)
+{
+       KUNIT_EXPECT_TRUE(test, amdgpu_dm_supported_blnd_tfs &
+                         BIT(DRM_COLOROP_1D_CURVE_GAMMA26));
+}
+
 static void dm_test_supported_blnd_tfs_no_extra_bits(struct kunit *test)
 {
        u64 expected = BIT(DRM_COLOROP_1D_CURVE_SRGB_EOTF) |
                       BIT(DRM_COLOROP_1D_CURVE_PQ_125_EOTF) |
                       BIT(DRM_COLOROP_1D_CURVE_BT2020_INV_OETF) |
-                      BIT(DRM_COLOROP_1D_CURVE_GAMMA22);
+                      BIT(DRM_COLOROP_1D_CURVE_GAMMA22) |
+                      BIT(DRM_COLOROP_1D_CURVE_GAMMA24) |
+                      BIT(DRM_COLOROP_1D_CURVE_GAMMA26);
 
        KUNIT_EXPECT_EQ(test, amdgpu_dm_supported_blnd_tfs, expected);
 }
@@ -497,18 +539,24 @@ static struct kunit_case dm_colorop_test_cases[] = {
        KUNIT_CASE(dm_test_supported_degam_tfs_has_pq125_eotf),
        KUNIT_CASE(dm_test_supported_degam_tfs_has_bt2020_inv_oetf),
        KUNIT_CASE(dm_test_supported_degam_tfs_has_gamma22),
+       KUNIT_CASE(dm_test_supported_degam_tfs_has_gamma24),
+       KUNIT_CASE(dm_test_supported_degam_tfs_has_gamma26),
        KUNIT_CASE(dm_test_supported_degam_tfs_no_extra_bits),
        /* shaper TFs */
        KUNIT_CASE(dm_test_supported_shaper_tfs_has_srgb_inv_eotf),
        KUNIT_CASE(dm_test_supported_shaper_tfs_has_pq125_inv_eotf),
        KUNIT_CASE(dm_test_supported_shaper_tfs_has_bt2020_oetf),
        KUNIT_CASE(dm_test_supported_shaper_tfs_has_gamma22_inv),
+       KUNIT_CASE(dm_test_supported_shaper_tfs_has_gamma24_inv),
+       KUNIT_CASE(dm_test_supported_shaper_tfs_has_gamma26_inv),
        KUNIT_CASE(dm_test_supported_shaper_tfs_no_extra_bits),
        /* blnd TFs */
        KUNIT_CASE(dm_test_supported_blnd_tfs_has_srgb_eotf),
        KUNIT_CASE(dm_test_supported_blnd_tfs_has_pq125_eotf),
        KUNIT_CASE(dm_test_supported_blnd_tfs_has_bt2020_inv_oetf),
        KUNIT_CASE(dm_test_supported_blnd_tfs_has_gamma22),
+       KUNIT_CASE(dm_test_supported_blnd_tfs_has_gamma24),
+       KUNIT_CASE(dm_test_supported_blnd_tfs_has_gamma26),
        KUNIT_CASE(dm_test_supported_blnd_tfs_no_extra_bits),
        /* cross-check */
        KUNIT_CASE(dm_test_degam_and_blnd_tfs_match),
-- 
2.56.1

Reply via email to