drm/i915: Introduce intel_parent_fb_pin_get_map()

Introduce the "fb_pin" parent interface, as the first trivial step
move the *_get_map() stuff there.

The whole "fb_pin" as an interface might not really make sense,
and perhaps this (and other stuff) should just be collected into
some kind of "bo" interface. But let's go with "fb_pin" for now
to match where things are implemented, and possibly restructure
it later.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patch.msgid.link/20260508143426.26504-2-ville.syrjala@linux.intel.com
This commit is contained in:
Ville Syrjälä 2026-05-08 17:34:11 +03:00
parent 38e10ddae6
commit c2b4b6075d
13 changed files with 65 additions and 9 deletions

View File

@ -35,6 +35,5 @@ void intel_fb_unpin_vma(struct i915_vma *vma, int fence_id);
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

View File

@ -55,6 +55,7 @@
#include "intel_fb_pin.h"
#include "intel_fbdev.h"
#include "intel_frontbuffer.h"
#include "intel_parent.h"
#include "intel_plane.h"
struct intel_fbdev {
@ -563,7 +564,9 @@ 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)
void intel_fbdev_get_map(struct intel_display *display, struct iosys_map *map)
{
intel_fb_get_map(fbdev->vma, map);
struct intel_fbdev *fbdev = display->fbdev.fbdev;
intel_parent_fb_pin_get_map(display, fbdev->vma, map);
}

View File

@ -23,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);
void intel_fbdev_get_map(struct intel_display *display, struct iosys_map *map);
#else
#define INTEL_FBDEV_DRIVER_OPS \
.fbdev_probe = NULL
@ -40,7 +40,7 @@ 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)
static inline void intel_fbdev_get_map(struct intel_display *display, struct iosys_map *map)
{
}
#endif

View File

