]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/i915/dpt: move suspend/resume to parent interface
authorJani Nikula <jani.nikula@intel.com>
Wed, 25 Feb 2026 14:49:10 +0000 (16:49 +0200)
committerJani Nikula <jani.nikula@intel.com>
Thu, 26 Feb 2026 21:28:57 +0000 (23:28 +0200)
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>
drivers/gpu/drm/i915/display/intel_dpt.h
drivers/gpu/drm/i915/display/intel_dpt_common.c
drivers/gpu/drm/i915/display/intel_dpt_common.h
drivers/gpu/drm/i915/display/intel_parent.c
drivers/gpu/drm/i915/display/intel_parent.h
drivers/gpu/drm/i915/i915_dpt.c
drivers/gpu/drm/i915/i915_driver.c
include/drm/intel/display_parent_interface.h

index e05b3a716310989d25ca7f38810a970baff72ad5..0482af43e946ff642e522d3f3ea7d2bc96246532 100644 (file)
 
 struct i915_address_space;
 struct i915_vma;
-struct intel_display;
 
 struct i915_vma *intel_dpt_pin_to_ggtt(struct i915_address_space *vm,
                                       unsigned int alignment);
 void intel_dpt_unpin_from_ggtt(struct i915_address_space *vm);
-void intel_dpt_suspend(struct intel_display *display);
-void intel_dpt_resume(struct intel_display *display);
 u64 intel_dpt_offset(struct i915_vma *dpt_vma);
 
 #endif /* __INTEL_DPT_H__ */
index 5eb88d51dba1bec89055aa2e3b45c2778a7b32fc..6551318b037b5e612f5b5c69d7753085ebf8a3cf 100644 (file)
@@ -7,6 +7,7 @@
 #include "intel_display_regs.h"
 #include "intel_display_types.h"
 #include "intel_dpt_common.h"
+#include "intel_parent.h"
 #include "skl_universal_plane_regs.h"
 
 void intel_dpt_configure(struct intel_crtc *crtc)
@@ -33,3 +34,61 @@ void intel_dpt_configure(struct intel_crtc *crtc)
                             CHICKEN_MISC_DISABLE_DPT);
        }
 }
+
+/**
+ * intel_dpt_suspend - suspend the memory mapping for all DPT FBs during system suspend
+ * @display: display device instance
+ *
+ * Suspend the memory mapping during system suspend for all framebuffers which
+ * are mapped to HW via a GGTT->DPT page table.
+ *
+ * This function must be called before the mappings in GGTT are suspended calling
+ * i915_ggtt_suspend().
+ */
+void intel_dpt_suspend(struct intel_display *display)
+{
+       struct drm_framebuffer *drm_fb;
+
+       if (!HAS_DISPLAY(display))
+               return;
+
+       mutex_lock(&display->drm->mode_config.fb_lock);
+
+       drm_for_each_fb(drm_fb, display->drm) {
+               struct intel_framebuffer *fb = to_intel_framebuffer(drm_fb);
+
+               if (fb->dpt_vm)
+                       intel_parent_dpt_suspend(display, fb->dpt_vm);
+       }
+
+       mutex_unlock(&display->drm->mode_config.fb_lock);
+}
+
+/**
+ * intel_dpt_resume - restore the memory mapping for all DPT FBs during system resume
+ * @display: display device instance
+ *
+ * Restore the memory mapping during system resume for all framebuffers which
+ * are mapped to HW via a GGTT->DPT page table. The content of these page
+ * tables are not stored in the hibernation image during S4 and S3RST->S4
+ * transitions, so here we reprogram the PTE entries in those tables.
+ *
+ * This function must be called after the mappings in GGTT have been restored calling
+ * i915_ggtt_resume().
+ */
+void intel_dpt_resume(struct intel_display *display)
+{
+       struct drm_framebuffer *drm_fb;
+
+       if (!HAS_DISPLAY(display))
+               return;
+
+       mutex_lock(&display->drm->mode_config.fb_lock);
+       drm_for_each_fb(drm_fb, display->drm) {
+               struct intel_framebuffer *fb = to_intel_framebuffer(drm_fb);
+
+               if (fb->dpt_vm)
+                       intel_parent_dpt_resume(display, fb->dpt_vm);
+       }
+       mutex_unlock(&display->drm->mode_config.fb_lock);
+}
index 6d7de405126a58da8c52ef10e04892c4e9fa32fd..11bd495693b26d41f5c89e1a8bdec5d5a18547c5 100644 (file)
@@ -7,7 +7,10 @@
 #define __INTEL_DPT_COMMON_H__
 
 struct intel_crtc;
+struct intel_display;
 
 void intel_dpt_configure(struct intel_crtc *crtc);
+void intel_dpt_suspend(struct intel_display *display);
+void intel_dpt_resume(struct intel_display *display);
 
 #endif /* __INTEL_DPT_COMMON_H__ */
index c43e3518a1395b85b222aa75d914fd210c2c11af..a79ea775bde2a01e7805b0c72f53ae0a9c6d2662 100644 (file)
@@ -40,6 +40,18 @@ void intel_parent_dpt_destroy(struct intel_display *display, struct i915_address
                display->parent->dpt->destroy(vm);
 }
 
