Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: "Jouni Högander" <jouni.hogander@intel.com>,
	intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Cc: "Jouni Högander" <jouni.hogander@intel.com>
Subject: Re: [PATCH 3/6] drm/i915/display: Runtime pm wrappers for display parent interface
Date: Wed, 22 Oct 2025 12:27:35 +0300	[thread overview]
Message-ID: <6902d020853a877a34d92a0a934ed3f32bba3c41@intel.com> (raw)
In-Reply-To: <20251022085548.876150-4-jouni.hogander@intel.com>

On Wed, 22 Oct 2025, Jouni Högander <jouni.hogander@intel.com> wrote:
> Implement runtime pm wrappers for i915 driver and add them into display
> parent interface.
>
> Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_driver.c | 77 ++++++++++++++++++++++++++++++
>  1 file changed, 77 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
> index b295326eb4331..f0f5feaf3ff2c 100644
> --- a/drivers/gpu/drm/i915/i915_driver.c
> +++ b/drivers/gpu/drm/i915/i915_driver.c
> @@ -739,7 +739,84 @@ static void i915_welcome_messages(struct drm_i915_private *dev_priv)
>  			 "DRM_I915_DEBUG_RUNTIME_PM enabled\n");
>  }
>  
> +static struct intel_runtime_pm *drm_to_rpm(const struct drm_device *drm)
> +{
> +	struct drm_i915_private *i915 = to_i915(drm);
> +
> +	return &i915->runtime_pm;
> +}
> +
> +static struct ref_tracker *intel_rpm_get(const struct drm_device *drm)
> +{
> +	return intel_runtime_pm_get(drm_to_rpm(drm));
> +}
> +
> +static struct ref_tracker *intel_rpm_get_raw(const struct drm_device *drm)
> +{
> +	return intel_runtime_pm_get_raw(drm_to_rpm(drm));
> +}
> +
> +static struct ref_tracker *intel_rpm_get_if_in_use(const struct drm_device *drm)
> +{
> +	return intel_runtime_pm_get_if_in_use(drm_to_rpm(drm));
> +}
> +
> +static struct ref_tracker *intel_rpm_get_noresume(const struct drm_device *drm)
> +{
> +	return intel_runtime_pm_get_noresume(drm_to_rpm(drm));
> +}
> +
> +static void intel_rpm_put(const struct drm_device *drm, struct ref_tracker *wakeref)
> +{
> +	intel_runtime_pm_put(drm_to_rpm(drm), wakeref);
> +}
> +
> +static void intel_rpm_put_raw(const struct drm_device *drm, struct ref_tracker *wakeref)
> +{
> +	intel_runtime_pm_put_raw(drm_to_rpm(drm), wakeref);
> +}
> +
> +static void intel_rpm_put_unchecked(const struct drm_device *drm)
> +{
> +	intel_runtime_pm_put_unchecked(drm_to_rpm(drm));
> +}
> +
> +static bool intel_rpm_suspended(const struct drm_device *drm)
> +{
> +	return intel_runtime_pm_suspended(drm_to_rpm(drm));
> +}
> +
> +static void intel_rpm_assert_held(const struct drm_device *drm)
> +{
> +	assert_rpm_wakelock_held(drm_to_rpm(drm));
> +}
> +
> +static void intel_rpm_assert_block(const struct drm_device *drm)
> +{
> +	disable_rpm_wakeref_asserts(drm_to_rpm(drm));
> +}
> +
> +static void intel_rpm_assert_unblock(const struct drm_device *drm)
> +{
> +	enable_rpm_wakeref_asserts(drm_to_rpm(drm));
> +}
> +
> +static struct intel_display_rpm rpm = {

const

> +	.get = intel_rpm_get,
> +	.get_raw = intel_rpm_get_raw,
> +	.get_if_in_use = intel_rpm_get_if_in_use,
> +	.get_noresume = intel_rpm_get_noresume,
> +	.put = intel_rpm_put,
> +	.put_raw = intel_rpm_put_raw,
> +	.put_unchecked = intel_rpm_put_unchecked,
> +	.suspended = intel_rpm_suspended,
> +	.assert_held = intel_rpm_assert_held,
> +	.assert_block = intel_rpm_assert_block,
> +	.assert_unblock = intel_rpm_assert_unblock
> +};

I think all of the above belong in intel_runtime_pm.c.

I do dislike having to declare the rpm variable and make it non-static,
but I think the isolation is still better that way. The name also needs
to be longer because of this.

If we keep them here, this file will grow to a ton of small snippets
like above as we add more interfaces. I think the compiler might be able
to be more clever if the above wrapper functions are in the same file as
the functions being wrapped.

BR,
Jani.

> +
>  static const struct intel_display_parent_interface parent = {
> +	.rpm = &rpm,
>  };
>  
>  const struct intel_display_parent_interface *i915_driver_parent_interface(void)

-- 
Jani Nikula, Intel

  reply	other threads:[~2025-10-22  9:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-22  8:55 [PATCH 0/6] Use display parent interface for runtime pm Jouni Högander
2025-10-22  8:55 ` [PATCH 1/6] drm/{i915, xe}/display: pass parent interface to display probe Jouni Högander
2025-10-22  9:17   ` [PATCH 1/6] drm/{i915,xe}/display: " Jani Nikula
2025-10-23  7:18     ` Jani Nikula
2025-10-22  8:55 ` [PATCH 2/6] drm/{i915, xe}/display: Add display runtime pm parent interface Jouni Högander
2025-10-22  9:22   ` Jani Nikula
2025-10-22  8:55 ` [PATCH 3/6] drm/i915/display: Runtime pm wrappers for display " Jouni Högander
2025-10-22  9:27   ` Jani Nikula [this message]
2025-10-22  8:55 ` [PATCH 4/6] drm/xe/display: " Jouni Högander
2025-10-22  9:29   ` Jani Nikula
2025-10-22  8:55 ` [PATCH 5/6] drm/i915/display: Use display parent interface for i915 runtime pm Jouni Högander
2025-10-22  9:35   ` Jani Nikula
2025-10-22  8:55 ` [PATCH 6/6] drm/xe/display: Use display parent interface for xe " Jouni Högander
2025-10-22  9:36   ` Jani Nikula
2025-10-22  9:52 ` ✓ i915.CI.BAT: success for Use display parent interface for " Patchwork
2025-10-22 12:22 ` ✗ i915.CI.Full: 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=6902d020853a877a34d92a0a934ed3f32bba3c41@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jouni.hogander@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