Moved common code to check gamma_enable to specific funcs per platform
in bit_precision func. icl doesn't support that and chv has separate
enable knob for CGM LUT.

Signed-off-by: Swati Sharma <swati2.sha...@intel.com>
---
 drivers/gpu/drm/i915/display/intel_color.c | 23 +++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_color.c 
b/drivers/gpu/drm/i915/display/intel_color.c
index 8f02313a7fef..44ce75f051ad 100644
--- a/drivers/gpu/drm/i915/display/intel_color.c
+++ b/drivers/gpu/drm/i915/display/intel_color.c
@@ -1420,6 +1420,9 @@ static int icl_color_check(struct intel_crtc_state 
*crtc_state)
 
 static int i9xx_gamma_precision(const struct intel_crtc_state *crtc_state)
 {
+       if (!crtc_state->gamma_enable)
+               return 0;
+
        switch (crtc_state->gamma_mode) {
        case GAMMA_MODE_MODE_8BIT:
                return 8;
@@ -1433,6 +1436,9 @@ static int i9xx_gamma_precision(const struct 
intel_crtc_state *crtc_state)
 
 static int ilk_gamma_precision(const struct intel_crtc_state *crtc_state)
 {
+       if (!crtc_state->gamma_enable)
+               return 0;
+
        if ((crtc_state->csc_mode & CSC_POSITION_BEFORE_GAMMA) == 0)
                return 0;
 
@@ -1449,14 +1455,24 @@ static int ilk_gamma_precision(const struct 
intel_crtc_state *crtc_state)
 
 static int chv_gamma_precision(const struct intel_crtc_state *crtc_state)
 {
-       if (crtc_state->cgm_mode & CGM_PIPE_MODE_GAMMA)
-               return 10;
+       if (crtc_state->cgm_mode) {
+               if ((crtc_state->cgm_mode & CGM_PIPE_MODE_GAMMA) == 0)
+                       return 0;
+               else
+                       return 10;
+       }
+
+       if (!crtc_state->gamma_enable)
+               return 0;
        else
                return i9xx_gamma_precision(crtc_state);
 }
 
 static int glk_gamma_precision(const struct intel_crtc_state *crtc_state)
 {
+       if (!crtc_state->gamma_enable)
+               return 0;
+
        switch (crtc_state->gamma_mode) {
        case GAMMA_MODE_MODE_8BIT:
                return 8;
@@ -1473,9 +1489,6 @@ int intel_color_get_gamma_bit_precision(const struct 
intel_crtc_state *crtc_stat
        struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
        struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 
-       if (!crtc_state->gamma_enable)
-               return 0;
-
        if (HAS_GMCH(dev_priv)) {
                if (IS_CHERRYVIEW(dev_priv))
                        return chv_gamma_precision(crtc_state);
-- 
2.23.0

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

Reply via email to