Thomas Zimmermann
2024-Aug-07 08:41 UTC
[PATCH 1/8] drm/fbdev-helper: Do delayed switcheroo in lastclose helper
Amdgpu and nouveau call vga_switcheroo_process_delayed_switch() from their lastclose callbacks. Call it from the fbdev lastclose helper, so that the driver functions can finally be removed. The fbdev call is part of all lastclose handling that restores the DRM fbcon terminal. Only PCI devices with enabled switcheroo do the delayed switching. The call has no effect on other drivers. Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de> --- drivers/gpu/drm/drm_fb_helper.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 3f7da78849e4..f6667dfba8a2 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -2009,6 +2009,10 @@ EXPORT_SYMBOL(drm_fb_helper_hotplug_event); void drm_fb_helper_lastclose(struct drm_device *dev) { drm_fb_helper_restore_fbdev_mode_unlocked(dev->fb_helper); + + if (dev_is_pci(dev->dev)) + vga_switcheroo_process_delayed_switch(); + } EXPORT_SYMBOL(drm_fb_helper_lastclose); -- 2.46.0
Daniel Vetter
2024-Aug-09 08:44 UTC
[PATCH 1/8] drm/fbdev-helper: Do delayed switcheroo in lastclose helper
On Wed, Aug 07, 2024 at 10:41:33AM +0200, Thomas Zimmermann wrote:> Amdgpu and nouveau call vga_switcheroo_process_delayed_switch() from > their lastclose callbacks. Call it from the fbdev lastclose helper, > so that the driver functions can finally be removed. > > The fbdev call is part of all lastclose handling that restores the > DRM fbcon terminal. Only PCI devices with enabled switcheroo do the > delayed switching. The call has no effect on other drivers. > > Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de> > --- > drivers/gpu/drm/drm_fb_helper.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c > index 3f7da78849e4..f6667dfba8a2 100644 > --- a/drivers/gpu/drm/drm_fb_helper.c > +++ b/drivers/gpu/drm/drm_fb_helper.c > @@ -2009,6 +2009,10 @@ EXPORT_SYMBOL(drm_fb_helper_hotplug_event); > void drm_fb_helper_lastclose(struct drm_device *dev) > { > drm_fb_helper_restore_fbdev_mode_unlocked(dev->fb_helper); > + > + if (dev_is_pci(dev->dev)) > + vga_switcheroo_process_delayed_switch();I think if you want to move this, it needs to be in drm core. Otherwise the vgaswitcheroo delayed switching stops working if you disable fbdev support. Which doesn't make much sense. -Sima> + > } > EXPORT_SYMBOL(drm_fb_helper_lastclose); > > -- > 2.46.0 >-- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch