From 61bd29bfd3a5ae49a35c3e2eadbf2f8022056e82244ac6feb94928fdf72d43ee Mon Sep 17 00:00:00 2001 From: Stefan Dirsch Date: Wed, 24 Mar 2010 01:56:12 +0000 Subject: [PATCH] Accepting request 35601 from home:oertel:branches:openSUSE:Factory Copy from home:oertel:branches:openSUSE:Factory/xorg-x11-server via accept of submit request 35601 revision 20. Request was accepted with message: reviewed ok. OBS-URL: https://build.opensuse.org/request/show/35601 OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/xorg-x11-server?expand=0&rev=232 --- xorg-server-walk_drivers.diff | 205 ++++++++++++++-------------------- xorg-x11-server.changes | 7 ++ 2 files changed, 90 insertions(+), 122 deletions(-) diff --git a/xorg-server-walk_drivers.diff b/xorg-server-walk_drivers.diff index e602a6a..ba78d97 100644 --- a/xorg-server-walk_drivers.diff +++ b/xorg-server-walk_drivers.diff @@ -1,136 +1,97 @@ --- hw/xfree86/common/xf86AutoConfig.c +++ hw/xfree86/common/xf86AutoConfig.c -@@ -541,22 +541,32 @@ - static char* - chooseVideoDriver(void) - { +@@ -539,34 +541,13 @@ + } + } + +-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); - +- 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++) { +- +- 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 @@ +- } +- +- return chosen_driver; +-} +- + GDevPtr + autoConfigDevice(GDevPtr preconf_device) { - GDevPtr gdp, *pgdp = NULL; - confScreenPtr screensecptr; -+ char *screendriver, *screendriver_next; - int i,j; +- GDevPtr ptr = NULL; ++ GDevPtr ptr = NULL, cptr = NULL; ++ char *matches[20]; /* If we have more than 20 drivers we're in trouble */ ++ int num_matches = 0, num_screens = 0, i; ++ screenLayoutPtr slp; - 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; + if (!xf86configptr) { + return NULL; +@@ -589,14 +571,49 @@ + ptr->driver = NULL; + } + if (!ptr->driver) { +- ptr->driver = chooseVideoDriver(); ++ listPossibleVideoDrivers(matches, 20); ++ for (; matches[num_matches] ; num_matches++); ++ slp = xf86ConfigLayout.screens; ++ if (slp) { ++ for (; slp[num_screens].screen ; num_screens++); ++ xf86ConfigLayout.screens = xnfcalloc(1,(num_screens+num_matches+1) * sizeof(screenLayoutRec)); ++ xf86ConfigLayout.screens[0] = slp[0]; + } -+ ++ for (i=0; idriver = matches[0]; ++ if (slp && !xf86ConfigLayout.screens[0].screen->device) { ++ xf86ConfigLayout.screens[0].screen->device = ptr; ++ ptr->myScreenSection = xf86ConfigLayout.screens[0].screen; ++ } ++ } else { ++ if (slp) { ++ xf86ConfigLayout.screens[i].screen = xnfcalloc(1, sizeof(confScreenRec)); ++ if(!xf86ConfigLayout.screens[i].screen) ++ return NULL; ++ memcpy(xf86ConfigLayout.screens[i].screen, slp[0].screen, sizeof(confScreenRec)); ++ } ++ cptr = xcalloc(1, sizeof(GDevRec)); ++ if (!cptr) ++ return NULL; ++ memcpy(cptr, ptr, sizeof(GDevRec)); ++ cptr->identifier = xnfcalloc(1,strlen("Autoconfigured Video Device ")+strlen(matches[i])+1); ++ sprintf(cptr->identifier, "Autoconfigured Video Device %s", matches[i]); ++ cptr->driver = matches[i]; ++ if (slp) { ++ xf86ConfigLayout.screens[i].screen->device = cptr; ++ cptr->myScreenSection = xf86ConfigLayout.screens[i].screen; ++ } ++ } ++ } ++ for (i=1;iscreen->device) { +- xf86ConfigLayout.screens->screen->device = ptr; +- ptr->myScreenSection = xf86ConfigLayout.screens->screen; +- } ++ /* TODO Handle rest of multiple screen sections */ + xf86Msg(X_DEFAULT, "Assigned the driver to the xf86ConfigLayout\n"); + + return ptr; diff --git a/xorg-x11-server.changes b/xorg-x11-server.changes index 3bc85da..177d694 100644 --- a/xorg-x11-server.changes +++ b/xorg-x11-server.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Wed Mar 24 02:37:56 CET 2010 - ro@suse.de + +- re-do xorg-server-walk_drivers.diff again, different approach + create screen sections for each possible drivers + now it is really using the first driver as in full autoconfig + ------------------------------------------------------------------- Tue Mar 23 14:10:59 CET 2010 - sndirsch@suse.de