+void intel_parent_dpt_suspend(struct intel_display *display, struct i915_address_space *vm)
+{
+       if (display->parent->dpt)
+               display->parent->dpt->suspend(vm);
+}
+
+void intel_parent_dpt_resume(struct intel_display *display, struct i915_address_space *vm)
+{
+       if (display->parent->dpt)
+               display->parent->dpt->resume(vm);
+}
+
 /* hdcp */
 ssize_t intel_parent_hdcp_gsc_msg_send(struct intel_display *display,
                                       struct intel_hdcp_gsc_context *gsc_context,
index 88860e471a0d42023a83ee79ad60d8b4dd712011..be577ce10c21f870461446881037ca32217405a4 100644 (file)
@@ -20,6 +20,8 @@ struct i915_address_space *intel_parent_dpt_create(struct intel_display *display
                                                   struct drm_gem_object *obj,
                                                   size_t size);
 void intel_parent_dpt_destroy(struct intel_display *display, struct i915_address_space *vm);
+void intel_parent_dpt_suspend(struct intel_display *display, struct i915_address_space *vm);
+void intel_parent_dpt_resume(struct intel_display *display, struct i915_address_space *vm);
 
 /* hdcp */
 ssize_t intel_parent_hdcp_gsc_msg_send(struct intel_display *display,
index 5237d057119e10bc36882787b44d5fa7afebaa6d..635127ee55051beaf6c071e1dbf52f5420bb1f79 100644 (file)
@@ -8,9 +8,7 @@
 
 #include "display/intel_display_core.h"
 #include "display/intel_display_rpm.h"
-#include "display/intel_display_types.h"
 #include "display/intel_dpt.h"
-#include "display/intel_fb.h"
 #include "gem/i915_gem_domain.h"
 #include "gem/i915_gem_internal.h"
 #include "gem/i915_gem_lmem.h"
@@ -185,64 +183,6 @@ void intel_dpt_unpin_from_ggtt(struct i915_address_space *vm)
        i915_vma_put(dpt->vma);
 }
 
-/**
- * intel_dpt_resume - restore the memory mapping for all DPT FBs during system resume
- * @display: display device instance
- *
- * Restore the memory mapping during system resume for all framebuffers which
- * are mapped to HW via a GGTT->DPT page table. The content of these page
- * tables are not stored in the hibernation image during S4 and S3RST->S4
- * transitions, so here we reprogram the PTE entries in those tables.
- *
- * This function must be called after the mappings in GGTT have been restored calling
- * i915_ggtt_resume().
- */
-void intel_dpt_resume(struct intel_display *display)
-{
-       struct drm_framebuffer *drm_fb;
-
-       if (!HAS_DISPLAY(display))
-               return;
-
-       mutex_lock(&display->drm->mode_config.fb_lock);
-       drm_for_each_fb(drm_fb, display->drm) {
-               struct intel_framebuffer *fb = to_intel_framebuffer(drm_fb);
-
-               if (fb->dpt_vm)
-                       i915_ggtt_resume_vm(fb->dpt_vm, true);
-       }
-       mutex_unlock(&display->drm->mode_config.fb_lock);
-}
-
-/**
- * intel_dpt_suspend - suspend the memory mapping for all DPT FBs during system suspend
- * @display: display device instance
- *
- * Suspend the memory mapping during system suspend for all framebuffers which
- * are mapped to HW via a GGTT->DPT page table.
- *
- * This function must be called before the mappings in GGTT are suspended calling
- * i915_ggtt_suspend().
- */
-void intel_dpt_suspend(struct intel_display *display)
-{
-       struct drm_framebuffer *drm_fb;
-
-       if (!HAS_DISPLAY(display))
-               return;
-
-       mutex_lock(&display->drm->mode_config.fb_lock);
-
-       drm_for_each_fb(drm_fb, display->drm) {
-               struct intel_framebuffer *fb = to_intel_framebuffer(drm_fb);
-
-               if (fb->dpt_vm)
-                       i915_ggtt_suspend_vm(fb->dpt_vm, true);
-       }
-
-       mutex_unlock(&display->drm->mode_config.fb_lock);
-}
-
 static struct i915_address_space *i915_dpt_create(struct drm_gem_object *obj, size_t size)
 {
        struct drm_i915_private *i915 = to_i915(obj->dev);
@@ -316,6 +256,16 @@ static void i915_dpt_destroy(struct i915_address_space *vm)
        i915_vm_put(&dpt->vm);
 }
 
+static void i915_dpt_suspend(struct i915_address_space *vm)
+{
+       i915_ggtt_suspend_vm(vm, true);
+}
+
+static void i915_dpt_resume(struct i915_address_space *vm)
+{
+       i915_ggtt_resume_vm(vm, true);
+}
+
 u64 intel_dpt_offset(struct i915_vma *dpt_vma)
 {
        return i915_vma_offset(dpt_vma);
@@ -324,4 +274,6 @@ u64 intel_dpt_offset(struct i915_vma *dpt_vma)
 const struct intel_display_dpt_interface i915_display_dpt_interface = {
        .create = i915_dpt_create,
        .destroy = i915_dpt_destroy,
+       .suspend = i915_dpt_suspend,
+       .resume = i915_dpt_resume,
 };
index 31a608ccab007e30783e82bcef25a1efdb44c358..570626f8a55415f2000bc330190d837c9f9b2f10 100644 (file)
@@ -59,7 +59,7 @@
 #include "display/intel_display_power.h"
 #include "display/intel_dmc.h"
 #include "display/intel_dp.h"
-#include "display/intel_dpt.h"
+#include "display/intel_dpt_common.h"
 #include "display/intel_dram.h"
 #include "display/intel_encoder.h"
 #include "display/intel_fbdev.h"
index 48abbe187d61a3ca9c33e88f49932efff29fb54f..2af4d6e99fd0c26b6f72c94dac2833f9d83b28e8 100644 (file)
@@ -27,6 +27,8 @@ struct ref_tracker;
 struct intel_display_dpt_interface {
        struct i915_address_space *(*create)(struct drm_gem_object *obj, size_t size);
        void (*destroy)(struct i915_address_space *vm);
+       void (*suspend)(struct i915_address_space *vm);
+       void (*resume)(struct i915_address_space *vm);
 };
 
 struct intel_display_dsb_interface {