Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@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 v2 4/6] drm/xe/display: Runtime pm wrappers for display parent interface
Date: Fri, 24 Oct 2025 15:31:56 +0300	[thread overview]
Message-ID: <8f4bb6d726a6363f125f2ea8bda7c44afe51ee7c@intel.com> (raw)
In-Reply-To: <20251024093113.1119070-5-jouni.hogander@intel.com>

On Fri, 24 Oct 2025, Jouni Högander <jouni.hogander@intel.com> wrote:
> Implement runtime pm wrappers for xe driver and add them into display
> parent interface.
>
> v2:
>   - move xe_display_rpm_interface code into xe_display_rpm.c
>   - rename xe_rpm as xe_display_rpm
>
> Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
> ---
>  drivers/gpu/drm/xe/display/xe_display.c     |  3 +
>  drivers/gpu/drm/xe/display/xe_display_rpm.c | 76 +++++++++++++++++++++
>  drivers/gpu/drm/xe/display/xe_display_rpm.h | 11 +++
>  3 files changed, 90 insertions(+)
>  create mode 100644 drivers/gpu/drm/xe/display/xe_display_rpm.h
>
> diff --git a/drivers/gpu/drm/xe/display/xe_display.c b/drivers/gpu/drm/xe/display/xe_display.c
> index 0e38c96eb6def..be7f3c7ef5c3f 100644
> --- a/drivers/gpu/drm/xe/display/xe_display.c
> +++ b/drivers/gpu/drm/xe/display/xe_display.c
> @@ -35,7 +35,9 @@
>  #include "intel_hotplug.h"
>  #include "intel_opregion.h"
>  #include "skl_watermark.h"
> +#include "xe_display_rpm.h"
>  #include "xe_module.h"
> +#include "xe_pm.h"
>  
>  /* Ensure drm and display members are placed properly. */
>  INTEL_DISPLAY_MEMBER_STATIC_ASSERT(struct xe_device, drm, display);
> @@ -516,6 +518,7 @@ static void display_device_remove(struct drm_device *dev, void *arg)
>  }
>  
>  static const struct intel_display_parent_interface parent = {
> +	.rpm = &xe_display_rpm_interface,
>  };
>  
>  /**
> diff --git a/drivers/gpu/drm/xe/display/xe_display_rpm.c b/drivers/gpu/drm/xe/display/xe_display_rpm.c
> index 3825376e98ccd..72a351e26a008 100644
> --- a/drivers/gpu/drm/xe/display/xe_display_rpm.c
> +++ b/drivers/gpu/drm/xe/display/xe_display_rpm.c
> @@ -1,6 +1,8 @@
>  // SPDX-License-Identifier: MIT
>  /* Copyright © 2025 Intel Corporation */
>  
> +#include <drm/intel/display_parent_interface.h>
> +
>  #include "intel_display_core.h"
>  #include "intel_display_rpm.h"
>  #include "xe_device.h"
> @@ -71,3 +73,77 @@ void intel_display_rpm_assert_unblock(struct intel_display *display)
>  {
>  	/* FIXME */
>  }
> +
> +static struct ref_tracker *xe_display_rpm_get(const struct drm_device *drm)
> +{
> +	return xe_pm_runtime_resume_and_get(to_xe_device(drm)) ? INTEL_WAKEREF_DEF : NULL;
> +}
> +
> +static struct ref_tracker *xe_display_rpm_get_raw(const struct drm_device *drm)
> +{
> +	return xe_display_rpm_get(drm);

Oh, just an observation, you could also just point both .get and
.get_raw at xe_display_rpm_get in the struct initialization. Dunno
what's easier on the reader. *shrug*

Ditto for put.

BR,
Jani.

> +}
> +
> +static struct ref_tracker *xe_display_rpm_get_if_in_use(const struct drm_device *drm)
> +{
> +	return xe_pm_runtime_get_if_in_use(to_xe_device(drm)) ? INTEL_WAKEREF_DEF : NULL;
> +}
> +
> +static struct ref_tracker *xe_display_rpm_get_noresume(const struct drm_device *drm)
> +{
> +	xe_pm_runtime_get_noresume(to_xe_device(drm));
> +
> +	return INTEL_WAKEREF_DEF;
> +}
> +
> +static void xe_display_rpm_put(const struct drm_device *drm, struct ref_tracker *wakeref)
> +{
> +	if (wakeref)
> +		xe_pm_runtime_put(to_xe_device(drm));
> +}
> +
> +static void xe_display_rpm_put_raw(const struct drm_device *drm, struct ref_tracker *wakeref)
> +{
> +	xe_display_rpm_put(drm, wakeref);
> +}
> +
> +static void xe_display_rpm_put_unchecked(const struct drm_device *drm)
> +{
> +	xe_pm_runtime_put(to_xe_device(drm));
> +}
> +
> +static bool xe_display_rpm_suspended(const struct drm_device *drm)
> +{
> +	struct xe_device *xe = to_xe_device(drm);
> +
> +	return pm_runtime_suspended(xe->drm.dev);
> +}
> +
> +static void xe_display_rpm_assert_held(const struct drm_device *drm)
> +{
> +	/* FIXME */
> +}
> +
> +static void xe_display_rpm_assert_block(const struct drm_device *drm)
> +{
> +	/* FIXME */
> +}
> +
> +static void xe_display_rpm_assert_unblock(const struct drm_device *drm)
> +{
> +	/* FIXME */
> +}
> +
> +const struct intel_display_rpm_interface xe_display_rpm_interface = {
> +	.get = xe_display_rpm_get,
> +	.get_raw = xe_display_rpm_get_raw,
> +	.get_if_in_use = xe_display_rpm_get_if_in_use,
> +	.get_noresume = xe_display_rpm_get_noresume,
> +	.put = xe_display_rpm_put,
> +	.put_raw = xe_display_rpm_put_raw,
> +	.put_unchecked = xe_display_rpm_put_unchecked,
> +	.suspended = xe_display_rpm_suspended,
> +	.assert_held = xe_display_rpm_assert_held,
> +	.assert_block = xe_display_rpm_assert_block,
> +	.assert_unblock = xe_display_rpm_assert_unblock
> +};
> diff --git a/drivers/gpu/drm/xe/display/xe_display_rpm.h b/drivers/gpu/drm/xe/display/xe_display_rpm.h
> new file mode 100644
> index 0000000000000..0bf9d31e87c17
> --- /dev/null
> +++ b/drivers/gpu/drm/xe/display/xe_display_rpm.h
> @@ -0,0 +1,11 @@
> +/* SPDX-License-Identifier: MIT */
> +/*
> + * Copyright © 2025 Intel Corporation
> + */
> +
> +#ifndef _XE_DISPLAY_RPM_H_
> +#define _XE_DISPLAY_RPM_H_
> +
> +extern const struct intel_display_rpm_interface xe_display_rpm_interface;
> +
> +#endif /* _XE_DISPLAY_RPM_H_ */

