xfree86: Improved autoconfig drivers matching

Implementation of new drivers matching algorithm. New approach
doesn't add duplicate drivers and ease drivers matching phase.

Signed-off-by: Karol Kosik <kkosik@nvidia.com>
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
This commit is contained in:
Karol Kosik 2015-07-22 16:42:07 -07:00 committed by Adam Jackson
parent 1549e30372
commit 112d0d7d01
8 changed files with 153 additions and 118 deletions

View File

@ -58,7 +58,8 @@ sdk_HEADERS = compiler.h fourcc.h xf86.h xf86Module.h xf86Opt.h \
xf86PciInfo.h xf86Priv.h xf86Privstr.h \ xf86PciInfo.h xf86Priv.h xf86Privstr.h \
xf86cmap.h xf86fbman.h xf86str.h xf86Xinput.h xisb.h \ xf86cmap.h xf86fbman.h xf86str.h xf86Xinput.h xisb.h \
$(XVSDKINCS) $(XF86VMODE_SDK) $(DGA_SDK) xorgVersion.h \ $(XVSDKINCS) $(XF86VMODE_SDK) $(DGA_SDK) xorgVersion.h \
xf86sbusBus.h xf86VGAarbiter.h xf86Optionstr.h xf86platformBus.h \ xf86sbusBus.h xf86VGAarbiter.h xf86Optionstr.h \
xf86platformBus.h xf86MatchDrivers.h \
xaarop.h xaarop.h
DISTCLEANFILES = xf86Build.h DISTCLEANFILES = xf86Build.h

View File

@ -43,6 +43,7 @@ xorg_sdk_headers = [
'xf86VGAarbiter.h', 'xf86VGAarbiter.h',
'xf86Optionstr.h', 'xf86Optionstr.h',
'xf86platformBus.h', 'xf86platformBus.h',
'xf86MatchDrivers.h',
'xaarop.h', 'xaarop.h',
] ]

View File

