From c9f2c30565da1bdb58064684d461b432e4384777 Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Thu, 9 Jul 2026 11:16:02 +0200 Subject: [PATCH] drm: Implement vga_switcheroo_client_ops.post_switch An output's attached display might have changed while a DRM client's device did not have the output switched to it. The nouveau_switcheroo_reprobe() callback sends a hotplug notice to DRM's internal clients, so that they can reconfigure their display output if necessary. As post_switch callback replaces reprobe in vga_switcheroo, update nouveau accordingly. In the other drivers, remove the NULL-assignment to reprobe. No functional changes. Signed-off-by: Thomas Zimmermann Reviewed-by: Lyude Paul # nouveau Acked-by: Maxime Ripard Acked-by: Helge Deller Link: https://patch.msgid.link/20260709092215.168172-7-tzimmermann@suse.de --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 1 - drivers/gpu/drm/i915/i915_switcheroo.c | 1 - drivers/gpu/drm/nouveau/nouveau_vga.c | 19 +++++++++---------- drivers/gpu/drm/radeon/radeon_device.c | 1 - 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 0c8a94a22192..62b5b4a23f17 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -1743,7 +1743,6 @@ static void amdgpu_switcheroo_pre_switch(struct pci_dev *pdev) static const struct vga_switcheroo_client_ops amdgpu_switcheroo_ops = { .set_gpu_state = amdgpu_switcheroo_set_state, - .reprobe = NULL, .can_switch = amdgpu_switcheroo_can_switch, .pre_switch = amdgpu_switcheroo_pre_switch, }; diff --git a/drivers/gpu/drm/i915/i915_switcheroo.c b/drivers/gpu/drm/i915/i915_switcheroo.c index 6b306ece0556..d97057722fde 100644 --- a/drivers/gpu/drm/i915/i915_switcheroo.c +++ b/drivers/gpu/drm/i915/i915_switcheroo.c @@ -69,7 +69,6 @@ static void i915_switcheroo_pre_switch(struct pci_dev *pdev) static const struct vga_switcheroo_client_ops i915_switcheroo_ops = { .set_gpu_state = i915_switcheroo_set_state, - .reprobe = NULL, .can_switch = i915_switcheroo_can_switch, .pre_switch = i915_switcheroo_pre_switch, }; diff --git a/drivers/gpu/drm/nouveau/nouveau_vga.c b/drivers/gpu/drm/nouveau/nouveau_vga.c index 2d2d08be8fbe..29a801124e56 100644 --- a/drivers/gpu/drm/nouveau/nouveau_vga.c +++ b/drivers/gpu/drm/nouveau/nouveau_vga.c @@ -54,15 +54,6 @@ nouveau_switcheroo_set_state(struct pci_dev *pdev, } } -static void -nouveau_switcheroo_reprobe(struct pci_dev *pdev) -{ - struct nouveau_drm *drm = pci_get_drvdata(pdev); - struct drm_device *dev = drm->dev; - - drm_client_dev_hotplug(dev); -} - static bool nouveau_switcheroo_can_switch(struct pci_dev *pdev) { @@ -84,12 +75,20 @@ nouveau_switcheroo_pre_switch(struct pci_dev *pdev) drm_client_dev_acquire_outputs(drm->dev); } +static void +nouveau_switcheroo_post_switch(struct pci_dev *pdev) +{ + struct nouveau_drm *drm = pci_get_drvdata(pdev); + + drm_client_dev_hotplug(drm->dev); +} + static const struct vga_switcheroo_client_ops nouveau_switcheroo_ops = { .set_gpu_state = nouveau_switcheroo_set_state, - .reprobe = nouveau_switcheroo_reprobe, .can_switch = nouveau_switcheroo_can_switch, .pre_switch = nouveau_switcheroo_pre_switch, + .post_switch = nouveau_switcheroo_post_switch, }; void diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 8697a9eb5d13..9523240110a6 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c @@ -1267,7 +1267,6 @@ static void radeon_switcheroo_pre_switch(struct pci_dev *pdev) static const struct vga_switcheroo_client_ops radeon_switcheroo_ops = { .set_gpu_state = radeon_switcheroo_set_state, - .reprobe = NULL, .can_switch = radeon_switcheroo_can_switch, .pre_switch = radeon_switcheroo_pre_switch, };