[v3,7/7] drm/i915: Enable advance gamma mode
diff mbox series

Message ID 1555064463-18479-8-git-send-email-uma.shankar@intel.com
State New
Headers show
Series
  • Add Multi Segment Gamma Support
Related show

Commit Message

Shankar, Uma April 12, 2019, 10:21 a.m. UTC
Enable advance gamma modes based on client
caps.

Signed-off-by: Uma Shankar <uma.shankar@intel.com>
---
 drivers/gpu/drm/i915/intel_color.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

Patch
diff mbox series

diff --git a/drivers/gpu/drm/i915/intel_color.c b/drivers/gpu/drm/i915/intel_color.c
index edf5ff8..36604c16 100644
--- a/drivers/gpu/drm/i915/intel_color.c
+++ b/drivers/gpu/drm/i915/intel_color.c
@@ -926,8 +926,9 @@  static void icl_load_luts(const struct intel_crtc_state *crtc_state)
 	if ((crtc_state->gamma_mode & GAMMA_MODE_MODE_MASK) ==
 	    GAMMA_MODE_MODE_8BIT) {
 		i9xx_load_luts(crtc_state);
-	} else if (crtc_state->base.gamma_mode_type ==
-		   MULTI_SEGMENTED_GAMMA_MODE_12BIT) {
+	} else if ((crtc_state->base.gamma_mode_type ==
+		   MULTI_SEGMENTED_GAMMA_MODE_12BIT) &&
+		  crtc_state->base.advance_gamma_mode_active) {
 		icl_load_gamma_multi_segmented_lut(crtc_state, 0);
 	} else {
 		bdw_load_lut_10(crtc, gamma_lut, PAL_PREC_INDEX_VALUE(0));
@@ -1352,12 +1353,13 @@  static u32 icl_gamma_mode(struct intel_crtc_state *crtc_state)
 	    !crtc_state->c8_planes)
 		gamma_mode |= POST_CSC_GAMMA_ENABLE;
 
-	if (!crtc_state->base.gamma_lut ||
-	    crtc_state_is_legacy_gamma(crtc_state))
-		gamma_mode |= GAMMA_MODE_MODE_8BIT;
-	else if (crtc_state->base.gamma_mode_type ==
-		 MULTI_SEGMENTED_GAMMA_MODE_12BIT)
+	if (crtc_state->base.gamma_mode_type ==
+		MULTI_SEGMENTED_GAMMA_MODE_12BIT &&
+	     crtc_state->base.advance_gamma_mode_active)
 		gamma_mode |= GAMMA_MODE_MODE_12BIT_MULTI_SEGMENTED;
+	else if (!crtc_state->base.gamma_lut ||
+		 crtc_state_is_legacy_gamma(crtc_state))
+		gamma_mode |= GAMMA_MODE_MODE_8BIT;
 	else
 		gamma_mode |= GAMMA_MODE_MODE_10BIT;