All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Swati Sharma <swati2.sharma@intel.com>
Cc: jani.nikula@intel.com, intel-gfx@lists.freedesktop.org,
	ankit.k.nautiyal@intel.com
Subject: Re: [PATCH 1/4] [v2] drm/i915/color: fix broken gamma state-checker during boot
Date: Fri, 4 Oct 2019 23:12:04 +0300	[thread overview]
Message-ID: <20191004201204.GK1208@intel.com> (raw)
In-Reply-To: <20191004082610.24664-2-swati2.sharma@intel.com>

On Fri, Oct 04, 2019 at 01:56:07PM +0530, Swati Sharma wrote:
> Premature gamma lut prepration and loading which was getting
> reflected in first modeset causing different colors on
> screen during boot.
> 
> Issue: In BIOS, gamma is disabled by default. However, legacy read_luts()
> was setting crtc_state->base.gamma_lut and gamma_lut was programmed
> with junk values which led to visual artifacts (different
> colored screens instead of usual black during boot).
> 
> Fix: Calling read_luts() only when gamma is enabled which will happen
> after first modeset.
> 
> This fix is independent from the revert 1b8588741fdc ("Revert
> "drm/i915/color: Extract icl_read_luts()"") and should fix different colors
> on screen in legacy platforms too.
> 
> -Added gamma_enable checks inside read_luts() [Ville/Jani N]
> -Corrected gamma enable check for CHV [Ville]
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111809
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111885
> Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_color.c | 27 +++++++++++++++++++---
>  1 file changed, 24 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_color.c b/drivers/gpu/drm/i915/display/intel_color.c
> index 9ab34902663e..8f02313a7fef 100644
> --- a/drivers/gpu/drm/i915/display/intel_color.c
> +++ b/drivers/gpu/drm/i915/display/intel_color.c
> @@ -1613,6 +1613,9 @@ i9xx_read_lut_8(const struct intel_crtc_state *crtc_state)
>  
>  static void i9xx_read_luts(struct intel_crtc_state *crtc_state)
>  {
> +	if (!crtc_state->gamma_enable)
> +		return;
> +
>  	crtc_state->base.gamma_lut = i9xx_read_lut_8(crtc_state);
>  }
>  
> @@ -1659,6 +1662,9 @@ i965_read_lut_10p6(const struct intel_crtc_state *crtc_state)
>  
>  static void i965_read_luts(struct intel_crtc_state *crtc_state)
>  {
> +	if (!crtc_state->gamma_enable)
> +		return;
> +
>  	if (crtc_state->gamma_mode == GAMMA_MODE_MODE_8BIT)
>  		crtc_state->base.gamma_lut = i9xx_read_lut_8(crtc_state);
>  	else
> @@ -1701,10 +1707,19 @@ chv_read_cgm_lut(const struct intel_crtc_state *crtc_state)
>  
>  static void chv_read_luts(struct intel_crtc_state *crtc_state)
>  {
> -	if (crtc_state->gamma_mode == GAMMA_MODE_MODE_8BIT)
> -		crtc_state->base.gamma_lut = i9xx_read_lut_8(crtc_state);
> -	else
> +	if (crtc_state->cgm_mode) {
> +		if ((crtc_state->cgm_mode & CGM_PIPE_MODE_GAMMA) == 0)
> +			return;
> +
>  		crtc_state->base.gamma_lut = chv_read_cgm_lut(crtc_state);
> +	}
> +
> +	if (crtc_state->gamma_mode == GAMMA_MODE_MODE_8BIT) {
> +		if (!crtc_state->gamma_enable)
> +			return;
> +
> +		crtc_state->base.gamma_lut = i9xx_read_lut_8(crtc_state);
> +	}

I'd simply make this something like:

if (crtc_state->cgm_mode & CGM_PIPE_MODE_GAMMA) {
	crtc_state->base.gamma_lut = chv_read_cgm_lut(crtc_state);
} else {
	i965_read_luts(crtc_state);
}

>  }
>  
>  static struct drm_property_blob *
> @@ -1742,6 +1757,9 @@ ilk_read_lut_10(const struct intel_crtc_state *crtc_state)
>  
>  static void ilk_read_luts(struct intel_crtc_state *crtc_state)
>  {
> +	if (!crtc_state->gamma_enable)
> +		return;

We should check
        if ((crtc_state->csc_mode & CSC_POSITION_BEFORE_GAMMA) == 0)
	                return;

here so we don't read the hw degamma into the state gmama_lut.

> +
>  	if (crtc_state->gamma_mode == GAMMA_MODE_MODE_8BIT)
>  		crtc_state->base.gamma_lut = i9xx_read_lut_8(crtc_state);
>  	else
> @@ -1788,6 +1806,9 @@ glk_read_lut_10(const struct intel_crtc_state *crtc_state, u32 prec_index)
>  
>  static void glk_read_luts(struct intel_crtc_state *crtc_state)
>  {
> +	if (!crtc_state->gamma_enable)
> +		return;
> +
>  	if (crtc_state->gamma_mode == GAMMA_MODE_MODE_8BIT)
>  		crtc_state->base.gamma_lut = i9xx_read_lut_8(crtc_state);
>  	else
> -- 
> 2.23.0

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

  reply	other threads:[~2019-10-04 20:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-04  8:26 [PATCH 0/4] fix broken state checker and enable state checker for icl+ Swati Sharma
2019-10-04  8:26 ` [PATCH 1/4] [v2] drm/i915/color: fix broken gamma state-checker during boot Swati Sharma
2019-10-04 20:12   ` Ville Syrjälä [this message]
2019-10-04  8:26 ` [PATCH 2/4] drm/i915/color: move check of gamma_enable to specific func/platform Swati Sharma
2019-10-04 20:14   ` Ville Syrjälä
2019-10-04  8:26 ` [PATCH 3/4] [v5] drm/i915/color: Extract icl_read_luts() Swati Sharma
2019-10-04  8:26 ` [PATCH 4/4] FOR_TESTING_ONLY: Print rgb values of hw and sw blobs Swati Sharma
2019-10-04  9:29 ` ✗ Fi.CI.CHECKPATCH: warning for fix broken state checker and enable state checker for icl+ Patchwork
2019-10-04 11:12 ` ✓ Fi.CI.BAT: success " Patchwork
2019-10-04 14:01 ` [PATCH 0/4] " Saarinen, Jani
2019-10-04 15:20 ` ✗ Fi.CI.IGT: failure for " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191004201204.GK1208@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=ankit.k.nautiyal@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=swati2.sharma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.