xserver: Branch 'master' - 3 commits

David Nusinow gravity at kemper.freedesktop.org
Sun Oct 21 20:52:07 PDT 2007


 configure.ac                       |    5 +++++
 hw/xfree86/common/Makefile.am      |    2 ++
 hw/xfree86/common/xf86AutoConfig.c |   19 ++++++++++++++-----
 3 files changed, 21 insertions(+), 5 deletions(-)

New commits:
commit be9b0e558d6172ef01ed880d47da897d2ceb25fa
Author: David Nusinow <dnusinow at debian.org>
Date:   Sun Oct 21 23:49:14 2007 -0400

    Add a note as to why the text file based PCI ID scheme is present at all

diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c
index efaf45f..29f1279 100644
--- a/hw/xfree86/common/xf86AutoConfig.c
+++ b/hw/xfree86/common/xf86AutoConfig.c
@@ -330,6 +330,10 @@ autoConfigDevice(GDevPtr preconf_device)
 }
 
 #ifdef __linux__
+/* This function is used to provide a workaround for binary drivers that
+ * don't export their PCI ID's properly. If distros don't end up using this
+ * feature it can and should be removed because the symbol-based resolution
+ * scheme should be the primary one */
 static void
 matchDriverFromFiles (char** matches, uint16_t match_vendor, uint16_t match_chip)
 {
commit b79b965bd9a96f79781e85c0428068caa1ba381b
Author: David Nusinow <dnusinow at debian.org>
Date:   Sun Oct 21 23:46:54 2007 -0400

    Fix compilation issue on FreeBSD (bug #12841)
    
    Hide getline call by checking for glibc. If not, use fgetln instead. Even
    though this section is now #ifdef'ed for linux only, this should help make
    it more portable if non-linux folks end up wanting it.

diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c
index 524e14e..efaf45f 100644
--- a/hw/xfree86/common/xf86AutoConfig.c
+++ b/hw/xfree86/common/xf86AutoConfig.c
@@ -366,7 +366,11 @@ matchDriverFromFiles (char** matches, uint16_t match_vendor, uint16_t match_chip
                     goto end;
                 }
                 /* Read the file */
+                #ifdef __GLIBC__
                 while ((read = getline(&line, &len, fp)) != -1) {
+                #else
+                while ((line = fgetln(fp, &len)) != (char *)NULL) {
+                #endif /* __GLIBC __ */
                     xchomp(line);
                     if (isdigit(line[0])) {
                         strncpy(vendor_str, line, 4);
commit 7f5e71fa7347fb4ec2657ccc453831c04a0f288d
Author: David Nusinow <dnusinow at debian.org>
Date:   Sun Oct 21 23:41:49 2007 -0400

    Make PCI text file directory configurable

diff --git a/configure.ac b/configure.ac
index e7d229c..c8b2b78 100644
--- a/configure.ac
+++ b/configure.ac
@@ -464,6 +464,10 @@ APPLE_APPLICATIONS_DIR="${bindir}/Applications"
 AC_ARG_WITH(apple-applications-dir,AS_HELP_STRING([--with-apple-applications-dir=PATH], [Path to the Applications directory (default: ${bindir}/Applications)]),
                                [ APPLE_APPLICATIONS_DIR="${withval}" ].
                                [ APPLE_APPLICATIONS_DIR="${bindir}/Applications" ])
+AC_ARG_WITH(pci-txt-ids-dir, AS_HELP_STRING([--with-pci-txt-ids-dir=PATH],
+[Path to pci id directory (default: ${datadir}/X11/pci)]),
+				[ PCI_TXT_IDS_DIR="$withval" ],
+				[ PCI_TXT_IDS_DIR="${datadir}/X11/pci" ])
 AC_ARG_ENABLE(builddocs,      AS_HELP_STRING([--enable-builddocs], [Build docs (default: disabled)]),
                                 [BUILDDOCS=$enableval],
                                 [BUILDDOCS=no])
@@ -1003,6 +1007,7 @@ fi
 
 AC_DEFINE_DIR(COMPILEDDEFAULTFONTPATH, FONTPATH, [Default font path])
 AC_DEFINE_DIR(RGB_DB, RGBPATH, [Default RGB path])
+AC_DEFINE_DIR(PCI_TXT_IDS_PATH, PCI_TXT_IDS_DIR, [Default PCI text file ID path])
 AC_DEFINE_DIR(SERVERCONFIGdir, SERVERCONFIG, [Server config path])
 AC_DEFINE_DIR(BASE_FONT_PATH, FONTDIR, [Default base font path])
 AC_DEFINE_DIR(DRI_DRIVER_PATH, DRI_DRIVER_PATH, [Default DRI driver path])
diff --git a/hw/xfree86/common/Makefile.am b/hw/xfree86/common/Makefile.am
index db726fe..05c088c 100644
--- a/hw/xfree86/common/Makefile.am
+++ b/hw/xfree86/common/Makefile.am
@@ -94,4 +94,6 @@ if LNXACPI
 XORG_CFLAGS += -DHAVE_ACPI
 endif
 
+XORG_CFLAGS += -DPCITXTIDSPATH=\"$(PCI_TXT_IDS_PATH)\"
+
 AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c
index 8117ace..524e14e 100644
--- a/hw/xfree86/common/xf86AutoConfig.c
+++ b/hw/xfree86/common/xf86AutoConfig.c
@@ -342,9 +342,10 @@ matchDriverFromFiles (char** matches, uint16_t match_vendor, uint16_t match_chip
     char path_name[256], vendor_str[5], chip_str[5];
     uint16_t vendor, chip;
     int i, j;
-    idsdir = opendir("/usr/share/xserver-xorg/pci");
 
+    idsdir = opendir(PCITXTIDSPATH);
     if (idsdir) {
+         xf86Msg(X_INFO, "Scanning %s directory for additional PCI ID's supported by the drivers\n", PCITXTIDSPATH);
         direntry = readdir(idsdir);
         /* Read the directory */
         while (direntry) {
@@ -356,8 +357,9 @@ matchDriverFromFiles (char** matches, uint16_t match_vendor, uint16_t match_chip
             /* A tiny bit of sanity checking. We should probably do better */
             if (strncmp(&(direntry->d_name[len-4]), ".ids", 4) == 0) {
                 /* We need the full path name to open the file */
-                strncpy(path_name, "/usr/share/xserver-xorg/pci/", 256);
-                strncat(path_name, direntry->d_name, (256 - strlen(path_name)));
+                strncpy(path_name, PCITXTIDSPATH, 256);
+                strncat(path_name, "/", 1);
+                strncat(path_name, direntry->d_name, (256 - strlen(path_name) - 1));
                 fp = fopen(path_name, "r");
                 if (fp == NULL) {
                     xf86Msg(X_ERROR, "Could not open %s for reading. Exiting.\n", path_name);
@@ -406,8 +408,7 @@ matchDriverFromFiles (char** matches, uint16_t match_vendor, uint16_t match_chip
                                     matches[i][j] = direntry->d_name[j];
                                 }
                             }
-                            xf86Msg(X_INFO, "Matched %s from file name %s in autoconfig\n", matches[i], direntry->d_name);
-
+                            xf86Msg(X_INFO, "Matched %s from file name %s\n", matches[i], direntry->d_name);
                         }
                     } else {
                         /* TODO Handle driver overrides here */


More information about the xorg-commit mailing list