All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: <intel-gfx@lists.freedesktop.org>, <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 09/11] drm/i915/ips: convert to struct intel_display
Date: Wed, 23 Oct 2024 13:19:49 -0400	[thread overview]
Message-ID: <ZxkwNXTVSgUkzVBJ@intel.com> (raw)
In-Reply-To: <2733f533be0729b15720a432a4fdcd77b6cb9dc8.1729612605.git.jani.nikula@intel.com>

On Tue, Oct 22, 2024 at 06:57:26PM +0300, Jani Nikula wrote:
> struct intel_display will replace struct drm_i915_private as the main
> device pointer for display code. Switch HSW IPS code over to it.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> ---
>  drivers/gpu/drm/i915/display/hsw_ips.c | 47 ++++++++++++++------------
>  1 file changed, 26 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/hsw_ips.c b/drivers/gpu/drm/i915/display/hsw_ips.c
> index c571c6e76d4a..34c5d28fc866 100644
> --- a/drivers/gpu/drm/i915/display/hsw_ips.c
> +++ b/drivers/gpu/drm/i915/display/hsw_ips.c
> @@ -15,6 +15,7 @@
>  
>  static void hsw_ips_enable(const struct intel_crtc_state *crtc_state)
>  {
> +	struct intel_display *display = to_intel_display(crtc_state);
>  	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
>  	struct drm_i915_private *i915 = to_i915(crtc->base.dev);
>  	u32 val;
> @@ -27,16 +28,16 @@ static void hsw_ips_enable(const struct intel_crtc_state *crtc_state)
>  	 * This function is called from post_plane_update, which is run after
>  	 * a vblank wait.
>  	 */
> -	drm_WARN_ON(&i915->drm,
> +	drm_WARN_ON(display->drm,
>  		    !(crtc_state->active_planes & ~BIT(PLANE_CURSOR)));
>  
>  	val = IPS_ENABLE;
>  
> -	if (i915->display.ips.false_color)
> +	if (display->ips.false_color)
>  		val |= IPS_FALSE_COLOR;
>  
>  	if (IS_BROADWELL(i915)) {
> -		drm_WARN_ON(&i915->drm,
> +		drm_WARN_ON(display->drm,
>  			    snb_pcode_write(&i915->uncore, DISPLAY_IPS_CONTROL,
>  					    val | IPS_PCODE_CONTROL));
>  		/*
> @@ -46,7 +47,7 @@ static void hsw_ips_enable(const struct intel_crtc_state *crtc_state)
>  		 * so we need to just enable it and continue on.
>  		 */
>  	} else {
> -		intel_de_write(i915, IPS_CTL, val);
> +		intel_de_write(display, IPS_CTL, val);
>  		/*
>  		 * The bit only becomes 1 in the next vblank, so this wait here
>  		 * is essentially intel_wait_for_vblank. If we don't have this
> @@ -54,14 +55,15 @@ static void hsw_ips_enable(const struct intel_crtc_state *crtc_state)
>  		 * the HW state readout code will complain that the expected
>  		 * IPS_CTL value is not the one we read.
>  		 */
> -		if (intel_de_wait_for_set(i915, IPS_CTL, IPS_ENABLE, 50))
> -			drm_err(&i915->drm,
> +		if (intel_de_wait_for_set(display, IPS_CTL, IPS_ENABLE, 50))
> +			drm_err(display->drm,
>  				"Timed out waiting for IPS enable\n");
>  	}
>  }
>  
>  bool hsw_ips_disable(const struct intel_crtc_state *crtc_state)
>  {
> +	struct intel_display *display = to_intel_display(crtc_state);
>  	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
>  	struct drm_i915_private *i915 = to_i915(crtc->base.dev);
>  	bool need_vblank_wait = false;
> @@ -70,19 +72,19 @@ bool hsw_ips_disable(const struct intel_crtc_state *crtc_state)
>  		return need_vblank_wait;
>  
>  	if (IS_BROADWELL(i915)) {
> -		drm_WARN_ON(&i915->drm,
> +		drm_WARN_ON(display->drm,
>  			    snb_pcode_write(&i915->uncore, DISPLAY_IPS_CONTROL, 0));
>  		/*
>  		 * Wait for PCODE to finish disabling IPS. The BSpec specified
>  		 * 42ms timeout value leads to occasional timeouts so use 100ms
>  		 * instead.
>  		 */
> -		if (intel_de_wait_for_clear(i915, IPS_CTL, IPS_ENABLE, 100))
> -			drm_err(&i915->drm,
> +		if (intel_de_wait_for_clear(display, IPS_CTL, IPS_ENABLE, 100))
> +			drm_err(display->drm,
>  				"Timed out waiting for IPS disable\n");
>  	} else {
> -		intel_de_write(i915, IPS_CTL, 0);
> -		intel_de_posting_read(i915, IPS_CTL);
> +		intel_de_write(display, IPS_CTL, 0);
> +		intel_de_posting_read(display, IPS_CTL);
>  	}
>  
>  	/* We need to wait for a vblank before we can disable the plane. */
> @@ -188,6 +190,7 @@ bool hsw_crtc_supports_ips(struct intel_crtc *crtc)
>  
>  bool hsw_crtc_state_ips_capable(const struct intel_crtc_state *crtc_state)
>  {
> +	struct intel_display *display = to_intel_display(crtc_state);
>  	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
>  	struct drm_i915_private *i915 = to_i915(crtc->base.dev);
>  
> @@ -195,7 +198,7 @@ bool hsw_crtc_state_ips_capable(const struct intel_crtc_state *crtc_state)
>  	if (!hsw_crtc_supports_ips(crtc))
>  		return false;
>  
> -	if (!i915->display.params.enable_ips)
> +	if (!display->params.enable_ips)
>  		return false;
>  
>  	if (crtc_state->pipe_bpp > 24)
> @@ -209,7 +212,7 @@ bool hsw_crtc_state_ips_capable(const struct intel_crtc_state *crtc_state)
>  	 * Should measure whether using a lower cdclk w/o IPS
>  	 */
>  	if (IS_BROADWELL(i915) &&
> -	    crtc_state->pixel_rate > i915->display.cdclk.max_cdclk_freq * 95 / 100)
> +	    crtc_state->pixel_rate > display->cdclk.max_cdclk_freq * 95 / 100)
>  		return false;
>  
>  	return true;
> @@ -259,6 +262,7 @@ int hsw_ips_compute_config(struct intel_atomic_state *state,
>  
>  void hsw_ips_get_config(struct intel_crtc_state *crtc_state)
>  {
> +	struct intel_display *display = to_intel_display(crtc_state);
>  	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
>  	struct drm_i915_private *i915 = to_i915(crtc->base.dev);
>  
> @@ -266,7 +270,7 @@ void hsw_ips_get_config(struct intel_crtc_state *crtc_state)
>  		return;
>  
>  	if (IS_HASWELL(i915)) {
> -		crtc_state->ips_enabled = intel_de_read(i915, IPS_CTL) & IPS_ENABLE;
> +		crtc_state->ips_enabled = intel_de_read(display, IPS_CTL) & IPS_ENABLE;
>  	} else {
>  		/*
>  		 * We cannot readout IPS state on broadwell, set to
> @@ -280,9 +284,9 @@ void hsw_ips_get_config(struct intel_crtc_state *crtc_state)
>  static int hsw_ips_debugfs_false_color_get(void *data, u64 *val)
>  {
>  	struct intel_crtc *crtc = data;
> -	struct drm_i915_private *i915 = to_i915(crtc->base.dev);
> +	struct intel_display *display = to_intel_display(crtc);
>  
> -	*val = i915->display.ips.false_color;
> +	*val = display->ips.false_color;
>  
>  	return 0;
>  }
> @@ -290,7 +294,7 @@ static int hsw_ips_debugfs_false_color_get(void *data, u64 *val)
>  static int hsw_ips_debugfs_false_color_set(void *data, u64 val)
>  {
>  	struct intel_crtc *crtc = data;
> -	struct drm_i915_private *i915 = to_i915(crtc->base.dev);
> +	struct intel_display *display = to_intel_display(crtc);
>  	struct intel_crtc_state *crtc_state;
>  	int ret;
>  
> @@ -298,7 +302,7 @@ static int hsw_ips_debugfs_false_color_set(void *data, u64 val)
>  	if (ret)
>  		return ret;
>  
> -	i915->display.ips.false_color = val;
> +	display->ips.false_color = val;
>  
>  	crtc_state = to_intel_crtc_state(crtc->base.state);
>  
> @@ -325,18 +329,19 @@ DEFINE_DEBUGFS_ATTRIBUTE(hsw_ips_debugfs_false_color_fops,
>  static int hsw_ips_debugfs_status_show(struct seq_file *m, void *unused)
>  {
>  	struct intel_crtc *crtc = m->private;
> +	struct intel_display *display = to_intel_display(crtc);
>  	struct drm_i915_private *i915 = to_i915(crtc->base.dev);
>  	intel_wakeref_t wakeref;
>  
>  	wakeref = intel_runtime_pm_get(&i915->runtime_pm);
>  
>  	seq_printf(m, "Enabled by kernel parameter: %s\n",
> -		   str_yes_no(i915->display.params.enable_ips));
> +		   str_yes_no(display->params.enable_ips));
>  
> -	if (DISPLAY_VER(i915) >= 8) {
> +	if (DISPLAY_VER(display) >= 8) {
>  		seq_puts(m, "Currently: unknown\n");
>  	} else {
> -		if (intel_de_read(i915, IPS_CTL) & IPS_ENABLE)
> +		if (intel_de_read(display, IPS_CTL) & IPS_ENABLE)
>  			seq_puts(m, "Currently: enabled\n");
>  		else
>  			seq_puts(m, "Currently: disabled\n");
> -- 
> 2.39.5
> 

  reply	other threads:[~2024-10-23 17:20 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-22 15:57 [PATCH 00/11] drm/i915/display: bunch of struct intel_display conversions Jani Nikula
2024-10-22 15:57 ` [PATCH 01/11] drm/i915/gmbus: convert to struct intel_display Jani Nikula
2024-10-23 14:51   ` Rodrigo Vivi
2024-10-22 15:57 ` [PATCH 02/11] drm/i915/cx0: " Jani Nikula
2024-10-23 14:53   ` Rodrigo Vivi
2024-10-22 15:57 ` [PATCH 03/11] drm/i915/dpio: " Jani Nikula
2024-10-23 14:54   ` Rodrigo Vivi
2024-10-22 15:57 ` [PATCH 04/11] drm/i915/hdcp: further conversion " Jani Nikula
2024-10-23 14:55   ` Rodrigo Vivi
2024-10-22 15:57 ` [PATCH 05/11] drm/i915/dp/hdcp: convert " Jani Nikula
2024-10-23 14:57   ` Rodrigo Vivi
2024-10-22 15:57 ` [PATCH 06/11] drm/i915/crt: " Jani Nikula
2024-10-23 15:05   ` Rodrigo Vivi
2024-10-22 15:57 ` [PATCH 07/11] drm/i915/display: convert vlv_wait_port_ready() " Jani Nikula
2024-10-23 17:18   ` Rodrigo Vivi
2024-10-22 15:57 ` [PATCH 08/11] drm/i915/power: convert assert_chv_phy_status() " Jani Nikula
2024-10-23 17:19   ` Rodrigo Vivi
2024-10-22 15:57 ` [PATCH 09/11] drm/i915/ips: convert " Jani Nikula
2024-10-23 17:19   ` Rodrigo Vivi [this message]
2024-10-22 15:57 ` [PATCH 10/11] drm/i915/dsi: " Jani Nikula
2024-10-23 17:26   ` Rodrigo Vivi
2024-10-22 15:57 ` [PATCH 11/11] drm/i915/de: remove unnecessary generic wrappers Jani Nikula
2024-10-23 17:28   ` Rodrigo Vivi
2024-10-22 16:57 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915/display: bunch of struct intel_display conversions Patchwork
2024-10-22 16:57 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-10-22 17:07 ` ✓ Fi.CI.BAT: success " Patchwork
2024-10-22 17:14 ` ✓ CI.Patch_applied: " Patchwork
2024-10-22 17:15 ` ✗ CI.checkpatch: warning " Patchwork
2024-10-22 17:16 ` ✓ CI.KUnit: success " Patchwork
2024-10-22 17:27 ` ✓ CI.Build: " Patchwork
2024-10-22 17:30 ` ✓ CI.Hooks: " Patchwork
2024-10-22 17:31 ` ✗ CI.checksparse: warning " Patchwork
2024-10-22 17:51 ` ✓ CI.BAT: success " Patchwork
2024-10-22 21:22 ` ✗ CI.FULL: failure " Patchwork
2024-10-22 22:23 ` ✗ Fi.CI.IGT: " 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=ZxkwNXTVSgUkzVBJ@intel.com \
    --to=rodrigo.vivi@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 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.