nouveau.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: alexander.deucher@amd.com, christian.koenig@amd.com,
	Xinhui.Pan@amd.com, airlied@gmail.com, daniel@ffwll.ch,
	maarten.lankhorst@linux.intel.com, mripard@kernel.org,
	jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com,
	rodrigo.vivi@intel.com, tvrtko.ursulin@linux.intel.com,
	bskeggs@redhat.com, kherbst@redhat.com, lyude@redhat.com,
	evan.quan@amd.com, jose.souza@intel.com
Cc: dri-devel@lists.freedesktop.org,
	"YiPeng Chai" <YiPeng.Chai@amd.com>,
	"Hamza Mahfooz" <hamza.mahfooz@amd.com>,
	"Likun Gao" <Likun.Gao@amd.com>,
	"Sam Ravnborg" <sam@ravnborg.org>,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	"Mario Limonciello" <mario.limonciello@amd.com>,
	"Guchun Chen" <guchun.chen@amd.com>,
	"Javier Martinez Canillas" <javierm@redhat.com>,
	amd-gfx@lists.freedesktop.org,
	"Aurabindo Pillai" <aurabindo.pillai@amd.com>,
	"Stanley Yang" <Stanley.Yang@amd.com>,
	nouveau@lists.freedesktop.org, "Dave Airlie" <airlied@redhat.com>,
	"Marek Olšák" <marek.olsak@amd.com>,
	"Andrey Grodzovsky" <andrey.grodzovsky@amd.com>,
	"Jani Nikula" <jani.nikula@intel.com>,
	"Bokun Zhang" <Bokun.Zhang@amd.com>,
	intel-gfx@lists.freedesktop.org,
	"Tianci.Yin" <tianci.yin@amd.com>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Laurent Pinchart" <laurent.pinchart@ideasonboard.com>,
	"Xiaojian Du" <Xiaojian.Du@amd.com>,
	"Felix Kuehling" <Felix.Kuehling@amd.com>,
	"Somalapuram Amaranath" <Amaranath.Somalapuram@amd.com>,
	stable@vger.kernel.org, "Solomon Chiu" <solomon.chiu@amd.com>,
	"Kai-Heng Feng" <kai.heng.feng@canonical.com>,
	"Hawking Zhang" <Hawking.Zhang@amd.com>
Subject: [Nouveau] [PATCH v3 2/3] drm/fb-helper: Set framebuffer for vga-switcheroo clients
Date: Mon, 16 Jan 2023 12:54:24 +0100	[thread overview]
Message-ID: <20230116115425.13484-3-tzimmermann@suse.de> (raw)
In-Reply-To: <20230116115425.13484-1-tzimmermann@suse.de>

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@suse.de>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Karol Herbst <kherbst@redhat.com>
Cc: Lyude Paul <lyude@redhat.com>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Javier Martinez Canillas <javierm@redhat.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Evan Quan <evan.quan@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Hawking Zhang <Hawking.Zhang@amd.com>
Cc: Likun Gao <Likun.Gao@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: Stanley Yang <Stanley.Yang@amd.com>
Cc: "Tianci.Yin" <tianci.yin@amd.com>
Cc: Xiaojian Du <Xiaojian.Du@amd.com>
Cc: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Cc: YiPeng Chai <YiPeng.Chai@amd.com>
Cc: Somalapuram Amaranath <Amaranath.Somalapuram@amd.com>
Cc: Bokun Zhang <Bokun.Zhang@amd.com>
Cc: Guchun Chen <guchun.chen@amd.com>
Cc: Hamza Mahfooz <hamza.mahfooz@amd.com>
Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
Cc: Mario Limonciello <mario.limonciello@amd.com>
Cc: Solomon Chiu <solomon.chiu@amd.com>
Cc: Kai-Heng Feng <kai.heng.feng@canonical.com>
Cc: Felix Kuehling <Felix.Kuehling@amd.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: "Marek Olšák" <marek.olsak@amd.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: dri-devel@lists.freedesktop.org
Cc: nouveau@lists.freedesktop.org
Cc: <stable@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 367fb8b2d5fa..c5c13e192b64 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>
@@ -1924,6 +1926,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;
 
@@ -1945,6 +1948,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


  parent reply	other threads:[~2023-05-04 12:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-16 11:54 [Nouveau] [PATCH v3 0/3] drm/{amdgpu, i915, nouveau, radeon}: Fix fbdev and vga-switcheroo Thomas Zimmermann
2023-01-16 11:54 ` [Nouveau] [PATCH v3 1/3] drm/i915: Allow switching away via vga-switcheroo if uninitialized Thomas Zimmermann
2023-01-16 11:54 ` Thomas Zimmermann [this message]
2023-01-16 11:54 ` [Nouveau] [PATCH v3 3/3] drm: Call vga_switcheroo_process_delayed_switch() in drm_lastclose Thomas Zimmermann
2023-01-16 18:42 ` [Nouveau] [PATCH v3 0/3] drm/{amdgpu, i915, nouveau, radeon}: Fix fbdev and vga-switcheroo Alex Deucher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230116115425.13484-3-tzimmermann@suse.de \
    --to=tzimmermann@suse.de \
    --cc=Amaranath.Somalapuram@amd.com \
    --cc=Bokun.Zhang@amd.com \
    --cc=Felix.Kuehling@amd.com \
    --cc=Hawking.Zhang@amd.com \
    --cc=Likun.Gao@amd.com \
    --cc=Stanley.Yang@amd.com \
    --cc=Xiaojian.Du@amd.com \
    --cc=Xinhui.Pan@amd.com \
    --cc=YiPeng.Chai@amd.com \
    --cc=airlied@gmail.com \
    --cc=airlied@redhat.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=andrey.grodzovsky@amd.com \
    --cc=aurabindo.pillai@amd.com \
    --cc=bskeggs@redhat.com \
    --cc=christian.koenig@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=evan.quan@amd.com \
    --cc=guchun.chen@amd.com \
    --cc=hamza.mahfooz@amd.com \
    --cc=hdegoede@redhat.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=jani.nikula@linux.intel.com \
    --cc=javierm@redhat.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=jose.souza@intel.com \
    --cc=kai.heng.feng@canonical.com \
    --cc=kherbst@redhat.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=lyude@redhat.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=marek.olsak@amd.com \
    --cc=mario.limonciello@amd.com \
    --cc=mripard@kernel.org \
    --cc=nouveau@lists.freedesktop.org \
    --cc=rodrigo.vivi@intel.com \
    --cc=sam@ravnborg.org \
    --cc=solomon.chiu@amd.com \
    --cc=stable@vger.kernel.org \
    --cc=tianci.yin@amd.com \
    --cc=tvrtko.ursulin@linux.intel.com \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).