From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Imre Deak <imre.deak@intel.com>
Cc: <intel-gfx@lists.freedesktop.org>, <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 1/3] drm/i915: Move encoder suspend/shutdown helpers to intel_encoder.c
Date: Mon, 17 Jun 2024 13:41:45 -0400 [thread overview]
Message-ID: <ZnB1WSGVFzEFcBlI@intel.com> (raw)
In-Reply-To: <20240617170356.4000251-1-imre.deak@intel.com>
On Mon, Jun 17, 2024 at 08:03:54PM +0300, Imre Deak wrote:
> Move the encoder suspend/shutdown helpers to intel_encoder.c, this being
> the logical place for encoder functions.
>
> This also allows sharing the above helpers with the xe driver, done in a
> follow-up patch.
>
> While at it rename the functions using the usual intel_encoder prefix
> and in the functions rename the dev_priv parameter to i915.
>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Signed-off-by: Imre Deak <imre.deak@intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_encoder.c | 44 +++++++++++++++++
> drivers/gpu/drm/i915/display/intel_encoder.h | 5 ++
> drivers/gpu/drm/i915/i915_driver.c | 51 ++------------------
> 3 files changed, 53 insertions(+), 47 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_encoder.c b/drivers/gpu/drm/i915/display/intel_encoder.c
> index dee55f56960fc..8a1dccb893a37 100644
> --- a/drivers/gpu/drm/i915/display/intel_encoder.c
> +++ b/drivers/gpu/drm/i915/display/intel_encoder.c
> @@ -37,3 +37,47 @@ void intel_encoder_link_check_queue_work(struct intel_encoder *encoder, int dela
> mod_delayed_work(i915->unordered_wq,
> &encoder->link_check_work, msecs_to_jiffies(delay_ms));
> }
> +
> +void intel_encoder_suspend_all(struct drm_i915_private *i915)
> +{
> + struct intel_encoder *encoder;
> +
> + if (!HAS_DISPLAY(i915))
> + return;
> +
> + /*
> + * TODO: check and remove holding the modeset locks if none of
> + * the encoders depends on this.
> + */
> + drm_modeset_lock_all(&i915->drm);
> + for_each_intel_encoder(&i915->drm, encoder)
> + if (encoder->suspend)
> + encoder->suspend(encoder);
> + drm_modeset_unlock_all(&i915->drm);
> +
> + for_each_intel_encoder(&i915->drm, encoder)
> + if (encoder->suspend_complete)
> + encoder->suspend_complete(encoder);
> +}
> +
> +void intel_encoder_shutdown_all(struct drm_i915_private *i915)
> +{
> + struct intel_encoder *encoder;
> +
> + if (!HAS_DISPLAY(i915))
> + return;
> +
> + /*
> + * TODO: check and remove holding the modeset locks if none of
> + * the encoders depends on this.
> + */
> + drm_modeset_lock_all(&i915->drm);
> + for_each_intel_encoder(&i915->drm, encoder)
> + if (encoder->shutdown)
> + encoder->shutdown(encoder);
> + drm_modeset_unlock_all(&i915->drm);
> +
> + for_each_intel_encoder(&i915->drm, encoder)
> + if (encoder->shutdown_complete)
> + encoder->shutdown_complete(encoder);
> +}
> diff --git a/drivers/gpu/drm/i915/display/intel_encoder.h b/drivers/gpu/drm/i915/display/intel_encoder.h
> index 2cda054e2b152..e6cd74576f78e 100644
> --- a/drivers/gpu/drm/i915/display/intel_encoder.h
> +++ b/drivers/gpu/drm/i915/display/intel_encoder.h
> @@ -6,6 +6,8 @@
> #ifndef __INTEL_ENCODER_H__
> #define __INTEL_ENCODER_H__
>
> +struct drm_i915_private;
> +
> struct intel_encoder;
>
> void intel_encoder_link_check_init(struct intel_encoder *encoder,
> @@ -13,4 +15,7 @@ void intel_encoder_link_check_init(struct intel_encoder *encoder,
> void intel_encoder_link_check_queue_work(struct intel_encoder *encoder, int delay_ms);
> void intel_encoder_link_check_flush_work(struct intel_encoder *encoder);
>
> +void intel_encoder_suspend_all(struct drm_i915_private *i915);
> +void intel_encoder_shutdown_all(struct drm_i915_private *i915);
> +
> #endif /* __INTEL_ENCODER_H__ */
> diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
> index 161b21eff6943..e9e38ed246f66 100644
> --- a/drivers/gpu/drm/i915/i915_driver.c
> +++ b/drivers/gpu/drm/i915/i915_driver.c
> @@ -53,6 +53,7 @@
> #include "display/intel_dmc.h"
> #include "display/intel_dp.h"
> #include "display/intel_dpt.h"
> +#include "display/intel_encoder.h"
> #include "display/intel_fbdev.h"
> #include "display/intel_hotplug.h"
> #include "display/intel_overlay.h"
> @@ -933,50 +934,6 @@ static void i915_driver_postclose(struct drm_device *dev, struct drm_file *file)
> i915_gem_flush_free_objects(to_i915(dev));
> }
>
> -static void intel_suspend_encoders(struct drm_i915_private *dev_priv)
> -{
> - struct intel_encoder *encoder;
> -
> - if (!HAS_DISPLAY(dev_priv))
> - return;
> -
> - /*
> - * TODO: check and remove holding the modeset locks if none of
> - * the encoders depends on this.
> - */
> - drm_modeset_lock_all(&dev_priv->drm);
> - for_each_intel_encoder(&dev_priv->drm, encoder)
> - if (encoder->suspend)
> - encoder->suspend(encoder);
> - drm_modeset_unlock_all(&dev_priv->drm);
> -
> - for_each_intel_encoder(&dev_priv->drm, encoder)
> - if (encoder->suspend_complete)
> - encoder->suspend_complete(encoder);
> -}
> -
> -static void intel_shutdown_encoders(struct drm_i915_private *dev_priv)
> -{
> - struct intel_encoder *encoder;
> -
> - if (!HAS_DISPLAY(dev_priv))
> - return;
> -
> - /*
> - * TODO: check and remove holding the modeset locks if none of
> - * the encoders depends on this.
> - */
> - drm_modeset_lock_all(&dev_priv->drm);
> - for_each_intel_encoder(&dev_priv->drm, encoder)
> - if (encoder->shutdown)
> - encoder->shutdown(encoder);
> - drm_modeset_unlock_all(&dev_priv->drm);
> -
> - for_each_intel_encoder(&dev_priv->drm, encoder)
> - if (encoder->shutdown_complete)
> - encoder->shutdown_complete(encoder);
> -}
> -
> void i915_driver_shutdown(struct drm_i915_private *i915)
> {
> disable_rpm_wakeref_asserts(&i915->runtime_pm);
> @@ -999,8 +956,8 @@ void i915_driver_shutdown(struct drm_i915_private *i915)
> if (HAS_DISPLAY(i915))
> intel_display_driver_suspend_access(i915);
>
> - intel_suspend_encoders(i915);
> - intel_shutdown_encoders(i915);
> + intel_encoder_suspend_all(i915);
> + intel_encoder_shutdown_all(i915);
>
> intel_dmc_suspend(i915);
>
> @@ -1083,7 +1040,7 @@ static int i915_drm_suspend(struct drm_device *dev)
> if (HAS_DISPLAY(dev_priv))
> intel_display_driver_suspend_access(dev_priv);
>
> - intel_suspend_encoders(dev_priv);
> + intel_encoder_suspend_all(dev_priv);
>
> /* Must be called before GGTT is suspended. */
> intel_dpt_suspend(dev_priv);
> --
> 2.43.3
>
next prev parent reply other threads:[~2024-06-17 17:41 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-17 17:03 [PATCH 1/3] drm/i915: Move encoder suspend/shutdown helpers to intel_encoder.c Imre Deak
2024-06-17 17:03 ` [PATCH 2/3] drm/i915: Pass intel_display to the encoder suspend/shutdown helpers Imre Deak
2024-06-17 17:42 ` Rodrigo Vivi
2024-06-18 9:05 ` Jani Nikula
2024-06-18 11:19 ` Imre Deak
2024-06-17 17:03 ` [PATCH 3/3] drm/xe: Use the encoder suspend helper also used by the i915 driver Imre Deak
2024-06-17 17:44 ` Rodrigo Vivi
2024-06-17 17:54 ` Imre Deak
2024-06-17 18:03 ` Rodrigo Vivi
2024-06-17 17:30 ` ✓ CI.Patch_applied: success for series starting with [1/3] drm/i915: Move encoder suspend/shutdown helpers to intel_encoder.c Patchwork
2024-06-17 17:30 ` ✗ CI.checkpatch: warning " Patchwork
2024-06-17 17:31 ` ✓ CI.KUnit: success " Patchwork
2024-06-17 17:41 ` Rodrigo Vivi [this message]
2024-06-17 17:43 ` ✓ CI.Build: " Patchwork
2024-06-17 17:45 ` ✗ CI.Hooks: failure " Patchwork
2024-06-17 17:46 ` ✗ CI.checksparse: warning " Patchwork
2024-06-17 18:08 ` ✓ CI.BAT: success " Patchwork
2024-06-18 8:01 ` [PATCH 1/3] " Jani Nikula
2024-06-18 11:16 ` Imre Deak
2024-06-18 12:52 ` ✗ CI.FULL: failure for series starting with [1/3] " 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=ZnB1WSGVFzEFcBlI@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=imre.deak@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
/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