Skip to contentSkip to conversation

drm: Generic fbdev and vga-switcheroo

PATCH Superseded Thomas Zimmermann 5 participants 13 messages Jan 12, 2023 – Jan 30, 2023

Subsystems (7)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Thomas Zimmermann

author maintainer
#0 lore raw

v2 cover drm: Generic fbdev and vga-switcheroo

(was: drm/fb-helper: Set framebuffer for vga-switcheroo clients)

This patch has now turned into a little series. The first two patches are bug fixes for the existing code. The third patch cleans up the drivers.

Patch 1 fixes i915 to do the correct thing if the device has not been initialized yet. Switching to the device is only possible after the initialization, but switching away is always possible.

Patch 2 is the original patch without the amdgpu changes. Installs the fbdev framebuffer in vga-switcheroo for the PCI device. Does nothing for drivers without vga-switcheroo.

Patch 3 cleans up vga_switcheroo_process_delayed_switch() in amdgpu and the other related drivers (i.e., i915, nouveau and radeon). The call is now located at the end of drm_lastclose() and drivers do not need their own lastclose helpers any longer.

I kept the r-bs from v1, but patch 1 is entirely new and patch 3 has significantly grown in size.

Thomas Zimmermann (3):
drm/i915: Allow switching away via vga-switcheroo if uninitialized drm/fb-helper: Set framebuffer for vga-switcheroo clients
drm: Call vga_switcheroo_process_delayed_switch() in drm_lastclose

 drivers/gpu/drm/amd/amdgpu/amdgpu.h     |  1 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c |  2 --
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 13 -------------
 drivers/gpu/drm/drm_fb_helper.c         |  8 ++++++++
 drivers/gpu/drm/drm_file.c              |  3 +++
 drivers/gpu/drm/i915/i915_driver.c      | 26 ++-----------------------
 drivers/gpu/drm/i915/i915_switcheroo.c  |  6 +++++-
 drivers/gpu/drm/nouveau/nouveau_drm.c   |  1 -
 drivers/gpu/drm/nouveau/nouveau_vga.c   |  7 -------
 drivers/gpu/drm/nouveau/nouveau_vga.h   |  1 -
 drivers/gpu/drm/radeon/radeon_drv.c     |  2 +-
 drivers/gpu/drm/radeon/radeon_drv.h     |  1 -
 drivers/gpu/drm/radeon/radeon_kms.c     | 18 -----------------
 drivers/gpu/vga/vga_switcheroo.c        |  4 ++--
 14 files changed, 21 insertions(+), 72 deletions(-)

base-commit: ac04152253dccfb02dcedfa0c57443122cf79314

Signature · 1 line
2.39.0
author maintainer
#6 lore raw

PATCH v2 3/3 drm: Call vga_switcheroo_process_delayed_switch() in drm_lastclose

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.

There was an earlier patchset to do something similar. [1]

v2:
* handle vga_switcheroo_client_fb_set() in a separate patch
* also update i915, nouveau and radeon
* remove unnecessary include statements
* update vga-switcheroo docs

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h     |  1 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c |  2 --
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 13 -------------
 drivers/gpu/drm/drm_file.c              |  3 +++
 drivers/gpu/drm/i915/i915_driver.c      | 25 ++-----------------------
 drivers/gpu/drm/nouveau/nouveau_drm.c   |  1 -
 drivers/gpu/drm/nouveau/nouveau_vga.c   |  7 -------
 drivers/gpu/drm/nouveau/nouveau_vga.h   |  1 -
 drivers/gpu/drm/radeon/radeon_drv.c     |  2 +-
 drivers/gpu/drm/radeon/radeon_drv.h     |  1 -
 drivers/gpu/drm/radeon/radeon_kms.c     | 18 ------------------
 drivers/gpu/vga/vga_switcheroo.c        |  4 ++--
 12 files changed, 8 insertions(+), 70 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -1
index 63c921c55fb9..7120b9b6e580 100644
@@ -1330,7 +1330,6 @@ extern const int amdgpu_max_kms_ioctl;
 
 int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags);
 void amdgpu_driver_unload_kms(struct drm_device *dev);
-void amdgpu_driver_lastclose_kms(struct drm_device *dev);
 int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv);
 void amdgpu_driver_postclose_kms(struct drm_device *dev,
 				 struct drm_file *file_priv);
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -2
index 1353ffd08988..783c1e284a22 100644
@@ -34,7 +34,6 @@
 #include <drm/drm_pciids.h>
 #include <linux/module.h>
 #include <linux/pm_runtime.h>
-#include <linux/vga_switcheroo.h>
 #include <drm/drm_probe_helper.h>
 #include <linux/mmu_notifier.h>
 #include <linux/suspend.h>
@@ -2785,7 +2784,6 @@ static const struct drm_driver amdgpu_kms_driver = {
 	    DRIVER_SYNCOBJ_TIMELINE,
 	.open = amdgpu_driver_open_kms,
 	.postclose = amdgpu_driver_postclose_kms,
-	.lastclose = amdgpu_driver_lastclose_kms,
 	.ioctls = amdgpu_ioctls_kms,
 	.num_ioctls = ARRAY_SIZE(amdgpu_ioctls_kms),
 	.dumb_create = amdgpu_mode_dumb_create,
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0 -13
index 7aa7e52ca784..a37be02fb2fc 100644
@@ -34,7 +34,6 @@
 #include "amdgpu_vce.h"
 #include "atom.h"
 
-#include <linux/vga_switcheroo.h>
 #include <linux/slab.h>
 #include <linux/uaccess.h>
 #include <linux/pci.h>
@@ -1104,18 +1103,6 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
 /*
  * Outdated mess for old drm with Xorg being in charge (void function now).
  */
-/**
- * amdgpu_driver_lastclose_kms - drm callback for last close
- *
- * @dev: drm dev pointer
- *
- * Switch vga_switcheroo state after last close (all asics).
- */
-void amdgpu_driver_lastclose_kms(struct drm_device *dev)
-{
-	drm_fb_helper_lastclose(dev);
-	vga_switcheroo_process_delayed_switch();
-}
 
 /**
  * amdgpu_driver_open_kms - drm callback for open
drivers/gpu/drm/drm_file.c +3 -0
index a51ff8cee049..314c309db9a3 100644
@@ -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();
 }
 
 /**
drivers/gpu/drm/i915/i915_driver.c +2 -23
index 33e231b120c1..bf6ad8620970 100644
@@ -29,6 +29,7 @@
 
 #include <linux/acpi.h>
 #include <linux/device.h>
+#include <linux/fb.h> /* for FBINFO_STATE_ */
 #include <linux/module.h>
 #include <linux/oom.h>
 #include <linux/pci.h>
@@ -37,7 +38,6 @@
 #include <linux/pnp.h>
 #include <linux/slab.h>
 #include <linux/string_helpers.h>
-#include <linux/vga_switcheroo.h>
 #include <linux/vt.h>
 
 #include <drm/drm_aperture.h>
@@ -1057,27 +1057,6 @@ static int i915_driver_open(struct drm_device *dev, struct drm_file *file)
 	return 0;
 }
 
