forked from pool/xorg-x11-server
Stefan Dirsch
61bd29bfd3
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
98 lines
3.0 KiB
Diff
98 lines
3.0 KiB
Diff
--- hw/xfree86/common/xf86AutoConfig.c
|
|
+++ hw/xfree86/common/xf86AutoConfig.c
|
|
@@ -539,34 +541,13 @@
|
|
}
|
|
}
|
|
|
|
-static char*
|
|
-chooseVideoDriver(void)
|
|
-{
|
|
- char *chosen_driver = NULL;
|
|
- int i;
|
|
- 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];
|
|
-
|
|
- 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]);
|
|
- }
|
|
- }
|
|
-
|
|
- return chosen_driver;
|
|
-}
|
|
-
|
|
GDevPtr
|
|
autoConfigDevice(GDevPtr preconf_device)
|
|
{
|
|
- 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 (!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; i<num_matches;i++) {
|
|
+ if (i==0) {
|
|
+ ptr->driver = 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;i<num_screens;i++) {
|
|
+ xf86ConfigLayout.screens[i+num_matches] = slp[i];
|
|
+ }
|
|
+ xf86ConfigLayout.screens[num_screens+num_matches].screen = NULL;
|
|
+ xfree(slp);
|
|
}
|
|
|
|
- /* TODO Handle multiple screen sections */
|
|
- if (xf86ConfigLayout.screens && !xf86ConfigLayout.screens->screen->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;
|