@ -37,6 +37,7 @@
#include "xf86Parser.h" #include "xf86Parser.h"
#include "xf86tokens.h" #include "xf86tokens.h"
#include "xf86Config.h" #include "xf86Config.h"
#include "xf86MatchDrivers.h"
#include "xf86Priv.h" #include "xf86Priv.h"
#include "xf86_OSlib.h" #include "xf86_OSlib.h"
#include "xf86platformBus.h" #include "xf86platformBus.h"
@ -89,7 +90,7 @@
static const char **builtinConfig = NULL; static const char **builtinConfig = NULL;
static int builtinLines = 0; static int builtinLines = 0;
static void listPossibleVideoDrivers(char *matches[], int nmatches); static void listPossibleVideoDrivers(XF86MatchedDrivers *md);
/* /*
* A built-in config file is stored as an array of strings, with each string * A built-in config file is stored as an array of strings, with each string
@ -140,11 +141,33 @@ AppendToConfig(const char *s)
AppendToList(s, &builtinConfig, &builtinLines); AppendToList(s, &builtinConfig, &builtinLines);
} }
void
xf86AddMatchedDriver(XF86MatchedDrivers *md, const char *driver)
{
int j;
int nmatches = md->nmatches;
for (j = 0; j < nmatches; ++j) {
if (xf86NameCmp(md->matches[j], driver) == 0) {
// Driver already in matched drivers
return;
}
}
if (nmatches < MATCH_DRIVERS_LIMIT) {
md->matches[nmatches] = xnfstrdup(driver);
md->nmatches++;
}
else {
xf86Msg(X_WARNING, "Too many drivers registered, can't add %s\n", driver);
}
}
Bool Bool
xf86AutoConfig(void) xf86AutoConfig(void)
{ {
char *deviceList[20]; XF86MatchedDrivers md;
char **p; int i;
const char **cp; const char **cp;
char buf[1024]; char buf[1024];
ConfigStatus ret; ConfigStatus ret;
@ -158,24 +181,27 @@ xf86AutoConfig(void)
return FALSE; return FALSE;
} }
listPossibleVideoDrivers(deviceList, 20); listPossibleVideoDrivers(&md);
for (p = deviceList; *p; p++) { for (i = 0; i < md.nmatches; i++) {
snprintf(buf, sizeof(buf), BUILTIN_DEVICE_SECTION, *p, 0, *p); snprintf(buf, sizeof(buf), BUILTIN_DEVICE_SECTION,
md.matches[i], 0, md.matches[i]);
AppendToConfig(buf); AppendToConfig(buf);
snprintf(buf, sizeof(buf), BUILTIN_SCREEN_SECTION, *p, 0, *p, 0); snprintf(buf, sizeof(buf), BUILTIN_SCREEN_SECTION,
md.matches[i], 0, md.matches[i], 0);
AppendToConfig(buf); AppendToConfig(buf);
} }
AppendToConfig(BUILTIN_LAYOUT_SECTION_PRE); AppendToConfig(BUILTIN_LAYOUT_SECTION_PRE);
for (p = deviceList; *p; p++) { for (i = 0; i < md.nmatches; i++) {
snprintf(buf, sizeof(buf), BUILTIN_LAYOUT_SCREEN_LINE, *p, 0); snprintf(buf, sizeof(buf), BUILTIN_LAYOUT_SCREEN_LINE,
md.matches[i], 0);
AppendToConfig(buf); AppendToConfig(buf);
} }
AppendToConfig(BUILTIN_LAYOUT_SECTION_POST); AppendToConfig(BUILTIN_LAYOUT_SECTION_POST);
for (p = deviceList; *p; p++) { for (i = 0; i < md.nmatches; i++) {
free(*p); free(md.matches[i]);
} }
xf86MsgVerb(X_DEFAULT, 0, xf86MsgVerb(X_DEFAULT, 0,
@ -199,22 +225,17 @@ xf86AutoConfig(void)
} }
static void static void
listPossibleVideoDrivers(char *matches[], int nmatches) listPossibleVideoDrivers(XF86MatchedDrivers *md)
{ {
int i; md->nmatches = 0;
for (i = 0; i < nmatches; i++) {
matches[i] = NULL;
}
i = 0;
#ifdef XSERVER_PLATFORM_BUS #ifdef XSERVER_PLATFORM_BUS
i = xf86PlatformMatchDriver(matches, nmatches); xf86PlatformMatchDriver(md);
#endif #endif
#ifdef __sun #ifdef __sun
/* Check for driver type based on /dev/fb type and if valid, use /* Check for driver type based on /dev/fb type and if valid, use
it instead of PCI bus probe results */ it instead of PCI bus probe results */
if (xf86Info.consoleFd >= 0 && (i < (nmatches - 1))) { if (xf86Info.consoleFd >= 0) {
struct vis_identifier visid; struct vis_identifier visid;
const char *cp; const char *cp;
int iret; int iret;
@ -240,7 +261,7 @@ listPossibleVideoDrivers(char *matches[], int nmatches)
/* Special case from before the general case was set */ /* Special case from before the general case was set */
if (strcmp(visid.name, "NVDAnvda") == 0) { if (strcmp(visid.name, "NVDAnvda") == 0) {
matches[i++] = xnfstrdup("nvidia"); xf86AddMatchedDriver(md, "nvidia");
} }
/* General case - split into vendor name (initial all-caps /* General case - split into vendor name (initial all-caps
@ -250,55 +271,48 @@ listPossibleVideoDrivers(char *matches[], int nmatches)
/* find end of all uppercase vendor section */ /* find end of all uppercase vendor section */
} }
if ((cp != visid.name) && (*cp != '\0')) { if ((cp != visid.name) && (*cp != '\0')) {
char *driverName = xnfstrdup(cp);
char *vendorName = xnfstrdup(visid.name); char *vendorName = xnfstrdup(visid.name);
vendorName[cp - visid.name] = '\0'; vendorName[cp - visid.name] = '\0';
matches[i++] = vendorName; xf86AddMatchedDriver(md, vendorName);
matches[i++] = driverName; xf86AddMatchedDriver(md, cp);
free(vendorName);
} }
} }
} }
} }
#endif #endif
#ifdef __sparc__ #ifdef __sparc__
if (i < (nmatches - 1)) char *sbusDriver = sparcDriverName();
{
char *sbusDriver = sparcDriverName();
if (sbusDriver) if (sbusDriver)
matches[i++] = xnfstrdup(sbusDriver); xf86AddMatchedDriver(md, sbusDriver);
}
#endif #endif
#ifdef XSERVER_LIBPCIACCESS #ifdef XSERVER_LIBPCIACCESS
if (i < (nmatches - 1)) xf86PciMatchDriver(md);
i += xf86PciMatchDriver(&matches[i], nmatches - i);
#endif #endif
#if defined(__linux__) #if defined(__linux__)
matches[i++] = xnfstrdup("modesetting"); xf86AddMatchedDriver(md, "modesetting");
#endif #endif
#if !defined(__sun) #if !defined(__sun)
/* Fallback to platform default frame buffer driver */ /* Fallback to platform default frame buffer driver */
if (i < (nmatches - 1)) {
#if !defined(__linux__) && defined(__sparc__) #if !defined(__linux__) && defined(__sparc__)
matches[i++] = xnfstrdup("wsfb"); xf86AddMatchedDriver(md, "wsfb");
#else #else
matches[i++] = xnfstrdup("fbdev"); xf86AddMatchedDriver(md, "fbdev");
#endif #endif
}
#endif /* !__sun */ #endif /* !__sun */
/* Fallback to platform default hardware */ /* Fallback to platform default hardware */
if (i < (nmatches - 1)) {
#if defined(__i386__) || defined(__amd64__) || defined(__hurd__) #if defined(__i386__) || defined(__amd64__) || defined(__hurd__)
matches[i++] = xnfstrdup("vesa"); xf86AddMatchedDriver(md, "vesa");
#elif defined(__sparc__) && !defined(__sun) #elif defined(__sparc__) && !defined(__sun)
matches[i++] = xnfstrdup("sunffb"); xf86AddMatchedDriver(md, "sunffb");
#endif #endif
}
} }
/* copy a screen section and enter the desired driver /* copy a screen section and enter the desired driver
@ -344,8 +358,8 @@ GDevPtr
autoConfigDevice(GDevPtr preconf_device) autoConfigDevice(GDevPtr preconf_device)
{ {
GDevPtr ptr = NULL; GDevPtr ptr = NULL;
char *matches[20]; /* If we have more than 20 drivers we're in trouble */ XF86MatchedDrivers md;
int num_matches = 0, num_screens = 0, i; int num_screens = 0, i;
screenLayoutPtr slp; screenLayoutPtr slp;
if (!xf86configptr) { if (!xf86configptr) {
@ -372,10 +386,10 @@ autoConfigDevice(GDevPtr preconf_device)
} }
if (!ptr->driver) { if (!ptr->driver) {
/* get all possible video drivers and count them */ /* get all possible video drivers and count them */
listPossibleVideoDrivers(matches, 20); listPossibleVideoDrivers(&md);
for (; matches[num_matches]; num_matches++) { for (i = 0; i < md.nmatches; i++) {
xf86Msg(X_DEFAULT, "Matched %s as autoconfigured driver %d\n", xf86Msg(X_DEFAULT, "Matched %s as autoconfigured driver %d\n",
matches[num_matches], num_matches); md.matches[i], i);
} }
slp = xf86ConfigLayout.screens; slp = xf86ConfigLayout.screens;
@ -385,12 +399,12 @@ autoConfigDevice(GDevPtr preconf_device)
* minus one for the already existing first one * minus one for the already existing first one
* plus one for the terminating NULL */ * plus one for the terminating NULL */
for (; slp[num_screens].screen; num_screens++); for (; slp[num_screens].screen; num_screens++);
xf86ConfigLayout.screens = xnfcalloc(num_screens + num_matches, xf86ConfigLayout.screens = xnfcalloc(num_screens + md.nmatches,
sizeof(screenLayoutRec)); sizeof(screenLayoutRec));
xf86ConfigLayout.screens[0] = slp[0]; xf86ConfigLayout.screens[0] = slp[0];
/* do the first match and set that for the original first screen */ /* do the first match and set that for the original first screen */
ptr->driver = matches[0]; ptr->driver = md.matches[0];
if (!xf86ConfigLayout.screens[0].screen->device) { if (!xf86ConfigLayout.screens[0].screen->device) {
xf86ConfigLayout.screens[0].screen->device = ptr; xf86ConfigLayout.screens[0].screen->device = ptr;
ptr->myScreenSection = xf86ConfigLayout.screens[0].screen; ptr->myScreenSection = xf86ConfigLayout.screens[0].screen;
@ -398,8 +412,8 @@ autoConfigDevice(GDevPtr preconf_device)
/* for each other driver found, copy the first screen, insert it /* for each other driver found, copy the first screen, insert it
* into the list of screens and set the driver */ * into the list of screens and set the driver */
for (i = 1; i < num_matches; i++) { while (i++ < md.nmatches) {
if (!copyScreen(slp[0].screen, ptr, i, matches[i])) if (!copyScreen(slp[0].screen, ptr, i, md.matches[i]))
return NULL; return NULL;
} }
@ -408,19 +422,17 @@ autoConfigDevice(GDevPtr preconf_device)
* *
* TODO Handle rest of multiple screen sections */ * TODO Handle rest of multiple screen sections */
for (i = 1; i < num_screens; i++) { for (i = 1; i < num_screens; i++) {
xf86ConfigLayout.screens[i + num_matches] = slp[i]; xf86ConfigLayout.screens[i + md.nmatches] = slp[i];
} }
xf86ConfigLayout.screens[num_screens + num_matches - 1].screen = xf86ConfigLayout.screens[num_screens + md.nmatches - 1].screen =
NULL; NULL;
free(slp); free(slp);
} }
else { else {
/* layout does not have any screens, not much to do */ /* layout does not have any screens, not much to do */
ptr->driver = matches[0]; ptr->driver = md.matches[0];
for (i = 1; matches[i]; i++) { for (i = 1; i < md.nmatches; i++) {
if (matches[i] != matches[0]) { free(md.matches[i]);
free(matches[i]);
}
} }
} }
} }