-- 
Jani Nikula, Intel

  parent reply	other threads:[~2025-10-24 12:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-24  9:31 [PATCH v2 0/6] Use display parent interface for runtime pm Jouni Högander
2025-10-24  9:31 ` [PATCH v2 1/6] drm/{i915, xe}/display: pass parent interface to display probe Jouni Högander
2025-10-24 12:25   ` [PATCH v2 1/6] drm/{i915,xe}/display: " Jani Nikula
2025-10-24  9:31 ` [PATCH v2 2/6] drm/{i915, xe}/display: Add display runtime pm parent interface Jouni Högander
2025-10-24 12:25   ` [PATCH v2 2/6] drm/{i915,xe}/display: " Jani Nikula
2025-10-24  9:31 ` [PATCH v2 3/6] drm/i915/display: Runtime pm wrappers for display " Jouni Högander
2025-10-24 12:26   ` Jani Nikula
2025-10-24  9:31 ` [PATCH v2 4/6] drm/xe/display: " Jouni Högander
2025-10-24 12:27   ` Jani Nikula
2025-10-24 12:31   ` Jani Nikula [this message]
2025-10-24  9:31 ` [PATCH v2 5/6] drm/i915/display: Use display parent interface for i915 runtime pm Jouni Högander
2025-10-24 12:28   ` Jani Nikula
2025-10-24  9:31 ` [PATCH v2 6/6] drm/xe/display: Use display parent interface for xe " Jouni Högander
2025-10-24 12:28   ` Jani Nikula
2025-10-24  9:38 ` ✗ CI.checkpatch: warning for Use display parent interface for runtime pm (rev2) Patchwork
2025-10-24  9:39 ` ✓ CI.KUnit: success " Patchwork
2025-10-24  9:55 ` ✗ CI.checksparse: warning " Patchwork
2025-10-24 10:18 ` ✓ Xe.CI.BAT: success " Patchwork
2025-10-24 18:59 ` ✗ Xe.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=8f4bb6d726a6363f125f2ea8bda7c44afe51ee7c@intel.com \
    --to=jani.nikula@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