[PATCH v2 3/3] drm: Call vga_switcheroo_process_delayed_switch() in drm_lastclose
Lukas Wunner
lukas at wunner.de
Tue Jan 17 09:44:40 UTC 2023
On Thu, Jan 12, 2023 at 09:11:56PM +0100, Thomas Zimmermann wrote:
> Several lastclose helpers call vga_switcheroo_process_delayed_switch().
> It's better to call the helper from drm_lastclose() after the kernel
> client's screen has been restored. This way, all drivers can benefit
> without having to implement their own lastclose helper. For drivers
> without vga-switcheroo, vga_switcheroo_process_delayed_switch() does
> nothing.
[...]
> --- a/drivers/gpu/drm/drm_file.c
> +++ b/drivers/gpu/drm/drm_file.c
> @@ -38,6 +38,7 @@
> #include <linux/pci.h>
> #include <linux/poll.h>
> #include <linux/slab.h>
> +#include <linux/vga_switcheroo.h>
>
> #include <drm/drm_client.h>
> #include <drm/drm_drv.h>
> @@ -460,6 +461,8 @@ void drm_lastclose(struct drm_device * dev)
> drm_legacy_dev_reinit(dev);
>
> drm_client_dev_restore(dev);
> +
> + vga_switcheroo_process_delayed_switch();
> }
Hm, this looks like a case of midlayer fallacy:
https://blog.ffwll.ch/2016/12/midlayers-once-more-with-feeling.html
It is a departure from the opt-in library approach we've had so far.
For switcheroo-aware EDID retrieval, there's a drm_get_edid_switcheroo()
helper. How about introducing a switcheroo-aware lastclose helper which
drivers can reference?
Thanks,
Lukas
More information about the dri-devel
mailing list