View File

@ -0,0 +1,40 @@
/*
* Copyright © 2015 NVIDIA Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifndef _xf86_match_drivers_h
#define _xf86_match_drivers_h
#define MATCH_DRIVERS_LIMIT 20
typedef struct _XF86MatchedDrivers {
char *matches[MATCH_DRIVERS_LIMIT];
int nmatches;
} XF86MatchedDrivers;
/*
* prototypes
*/
void xf86AddMatchedDriver(XF86MatchedDrivers *, const char *);
#endif /* _xf86_match_drivers_h */

View File

@ -1063,9 +1063,8 @@ xf86ConfigPciEntity(ScrnInfoPtr pScrn, int scrnFlag, int entityIndex,
return pScrn; return pScrn;
} }
int void
xf86VideoPtrToDriverList(struct pci_device *dev, xf86VideoPtrToDriverList(struct pci_device *dev, XF86MatchedDrivers *md)
char *returnList[], int returnListMax)
{ {
int i; int i;
@ -1268,10 +1267,9 @@ xf86VideoPtrToDriverList(struct pci_device *dev,
default: default:
break; break;
} }
for (i = 0; (i < returnListMax) && (driverList[i] != NULL); i++) { for (i = 0; driverList[i] != NULL; i++) {
returnList[i] = xnfstrdup(driverList[i]); xf86AddMatchedDriver(md, driverList[i]);
} }
return i; /* Number of entries added */
} }
#ifdef __linux__ #ifdef __linux__
@ -1295,23 +1293,23 @@ xchomp(char *line)
* don't export their PCI ID's properly. If distros don't end up using this * 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 * feature it can and should be removed because the symbol-based resolution
* scheme should be the primary one */ * scheme should be the primary one */
int void
xf86MatchDriverFromFiles(uint16_t match_vendor, uint16_t match_chip, xf86MatchDriverFromFiles(uint16_t match_vendor, uint16_t match_chip,
char *matches[], int nmatches) XF86MatchedDrivers *md)
{ {
DIR *idsdir; DIR *idsdir;
FILE *fp; FILE *fp;
struct dirent *direntry; struct dirent *direntry;
char *line = NULL; char *line = NULL, *tmpMatch;
size_t len; size_t len;
ssize_t read; ssize_t read;
char path_name[256], vendor_str[5], chip_str[5]; char path_name[256], vendor_str[5], chip_str[5];
uint16_t vendor, chip; uint16_t vendor, chip;
int i = 0, j; int j;
idsdir = opendir(PCI_TXT_IDS_PATH); idsdir = opendir(PCI_TXT_IDS_PATH);
if (!idsdir) if (!idsdir)
return 0; return;
xf86Msg(X_INFO, xf86Msg(X_INFO,
"Scanning %s directory for additional PCI ID's supported by the drivers\n", "Scanning %s directory for additional PCI ID's supported by the drivers\n",
@ -1362,10 +1360,10 @@ xf86MatchDriverFromFiles(uint16_t match_vendor, uint16_t match_chip,
} }
} }
if (vendor == match_vendor && chip == match_chip) { if (vendor == match_vendor && chip == match_chip) {
matches[i] = tmpMatch =
(char *) malloc(sizeof(char) * (char *) malloc(sizeof(char) *
strlen(direntry->d_name) - 3); strlen(direntry->d_name) - 3);
if (!matches[i]) { if (!tmpMatch) {
xf86Msg(X_ERROR, xf86Msg(X_ERROR,
"Could not allocate space for the module name. Exiting.\n"); "Could not allocate space for the module name. Exiting.\n");
goto end; goto end;
@ -1375,16 +1373,17 @@ xf86MatchDriverFromFiles(uint16_t match_vendor, uint16_t match_chip,
* taking off anything after the first '.' */ * taking off anything after the first '.' */
for (j = 0; j < (strlen(direntry->d_name) - 3); j++) { for (j = 0; j < (strlen(direntry->d_name) - 3); j++) {
if (direntry->d_name[j] == '.') { if (direntry->d_name[j] == '.') {
matches[i][j] = '\0'; tmpMatch[j] = '\0';
break; break;
} }
else { else {
matches[i][j] = direntry->d_name[j]; tmpMatch[j] = direntry->d_name[j];
} }
} }
xf86AddMatchedDriver(md, tmpMatch);
xf86Msg(X_INFO, "Matched %s from file name %s\n", xf86Msg(X_INFO, "Matched %s from file name %s\n",
matches[i], direntry->d_name); tmpMatch, direntry->d_name);
i++; free(tmpMatch);
} }
} }
else { else {
@ -1398,18 +1397,12 @@ xf86MatchDriverFromFiles(uint16_t match_vendor, uint16_t match_chip,
end: end:
free(line); free(line);
closedir(idsdir); closedir(idsdir);
return i;
} }
#endif /* __linux__ */ #endif /* __linux__ */
/** void
* @return The numbers of found devices that match with the current system xf86PciMatchDriver(XF86MatchedDrivers *md)
* drivers.
*/
int
xf86PciMatchDriver(char *matches[], int nmatches)
{ {
int i = 0;
struct pci_device *info = NULL; struct pci_device *info = NULL;
struct pci_device_iterator *iter; struct pci_device_iterator *iter;
@ -1424,15 +1417,12 @@ xf86PciMatchDriver(char *matches[], int nmatches)
pci_iterator_destroy(iter); pci_iterator_destroy(iter);
#ifdef __linux__ #ifdef __linux__
if (info) if (info)
i += xf86MatchDriverFromFiles(info->vendor_id, info->device_id, xf86MatchDriverFromFiles(info->vendor_id, info->device_id, md);
matches, nmatches);
#endif #endif
if ((info != NULL) && (i < nmatches)) { if (info != NULL) {
i += xf86VideoPtrToDriverList(info, &(matches[i]), nmatches - i); xf86VideoPtrToDriverList(info, md);
} }
return i;
} }
Bool Bool

View File

@ -33,11 +33,13 @@
#ifndef _XF86_PCI_BUS_H #ifndef _XF86_PCI_BUS_H
#define _XF86_PCI_BUS_H #define _XF86_PCI_BUS_H
#include "xf86MatchDrivers.h"
void xf86PciProbe(void); void xf86PciProbe(void);
Bool xf86PciAddMatchingDev(DriverPtr drvp); Bool xf86PciAddMatchingDev(DriverPtr drvp);
Bool xf86PciProbeDev(DriverPtr drvp); Bool xf86PciProbeDev(DriverPtr drvp);
void xf86PciIsolateDevice(const char *argument); void xf86PciIsolateDevice(const char *argument);
int xf86PciMatchDriver(char *matches[], int nmatches); void xf86PciMatchDriver(XF86MatchedDrivers *md);
Bool xf86PciConfigure(void *busData, struct pci_device *pDev); Bool xf86PciConfigure(void *busData, struct pci_device *pDev);
void xf86PciConfigureNewDev(void *busData, struct pci_device *pVideo, void xf86PciConfigureNewDev(void *busData, struct pci_device *pVideo,
GDevRec * GDev, int *chipset); GDevRec * GDev, int *chipset);
@ -47,10 +49,9 @@ void xf86PciConfigureNewDev(void *busData, struct pci_device *pVideo,
((x)->func == (y)->func) && \ ((x)->func == (y)->func) && \
((x)->dev == (y)->dev)) ((x)->dev == (y)->dev))
int void
xf86MatchDriverFromFiles(uint16_t match_vendor, uint16_t match_chip, xf86MatchDriverFromFiles(uint16_t match_vendor, uint16_t match_chip,
char *matches[], int nmatches); XF86MatchedDrivers *md);
int void
xf86VideoPtrToDriverList(struct pci_device *dev, xf86VideoPtrToDriverList(struct pci_device *dev, XF86MatchedDrivers *md);
char *returnList[], int returnListMax);
#endif /* _XF86_PCI_BUS_H */ #endif /* _XF86_PCI_BUS_H */

View File

@ -219,14 +219,10 @@ OutputClassMatches(const XF86ConfOutputClassPtr oclass,
return TRUE; return TRUE;
} }
static int static void
xf86OutputClassDriverList(int index, char *matches[], int nmatches) xf86OutputClassDriverList(int index, XF86MatchedDrivers *md)
{ {
XF86ConfOutputClassPtr cl; XF86ConfOutputClassPtr cl;
int i = 0;
if (nmatches == 0)
return 0;
for (cl = xf86configptr->conf_outputclass_lst; cl; cl = cl->list.next) { for (cl = xf86configptr->conf_outputclass_lst; cl; cl = cl->list.next) {
if (OutputClassMatches(cl, &xf86_platform_devices[index])) { if (OutputClassMatches(cl, &xf86_platform_devices[index])) {
@ -236,24 +232,19 @@ xf86OutputClassDriverList(int index, char *matches[], int nmatches)
cl->identifier, path); cl->identifier, path);
xf86Msg(X_NONE, "\tloading driver: %s\n", cl->driver); xf86Msg(X_NONE, "\tloading driver: %s\n", cl->driver);
matches[i++] = xstrdup(cl->driver); xf86AddMatchedDriver(md, cl->driver);
} }
if (i >= nmatches)
break;
} }
return i;
} }
/** /**
* @return The numbers of found devices that match with the current system * @return The numbers of found devices that match with the current system
* drivers. * drivers.
*/ */
int void
xf86PlatformMatchDriver(char *matches[], int nmatches) xf86PlatformMatchDriver(XF86MatchedDrivers *md)
{ {
int i, j = 0; int i;
struct pci_device *info = NULL; struct pci_device *info = NULL;
int pass = 0; int pass = 0;
@ -265,21 +256,19 @@ xf86PlatformMatchDriver(char *matches[], int nmatches)
else if (!xf86IsPrimaryPlatform(&xf86_platform_devices[i]) && (pass == 0)) else if (!xf86IsPrimaryPlatform(&xf86_platform_devices[i]) && (pass == 0))
continue; continue;
j += xf86OutputClassDriverList(i, &matches[j], nmatches - j); xf86OutputClassDriverList(i, md);
info = xf86_platform_devices[i].pdev; info = xf86_platform_devices[i].pdev;
#ifdef __linux__ #ifdef __linux__
if (info) if (info)
j += xf86MatchDriverFromFiles(info->vendor_id, info->device_id, xf86MatchDriverFromFiles(info->vendor_id, info->device_id, md);
&matches[j], nmatches - j);
#endif #endif
if ((info != NULL) && (j < nmatches)) { if (info != NULL) {
j += xf86VideoPtrToDriverList(info, &(matches[j]), nmatches - j); xf86VideoPtrToDriverList(info, md);
} }
} }
} }
return j;
} }
int int

View File

@ -25,6 +25,7 @@
#define XF86_PLATFORM_BUS_H #define XF86_PLATFORM_BUS_H
#include "hotplug.h" #include "hotplug.h"
#include "xf86MatchDrivers.h"
struct xf86_platform_device { struct xf86_platform_device {
struct OdevAttributes *attribs; struct OdevAttributes *attribs;
@ -153,8 +154,8 @@ _xf86_get_platform_device_int_attrib(struct xf86_platform_device *device, int at
extern _X_EXPORT Bool extern _X_EXPORT Bool
xf86PlatformDeviceCheckBusID(struct xf86_platform_device *device, const char *busid); xf86PlatformDeviceCheckBusID(struct xf86_platform_device *device, const char *busid);
extern _X_EXPORT int extern _X_EXPORT void
xf86PlatformMatchDriver(char *matches[], int nmatches); xf86PlatformMatchDriver(XF86MatchedDrivers *);
extern void xf86platformVTProbe(void); extern void xf86platformVTProbe(void);
extern void xf86platformPrimary(void); extern void xf86platformPrimary(void);