diff options
author | marha <marha@users.sourceforge.net> | 2012-03-26 14:23:28 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-03-26 14:23:28 +0200 |
commit | 76bcc36ed305418a3ddc5752d287ede894243e1b (patch) | |
tree | bacb320c825768471ce56f058f17ce863d592376 /xorg-server/hw/xfree86/common/xf86Configure.c | |
parent | 7d894e32566b710952c44cbc71939ad1d9e2fa8d (diff) | |
parent | 0f834b91a4768673833ab4917e87d86c237bb1a6 (diff) | |
download | vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.tar.gz vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.tar.bz2 vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
pixman/pixman/pixman-mmx.c
xorg-server/Xext/shm.c
xorg-server/Xext/syncsrv.h
xorg-server/Xext/xvmain.c
xorg-server/Xi/exevents.c
xorg-server/Xi/opendev.c
xorg-server/composite/compalloc.c
xorg-server/composite/compoverlay.c
xorg-server/dix/colormap.c
xorg-server/dix/devices.c
xorg-server/dix/dispatch.c
xorg-server/dix/dixfonts.c
xorg-server/dix/eventconvert.c
xorg-server/dix/events.c
xorg-server/dix/gc.c
xorg-server/dix/getevents.c
xorg-server/dix/main.c
xorg-server/dix/privates.c
xorg-server/dix/registry.c
xorg-server/dix/resource.c
xorg-server/exa/exa_accel.c
xorg-server/exa/exa_migration_classic.c
xorg-server/exa/exa_unaccel.c
xorg-server/fb/fb.h
xorg-server/fb/fbcopy.c
xorg-server/fb/fbpixmap.c
xorg-server/glx/dispatch.h
xorg-server/glx/glapi.h
xorg-server/glx/glapi_gentable.c
xorg-server/glx/glapitable.h
xorg-server/glx/glprocs.h
xorg-server/glx/glxcmds.c
xorg-server/glx/glxcmdsswap.c
xorg-server/glx/glxdricommon.c
xorg-server/glx/glxdriswrast.c
xorg-server/glx/glxext.c
xorg-server/glx/indirect_dispatch.c
xorg-server/glx/indirect_dispatch.h
xorg-server/glx/indirect_dispatch_swap.c
xorg-server/glx/indirect_size.h
xorg-server/glx/indirect_size_get.h
xorg-server/glx/indirect_table.c
xorg-server/glx/indirect_util.c
xorg-server/glx/rensize.c
xorg-server/glx/single2swap.c
xorg-server/glx/singlepix.c
xorg-server/glx/singlepixswap.c
xorg-server/glx/singlesize.c
xorg-server/hw/dmx/dmxinit.c
xorg-server/hw/kdrive/ephyr/ephyr.c
xorg-server/hw/kdrive/ephyr/hostx.c
xorg-server/hw/kdrive/ephyr/hostx.h
xorg-server/hw/kdrive/src/kinput.c
xorg-server/hw/xfree86/common/compiler.h
xorg-server/hw/xwin/InitInput.c
xorg-server/hw/xwin/InitOutput.c
xorg-server/hw/xwin/ddraw.h
xorg-server/hw/xwin/glx/glwrap.c
xorg-server/hw/xwin/glx/indirect.c
xorg-server/hw/xwin/glx/wgl_ext_api.h
xorg-server/hw/xwin/glx/winpriv.c
xorg-server/hw/xwin/win.h
xorg-server/hw/xwin/winallpriv.c
xorg-server/hw/xwin/winauth.c
xorg-server/hw/xwin/winclipboard.h
xorg-server/hw/xwin/winclipboardinit.c
xorg-server/hw/xwin/winclipboardthread.c
xorg-server/hw/xwin/winclipboardunicode.c
xorg-server/hw/xwin/winclipboardwndproc.c
xorg-server/hw/xwin/winclipboardwrappers.c
xorg-server/hw/xwin/winclipboardxevents.c
xorg-server/hw/xwin/wincmap.c
xorg-server/hw/xwin/winconfig.c
xorg-server/hw/xwin/wincreatewnd.c
xorg-server/hw/xwin/wincursor.c
xorg-server/hw/xwin/windialogs.c
xorg-server/hw/xwin/winengine.c
xorg-server/hw/xwin/winerror.c
xorg-server/hw/xwin/wingc.c
xorg-server/hw/xwin/wingetsp.c
xorg-server/hw/xwin/winkeybd.c
xorg-server/hw/xwin/winkeybd.h
xorg-server/hw/xwin/winlayouts.h
xorg-server/hw/xwin/winmisc.c
xorg-server/hw/xwin/winmonitors.c
xorg-server/hw/xwin/winmouse.c
xorg-server/hw/xwin/winmsg.c
xorg-server/hw/xwin/winmsg.h
xorg-server/hw/xwin/winmultiwindowclass.c
xorg-server/hw/xwin/winmultiwindowicons.c
xorg-server/hw/xwin/winmultiwindowshape.c
xorg-server/hw/xwin/winmultiwindowwindow.c
xorg-server/hw/xwin/winmultiwindowwm.c
xorg-server/hw/xwin/winmultiwindowwndproc.c
xorg-server/hw/xwin/winnativegdi.c
xorg-server/hw/xwin/winpfbdd.c
xorg-server/hw/xwin/winpixmap.c
xorg-server/hw/xwin/winpolyline.c
xorg-server/hw/xwin/winprefs.c
xorg-server/hw/xwin/winprocarg.c
xorg-server/hw/xwin/winregistry.c
xorg-server/hw/xwin/winscrinit.c
xorg-server/hw/xwin/winsetsp.c
xorg-server/hw/xwin/winshaddd.c
xorg-server/hw/xwin/winshadddnl.c
xorg-server/hw/xwin/winshadgdi.c
xorg-server/hw/xwin/wintrayicon.c
xorg-server/hw/xwin/winwin32rootless.c
xorg-server/hw/xwin/winwin32rootlesswindow.c
xorg-server/hw/xwin/winwin32rootlesswndproc.c
xorg-server/hw/xwin/winwindow.c
xorg-server/hw/xwin/winwindow.h
xorg-server/hw/xwin/winwindowswm.c
xorg-server/hw/xwin/winwndproc.c
xorg-server/include/callback.h
xorg-server/include/dixstruct.h
xorg-server/include/misc.h
xorg-server/include/os.h
xorg-server/include/scrnintstr.h
xorg-server/mi/micmap.c
xorg-server/mi/miinitext.c
xorg-server/mi/mioverlay.c
xorg-server/mi/misprite.c
xorg-server/mi/mivaltree.c
xorg-server/mi/miwindow.c
xorg-server/miext/damage/damage.c
xorg-server/miext/rootless/rootlessGC.c
xorg-server/miext/rootless/rootlessWindow.c
xorg-server/os/WaitFor.c
xorg-server/os/access.c
xorg-server/os/connection.c
xorg-server/os/io.c
xorg-server/os/log.c
xorg-server/os/osinit.c
xorg-server/os/utils.c
xorg-server/os/xdmcp.c
xorg-server/os/xprintf.c
xorg-server/os/xstrans.c
xorg-server/render/mipict.c
xorg-server/xkb/xkbActions.c
xorg-server/xkb/xkbInit.c
xorg-server/xkeyboard-config/compat/default.in
Diffstat (limited to 'xorg-server/hw/xfree86/common/xf86Configure.c')
-rw-r--r-- | xorg-server/hw/xfree86/common/xf86Configure.c | 827 |
1 files changed, 424 insertions, 403 deletions
diff --git a/xorg-server/hw/xfree86/common/xf86Configure.c b/xorg-server/hw/xfree86/common/xf86Configure.c index 994d46fc2..6f69117d3 100644 --- a/xorg-server/hw/xfree86/common/xf86Configure.c +++ b/xorg-server/hw/xfree86/common/xf86Configure.c @@ -43,7 +43,7 @@ typedef struct _DevToConfig { GDevRec GDev; - struct pci_device * pVideo; + struct pci_device *pVideo; #if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__) sbusDevicePtr sVideo; #endif @@ -77,28 +77,29 @@ static const char *DFLT_MOUSE_PROTO = "auto"; * the caller fill in the rest and/or change it as it sees fit. */ GDevPtr -xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int chipset) +xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, + int chipset) { int ret, i, j; if (!xf86DoConfigure || !xf86DoConfigurePass1) - return NULL; + return NULL; /* Check for duplicates */ - for (i = 0; i < nDevToConfig; i++) { + for (i = 0; i < nDevToConfig; i++) { switch (bus) { #ifdef XSERVER_LIBPCIACCESS - case BUS_PCI: - ret = xf86PciConfigure(busData, DevToConfig[i].pVideo); - break; + case BUS_PCI: + ret = xf86PciConfigure(busData, DevToConfig[i].pVideo); + break; #endif #if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__) - case BUS_SBUS: - ret = xf86SbusConfigure(busData, DevToConfig[i].sVideo); - break; + case BUS_SBUS: + ret = xf86SbusConfigure(busData, DevToConfig[i].sVideo); + break; #endif - default: - return NULL; + default: + return NULL; } if (ret == 0) goto out; @@ -107,112 +108,113 @@ xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int /* Allocate new structure occurrence */ i = nDevToConfig++; DevToConfig = - xnfrealloc(DevToConfig, nDevToConfig * sizeof(DevToConfigRec)); + xnfrealloc(DevToConfig, nDevToConfig * sizeof(DevToConfigRec)); memset(DevToConfig + i, 0, sizeof(DevToConfigRec)); DevToConfig[i].GDev.chipID = - DevToConfig[i].GDev.chipRev = DevToConfig[i].GDev.irq = -1; + DevToConfig[i].GDev.chipRev = DevToConfig[i].GDev.irq = -1; DevToConfig[i].iDriver = CurrentDriver; /* Fill in what we know, converting the driver name to lower case */ DevToConfig[i].GDev.driver = xnfalloc(strlen(driver) + 1); - for (j = 0; (DevToConfig[i].GDev.driver[j] = tolower(driver[j])); j++); + for (j = 0; (DevToConfig[i].GDev.driver[j] = tolower(driver[j])); j++); switch (bus) { #ifdef XSERVER_LIBPCIACCESS - case BUS_PCI: - xf86PciConfigureNewDev(busData, DevToConfig[i].pVideo, - &DevToConfig[i].GDev, &chipset); - break; + case BUS_PCI: + xf86PciConfigureNewDev(busData, DevToConfig[i].pVideo, + &DevToConfig[i].GDev, &chipset); + break; #endif #if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__) - case BUS_SBUS: - xf86SbusConfigureNewDev(busData, DevToConfig[i].sVideo, - &DevToConfig[i].GDev); - break; + case BUS_SBUS: + xf86SbusConfigureNewDev(busData, DevToConfig[i].sVideo, + &DevToConfig[i].GDev); + break; #endif - default: - break; + default: + break; } /* Get driver's available options */ if (xf86DriverList[CurrentDriver]->AvailableOptions) - DevToConfig[i].GDev.options = (OptionInfoPtr) - (*xf86DriverList[CurrentDriver]->AvailableOptions)(chipset, - bus); + DevToConfig[i].GDev.options = (OptionInfoPtr) + (*xf86DriverList[CurrentDriver]->AvailableOptions) (chipset, bus); return &DevToConfig[i].GDev; -out: + out: return NULL; } static XF86ConfInputPtr -configureInputSection (void) +configureInputSection(void) { XF86ConfInputPtr mouse = NULL; - parsePrologue (XF86ConfInputPtr, XF86ConfInputRec) - ptr->inp_identifier = "Keyboard0"; + parsePrologue(XF86ConfInputPtr, XF86ConfInputRec) + + ptr->inp_identifier = "Keyboard0"; ptr->inp_driver = "kbd"; ptr->list.next = NULL; /* Crude mechanism to auto-detect mouse (os dependent) */ - { - int fd; + { + int fd; - fd = open(DFLT_MOUSE_DEV, 0); - if (fd != -1) { - foundMouse = TRUE; - close(fd); - } + fd = open(DFLT_MOUSE_DEV, 0); + if (fd != -1) { + foundMouse = TRUE; + close(fd); + } } mouse = calloc(1, sizeof(XF86ConfInputRec)); mouse->inp_identifier = "Mouse0"; mouse->inp_driver = "mouse"; - mouse->inp_option_lst = - xf86addNewOption(mouse->inp_option_lst, strdup("Protocol"), - strdup(DFLT_MOUSE_PROTO)); - mouse->inp_option_lst = - xf86addNewOption(mouse->inp_option_lst, strdup("Device"), - strdup(DFLT_MOUSE_DEV)); - mouse->inp_option_lst = - xf86addNewOption(mouse->inp_option_lst, strdup("ZAxisMapping"), - strdup("4 5 6 7")); - ptr = (XF86ConfInputPtr)xf86addListItem((glp)ptr, (glp)mouse); + mouse->inp_option_lst = + xf86addNewOption(mouse->inp_option_lst, strdup("Protocol"), + strdup(DFLT_MOUSE_PROTO)); + mouse->inp_option_lst = + xf86addNewOption(mouse->inp_option_lst, strdup("Device"), + strdup(DFLT_MOUSE_DEV)); + mouse->inp_option_lst = + xf86addNewOption(mouse->inp_option_lst, strdup("ZAxisMapping"), + strdup("4 5 6 7")); + ptr = (XF86ConfInputPtr) xf86addListItem((glp) ptr, (glp) mouse); return ptr; } static XF86ConfScreenPtr -configureScreenSection (int screennum) +configureScreenSection(int screennum) { int i; - int depths[] = { 1, 4, 8, 15, 16, 24/*, 32*/ }; - parsePrologue (XF86ConfScreenPtr, XF86ConfScreenRec) + int depths[] = { 1, 4, 8, 15, 16, 24 /*, 32 */ }; + parsePrologue(XF86ConfScreenPtr, XF86ConfScreenRec) - XNFasprintf(&ptr->scrn_identifier, "Screen%d", screennum); + XNFasprintf(&ptr->scrn_identifier, "Screen%d", screennum); XNFasprintf(&ptr->scrn_monitor_str, "Monitor%d", screennum); XNFasprintf(&ptr->scrn_device_str, "Card%d", screennum); - for (i=0; i<sizeof(depths)/sizeof(depths[0]); i++) - { - XF86ConfDisplayPtr display; - - display = calloc(1, sizeof(XF86ConfDisplayRec)); - display->disp_depth = depths[i]; - display->disp_black.red = display->disp_white.red = -1; - display->disp_black.green = display->disp_white.green = -1; - display->disp_black.blue = display->disp_white.blue = -1; - ptr->scrn_display_lst = (XF86ConfDisplayPtr)xf86addListItem( - (glp)ptr->scrn_display_lst, (glp)display); + for (i = 0; i < sizeof(depths) / sizeof(depths[0]); i++) { + XF86ConfDisplayPtr display; + + display = calloc(1, sizeof(XF86ConfDisplayRec)); + display->disp_depth = depths[i]; + display->disp_black.red = display->disp_white.red = -1; + display->disp_black.green = display->disp_white.green = -1; + display->disp_black.blue = display->disp_white.blue = -1; + ptr->scrn_display_lst = (XF86ConfDisplayPtr) xf86addListItem((glp) ptr-> + scrn_display_lst, + (glp) + display); } return ptr; } -static const char* +static const char * optionTypeToString(OptionValueType type) { switch (type) { @@ -223,7 +225,7 @@ optionTypeToString(OptionValueType type) case OPTV_STRING: return "<str>"; case OPTV_ANYSTR: - return "[<str>]"; + return "[<str>]"; case OPTV_REAL: return "<f>"; case OPTV_BOOLEAN: @@ -238,20 +240,21 @@ optionTypeToString(OptionValueType type) } static XF86ConfDevicePtr -configureDeviceSection (int screennum) +configureDeviceSection(int screennum) { OptionInfoPtr p; int i = 0; - parsePrologue (XF86ConfDevicePtr, XF86ConfDeviceRec) - /* Move device info to parser structure */ - if (asprintf(&ptr->dev_identifier, "Card%d", screennum) == -1) + parsePrologue(XF86ConfDevicePtr, XF86ConfDeviceRec) + + /* Move device info to parser structure */ + if (asprintf(&ptr->dev_identifier, "Card%d", screennum) == -1) ptr->dev_identifier = NULL; ptr->dev_chipset = DevToConfig[screennum].GDev.chipset; ptr->dev_busid = DevToConfig[screennum].GDev.busID; ptr->dev_driver = DevToConfig[screennum].GDev.driver; ptr->dev_ramdac = DevToConfig[screennum].GDev.ramdac; - for (i = 0; (i < MAXDACSPEEDS) && (i < CONF_MAXDACSPEEDS); i++) + for (i = 0; (i < MAXDACSPEEDS) && (i < CONF_MAXDACSPEEDS); i++) ptr->dev_dacSpeeds[i] = DevToConfig[screennum].GDev.dacSpeeds[i]; ptr->dev_videoram = DevToConfig[screennum].GDev.videoRam; ptr->dev_textclockfreq = DevToConfig[screennum].GDev.textClockFreq; @@ -259,7 +262,8 @@ configureDeviceSection (int screennum) ptr->dev_mem_base = DevToConfig[screennum].GDev.MemBase; ptr->dev_io_base = DevToConfig[screennum].GDev.IOBase; ptr->dev_clockchip = DevToConfig[screennum].GDev.clockchip; - for (i = 0; (i < MAXCLOCKS) && (i < DevToConfig[screennum].GDev.numclocks); i++) + for (i = 0; (i < MAXCLOCKS) && (i < DevToConfig[screennum].GDev.numclocks); + i++) ptr->dev_clock[i] = DevToConfig[screennum].GDev.clock[i]; ptr->dev_clocks = i; ptr->dev_chipid = DevToConfig[screennum].GDev.chipID; @@ -268,161 +272,165 @@ configureDeviceSection (int screennum) /* Make sure older drivers don't segv */ if (DevToConfig[screennum].GDev.options) { - /* Fill in the available driver options for people to use */ - const char *descrip = - " ### Available Driver options are:-\n" - " ### Values: <i>: integer, <f>: float, " - "<bool>: \"True\"/\"False\",\n" - " ### <string>: \"String\", <freq>: \"<f> Hz/kHz/MHz\",\n" - " ### <percent>: \"<f>%\"\n" - " ### [arg]: arg optional\n"; - ptr->dev_comment = strdup(descrip); - if (ptr->dev_comment) { - for (p = DevToConfig[screennum].GDev.options; - p->name != NULL; p++) { - char *p_e; - const char *prefix = " #Option "; - const char *middle = " \t# "; - const char *suffix = "\n"; - const char *opttype = optionTypeToString(p->type); - char *optname; - int len = strlen(ptr->dev_comment) + strlen(prefix) + - strlen(middle) + strlen(suffix) + 1; - - if (asprintf(&optname, "\"%s\"", p->name) == -1) - break; - - len += max(20, strlen(optname)); - len += strlen(opttype); - - ptr->dev_comment = realloc(ptr->dev_comment, len); - if (!ptr->dev_comment) - break; - p_e = ptr->dev_comment + strlen(ptr->dev_comment); - sprintf(p_e, "%s%-20s%s%s%s", prefix, optname, middle, - opttype, suffix); - free(optname); - } - } + /* Fill in the available driver options for people to use */ + const char *descrip = + " ### Available Driver options are:-\n" + " ### Values: <i>: integer, <f>: float, " + "<bool>: \"True\"/\"False\",\n" + " ### <string>: \"String\", <freq>: \"<f> Hz/kHz/MHz\",\n" + " ### <percent>: \"<f>%\"\n" + " ### [arg]: arg optional\n"; + ptr->dev_comment = strdup(descrip); + if (ptr->dev_comment) { + for (p = DevToConfig[screennum].GDev.options; p->name != NULL; p++) { + char *p_e; + const char *prefix = " #Option "; + const char *middle = " \t# "; + const char *suffix = "\n"; + const char *opttype = optionTypeToString(p->type); + char *optname; + int len = strlen(ptr->dev_comment) + strlen(prefix) + + strlen(middle) + strlen(suffix) + 1; + + if (asprintf(&optname, "\"%s\"", p->name) == -1) + break; + + len += max(20, strlen(optname)); + len += strlen(opttype); + + ptr->dev_comment = realloc(ptr->dev_comment, len); + if (!ptr->dev_comment) + break; + p_e = ptr->dev_comment + strlen(ptr->dev_comment); + sprintf(p_e, "%s%-20s%s%s%s", prefix, optname, middle, + opttype, suffix); + free(optname); + } + } } return ptr; } static XF86ConfLayoutPtr -configureLayoutSection (void) +configureLayoutSection(void) { int scrnum = 0; - parsePrologue (XF86ConfLayoutPtr, XF86ConfLayoutRec) - ptr->lay_identifier = "X.org Configured"; + parsePrologue(XF86ConfLayoutPtr, XF86ConfLayoutRec) - { - XF86ConfInputrefPtr iptr; + ptr->lay_identifier = "X.org Configured"; - iptr = malloc (sizeof (XF86ConfInputrefRec)); - iptr->list.next = NULL; - iptr->iref_option_lst = NULL; - iptr->iref_inputdev_str = "Mouse0"; - iptr->iref_option_lst = - xf86addNewOption (iptr->iref_option_lst, strdup("CorePointer"), NULL); - ptr->lay_input_lst = (XF86ConfInputrefPtr) - xf86addListItem ((glp) ptr->lay_input_lst, (glp) iptr); + { + XF86ConfInputrefPtr iptr; + + iptr = malloc(sizeof(XF86ConfInputrefRec)); + iptr->list.next = NULL; + iptr->iref_option_lst = NULL; + iptr->iref_inputdev_str = "Mouse0"; + iptr->iref_option_lst = + xf86addNewOption(iptr->iref_option_lst, strdup("CorePointer"), + NULL); + ptr->lay_input_lst = (XF86ConfInputrefPtr) + xf86addListItem((glp) ptr->lay_input_lst, (glp) iptr); } { - XF86ConfInputrefPtr iptr; - - iptr = malloc (sizeof (XF86ConfInputrefRec)); - iptr->list.next = NULL; - iptr->iref_option_lst = NULL; - iptr->iref_inputdev_str = "Keyboard0"; - iptr->iref_option_lst = - xf86addNewOption (iptr->iref_option_lst, strdup("CoreKeyboard"), NULL); - ptr->lay_input_lst = (XF86ConfInputrefPtr) - xf86addListItem ((glp) ptr->lay_input_lst, (glp) iptr); - } - - for (scrnum = 0; scrnum < nDevToConfig; scrnum++) { - XF86ConfAdjacencyPtr aptr; - - aptr = malloc (sizeof (XF86ConfAdjacencyRec)); - aptr->list.next = NULL; - aptr->adj_x = 0; - aptr->adj_y = 0; - aptr->adj_scrnum = scrnum; - XNFasprintf(&aptr->adj_screen_str, "Screen%d", scrnum); - if (scrnum == 0) { - aptr->adj_where = CONF_ADJ_ABSOLUTE; - aptr->adj_refscreen = NULL; - } - else { - aptr->adj_where = CONF_ADJ_RIGHTOF; - XNFasprintf(&aptr->adj_refscreen, "Screen%d", scrnum - 1); - } - ptr->lay_adjacency_lst = - (XF86ConfAdjacencyPtr)xf86addListItem((glp)ptr->lay_adjacency_lst, - (glp)aptr); + XF86ConfInputrefPtr iptr; + + iptr = malloc(sizeof(XF86ConfInputrefRec)); + iptr->list.next = NULL; + iptr->iref_option_lst = NULL; + iptr->iref_inputdev_str = "Keyboard0"; + iptr->iref_option_lst = + xf86addNewOption(iptr->iref_option_lst, strdup("CoreKeyboard"), + NULL); + ptr->lay_input_lst = (XF86ConfInputrefPtr) + xf86addListItem((glp) ptr->lay_input_lst, (glp) iptr); + } + + for (scrnum = 0; scrnum < nDevToConfig; scrnum++) { + XF86ConfAdjacencyPtr aptr; + + aptr = malloc(sizeof(XF86ConfAdjacencyRec)); + aptr->list.next = NULL; + aptr->adj_x = 0; + aptr->adj_y = 0; + aptr->adj_scrnum = scrnum; + XNFasprintf(&aptr->adj_screen_str, "Screen%d", scrnum); + if (scrnum == 0) { + aptr->adj_where = CONF_ADJ_ABSOLUTE; + aptr->adj_refscreen = NULL; + } + else { + aptr->adj_where = CONF_ADJ_RIGHTOF; + XNFasprintf(&aptr->adj_refscreen, "Screen%d", scrnum - 1); + } + ptr->lay_adjacency_lst = + (XF86ConfAdjacencyPtr) xf86addListItem((glp) ptr->lay_adjacency_lst, + (glp) aptr); } return ptr; } static XF86ConfFlagsPtr -configureFlagsSection (void) +configureFlagsSection(void) { - parsePrologue (XF86ConfFlagsPtr, XF86ConfFlagsRec) + parsePrologue(XF86ConfFlagsPtr, XF86ConfFlagsRec) - return ptr; + return ptr; } static XF86ConfModulePtr -configureModuleSection (void) +configureModuleSection(void) { char **elist, **el; + /* Find the list of extension & font modules. */ const char *esubdirs[] = { - "extensions", - "fonts", - NULL + "extensions", + "fonts", + NULL }; - parsePrologue (XF86ConfModulePtr, XF86ConfModuleRec) + parsePrologue(XF86ConfModulePtr, XF86ConfModuleRec) - elist = LoaderListDirs(esubdirs, NULL); + elist = LoaderListDirs(esubdirs, NULL); if (elist) { - for (el = elist; *el; el++) { - XF86LoadPtr module; - - module = calloc(1, sizeof(XF86LoadRec)); - module->load_name = *el; - ptr->mod_load_lst = (XF86LoadPtr)xf86addListItem( - (glp)ptr->mod_load_lst, (glp)module); - } - free(elist); + for (el = elist; *el; el++) { + XF86LoadPtr module; + + module = calloc(1, sizeof(XF86LoadRec)); + module->load_name = *el; + ptr->mod_load_lst = (XF86LoadPtr) xf86addListItem((glp) ptr-> + mod_load_lst, + (glp) module); + } + free(elist); } return ptr; } static XF86ConfFilesPtr -configureFilesSection (void) +configureFilesSection(void) { - parsePrologue (XF86ConfFilesPtr, XF86ConfFilesRec) + parsePrologue(XF86ConfFilesPtr, XF86ConfFilesRec) + + if (xf86ModulePath) + ptr->file_modulepath = strdup(xf86ModulePath); + if (defaultFontPath) + ptr->file_fontpath = strdup(defaultFontPath); - if (xf86ModulePath) - ptr->file_modulepath = strdup(xf86ModulePath); - if (defaultFontPath) - ptr->file_fontpath = strdup(defaultFontPath); - return ptr; } static XF86ConfMonitorPtr -configureMonitorSection (int screennum) +configureMonitorSection(int screennum) { - parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec) + parsePrologue(XF86ConfMonitorPtr, XF86ConfMonitorRec) - XNFasprintf(&ptr->mon_identifier, "Monitor%d", screennum); + XNFasprintf(&ptr->mon_identifier, "Monitor%d", screennum); ptr->mon_vendor = strdup("Monitor Vendor"); ptr->mon_modelname = strdup("Monitor Model"); @@ -430,29 +438,24 @@ configureMonitorSection (int screennum) } /* Initialize Configure Monitor from Detailed Timing Block */ -static void handle_detailed_input(struct detailed_monitor_section *det_mon, - void *data) +static void +handle_detailed_input(struct detailed_monitor_section *det_mon, void *data) { XF86ConfMonitorPtr ptr = (XF86ConfMonitorPtr) data; switch (det_mon->type) { case DS_NAME: ptr->mon_modelname = realloc(ptr->mon_modelname, - strlen((char*)(det_mon->section.name)) + + strlen((char *) (det_mon->section.name)) + 1); - strcpy(ptr->mon_modelname, - (char*)(det_mon->section.name)); + strcpy(ptr->mon_modelname, (char *) (det_mon->section.name)); break; case DS_RANGES: - ptr->mon_hsync[ptr->mon_n_hsync].lo = - det_mon->section.ranges.min_h; - ptr->mon_hsync[ptr->mon_n_hsync].hi = - det_mon->section.ranges.max_h; + ptr->mon_hsync[ptr->mon_n_hsync].lo = det_mon->section.ranges.min_h; + ptr->mon_hsync[ptr->mon_n_hsync].hi = det_mon->section.ranges.max_h; ptr->mon_n_vrefresh = 1; - ptr->mon_vrefresh[ptr->mon_n_hsync].lo = - det_mon->section.ranges.min_v; - ptr->mon_vrefresh[ptr->mon_n_hsync].hi = - det_mon->section.ranges.max_v; + ptr->mon_vrefresh[ptr->mon_n_hsync].lo = det_mon->section.ranges.min_v; + ptr->mon_vrefresh[ptr->mon_n_hsync].hi = det_mon->section.ranges.max_v; ptr->mon_n_hsync++; default: break; @@ -460,53 +463,56 @@ static void handle_detailed_input(struct detailed_monitor_section *det_mon, } static XF86ConfMonitorPtr -configureDDCMonitorSection (int screennum) +configureDDCMonitorSection(int screennum) { int len, mon_width, mon_height; + #define displaySizeMaxLen 80 char displaySize_string[displaySizeMaxLen]; int displaySizeLen; - parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec) + parsePrologue(XF86ConfMonitorPtr, XF86ConfMonitorRec) - XNFasprintf(&ptr->mon_identifier, "Monitor%d", screennum); + XNFasprintf(&ptr->mon_identifier, "Monitor%d", screennum); ptr->mon_vendor = strdup(ConfiguredMonitor->vendor.name); XNFasprintf(&ptr->mon_modelname, "%x", ConfiguredMonitor->vendor.prod_id); /* features in centimetres, we want millimetres */ - mon_width = 10 * ConfiguredMonitor->features.hsize ; - mon_height = 10 * ConfiguredMonitor->features.vsize ; + mon_width = 10 * ConfiguredMonitor->features.hsize; + mon_height = 10 * ConfiguredMonitor->features.vsize; #ifdef CONFIGURE_DISPLAYSIZE - ptr->mon_width = mon_width; + ptr->mon_width = mon_width; ptr->mon_height = mon_height; #else if (mon_width && mon_height) { - /* when values available add DisplaySize option AS A COMMENT */ - - displaySizeLen = snprintf(displaySize_string, displaySizeMaxLen, - "\t#DisplaySize\t%5d %5d\t# mm\n", - mon_width, mon_height); - - if (displaySizeLen>0 && displaySizeLen<displaySizeMaxLen) { - if (ptr->mon_comment) { - len = strlen(ptr->mon_comment); - } else { - len = 0; - } - if ((ptr->mon_comment = - realloc(ptr->mon_comment, len + strlen(displaySize_string) + 1))) { - strcpy(ptr->mon_comment + len, displaySize_string); - } - } + /* when values available add DisplaySize option AS A COMMENT */ + + displaySizeLen = snprintf(displaySize_string, displaySizeMaxLen, + "\t#DisplaySize\t%5d %5d\t# mm\n", + mon_width, mon_height); + + if (displaySizeLen > 0 && displaySizeLen < displaySizeMaxLen) { + if (ptr->mon_comment) { + len = strlen(ptr->mon_comment); + } + else { + len = 0; + } + if ((ptr->mon_comment = + realloc(ptr->mon_comment, + len + strlen(displaySize_string) + 1))) { + strcpy(ptr->mon_comment + len, displaySize_string); + } + } } -#endif /* def CONFIGURE_DISPLAYSIZE */ +#endif /* def CONFIGURE_DISPLAYSIZE */ - xf86ForEachDetailedBlock(ConfiguredMonitor, handle_detailed_input, - ptr); + xf86ForEachDetailedBlock(ConfiguredMonitor, handle_detailed_input, ptr); if (ConfiguredMonitor->features.dpms) { - ptr->mon_option_lst = xf86addNewOption(ptr->mon_option_lst, strdup("DPMS"), NULL); + ptr->mon_option_lst = + xf86addNewOption(ptr->mon_option_lst, strdup("DPMS"), NULL); } return ptr; @@ -515,7 +521,7 @@ configureDDCMonitorSection (int screennum) void DoConfigure(void) { - int i,j, screennum = -1; + int i, j, screennum = -1; const char *home = NULL; char filename[PATH_MAX]; const char *addslash = ""; @@ -526,13 +532,13 @@ DoConfigure(void) vlist = xf86DriverlistFromCompile(); if (!vlist) { - ErrorF("Missing output drivers. Configuration failed.\n"); - goto bail; + ErrorF("Missing output drivers. Configuration failed.\n"); + goto bail; } ErrorF("List of video drivers:\n"); for (vl = vlist; *vl; vl++) - ErrorF("\t%s\n", *vl); + ErrorF("\t%s\n", *vl); /* Load all the drivers that were found. */ xf86LoadModules(vlist, NULL); @@ -540,65 +546,71 @@ DoConfigure(void) free(vlist); for (i = 0; i < xf86NumDrivers; i++) { - xorgHWFlags flags; - if (!xf86DriverList[i]->driverFunc - || !xf86DriverList[i]->driverFunc(NULL, - GET_REQUIRED_HW_INTERFACES, - &flags) - || NEED_IO_ENABLED(flags)) { - xorgHWAccess = TRUE; - break; - } + xorgHWFlags flags; + + if (!xf86DriverList[i]->driverFunc + || !xf86DriverList[i]->driverFunc(NULL, + GET_REQUIRED_HW_INTERFACES, + &flags) + || NEED_IO_ENABLED(flags)) { + xorgHWAccess = TRUE; + break; + } } /* Enable full I/O access */ if (xorgHWAccess) { - if(!xf86EnableIO()) - /* oops, we have failed */ - xorgHWAccess = FALSE; + if (!xf86EnableIO()) + /* oops, we have failed */ + xorgHWAccess = FALSE; } /* Create XF86Config file structure */ xf86config = calloc(1, sizeof(XF86ConfigRec)); /* Call all of the probe functions, reporting the results. */ - for (CurrentDriver = 0; CurrentDriver < xf86NumDrivers; CurrentDriver++) { - xorgHWFlags flags; - Bool found_screen; - DriverRec * const drv = xf86DriverList[CurrentDriver]; - - if (!xorgHWAccess) { - if (!drv->driverFunc - || !drv->driverFunc( NULL, GET_REQUIRED_HW_INTERFACES, &flags ) - || NEED_IO_ENABLED(flags)) - continue; - } - - found_screen = xf86CallDriverProbe( drv, TRUE ); - if ( found_screen && drv->Identify ) { - (*drv->Identify)(0); - } + for (CurrentDriver = 0; CurrentDriver < xf86NumDrivers; CurrentDriver++) { + xorgHWFlags flags; + Bool found_screen; + DriverRec *const drv = xf86DriverList[CurrentDriver]; + + if (!xorgHWAccess) { + if (!drv->driverFunc + || !drv->driverFunc(NULL, GET_REQUIRED_HW_INTERFACES, &flags) + || NEED_IO_ENABLED(flags)) + continue; + } + + found_screen = xf86CallDriverProbe(drv, TRUE); + if (found_screen && drv->Identify) { + (*drv->Identify) (0); + } } if (nDevToConfig <= 0) { - ErrorF("No devices to configure. Configuration failed.\n"); - goto bail; + ErrorF("No devices to configure. Configuration failed.\n"); + goto bail; } /* Add device, monitor and screen sections for detected devices */ - for (screennum = 0; screennum < nDevToConfig; screennum++) { - XF86ConfDevicePtr DevicePtr; - XF86ConfMonitorPtr MonitorPtr; - XF86ConfScreenPtr ScreenPtr; - - DevicePtr = configureDeviceSection(screennum); - xf86config->conf_device_lst = (XF86ConfDevicePtr)xf86addListItem( - (glp)xf86config->conf_device_lst, (glp)DevicePtr); - MonitorPtr = configureMonitorSection(screennum); - xf86config->conf_monitor_lst = (XF86ConfMonitorPtr)xf86addListItem( - (glp)xf86config->conf_monitor_lst, (glp)MonitorPtr); - ScreenPtr = configureScreenSection(screennum); - xf86config->conf_screen_lst = (XF86ConfScreenPtr)xf86addListItem( - (glp)xf86config->conf_screen_lst, (glp)ScreenPtr); + for (screennum = 0; screennum < nDevToConfig; screennum++) { + XF86ConfDevicePtr DevicePtr; + XF86ConfMonitorPtr MonitorPtr; + XF86ConfScreenPtr ScreenPtr; + + DevicePtr = configureDeviceSection(screennum); + xf86config->conf_device_lst = (XF86ConfDevicePtr) xf86addListItem((glp) + xf86config-> + conf_device_lst, + (glp) + DevicePtr); + MonitorPtr = configureMonitorSection(screennum); + xf86config->conf_monitor_lst = (XF86ConfMonitorPtr) xf86addListItem((glp) xf86config->conf_monitor_lst, (glp) MonitorPtr); + ScreenPtr = configureScreenSection(screennum); + xf86config->conf_screen_lst = (XF86ConfScreenPtr) xf86addListItem((glp) + xf86config-> + conf_screen_lst, + (glp) + ScreenPtr); } xf86config->conf_files = configureFilesSection(); @@ -613,91 +625,95 @@ DoConfigure(void) home = getenv("HOME"); if ((home == NULL) || (home[0] == '\0')) { - home = "/"; - } else { - /* Determine if trailing slash is present or needed */ - int l = strlen(home); + home = "/"; + } + else { + /* Determine if trailing slash is present or needed */ + int l = strlen(home); - if (home[l-1] != '/') { - addslash = "/"; - } + if (home[l - 1] != '/') { + addslash = "/"; + } } snprintf(filename, sizeof(filename), "%s%s" XF86CONFIGFILE ".new", - home, addslash); + home, addslash); if (xf86writeConfigFile(filename, xf86config) == 0) { - xf86Msg(X_ERROR, "Unable to write config file: \"%s\": %s\n", - filename, strerror(errno)); - goto bail; + xf86Msg(X_ERROR, "Unable to write config file: \"%s\": %s\n", + filename, strerror(errno)); + goto bail; } xf86DoConfigurePass1 = FALSE; /* Try to get DDC information filled in */ xf86ConfigFile = filename; if (xf86HandleConfigFile(FALSE) != CONFIG_OK) { - goto bail; + goto bail; } xf86DoConfigurePass1 = FALSE; - - dev2screen = xnfcalloc(1,xf86NumDrivers*sizeof(int)); + + dev2screen = xnfcalloc(1, xf86NumDrivers * sizeof(int)); { - Bool *driverProbed = xnfcalloc(1,xf86NumDrivers*sizeof(Bool)); - for (screennum = 0; screennum < nDevToConfig; screennum++) { - int k,l,n,oldNumScreens; - - i = DevToConfig[screennum].iDriver; - - if (driverProbed[i]) continue; - driverProbed[i] = TRUE; - - oldNumScreens = xf86NumScreens; - - xf86CallDriverProbe( xf86DriverList[i], FALSE ); - - /* reorder */ - k = screennum > 0 ? screennum : 1; - for (l = oldNumScreens; l < xf86NumScreens; l++) { - /* is screen primary? */ - Bool primary = FALSE; - for (n = 0; n<xf86Screens[l]->numEntities; n++) { - if (xf86IsEntityPrimary(xf86Screens[l]->entityList[n])) { - dev2screen[0] = l; - primary = TRUE; - break; - } - } - if (primary) continue; - /* not primary: assign it to next device of same driver */ - /* - * NOTE: we assume that devices in DevToConfig - * and xf86Screens[] have the same order except - * for the primary device which always comes first. - */ - for (; k < nDevToConfig; k++) { - if (DevToConfig[k].iDriver == i) { - dev2screen[k++] = l; - break; - } - } - } - } - free(driverProbed); - } - + Bool *driverProbed = xnfcalloc(1, xf86NumDrivers * sizeof(Bool)); + + for (screennum = 0; screennum < nDevToConfig; screennum++) { + int k, l, n, oldNumScreens; + + i = DevToConfig[screennum].iDriver; + + if (driverProbed[i]) + continue; + driverProbed[i] = TRUE; + + oldNumScreens = xf86NumScreens; + + xf86CallDriverProbe(xf86DriverList[i], FALSE); + + /* reorder */ + k = screennum > 0 ? screennum : 1; + for (l = oldNumScreens; l < xf86NumScreens; l++) { + /* is screen primary? */ + Bool primary = FALSE; + + for (n = 0; n < xf86Screens[l]->numEntities; n++) { + if (xf86IsEntityPrimary(xf86Screens[l]->entityList[n])) { + dev2screen[0] = l; + primary = TRUE; + break; + } + } + if (primary) + continue; + /* not primary: assign it to next device of same driver */ + /* + * NOTE: we assume that devices in DevToConfig + * and xf86Screens[] have the same order except + * for the primary device which always comes first. + */ + for (; k < nDevToConfig; k++) { + if (DevToConfig[k].iDriver == i) { + dev2screen[k++] = l; + break; + } + } + } + } + free(driverProbed); + } if (nDevToConfig != xf86NumScreens) { - ErrorF("Number of created screens does not match number of detected" - " devices.\n Configuration failed.\n"); - goto bail; + ErrorF("Number of created screens does not match number of detected" + " devices.\n Configuration failed.\n"); + goto bail; } xf86PostProbe(); for (j = 0; j < xf86NumScreens; j++) { - xf86Screens[j]->scrnIndex = j; + xf86Screens[j]->scrnIndex = j; } xf86freeMonitorList(xf86config->conf_monitor_lst); @@ -705,53 +721,57 @@ DoConfigure(void) xf86freeScreenList(xf86config->conf_screen_lst); xf86config->conf_screen_lst = NULL; for (j = 0; j < xf86NumScreens; j++) { - XF86ConfMonitorPtr MonitorPtr; - XF86ConfScreenPtr ScreenPtr; + XF86ConfMonitorPtr MonitorPtr; + XF86ConfScreenPtr ScreenPtr; - ConfiguredMonitor = NULL; + ConfiguredMonitor = NULL; - if ((*xf86Screens[dev2screen[j]]->PreInit)(xf86Screens[dev2screen[j]], - PROBE_DETECT) && - ConfiguredMonitor) { - MonitorPtr = configureDDCMonitorSection(j); - } else { - MonitorPtr = configureMonitorSection(j); - } - ScreenPtr = configureScreenSection(j); - xf86config->conf_monitor_lst = (XF86ConfMonitorPtr)xf86addListItem( - (glp)xf86config->conf_monitor_lst, (glp)MonitorPtr); - xf86config->conf_screen_lst = (XF86ConfScreenPtr)xf86addListItem( - (glp)xf86config->conf_screen_lst, (glp)ScreenPtr); + if ((*xf86Screens[dev2screen[j]]->PreInit) (xf86Screens[dev2screen[j]], + PROBE_DETECT) && + ConfiguredMonitor) { + MonitorPtr = configureDDCMonitorSection(j); + } + else { + MonitorPtr = configureMonitorSection(j); + } + ScreenPtr = configureScreenSection(j); + + xf86config->conf_monitor_lst = (XF86ConfMonitorPtr) xf86addListItem((glp) xf86config->conf_monitor_lst, (glp) MonitorPtr); + xf86config->conf_screen_lst = (XF86ConfScreenPtr) xf86addListItem((glp) + xf86config-> + conf_screen_lst, + (glp) + ScreenPtr); } if (xf86writeConfigFile(filename, xf86config) == 0) { - xf86Msg(X_ERROR, "Unable to write config file: \"%s\": %s\n", - filename, strerror(errno)); - goto bail; + xf86Msg(X_ERROR, "Unable to write config file: \"%s\": %s\n", + filename, strerror(errno)); + goto bail; } ErrorF("\n"); if (!foundMouse) { - ErrorF("\n"__XSERVERNAME__" is not able to detect your mouse.\n" - "Edit the file and correct the Device.\n"); - } else { - ErrorF("\n"__XSERVERNAME__" detected your mouse at device %s.\n" - "Please check your config if the mouse is still not\n" - "operational, as by default "__XSERVERNAME__ - " tries to autodetect\n" - "the protocol.\n",DFLT_MOUSE_DEV); + ErrorF("\n" __XSERVERNAME__ " is not able to detect your mouse.\n" + "Edit the file and correct the Device.\n"); + } + else { + ErrorF("\n" __XSERVERNAME__ " detected your mouse at device %s.\n" + "Please check your config if the mouse is still not\n" + "operational, as by default " __XSERVERNAME__ + " tries to autodetect\n" "the protocol.\n", DFLT_MOUSE_DEV); } if (xf86NumScreens > 1) { - ErrorF("\n"__XSERVERNAME__ - " has configured a multihead system, please check your config.\n"); + ErrorF("\n" __XSERVERNAME__ + " has configured a multihead system, please check your config.\n"); } - ErrorF("\nYour %s file is %s\n\n", XF86CONFIGFILE ,filename); + ErrorF("\nYour %s file is %s\n\n", XF86CONFIGFILE, filename); ErrorF("To test the server, run 'X -config %s'\n\n", filename); -bail: + bail: OsCleanup(TRUE); AbortDDX(EXIT_ERR_CONFIGURE); fflush(stderr); @@ -765,47 +785,48 @@ bail: * Author: Marcus Schaefer, ms@suse.de */ -void DoShowOptions (void) { - int i = 0; - char **vlist = 0; - char *pSymbol = 0; - XF86ModuleData *initData = 0; - if (! (vlist = xf86DriverlistFromCompile())) { - ErrorF("Missing output drivers\n"); - goto bail; - } - xf86LoadModules (vlist,0); - free(vlist); - for (i = 0; i < xf86NumDrivers; i++) { - if (xf86DriverList[i]->AvailableOptions) { - const OptionInfoRec *pOption = - (*xf86DriverList[i]->AvailableOptions)(0,0); - if (! pOption) { - ErrorF ("(EE) Couldn't read option table for %s driver\n", - xf86DriverList[i]->driverName - ); - continue; - } - XNFasprintf(&pSymbol, "%sModuleData", - xf86DriverList[i]->driverName); - initData = LoaderSymbol (pSymbol); - if (initData) { - XF86ModuleVersionInfo *vers = initData->vers; - const OptionInfoRec *p; - ErrorF ("Driver[%d]:%s[%s] {\n", - i,xf86DriverList[i]->driverName,vers->vendor - ); - for (p = pOption; p->name != NULL; p++) { - ErrorF ("\t%s:%s\n", p->name, - optionTypeToString(p->type)); - } - ErrorF ("}\n"); - } - } - } - bail: - OsCleanup (TRUE); - AbortDDX (EXIT_ERR_DRIVERS); - fflush (stderr); - exit (0); +void +DoShowOptions(void) +{ + int i = 0; + char **vlist = 0; + char *pSymbol = 0; + XF86ModuleData *initData = 0; + + if (!(vlist = xf86DriverlistFromCompile())) { + ErrorF("Missing output drivers\n"); + goto bail; + } + xf86LoadModules(vlist, 0); + free(vlist); + for (i = 0; i < xf86NumDrivers; i++) { + if (xf86DriverList[i]->AvailableOptions) { + const OptionInfoRec *pOption = + (*xf86DriverList[i]->AvailableOptions) (0, 0); + if (!pOption) { + ErrorF("(EE) Couldn't read option table for %s driver\n", + xf86DriverList[i]->driverName); + continue; + } + XNFasprintf(&pSymbol, "%sModuleData", + xf86DriverList[i]->driverName); + initData = LoaderSymbol(pSymbol); + if (initData) { + XF86ModuleVersionInfo *vers = initData->vers; + const OptionInfoRec *p; + + ErrorF("Driver[%d]:%s[%s] {\n", + i, xf86DriverList[i]->driverName, vers->vendor); + for (p = pOption; p->name != NULL; p++) { + ErrorF("\t%s:%s\n", p->name, optionTypeToString(p->type)); + } + ErrorF("}\n"); + } + } + } + bail: + OsCleanup(TRUE); + AbortDDX(EXIT_ERR_DRIVERS); + fflush(stderr); + exit(0); } |