Message ID | 20240903223803.380711-4-rodrigo.vivi@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/xe/display: Clean-up PM sequences | expand |
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. > 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. 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:
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
On Wed, 04 Sep 2024, Rodrigo Vivi <rodrigo.vivi@intel.com> wrote: > 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; Gah, tripped by having happy day return within an if statement. > >> >> > 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. But you do have to check again after intel_display_device_info_runtime_init(). BR, Jani. > >> >> 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
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:
When HAS_DISPLAY is false, info.probe_display is set to false. Hence, all these calls to has_display() are bogus. 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(-)