diff mbox series

[08/11] drm/i915: Reuse ilk_gamma_mode() on ivb+

Message ID 20221026113906.10551-9-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: More gamma work | expand

Commit Message

Ville Syrjälä Oct. 26, 2022, 11:39 a.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Apart from the split gamma mode ivb+ LUTs work just like ilk+ LUTs.
So let's handle the special case, and then just fall back to
ilk_gamma_mode() to avoid having to duplicate the same logic.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_color.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

Comments

Nautiyal, Ankit K Nov. 3, 2022, 10:09 a.m. UTC | #1
Makes sense. LGTM.

Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>

On 10/26/2022 5:09 PM, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Apart from the split gamma mode ivb+ LUTs work just like ilk+ LUTs.
> So let's handle the special case, and then just fall back to
> ilk_gamma_mode() to avoid having to duplicate the same logic.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>   drivers/gpu/drm/i915/display/intel_color.c | 10 +++-------
>   1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_color.c b/drivers/gpu/drm/i915/display/intel_color.c
> index 946fb767f3e0..435394cad359 100644
> --- a/drivers/gpu/drm/i915/display/intel_color.c
> +++ b/drivers/gpu/drm/i915/display/intel_color.c
> @@ -1521,14 +1521,10 @@ static int ilk_color_check(struct intel_crtc_state *crtc_state)
>   
>   static u32 ivb_gamma_mode(const struct intel_crtc_state *crtc_state)
>   {
> -	if (!crtc_state->gamma_enable ||
> -	    crtc_state_is_legacy_gamma(crtc_state))
> -		return GAMMA_MODE_MODE_8BIT;
> -	else if (crtc_state->hw.gamma_lut &&
> -		 crtc_state->hw.degamma_lut)
> +	if (crtc_state->hw.degamma_lut && crtc_state->hw.gamma_lut)
>   		return GAMMA_MODE_MODE_SPLIT;
> -	else
> -		return GAMMA_MODE_MODE_10BIT;
> +
> +	return ilk_gamma_mode(crtc_state);
>   }
>   
>   static u32 ivb_csc_mode(const struct intel_crtc_state *crtc_state)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_color.c b/drivers/gpu/drm/i915/display/intel_color.c
index 946fb767f3e0..435394cad359 100644
--- a/drivers/gpu/drm/i915/display/intel_color.c
+++ b/drivers/gpu/drm/i915/display/intel_color.c
@@ -1521,14 +1521,10 @@  static int ilk_color_check(struct intel_crtc_state *crtc_state)
 
 static u32 ivb_gamma_mode(const struct intel_crtc_state *crtc_state)
 {
-	if (!crtc_state->gamma_enable ||
-	    crtc_state_is_legacy_gamma(crtc_state))
-		return GAMMA_MODE_MODE_8BIT;
-	else if (crtc_state->hw.gamma_lut &&
-		 crtc_state->hw.degamma_lut)
+	if (crtc_state->hw.degamma_lut && crtc_state->hw.gamma_lut)
 		return GAMMA_MODE_MODE_SPLIT;
-	else
-		return GAMMA_MODE_MODE_10BIT;
+
+	return ilk_gamma_mode(crtc_state);
 }
 
 static u32 ivb_csc_mode(const struct intel_crtc_state *crtc_state)