intel-xe.lists.freedesktop.org archive mirror
 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>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Lucas De Marchi <lucas.demarchi@intel.com>
Subject: Re: [PATCH 3/4] drm/xe/display: Kill useless has_display
Date: Wed, 4 Sep 2024 11:22:39 -0400	[thread overview]
Message-ID: <Zth7P18cu2YLAtTY@intel.com> (raw)
In-Reply-To: <87a5gnub2w.fsf@intel.com>

On Wed, Sep 04, 2024 at 10:33:59AM +0300, Jani Nikula wrote:
> On Tue, 03 Sep 2024, Rodrigo Vivi <rodrigo.vivi@intel.com> wrote:
> > When HAS_DISPLAY is false, info.probe_display is set to false.
> 
> Where? xe_display_probe() returns 0 directly when HAS_DISPLAY() is false
> instead of setting info.probe_display.

the return 0 is when has_display is true.

if it is false it goes further to
no_display:
	xe->info.probe_display = false;

> 
> > Hence, all these calls to has_display() are bogus.
> 
> Also not quite, as intel_display_device_info_runtime_init() checks fuses
> and could change HAS_DISPLAY() to return false after that, with no
> impact on info.probe_display.

I confess that I get confused with the many no_display kind of states
we have and specially with mutable ones. But this was only one extra
reason to consolidate everything on the probe_display since that
is getting changed during xe_display_probe and not changing on our
back after.