-/**
- * i915_driver_lastclose - clean up after all DRM clients have exited
- * @dev: DRM device
- *
- * Take care of cleaning up after all DRM clients have exited.  In the
- * mode setting case, we want to restore the kernel's initial mode (just
- * in case the last client left us in a bad state).
- *
- * Additionally, in the non-mode setting case, we'll tear down the GTT
- * and DMA structures, since the kernel won't be using them, and clea
- * up any GEM state.
- */
-static void i915_driver_lastclose(struct drm_device *dev)
-{
-	struct drm_i915_private *i915 = to_i915(dev);
-
-	intel_fbdev_restore_mode(dev);
-
-	vga_switcheroo_process_delayed_switch();
-}
-
 static void i915_driver_postclose(struct drm_device *dev, struct drm_file *file)
 {
 	struct drm_i915_file_private *file_priv = file->driver_priv;
@@ -1921,7 +1900,7 @@ static const struct drm_driver i915_drm_driver = {
 	    DRIVER_SYNCOBJ_TIMELINE,
 	.release = i915_driver_release,
 	.open = i915_driver_open,
-	.lastclose = i915_driver_lastclose,
+	.lastclose = intel_fbdev_restore_mode,
 	.postclose = i915_driver_postclose,
 
 	.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
drivers/gpu/drm/nouveau/nouveau_drm.c +0 -1
index 80f154b6adab..c3bd2a1d3d2e 100644
@@ -1230,7 +1230,6 @@ driver_stub = {
 
 	.open = nouveau_drm_open,
 	.postclose = nouveau_drm_postclose,
-	.lastclose = nouveau_vga_lastclose,
 
 #if defined(CONFIG_DEBUG_FS)
 	.debugfs_init = nouveau_drm_debugfs_init,
drivers/gpu/drm/nouveau/nouveau_vga.c +0 -7
index 789393b94291..fc125e2247f7 100644
@@ -126,10 +126,3 @@ nouveau_vga_fini(struct nouveau_drm *drm)
 	if (runtime && nouveau_is_v1_dsm() && !nouveau_is_optimus())
 		vga_switcheroo_fini_domain_pm_ops(drm->dev->dev);
 }
-
-
-void
-nouveau_vga_lastclose(struct drm_device *dev)
-{
-	vga_switcheroo_process_delayed_switch();
-}
drivers/gpu/drm/nouveau/nouveau_vga.h +0 -1
index 951a83f984dd..63be415d2a44 100644
@@ -4,6 +4,5 @@
 
 void nouveau_vga_init(struct nouveau_drm *);
 void nouveau_vga_fini(struct nouveau_drm *);
-void nouveau_vga_lastclose(struct drm_device *dev);
 
 #endif
drivers/gpu/drm/radeon/radeon_drv.c +1 -1
index 6cbe1ab81aba..dbf85e1f0061 100644
@@ -597,7 +597,7 @@ static const struct drm_driver kms_driver = {
 	.load = radeon_driver_load_kms,
 	.open = radeon_driver_open_kms,
 	.postclose = radeon_driver_postclose_kms,
-	.lastclose = radeon_driver_lastclose_kms,
+	.lastclose = drm_fb_helper_lastclose,
 	.unload = radeon_driver_unload_kms,
 	.ioctls = radeon_ioctls_kms,
 	.num_ioctls = ARRAY_SIZE(radeon_ioctls_kms),
drivers/gpu/drm/radeon/radeon_drv.h +0 -1
index ac7970919c4d..2ffe0975ee54 100644
@@ -120,7 +120,6 @@ long radeon_drm_ioctl(struct file *filp,
 
 int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
 void radeon_driver_unload_kms(struct drm_device *dev);
-void radeon_driver_lastclose_kms(struct drm_device *dev);
 int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv);
 void radeon_driver_postclose_kms(struct drm_device *dev,
 				 struct drm_file *file_priv);
drivers/gpu/drm/radeon/radeon_kms.c +0 -18
index 965161b8565b..e0214cf1b43b 100644
@@ -32,7 +32,6 @@
 #include <linux/uaccess.h>
 #include <linux/vga_switcheroo.h>
 
-#include <drm/drm_fb_helper.h>
 #include <drm/drm_file.h>
 #include <drm/drm_ioctl.h>
 #include <drm/radeon_drm.h>
@@ -622,23 +621,6 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
 	return 0;
 }
 
-
-/*
- * Outdated mess for old drm with Xorg being in charge (void function now).
- */
-/**
- * radeon_driver_lastclose_kms - drm callback for last close
- *
- * @dev: drm dev pointer
- *
- * Switch vga_switcheroo state after last close (all asics).
- */
-void radeon_driver_lastclose_kms(struct drm_device *dev)
-{
-	drm_fb_helper_lastclose(dev);
-	vga_switcheroo_process_delayed_switch();
-}
-
 /**
  * radeon_driver_open_kms - drm callback for open
  *
drivers/gpu/vga/vga_switcheroo.c +2 -2
index 365e6ddbe90f..6a198cb80c12 100644
@@ -926,8 +926,8 @@ static void vga_switcheroo_debugfs_init(struct vgasr_priv *priv)
 /**
  * vga_switcheroo_process_delayed_switch() - helper for delayed switching
  *
- * Process a delayed switch if one is pending. DRM drivers should call this
- * from their ->lastclose callback.
+ * Process a delayed switch if one is pending. DRM automatically calls this
+ * at the end of its lastclose function.
  *
  * Return: 0 on success. -EINVAL if no delayed switch is pending, if the client
  * has unregistered in the meantime or if there are other clients blocking the
Signature · 1 line
2.39.0
author maintainer
#1 lore raw

PATCH v2 1/3 drm/i915: Allow switching away via vga-switcheroo if uninitialized

In reply to Thomas Zimmermann

Always allow switching away via vga-switcheroo if the display is uninitalized. Instead prevent switching to i915 if the device has not been initialized.

This issue was introduced by commit 5df7bd130818 ("drm/i915: skip display initialization when there is no display") protected, which protects code paths from being executed on uninitialized devices. In the case of vga-switcheroo, we want to allow a switch away from i915's device. So run vga_switcheroo_process_delayed_switch() and test in the switcheroo callbacks if the i915 device is available.

Fixes 5df7bd130818 ("drm/i915: skip display initialization when there is no display")
Cc Radhakrishna Sripada <[email protected]>
Cc Lucas De Marchi <[email protected]>
Cc José Roberto de Souza <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Ville Syrjälä <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Joonas Lahtinen <[email protected]>
Cc Rodrigo Vivi <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc "Ville Syrjälä" <[email protected]>
Cc Manasi Navare <[email protected]>
Cc Stanislav Lisovskiy <[email protected]>
Cc Imre Deak <[email protected]>
Cc "Jouni Högander" <[email protected]>
Cc Uma Shankar <[email protected]>
Cc Ankit Nautiyal <[email protected]>
Cc "Jason A. Donenfeld" <[email protected]>
Cc Matt Roper <[email protected]>
Cc Ramalingam C <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc Andi Shyti <[email protected]>
Cc Andrzej Hajda <[email protected]>
Cc "José Roberto de Souza" <[email protected]>
Cc Julia Lawall <[email protected]>
Cc <[email protected]> # v5.14+
---
 drivers/gpu/drm/i915/i915_driver.c     | 3 +--
 drivers/gpu/drm/i915/i915_switcheroo.c | 6 +++++-
 2 files changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_driver.c +1 -2
index c1e427ba57ae..33e231b120c1 100644
@@ -1075,8 +1075,7 @@ static void i915_driver_lastclose(struct drm_device *dev)
 
 	intel_fbdev_restore_mode(dev);
 
-	if (HAS_DISPLAY(i915))
-		vga_switcheroo_process_delayed_switch();
+	vga_switcheroo_process_delayed_switch();
 }
 
 static void i915_driver_postclose(struct drm_device *dev, struct drm_file *file)
drivers/gpu/drm/i915/i915_switcheroo.c +5 -1
index 23777d500cdf..f45bd6b6cede 100644
@@ -19,6 +19,10 @@ static void i915_switcheroo_set_state(struct pci_dev *pdev,
 		dev_err(&pdev->dev, "DRM not initialized, aborting switch.\n");
 		return;
 	}
+	if (!HAS_DISPLAY(i915)) {
+		dev_err(&pdev->dev, "Device state not initialized, aborting switch.\n");
+		return;
+	}
 
 	if (state == VGA_SWITCHEROO_ON) {
 		drm_info(&i915->drm, "switched on\n");
@@ -44,7 +48,7 @@ static bool i915_switcheroo_can_switch(struct pci_dev *pdev)
 	 * locking inversion with the driver load path. And the access here is
 	 * completely racy anyway. So don't bother with locking for now.
 	 */
-	return i915 && atomic_read(&i915->drm.open_count) == 0;
+	return i915 && HAS_DISPLAY(i915) && atomic_read(&i915->drm.open_count) == 0;
 }
 
 static const struct vga_switcheroo_client_ops i915_switcheroo_ops = {
Signature · 1 line
2.39.0
author maintainer
#2 lore raw

PATCH v2 2/3 drm/fb-helper: Set framebuffer for vga-switcheroo clients

In reply to Thomas Zimmermann

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")
Cc Ben Skeggs <[email protected]>
Cc Karol Herbst <[email protected]>
Cc Lyude Paul <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc Javier Martinez Canillas <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Evan Quan <[email protected]>
Cc Christian König <[email protected]>
Cc Alex Deucher <[email protected]>
Cc Hawking Zhang <[email protected]>
Cc Likun Gao <[email protected]>
Cc "Christian König" <[email protected]>
Cc Stanley Yang <[email protected]>
Cc "Tianci.Yin" <[email protected]>
Cc Xiaojian Du <[email protected]>
Cc Andrey Grodzovsky <[email protected]>
Cc YiPeng Chai <[email protected]>
Cc Somalapuram Amaranath <[email protected]>
Cc Bokun Zhang <[email protected]>
Cc Guchun Chen <[email protected]>
Cc Hamza Mahfooz <[email protected]>
Cc Aurabindo Pillai <[email protected]>
Cc Mario Limonciello <[email protected]>
Cc Solomon Chiu <[email protected]>
Cc Kai-Heng Feng <[email protected]>
Cc Felix Kuehling <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc "Marek Olšák" <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc Hans de Goede <[email protected]>
Cc "Ville Syrjälä" <[email protected]>
Cc <[email protected]> # v5.17+
---
 drivers/gpu/drm/drm_fb_helper.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/drm_fb_helper.c +8 -0
index 427631706128..5e445c61252d 100644
@@ -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;
 }
 
Signature · 1 line
2.39.0
#11 lore raw

[Intel-gfx] ✓ Fi.CI.BAT: success for drm: Generic fbdev and vga-switcheroo

In reply to Thomas Zimmermann
== Series Details ==

== Series Details ==

Series: drm: Generic fbdev and vga-switcheroo
URL : https://patchwork.freedesktop.org/series/112754/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_12578 -> Patchwork_112754v1
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112754v1/index.html

Participating hosts (42 -> 42)
------------------------------

Additional (1): fi-bsw-kefka
Missing (1): fi-snb-2520m

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_112754v1:

### IGT changes ###

#### Suppressed ####

The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.

* igt@gem_exec_suspend@basic-s0@smem:
- {bat-rplp-1}: [PASS][1] -> [DMESG-WARN][2] +4 similar issues
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12578/bat-rplp-1/igt@gem_exec_suspend@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112754v1/bat-rplp-1/igt@gem_exec_suspend@[email protected]

Known issues
------------

Here are the changes found in Patchwork_112754v1 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor@atomic-transitions-varying-size:
- fi-bsw-n3050: [PASS][3] -> [FAIL][4] ([i915#6298])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12578/fi-bsw-n3050/igt@kms_cursor_legacy@basic-busy-flip-before-cursor@atomic-transitions-varying-size.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112754v1/fi-bsw-n3050/igt@kms_cursor_legacy@basic-busy-flip-before-cursor@atomic-transitions-varying-size.html

* igt@prime_vgem@basic-fence-flip:
- fi-bsw-kefka: NOTRUN -> [SKIP][5] ([fdo#109271]) +26 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112754v1/fi-bsw-kefka/igt@[email protected]

#### Possible fixes ####

* igt@i915_selftest@live@gt_pm:
- {bat-rpls-2}: [DMESG-FAIL][6] ([i915#4258]) -> [PASS][7]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12578/bat-rpls-2/igt@i915_selftest@live@gt_pm.html
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112754v1/bat-rpls-2/igt@i915_selftest@live@gt_pm.html

* igt@i915_selftest@live@requests:
- {bat-rpls-2}: [INCOMPLETE][8] ([i915#4983] / [i915#6257]) -> [PASS][9]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12578/bat-rpls-2/igt@i915_selftest@[email protected]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112754v1/bat-rpls-2/igt@i915_selftest@[email protected]

* igt@i915_selftest@live@slpc:
- {bat-adlp-9}: [DMESG-FAIL][10] ([i915#6367]) -> [PASS][11]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12578/bat-adlp-9/igt@i915_selftest@[email protected]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112754v1/bat-adlp-9/igt@i915_selftest@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
[i915#4258]: https://gitlab.freedesktop.org/drm/intel/issues/4258
[i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
[i915#6257]: https://gitlab.freedesktop.org/drm/intel/issues/6257
[i915#6298]: https://gitlab.freedesktop.org/drm/intel/issues/6298
[i915#6367]: https://gitlab.freedesktop.org/drm/intel/issues/6367
[i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828

Build changes
-------------

* Linux: CI_DRM_12578 -> Patchwork_112754v1

CI-20190529: 20190529
CI_DRM_12578: c0ba6b6312e9139ce4b89da2904b329c13b5e94d @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7119: 1e6d24e6dfa42b22f950f7d5e436b8f9acf8747f @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_112754v1: c0ba6b6312e9139ce4b89da2904b329c13b5e94d @ git://anongit.freedesktop.org/gfx-ci/linux

### Linux commits

8b6eba054e60 drm: Call vga_switcheroo_process_delayed_switch() in drm_lastclose 26fb5c9ed690 drm/fb-helper: Set framebuffer for vga-switcheroo clients 87f27562b57a drm/i915: Allow switching away via vga-switcheroo if uninitialized

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112754v1/index.html

#12 lore raw

[Intel-gfx] ✓ Fi.CI.IGT: success for drm: Generic fbdev and vga-switcheroo

In reply to Thomas Zimmermann
== Series Details ==

== Series Details ==

Series: drm: Generic fbdev and vga-switcheroo
URL : https://patchwork.freedesktop.org/series/112754/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_12578_full -> Patchwork_112754v1_full
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112754v1/index.html

Participating hosts (13 -> 10)
------------------------------

Missing (3): pig-skl-6260u pig-kbl-iris pig-glk-j5005

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_112754v1_full:

### IGT changes ###

#### Suppressed ####

The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.

* igt@i915_module_load@reload-with-fault-injection:
- {shard-dg1}: [PASS][1] -> [DMESG-WARN][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12578/shard-dg1-14/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112754v1/shard-dg1-17/igt@[email protected]

Known issues
------------

Here are the changes found in Patchwork_112754v1_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@fbdev@write:
- shard-glk: [PASS][3] -> [FAIL][4] ([i915#6724])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12578/shard-glk4/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112754v1/shard-glk2/igt@[email protected]

#### Possible fixes ####

* igt@drm_fdinfo@idle@rcs0:
- {shard-rkl}: [FAIL][5] ([i915#7742]) -> [PASS][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12578/shard-rkl-4/igt@drm_fdinfo@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112754v1/shard-rkl-5/igt@drm_fdinfo@[email protected]

* igt@fbdev@eof:
- {shard-rkl}: [SKIP][7] ([i915#2582]) -> [PASS][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12578/shard-rkl-4/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112754v1/shard-rkl-6/igt@[email protected]

* igt@fbdev@write:
- {shard-tglu}: [FAIL][9] ([i915#6724]) -> [PASS][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12578/shard-tglu-1/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112754v1/shard-tglu-7/igt@[email protected]

* igt@gem_exec_fair@basic-pace@rcs0:
- {shard-rkl}: [FAIL][11] ([i915#2842]) -> [PASS][12] +4 similar issues
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12578/shard-rkl-6/igt@gem_exec_fair@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112754v1/shard-rkl-5/igt@gem_exec_fair@[email protected]

* igt@gem_exec_reloc@basic-gtt-read-noreloc:
- {shard-rkl}: [SKIP][13] ([i915#3281]) -> [PASS][14] +13 similar issues
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12578/shard-rkl-4/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112754v1/shard-rkl-5/igt@[email protected]

* igt@gem_mmap_gtt@coherency:
- {shard-rkl}: [SKIP][15] ([fdo#111656]) -> [PASS][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12578/shard-rkl-1/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112754v1/shard-rkl-5/igt@[email protected]

* igt@gem_partial_pwrite_pread@writes-after-reads-uncached:
- {shard-rkl}: [SKIP][17] ([i915#3282]) -> [PASS][18] +4 similar issues
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12578/shard-rkl-1/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112754v1/shard-rkl-5/igt@[email protected]

* igt@gen9_exec_parse@batch-invalid-length:
- {shard-rkl}: [SKIP][19] ([i915#2527]) -> [PASS][20] +3 similar issues
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12578/shard-rkl-4/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112754v1/shard-rkl-5/igt@[email protected]

* igt@i915_pm_rpm@dpms-mode-unset-lpsp:
- {shard-rkl}: [SKIP][21] ([i915#1397]) -> [PASS][22]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12578/shard-rkl-4/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112754v1/shard-rkl-6/igt@[email protected]

* igt@i915_pm_rpm@modeset-non-lpsp-stress:
- {shard-dg1}: [SKIP][23] ([i915#1397]) -> [PASS][24]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12578/shard-dg1-14/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112754v1/shard-dg1-19/igt@[email protected]

* igt@kms_fbcon_fbt@psr:
- {shard-rkl}: [SKIP][25] ([i915#3955]) -> [PASS][26]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12578/shard-rkl-4/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112754v1/shard-rkl-6/igt@[email protected]

* igt@kms_flip@flip-vs-expired-vblank-interruptible@c-hdmi-a1:
- shard-glk: [FAIL][27] ([i915#79]) -> [PASS][28]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12578/shard-glk4/igt@kms_flip@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112754v1/shard-glk2/igt@kms_flip@[email protected]

* igt@kms_frontbuffer_tracking@fbc-tiling-linear:
- {shard-rkl}: [SKIP][29] ([i915#1849] / [i915#4098]) -> [PASS][30] +19 similar issues
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12578/shard-rkl-4/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112754v1/shard-rkl-6/igt@[email protected]

* igt@kms_hdmi_inject@inject-audio:
- {shard-rkl}: [SKIP][31] ([i915#433]) -> [PASS][32]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12578/shard-rkl-4/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112754v1/shard-rkl-5/igt@[email protected]

* igt@kms_pipe_crc_basic@bad-source:
- {shard-rkl}: [SKIP][33] ([i915#1845] / [i915#4098]) -> [PASS][34] +24 similar issues
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12578/shard-rkl-5/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112754v1/shard-rkl-6/igt@[email protected]

* igt@kms_psr@sprite_plane_onoff:
- {shard-rkl}: [SKIP][35] ([i915#1072]) -> [PASS][36] +2 similar issues
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12578/shard-rkl-4/igt@kms_psr@sprite_plane_onoff.html
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112754v1/shard-rkl-6/igt@kms_psr@sprite_plane_onoff.html

* igt@kms_psr_stress_test@flip-primary-invalidate-overlay:
- {shard-rkl}: [SKIP][37] ([i915#5461]) -> [PASS][38]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12578/shard-rkl-4/igt@[email protected]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112754v1/shard-rkl-6/igt@[email protected]

* igt@prime_vgem@basic-write:
- {shard-rkl}: [SKIP][39] ([fdo#109295] / [i915#3291] / [i915#3708]) -> [PASS][40]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12578/shard-rkl-6/igt@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112754v1/shard-rkl-5/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#109274]: https://bugs.freedesktop.org/show_bug.cgi?id=109274
[fdo#109279]: https://bugs.freedesktop.org/show_bug.cgi?id=109279
[fdo#109280]: https://bugs.freedesktop.org/show_bug.cgi?id=109280
[fdo#109283]: https://bugs.freedesktop.org/show_bug.cgi?id=109283
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
[fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
[fdo#109302]: https://bugs.freedesktop.org/show_bug.cgi?id=109302
[fdo#109308]: https://bugs.freedesktop.org/show_bug.cgi?id=109308
[fdo#109309]: https://bugs.freedesktop.org/show_bug.cgi?id=109309
[fdo#109312]: https://bugs.freedesktop.org/show_bug.cgi?id=109312
[fdo#109313]: https://bugs.freedesktop.org/show_bug.cgi?id=109313
[fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
[fdo#109506]: https://bugs.freedesktop.org/show_bug.cgi?id=109506
[fdo#109642]: https://bugs.freedesktop.org/show_bug.cgi?id=109642
[fdo#110189]: https://bugs.freedesktop.org/show_bug.cgi?id=110189
[fdo#110542]: https://bugs.freedesktop.org/show_bug.cgi?id=110542
[fdo#110723]: https://bugs.freedesktop.org/show_bug.cgi?id=110723
[fdo#111068]: https://bugs.freedesktop.org/show_bug.cgi?id=111068
[fdo#111614]: https://bugs.freedesktop.org/show_bug.cgi?id=111614
[fdo#111615]: https://bugs.freedesktop.org/show_bug.cgi?id=111615
[fdo#111644]: https://bugs.freedesktop.org/show_bug.cgi?id=111644
[fdo#111656]: https://bugs.freedesktop.org/show_bug.cgi?id=111656
[fdo#111825]: https://bugs.freedesktop.org/show_bug.cgi?id=111825
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[fdo#112054]: https://bugs.freedesktop.org/show_bug.cgi?id=112054
[fdo#112283]: https://bugs.freedesktop.org/show_bug.cgi?id=112283
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#132]: https://gitlab.freedesktop.org/drm/intel/issues/132
[i915#1397]: https://gitlab.freedesktop.org/drm/intel/issues/1397
[i915#1769]: https://gitlab.freedesktop.org/drm/intel/issues/1769
[i915#1825]: https://gitlab.freedesktop.org/drm/intel/issues/1825
[i915#1839]: https://gitlab.freedesktop.org/drm/intel/issues/1839
[i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
[i915#1849]: https://gitlab.freedesktop.org/drm/intel/issues/1849
[i915#1902]: https://gitlab.freedesktop.org/drm/intel/issues/1902
[i915#1937]: https://gitlab.freedesktop.org/drm/intel/issues/1937
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#2437]: https://gitlab.freedesktop.org/drm/intel/issues/2437
[i915#2527]: https://gitlab.freedesktop.org/drm/intel/issues/2527
[i915#2575]: https://gitlab.freedesktop.org/drm/intel/issues/2575
[i915#2582]: https://gitlab.freedesktop.org/drm/intel/issues/2582
[i915#2587]: https://gitlab.freedesktop.org/drm/intel/issues/2587
[i915#2658]: https://gitlab.freedesktop.org/drm/intel/issues/2658
[i915#2672]: https://gitlab.freedesktop.org/drm/intel/issues/2672
[i915#2705]: https://gitlab.freedesktop.org/drm/intel/issues/2705
[i915#280]: https://gitlab.freedesktop.org/drm/intel/issues/280
[i915#284]: https://gitlab.freedesktop.org/drm/intel/issues/284
[i915#2842]: https://gitlab.freedesktop.org/drm/intel/issues/2842
[i915#2856]: https://gitlab.freedesktop.org/drm/intel/issues/2856
[i915#2920]: https://gitlab.freedesktop.org/drm/intel/issues/2920
[i915#2994]: https://gitlab.freedesktop.org/drm/intel/issues/2994
[i915#3116]: https://gitlab.freedesktop.org/drm/intel/issues/3116
[i915#315]: https://gitlab.freedesktop.org/drm/intel/issues/315
[i915#3281]: https://gitlab.freedesktop.org/drm/intel/issues/3281
[i915#3282]: https://gitlab.freedesktop.org/drm/intel/issues/3282
[i915#3291]: https://gitlab.freedesktop.org/drm/intel/issues/3291
[i915#3297]: https://gitlab.freedesktop.org/drm/intel/issues/3297
[i915#3299]: https://gitlab.freedesktop.org/drm/intel/issues/3299
[i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301
[i915#3318]: https://gitlab.freedesktop.org/drm/intel/issues/3318
[i915#3359]: https://gitlab.freedesktop.org/drm/intel/issues/3359
[i915#3361]: https://gitlab.freedesktop.org/drm/intel/issues/3361
[i915#3458]: https://gitlab.freedesktop.org/drm/intel/issues/3458
[i915#3469]: https://gitlab.freedesktop.org/drm/intel/issues/3469
[i915#3528]: https://gitlab.freedesktop.org/drm/intel/issues/3528
[i915#3536]: https://gitlab.freedesktop.org/drm/intel/issues/3536
[i915#3539]: https://gitlab.freedesktop.org/drm/intel/issues/3539
[i915#3546]: https://gitlab.freedesktop.org/drm/intel/issues/3546
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#3591]: https://gitlab.freedesktop.org/drm/intel/issues/3591
[i915#3637]: https://gitlab.freedesktop.org/drm/intel/issues/3637
[i915#3638]: https://gitlab.freedesktop.org/drm/intel/issues/3638
[i915#3639]: https://gitlab.freedesktop.org/drm/intel/issues/3639
[i915#3689]: https://gitlab.freedesktop.org/drm/intel/issues/3689
[i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
[i915#3734]: https://gitlab.freedesktop.org/drm/intel/issues/3734
[i915#3742]: https://gitlab.freedesktop.org/drm/intel/issues/3742
[i915#3804]: https://gitlab.freedesktop.org/drm/intel/issues/3804
[i915#3810]: https://gitlab.freedesktop.org/drm/intel/issues/3810
[i915#3840]: https://gitlab.freedesktop.org/drm/intel/issues/3840
[i915#3886]: https://gitlab.freedesktop.org/drm/intel/issues/3886
[i915#3955]: https://gitlab.freedesktop.org/drm/intel/issues/3955
[i915#3966]: https://gitlab.freedesktop.org/drm/intel/issues/3966
[i915#404]: https://gitlab.freedesktop.org/drm/intel/issues/404
[i915#4070]: https://gitlab.freedesktop.org/drm/intel/issues/4070
[i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
[i915#4078]: https://gitlab.freedesktop.org/drm/intel/issues/4078
[i915#4098]: https://gitlab.freedesktop.org/drm/intel/issues/4098
[i915#4270]: https://gitlab.freedesktop.org/drm/intel/issues/4270
[i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
[i915#433]: https://gitlab.freedesktop.org/drm/intel/issues/433
[i915#4349]: https://gitlab.freedesktop.org/drm/intel/issues/4349
[i915#4387]: https://gitlab.freedesktop.org/drm/intel/issues/4387
[i915#4538]: https://gitlab.freedesktop.org/drm/intel/issues/4538
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#4833]: https://gitlab.freedesktop.org/drm/intel/issues/4833
[i915#4877]: https://gitlab.freedesktop.org/drm/intel/issues/4877
[i915#5030]: https://gitlab.freedesktop.org/drm/intel/issues/5030
[i915#5176]: https://gitlab.freedesktop.org/drm/intel/issues/5176
[i915#5235]: https://gitlab.freedesktop.org/drm/intel/issues/5235
[i915#5286]: https://gitlab.freedesktop.org/drm/intel/issues/5286
[i915#5288]: https://gitlab.freedesktop.org/drm/intel/issues/5288
[i915#5289]: https://gitlab.freedesktop.org/drm/intel/issues/5289
[i915#5325]: https://gitlab.freedesktop.org/drm/intel/issues/5325
[i915#5327]: https://gitlab.freedesktop.org/drm/intel/issues/5327
[i915#533]: https://gitlab.freedesktop.org/drm/intel/issues/533
[i915#5439]: https://gitlab.freedesktop.org/drm/intel/issues/5439
[i915#5461]: https://gitlab.freedesktop.org/drm/intel/issues/5461
[i915#5723]: https://gitlab.freedesktop.org/drm/intel/issues/5723
[i915#6095]: https://gitlab.freedesktop.org/drm/intel/issues/6095
[i915#6227]: https://gitlab.freedesktop.org/drm/intel/issues/6227
[i915#6247]: https://gitlab.freedesktop.org/drm/intel/issues/6247
[i915#6248]: https://gitlab.freedesktop.org/drm/intel/issues/6248
[i915#6252]: https://gitlab.freedesktop.org/drm/intel/issues/6252
[i915#6268]: https://gitlab.freedesktop.org/drm/intel/issues/6268
[i915#6301]: https://gitlab.freedesktop.org/drm/intel/issues/6301
[i915#6334]: https://gitlab.freedesktop.org/drm/intel/issues/6334
[i915#6335]: https://gitlab.freedesktop.org/drm/intel/issues/6335
[i915#6344]: https://gitlab.freedesktop.org/drm/intel/issues/6344
[i915#6412]: https://gitlab.freedesktop.org/drm/intel/issues/6412
[i915#6433]: https://gitlab.freedesktop.org/drm/intel/issues/6433
[i915#6497]: https://gitlab.freedesktop.org/drm/intel/issues/6497
[i915#6524]: https://gitlab.freedesktop.org/drm/intel/issues/6524
[i915#658]: https://gitlab.freedesktop.org/drm/intel/issues/658
[i915#6724]: https://gitlab.freedesktop.org/drm/intel/issues/6724
[i915#6768]: https://gitlab.freedesktop.org/drm/intel/issues/6768
[i915#6944]: https://gitlab.freedesktop.org/drm/intel/issues/6944
[i915#6946]: https://gitlab.freedesktop.org/drm/intel/issues/6946
[i915#7037]: https://gitlab.freedesktop.org/drm/intel/issues/7037
[i915#7116]: https://gitlab.freedesktop.org/drm/intel/issues/7116
[i915#7118]: https://gitlab.freedesktop.org/drm/intel/issues/7118
[i915#7456]: https://gitlab.freedesktop.org/drm/intel/issues/7456
[i915#7561]: https://gitlab.freedesktop.org/drm/intel/issues/7561
[i915#7701]: https://gitlab.freedesktop.org/drm/intel/issues/7701
[i915#7707]: https://gitlab.freedesktop.org/drm/intel/issues/7707
[i915#7711]: https://gitlab.freedesktop.org/drm/intel/issues/7711
[i915#7742]: https://gitlab.freedesktop.org/drm/intel/issues/7742
[i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
[i915#7863]: https://gitlab.freedesktop.org/drm/intel/issues/7863
[i915#79]: https://gitlab.freedesktop.org/drm/intel/issues/79

Build changes
-------------

* Linux: CI_DRM_12578 -> Patchwork_112754v1
* Piglit: piglit_4509 -> None

CI-20190529: 20190529
CI_DRM_12578: c0ba6b6312e9139ce4b89da2904b329c13b5e94d @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7119: 1e6d24e6dfa42b22f950f7d5e436b8f9acf8747f @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_112754v1: c0ba6b6312e9139ce4b89da2904b329c13b5e94d @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_112754v1/index.html

reviewer
#7 lore raw

Re: [PATCH v2 3/3] drm: Call vga_switcheroo_process_delayed_switch() in drm_lastclose

In reply to Thomas Zimmermann
Quoted 6 lines · Thomas Zimmermann

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.

[...]

Quoted 11 lines
drivers/gpu/drm/drm_file.c +1 -0
@@ -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>

drivers/gpu/drm/drm_file.c void drm_lastclose(struct drm_device * dev) · line 466

Quoted 6 lines
drivers/gpu/drm/drm_file.c +2 -0
@@ -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

author maintainer
#8 lore raw

Re: [PATCH v2 3/3] drm: Call vga_switcheroo_process_delayed_switch() in drm_lastclose

Hi

Am 17.01.23 um 10:44 schrieb Lukas Wunner:

Quoted 28 lines · Thomas Zimmermann
Quoted 6 lines

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.

[...]

Quoted 11 lines
drivers/gpu/drm/drm_file.c +1 -0
@@ -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>

drivers/gpu/drm/drm_file.c void drm_lastclose(struct drm_device * dev) · line 466

Quoted 6 lines
drivers/gpu/drm/drm_file.c +2 -0
@@ -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:

Quoted 7 lines

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?

Console emulation is a mess. I'm working on it, but it takes time. Therefore a nice solution is probably not possible ATM.

We could have something like drm_fb_helper_lastclose_switcheroo(), which does drm_fb_helper_lastclose() + vga_switcheroo_process_delayed_switch(). i915 and radeon could use that as-is. amdgpu and nouveau have already switched to generic fbdev emulation. We could use drm_fb_helper_lastclose_switcheroo() from the generic code as well, but it will still be somewhat midlayerish.

But with all that, it's probably better to not land patch 3 at all. The hook drm_driver.lastclose is just for the old fbdev emulation. For the new fbdev emulation, we have better data structures (see drm_client_dev).

The correct design would be to switch amdgpu and nouveau back to their own fbdev emulation and handle switcheroo there. But their old fbdev code needed an overhaul, so just reverting isn't an option.

Best regards
Thomas

Quoted 4 lines

Thanks,

Lukas

Signature · 6 lines
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
maintainer
#3 lore raw

Re: [Intel-gfx] [PATCH v2 2/3] drm/fb-helper: Set framebuffer for vga-switcheroo clients

In reply to Thomas Zimmermann
Quoted 69 lines · Thomas Zimmermann

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")
Cc Ben Skeggs <[email protected]>
Cc Karol Herbst <[email protected]>
Cc Lyude Paul <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc Javier Martinez Canillas <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Evan Quan <[email protected]>
Cc Christian König <[email protected]>
Cc Alex Deucher <[email protected]>
Cc Hawking Zhang <[email protected]>
Cc Likun Gao <[email protected]>
Cc "Christian König" <[email protected]>
Cc Stanley Yang <[email protected]>
Cc "Tianci.Yin" <[email protected]>
Cc Xiaojian Du <[email protected]>
Cc Andrey Grodzovsky <[email protected]>
Cc YiPeng Chai <[email protected]>
Cc Somalapuram Amaranath <[email protected]>
Cc Bokun Zhang <[email protected]>
Cc Guchun Chen <[email protected]>
Cc Hamza Mahfooz <[email protected]>
Cc Aurabindo Pillai <[email protected]>
Cc Mario Limonciello <[email protected]>
Cc Solomon Chiu <[email protected]>
Cc Kai-Heng Feng <[email protected]>
Cc Felix Kuehling <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc "Marek Olšák" <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc Hans de Goede <[email protected]>
Cc "Ville Syrjälä" <[email protected]>
Cc <[email protected]> # v5.17+
---
 drivers/gpu/drm/drm_fb_helper.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/drm_fb_helper.c +2 -0
index 427631706128..5e445c61252d 100644
@@ -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>

drivers/gpu/drm/drm_fb_helper.c static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper, · line 1945

Quoted 4 lines
drivers/gpu/drm/drm_fb_helper.c +1 -0
@@ -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...

Quoted 18 lines
drivers/gpu/drm/drm_fb_helper.c +5 -0
 	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;
 }
 
Signature · 1 line
2.39.0
author maintainer
#4 lore raw

Re: [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:

Quoted 79 lines · Thomas Zimmermann
Quoted 69 lines

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")
Cc Ben Skeggs <[email protected]>
Cc Karol Herbst <[email protected]>
Cc Lyude Paul <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc Javier Martinez Canillas <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Evan Quan <[email protected]>
Cc Christian König <[email protected]>
Cc Alex Deucher <[email protected]>
Cc Hawking Zhang <[email protected]>
Cc Likun Gao <[email protected]>
Cc "Christian König" <[email protected]>
Cc Stanley Yang <[email protected]>
Cc "Tianci.Yin" <[email protected]>
Cc Xiaojian Du <[email protected]>
Cc Andrey Grodzovsky <[email protected]>
Cc YiPeng Chai <[email protected]>
Cc Somalapuram Amaranath <[email protected]>
Cc Bokun Zhang <[email protected]>
Cc Guchun Chen <[email protected]>
Cc Hamza Mahfooz <[email protected]>
Cc Aurabindo Pillai <[email protected]>
Cc Mario Limonciello <[email protected]>
Cc Solomon Chiu <[email protected]>
Cc Kai-Heng Feng <[email protected]>
Cc Felix Kuehling <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc "Marek Olšák" <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc Hans de Goede <[email protected]>
Cc "Ville Syrjälä" <[email protected]>
Cc <[email protected]> # v5.17+
---
  drivers/gpu/drm/drm_fb_helper.c | 8 ++++++++
  1 file changed, 8 insertions(+)
drivers/gpu/drm/drm_fb_helper.c +2 -0
index 427631706128..5e445c61252d 100644
@@ -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>

drivers/gpu/drm/drm_fb_helper.c static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper, · line 1945

Quoted 4 lines
drivers/gpu/drm/drm_fb_helper.c +1 -0
@@ -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.

Quoted 1 line

I had created a fix-up patch in drm-tip re-introducing this line.

Thank you. Is it fixed for now?

Quoted 4 lines

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

Quoted 19 lines
Quoted 19 lines
drivers/gpu/drm/drm_fb_helper.c +5 -0
  	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;
  }
 
Signature · 1 line
2.39.0
Signature · 6 lines
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
maintainer
#5 lore raw

Re: [Intel-gfx] [PATCH v2 2/3] drm/fb-helper: Set framebuffer for vga-switcheroo clients

Quoted 80 lines · Thomas Zimmermann

Hi

Am 18.01.23 um 20:21 schrieb Rodrigo Vivi:

Quoted 77 lines · Thomas Zimmermann
Quoted 67 lines

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")
Cc Ben Skeggs <[email protected]>
Cc Karol Herbst <[email protected]>
Cc Lyude Paul <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc Javier Martinez Canillas <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Evan Quan <[email protected]>
Cc Christian König <[email protected]>
Cc Alex Deucher <[email protected]>
Cc Hawking Zhang <[email protected]>
Cc Likun Gao <[email protected]>
Cc "Christian König" <[email protected]>
Cc Stanley Yang <[email protected]>
Cc "Tianci.Yin" <[email protected]>
Cc Xiaojian Du <[email protected]>
Cc Andrey Grodzovsky <[email protected]>
Cc YiPeng Chai <[email protected]>
Cc Somalapuram Amaranath <[email protected]>
Cc Bokun Zhang <[email protected]>
Cc Guchun Chen <[email protected]>
Cc Hamza Mahfooz <[email protected]>
Cc Aurabindo Pillai <[email protected]>
Cc Mario Limonciello <[email protected]>
Cc Solomon Chiu <[email protected]>
Cc Kai-Heng Feng <[email protected]>
Cc Felix Kuehling <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc "Marek Olšák" <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc Hans de Goede <[email protected]>
Cc "Ville Syrjälä" <[email protected]>
Cc <[email protected]> # v5.17+
---
  drivers/gpu/drm/drm_fb_helper.c | 8 ++++++++
  1 file changed, 8 insertions(+)
drivers/gpu/drm/drm_fb_helper.c +2 -0
index 427631706128..5e445c61252d 100644
@@ -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>

drivers/gpu/drm/drm_fb_helper.c static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper, · line 1945

Quoted 4 lines
drivers/gpu/drm/drm_fb_helper.c +1 -0
@@ -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.

Quoted 3 lines
Quoted 1 line

I had created a fix-up patch in drm-tip re-introducing this line.

Thank you. Is it fixed for now?

Fixed in drm-tip, yes. But broke linux-next as well. This resolution will need to go up with any merge...

Quoted 8 lines
Quoted 5 lines

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.

doh! Indeed I should've known this by heart... -ENOTEHOUGHCOFFEE

Quoted 3 lines

Can we solve this by merging -fixes into upstream and backmerging this into our -next branches?

hmmm... probably better just wait and let folks know the resolution when the patches are moving up...

Quoted 28 lines

Best regards
Thomas

Quoted 16 lines
Quoted 16 lines
drivers/gpu/drm/drm_fb_helper.c +5 -0
  	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;
  }
Signature · 1 line
2.39.0
Signature · 6 lines
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
maintainer Acked-by on v2 3/3
#9 lore raw

Re: [PATCH v2 3/3] drm: Call vga_switcheroo_process_delayed_switch() in drm_lastclose

In reply to Thomas Zimmermann
Quoted 290 lines · Thomas Zimmermann

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.

There was an earlier patchset to do something similar. [1]

v2:
* handle vga_switcheroo_client_fb_set() in a separate patch
* also update i915, nouveau and radeon
* remove unnecessary include statements
* update vga-switcheroo docs

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h     |  1 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c |  2 --
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 13 -------------
 drivers/gpu/drm/drm_file.c              |  3 +++
 drivers/gpu/drm/i915/i915_driver.c      | 25 ++-----------------------
 drivers/gpu/drm/nouveau/nouveau_drm.c   |  1 -
 drivers/gpu/drm/nouveau/nouveau_vga.c   |  7 -------
 drivers/gpu/drm/nouveau/nouveau_vga.h   |  1 -
 drivers/gpu/drm/radeon/radeon_drv.c     |  2 +-
 drivers/gpu/drm/radeon/radeon_drv.h     |  1 -
 drivers/gpu/drm/radeon/radeon_kms.c     | 18 ------------------
 drivers/gpu/vga/vga_switcheroo.c        |  4 ++--
 12 files changed, 8 insertions(+), 70 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -1
index 63c921c55fb9..7120b9b6e580 100644
@@ -1330,7 +1330,6 @@ extern const int amdgpu_max_kms_ioctl;
 
 int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags);
 void amdgpu_driver_unload_kms(struct drm_device *dev);
-void amdgpu_driver_lastclose_kms(struct drm_device *dev);
 int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv);
 void amdgpu_driver_postclose_kms(struct drm_device *dev,
 				 struct drm_file *file_priv);
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -2
index 1353ffd08988..783c1e284a22 100644
@@ -34,7 +34,6 @@
 #include <drm/drm_pciids.h>
 #include <linux/module.h>
 #include <linux/pm_runtime.h>
-#include <linux/vga_switcheroo.h>
 #include <drm/drm_probe_helper.h>
 #include <linux/mmu_notifier.h>
 #include <linux/suspend.h>
@@ -2785,7 +2784,6 @@ static const struct drm_driver amdgpu_kms_driver = {
 	    DRIVER_SYNCOBJ_TIMELINE,
 	.open = amdgpu_driver_open_kms,
 	.postclose = amdgpu_driver_postclose_kms,
-	.lastclose = amdgpu_driver_lastclose_kms,
 	.ioctls = amdgpu_ioctls_kms,
 	.num_ioctls = ARRAY_SIZE(amdgpu_ioctls_kms),
 	.dumb_create = amdgpu_mode_dumb_create,
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0 -13
index 7aa7e52ca784..a37be02fb2fc 100644
@@ -34,7 +34,6 @@
 #include "amdgpu_vce.h"
 #include "atom.h"
 
-#include <linux/vga_switcheroo.h>
 #include <linux/slab.h>
 #include <linux/uaccess.h>
 #include <linux/pci.h>
@@ -1104,18 +1103,6 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
 /*
  * Outdated mess for old drm with Xorg being in charge (void function now).
  */
-/**
- * amdgpu_driver_lastclose_kms - drm callback for last close
- *
- * @dev: drm dev pointer
- *
- * Switch vga_switcheroo state after last close (all asics).
- */
-void amdgpu_driver_lastclose_kms(struct drm_device *dev)
-{
-	drm_fb_helper_lastclose(dev);
-	vga_switcheroo_process_delayed_switch();
-}
 
 /**
  * amdgpu_driver_open_kms - drm callback for open
drivers/gpu/drm/drm_file.c +3 -0
index a51ff8cee049..314c309db9a3 100644
@@ -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();
 }
 
 /**
drivers/gpu/drm/i915/i915_driver.c +2 -23
index 33e231b120c1..bf6ad8620970 100644
@@ -29,6 +29,7 @@
 
 #include <linux/acpi.h>
 #include <linux/device.h>
+#include <linux/fb.h> /* for FBINFO_STATE_ */
 #include <linux/module.h>
 #include <linux/oom.h>
 #include <linux/pci.h>
@@ -37,7 +38,6 @@
 #include <linux/pnp.h>
 #include <linux/slab.h>
 #include <linux/string_helpers.h>
-#include <linux/vga_switcheroo.h>
 #include <linux/vt.h>
 
 #include <drm/drm_aperture.h>
@@ -1057,27 +1057,6 @@ static int i915_driver_open(struct drm_device *dev, struct drm_file *file)
 	return 0;
 }
 
-/**
- * i915_driver_lastclose - clean up after all DRM clients have exited
- * @dev: DRM device
- *
- * Take care of cleaning up after all DRM clients have exited.  In the
- * mode setting case, we want to restore the kernel's initial mode (just
- * in case the last client left us in a bad state).
- *
- * Additionally, in the non-mode setting case, we'll tear down the GTT
- * and DMA structures, since the kernel won't be using them, and clea
- * up any GEM state.
- */
-static void i915_driver_lastclose(struct drm_device *dev)
-{
-	struct drm_i915_private *i915 = to_i915(dev);
-
-	intel_fbdev_restore_mode(dev);
-
-	vga_switcheroo_process_delayed_switch();
-}
-
 static void i915_driver_postclose(struct drm_device *dev, struct drm_file *file)
 {
 	struct drm_i915_file_private *file_priv = file->driver_priv;
@@ -1921,7 +1900,7 @@ static const struct drm_driver i915_drm_driver = {
 	    DRIVER_SYNCOBJ_TIMELINE,
 	.release = i915_driver_release,
 	.open = i915_driver_open,
-	.lastclose = i915_driver_lastclose,
+	.lastclose = intel_fbdev_restore_mode,
 	.postclose = i915_driver_postclose,
 
 	.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
drivers/gpu/drm/nouveau/nouveau_drm.c +0 -1
index 80f154b6adab..c3bd2a1d3d2e 100644
@@ -1230,7 +1230,6 @@ driver_stub = {
 
 	.open = nouveau_drm_open,
 	.postclose = nouveau_drm_postclose,
-	.lastclose = nouveau_vga_lastclose,
 
 #if defined(CONFIG_DEBUG_FS)
 	.debugfs_init = nouveau_drm_debugfs_init,
drivers/gpu/drm/nouveau/nouveau_vga.c +0 -7
index 789393b94291..fc125e2247f7 100644
@@ -126,10 +126,3 @@ nouveau_vga_fini(struct nouveau_drm *drm)
 	if (runtime && nouveau_is_v1_dsm() && !nouveau_is_optimus())
 		vga_switcheroo_fini_domain_pm_ops(drm->dev->dev);
 }
-
-
-void
-nouveau_vga_lastclose(struct drm_device *dev)
-{
-	vga_switcheroo_process_delayed_switch();
-}
drivers/gpu/drm/nouveau/nouveau_vga.h +0 -1
index 951a83f984dd..63be415d2a44 100644
@@ -4,6 +4,5 @@
 
 void nouveau_vga_init(struct nouveau_drm *);
 void nouveau_vga_fini(struct nouveau_drm *);
-void nouveau_vga_lastclose(struct drm_device *dev);
 
 #endif
drivers/gpu/drm/radeon/radeon_drv.c +1 -1
index 6cbe1ab81aba..dbf85e1f0061 100644
@@ -597,7 +597,7 @@ static const struct drm_driver kms_driver = {
 	.load = radeon_driver_load_kms,
 	.open = radeon_driver_open_kms,
 	.postclose = radeon_driver_postclose_kms,
-	.lastclose = radeon_driver_lastclose_kms,
+	.lastclose = drm_fb_helper_lastclose,
 	.unload = radeon_driver_unload_kms,
 	.ioctls = radeon_ioctls_kms,
 	.num_ioctls = ARRAY_SIZE(radeon_ioctls_kms),
drivers/gpu/drm/radeon/radeon_drv.h +0 -1
index ac7970919c4d..2ffe0975ee54 100644
@@ -120,7 +120,6 @@ long radeon_drm_ioctl(struct file *filp,
 
 int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
 void radeon_driver_unload_kms(struct drm_device *dev);
-void radeon_driver_lastclose_kms(struct drm_device *dev);
 int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv);
 void radeon_driver_postclose_kms(struct drm_device *dev,
 				 struct drm_file *file_priv);
drivers/gpu/drm/radeon/radeon_kms.c +0 -18
index 965161b8565b..e0214cf1b43b 100644
@@ -32,7 +32,6 @@
 #include <linux/uaccess.h>
 #include <linux/vga_switcheroo.h>
 
-#include <drm/drm_fb_helper.h>
 #include <drm/drm_file.h>
 #include <drm/drm_ioctl.h>
 #include <drm/radeon_drm.h>
@@ -622,23 +621,6 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
 	return 0;
 }
 
-
-/*
- * Outdated mess for old drm with Xorg being in charge (void function now).
- */
-/**
- * radeon_driver_lastclose_kms - drm callback for last close
- *
- * @dev: drm dev pointer
- *
- * Switch vga_switcheroo state after last close (all asics).
- */
-void radeon_driver_lastclose_kms(struct drm_device *dev)
-{
-	drm_fb_helper_lastclose(dev);
-	vga_switcheroo_process_delayed_switch();
-}
-
 /**
  * radeon_driver_open_kms - drm callback for open
  *
drivers/gpu/vga/vga_switcheroo.c +2 -2
index 365e6ddbe90f..6a198cb80c12 100644
@@ -926,8 +926,8 @@ static void vga_switcheroo_debugfs_init(struct vgasr_priv *priv)
 /**
  * vga_switcheroo_process_delayed_switch() - helper for delayed switching
  *
- * Process a delayed switch if one is pending. DRM drivers should call this
- * from their ->lastclose callback.
+ * Process a delayed switch if one is pending. DRM automatically calls this
+ * at the end of its lastclose function.
  *
  * Return: 0 on success. -EINVAL if no delayed switch is pending, if the client
  * has unregistered in the meantime or if there are other clients blocking the
Signature · 3 lines
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat