aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2010-12-06 17:57:57 -0500
committerDave Airlie <airlied@redhat.com>2011-01-04 22:44:07 -0500
commit8d608aa6295242fe4c4b6105b8c59c6a5b232d89 (patch)
tree89205a1d839b0b002ec58d7988c2bebea7d8efc8 /drivers/gpu
parentd1fbd923da0f982f12b61a44e74c2e1f74c6ef56 (diff)
vga_switcheroo: add reprobe hook for fbcon to recheck connected outputs.
This adds a hook after the mux is switched for the driver to reprobe the connected outputs. Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c1
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_state.c7
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c1
-rw-r--r--drivers/gpu/vga/vga_switcheroo.c6
4 files changed, 15 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 8cb7f93732c2..ec1f650f6fab 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1231,6 +1231,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
1231 1231
1232 ret = vga_switcheroo_register_client(dev->pdev, 1232 ret = vga_switcheroo_register_client(dev->pdev,
1233 i915_switcheroo_set_state, 1233 i915_switcheroo_set_state,
1234 NULL,
1234 i915_switcheroo_can_switch); 1235 i915_switcheroo_can_switch);
1235 if (ret) 1236 if (ret)
1236 goto cleanup_vga_client; 1237 goto cleanup_vga_client;
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c
index db4b410f4a8c..1b87eee22fa9 100644
--- a/drivers/gpu/drm/nouveau/nouveau_state.c
+++ b/drivers/gpu/drm/nouveau/nouveau_state.c
@@ -605,6 +605,12 @@ static void nouveau_switcheroo_set_state(struct pci_dev *pdev,
605 } 605 }
606} 606}
607 607
608static void nouveau_switcheroo_reprobe(struct pci_dev *pdev)
609{
610 struct drm_device *dev = pci_get_drvdata(pdev);
611 nouveau_fbcon_output_poll_changed(dev);
612}
613
608static bool nouveau_switcheroo_can_switch(struct pci_dev *pdev) 614static bool nouveau_switcheroo_can_switch(struct pci_dev *pdev)
609{ 615{
610 struct drm_device *dev = pci_get_drvdata(pdev); 616 struct drm_device *dev = pci_get_drvdata(pdev);
@@ -625,6 +631,7 @@ nouveau_card_init(struct drm_device *dev)
625 631
626 vga_client_register(dev->pdev, dev, NULL, nouveau_vga_set_decode); 632 vga_client_register(dev->pdev, dev, NULL, nouveau_vga_set_decode);
627 vga_switcheroo_register_client(dev->pdev, nouveau_switcheroo_set_state, 633 vga_switcheroo_register_client(dev->pdev, nouveau_switcheroo_set_state,
634 nouveau_switcheroo_reprobe,
628 nouveau_switcheroo_can_switch); 635 nouveau_switcheroo_can_switch);
629 636
630 /* Initialise internal driver API hooks */ 637 /* Initialise internal driver API hooks */
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 96f0eb484ce6..1a1017f0d9db 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -779,6 +779,7 @@ int radeon_device_init(struct radeon_device *rdev,
779 vga_client_register(rdev->pdev, rdev, NULL, radeon_vga_set_decode); 779 vga_client_register(rdev->pdev, rdev, NULL, radeon_vga_set_decode);
780 vga_switcheroo_register_client(rdev->pdev, 780 vga_switcheroo_register_client(rdev->pdev,
781 radeon_switcheroo_set_state, 781 radeon_switcheroo_set_state,
782 NULL,
782 radeon_switcheroo_can_switch); 783 radeon_switcheroo_can_switch);
783 784
784 r = radeon_init(rdev); 785 r = radeon_init(rdev);
diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c
index 463691a1650e..2b8e1d25e8d0 100644
--- a/drivers/gpu/vga/vga_switcheroo.c
+++ b/drivers/gpu/vga/vga_switcheroo.c
@@ -33,6 +33,7 @@ struct vga_switcheroo_client {
33 struct fb_info *fb_info; 33 struct fb_info *fb_info;
34 int pwr_state; 34 int pwr_state;
35 void (*set_gpu_state)(struct pci_dev *pdev, enum vga_switcheroo_state); 35 void (*set_gpu_state)(struct pci_dev *pdev, enum vga_switcheroo_state);
36 void (*reprobe)(struct pci_dev *pdev);
36 bool (*can_switch)(struct pci_dev *pdev); 37 bool (*can_switch)(struct pci_dev *pdev);
37 int id; 38 int id;
38 bool active; 39 bool active;
@@ -103,6 +104,7 @@ static void vga_switcheroo_enable(void)
103 104
104int vga_switcheroo_register_client(struct pci_dev *pdev, 105int vga_switcheroo_register_client(struct pci_dev *pdev,
105 void (*set_gpu_state)(struct pci_dev *pdev, enum vga_switcheroo_state), 106 void (*set_gpu_state)(struct pci_dev *pdev, enum vga_switcheroo_state),
107 void (*reprobe)(struct pci_dev *pdev),
106 bool (*can_switch)(struct pci_dev *pdev)) 108 bool (*can_switch)(struct pci_dev *pdev))
107{ 109{
108 int index; 110 int index;
@@ -117,6 +119,7 @@ int vga_switcheroo_register_client(struct pci_dev *pdev,
117 vgasr_priv.clients[index].pwr_state = VGA_SWITCHEROO_ON; 119 vgasr_priv.clients[index].pwr_state = VGA_SWITCHEROO_ON;
118 vgasr_priv.clients[index].pdev = pdev; 120 vgasr_priv.clients[index].pdev = pdev;
119 vgasr_priv.clients[index].set_gpu_state = set_gpu_state; 121 vgasr_priv.clients[index].set_gpu_state = set_gpu_state;
122 vgasr_priv.clients[index].reprobe = reprobe;
120 vgasr_priv.clients[index].can_switch = can_switch; 123 vgasr_priv.clients[index].can_switch = can_switch;
121 vgasr_priv.clients[index].id = -1; 124 vgasr_priv.clients[index].id = -1;
122 if (pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW) 125 if (pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW)
@@ -251,6 +254,9 @@ static int vga_switchto(struct vga_switcheroo_client *new_client)
251 if (ret) 254 if (ret)
252 return ret; 255 return ret;
253 256
257 if (new_client->reprobe)
258 new_client->reprobe(new_client->pdev);
259
254 if (active->pwr_state == VGA_SWITCHEROO_ON) 260 if (active->pwr_state == VGA_SWITCHEROO_ON)
255 vga_switchoff(active); 261 vga_switchoff(active);
256 262