Thomas Zimmermann
2023-Jan-12 20:12 UTC
[Nouveau] [PATCH v2 2/3] drm/fb-helper: Set framebuffer for vga-switcheroo clients
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 <tzimmermann at suse.de> Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch> Reviewed-by: Alex Deucher <alexander.deucher at amd.com> Cc: Ben Skeggs <bskeggs at redhat.com> Cc: Karol Herbst <kherbst at redhat.com> Cc: Lyude Paul <lyude at redhat.com> Cc: Thomas Zimmermann <tzimmermann at suse.de> Cc: Javier Martinez Canillas <javierm at redhat.com> Cc: Laurent Pinchart <laurent.pinchart at ideasonboard.com> Cc: Jani Nikula <jani.nikula at intel.com> Cc: Dave Airlie <airlied at redhat.com> Cc: Evan Quan <evan.quan at amd.com> Cc: Christian K?nig <christian.koenig at amd.com> Cc: Alex Deucher <alexander.deucher at amd.com> Cc: Hawking Zhang <Hawking.Zhang at amd.com> Cc: Likun Gao <Likun.Gao at amd.com> Cc: "Christian K?nig" <christian.koenig at amd.com> Cc: Stanley Yang <Stanley.Yang at amd.com> Cc: "Tianci.Yin" <tianci.yin at amd.com> Cc: Xiaojian Du <Xiaojian.Du at amd.com> Cc: Andrey Grodzovsky <andrey.grodzovsky at amd.com> Cc: YiPeng Chai <YiPeng.Chai at amd.com> Cc: Somalapuram Amaranath <Amaranath.Somalapuram at amd.com> Cc: Bokun Zhang <Bokun.Zhang at amd.com> Cc: Guchun Chen <guchun.chen at amd.com> Cc: Hamza Mahfooz <hamza.mahfooz at amd.com> Cc: Aurabindo Pillai <aurabindo.pillai at amd.com> Cc: Mario Limonciello <mario.limonciello at amd.com> Cc: Solomon Chiu <solomon.chiu at amd.com> Cc: Kai-Heng Feng <kai.heng.feng at canonical.com> Cc: Felix Kuehling <Felix.Kuehling at amd.com> Cc: Daniel Vetter <daniel.vetter at ffwll.ch> Cc: "Marek Ol??k" <marek.olsak at amd.com> Cc: Sam Ravnborg <sam at ravnborg.org> Cc: Hans de Goede <hdegoede at redhat.com> Cc: "Ville Syrj?l?" <ville.syrjala at linux.intel.com> Cc: dri-devel at lists.freedesktop.org Cc: nouveau at lists.freedesktop.org Cc: <stable at vger.kernel.org> # v5.17+ --- drivers/gpu/drm/drm_fb_helper.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 427631706128..5e445c61252d 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 <linux/console.h> +#include <linux/pci.h> #include <linux/sysrq.h> +#include <linux/vga_switcheroo.h> #include <drm/drm_atomic.h> #include <drm/drm_drv.h> @@ -1940,6 +1942,7 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper, int preferred_bpp) { struct drm_client_dev *client = &fb_helper->client; + struct drm_device *dev = fb_helper->dev; struct drm_fb_helper_surface_size sizes; int ret; @@ -1961,6 +1964,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.39.0
Rodrigo Vivi
2023-Jan-18 19:22 UTC
[Nouveau] [Intel-gfx] [PATCH v2 2/3] drm/fb-helper: Set framebuffer for vga-switcheroo clients
On Thu, Jan 12, 2023 at 09:11:55PM +0100, Thomas Zimmermann wrote:> 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 <tzimmermann at suse.de> > Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch> > Reviewed-by: Alex Deucher <alexander.deucher at amd.com> > Cc: Ben Skeggs <bskeggs at redhat.com> > Cc: Karol Herbst <kherbst at redhat.com> > Cc: Lyude Paul <lyude at redhat.com> > Cc: Thomas Zimmermann <tzimmermann at suse.de> > Cc: Javier Martinez Canillas <javierm at redhat.com> > Cc: Laurent Pinchart <laurent.pinchart at ideasonboard.com> > Cc: Jani Nikula <jani.nikula at intel.com> > Cc: Dave Airlie <airlied at redhat.com> > Cc: Evan Quan <evan.quan at amd.com> > Cc: Christian K?nig <christian.koenig at amd.com> > Cc: Alex Deucher <alexander.deucher at amd.com> > Cc: Hawking Zhang <Hawking.Zhang at amd.com> > Cc: Likun Gao <Likun.Gao at amd.com> > Cc: "Christian K?nig" <christian.koenig at amd.com> > Cc: Stanley Yang <Stanley.Yang at amd.com> > Cc: "Tianci.Yin" <tianci.yin at amd.com> > Cc: Xiaojian Du <Xiaojian.Du at amd.com> > Cc: Andrey Grodzovsky <andrey.grodzovsky at amd.com> > Cc: YiPeng Chai <YiPeng.Chai at amd.com> > Cc: Somalapuram Amaranath <Amaranath.Somalapuram at amd.com> > Cc: Bokun Zhang <Bokun.Zhang at amd.com> > Cc: Guchun Chen <guchun.chen at amd.com> > Cc: Hamza Mahfooz <hamza.mahfooz at amd.com> > Cc: Aurabindo Pillai <aurabindo.pillai at amd.com> > Cc: Mario Limonciello <mario.limonciello at amd.com> > Cc: Solomon Chiu <solomon.chiu at amd.com> > Cc: Kai-Heng Feng <kai.heng.feng at canonical.com> > Cc: Felix Kuehling <Felix.Kuehling at amd.com> > Cc: Daniel Vetter <daniel.vetter at ffwll.ch> > Cc: "Marek Ol??k" <marek.olsak at amd.com> > Cc: Sam Ravnborg <sam at ravnborg.org> > Cc: Hans de Goede <hdegoede at redhat.com> > Cc: "Ville Syrj?l?" <ville.syrjala at linux.intel.com> > Cc: dri-devel at lists.freedesktop.org > Cc: nouveau at lists.freedesktop.org > Cc: <stable at vger.kernel.org> # v5.17+ > --- > drivers/gpu/drm/drm_fb_helper.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c > index 427631706128..5e445c61252d 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 <linux/console.h> > +#include <linux/pci.h> > #include <linux/sysrq.h> > +#include <linux/vga_switcheroo.h> > > #include <drm/drm_atomic.h> > #include <drm/drm_drv.h> > @@ -1940,6 +1942,7 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper, > int preferred_bpp) > { > struct drm_client_dev *client = &fb_helper->client; > + struct drm_device *dev = fb_helper->dev;On drm-tip, this commit has a silent conflict with cff84bac9922 ("drm/fh-helper: Split fbdev single-probe helper") that's already in drm-next. I had created a fix-up patch in drm-tip re-introducing this line. We probably need a backmerge from drm-next into drm-misc-fixes with the resolution applied there. And probably propagated that resolution later...> struct drm_fb_helper_surface_size sizes; > int ret; > > @@ -1961,6 +1964,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.39.0 >
Thomas Zimmermann
2023-Jan-19 08:06 UTC
[Nouveau] [Intel-gfx] [PATCH v2 2/3] drm/fb-helper: Set framebuffer for vga-switcheroo clients
Hi Am 18.01.23 um 20:21 schrieb Rodrigo Vivi:> On Thu, Jan 12, 2023 at 09:11:55PM +0100, Thomas Zimmermann wrote: >> 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 <tzimmermann at suse.de> >> Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch> >> Reviewed-by: Alex Deucher <alexander.deucher at amd.com> >> Cc: Ben Skeggs <bskeggs at redhat.com> >> Cc: Karol Herbst <kherbst at redhat.com> >> Cc: Lyude Paul <lyude at redhat.com> >> Cc: Thomas Zimmermann <tzimmermann at suse.de> >> Cc: Javier Martinez Canillas <javierm at redhat.com> >> Cc: Laurent Pinchart <laurent.pinchart at ideasonboard.com> >> Cc: Jani Nikula <jani.nikula at intel.com> >> Cc: Dave Airlie <airlied at redhat.com> >> Cc: Evan Quan <evan.quan at amd.com> >> Cc: Christian K?nig <christian.koenig at amd.com> >> Cc: Alex Deucher <alexander.deucher at amd.com> >> Cc: Hawking Zhang <Hawking.Zhang at amd.com> >> Cc: Likun Gao <Likun.Gao at amd.com> >> Cc: "Christian K?nig" <christian.koenig at amd.com> >> Cc: Stanley Yang <Stanley.Yang at amd.com> >> Cc: "Tianci.Yin" <tianci.yin at amd.com> >> Cc: Xiaojian Du <Xiaojian.Du at amd.com> >> Cc: Andrey Grodzovsky <andrey.grodzovsky at amd.com> >> Cc: YiPeng Chai <YiPeng.Chai at amd.com> >> Cc: Somalapuram Amaranath <Amaranath.Somalapuram at amd.com> >> Cc: Bokun Zhang <Bokun.Zhang at amd.com> >> Cc: Guchun Chen <guchun.chen at amd.com> >> Cc: Hamza Mahfooz <hamza.mahfooz at amd.com> >> Cc: Aurabindo Pillai <aurabindo.pillai at amd.com> >> Cc: Mario Limonciello <mario.limonciello at amd.com> >> Cc: Solomon Chiu <solomon.chiu at amd.com> >> Cc: Kai-Heng Feng <kai.heng.feng at canonical.com> >> Cc: Felix Kuehling <Felix.Kuehling at amd.com> >> Cc: Daniel Vetter <daniel.vetter at ffwll.ch> >> Cc: "Marek Ol??k" <marek.olsak at amd.com> >> Cc: Sam Ravnborg <sam at ravnborg.org> >> Cc: Hans de Goede <hdegoede at redhat.com> >> Cc: "Ville Syrj?l?" <ville.syrjala at linux.intel.com> >> Cc: dri-devel at lists.freedesktop.org >> Cc: nouveau at lists.freedesktop.org >> Cc: <stable at vger.kernel.org> # v5.17+ >> --- >> drivers/gpu/drm/drm_fb_helper.c | 8 ++++++++ >> 1 file changed, 8 insertions(+) >> >> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c >> index 427631706128..5e445c61252d 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 <linux/console.h> >> +#include <linux/pci.h> >> #include <linux/sysrq.h> >> +#include <linux/vga_switcheroo.h> >> >> #include <drm/drm_atomic.h> >> #include <drm/drm_drv.h> >> @@ -1940,6 +1942,7 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper, >> int preferred_bpp) >> { >> struct drm_client_dev *client = &fb_helper->client; >> + struct drm_device *dev = fb_helper->dev; > > On drm-tip, this commit has a silent conflict with > cff84bac9922 ("drm/fh-helper: Split fbdev single-probe helper") > that's already in drm-next. > > I had created a fix-up patch in drm-tip re-introducing this line.Thank you. Is it fixed for now?> > We probably need a backmerge from drm-next into drm-misc-fixes with > the resolution applied there. And probably propagated that resolution > later...Backmerging from -next into -fixes branches is a problem, as -fixes should be close to the latest release. Can we solve this by merging -fixes into upstream and backmerging this into our -next branches? Best regards Thomas> >> struct drm_fb_helper_surface_size sizes; >> int ret; >> >> @@ -1961,6 +1964,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.39.0 >>-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 N?rnberg, Germany (HRB 36809, AG N?rnberg) Gesch?ftsf?hrer: Ivo Totev -------------- next part -------------- A non-text attachment was scrubbed... Name: OpenPGP_signature Type: application/pgp-signature Size: 840 bytes Desc: OpenPGP digital signature URL: <https://lists.freedesktop.org/archives/nouveau/attachments/20230119/86d1793b/attachment-0001.sig>