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>
This commit is contained in:
Thomas Zimmermann
2024-12-12 18:08:50 +01:00
committed by Maarten Lankhorst
parent 04a1c47798
commit ef9e0e2ef9

View File

@@ -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,