xserver: Branch 'master' - 6 commits

David Nusinow gravity at kemper.freedesktop.org
Thu Oct 11 19:33:20 PDT 2007


 hw/xfree86/common/xf86AutoConfig.c |   70 +++++++++++++++++++------------------
 hw/xfree86/parser/Configint.h      |    4 --
 hw/xfree86/parser/Device.c         |   20 ----------
 hw/xfree86/parser/read.c           |    2 -
 4 files changed, 37 insertions(+), 59 deletions(-)

New commits:
diff-tree eaf0e2a21c2cb14e19852e61a4521b3c240253af (from a5089af726b6a4f833b95a31274743c994277e20)
Author: David Nusinow <dnusinow at debian.org>
Date:   Thu Oct 11 22:31:24 2007 -0400

    Fix another compiler warning

diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c
index 2b44e6d..a6bfc01 100644
--- a/hw/xfree86/common/xf86AutoConfig.c
+++ b/hw/xfree86/common/xf86AutoConfig.c
@@ -384,8 +384,7 @@ matchDriverFromFiles (char** matches, ui
                                     chip = (int)strtol(chip_str, NULL, 16);
                                 }
                         }
-                        if (vendor == match_vendor && 
-                               (chip == match_chip || chip == -1)) {
+                        if (vendor == match_vendor && chip == match_chip ) {
                             i = 0;
                             while (matches[i]) {
                                 i++;
diff-tree a5089af726b6a4f833b95a31274743c994277e20 (from cdf29ff45a3cb45573c9d0cb8f82e6ee97953fb5)
Author: David Nusinow <dnusinow at debian.org>
Date:   Thu Oct 11 22:24:31 2007 -0400

    Fix a warning about the control logic in xchomp()

diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c
index 3630041..2b44e6d 100644
--- a/hw/xfree86/common/xf86AutoConfig.c
+++ b/hw/xfree86/common/xf86AutoConfig.c
@@ -284,8 +284,8 @@ xchomp(char *line)
     len = strlen(line);
     if (line[len - 1] == '\n' && len > 0) {
         line[len - 1] = '\0';
-        return 0;
     }
+    return 0;
 }
 
 GDevPtr
diff-tree cdf29ff45a3cb45573c9d0cb8f82e6ee97953fb5 (from 3367091f7fa14497aab40e668cad179e244eef81)
Author: David Nusinow <dnusinow at debian.org>
Date:   Thu Oct 11 22:23:34 2007 -0400

    Remove some unused variables

diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c
index 1f48b17..3630041 100644
--- a/hw/xfree86/common/xf86AutoConfig.c
+++ b/hw/xfree86/common/xf86AutoConfig.c
@@ -215,8 +215,6 @@ xf86AutoConfig(void)
 {
     const char **p;
     char buf[1024];
-    struct pci_device_iterator *iter;
-    struct pci_device * info = NULL;
     const char *driver = NULL;
     ConfigStatus ret;
 
@@ -294,7 +292,6 @@ GDevPtr
 autoConfigDevice(GDevPtr preconf_device)
 {
     GDevPtr ptr = NULL;
-    confScreenPtr scrn = NULL;
 
     if (!xf86configptr) {
         return NULL;
diff-tree 3367091f7fa14497aab40e668cad179e244eef81 (from 3aa41bcb8215c037512ddbd68a3f7bcad3b80a1f)
Author: David Nusinow <dnusinow at debian.org>
Date:   Thu Oct 11 22:21:38 2007 -0400

    Separate choosing driver from the file-based implementation
    
    This clears the implementation out of the way to prepare for development
    of a symbol-based resolution scheme

diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c
index 797334e..1f48b17 100644
--- a/hw/xfree86/common/xf86AutoConfig.c
+++ b/hw/xfree86/common/xf86AutoConfig.c
@@ -332,41 +332,20 @@ autoConfigDevice(GDevPtr preconf_device)
     return ptr;
 }
 
-char*
-chooseVideoDriver(void)
+static void
+matchDriverFromFiles (char** matches, uint16_t match_vendor, uint16_t match_chip)
 {
-    struct pci_device * info = NULL;
-    struct pci_device_iterator *iter;
     DIR *idsdir;
     FILE *fp;
     struct dirent *direntry;
     char *line = NULL;
-    char *chosen_driver = NULL;
     size_t len;
     ssize_t read;
     char path_name[256], vendor_str[5], chip_str[5];
     uint16_t vendor, chip;
     int i, j;
-    char *matches[20]; /* If we have more than 20 drivers we're in trouble */
-    
-    for (i=0 ; i<20 ; i++)
-        matches[i] = NULL;
-
-    /* Find the primary device, and get some information about it. */
-    iter = pci_slot_match_iterator_create(NULL);
-    while ((info = pci_device_next(iter)) != NULL) {
-	if (xf86IsPrimaryPci(info)) {
-	    break;
-	}
-    }
-
-    pci_iterator_destroy(iter);
-
-    if (!info) {
-	ErrorF("Primary device is not PCI\n");
-    }
-
     idsdir = opendir("/usr/share/xserver-xorg/pci");
+
     if (idsdir) {
         direntry = readdir(idsdir);
         /* Read the directory */
@@ -408,8 +387,8 @@ chooseVideoDriver(void)
                                     chip = (int)strtol(chip_str, NULL, 16);
                                 }
                         }
-                        if (vendor == info->vendor_id && 
-                               (chip == info->device_id || chip == -1)) {
+                        if (vendor == match_vendor && 
+                               (chip == match_chip || chip == -1)) {
                             i = 0;
                             while (matches[i]) {
                                 i++;
@@ -442,6 +421,38 @@ chooseVideoDriver(void)
             direntry = readdir(idsdir);
         }
     }
+    end:
+    xfree(line);
+    closedir(idsdir);
+}
+
+char*
+chooseVideoDriver(void)
+{
+    struct pci_device * info = NULL;
+    struct pci_device_iterator *iter;
+    char *chosen_driver = NULL;
+    int i;
+    char *matches[20]; /* If we have more than 20 drivers we're in trouble */
+    
+    for (i=0 ; i<20 ; i++)
+        matches[i] = NULL;
+
+    /* Find the primary device, and get some information about it. */
+    iter = pci_slot_match_iterator_create(NULL);
+    while ((info = pci_device_next(iter)) != NULL) {
+	if (xf86IsPrimaryPci(info)) {
+	    break;
+	}
+    }
+
+    pci_iterator_destroy(iter);
+
+    if (!info) {
+	ErrorF("Primary device is not PCI\n");
+    }
+
+    matchDriverFromFiles(matches, info->vendor_id, info->device_id);
 
     /* TODO Handle multiple drivers claiming to support the same PCI ID */
     if (matches[0]) {
@@ -463,7 +474,6 @@ chooseVideoDriver(void)
 
     xf86Msg(X_DEFAULT, "Matched %s for the autoconfigured driver\n", chosen_driver);
 
-    end:
     i = 0;
     while (matches[i]) {
         if (matches[i] != chosen_driver) {
@@ -471,8 +481,6 @@ chooseVideoDriver(void)
         }
         i++;
     }
-    xfree(line);
-    closedir(idsdir);
 
     return chosen_driver;
 }
diff-tree 3aa41bcb8215c037512ddbd68a3f7bcad3b80a1f (from e3e12221111886c4063d2da5d70d3830c56d39e2)
Author: David Nusinow <dnusinow at debian.org>
Date:   Thu Oct 11 21:29:13 2007 -0400

    Remove obsolete error message define from parser

diff --git a/hw/xfree86/parser/Configint.h b/hw/xfree86/parser/Configint.h
index 1440cbb..4d5fbcf 100644
--- a/hw/xfree86/parser/Configint.h
+++ b/hw/xfree86/parser/Configint.h
@@ -186,8 +186,6 @@ else\
 "The Inactive keyword must be followed by a Device name in quotes."
 #define UNDEFINED_SCREEN_MSG \
 "Undefined Screen \"%s\" referenced by ServerLayout \"%s\"."
-#define UNDEFINED_MONITOR_MSG \
-"Undefined Monitor \"%s\" referenced by Screen \"%s\"."
 #define UNDEFINED_MODES_MSG \
 "Undefined Modes Section \"%s\" referenced by Monitor \"%s\"."
 #define UNDEFINED_DEVICE_MSG \
diff-tree e3e12221111886c4063d2da5d70d3830c56d39e2 (from 28ef7f59416677be380561709197b04df0479bef)
Author: David Nusinow <dnusinow at debian.org>
Date:   Thu Oct 11 21:27:07 2007 -0400

    Don't bother validating the Device section of the conf file
    
    All the previous tests can now be recovered from if not specified.

diff --git a/hw/xfree86/parser/Configint.h b/hw/xfree86/parser/Configint.h
index c20c195..1440cbb 100644
--- a/hw/xfree86/parser/Configint.h
+++ b/hw/xfree86/parser/Configint.h
@@ -204,8 +204,6 @@ else\
 "This section must have an Identifier line."
 #define ONLY_ONE_MSG \
 "This section must have only one of either %s line."
-#define UNDEFINED_DRIVER_MSG \
-"Device section \"%s\" must have a Driver line."
 #define UNDEFINED_INPUTDRIVER_MSG \
 "InputDevice section \"%s\" must have a Driver line."
 #define INVALID_GAMMA_MSG \
diff --git a/hw/xfree86/parser/Device.c b/hw/xfree86/parser/Device.c
index 6ad5601..216789f 100644
--- a/hw/xfree86/parser/Device.c
+++ b/hw/xfree86/parser/Device.c
@@ -357,26 +357,6 @@ xf86freeDeviceList (XF86ConfDevicePtr pt
 	}
 }
 
-int
-xf86validateDevice (XF86ConfigPtr p)
-{
-	XF86ConfDevicePtr device = p->conf_device_lst;
-
-	if (!device) {
-		xf86validationError ("At least one Device section is required.");
-		return (FALSE);
-	}
-
-	while (device) {
-		if (!device->dev_driver) {
-			xf86validationError (UNDEFINED_DRIVER_MSG, device->dev_identifier);
-			return (FALSE);
-		}
-	device = device->list.next;
-	}
-	return (TRUE);
-}
-
 XF86ConfDevicePtr
 xf86findDevice (const char *ident, XF86ConfDevicePtr p)
 {
diff --git a/hw/xfree86/parser/read.c b/hw/xfree86/parser/read.c
index 308ee03..430da0a 100644
--- a/hw/xfree86/parser/read.c
+++ b/hw/xfree86/parser/read.c
@@ -80,8 +80,6 @@ static xf86ConfigSymTabRec TopLevelTab[]
 static int
 xf86validateConfig (XF86ConfigPtr p)
 {
-	/*if (!xf86validateDevice (p))
-		return FALSE;*/
 	if (!xf86validateScreen (p))
 		return FALSE;
 	if (!xf86validateInput (p))


More information about the xorg-commit mailing list