Skip to content

Commit 9536d60

Browse files
committed
drm/i915/rps: refactor display rps support
Make the gt rps code and display irq code interact via intel_display_rps.[ch], instead of direct access. Add no-op static inline stubs for xe instead of having a separate build unit doing nothing. All of this clarifies the interfaces between i915 core and display. Reviewed-by: Gustavo Sousa <[email protected]> Link: https://lore.kernel.org/r/ef2a46dc8f30b72282494f54e98cb5fed7523b58.1746536745.git.jani.nikula@intel.com Signed-off-by: Jani Nikula <[email protected]>
1 parent 7a3bf08 commit 9536d60

File tree

7 files changed

+56
-39
lines changed

7 files changed

+56
-39
lines changed

drivers/gpu/drm/i915/display/intel_display_irq.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
#include <drm/drm_vblank.h>
77

8-
#include "gt/intel_rps.h"
98
#include "i915_drv.h"
109
#include "i915_irq.h"
1110
#include "i915_reg.h"
@@ -15,6 +14,7 @@
1514
#include "intel_de.h"
1615
#include "intel_display_irq.h"
1716
#include "intel_display_rpm.h"
17+
#include "intel_display_rps.h"
1818
#include "intel_display_trace.h"
1919
#include "intel_display_types.h"
2020
#include "intel_dmc_wl.h"
@@ -876,7 +876,6 @@ static void ilk_gtt_fault_irq_handler(struct intel_display *display)
876876

877877
void ilk_display_irq_handler(struct intel_display *display, u32 de_iir)
878878
{
879-
struct drm_i915_private __maybe_unused *dev_priv = to_i915(display->drm);
880879
enum pipe pipe;
881880
u32 hotplug_trigger = de_iir & DE_DP_A_HOTPLUG;
882881

@@ -923,7 +922,7 @@ void ilk_display_irq_handler(struct intel_display *display, u32 de_iir)
923922
}
924923

925924
if (DISPLAY_VER(display) == 5 && de_iir & DE_PCU_EVENT)
926-
gen5_rps_irq_handler(&to_gt(dev_priv)->rps);
925+
ilk_display_rps_irq_handler(display);
927926
}
928927

929928
void ivb_display_irq_handler(struct intel_display *display, u32 de_iir)

drivers/gpu/drm/i915/display/intel_display_rps.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
#include "gt/intel_rps.h"
1010
#include "i915_drv.h"
11+
#include "i915_reg.h"
12+
#include "intel_display_irq.h"
1113
#include "intel_display_rps.h"
1214
#include "intel_display_types.h"
1315

@@ -81,3 +83,28 @@ void intel_display_rps_mark_interactive(struct intel_display *display,
8183
intel_rps_mark_interactive(&to_gt(i915)->rps, interactive);
8284
state->rps_interactive = interactive;
8385
}
86+
87+
void ilk_display_rps_enable(struct intel_display *display)
88+
{
89+
struct drm_i915_private *i915 = to_i915(display->drm);
90+
91+
spin_lock(&i915->irq_lock);
92+
ilk_enable_display_irq(display, DE_PCU_EVENT);
93+
spin_unlock(&i915->irq_lock);
94+
}
95+
96+
void ilk_display_rps_disable(struct intel_display *display)
97+
{
98+
struct drm_i915_private *i915 = to_i915(display->drm);
99+
100+
spin_lock(&i915->irq_lock);
101+
ilk_disable_display_irq(display, DE_PCU_EVENT);
102+
spin_unlock(&i915->irq_lock);
103+
}
104+
105+
void ilk_display_rps_irq_handler(struct intel_display *display)
106+
{
107+
struct drm_i915_private *i915 = to_i915(display->drm);
108+
109+
gen5_rps_irq_handler(&to_gt(i915)->rps);
110+
}

drivers/gpu/drm/i915/display/intel_display_rps.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,34 @@ struct drm_crtc;
1313
struct intel_atomic_state;
1414
struct intel_display;
1515

16+
#ifdef I915
1617
void intel_display_rps_boost_after_vblank(struct drm_crtc *crtc,
1718
struct dma_fence *fence);
1819
void intel_display_rps_mark_interactive(struct intel_display *display,
1920
struct intel_atomic_state *state,
2021
bool interactive);
22+
void ilk_display_rps_enable(struct intel_display *display);
23+
void ilk_display_rps_disable(struct intel_display *display);
24+
void ilk_display_rps_irq_handler(struct intel_display *display);
25+
#else
26+
static inline void intel_display_rps_boost_after_vblank(struct drm_crtc *crtc,
27+
struct dma_fence *fence)
28+
{
29+
}
30+
static inline void intel_display_rps_mark_interactive(struct intel_display *display,
31+
struct intel_atomic_state *state,
32+
bool interactive)
33+
{
34+
}
35+
static inline void ilk_display_rps_enable(struct intel_display *display)
36+
{
37+
}
38+
static inline void ilk_display_rps_disable(struct intel_display *display)
39+
{
40+
}
41+
static inline void ilk_display_rps_irq_handler(struct intel_display *display)
42+
{
43+
}
44+
#endif
2145

2246
#endif /* __INTEL_DISPLAY_RPS_H__ */

drivers/gpu/drm/i915/gt/intel_rps.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include <drm/intel/i915_drm.h>
99

1010
#include "display/intel_display.h"
11-
#include "display/intel_display_irq.h"
11+
#include "display/intel_display_rps.h"
1212
#include "i915_drv.h"
1313
#include "i915_irq.h"
1414
#include "i915_reg.h"
@@ -608,9 +608,7 @@ static bool gen5_rps_enable(struct intel_rps *rps)
608608
rps->ips.last_count2 = intel_uncore_read(uncore, GFXEC);
609609
rps->ips.last_time2 = ktime_get_raw_ns();
610610

611-
spin_lock(&i915->irq_lock);
612-
ilk_enable_display_irq(display, DE_PCU_EVENT);
613-
spin_unlock(&i915->irq_lock);
611+
ilk_display_rps_enable(display);
614612

615613
spin_unlock_irq(&mchdev_lock);
616614

@@ -628,9 +626,7 @@ static void gen5_rps_disable(struct intel_rps *rps)
628626

629627
spin_lock_irq(&mchdev_lock);
630628

631-
spin_lock(&i915->irq_lock);
632-
ilk_disable_display_irq(display, DE_PCU_EVENT);
633-
spin_unlock(&i915->irq_lock);
629+
ilk_display_rps_disable(display);
634630

635631
rgvswctl = intel_uncore_read16(uncore, MEMSWCTL);
636632

drivers/gpu/drm/xe/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ xe-$(CONFIG_DRM_XE_DISPLAY) += \
182182
display/xe_display.o \
183183
display/xe_display_misc.o \
184184
display/xe_display_rpm.o \
185-
display/xe_display_rps.o \
186185
display/xe_display_wa.o \
187186
display/xe_dsb_buffer.o \
188187
display/xe_fb_pin.o \

drivers/gpu/drm/xe/compat-i915-headers/gt/intel_rps.h

Lines changed: 0 additions & 11 deletions
This file was deleted.

drivers/gpu/drm/xe/display/xe_display_rps.c

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)