Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/i915/rps: call RPS functions via the parent interface

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)

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patch.msgid.link/6a6c4420d9f2d9a545ee6df4cad5fdc32a86636b.1763370931.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>

+88 -11
+16 -11
drivers/gpu/drm/i915/display/intel_display_rps.c
··· 3 3 * Copyright © 2023 Intel Corporation 4 4 */ 5 5 6 + #include <linux/dma-fence.h> 7 + 6 8 #include <drm/drm_crtc.h> 7 9 #include <drm/drm_vblank.h> 8 10 9 - #include "gt/intel_rps.h" 10 - #include "i915_drv.h" 11 11 #include "i915_reg.h" 12 + #include "i915_request.h" 12 13 #include "intel_display_core.h" 13 14 #include "intel_display_irq.h" 14 15 #include "intel_display_rps.h" 15 16 #include "intel_display_types.h" 17 + #include "intel_parent.h" 16 18 17 19 struct wait_rps_boost { 18 20 struct wait_queue_entry wait; ··· 27 25 unsigned mode, int sync, void *key) 28 26 { 29 27 struct wait_rps_boost *wait = container_of(_wait, typeof(*wait), wait); 30 - struct i915_request *rq = to_request(wait->fence); 28 + struct intel_display *display = to_intel_display(wait->crtc->dev); 31 29 32 30 /* 33 31 * If we missed the vblank, but the request is already running it 34 32 * is reasonable to assume that it will complete before the next 35 - * vblank without our intervention, so leave RPS alone. 33 + * vblank without our intervention, so leave RPS alone if not started. 36 34 */ 37 - if (!i915_request_started(rq)) 38 - intel_rps_boost(rq); 35 + intel_parent_rps_boost_if_not_started(display, wait->fence); 36 + 39 37 dma_fence_put(wait->fence); 40 38 41 39 drm_crtc_vblank_put(wait->crtc); ··· 50 48 { 51 49 struct intel_display *display = to_intel_display(crtc->dev); 52 50 struct wait_rps_boost *wait; 51 + 52 + if (!intel_parent_rps_available(display)) 53 + return; 53 54 54 55 if (!dma_fence_is_i915(fence)) 55 56 return; ··· 82 77 struct intel_atomic_state *state, 83 78 bool interactive) 84 79 { 85 - struct drm_i915_private *i915 = to_i915(display->drm); 80 + if (!intel_parent_rps_available(display)) 81 + return; 86 82 87 83 if (state->rps_interactive == interactive) 88 84 return; 89 85 90 - intel_rps_mark_interactive(&to_gt(i915)->rps, interactive); 86 + intel_parent_rps_mark_interactive(display, interactive); 87 + 91 88 state->rps_interactive = interactive; 92 89 } 93 90 ··· 109 102 110 103 void ilk_display_rps_irq_handler(struct intel_display *display) 111 104 { 112 - struct drm_i915_private *i915 = to_i915(display->drm); 113 - 114 - gen5_rps_irq_handler(&to_gt(i915)->rps); 105 + intel_parent_rps_ilk_irq_handler(display); 115 106 }
+23
drivers/gpu/drm/i915/display/intel_parent.c
··· 32 32 display->parent->irq->synchronize(display->drm); 33 33 } 34 34 35 + bool intel_parent_rps_available(struct intel_display *display) 36 + { 37 + return display->parent->rps; 38 + } 39 + 40 + void intel_parent_rps_boost_if_not_started(struct intel_display *display, struct dma_fence *fence) 41 + { 42 + if (display->parent->rps) 43 + display->parent->rps->boost_if_not_started(fence); 44 + } 45 + 46 + void intel_parent_rps_mark_interactive(struct intel_display *display, bool interactive) 47 + { 48 + if (display->parent->rps) 49 + display->parent->rps->mark_interactive(display->drm, interactive); 50 + } 51 + 52 + void intel_parent_rps_ilk_irq_handler(struct intel_display *display) 53 + { 54 + if (display->parent->rps) 55 + display->parent->rps->ilk_irq_handler(display->drm); 56 + } 57 + 35 58 bool intel_parent_vgpu_active(struct intel_display *display) 36 59 { 37 60 return display->parent->vgpu_active && display->parent->vgpu_active(display->drm);
+6
drivers/gpu/drm/i915/display/intel_parent.h
··· 6 6 7 7 #include <linux/types.h> 8 8 9 + struct dma_fence; 9 10 struct intel_display; 10 11 11 12 bool intel_parent_irq_enabled(struct intel_display *display); 12 13 void intel_parent_irq_synchronize(struct intel_display *display); 14 + 15 + bool intel_parent_rps_available(struct intel_display *display); 16 + void intel_parent_rps_boost_if_not_started(struct intel_display *display, struct dma_fence *fence); 17 + void intel_parent_rps_mark_interactive(struct intel_display *display, bool interactive); 18 + void intel_parent_rps_ilk_irq_handler(struct intel_display *display); 13 19 14 20 bool intel_parent_vgpu_active(struct intel_display *display); 15 21
+29
drivers/gpu/drm/i915/gt/intel_rps.c
··· 6 6 #include <linux/string_helpers.h> 7 7 8 8 #include <drm/intel/i915_drm.h> 9 + #include <drm/intel/display_parent_interface.h> 9 10 10 11 #include "display/intel_display_rps.h" 11 12 #include "display/vlv_clock.h" ··· 2914 2913 return ret; 2915 2914 } 2916 2915 EXPORT_SYMBOL_GPL(i915_gpu_turbo_disable); 2916 + 2917 + static void boost_if_not_started(struct dma_fence *fence) 2918 + { 2919 + struct i915_request *rq = to_request(fence); 2920 + 2921 + if (!i915_request_started(rq)) 2922 + intel_rps_boost(rq); 2923 + } 2924 + 2925 + static void mark_interactive(struct drm_device *drm, bool interactive) 2926 + { 2927 + struct drm_i915_private *i915 = to_i915(drm); 2928 + 2929 + intel_rps_mark_interactive(&to_gt(i915)->rps, interactive); 2930 + } 2931 + 2932 + static void ilk_irq_handler(struct drm_device *drm) 2933 + { 2934 + struct drm_i915_private *i915 = to_i915(drm); 2935 + 2936 + gen5_rps_irq_handler(&to_gt(i915)->rps); 2937 + } 2938 + 2939 + const struct intel_display_rps_interface i915_display_rps_interface = { 2940 + .boost_if_not_started = boost_if_not_started, 2941 + .mark_interactive = mark_interactive, 2942 + .ilk_irq_handler = ilk_irq_handler, 2943 + }; 2917 2944 2918 2945 #if IS_ENABLED(CONFIG_DRM_I915_SELFTEST) 2919 2946 #include "selftest_rps.c"
+2
drivers/gpu/drm/i915/gt/intel_rps.h
··· 128 128 clear_bit(INTEL_RPS_TIMER, &rps->flags); 129 129 } 130 130 131 + extern const struct intel_display_rps_interface i915_display_rps_interface; 132 + 131 133 #endif /* INTEL_RPS_H */
+2
drivers/gpu/drm/i915/i915_driver.c
··· 81 81 #include "gt/intel_gt_pm.h" 82 82 #include "gt/intel_gt_print.h" 83 83 #include "gt/intel_rc6.h" 84 + #include "gt/intel_rps.h" 84 85 85 86 #include "pxp/intel_pxp.h" 86 87 #include "pxp/intel_pxp_debugfs.h" ··· 753 752 static const struct intel_display_parent_interface parent = { 754 753 .rpm = &i915_display_rpm_interface, 755 754 .irq = &i915_display_irq_interface, 755 + .rps = &i915_display_rps_interface, 756 756 .vgpu_active = vgpu_active, 757 757 .has_fenced_regions = has_fenced_regions, 758 758 };
+10
include/drm/intel/display_parent_interface.h
··· 6 6 7 7 #include <linux/types.h> 8 8 9 + struct dma_fence; 9 10 struct drm_device; 10 11 struct ref_tracker; 11 12 ··· 31 30 void (*synchronize)(struct drm_device *drm); 32 31 }; 33 32 33 + struct intel_display_rps_interface { 34 + void (*boost_if_not_started)(struct dma_fence *fence); 35 + void (*mark_interactive)(struct drm_device *drm, bool interactive); 36 + void (*ilk_irq_handler)(struct drm_device *drm); 37 + }; 38 + 34 39 /** 35 40 * struct intel_display_parent_interface - services parent driver provides to display 36 41 * ··· 55 48 56 49 /** @irq: IRQ interface */ 57 50 const struct intel_display_irq_interface *irq; 51 + 52 + /** @rpm: RPS interface. Optional. */ 53 + const struct intel_display_rps_interface *rps; 58 54 59 55 /** @vgpu_active: Is vGPU active? Optional. */ 60 56 bool (*vgpu_active)(struct drm_device *drm);