]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/i915/fbdev: Add intel_fbdev_get_map()
authorJocelyn Falempe <jfalempe@redhat.com>
Tue, 24 Jun 2025 09:01:11 +0000 (11:01 +0200)
committerMaarten Lankhorst <dev@lankhorst.se>
Fri, 27 Jun 2025 09:48:22 +0000 (11:48 +0200)
The vaddr of the fbdev framebuffer is private to the struct
intel_fbdev, so this function is needed to access it for drm_panic.
Also the struct i915_vma is different between i915 and xe, so it
requires a few functions to access fbdev->vma->iomap.

Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://lore.kernel.org/r/20250624091501.257661-3-jfalempe@redhat.com
Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>
drivers/gpu/drm/i915/display/intel_fb_pin.c
drivers/gpu/drm/i915/display/intel_fb_pin.h
drivers/gpu/drm/i915/display/intel_fbdev.c
drivers/gpu/drm/i915/display/intel_fbdev.h
drivers/gpu/drm/i915/i915_vma.h
drivers/gpu/drm/xe/display/xe_fb_pin.c

index fcc88e677e47037b0ae89e6d8eec25dcc7fdd7ae..5a0151775a3a34f6ba5795a637522eb0c3883d4b 100644 (file)
@@ -334,3 +334,8 @@ void intel_plane_unpin_fb(struct intel_plane_state *old_plane_state)
                        intel_dpt_unpin_from_ggtt(fb->dpt_vm);
        }
 }
+
+void intel_fb_get_map(struct i915_vma *vma, struct iosys_map *map)
+{
+       iosys_map_set_vaddr_iomem(map, i915_vma_get_iomap(vma));
+}
index 01770dbba2e08faeb58a8bfd2ea1f3aa9d46299f..81ab79da1af74b672bdc7c3a8126d9b9a818d5f4 100644 (file)
@@ -12,6 +12,7 @@ struct drm_framebuffer;
 struct i915_vma;
 struct intel_plane_state;
 struct i915_gtt_view;
+struct iosys_map;
 
 struct i915_vma *
 intel_fb_pin_to_ggtt(const struct drm_framebuffer *fb,
@@ -27,5 +28,6 @@ void intel_fb_unpin_vma(struct i915_vma *vma, unsigned long flags);
 int intel_plane_pin_fb(struct intel_plane_state *new_plane_state,
                       const struct intel_plane_state *old_plane_state);
 void intel_plane_unpin_fb(struct intel_plane_state *old_plane_state);
+void intel_fb_get_map(struct i915_vma *vma, struct iosys_map *map);
 
 #endif
index 2dc4029d71ed6764ebc10cd7c1ba9855be414293..7c4709d58aa345fe6dba6a2b768350327b1ae52f 100644 (file)
@@ -512,3 +512,8 @@ struct i915_vma *intel_fbdev_vma_pointer(struct intel_fbdev *fbdev)
 {
        return fbdev ? fbdev->vma : NULL;
 }
+
+void intel_fbdev_get_map(struct intel_fbdev *fbdev, struct iosys_map *map)
+{
+       intel_fb_get_map(fbdev->vma, map);
+}
index a15e3e222a0c7199ee72eb468b5bbee517f7fcd7..150cc5f45bb31ff4e662e652b8659516a69e5c18 100644 (file)
@@ -13,6 +13,7 @@ struct drm_fb_helper_surface_size;
 struct intel_display;
 struct intel_fbdev;
 struct intel_framebuffer;
+struct iosys_map;
 
 #ifdef CONFIG_DRM_FBDEV_EMULATION
 int intel_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper,
@@ -22,7 +23,7 @@ int intel_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper,
 void intel_fbdev_setup(struct intel_display *display);
 struct intel_framebuffer *intel_fbdev_framebuffer(struct intel_fbdev *fbdev);
 struct i915_vma *intel_fbdev_vma_pointer(struct intel_fbdev *fbdev);
-
+void intel_fbdev_get_map(struct intel_fbdev *fbdev, struct iosys_map *map);
 #else
 #define INTEL_FBDEV_DRIVER_OPS \
        .fbdev_probe = NULL
@@ -39,6 +40,9 @@ static inline struct i915_vma *intel_fbdev_vma_pointer(struct intel_fbdev *fbdev
        return NULL;
 }
 
+static inline void intel_fbdev_get_map(struct intel_fbdev *fbdev, struct iosys_map *map)
+{
+}
 #endif
 
 #endif /* __INTEL_FBDEV_H__ */
index 6a6be8048aa83f8d1fcd4b43855f1b24bdc790f5..4ae610927fa77b7318250d75412ef66958136cef 100644 (file)
@@ -353,6 +353,11 @@ static inline bool i915_node_color_differs(const struct drm_mm_node *node,
        return drm_mm_node_allocated(node) && node->color != color;
 }
 
+static inline void __iomem *i915_vma_get_iomap(struct i915_vma *vma)
+{
+       return READ_ONCE(vma->iomap);
+}
+
 /**
  * i915_vma_pin_iomap - calls ioremap_wc to map the GGTT VMA via the aperture
  * @vma: VMA to iomap
index 6b362695d6b6188e1afeff30437edc7b2f6d944d..45122822b051d766716c8979b737177b7bb91c14 100644 (file)
@@ -457,3 +457,8 @@ u64 intel_dpt_offset(struct i915_vma *dpt_vma)
 {
        return 0;
 }
+
+void intel_fb_get_map(struct i915_vma *vma, struct iosys_map *map)
+{
+       *map = vma->bo->vmap;
+}