Skip to content

Commit d2782a0

Browse files
Jocelyn FalempeMaarten Lankhorst
authored andcommitted
drm/i915/fbdev: Add intel_fbdev_get_map()
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Maarten Lankhorst <[email protected]>
1 parent 3dd922c commit d2782a0

File tree

6 files changed

+27
-1
lines changed

6 files changed

+27
-1
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,3 +334,8 @@ void intel_plane_unpin_fb(struct intel_plane_state *old_plane_state)
334334
intel_dpt_unpin_from_ggtt(fb->dpt_vm);
335335
}
336336
}
337+
338+
void intel_fb_get_map(struct i915_vma *vma, struct iosys_map *map)
339+
{
340+
iosys_map_set_vaddr_iomem(map, i915_vma_get_iomap(vma));
341+
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ struct drm_framebuffer;
1212
struct i915_vma;
1313
struct intel_plane_state;
1414
struct i915_gtt_view;
15+
struct iosys_map;
1516

1617
struct i915_vma *
1718
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);
2728
int intel_plane_pin_fb(struct intel_plane_state *new_plane_state,
2829
const struct intel_plane_state *old_plane_state);
2930
void intel_plane_unpin_fb(struct intel_plane_state *old_plane_state);
31+
void intel_fb_get_map(struct i915_vma *vma, struct iosys_map *map);
3032

3133
#endif

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,3 +512,8 @@ struct i915_vma *intel_fbdev_vma_pointer(struct intel_fbdev *fbdev)
512512
{
513513
return fbdev ? fbdev->vma : NULL;
514514
}
515+
516+
void intel_fbdev_get_map(struct intel_fbdev *fbdev, struct iosys_map *map)
517+
{
518+
intel_fb_get_map(fbdev->vma, map);
519+
}

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ struct drm_fb_helper_surface_size;
1313
struct intel_display;
1414
struct intel_fbdev;
1515
struct intel_framebuffer;
16+
struct iosys_map;
1617

1718
#ifdef CONFIG_DRM_FBDEV_EMULATION
1819
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,
2223
void intel_fbdev_setup(struct intel_display *display);
2324
struct intel_framebuffer *intel_fbdev_framebuffer(struct intel_fbdev *fbdev);
2425
struct i915_vma *intel_fbdev_vma_pointer(struct intel_fbdev *fbdev);
25-
26+
void intel_fbdev_get_map(struct intel_fbdev *fbdev, struct iosys_map *map);
2627
#else
2728
#define INTEL_FBDEV_DRIVER_OPS \
2829
.fbdev_probe = NULL
@@ -39,6 +40,9 @@ static inline struct i915_vma *intel_fbdev_vma_pointer(struct intel_fbdev *fbdev
3940
return NULL;
4041
}
4142

43+
static inline void intel_fbdev_get_map(struct intel_fbdev *fbdev, struct iosys_map *map)
44+
{
45+
}
4246
#endif
4347

4448
#endif /* __INTEL_FBDEV_H__ */

drivers/gpu/drm/i915/i915_vma.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,11 @@ static inline bool i915_node_color_differs(const struct drm_mm_node *node,
353353
return drm_mm_node_allocated(node) && node->color != color;
354354
}
355355

356+
static inline void __iomem *i915_vma_get_iomap(struct i915_vma *vma)
357+
{
358+
return READ_ONCE(vma->iomap);
359+
}
360+
356361
/**
357362
* i915_vma_pin_iomap - calls ioremap_wc to map the GGTT VMA via the aperture
358363
* @vma: VMA to iomap

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,3 +457,8 @@ u64 intel_dpt_offset(struct i915_vma *dpt_vma)
457457
{
458458
return 0;
459459
}
460+
461+
void intel_fb_get_map(struct i915_vma *vma, struct iosys_map *map)
462+
{
463+
*map = vma->bo->vmap;
464+
}

0 commit comments

Comments
 (0)