aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/common
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-07-11 18:04:20 +0200
committermarha <marha@users.sourceforge.net>2014-07-11 18:04:20 +0200
commit3865d60ef607cbb00c819e905e40d3628b8eca29 (patch)
tree73d8064951a7abbe4897bcc25959463d08544495 /xorg-server/hw/xfree86/common
parent294a395f15dec9e7aa24b83b08f47ba54b9bd232 (diff)
parente708bebcc029873004ade4241f347ce8c58896af (diff)
downloadvcxsrv-3865d60ef607cbb00c819e905e40d3628b8eca29.tar.gz
vcxsrv-3865d60ef607cbb00c819e905e40d3628b8eca29.tar.bz2
vcxsrv-3865d60ef607cbb00c819e905e40d3628b8eca29.zip
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'xorg-server/hw/xfree86/common')
-rw-r--r--xorg-server/hw/xfree86/common/xf86AutoConfig.c2
-rw-r--r--xorg-server/hw/xfree86/common/xf86pciBus.c24
-rw-r--r--xorg-server/hw/xfree86/common/xf86pciBus.h5
-rw-r--r--xorg-server/hw/xfree86/common/xf86platformBus.c85
4 files changed, 94 insertions, 22 deletions
diff --git a/xorg-server/hw/xfree86/common/xf86AutoConfig.c b/xorg-server/hw/xfree86/common/xf86AutoConfig.c
index 4eb86de22..2b53b908a 100644
--- a/xorg-server/hw/xfree86/common/xf86AutoConfig.c
+++ b/xorg-server/hw/xfree86/common/xf86AutoConfig.c
@@ -265,7 +265,7 @@ listPossibleVideoDrivers(char *matches[], int nmatches)
#endif
#ifdef XSERVER_LIBPCIACCESS
if (i < (nmatches - 1))
- i = xf86PciMatchDriver(matches, nmatches);
+ i += xf86PciMatchDriver(&matches[i], nmatches - i);
#endif
#if defined(__linux__)
diff --git a/xorg-server/hw/xfree86/common/xf86pciBus.c b/xorg-server/hw/xfree86/common/xf86pciBus.c
index 0f76a03ee..c06b04033 100644
--- a/xorg-server/hw/xfree86/common/xf86pciBus.c
+++ b/xorg-server/hw/xfree86/common/xf86pciBus.c
@@ -1320,8 +1320,9 @@ xchomp(char *line)
* 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 */
-void
-xf86MatchDriverFromFiles(char **matches, uint16_t match_vendor, uint16_t match_chip)
+int
+xf86MatchDriverFromFiles(uint16_t match_vendor, uint16_t match_chip,
+ char *matches[], int nmatches)
{
DIR *idsdir;
FILE *fp;
@@ -1331,11 +1332,11 @@ xf86MatchDriverFromFiles(char **matches, uint16_t match_vendor, uint16_t match_c
ssize_t read;
char path_name[256], vendor_str[5], chip_str[5];
uint16_t vendor, chip;
- int i, j;
+ int i = 0, j;
idsdir = opendir(PCI_TXT_IDS_PATH);
if (!idsdir)
- return;
+ return 0;
xf86Msg(X_INFO,
"Scanning %s directory for additional PCI ID's supported by the drivers\n",
@@ -1386,10 +1387,6 @@ xf86MatchDriverFromFiles(char **matches, uint16_t match_vendor, uint16_t match_c
}
}
if (vendor == match_vendor && chip == match_chip) {
- i = 0;
- while (matches[i]) {
- i++;
- }
matches[i] =
(char *) malloc(sizeof(char) *
strlen(direntry->d_name) - 3);
@@ -1412,6 +1409,7 @@ xf86MatchDriverFromFiles(char **matches, uint16_t match_vendor, uint16_t match_c
}
xf86Msg(X_INFO, "Matched %s from file name %s\n",
matches[i], direntry->d_name);
+ i++;
}
}
else {
@@ -1425,6 +1423,7 @@ xf86MatchDriverFromFiles(char **matches, uint16_t match_vendor, uint16_t match_c
end:
free(line);
closedir(idsdir);
+ return i;
}
#endif /* __linux__ */
@@ -1435,7 +1434,7 @@ xf86MatchDriverFromFiles(char **matches, uint16_t match_vendor, uint16_t match_c
int
xf86PciMatchDriver(char *matches[], int nmatches)
{
- int i;
+ int i = 0;
struct pci_device *info = NULL;
struct pci_device_iterator *iter;
@@ -1450,13 +1449,10 @@ xf86PciMatchDriver(char *matches[], int nmatches)
pci_iterator_destroy(iter);
#ifdef __linux__
if (info)
- xf86MatchDriverFromFiles(matches, info->vendor_id, info->device_id);
+ i += xf86MatchDriverFromFiles(info->vendor_id, info->device_id,
+ matches, nmatches);
#endif
- for (i = 0; (i < nmatches) && (matches[i]); i++) {
- /* find end of matches list */
- }
-
if ((info != NULL) && (i < nmatches)) {
i += xf86VideoPtrToDriverList(info, &(matches[i]), nmatches - i);
}
diff --git a/xorg-server/hw/xfree86/common/xf86pciBus.h b/xorg-server/hw/xfree86/common/xf86pciBus.h
index b497a7f2d..45b5a0fee 100644
--- a/xorg-server/hw/xfree86/common/xf86pciBus.h
+++ b/xorg-server/hw/xfree86/common/xf86pciBus.h
@@ -47,8 +47,9 @@ void xf86PciConfigureNewDev(void *busData, struct pci_device *pVideo,
((x)->func == (y)->func) && \
((x)->dev == (y)->dev))
-void
-xf86MatchDriverFromFiles(char **matches, uint16_t match_vendor, uint16_t match_chip);
+int
+xf86MatchDriverFromFiles(uint16_t match_vendor, uint16_t match_chip,
+ char *matches[], int nmatches);
int
xf86VideoPtrToDriverList(struct pci_device *dev,
char *returnList[], int returnListMax);
diff --git a/xorg-server/hw/xfree86/common/xf86platformBus.c b/xorg-server/hw/xfree86/common/xf86platformBus.c
index dd118a285..eb1a3fb5d 100644
--- a/xorg-server/hw/xfree86/common/xf86platformBus.c
+++ b/xorg-server/hw/xfree86/common/xf86platformBus.c
@@ -47,6 +47,7 @@
#include "xf86Bus.h"
#include "Pci.h"
#include "xf86platformBus.h"
+#include "xf86Config.h"
#include "randrstr.h"
int platformSlotClaimed;
@@ -199,6 +200,81 @@ xf86_check_platform_slot(const struct xf86_platform_device *pd)
return TRUE;
}
+static Bool
+MatchToken(const char *value, struct xorg_list *patterns,
+ int (*compare)(const char *, const char *))
+{
+ const xf86MatchGroup *group;
+
+ /* If there are no patterns, accept the match */
+ if (xorg_list_is_empty(patterns))
+ return TRUE;
+
+ /* If there are patterns but no attribute, reject the match */
+ if (!value)
+ return FALSE;
+
+ /*
+ * Otherwise, iterate the list of patterns ensuring each entry has a
+ * match. Each list entry is a separate Match line of the same type.
+ */
+ xorg_list_for_each_entry(group, patterns, entry) {
+ Bool match = FALSE;
+ char *const *cur;
+
+ for (cur = group->values; *cur; cur++) {
+ if ((*compare)(value, *cur) == 0) {
+ match = TRUE;
+ break;
+ }
+ }
+
+ if (!match)
+ return FALSE;
+ }
+
+ /* All the entries in the list matched the attribute */
+ return TRUE;
+}
+
+static Bool
+OutputClassMatches(const XF86ConfOutputClassPtr oclass, int index)
+{
+ char *driver = xf86_get_platform_attrib(index, ODEV_ATTRIB_DRIVER);
+
+ if (!MatchToken(driver, &oclass->match_driver, strcmp))
+ return FALSE;
+
+ return TRUE;
+}
+
+static int
+xf86OutputClassDriverList(int index, char *matches[], int nmatches)
+{
+ XF86ConfOutputClassPtr cl;
+ int i = 0;
+
+ if (nmatches == 0)
+ return 0;
+
+ for (cl = xf86configptr->conf_outputclass_lst; cl; cl = cl->list.next) {
+ if (OutputClassMatches(cl, index)) {
+ char *path = xf86_get_platform_attrib(index, ODEV_ATTRIB_PATH);
+
+ xf86Msg(X_INFO, "Applying OutputClass \"%s\" to %s\n",
+ cl->identifier, path);
+ xf86Msg(X_NONE, "\tloading driver: %s\n", cl->driver);
+
+ matches[i++] = xstrdup(cl->driver);
+ }
+
+ if (i >= nmatches)
+ break;
+ }
+
+ return i;
+}
+
/**
* @return The numbers of found devices that match with the current system
* drivers.
@@ -218,16 +294,15 @@ xf86PlatformMatchDriver(char *matches[], int nmatches)
else if (!xf86IsPrimaryPlatform(&xf86_platform_devices[i]) && (pass == 0))
continue;
+ j += xf86OutputClassDriverList(i, &matches[j], nmatches - j);
+
info = xf86_platform_devices[i].pdev;
#ifdef __linux__
if (info)
- xf86MatchDriverFromFiles(matches, info->vendor_id, info->device_id);
+ j += xf86MatchDriverFromFiles(info->vendor_id, info->device_id,
+ &matches[j], nmatches - j);
#endif
- for (j = 0; (j < nmatches) && (matches[j]); j++) {
- /* find end of matches list */
- }
-
if ((info != NULL) && (j < nmatches)) {
j += xf86VideoPtrToDriverList(info, &(matches[j]), nmatches - j);
}