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.c196
1 files changed, 126 insertions, 70 deletions
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 986244557..6369d6dda 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -132,9 +132,9 @@ static Bool configInput(IDevPtr inputp, XF86ConfInputPtr conf_input,
static Bool configDisplay(DispPtr displayp, XF86ConfDisplayPtr conf_display);
static Bool addDefaultModes(MonPtr monitorp);
#ifdef XF86DRI
-static Bool configDRI(XF86ConfDRIPtr drip);
+static void configDRI(XF86ConfDRIPtr drip);
#endif
-static Bool configExtensions(XF86ConfExtensionsPtr conf_ext);
+static void configExtensions(XF86ConfExtensionsPtr conf_ext);
/*
* xf86GetPathElem --
@@ -255,6 +255,7 @@ xf86ModulelistFromConfig(pointer **optlist)
char *ignore[] = { "GLcore", "speedo", "bitmap", "drm", NULL };
pointer *optarray;
XF86LoadPtr modp;
+ Bool found;
/*
* make sure the config file has been parsed and that we have a
@@ -267,35 +268,76 @@ xf86ModulelistFromConfig(pointer **optlist)
}
if (xf86configptr->conf_modules) {
- /*
- * Walk the list of modules in the "Module" section to determine how
- * many we have.
- */
- modp = xf86configptr->conf_modules->mod_load_lst;
- while (modp) {
- for (i = 0; ignore[i]; i++) {
- if (strcmp(modp->load_name, ignore[i]) == 0)
- modp->ignore = 1;
+ /* Walk the disable list and let people know what we've parsed to
+ * not be loaded
+ */
+ modp = xf86configptr->conf_modules->mod_disable_lst;
+ while (modp) {
+ xf86Msg(X_WARNING, "\"%s\" will not be loaded unless you've specified it to be loaded elsewhere.\n", modp->load_name);
+ modp = (XF86LoadPtr) modp->list.next;
+ }
+ /*
+ * Walk the default settings table. For each module listed to be
+ * loaded, make sure it's in the mod_load_lst. If it's not, make
+ * sure it's not in the mod_no_load_lst. If it's not disabled,
+ * append it to mod_load_lst
+ */
+ for (i=0 ; ModuleDefaults[i].name != NULL ; i++) {
+ if (ModuleDefaults[i].toLoad == FALSE) {
+ xf86Msg(X_WARNING, "\"%s\" is not to be loaded by default. Skipping.\n", ModuleDefaults[i].name);
+ continue;
}
- if (!modp->ignore)
- count++;
- modp = (XF86LoadPtr) modp->list.next;
- }
+ found = FALSE;
+ modp = xf86configptr->conf_modules->mod_load_lst;
+ while (modp) {
+ if (strcmp(modp->load_name, ModuleDefaults[i].name) == 0) {
+ xf86Msg(X_INFO, "\"%s\" will be loaded. This was enabled by default and also specified in the config file.\n", ModuleDefaults[i].name);
+ found = TRUE;
+ break;
+ }
+ modp = (XF86LoadPtr) modp->list.next;
+ }
+ if (found == FALSE) {
+ modp = xf86configptr->conf_modules->mod_disable_lst;
+ while (modp) {
+ if (strcmp(modp->load_name, ModuleDefaults[i].name) == 0) {
+ xf86Msg(X_INFO, "\"%s\" will be loaded even though the default is to disable it.\n", ModuleDefaults[i].name);
+ found = TRUE;
+ break;
+ }
+ modp = (XF86LoadPtr) modp->list.next;
+ }
+ }
+ if (found == FALSE) {
+ XF86ConfModulePtr ptr = xf86configptr->conf_modules;
+ ptr = xf86addNewLoadDirective(ptr, ModuleDefaults[i].name, XF86_LOAD_MODULE, ModuleDefaults[i].load_opt);
+ xf86Msg(X_INFO, "\"%s\" will be loaded by default.\n", ModuleDefaults[i].name);
+ }
+ }
} else {
xf86configptr->conf_modules = xnfcalloc(1, sizeof(XF86ConfModuleRec));
+ for (i=0 ; ModuleDefaults[i].name != NULL ; i++) {
+ if (ModuleDefaults[i].toLoad == TRUE) {
+ XF86ConfModulePtr ptr = xf86configptr->conf_modules;
+ ptr = xf86addNewLoadDirective(ptr, ModuleDefaults[i].name, XF86_LOAD_MODULE, ModuleDefaults[i].load_opt);
+ }
+ }
}
- if (count == 0) {
- XF86ConfModulePtr ptr = xf86configptr->conf_modules;
- ptr = xf86addNewLoadDirective(ptr, "extmod", XF86_LOAD_MODULE, NULL);
- ptr = xf86addNewLoadDirective(ptr, "dbe", XF86_LOAD_MODULE, NULL);
- ptr = xf86addNewLoadDirective(ptr, "glx", XF86_LOAD_MODULE, NULL);
- ptr = xf86addNewLoadDirective(ptr, "freetype", XF86_LOAD_MODULE, NULL);
- ptr = xf86addNewLoadDirective(ptr, "type1", XF86_LOAD_MODULE, NULL);
- ptr = xf86addNewLoadDirective(ptr, "record", XF86_LOAD_MODULE, NULL);
- ptr = xf86addNewLoadDirective(ptr, "dri", XF86_LOAD_MODULE, NULL);
- count = 7;
- }
+ /*
+ * Walk the list of modules in the "Module" section to determine how
+ * many we have.
+ */
+ modp = xf86configptr->conf_modules->mod_load_lst;
+ while (modp) {
+ for (i = 0; ignore[i]; i++) {
+ if (strcmp(modp->load_name, ignore[i]) == 0)
+ modp->ignore = 1;
+ }
+ if (!modp->ignore)
+ count++;
+ modp = (XF86LoadPtr) modp->list.next;
+ }
/*
* allocate the memory and walk the list again to fill in the pointers
@@ -304,22 +346,22 @@ xf86ModulelistFromConfig(pointer **optlist)
optarray = xnfalloc((count + 1) * sizeof(pointer));
count = 0;
if (xf86configptr->conf_modules) {
- modp = xf86configptr->conf_modules->mod_load_lst;
- while (modp) {
+ modp = xf86configptr->conf_modules->mod_load_lst;
+ while (modp) {
if (!modp->ignore) {
- modulearray[count] = modp->load_name;
- optarray[count] = modp->load_opt;
- count++;
+ modulearray[count] = modp->load_name;
+ optarray[count] = modp->load_opt;
+ count++;
}
- modp = (XF86LoadPtr) modp->list.next;
- }
+ modp = (XF86LoadPtr) modp->list.next;
+ }
}
modulearray[count] = NULL;
optarray[count] = NULL;
if (optlist)
- *optlist = optarray;
+ *optlist = optarray;
else
- xfree(optarray);
+ xfree(optarray);
return modulearray;
}
@@ -557,7 +599,7 @@ xf86ConfigError(char *msg, ...)
return;
}
-static Bool
+static void
configFiles(XF86ConfFilesPtr fileconf)
{
MessageType pathFrom = X_DEFAULT;
@@ -566,16 +608,24 @@ configFiles(XF86ConfFilesPtr fileconf)
char *log_buf;
/* FontPath */
-
/* Try XF86Config FontPath first */
if (!xf86fpFlag) {
if (fileconf) {
if (fileconf->file_fontpath) {
char *f = xf86ValidateFontPath(fileconf->file_fontpath);
pathFrom = X_CONFIG;
- if (*f)
- defaultFontPath = f;
- else {
+ if (*f) {
+ if (xf86Info.useDefaultFontPath) {
+ xf86Msg(X_DEFAULT, "Including the default font path %s.\n", defaultFontPath);
+ char *g = xnfalloc(strlen(defaultFontPath) + strlen(f) + 3);
+ strcpy(g, f);
+ strcat(g, ",");
+ defaultFontPath = strcat(g, defaultFontPath);
+ xfree(f);
+ } else {
+ defaultFontPath = f;
+ }
+ } else {
xf86Msg(X_WARNING,
"FontPath is completely invalid. Using compiled-in default.\n");
fontPath = NULL;
@@ -583,7 +633,7 @@ configFiles(XF86ConfFilesPtr fileconf)
}
}
} else {
- xf86Msg(X_WARNING,
+ xf86Msg(X_DEFAULT,
"No FontPath specified. Using compiled-in default.\n");
pathFrom = X_DEFAULT;
}
@@ -703,7 +753,7 @@ configFiles(XF86ConfFilesPtr fileconf)
}
#endif
- return TRUE;
+ return;
}
typedef enum {
@@ -743,6 +793,7 @@ typedef enum {
FLAG_AIGLX,
FLAG_IGNORE_ABI,
FLAG_ALLOW_EMPTY_INPUT,
+ FLAG_USE_DEFAULT_FONT_PATH
} FlagValues;
static OptionInfoRec FlagOptions[] = {
@@ -818,6 +869,8 @@ static OptionInfoRec FlagOptions[] = {
{0}, FALSE },
{ FLAG_IGNORE_ABI, "IgnoreABI", OPTV_BOOLEAN,
{0}, FALSE },
+ { FLAG_USE_DEFAULT_FONT_PATH, "UseDefaultFontPath", OPTV_BOOLEAN,
+ {0}, FALSE },
{ -1, NULL, OPTV_NONE,
{0}, FALSE },
};
@@ -1017,6 +1070,13 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
if (xf86GetOptValBool(FlagOptions, FLAG_ALLOW_EMPTY_INPUT, &value))
xf86Info.allowEmptyInput = TRUE;
+ xf86Info.useDefaultFontPath = TRUE;
+ xf86Info.useDefaultFontPathFrom = X_DEFAULT;
+ if (xf86GetOptValBool(FlagOptions, FLAG_USE_DEFAULT_FONT_PATH, &value)) {
+ xf86Info.useDefaultFontPath = value;
+ xf86Info.useDefaultFontPathFrom = X_CONFIG;
+ }
+
/* Make sure that timers don't overflow CARD32's after multiplying */
#define MAX_TIME_IN_MIN (0x7fffffff / MILLI_PER_MIN)
@@ -1272,7 +1332,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
(count + 1) * sizeof(IDevRec));
indp[count - 1] = Pointer;
indp[count - 1].extraOptions =
- xf86addNewOption(NULL, "CorePointer", NULL);
+ xf86addNewOption(NULL, xnfstrdup("CorePointer"), NULL);
indp[count].identifier = NULL;
servlayoutp->inputs = indp;
}
@@ -1288,9 +1348,13 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
* always synthesize a 'mouse' section configured to send core
* events, unless a 'void' section is found, in which case the user
* probably wants to run footless.
+ *
+ * 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")) {
+ if (!strcmp(i->driver, "void") || !strcmp(i->driver, "mouse") ||
+ !strcmp(i->driver, "vmmouse") || !strcmp(i->driver, "evdev")) {
found = 1; break;
}
}
@@ -1307,7 +1371,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
(count + 1) * sizeof(IDevRec));
indp[count - 1] = Pointer;
indp[count - 1].extraOptions =
- xf86addNewOption(NULL, "AlwaysCore", NULL);
+ xf86addNewOption(NULL, xnfstrdup("AlwaysCore"), NULL);
indp[count].identifier = NULL;
servlayoutp->inputs = indp;
}
@@ -1398,7 +1462,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
(count + 1) * sizeof(IDevRec));
indp[count - 1] = Keyboard;
indp[count - 1].extraOptions =
- xf86addNewOption(NULL, "CoreKeyboard", NULL);
+ xf86addNewOption(NULL, xnfstrdup("CoreKeyboard"), NULL);
indp[count].identifier = NULL;
servlayoutp->inputs = indp;
}
@@ -1411,13 +1475,13 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
}
if (pointerMsg) {
- xf86Msg(X_WARNING, "The core pointer device wasn't specified "
+ xf86Msg(X_DEFAULT, "The core pointer device wasn't specified "
"explicitly in the layout.\n"
"\tUsing the %s.\n", pointerMsg);
}
if (keyboardMsg) {
- xf86Msg(X_WARNING, "The core keyboard device wasn't specified "
+ xf86Msg(X_DEFAULT, "The core keyboard device wasn't specified "
"explicitly in the layout.\n"
"\tUsing the %s.\n", keyboardMsg);
}
@@ -1746,7 +1810,7 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen)
indp = xnfalloc(sizeof(IDevRec));
indp->identifier = NULL;
servlayoutp->inputs = indp;
- if (!xf86Info.allowEmptyInput && checkCoreInputDevices(servlayoutp, TRUE))
+ if (!xf86Info.allowEmptyInput && !checkCoreInputDevices(servlayoutp, TRUE))
return FALSE;
return TRUE;
@@ -1874,7 +1938,7 @@ configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum,
}
if (defaultMonitor) {
- xf86Msg(X_WARNING, "No monitor specified for screen \"%s\".\n"
+ xf86Msg(X_DEFAULT, "No monitor specified for screen \"%s\".\n"
"\tUsing a default monitor configuration.\n", screenp->id);
}
return TRUE;
@@ -2165,7 +2229,7 @@ configDevice(GDevPtr devicep, XF86ConfDevicePtr conf_device, Bool active)
}
#ifdef XF86DRI
-static Bool
+static void
configDRI(XF86ConfDRIPtr drip)
{
int count = 0;
@@ -2206,12 +2270,10 @@ configDRI(XF86ConfDRIPtr drip)
xf86ConfigDRI.bufs[i].flags = 0;
}
}
-
- return TRUE;
}
#endif
-static Bool
+static void
configExtensions(XF86ConfExtensionsPtr conf_ext)
{
XF86OptionPtr o;
@@ -2246,11 +2308,9 @@ configExtensions(XF86ConfExtensionsPtr conf_ext)
xf86NameCmp(val, "false") == 0) {
enable = !enable;
} else {
- xf86Msg(X_ERROR,
- "%s is not a valid value for the Extension option\n",
- val);
+ xf86Msg(X_WARNING, "Ignoring unrecognized value \"%s\"\n", val);
xfree(n);
- return FALSE;
+ continue;
}
if (EnableDisableExtension(name, enable)) {
@@ -2263,8 +2323,6 @@ configExtensions(XF86ConfExtensionsPtr conf_ext)
xfree(n);
}
}
-
- return TRUE;
}
static Bool
@@ -2394,7 +2452,7 @@ xf86HandleConfigFile(Bool autoconfig)
if (xf86configptr->conf_layout_lst == NULL || xf86ScreenName != NULL) {
if (xf86ScreenName == NULL) {
- xf86Msg(X_WARNING,
+ xf86Msg(X_DEFAULT,
"No Layout section. Using the first Screen section.\n");
}
if (!configImpliedLayout(&xf86ConfigLayout,
@@ -2448,19 +2506,17 @@ xf86HandleConfigFile(Bool autoconfig)
}
/* Now process everything else */
-
- if (!configFiles(xf86configptr->conf_files) ||
- !configServerFlags(xf86configptr->conf_flags,
- xf86ConfigLayout.options) ||
- !configExtensions(xf86configptr->conf_extensions)
-#ifdef XF86DRI
- || !configDRI(xf86configptr->conf_dri)
-#endif
- ) {
+ if (!configServerFlags(xf86configptr->conf_flags,xf86ConfigLayout.options)){
ErrorF ("Problem when converting the config data structures\n");
return CONFIG_PARSE_ERROR;
}
+ configFiles(xf86configptr->conf_files);
+ configExtensions(xf86configptr->conf_extensions);
+#ifdef XF86DRI
+ configDRI(xf86configptr->conf_dri);
+#endif
+
checkInput(&xf86ConfigLayout);
/*