diff mbox series

[1/8] drm/fbdev-helper: Do delayed switcheroo in lastclose helper

Message ID 20240807084539.304014-2-tzimmermann@suse.de (mailing list archive)
State New, archived
Headers show
Series drm/{amdgpu,nouveau}: Remove old fbdev hooks | expand

Commit Message

Thomas Zimmermann Aug. 7, 2024, 8:41 a.m. UTC
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@suse.de>
---
 drivers/gpu/drm/drm_fb_helper.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Daniel Vetter Aug. 9, 2024, 8:44 a.m. UTC | #1
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@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
>
Thomas Zimmermann Aug. 9, 2024, 9:28 a.m. UTC | #2
Hi

Am 09.08.24 um 10:44 schrieb Daniel Vetter:
> 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@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.

Thanks for reviewing. This call can then go directly into 
drm_lastclose(), which will stay around.

Best regards
Thomas

> -Sima
>
>> +
>>   }
>>   EXPORT_SYMBOL(drm_fb_helper_lastclose);
>>   
>> -- 
>> 2.46.0
>>
diff mbox series

Patch

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);