summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/i915/display/intel_fbdev.c
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2024-12-12 20:08:47 +0300
committerMaarten Lankhorst <dev@lankhorst.se>2025-03-05 23:48:49 +0300
commita1c008b987d0f0fc5a9d746dd7782350ba48ce57 (patch)
tree82d7b28ba7036dade2ca2b44810a23fd8e3e2128 /drivers/gpu/drm/i915/display/intel_fbdev.c
parent2ef5754c9649151ce438c9b30ec720840762d2a2 (diff)
downloadlinux-a1c008b987d0f0fc5a9d746dd7782350ba48ce57.tar.xz
drm/i915/display: fbdev: Move custom suspend code to new callback
If the fbdev buffer is backed by stolen memory, it has to be cleared upon resume from hibernation. Move the code into the new callback fb_set_suspend, so that it can run from DRM's generic fbdev client. No functional change. Other drivers are not affected. 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-7-tzimmermann@suse.de Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>
Diffstat (limited to 'drivers/gpu/drm/i915/display/intel_fbdev.c')
-rw-r--r--drivers/gpu/drm/i915/display/intel_fbdev.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i915/display/intel_fbdev.c
index 408e44251c47..a99793723695 100644
--- a/drivers/gpu/drm/i915/display/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
@@ -285,10 +285,27 @@ static void intelfb_restore(struct drm_fb_helper *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,
};
/*
@@ -457,7 +474,6 @@ void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous
{
struct drm_i915_private *dev_priv = to_i915(dev);
struct intel_fbdev *ifbdev = dev_priv->display.fbdev.fbdev;
- struct fb_info *info;
if (!ifbdev)
return;
@@ -468,8 +484,6 @@ void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous
if (!ifbdev->vma)
return;
- info = ifbdev->helper.info;
-
if (synchronous) {
/* Flush any pending work to turn the console on, and then
* wait to turn it off. It must be synchronous as we are
@@ -499,14 +513,6 @@ void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous
}
}
- /* On resume from hibernation: If the object is shmemfs backed, it has
- * been restored from swap. If the object is stolen however, it will be
- * full of whatever garbage was left in there.
- */
- if (state == FBINFO_STATE_RUNNING &&
- !intel_bo_is_shmem(intel_fb_bo(&ifbdev->fb->base)))
- memset_io(info->screen_base, 0, info->screen_size);
-
drm_fb_helper_set_suspend(&ifbdev->helper, state);
console_unlock();
}