File u_libpciaccess-vgaarb-add-function-to-get-default-vga-device-and-it.patch of Package libpciaccess

From: Egbert Eich <eich@freedesktop.org>
Author: Egbert Eich <eich@suse.de>
Date: Sun, 28 Aug 2011 19:53:02 +0200
Patch-Mainline: "To be upstreamed."
Subject: [PATCH] vgaarb: add function to get default vga device and it's decodes.

Signed-off-by: Egbert Eich <eich@freedesktop.org>
---
 src/common_vgaarb.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

Index: libpciaccess-0.13.1/src/common_vgaarb.c
===================================================================
--- libpciaccess-0.13.1.orig/src/common_vgaarb.c
+++ libpciaccess-0.13.1/src/common_vgaarb.c
@@ -153,7 +153,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);
 }
 
@@ -331,6 +335,11 @@ 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;
openSUSE Build Service is sponsored by