summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/i915/display/intel_fbdev.c
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2024-04-09 11:04:27 +0300
committerJani Nikula <jani.nikula@intel.com>2024-04-25 14:25:54 +0300
commit762f8c13b8ca4b861d28a529fa56b7960d71b892 (patch)
treeda5db135afaceb55b0319d2c9ae0bf35847a88f5 /drivers/gpu/drm/i915/display/intel_fbdev.c
parentf3a36cb5d97e49945b00f0a78ce6e6a4c5223806 (diff)
downloadlinux-762f8c13b8ca4b861d28a529fa56b7960d71b892.tar.xz
drm/{i915,xe}: Implement fbdev client callbacks
Move code from ad-hoc fbdev callbacks into DRM client functions and remove the old callbacks. The functions instruct the client to poll for changed output or restore the display. The DRM core calls both, the old callbacks and the new client helpers, from the same places. The new functions perform the same operation as before, so there's no change in functionality. Fox xe, remove xe_display_last_close(), which restored the fbdev display. As with i915, the DRM core's drm_lastclose() performs this operation automatically. v8: - mention xe in commit message v7: - update xe driver v6: - return errors from client callbacks (Jouni) Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Jouni Högander <jouni.hogander@intel.com> Acked-by: Lucas De Marchi <lucas.demarchi@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240409081029.17843-6-tzimmermann@suse.de Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Diffstat (limited to 'drivers/gpu/drm/i915/display/intel_fbdev.c')
-rw-r--r--drivers/gpu/drm/i915/display/intel_fbdev.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i915/display/intel_fbdev.c
index 4d0dba6c47d3..f783de611a7f 100644
--- a/drivers/gpu/drm/i915/display/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
@@ -551,13 +551,13 @@ set_suspend:
intel_fbdev_hpd_set_suspend(dev_priv, state);
}
-void intel_fbdev_output_poll_changed(struct drm_device *dev)
+static int intel_fbdev_output_poll_changed(struct drm_device *dev)
{
struct intel_fbdev *ifbdev = to_i915(dev)->display.fbdev.fbdev;
bool send_hpd;
if (!ifbdev)
- return;
+ return -EINVAL;
intel_fbdev_sync(ifbdev);
@@ -568,21 +568,29 @@ void intel_fbdev_output_poll_changed(struct drm_device *dev)
if (send_hpd && (ifbdev->vma || ifbdev->helper.deferred_setup))
drm_fb_helper_hotplug_event(&ifbdev->helper);
+
+ return 0;
}
-void intel_fbdev_restore_mode(struct drm_i915_private *dev_priv)
+static int intel_fbdev_restore_mode(struct drm_i915_private *dev_priv)
{
struct intel_fbdev *ifbdev = dev_priv->display.fbdev.fbdev;
+ int ret;
if (!ifbdev)
- return;
+ return -EINVAL;
intel_fbdev_sync(ifbdev);
if (!ifbdev->vma)
- return;
+ return -ENOMEM;
- if (drm_fb_helper_restore_fbdev_mode_unlocked(&ifbdev->helper) == 0)
- intel_fbdev_invalidate(ifbdev);
+ ret = drm_fb_helper_restore_fbdev_mode_unlocked(&ifbdev->helper);
+ if (ret)
+ return ret;
+
+ intel_fbdev_invalidate(ifbdev);
+
+ return 0;
}
/*
@@ -594,12 +602,21 @@ static void intel_fbdev_client_unregister(struct drm_client_dev *client)
static int intel_fbdev_client_restore(struct drm_client_dev *client)
{
+ struct drm_i915_private *dev_priv = to_i915(client->dev);
+ int ret;
+
+ ret = intel_fbdev_restore_mode(dev_priv);
+ if (ret)
+ return ret;
+
+ vga_switcheroo_process_delayed_switch();
+
return 0;
}
static int intel_fbdev_client_hotplug(struct drm_client_dev *client)
{
- return 0;
+ return intel_fbdev_output_poll_changed(client->dev);
}
static const struct drm_client_funcs intel_fbdev_client_funcs = {