summaryrefslogtreecommitdiff
path: root/hw/xfree86/common/xf86Config.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/xfree86/common/xf86Config.c')
-rw-r--r--hw/xfree86/common/xf86Config.c174
1 files changed, 110 insertions, 64 deletions
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 6369d6dda..71e008069 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -1,5 +1,3 @@
-
-
/*
* Loosely based on code bearing the following copyright:
*
@@ -53,10 +51,6 @@
#include <grp.h>
#endif
-#ifdef __UNIXOS2__
-#define I_NEED_OS2_H
-#endif
-
#include "xf86.h"
#include "xf86Parser.h"
#include "xf86tokens.h"
@@ -121,6 +115,17 @@ extern DeviceAssocRec mouse_assoc;
static char *fontPath = NULL;
+static ModuleDefault ModuleDefaults[] = {
+ {.name = "extmod", .toLoad = TRUE, .load_opt=NULL},
+ {.name = "dbe", .toLoad = TRUE, .load_opt=NULL},
+ {.name = "glx", .toLoad = TRUE, .load_opt=NULL},
+ {.name = "freetype", .toLoad = TRUE, .load_opt=NULL},
+ {.name = "record", .toLoad = TRUE, .load_opt=NULL},
+ {.name = "dri", .toLoad = TRUE, .load_opt=NULL},
+ {.name = NULL, .toLoad = FALSE, .load_opt=NULL}
+};
+
+
/* Forward declarations */
static Bool configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen,
int scrnum, MessageType from);
@@ -182,15 +187,8 @@ xf86ValidateFontPath(char *path)
while (next != NULL) {
path_elem = xf86GetPathElem(&next);
if (*path_elem == '/') {
-#ifndef __UNIXOS2__
dir_elem = xnfcalloc(1, strlen(path_elem) + 1);
if ((p1 = strchr(path_elem, ':')) != 0)
-#else
- /* OS/2 must prepend X11ROOT */
- path_elem = (char*)__XOS2RedirRoot(path_elem);
- dir_elem = xnfcalloc(1, strlen(path_elem) + 1);
- if (p1 = strchr(path_elem+2, ':'))
-#endif
dirlen = p1 - path_elem;
else
dirlen = strlen(path_elem);
@@ -214,9 +212,7 @@ xf86ValidateFontPath(char *path)
if (flag == 0)
if (!S_ISREG(stat_buf.st_mode))
flag = -1;
-#ifndef __UNIXOS2__
xfree(p1);
-#endif
if (flag != 0) {
xf86Msg(X_WARNING,
"`fonts.dir' not found (or not valid) in \"%s\".\n",
@@ -443,7 +439,7 @@ xf86InputDriverlistFromConfig()
{
int count = 0;
char **modulearray;
- IDevPtr idp;
+ IDevPtr* idp;
/*
* make sure the config file has been parsed and that we have a
@@ -461,7 +457,7 @@ xf86InputDriverlistFromConfig()
*/
if (xf86ConfigLayout.inputs) {
idp = xf86ConfigLayout.inputs;
- while (idp->identifier) {
+ while (*idp) {
count++;
idp++;
}
@@ -476,8 +472,8 @@ xf86InputDriverlistFromConfig()
modulearray = xnfalloc((count + 1) * sizeof(char*));
count = 0;
idp = xf86ConfigLayout.inputs;
- while (idp->identifier) {
- modulearray[count] = idp->driver;
+ while (idp && *idp) {
+ modulearray[count] = (*idp)->driver;
count++;
idp++;
}
@@ -793,7 +789,9 @@ typedef enum {
FLAG_AIGLX,
FLAG_IGNORE_ABI,
FLAG_ALLOW_EMPTY_INPUT,
- FLAG_USE_DEFAULT_FONT_PATH
+ FLAG_USE_DEFAULT_FONT_PATH,
+ FLAG_AUTO_ADD_DEVICES,
+ FLAG_AUTO_ENABLE_DEVICES,
} FlagValues;
static OptionInfoRec FlagOptions[] = {
@@ -871,6 +869,10 @@ static OptionInfoRec FlagOptions[] = {
{0}, FALSE },
{ FLAG_USE_DEFAULT_FONT_PATH, "UseDefaultFontPath", OPTV_BOOLEAN,
{0}, FALSE },
+ { FLAG_AUTO_ADD_DEVICES, "AutoAddDevices", OPTV_BOOLEAN,
+ {0}, TRUE },
+ { FLAG_AUTO_ENABLE_DEVICES, "AutoEnableDevices", OPTV_BOOLEAN,
+ {0}, TRUE },
{ -1, NULL, OPTV_NONE,
{0}, FALSE },
};
@@ -934,6 +936,30 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
xf86Msg(X_CONFIG, "Ignoring ABI Version\n");
}
+ if (xf86IsOptionSet(FlagOptions, FLAG_AUTO_ADD_DEVICES)) {
+ xf86GetOptValBool(FlagOptions, FLAG_AUTO_ADD_DEVICES,
+ &xf86Info.autoAddDevices);
+ from = X_CONFIG;
+ }
+ else {
+ xf86Info.autoAddDevices = TRUE;
+ from = X_DEFAULT;
+ }
+ xf86Msg(from, "%sutomatically adding devices\n",
+ xf86Info.autoAddDevices ? "A" : "Not a");
+
+ if (xf86IsOptionSet(FlagOptions, FLAG_AUTO_ENABLE_DEVICES)) {
+ xf86GetOptValBool(FlagOptions, FLAG_AUTO_ENABLE_DEVICES,
+ &xf86Info.autoEnableDevices);
+ from = X_CONFIG;
+ }
+ else {
+ xf86Info.autoEnableDevices = TRUE;
+ from = X_DEFAULT;
+ }
+ xf86Msg(from, "%sutomatically enabling devices\n",
+ xf86Info.autoEnableDevices ? "A" : "Not a");
+
/*
* Set things up based on the config file information. Some of these
* settings may be overridden later when the command line options are
@@ -1004,6 +1030,7 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
} else if (!xf86NameCmp(s,"sync")) {
xf86Msg(X_CONFIG, "Syncing logfile enabled\n");
xf86Info.log = LogSync;
+ LogSetParameter(XLOG_FLUSH, TRUE);
LogSetParameter(XLOG_SYNC, TRUE);
} else {
xf86Msg(X_WARNING,"Unknown Log option\n");
@@ -1186,7 +1213,8 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
IDevPtr corePointer = NULL, coreKeyboard = NULL;
Bool foundPointer = FALSE, foundKeyboard = FALSE;
const char *pointerMsg = NULL, *keyboardMsg = NULL;
- IDevPtr indp, i;
+ IDevPtr *devs, /* iterator */
+ indp;
IDevRec Pointer, Keyboard;
XF86ConfInputPtr confInput;
XF86ConfInputRec defPtr, defKbd;
@@ -1199,7 +1227,8 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
* in the active ServerLayout. If more than one is specified for either,
* remove the core attribute from the later ones.
*/
- for (indp = servlayoutp->inputs; indp->identifier; indp++) {
+ for (devs = servlayoutp->inputs; devs && *devs; devs++) {
+ indp = *devs;
pointer opt1 = NULL, opt2 = NULL;
if (indp->commonOptions &&
xf86CheckBoolOption(indp->commonOptions, "CorePointer", FALSE)) {
@@ -1264,11 +1293,15 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
* removed.
*/
if (corePointer) {
- for (indp = servlayoutp->inputs; indp->identifier; indp++)
- if (indp == corePointer)
+ for (devs = servlayoutp->inputs; devs && *devs; devs++)
+ if (*devs == corePointer)
+ {
+ xfree(*devs);
+ *devs = (IDevPtr)0x1; /* ensure we dont skip next loop*/
break;
- for (; indp->identifier; indp++)
- indp[0] = indp[1];
+ }
+ for (; devs && *devs; devs++)
+ devs[0] = devs[1];
count--;
}
corePointer = NULL;
@@ -1328,13 +1361,14 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
foundPointer = configInput(&Pointer, confInput, from);
if (foundPointer) {
count++;
- indp = xnfrealloc(servlayoutp->inputs,
- (count + 1) * sizeof(IDevRec));
- indp[count - 1] = Pointer;
- indp[count - 1].extraOptions =
+ devs = xnfrealloc(servlayoutp->inputs,
+ (count + 1) * sizeof(IDevPtr));
+ devs[count - 1] = xnfalloc(sizeof(IDevRec));
+ *devs[count - 1] = Pointer;
+ devs[count - 1]->extraOptions =
xf86addNewOption(NULL, xnfstrdup("CorePointer"), NULL);
- indp[count].identifier = NULL;
- servlayoutp->inputs = indp;
+ devs[count] = NULL;
+ servlayoutp->inputs = devs;
}
}
@@ -1352,9 +1386,9 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
* If you're using an evdev keyboard and expect a default mouse
* section ... deal.
*/
- for (i = servlayoutp->inputs; i->identifier && i->driver; i++) {
- if (!strcmp(i->driver, "void") || !strcmp(i->driver, "mouse") ||
- !strcmp(i->driver, "vmmouse") || !strcmp(i->driver, "evdev")) {
+ for (devs = servlayoutp->inputs; devs && *devs; devs++) {
+ if (!strcmp((*devs)->driver, "void") || !strcmp((*devs)->driver, "mouse") ||
+ !strcmp((*devs)->driver, "vmmouse") || !strcmp((*devs)->driver, "evdev")) {
found = 1; break;
}
}
@@ -1367,13 +1401,14 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
foundPointer = configInput(&Pointer, confInput, from);
if (foundPointer) {
count++;
- indp = xnfrealloc(servlayoutp->inputs,
- (count + 1) * sizeof(IDevRec));
- indp[count - 1] = Pointer;
- indp[count - 1].extraOptions =
+ devs = xnfrealloc(servlayoutp->inputs,
+ (count + 1) * sizeof(IDevPtr));
+ devs[count - 1] = xnfalloc(sizeof(IDevRec));
+ *devs[count - 1] = Pointer;
+ devs[count - 1]->extraOptions =
xf86addNewOption(NULL, xnfstrdup("AlwaysCore"), NULL);
- indp[count].identifier = NULL;
- servlayoutp->inputs = indp;
+ devs[count] = NULL;
+ servlayoutp->inputs = devs;
}
}
@@ -1394,11 +1429,15 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
* removed.
*/
if (coreKeyboard) {
- for (indp = servlayoutp->inputs; indp->identifier; indp++)
- if (indp == coreKeyboard)
+ for (devs = servlayoutp->inputs; devs && *devs; devs++)
+ if (*devs == coreKeyboard)
+ {
+ xfree(*devs);
+ *devs = (IDevPtr)0x1; /* ensure we dont skip next loop */
break;
- for (; indp->identifier; indp++)
- indp[0] = indp[1];
+ }
+ for (; devs && *devs; devs++)
+ devs[0] = devs[1];
count--;
}
coreKeyboard = NULL;
@@ -1458,13 +1497,14 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
foundKeyboard = configInput(&Keyboard, confInput, from);
if (foundKeyboard) {
count++;
- indp = xnfrealloc(servlayoutp->inputs,
- (count + 1) * sizeof(IDevRec));
- indp[count - 1] = Keyboard;
- indp[count - 1].extraOptions =
+ devs = xnfrealloc(servlayoutp->inputs,
+ (count + 1) * sizeof(IDevPtr));
+ devs[count - 1] = xnfalloc(sizeof(IDevRec));
+ *devs[count - 1] = Keyboard;
+ devs[count - 1]->extraOptions =
xf86addNewOption(NULL, xnfstrdup("CoreKeyboard"), NULL);
- indp[count].identifier = NULL;
- servlayoutp->inputs = indp;
+ devs[count] = NULL;
+ servlayoutp->inputs = devs;
}
}
@@ -1520,7 +1560,7 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
MessageType from;
screenLayoutPtr slp;
GDevPtr gdp;
- IDevPtr indp;
+ IDevPtr* indp;
int i = 0, j;
if (!servlayoutp)
@@ -1732,16 +1772,19 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
ErrorF("Found %d input devices in the layout section %s",
count, conf_layout->lay_identifier);
#endif
- indp = xnfalloc((count + 1) * sizeof(IDevRec));
- indp[count].identifier = NULL;
+ indp = xnfcalloc((count + 1), sizeof(IDevPtr));
+ indp[count] = NULL;
irp = conf_layout->lay_input_lst;
count = 0;
while (irp) {
- if (!configInput(&indp[count], irp->iref_inputdev, X_CONFIG)) {
- xfree(indp);
- return FALSE;
+ indp[count] = xnfalloc(sizeof(IDevRec));
+ if (!configInput(indp[count], irp->iref_inputdev, X_CONFIG)) {
+ while(count--)
+ xfree(indp[count]);
+ xfree(indp);
+ return FALSE;
}
- indp[count].extraOptions = irp->iref_option_lst;
+ indp[count]->extraOptions = irp->iref_option_lst;
count++;
irp = (XF86ConfInputrefPtr)irp->list.next;
}
@@ -1765,7 +1808,7 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen)
MessageType from;
XF86ConfScreenPtr s;
screenLayoutPtr slp;
- IDevPtr indp;
+ IDevPtr *indp;
if (!servlayoutp)
return FALSE;
@@ -1807,8 +1850,8 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen)
servlayoutp->inactives = xnfcalloc(1, sizeof(GDevRec));
servlayoutp->options = NULL;
/* Set up an empty input device list, then look for some core devices. */
- indp = xnfalloc(sizeof(IDevRec));
- indp->identifier = NULL;
+ indp = xnfalloc(sizeof(IDevPtr));
+ *indp = NULL;
servlayoutp->inputs = indp;
if (!xf86Info.allowEmptyInput && !checkCoreInputDevices(servlayoutp, TRUE))
return FALSE;
@@ -1945,12 +1988,15 @@ configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum,
}
typedef enum {
- MON_REDUCEDBLANKING
+ MON_REDUCEDBLANKING,
+ MON_MAX_PIX_CLOCK,
} MonitorValues;
static OptionInfoRec MonitorOptions[] = {
{ MON_REDUCEDBLANKING, "ReducedBlanking", OPTV_BOOLEAN,
{0}, FALSE },
+ { MON_MAX_PIX_CLOCK, "MaxPixClock", OPTV_FREQ,
+ {0}, FALSE },
{ -1, NULL, OPTV_NONE,
{0}, FALSE },
};
@@ -2097,11 +2143,11 @@ configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor)
return FALSE;
}
- /* Check wether this Monitor accepts Reduced Blanking modelines */
xf86ProcessOptions(-1, monitorp->options, MonitorOptions);
-
xf86GetOptValBool(MonitorOptions, MON_REDUCEDBLANKING,
&monitorp->reducedblanking);
+ xf86GetOptValFreq(MonitorOptions, MON_MAX_PIX_CLOCK, OPTUNITS_KHZ,
+ &monitorp->maxPixClock);
return TRUE;
}