From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v2] drm/i915/rps: call RPS functions via the parent interface
Date: Fri, 14 Nov 2025 18:22:54 +0200 [thread overview]
Message-ID: <aRdXXpT2y4ZleS2s@intel.com> (raw)
In-Reply-To: <20251114153109.1196370-1-jani.nikula@intel.com>
On Fri, Nov 14, 2025 at 05:31:09PM +0200, Jani Nikula wrote:
> Add struct intel_display_rps_interface to the display parent interface,
> and call the RPS functions through it. The RPS interface is optional.
>
> v2: s/boost/boost_if_not_started/ and keep comment in caller (Ville)
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
> .../gpu/drm/i915/display/intel_display_rps.c | 27 ++++++++++-------
> drivers/gpu/drm/i915/display/intel_parent.c | 23 +++++++++++++++
> drivers/gpu/drm/i915/display/intel_parent.h | 6 ++++
> drivers/gpu/drm/i915/gt/intel_rps.c | 29 +++++++++++++++++++
> drivers/gpu/drm/i915/gt/intel_rps.h | 2 ++
> drivers/gpu/drm/i915/i915_driver.c | 2 ++
> include/drm/intel/display_parent_interface.h | 10 +++++++
> 7 files changed, 88 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display_rps.c b/drivers/gpu/drm/i915/display/intel_display_rps.c
> index b6720f7c09d9..d639d9152bf5 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_rps.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_rps.c
> @@ -3,16 +3,18 @@
> * Copyright © 2023 Intel Corporation
> */
>
> +#include <linux/dma-fence.h>
> +
> #include <drm/drm_crtc.h>
> #include <drm/drm_vblank.h>
>
> -#include "gt/intel_rps.h"
> -#include "i915_drv.h"
> #include "i915_reg.h"
> +#include "i915_request.h"
> #include "intel_display_core.h"
> #include "intel_display_irq.h"
> #include "intel_display_rps.h"
> #include "intel_display_types.h"
> +#include "intel_parent.h"
>
> struct wait_rps_boost {
> struct wait_queue_entry wait;
> @@ -25,15 +27,15 @@ static int do_rps_boost(struct wait_queue_entry *_wait,
> unsigned mode, int sync, void *key)
> {
> struct wait_rps_boost *wait = container_of(_wait, typeof(*wait), wait);
> - struct i915_request *rq = to_request(wait->fence);
> + struct intel_display *display = to_intel_display(wait->crtc->dev);
>
> /*
> * If we missed the vblank, but the request is already running it
> * is reasonable to assume that it will complete before the next
> - * vblank without our intervention, so leave RPS alone.
> + * vblank without our intervention, so leave RPS alone if not started.
> */
> - if (!i915_request_started(rq))
> - intel_rps_boost(rq);
> + intel_parent_rps_boost_if_not_started(display, wait->fence);
> +
> dma_fence_put(wait->fence);
>
> drm_crtc_vblank_put(wait->crtc);
> @@ -49,6 +51,9 @@ void intel_display_rps_boost_after_vblank(struct drm_crtc *crtc,
> struct intel_display *display = to_intel_display(crtc->dev);
> struct wait_rps_boost *wait;
>
> + if (!intel_parent_rps_available(display))
> + return;
> +
> if (!dma_fence_is_i915(fence))
> return;
>
> @@ -77,12 +82,14 @@ void intel_display_rps_mark_interactive(struct intel_display *display,
> struct intel_atomic_state *state,
> bool interactive)
> {
> - struct drm_i915_private *i915 = to_i915(display->drm);
> + if (!intel_parent_rps_available(display))
> + return;
>
> if (state->rps_interactive == interactive)
> return;
>
> - intel_rps_mark_interactive(&to_gt(i915)->rps, interactive);
> + intel_parent_rps_mark_interactive(display, interactive);
> +
> state->rps_interactive = interactive;
> }
>
> @@ -102,7 +109,5 @@ void ilk_display_rps_disable(struct intel_display *display)
>
> void ilk_display_rps_irq_handler(struct intel_display *display)
> {
> - struct drm_i915_private *i915 = to_i915(display->drm);
> -
> - gen5_rps_irq_handler(&to_gt(i915)->rps);
> + intel_parent_rps_ilk_irq_handler(display);
> }
> diff --git a/drivers/gpu/drm/i915/display/intel_parent.c b/drivers/gpu/drm/i915/display/intel_parent.c
> index 535065e57213..6c131196718e 100644
> --- a/drivers/gpu/drm/i915/display/intel_parent.c
> +++ b/drivers/gpu/drm/i915/display/intel_parent.c
> @@ -32,6 +32,29 @@ void intel_parent_irq_synchronize(struct intel_display *display)
> display->parent->irq->synchronize(display->drm);
> }
>
> +bool intel_parent_rps_available(struct intel_display *display)
> +{
> + return display->parent->rps;
> +}
> +
> +void intel_parent_rps_boost_if_not_started(struct intel_display *display, struct dma_fence *fence)
> +{
> + if (display->parent->rps)
> + display->parent->rps->boost_if_not_started(fence);
> +}
> +
> +void intel_parent_rps_mark_interactive(struct intel_display *display, bool interactive)
> +{
> + if (display->parent->rps)
> + display->parent->rps->mark_interactive(display->drm, interactive);
> +}
> +
> +void intel_parent_rps_ilk_irq_handler(struct intel_display *display)
> +{
> + if (display->parent->rps)
> + display->parent->rps->ilk_irq_handler(display->drm);
> +}
> +
> bool intel_parent_vgpu_active(struct intel_display *display)
> {
> return display->parent->vgpu_active && display->parent->vgpu_active(display->drm);
> diff --git a/drivers/gpu/drm/i915/display/intel_parent.h b/drivers/gpu/drm/i915/display/intel_parent.h
> index 04320d937777..12cfbea95aa1 100644
> --- a/drivers/gpu/drm/i915/display/intel_parent.h
> +++ b/drivers/gpu/drm/i915/display/intel_parent.h
> @@ -6,11 +6,17 @@
>
> #include <linux/types.h>
>
> +struct dma_fence;
> struct intel_display;
>
> bool intel_parent_irq_enabled(struct intel_display *display);
> void intel_parent_irq_synchronize(struct intel_display *display);
>
> +bool intel_parent_rps_available(struct intel_display *display);
> +void intel_parent_rps_boost_if_not_started(struct intel_display *display, struct dma_fence *fence);
> +void intel_parent_rps_mark_interactive(struct intel_display *display, bool interactive);
> +void intel_parent_rps_ilk_irq_handler(struct intel_display *display);
> +
> bool intel_parent_vgpu_active(struct intel_display *display);
>
> bool intel_parent_has_fenced_regions(struct intel_display *display);
> diff --git a/drivers/gpu/drm/i915/gt/intel_rps.c b/drivers/gpu/drm/i915/gt/intel_rps.c
> index b01c837ab646..c42a1ee42b58 100644
> --- a/drivers/gpu/drm/i915/gt/intel_rps.c
> +++ b/drivers/gpu/drm/i915/gt/intel_rps.c
> @@ -6,6 +6,7 @@
> #include <linux/string_helpers.h>
>
> #include <drm/intel/i915_drm.h>
> +#include <drm/intel/display_parent_interface.h>
>
> #include "display/intel_display_rps.h"
> #include "display/vlv_clock.h"
> @@ -2914,6 +2915,34 @@ bool i915_gpu_turbo_disable(void)
> }
> EXPORT_SYMBOL_GPL(i915_gpu_turbo_disable);
>
> +static void boost_if_not_started(struct dma_fence *fence)
> +{
> + struct i915_request *rq = to_request(fence);
> +
> + if (!i915_request_started(rq))
> + intel_rps_boost(rq);
> +}
> +
> +static void mark_interactive(struct drm_device *drm, bool interactive)
> +{
> + struct drm_i915_private *i915 = to_i915(drm);
> +
> + intel_rps_mark_interactive(&to_gt(i915)->rps, interactive);
> +}
> +
> +static void ilk_irq_handler(struct drm_device *drm)
> +{
> + struct drm_i915_private *i915 = to_i915(drm);
> +
> + gen5_rps_irq_handler(&to_gt(i915)->rps);
> +}
> +
> +const struct intel_display_rps_interface i915_display_rps_interface = {
> + .boost_if_not_started = boost_if_not_started,
> + .mark_interactive = mark_interactive,
> + .ilk_irq_handler = ilk_irq_handler,
> +};
> +
> #if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
> #include "selftest_rps.c"
> #include "selftest_slpc.c"
> diff --git a/drivers/gpu/drm/i915/gt/intel_rps.h b/drivers/gpu/drm/i915/gt/intel_rps.h
> index 92fb01f5a452..5dbcebd7d4a5 100644
> --- a/drivers/gpu/drm/i915/gt/intel_rps.h
> +++ b/drivers/gpu/drm/i915/gt/intel_rps.h
> @@ -128,4 +128,6 @@ static inline void intel_rps_clear_timer(struct intel_rps *rps)
> clear_bit(INTEL_RPS_TIMER, &rps->flags);
> }
>
> +extern const struct intel_display_rps_interface i915_display_rps_interface;
> +
> #endif /* INTEL_RPS_H */
> diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
> index 9ba46850da72..7e1dedabf0ee 100644
> --- a/drivers/gpu/drm/i915/i915_driver.c
> +++ b/drivers/gpu/drm/i915/i915_driver.c
> @@ -81,6 +81,7 @@
> #include "gt/intel_gt_pm.h"
> #include "gt/intel_gt_print.h"
> #include "gt/intel_rc6.h"
> +#include "gt/intel_rps.h"
>
> #include "pxp/intel_pxp.h"
> #include "pxp/intel_pxp_debugfs.h"
> @@ -752,6 +753,7 @@ static bool has_fenced_regions(struct drm_device *drm)
> static const struct intel_display_parent_interface parent = {
> .rpm = &i915_display_rpm_interface,
> .irq = &i915_display_irq_interface,
> + .rps = &i915_display_rps_interface,
> .vgpu_active = vgpu_active,
> .has_fenced_regions = has_fenced_regions,
> };
> diff --git a/include/drm/intel/display_parent_interface.h b/include/drm/intel/display_parent_interface.h
> index 927d964f2071..0a6a26234fbe 100644
> --- a/include/drm/intel/display_parent_interface.h
> +++ b/include/drm/intel/display_parent_interface.h
> @@ -6,6 +6,7 @@
>
> #include <linux/types.h>
>
> +struct dma_fence;
> struct drm_device;
> struct ref_tracker;
>
> @@ -30,6 +31,12 @@ struct intel_display_irq_interface {
> void (*synchronize)(struct drm_device *drm);
> };
>
> +struct intel_display_rps_interface {
> + void (*boost_if_not_started)(struct dma_fence *fence);
> + void (*mark_interactive)(struct drm_device *drm, bool interactive);
> + void (*ilk_irq_handler)(struct drm_device *drm);
> +};
> +
> /**
> * struct intel_display_parent_interface - services parent driver provides to display
> *
> @@ -49,6 +56,9 @@ struct intel_display_parent_interface {
> /** @irq: IRQ interface */
> const struct intel_display_irq_interface *irq;
>
> + /** @rpm: RPS interface. Optional. */
> + const struct intel_display_rps_interface *rps;
> +
> /** @vgpu_active: Is vGPU active? Optional. */
> bool (*vgpu_active)(struct drm_device *drm);
>
> --
> 2.47.3
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2025-11-14 16:23 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-14 10:26 [PATCH 00/10] drm/i915: call irq and rps through the parent interface Jani Nikula
2025-11-14 10:26 ` [PATCH 01/10] drm/{i915, xe}/display: duplicate gen2 irq/error init/reset in display irq Jani Nikula
2025-11-14 10:26 ` [PATCH 02/10] drm/i915/display: convert the display irq interfaces to struct intel_display Jani Nikula
2025-11-14 10:26 ` [PATCH 03/10] drm/{i915, xe}/display: move irq calls to parent interface Jani Nikula
2025-11-14 13:57 ` [PATCH 03/10] drm/{i915,xe}/display: " Ville Syrjälä
2025-11-14 10:26 ` [PATCH 04/10] drm/i915: add .vgpu_active " Jani Nikula
2025-11-14 13:59 ` Ville Syrjälä
2025-11-14 10:26 ` [PATCH 05/10] drm/i915: add .fence_support_legacy " Jani Nikula
2025-11-14 14:03 ` Ville Syrjälä
2025-11-14 15:16 ` [PATCH v2] FIXME drm/i915: add .has_fenced_regions " Jani Nikula
2025-11-14 15:18 ` Jani Nikula
2025-11-14 16:18 ` Ville Syrjälä
2025-11-14 10:26 ` [PATCH 06/10] drm/i915/rps: store struct dma_fence in struct wait_rps_boost Jani Nikula
2025-11-14 14:03 ` Ville Syrjälä
2025-11-14 10:26 ` [PATCH 07/10] drm/i915/rps: call RPS functions via the parent interface Jani Nikula
2025-11-14 14:13 ` Ville Syrjälä
2025-11-14 15:31 ` [PATCH v2] " Jani Nikula
2025-11-14 16:22 ` Ville Syrjälä [this message]
2025-11-14 10:26 ` [PATCH 08/10] drm/i915/rps: postpone i915 fence check to boost Jani Nikula
2025-11-14 14:15 ` Ville Syrjälä
2025-11-14 14:21 ` Ville Syrjälä
2025-11-14 10:26 ` [PATCH 09/10] drm/i915: add .fence_priority_display to parent interface Jani Nikula
2025-11-14 14:19 ` Ville Syrjälä
2025-11-14 15:32 ` [PATCH v3] " Jani Nikula
2025-11-14 10:26 ` [PATCH 10/10] drm/xe/rps: build RPS as part of xe Jani Nikula
2025-11-14 14:20 ` Ville Syrjälä
2025-11-14 12:03 ` ✓ i915.CI.BAT: success for drm/i915: call irq and rps through the parent interface Patchwork
2025-11-15 5:22 ` ✗ i915.CI.Full: failure for drm/i915: call irq and rps through the parent interface (rev4) 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=aRdXXpT2y4ZleS2s@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=jani.nikula@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