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 07/10] drm/i915/rps: call RPS functions via the parent interface
Date: Fri, 14 Nov 2025 16:13:00 +0200 [thread overview]
Message-ID: <aRc47IAHVAeWMvF3@intel.com> (raw)
In-Reply-To: <51b4e18a2d306e6b903a5ea9a73f3ef6f30a09ff.1763115899.git.jani.nikula@intel.com>
On Fri, Nov 14, 2025 at 12:26:46PM +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.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
> .../gpu/drm/i915/display/intel_display_rps.c | 32 ++++++++---------
> 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 | 34 +++++++++++++++++++
> 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, 93 insertions(+), 16 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..e70c4f0eab80 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,10 @@ 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);
> -
> - /*
> - * 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.
> - */
> - if (!i915_request_started(rq))
> - intel_rps_boost(rq);
> + struct intel_display *display = to_intel_display(wait->crtc->dev);
> +
> + intel_parent_rps_boost(display, wait->fence);
> +
> dma_fence_put(wait->fence);
>
> drm_crtc_vblank_put(wait->crtc);
> @@ -49,6 +46,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 +77,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 +104,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 3dd31852e2e1..9370da9d215c 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(struct intel_display *display, struct dma_fence *fence)
> +{
> + if (display->parent->rps)
> + display->parent->rps->boost(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 fc6799db0361..41d6943786fb 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(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_fence_support_legacy(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..61d746bda462 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,39 @@ bool i915_gpu_turbo_disable(void)
> }
> EXPORT_SYMBOL_GPL(i915_gpu_turbo_disable);
>
> +static void boost(struct dma_fence *fence)
> +{
> + struct i915_request *rq = to_request(fence);
> +
> + /*
> + * 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.
> + */
Hmm. The comment is now rather detached from the actual vblank
related details. So I'd kinda prefer to keep the comment in the
caller, but then the request started vs. not started stuff gets
confusing. Argh.
Maybe
a) comment in caller and make this .boost_if_not_started()
b) comment here and make this .boost_after_missed_vblank()
?
Dunno.
> + 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 = boost,
> + .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 814b430de960..ac189b90f985 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 fence_support_legacy(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,
> .fence_support_legacy = fence_support_legacy,
> };
> diff --git a/include/drm/intel/display_parent_interface.h b/include/drm/intel/display_parent_interface.h
> index 11767adb0083..2ea68a31224d 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)(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 14:13 UTC|newest]
Thread overview: 31+ 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ä [this message]
2025-11-14 15:31 ` [PATCH v2] " Jani Nikula
2025-11-14 16:22 ` Ville Syrjälä
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 11:22 ` ✗ CI.checkpatch: warning for drm/i915: call irq and rps through the parent interface Patchwork
2025-11-14 11:24 ` ✓ CI.KUnit: success " Patchwork
2025-11-14 11:39 ` ✗ CI.checksparse: warning " Patchwork
2025-11-14 12:33 ` ✓ Xe.CI.BAT: success " Patchwork
2025-11-14 19:45 ` ✗ 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=aRc47IAHVAeWMvF3@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;
as well as URLs for NNTP newsgroup(s).