[PATCH] libpciaccess/vgaarb: add function to get default vga device and it's decodes.

Stefan Dirsch sndirsch at suse.de
Wed Apr 20 14:22:29 UTC 2016


Reenable default device when shutting down VGA arbitration.
https://bugzilla.opensuse.org/show_bug.cgi?id=714677

Patch author: Egbert Eich <eich at freedesktop.org>

Signed-off-by: Egbert Eich <eich at freedesktop.org>
---
 src/common_vgaarb.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/common_vgaarb.c b/src/common_vgaarb.c
index 7a7d204..2c0686e 100644
--- a/src/common_vgaarb.c
+++ b/src/common_vgaarb.c
@@ -156,6 +156,11 @@ pci_device_vgaarb_fini(void)
 {
     if (!pci_sys)
         return;
+    if (pci_device_vgaarb_set_target(NULL) < 0 ||
+	pci_device_vgaarb_lock() < 0 ||
+	pci_device_vgaarb_unlock() < 0) {
+	fprintf(stderr, "VGA Arbitration: Cannot restore default device.\n");
+    }
 
     close(pci_sys->vgaarb_fd);
 }
@@ -334,6 +339,10 @@ pci_device_vgaarb_unlock(void)
 int pci_device_vgaarb_get_info(struct pci_device *dev, int *vga_count, int *rsrc_decodes)
 {
     *vga_count = pci_sys->vga_count;
+    if (!rsrc_decodes)
+        return 0;
+    if (!dev)
+        dev = pci_sys->vga_default_dev;
     if (!dev)
         return 0;
 
-- 
2.6.2



More information about the xorg-devel mailing list