Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v2 2/2] drm/i915/dsc: don't mess up splitter state in joiner or dsc config
Date: Fri, 14 Jun 2024 14:47:38 +0300	[thread overview]
Message-ID: <Zmwt2l3SFaE1icV8@intel.com> (raw)
In-Reply-To: <aea210a824084a0644de5a546e7ecb6dfc6bdef9.1718360103.git.jani.nikula@intel.com>

On Fri, Jun 14, 2024 at 01:16:04PM +0300, Jani Nikula wrote:
> The driver handles splitter (for MSO) and joiner/dsc configuration in
> different places. Avoid messing up the splitter hardware state when
> enabling/disabling joiner or dsc. It should not be possible to enable
> both joiner and splitter at the same time, but add more clarity to the
> register use overall.
> 
> Note: We should probably handle splitter for MSO as well as dual-link
> DSI in intel_vdsc.c. Also, we have intel_uncompressed_joiner_enable()
> but no corresponding disable.
> 
> Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_ddi.c       |  5 ++---
>  drivers/gpu/drm/i915/display/intel_vdsc.c      | 12 +++++++++---
>  drivers/gpu/drm/i915/display/intel_vdsc_regs.h |  1 +
>  3 files changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
> index bb13a3ca8c7c..49509a6599fe 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -2417,9 +2417,8 @@ static void intel_ddi_mso_configure(const struct intel_crtc_state *crtc_state)
>  			dss1 |= SPLITTER_CONFIGURATION_4_SEGMENT;
>  	}
>  
> -	intel_de_rmw(i915, ICL_PIPE_DSS_CTL1(pipe),
> -		     SPLITTER_ENABLE | SPLITTER_CONFIGURATION_MASK |
> -		     OVERLAP_PIXELS_MASK, dss1);
> +	/* Only touch the splitter */
> +	intel_de_rmw(i915, ICL_PIPE_DSS_CTL1(pipe), SPLITTER_STATE, dss1);
>  }
>  
>  static u8 mtl_get_port_width(u8 lane_count)
> diff --git a/drivers/gpu/drm/i915/display/intel_vdsc.c b/drivers/gpu/drm/i915/display/intel_vdsc.c
> index b9687b7692b8..a8671d3f1d41 100644
> --- a/drivers/gpu/drm/i915/display/intel_vdsc.c
> +++ b/drivers/gpu/drm/i915/display/intel_vdsc.c
> @@ -766,7 +766,9 @@ void intel_uncompressed_joiner_enable(const struct intel_crtc_state *crtc_state)
>  		else
>  			dss_ctl1_val |= UNCOMPRESSED_JOINER_PRIMARY;
>  
> -		intel_de_write(dev_priv, dss_ctl1_reg(crtc, crtc_state->cpu_transcoder), dss_ctl1_val);
> +		/* Avoid touching the splitter */
> +		intel_de_rmw(dev_priv, dss_ctl1_reg(crtc, crtc_state->cpu_transcoder),
> +			     ~SPLITTER_STATE, dss_ctl1_val);
>  	}
>  }
>  
> @@ -793,7 +795,9 @@ void intel_dsc_enable(const struct intel_crtc_state *crtc_state)
>  		if (!intel_crtc_is_joiner_secondary(crtc_state))
>  			dss_ctl1_val |= PRIMARY_BIG_JOINER_ENABLE;
>  	}
> -	intel_de_write(dev_priv, dss_ctl1_reg(crtc, crtc_state->cpu_transcoder), dss_ctl1_val);
> +	/* Avoid touching the splitter */
> +	intel_de_rmw(dev_priv, dss_ctl1_reg(crtc, crtc_state->cpu_transcoder),
> +		     ~SPLITTER_STATE, dss_ctl1_val);
>  	intel_de_write(dev_priv, dss_ctl2_reg(crtc, crtc_state->cpu_transcoder), dss_ctl2_val);
>  }
>  
> @@ -805,7 +809,9 @@ void intel_dsc_disable(const struct intel_crtc_state *old_crtc_state)
>  	/* Disable only if either of them is enabled */
>  	if (old_crtc_state->dsc.compression_enable ||
>  	    old_crtc_state->joiner_pipes) {
> -		intel_de_write(dev_priv, dss_ctl1_reg(crtc, old_crtc_state->cpu_transcoder), 0);
> +		/* Avoid touching the splitter */
> +		intel_de_rmw(dev_priv, dss_ctl1_reg(crtc, old_crtc_state->cpu_transcoder),
> +			     ~SPLITTER_STATE, 0);
>  		intel_de_write(dev_priv, dss_ctl2_reg(crtc, old_crtc_state->cpu_transcoder), 0);
>  	}
>  }
> diff --git a/drivers/gpu/drm/i915/display/intel_vdsc_regs.h b/drivers/gpu/drm/i915/display/intel_vdsc_regs.h
> index f921ad67b587..3734cd96f55e 100644
> --- a/drivers/gpu/drm/i915/display/intel_vdsc_regs.h
> +++ b/drivers/gpu/drm/i915/display/intel_vdsc_regs.h
> @@ -37,6 +37,7 @@
>  #define  SPLITTER_CONFIGURATION_MASK		REG_GENMASK(26, 25)
>  #define  SPLITTER_CONFIGURATION_2_SEGMENT	REG_FIELD_PREP(SPLITTER_CONFIGURATION_MASK, 0)
>  #define  SPLITTER_CONFIGURATION_4_SEGMENT	REG_FIELD_PREP(SPLITTER_CONFIGURATION_MASK, 1)
> +#define  SPLITTER_STATE				(SPLITTER_ENABLE | SPLITTER_CONFIGURATION_MASK | OVERLAP_PIXELS_MASK)

Not a big fan of this. I'd rather explicicitly list the bits
we actually want to modify in each call site.

Also not a big fan of the rmws. I think in the future we might be
able to adjust some DSC stuff via fastsets, and that means no rmws
because we then want to do it via DSB. But not sure if the DSS
registers specifically would be involved in that, and I guess we
already had some rmws in there so it'll require work anyway. So
no hard objection to using rmw for now.

>  #define  UNCOMPRESSED_JOINER_PRIMARY		(1 << 21)
>  #define  UNCOMPRESSED_JOINER_SECONDARY		(1 << 20)
>  
> -- 
> 2.39.2

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2024-06-14 11:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-14 10:16 [PATCH v2 0/2] drm/i915: fix MSO vs. joiner issue Jani Nikula
2024-06-14 10:16 ` [PATCH v2 1/2] drm/i915/mso: using joiner is not possible with eDP MSO Jani Nikula
2024-06-14 11:41   ` Ville Syrjälä
2024-06-14 14:01     ` Jani Nikula
2024-06-14 10:16 ` [PATCH v2 2/2] drm/i915/dsc: don't mess up splitter state in joiner or dsc config Jani Nikula
2024-06-14 11:47   ` Ville Syrjälä [this message]
2024-06-14 14:17     ` Jani Nikula
2024-06-14 14:29       ` Ville Syrjälä
2024-06-14 10:50 ` ✗ Fi.CI.SPARSE: warning for drm/i915: fix MSO vs. joiner issue Patchwork
2024-06-14 11:00 ` ✓ Fi.CI.BAT: success " Patchwork
2024-06-16  7:38 ` ✗ Fi.CI.IGT: failure " 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=Zmwt2l3SFaE1icV8@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox