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/dpt: move suspend/resume to parent interface

Add per-vm DPT suspend/resume calls to the display parent interface, and
lift the generic code away from i915 specific code.

Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Link: https://patch.msgid.link/080945a49559ec1f5183ad409e1526736e828d90.1772030909.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>

+91 -64
-3
drivers/gpu/drm/i915/display/intel_dpt.h
··· 10 10 11 11 struct i915_address_space; 12 12 struct i915_vma; 13 - struct intel_display; 14 13 15 14 struct i915_vma *intel_dpt_pin_to_ggtt(struct i915_address_space *vm, 16 15 unsigned int alignment); 17 16 void intel_dpt_unpin_from_ggtt(struct i915_address_space *vm); 18 - void intel_dpt_suspend(struct intel_display *display); 19 - void intel_dpt_resume(struct intel_display *display); 20 17 u64 intel_dpt_offset(struct i915_vma *dpt_vma); 21 18 22 19 #endif /* __INTEL_DPT_H__ */
+59
drivers/gpu/drm/i915/display/intel_dpt_common.c
··· 7 7 #include "intel_display_regs.h" 8 8 #include "intel_display_types.h" 9 9 #include "intel_dpt_common.h" 10 + #include "intel_parent.h" 10 11 #include "skl_universal_plane_regs.h" 11 12 12 13 void intel_dpt_configure(struct intel_crtc *crtc) ··· 33 32 display->params.enable_dpt ? 0 : 34 33 CHICKEN_MISC_DISABLE_DPT); 35 34 } 35 + } 36 + 37 + /** 38 + * intel_dpt_suspend - suspend the memory mapping for all DPT FBs during system suspend 39 + * @display: display device instance 40 + * 41 + * Suspend the memory mapping during system suspend for all framebuffers which 42 + * are mapped to HW via a GGTT->DPT page table. 43 + * 44 + * This function must be called before the mappings in GGTT are suspended calling 45 + * i915_ggtt_suspend(). 46 + */ 47 + void intel_dpt_suspend(struct intel_display *display) 48 + { 49 + struct drm_framebuffer *drm_fb; 50 + 51 + if (!HAS_DISPLAY(display)) 52 + return; 53 + 54 + mutex_lock(&display->drm->mode_config.fb_lock); 55 + 56 + drm_for_each_fb(drm_fb, display->drm) { 57 + struct intel_framebuffer *fb = to_intel_framebuffer(drm_fb); 58 + 59 + if (fb->dpt_vm) 60 + intel_parent_dpt_suspend(display, fb->dpt_vm); 61 + } 62 + 63 + mutex_unlock(&display->drm->mode_config.fb_lock); 64 + } 65 + 66 + /** 67 + * intel_dpt_resume - restore the memory mapping for all DPT FBs during system resume 68 + * @display: display device instance 69 + * 70 + * Restore the memory mapping during system resume for all framebuffers which 71 + * are mapped to HW via a GGTT->DPT page table. The content of these page 72 + * tables are not stored in the hibernation image during S4 and S3RST->S4 73 + * transitions, so here we reprogram the PTE entries in those tables. 74 + * 75 + * This function must be called after the mappings in GGTT have been restored calling 76 + * i915_ggtt_resume(). 77 + */ 78 + void intel_dpt_resume(struct intel_display *display) 79 + { 80 + struct drm_framebuffer *drm_fb; 81 + 82 + if (!HAS_DISPLAY(display)) 83 + return; 84 + 85 + mutex_lock(&display->drm->mode_config.fb_lock); 86 + drm_for_each_fb(drm_fb, display->drm) { 87 + struct intel_framebuffer *fb = to_intel_framebuffer(drm_fb); 88 + 89 + if (fb->dpt_vm) 90 + intel_parent_dpt_resume(display, fb->dpt_vm); 91 + } 92 + mutex_unlock(&display->drm->mode_config.fb_lock); 36 93 }
+3
drivers/gpu/drm/i915/display/intel_dpt_common.h
··· 7 7 #define __INTEL_DPT_COMMON_H__ 8 8 9 9 struct intel_crtc; 10 + struct intel_display; 10 11 11 12 void intel_dpt_configure(struct intel_crtc *crtc); 13 + void intel_dpt_suspend(struct intel_display *display); 14 + void intel_dpt_resume(struct intel_display *display); 12 15 13 16 #endif /* __INTEL_DPT_COMMON_H__ */
+12
drivers/gpu/drm/i915/display/intel_parent.c
··· 40 40 display->parent->dpt->destroy(vm); 41 41 } 42 42 43 + void intel_parent_dpt_suspend(struct intel_display *display, struct i915_address_space *vm) 44 + { 45 + if (display->parent->dpt) 46 + display->parent->dpt->suspend(vm); 47 + } 48 + 49 + void intel_parent_dpt_resume(struct intel_display *display, struct i915_address_space *vm) 50 + { 51 + if (display->parent->dpt) 52 + display->parent->dpt->resume(vm); 53 + } 54 + 43 55 /* hdcp */ 44 56 ssize_t intel_parent_hdcp_gsc_msg_send(struct intel_display *display, 45 57 struct intel_hdcp_gsc_context *gsc_context,
+2
drivers/gpu/drm/i915/display/intel_parent.h
··· 20 20 struct drm_gem_object *obj, 21 21 size_t size); 22 22 void intel_parent_dpt_destroy(struct intel_display *display, struct i915_address_space *vm); 23 + void intel_parent_dpt_suspend(struct intel_display *display, struct i915_address_space *vm); 24 + void intel_parent_dpt_resume(struct intel_display *display, struct i915_address_space *vm); 23 25 24 26 /* hdcp */ 25 27 ssize_t intel_parent_hdcp_gsc_msg_send(struct intel_display *display,
+12 -60
drivers/gpu/drm/i915/i915_dpt.c
··· 8 8 9 9 #include "display/intel_display_core.h" 10 10 #include "display/intel_display_rpm.h" 11 - #include "display/intel_display_types.h" 12 11 #include "display/intel_dpt.h" 13 - #include "display/intel_fb.h" 14 12 #include "gem/i915_gem_domain.h" 15 13 #include "gem/i915_gem_internal.h" 16 14 #include "gem/i915_gem_lmem.h" ··· 183 185 i915_vma_put(dpt->vma); 184 186 } 185 187 186 - /** 187 - * intel_dpt_resume - restore the memory mapping for all DPT FBs during system resume 188 - * @display: display device instance 189 - * 190 - * Restore the memory mapping during system resume for all framebuffers which 191 - * are mapped to HW via a GGTT->DPT page table. The content of these page 192 - * tables are not stored in the hibernation image during S4 and S3RST->S4 193 - * transitions, so here we reprogram the PTE entries in those tables. 194 - * 195 - * This function must be called after the mappings in GGTT have been restored calling 196 - * i915_ggtt_resume(). 197 - */ 198 - void intel_dpt_resume(struct intel_display *display) 199 - { 200 - struct drm_framebuffer *drm_fb; 201 - 202 - if (!HAS_DISPLAY(display)) 203 - return; 204 - 205 - mutex_lock(&display->drm->mode_config.fb_lock); 206 - drm_for_each_fb(drm_fb, display->drm) { 207 - struct intel_framebuffer *fb = to_intel_framebuffer(drm_fb); 208 - 209 - if (fb->dpt_vm) 210 - i915_ggtt_resume_vm(fb->dpt_vm, true); 211 - } 212 - mutex_unlock(&display->drm->mode_config.fb_lock); 213 - } 214 - 215 - /** 216 - * intel_dpt_suspend - suspend the memory mapping for all DPT FBs during system suspend 217 - * @display: display device instance 218 - * 219 - * Suspend the memory mapping during system suspend for all framebuffers which 220 - * are mapped to HW via a GGTT->DPT page table. 221 - * 222 - * This function must be called before the mappings in GGTT are suspended calling 223 - * i915_ggtt_suspend(). 224 - */ 225 - void intel_dpt_suspend(struct intel_display *display) 226 - { 227 - struct drm_framebuffer *drm_fb; 228 - 229 - if (!HAS_DISPLAY(display)) 230 - return; 231 - 232 - mutex_lock(&display->drm->mode_config.fb_lock); 233 - 234 - drm_for_each_fb(drm_fb, display->drm) { 235 - struct intel_framebuffer *fb = to_intel_framebuffer(drm_fb); 236 - 237 - if (fb->dpt_vm) 238 - i915_ggtt_suspend_vm(fb->dpt_vm, true); 239 - } 240 - 241 - mutex_unlock(&display->drm->mode_config.fb_lock); 242 - } 243 - 244 188 static struct i915_address_space *i915_dpt_create(struct drm_gem_object *obj, size_t size) 245 189 { 246 190 struct drm_i915_private *i915 = to_i915(obj->dev); ··· 256 316 i915_vm_put(&dpt->vm); 257 317 } 258 318 319 + static void i915_dpt_suspend(struct i915_address_space *vm) 320 + { 321 + i915_ggtt_suspend_vm(vm, true); 322 + } 323 + 324 + static void i915_dpt_resume(struct i915_address_space *vm) 325 + { 326 + i915_ggtt_resume_vm(vm, true); 327 + } 328 + 259 329 u64 intel_dpt_offset(struct i915_vma *dpt_vma) 260 330 { 261 331 return i915_vma_offset(dpt_vma); ··· 274 324 const struct intel_display_dpt_interface i915_display_dpt_interface = { 275 325 .create = i915_dpt_create, 276 326 .destroy = i915_dpt_destroy, 327 + .suspend = i915_dpt_suspend, 328 + .resume = i915_dpt_resume, 277 329 };
+1 -1
drivers/gpu/drm/i915/i915_driver.c
··· 59 59 #include "display/intel_display_power.h" 60 60 #include "display/intel_dmc.h" 61 61 #include "display/intel_dp.h" 62 - #include "display/intel_dpt.h" 62 + #include "display/intel_dpt_common.h" 63 63 #include "display/intel_dram.h" 64 64 #include "display/intel_encoder.h" 65 65 #include "display/intel_fbdev.h"
+2
include/drm/intel/display_parent_interface.h
··· 27 27 struct intel_display_dpt_interface { 28 28 struct i915_address_space *(*create)(struct drm_gem_object *obj, size_t size); 29 29 void (*destroy)(struct i915_address_space *vm); 30 + void (*suspend)(struct i915_address_space *vm); 31 + void (*resume)(struct i915_address_space *vm); 30 32 }; 31 33 32 34 struct intel_display_dsb_interface {