vga_switcheroo: add reprobe hook for fbcon to recheck connected outputs.
authorDave Airlie <airlied@redhat.com>
Mon, 6 Dec 2010 22:57:57 +0000 (08:57 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 5 Jan 2011 03:44:07 +0000 (13:44 +1000)
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>
drivers/gpu/drm/i915/i915_dma.c
drivers/gpu/drm/nouveau/nouveau_state.c
drivers/gpu/drm/radeon/radeon_device.c
drivers/gpu/vga/vga_switcheroo.c
include/linux/vga_switcheroo.h

index 8cb7f93732c2c05c1311985684141a4296358b94..ec1f650f6fabf7d36e228d3e2833c645a6a4fe5a 100644 (file)
@@ -1231,6 +1231,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
 
        ret = vga_switcheroo_register_client(dev->pdev,
                                             i915_switcheroo_set_state,
+                                            NULL,
                                             i915_switcheroo_can_switch);
        if (ret)
                goto cleanup_vga_client;
index db4b410f4a8cbd19d90f4a5bab308e5244dc9943..1b87eee22fa9fd5a3cabb128bd7f3b10a38bf4f5 100644 (file)
@@ -605,6 +605,12 @@ static void nouveau_switcheroo_set_state(struct pci_dev *pdev,
        }
 }
 
+static void nouveau_switcheroo_reprobe(struct pci_dev *pdev)
+{
+       struct drm_device *dev = pci_get_drvdata(pdev);
+       nouveau_fbcon_output_poll_changed(dev);
+}
+
 static bool nouveau_switcheroo_can_switch(struct pci_dev *pdev)
 {
        struct drm_device *dev = pci_get_drvdata(pdev);
@@ -625,6 +631,7 @@ nouveau_card_init(struct drm_device *dev)
 
        vga_client_register(dev->pdev, dev, NULL, nouveau_vga_set_decode);
        vga_switcheroo_register_client(dev->pdev, nouveau_switcheroo_set_state,
+                                      nouveau_switcheroo_reprobe,
                                       nouveau_switcheroo_can_switch);
 
        /* Initialise internal driver API hooks */
index 96f0eb484ce68170042cfa86a2d34794176e8e02..1a1017f0d9dbb2bddf1369271d09b80fe933e9d7 100644 (file)
@@ -779,6 +779,7 @@ int radeon_device_init(struct radeon_device *rdev,
        vga_client_register(rdev->pdev, rdev, NULL, radeon_vga_set_decode);
        vga_switcheroo_register_client(rdev->pdev,
                                       radeon_switcheroo_set_state,
+                                      NULL,
                                       radeon_switcheroo_can_switch);
 
        r = radeon_init(rdev);
index 463691a1650ef2c1aa0da8a3e24b780221c21810..2b8e1d25e8d00c5d6d6762ff712fe7168295fdf5 100644 (file)
@@ -33,6 +33,7 @@ struct vga_switcheroo_client {
        struct fb_info *fb_info;
        int pwr_state;
        void (*set_gpu_state)(struct pci_dev *pdev, enum vga_switcheroo_state);
+       void (*reprobe)(struct pci_dev *pdev);
        bool (*can_switch)(struct pci_dev *pdev);
        int id;
        bool active;
@@ -103,6 +104,7 @@ static void vga_switcheroo_enable(void)
 
 int vga_switcheroo_register_client(struct pci_dev *pdev,
                                   void (*set_gpu_state)(struct pci_dev *pdev, enum vga_switcheroo_state),
+                                  void (*reprobe)(struct pci_dev *pdev),
                                   bool (*can_switch)(struct pci_dev *pdev))
 {
        int index;
@@ -117,6 +119,7 @@ int vga_switcheroo_register_client(struct pci_dev *pdev,
        vgasr_priv.clients[index].pwr_state = VGA_SWITCHEROO_ON;
        vgasr_priv.clients[index].pdev = pdev;
        vgasr_priv.clients[index].set_gpu_state = set_gpu_state;
+       vgasr_priv.clients[index].reprobe = reprobe;
        vgasr_priv.clients[index].can_switch = can_switch;
        vgasr_priv.clients[index].id = -1;
        if (pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW)
@@ -251,6 +254,9 @@ static int vga_switchto(struct vga_switcheroo_client *new_client)
        if (ret)
                return ret;
 
+       if (new_client->reprobe)
+               new_client->reprobe(new_client->pdev);
+
        if (active->pwr_state == VGA_SWITCHEROO_ON)
                vga_switchoff(active);
 
index ae9ab13b963d53e5de2eef42220c9b61f8ad466b..f80fa9de5b8247c80af02e97f6004b9a8506730e 100644 (file)
@@ -33,6 +33,7 @@ struct vga_switcheroo_handler {
 void vga_switcheroo_unregister_client(struct pci_dev *dev);
 int vga_switcheroo_register_client(struct pci_dev *dev,
                                   void (*set_gpu_state)(struct pci_dev *dev, enum vga_switcheroo_state),
+                                  void (*reprobe)(struct pci_dev *dev),
                                   bool (*can_switch)(struct pci_dev *dev));
 
 void vga_switcheroo_client_fb_set(struct pci_dev *dev,