xorg-x11-server/xorg-server-walk_drivers.diff

137 lines
4.0 KiB
Diff
Raw Normal View History

--- hw/xfree86/common/xf86AutoConfig.c
+++ hw/xfree86/common/xf86AutoConfig.c
@@ -541,22 +541,32 @@
static char*
chooseVideoDriver(void)
{
- char *chosen_driver = NULL;
- int i;
+ char *chosen_driver = NULL, *match_driver;
+ int i, len = 0;
char *matches[20]; /* If we have more than 20 drivers we're in trouble */
listPossibleVideoDrivers(matches, 20);
- /* TODO Handle multiple drivers claiming to support the same PCI ID */
- chosen_driver = matches[0];
+ for (i = 0; matches[i] ; i++) {
+ len += strlen(matches[i])+1;
+ }
+
+ chosen_driver = (char*)xalloc(len);
+ match_driver = chosen_driver;
+ for (i = 0; matches[i] ; i++) {
+ strcpy(match_driver, matches[i]);
+ match_driver += strlen(matches[i]);
+ if (matches[i+1]) {
+ strcat(chosen_driver, ",");
+ match_driver++;
+ }
+ }
xf86Msg(X_DEFAULT, "Matched %s for the autoconfigured driver\n",
chosen_driver);
for (i = 0; matches[i] ; i++) {
- if (matches[i] != chosen_driver) {
- xfree(matches[i]);
- }
+ xfree(matches[i]);
}
return chosen_driver;
--- hw/xfree86/common/xf86Config.c
+++ hw/xfree86/common/xf86Config.c
@@ -381,6 +381,7 @@
int count = 0;
int j;
char **modulearray;
+ char *screendriver, *screendriver_next;
screenLayoutPtr slp;
/*
@@ -400,8 +401,14 @@
*/
if (xf86ConfigLayout.screens) {
slp = xf86ConfigLayout.screens;
- while ((slp++)->screen) {
+ while (slp->screen) {
+ screendriver = slp->screen->device->driver;
+ while ((screendriver = strchr(screendriver,',')) != NULL) {
+ screendriver++;
+ count++;
+ }
count++;
+ slp++;
}
}
@@ -422,7 +429,16 @@
count = 0;
slp = xf86ConfigLayout.screens;
while (slp->screen) {
- modulearray[count] = slp->screen->device->driver;
+ screendriver = slp->screen->device->driver;
+ while ((screendriver_next = strchr(screendriver,',')) != NULL) {
+ int entry_len = screendriver_next - screendriver;
+ modulearray[count] = xnfalloc((entry_len+1)*sizeof(char));
+ strncpy(modulearray[count],screendriver,entry_len);
+ *(modulearray[count] + entry_len) = '\0';
+ screendriver = screendriver_next+1;
+ count++;
+ }
+ modulearray[count] = screendriver;
count++;
slp++;
}
--- hw/xfree86/common/xf86Helper.c
+++ hw/xfree86/common/xf86Helper.c
@@ -1459,6 +1459,7 @@
{
GDevPtr gdp, *pgdp = NULL;
confScreenPtr screensecptr;
+ char *screendriver, *screendriver_next;
int i,j;
if (sectlist)
@@ -1489,15 +1490,31 @@
*/
for (j=0; xf86ConfigLayout.screens[j].screen != NULL; j++) {
screensecptr = xf86ConfigLayout.screens[j].screen;
- if ((screensecptr->device->driver != NULL)
- && (xf86NameCmp( screensecptr->device->driver,drivername) == 0)
- && (! screensecptr->device->claimed)) {
- /*
- * we have a matching driver that wasn't claimed, yet
- */
- pgdp = xnfrealloc(pgdp, (i + 2) * sizeof(GDevPtr));
- pgdp[i++] = screensecptr->device;
+ screendriver = screensecptr->device->driver;
+ while(screendriver && (screendriver_next = strchr(screendriver,',')) != NULL) {
+ *screendriver_next = '\0';
+ if ((xf86NameCmp( screensecptr->device->driver,drivername) == 0)
+ && (! screensecptr->device->claimed)) {
+ /*
+ * we have a matching driver that wasn't claimed, yet
+ */
+ pgdp = xnfrealloc(pgdp, (i + 2) * sizeof(GDevPtr));
+ pgdp[i++] = screensecptr->device;
+ }
+ *screendriver_next = ',';
+ screendriver = screendriver_next+1;
}
+
+ if (screendriver
+ && (xf86NameCmp(screendriver,drivername) == 0)
+ && (! screensecptr->device->claimed)) {
+ /*
+ * we have a matching driver that wasn't claimed, yet
+ */
+ pgdp = xnfrealloc(pgdp, (i + 2) * sizeof(GDevPtr));
+ pgdp[i++] = screensecptr->device;
+ }
+
}
/* Then handle the inactive devices */