> 
> BR,
> Jani.
> 
> >
> > With only one place left, use the main macro now and entirely
> > kill has_display() local helper.
> >
> > Cc: Jani Nikula <jani.nikula@intel.com>
> > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> > Cc: Lucas De Marchi <lucas.demarchi@intel.com>
> > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > ---
> >  drivers/gpu/drm/xe/display/xe_display.c | 43 ++++++++-----------------
> >  1 file changed, 14 insertions(+), 29 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/xe/display/xe_display.c b/drivers/gpu/drm/xe/display/xe_display.c
> > index 65331bbbc068..daf9b9baa88a 100644
> > --- a/drivers/gpu/drm/xe/display/xe_display.c
> > +++ b/drivers/gpu/drm/xe/display/xe_display.c
> > @@ -29,13 +29,6 @@
> >  #include "intel_opregion.h"
> >  #include "xe_module.h"
> >  
> > -/* Xe device functions */
> > -
> > -static bool has_display(struct xe_device *xe)
> > -{
> > -	return HAS_DISPLAY(&xe->display);
> > -}
> > -
> >  /**
> >   * xe_display_driver_probe_defer - Detect if we need to wait for other drivers
> >   *				   early on
> > @@ -336,8 +329,7 @@ static void xe_display_from_d3cold(struct xe_device *xe)
> >  
> >  	intel_dmc_resume(xe);
> >  
> > -	if (has_display(xe))
> > -		drm_mode_config_reset(&xe->drm);
> > +	drm_mode_config_reset(&xe->drm);
> >  
> >  	intel_display_driver_init_hw(xe);
> >  	intel_hpd_init(xe);
> > @@ -388,11 +380,10 @@ void xe_display_pm_suspend(struct xe_device *xe)
> >  	 */
> >  	intel_power_domains_disable(xe);
> >  	intel_fbdev_set_suspend(&xe->drm, FBINFO_STATE_SUSPENDED, true);
> > -	if (has_display(xe)) {
> > -		drm_kms_helper_poll_disable(&xe->drm);
> > -		intel_display_driver_disable_user_access(xe);
> > -		intel_display_driver_suspend(xe);
> > -	}
> > +
> > +	drm_kms_helper_poll_disable(&xe->drm);
> > +	intel_display_driver_disable_user_access(xe);
> > +	intel_display_driver_suspend(xe);
> >  
> >  	xe_display_flush_cleanup_work(xe);
> >  
> > @@ -400,10 +391,8 @@ void xe_display_pm_suspend(struct xe_device *xe)
> >  
> >  	intel_hpd_cancel_work(xe);
> >  
> > -	if (has_display(xe)) {
> > -		intel_display_driver_suspend_access(xe);
> > -		intel_encoder_suspend_all(&xe->display);
> > -	}
> > +	intel_display_driver_suspend_access(xe);
> > +	intel_encoder_suspend_all(&xe->display);
> >  
> >  	intel_opregion_suspend(display, s2idle ? PCI_D1 : PCI_D3cold);
> >  
> > @@ -440,23 +429,19 @@ void xe_display_pm_resume(struct xe_device *xe)
> >  
> >  	intel_dmc_resume(xe);
> >  
> > -	if (has_display(xe))
> > -		drm_mode_config_reset(&xe->drm);
> > +	drm_mode_config_reset(&xe->drm);
> >  
> >  	intel_display_driver_init_hw(xe);
> >  	intel_hpd_init(xe);
> >  
> > -	if (has_display(xe))
> > -		intel_display_driver_resume_access(xe);
> > +	intel_display_driver_resume_access(xe);
> >  
> >  	/* MST sideband requires HPD interrupts enabled */
> >  	intel_dp_mst_resume(xe);
> > -	if (has_display(xe)) {
> > -		intel_display_driver_resume(xe);
> > -		drm_kms_helper_poll_enable(&xe->drm);
> > -		intel_display_driver_enable_user_access(xe);
> > -		intel_hpd_poll_disable(xe);
> > -	}
> > +	intel_display_driver_resume(xe);
> > +	drm_kms_helper_poll_enable(&xe->drm);
> > +	intel_display_driver_enable_user_access(xe);
> > +	intel_hpd_poll_disable(xe);
> >  
> >  	intel_opregion_resume(display);
> >  
> > @@ -485,7 +470,7 @@ int xe_display_probe(struct xe_device *xe)
> >  	if (err)
> >  		return err;
> >  
> > -	if (has_display(xe))
> > +	if (HAS_DISPLAY(&xe->display))
> >  		return 0;
> >  
> >  no_display:
> 
> -- 
> Jani Nikula, Intel

  reply	other threads:[~2024-09-04 15:22 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-03 22:37 [PATCH 0/4] drm/xe/display: Clean-up PM sequences Rodrigo Vivi
2024-09-03 22:38 ` [PATCH 1/4] drm/xe/display: Spin-off xe_display runtime/d3cold sequences Rodrigo Vivi
2024-09-03 22:38 ` [PATCH 2/4] drm/xe/display: Remove i915_drv.h include Rodrigo Vivi
2024-09-04  7:27   ` Jani Nikula
2024-09-03 22:38 ` [PATCH 3/4] drm/xe/display: Kill useless has_display Rodrigo Vivi
2024-09-04  7:33   ` Jani Nikula
2024-09-04 15:22     ` Rodrigo Vivi [this message]
2024-09-04 16:08       ` Jani Nikula
2024-09-03 22:38 ` [PATCH 4/4] drm/xe/display: Reduce and streamline d3cold display sequence Rodrigo Vivi
2024-09-04  5:39   ` Anshuman Gupta
2024-09-04 15:24     ` Rodrigo Vivi
2024-09-03 22:43 ` ✓ CI.Patch_applied: success for drm/xe/display: Clean-up PM sequences Patchwork
2024-09-03 22:44 ` ✓ CI.checkpatch: " Patchwork
2024-09-03 22:45 ` ✓ CI.KUnit: " Patchwork
2024-09-03 22:57 ` ✓ CI.Build: " Patchwork
2024-09-03 22:59 ` ✓ CI.Hooks: " Patchwork
2024-09-03 23:00 ` ✓ CI.checksparse: " Patchwork
2024-09-03 23:20 ` ✓ CI.BAT: " Patchwork
2024-09-04  3:14 ` ✓ CI.FULL: " Patchwork
2024-09-04  9:02 ` [PATCH 0/4] " Jani Nikula
2024-09-04 15:16   ` Rodrigo Vivi

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=Zth7P18cu2YLAtTY@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=lucas.demarchi@intel.com \
    --cc=maarten.lankhorst@linux.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;
as well as URLs for NNTP newsgroup(s).