Commit 2fbe8c7c authored by Matthew Garrett's avatar Matthew Garrett Committed by Dave Airlie

vga-switcheroo: Use vga_default_device()

vga-switcheroo currently changes the default VGA device by fiddling with
the IORESOURCE_ROM_SHADOW flag on the device. This isn't strictly accurate,
since there's no guarantee that switching also changes the ROM decoding.
Switch over to using the vgaarb functions for this.
Signed-off-by: default avatarMatthew Garrett <mjg@redhat.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 1a39b310
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/vga_switcheroo.h> #include <linux/vga_switcheroo.h>
#include <linux/vgaarb.h>
struct vga_switcheroo_client { struct vga_switcheroo_client {
struct pci_dev *pdev; struct pci_dev *pdev;
struct fb_info *fb_info; struct fb_info *fb_info;
...@@ -122,7 +124,7 @@ int vga_switcheroo_register_client(struct pci_dev *pdev, ...@@ -122,7 +124,7 @@ int vga_switcheroo_register_client(struct pci_dev *pdev,
vgasr_priv.clients[index].reprobe = reprobe; vgasr_priv.clients[index].reprobe = reprobe;
vgasr_priv.clients[index].can_switch = can_switch; vgasr_priv.clients[index].can_switch = can_switch;
vgasr_priv.clients[index].id = -1; vgasr_priv.clients[index].id = -1;
if (pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW) if (pdev == vga_default_device())
vgasr_priv.clients[index].active = true; vgasr_priv.clients[index].active = true;
vgasr_priv.registered_clients |= (1 << index); vgasr_priv.registered_clients |= (1 << index);
...@@ -230,9 +232,8 @@ static int vga_switchto_stage1(struct vga_switcheroo_client *new_client) ...@@ -230,9 +232,8 @@ static int vga_switchto_stage1(struct vga_switcheroo_client *new_client)
if (new_client->pwr_state == VGA_SWITCHEROO_OFF) if (new_client->pwr_state == VGA_SWITCHEROO_OFF)
vga_switchon(new_client); vga_switchon(new_client);
/* swap shadow resource to denote boot VGA device has changed so X starts on new device */ vga_set_default_device(new_client->pdev);
active->pdev->resource[PCI_ROM_RESOURCE].flags &= ~IORESOURCE_ROM_SHADOW;
new_client->pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment