From: "Leo (Sunpeng) Li" <sunpeng...@amd.com>

Change-Id: If0205a3552cfd74a06511f595e5d1b6be5b655e8
Signed-off-by: Leo (Sunpeng) Li <sunpeng...@amd.com>
Reviewed-by: Harry Wentland <harry.wentl...@amd.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c       |  5 +++--
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h       |  2 ++
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c | 11 +++++------
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 9212964a1246..b632be5203b8 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -3233,8 +3233,9 @@ static int amdgpu_dm_crtc_init(struct 
amdgpu_display_manager *dm,
        acrtc->base.enabled = false;
 
        dm->adev->mode_info.crtcs[crtc_index] = acrtc;
-       drm_crtc_enable_color_mgmt(&acrtc->base, 256, true, 256);
-       drm_mode_crtc_set_gamma_size(&acrtc->base, 256);
+       drm_crtc_enable_color_mgmt(&acrtc->base, MAX_COLOR_LUT_ENTRIES,
+                                  true, MAX_COLOR_LUT_ENTRIES);
+       drm_mode_crtc_set_gamma_size(&acrtc->base, MAX_COLOR_LUT_ENTRIES);
 
        return 0;
 
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
index 7e5d5cd40680..c40c13a9f614 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
@@ -269,6 +269,8 @@ void amdgpu_dm_crtc_handle_crc_irq(struct drm_crtc *crtc);
 #define amdgpu_dm_crtc_handle_crc_irq(x)
 #endif
 
+#define MAX_COLOR_LUT_ENTRIES 256
+
 void amdgpu_dm_init_color_mod(void);
 int amdgpu_dm_set_degamma_lut(struct drm_crtc_state *crtc_state,
                              struct dc_plane_state *dc_plane_state);
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
index d7bc1b7dd152..62bb72fe9aa5 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
@@ -39,14 +39,13 @@ void amdgpu_dm_init_color_mod(void)
 }
 
 
-#define MAX_LUT_ENTRIES 256
-
 /*
  * Return true if the given lut is a linear mapping of values, i.e. it acts
  * like a bypass LUT.
  *
  * It is considered linear if the lut represents:
- * f(a) = (0xFF00/MAX_LUT_ENTRIES-1)a; for integer a in [0, MAX_LUT_ENTRIES)
+ * f(a) = (0xFF00/MAX_COLOR_LUT_ENTRIES-1)a; for integer a in
+ *                                           [0, MAX_COLOR_LUT_ENTRIES)
  */
 static bool __is_lut_linear(struct drm_color_lut *lut)
 {
@@ -55,12 +54,12 @@ static bool __is_lut_linear(struct drm_color_lut *lut)
        uint32_t expected;
        int delta;
 
-       for (i = 0; i < MAX_LUT_ENTRIES; i++) {
+       for (i = 0; i < MAX_COLOR_LUT_ENTRIES; i++) {
                /* All color values should equal */
                if ((lut[i].red != lut[i].green) || (lut[i].green != 
lut[i].blue))
                        return false;
 
-               expected = i * max_os / (MAX_LUT_ENTRIES-1);
+               expected = i * max_os / (MAX_COLOR_LUT_ENTRIES-1);
 
                /* Allow a +/-1 error. */
                delta = lut[i].red - expected;
@@ -113,7 +112,7 @@ int amdgpu_dm_set_regamma_lut(struct dm_crtc_state *crtc)
        if (!gamma)
                return -ENOMEM;
 
-       gamma->num_entries = MAX_LUT_ENTRIES;
+       gamma->num_entries = MAX_COLOR_LUT_ENTRIES;
        gamma->type = GAMMA_RGB_256;
 
        /* Truncate, and store in dc_gamma for output tf calculation */
-- 
2.14.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to