@ -52,6 +52,13 @@ void intel_parent_dpt_resume(struct intel_display *display, struct intel_dpt *dp
display->parent->dpt->resume(dpt);
}
/* fb_pin */
void intel_parent_fb_pin_get_map(struct intel_display *display,
struct i915_vma *vma, struct iosys_map *map)
{
return display->parent->fb_pin->get_map(vma, map);
}
/* frontbuffer */
struct intel_frontbuffer *intel_parent_frontbuffer_get(struct intel_display *display, struct drm_gem_object *obj)
{

View File

@ -18,6 +18,7 @@ struct intel_frontbuffer;
struct intel_hdcp_gsc_context;
struct intel_panic;
struct intel_stolen_node;
struct iosys_map;
/* dpt */
struct intel_dpt *intel_parent_dpt_create(struct intel_display *display,
@ -26,6 +27,10 @@ void intel_parent_dpt_destroy(struct intel_display *display, struct intel_dpt *d
void intel_parent_dpt_suspend(struct intel_display *display, struct intel_dpt *dpt);
void intel_parent_dpt_resume(struct intel_display *display, struct intel_dpt *dpt);
/* fb_pin */
void intel_parent_fb_pin_get_map(struct intel_display *display,
struct i915_vma *vma, struct iosys_map *map);
/* frontbuffer */
struct intel_frontbuffer *intel_parent_frontbuffer_get(struct intel_display *display, struct drm_gem_object *obj);
void intel_parent_frontbuffer_ref(struct intel_display *display, struct intel_frontbuffer *front);

View File

@ -1404,7 +1404,7 @@ static void intel_panic_flush(struct drm_plane *_plane)
if (fb == intel_fbdev_framebuffer(display->fbdev.fbdev)) {
struct iosys_map map;
intel_fbdev_get_map(display->fbdev.fbdev, &map);
intel_fbdev_get_map(display, &map);
drm_clflush_virt_range(map.vaddr, fb->base.pitches[0] * fb->base.height);
return;
}
@ -1462,7 +1462,7 @@ static int intel_get_scanout_buffer(struct drm_plane *plane,
return -ENODEV;
if (fb == intel_fbdev_framebuffer(display->fbdev.fbdev)) {
intel_fbdev_get_map(display->fbdev.fbdev, &sb->map[0]);
intel_fbdev_get_map(display, &sb->map[0]);
} else {
int ret;
/* Can't disable tiling if DPT is in use */

View File

@ -99,6 +99,7 @@
#include "i915_drv.h"
#include "i915_dsb_buffer.h"
#include "i915_edram.h"
#include "i915_fb_pin.h"
#include "i915_file_private.h"
#include "i915_getparam.h"
#include "i915_gmch.h"
@ -768,6 +769,7 @@ static const struct intel_display_parent_interface parent = {
.bo = &i915_display_bo_interface,
.dpt = &i915_display_dpt_interface,
.dsb = &i915_display_dsb_interface,
.fb_pin = &i915_display_fb_pin_interface,
.frontbuffer = &i915_display_frontbuffer_interface,
.hdcp = &i915_display_hdcp_interface,
.initial_plane = &i915_display_initial_plane_interface,

View File

@ -8,6 +8,7 @@
*/
#include <drm/drm_print.h>
#include <drm/intel/display_parent_interface.h>
#include "display/intel_display_core.h"
#include "display/intel_display_types.h"
@ -18,6 +19,7 @@
#include "gem/i915_gem_domain.h"
#include "gem/i915_gem_object.h"
#include "i915_fb_pin.h"
#include "i915_dpt.h"
#include "i915_drv.h"
#include "i915_vma.h"
@ -352,7 +354,11 @@ 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)
static void i915_fb_pin_get_map(struct i915_vma *vma, struct iosys_map *map)
{
iosys_map_set_vaddr_iomem(map, i915_vma_get_iomap(vma));
}
const struct intel_display_fb_pin_interface i915_display_fb_pin_interface = {
.get_map = i915_fb_pin_get_map,
};

View File

@ -0,0 +1,9 @@
/* SPDX-License-Identifier: MIT */
/* Copyright © 2026 Intel Corporation */
#ifndef __I915_FB_PIN_H__
#define __I915_FB_PIN_H__
extern const struct intel_display_fb_pin_interface i915_display_fb_pin_interface;
#endif /* __I915_FB_PIN_H__ */

View File

@ -40,6 +40,7 @@
#include "xe_display_pcode.h"
#include "xe_display_rpm.h"
#include "xe_dsb_buffer.h"
#include "xe_fb_pin.h"
#include "xe_frontbuffer.h"
#include "xe_hdcp_gsc.h"
#include "xe_initial_plane.h"
@ -553,6 +554,7 @@ static bool has_auxccs(struct drm_device *drm)
static const struct intel_display_parent_interface parent = {
.bo = &xe_display_bo_interface,
.dsb = &xe_display_dsb_interface,
.fb_pin = &xe_display_fb_pin_interface,
.frontbuffer = &xe_display_frontbuffer_interface,
.hdcp = &xe_display_hdcp_interface,
.initial_plane = &xe_display_initial_plane_interface,

View File

@ -3,6 +3,7 @@
* Copyright © 2021 Intel Corporation
*/
#include <drm/intel/display_parent_interface.h>
#include <drm/ttm/ttm_bo.h>
#include "intel_display_core.h"
@ -13,6 +14,7 @@
#include "xe_bo.h"
#include "xe_device.h"
#include "xe_display_vma.h"
#include "xe_fb_pin.h"
#include "xe_ggtt.h"
#include "xe_pm.h"
#include "xe_vram_types.h"
@ -505,7 +507,11 @@ void intel_plane_unpin_fb(struct intel_plane_state *old_plane_state)
old_plane_state->ggtt_vma = NULL;
}
void intel_fb_get_map(struct i915_vma *vma, struct iosys_map *map)
static void xe_fb_pin_get_map(struct i915_vma *vma, struct iosys_map *map)
{
*map = vma->bo->vmap;
}
const struct intel_display_fb_pin_interface xe_display_fb_pin_interface = {
.get_map = xe_fb_pin_get_map,
};

View File

@ -0,0 +1,9 @@
/* SPDX-License-Identifier: MIT */
/* Copyright © 2026 Intel Corporation */
#ifndef __XE_FB_PIN_H__
#define __XE_FB_PIN_H__
extern const struct intel_display_fb_pin_interface xe_display_fb_pin_interface;
#endif /* __XE_FB_PIN_H__ */

View File

@ -24,6 +24,7 @@ struct intel_hdcp_gsc_context;
struct intel_initial_plane_config;
struct intel_panic;
struct intel_stolen_node;
struct iosys_map;
struct ref_tracker;
struct seq_file;
struct vm_area_struct;
@ -69,6 +70,10 @@ struct intel_display_dsb_interface {
void (*flush_map)(struct intel_dsb_buffer *dsb_buf);
};
struct intel_display_fb_pin_interface {
void (*get_map)(struct i915_vma *vma, struct iosys_map *map);
};
struct intel_display_frontbuffer_interface {
struct intel_frontbuffer *(*get)(struct drm_gem_object *obj);
void (*ref)(struct intel_frontbuffer *front);
@ -211,6 +216,9 @@ struct intel_display_parent_interface {
/** @dsb: DSB buffer interface */
const struct intel_display_dsb_interface *dsb;
/** @fb_pin: Framebuffer pin interface */
const struct intel_display_fb_pin_interface *fb_pin;
/** @frontbuffer: Frontbuffer interface */
const struct intel_display_frontbuffer_interface *frontbuffer;