From d1d5101452ab04e5a3f010bdd200971d78956e5a Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Mon, 16 Jan 2023 12:54:24 +0100 Subject: [PATCH] drm/fb-helper: Set framebuffer for vga-switcheroo clients MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Set the framebuffer info for drivers that support VGA switcheroo. Only affects the amdgpu and nouveau drivers, which use VGA switcheroo and generic fbdev emulation. For other drivers, this does nothing. This fixes a potential regression in the console code. Both, amdgpu and nouveau, invoked vga_switcheroo_client_fb_set() from their internal fbdev code. But the call got lost when the drivers switched to the generic emulation. Fixes: 087451f372bf ("drm/amdgpu: use generic fb helpers instead of setting up AMD own's.") Fixes: 4a16dd9d18a0 ("drm/nouveau/kms: switch to drm fbdev helpers") Signed-off-by: Thomas Zimmermann Reviewed-by: Daniel Vetter Reviewed-by: Alex Deucher Cc: Ben Skeggs Cc: Karol Herbst Cc: Lyude Paul Cc: Thomas Zimmermann Cc: Javier Martinez Canillas Cc: Laurent Pinchart Cc: Jani Nikula Cc: Dave Airlie Cc: Evan Quan Cc: Christian König Cc: Alex Deucher Cc: Hawking Zhang Cc: Likun Gao Cc: "Christian König" Cc: Stanley Yang Cc: "Tianci.Yin" Cc: Xiaojian Du Cc: Andrey Grodzovsky Cc: YiPeng Chai Cc: Somalapuram Amaranath Cc: Bokun Zhang Cc: Guchun Chen Cc: Hamza Mahfooz Cc: Aurabindo Pillai Cc: Mario Limonciello Cc: Solomon Chiu Cc: Kai-Heng Feng Cc: Felix Kuehling Cc: Daniel Vetter Cc: "Marek Olšák" Cc: Sam Ravnborg Cc: Hans de Goede Cc: "Ville Syrjälä" Cc: dri-devel@lists.freedesktop.org Cc: nouveau@lists.freedesktop.org Cc: # v5.17+ Link: https://patchwork.freedesktop.org/patch/msgid/20230116115425.13484-3-tzimmermann@suse.de --- drivers/gpu/drm/drm_fb_helper.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index b3a731b..0d0c26e 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -30,7 +30,9 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include +#include #include +#include #include #include @@ -1909,6 +1911,11 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper, return ret; strcpy(fb_helper->fb->comm, "[fbcon]"); + + /* Set the fb info for vgaswitcheroo clients. Does nothing otherwise. */ + if (dev_is_pci(dev->dev)) + vga_switcheroo_client_fb_set(to_pci_dev(dev->dev), fb_helper->info); + return 0; } -- 2.7.4