diff options
author | Thomas Zimmermann <tzimmermann@suse.de> | 2024-12-12 18:08:50 +0100 |
---|---|---|
committer | Maarten Lankhorst <dev@lankhorst.se> | 2025-03-05 21:48:50 +0100 |
commit | ef9e0e2ef958cd50a50b63f4444ebd946e24d99a (patch) | |
tree | 6019e1b082c88570b32d77f6d9b3486efd951c26 /drivers/gpu/drm/i915/display | |
parent | 04a1c47798f773cc6b071790c56eaa460a1e5caf (diff) |
drm/i915/display: Move fbdev code around
Move fbdev code around in the source file before switching to DRM's
generic fbdev client. This will make the conversion less intrusive.
No functional changes.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241212170913.185939-10-tzimmermann@suse.de
Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>
Diffstat (limited to 'drivers/gpu/drm/i915/display')
-rw-r--r-- | drivers/gpu/drm/i915/display/intel_fbdev.c | 85 |
1 files changed, 44 insertions, 41 deletions
diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i915/display/intel_fbdev.c index 7f9de9f49087..4578634cc4ab 100644 --- a/drivers/gpu/drm/i915/display/intel_fbdev.c +++ b/drivers/gpu/drm/i915/display/intel_fbdev.c @@ -56,6 +56,9 @@ #include "intel_fbdev_fb.h" #include "intel_frontbuffer.h" +static int intelfb_create(struct drm_fb_helper *helper, + struct drm_fb_helper_surface_size *sizes); + struct intel_fbdev { struct intel_framebuffer *fb; struct i915_vma *vma; @@ -165,6 +168,47 @@ static const struct fb_ops intelfb_ops = { __diag_pop(); +static int intelfb_dirty(struct drm_fb_helper *helper, struct drm_clip_rect *clip) +{ + if (!(clip->x1 < clip->x2 && clip->y1 < clip->y2)) + return 0; + + if (helper->fb->funcs->dirty) + return helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, clip, 1); + + return 0; +} + +static void intelfb_restore(struct drm_fb_helper *fb_helper) +{ + struct intel_fbdev *ifbdev = to_intel_fbdev(fb_helper); + + intel_fbdev_invalidate(ifbdev); +} + +static void intelfb_set_suspend(struct drm_fb_helper *fb_helper, bool suspend) +{ + struct fb_info *info = fb_helper->info; + + /* + * When resuming from hibernation, Linux restores the object's + * content from swap if the buffer is backed by shmemfs. If the + * object is stolen however, it will be full of whatever garbage + * was left in there. Clear it to zero in this case. + */ + if (!suspend && !intel_bo_is_shmem(intel_fb_bo(fb_helper->fb))) + memset_io(info->screen_base, 0, info->screen_size); + + fb_set_suspend(info, suspend); +} + +static const struct drm_fb_helper_funcs intel_fb_helper_funcs = { + .fb_probe = intelfb_create, + .fb_dirty = intelfb_dirty, + .fb_restore = intelfb_restore, + .fb_set_suspend = intelfb_set_suspend, +}; + static int intelfb_create(struct drm_fb_helper *helper, struct drm_fb_helper_surface_size *sizes) { @@ -268,47 +312,6 @@ out_unlock: return ret; } -static int intelfb_dirty(struct drm_fb_helper *helper, struct drm_clip_rect *clip) -{ - if (!(clip->x1 < clip->x2 && clip->y1 < clip->y2)) - return 0; - - if (helper->fb->funcs->dirty) - return helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, clip, 1); - - return 0; -} - -static void intelfb_restore(struct drm_fb_helper *fb_helper) -{ - struct intel_fbdev *ifbdev = to_intel_fbdev(fb_helper); - - intel_fbdev_invalidate(ifbdev); -} - -static void intelfb_set_suspend(struct drm_fb_helper *fb_helper, bool suspend) -{ - struct fb_info *info = fb_helper->info; - - /* - * When resuming from hibernation, Linux restores the object's - * content from swap if the buffer is backed by shmemfs. If the - * object is stolen however, it will be full of whatever garbage - * was left in there. Clear it to zero in this case. - */ - if (!suspend && !intel_bo_is_shmem(intel_fb_bo(fb_helper->fb))) - memset_io(info->screen_base, 0, info->screen_size); - - fb_set_suspend(info, suspend); -} - -static const struct drm_fb_helper_funcs intel_fb_helper_funcs = { - .fb_probe = intelfb_create, - .fb_dirty = intelfb_dirty, - .fb_restore = intelfb_restore, - .fb_set_suspend = intelfb_set_suspend, -}; - /* * Build an intel_fbdev struct using a BIOS allocated framebuffer, if possible. * The core display code will have read out the current plane configuration, |