From b04aff76ac2eb461c71b85525a00e25efb8bf267 Mon Sep 17 00:00:00 2001 From: Michal Suchanek Date: Thu, 13 Oct 2011 17:14:53 +0200 Subject: [PATCH 1/4] Document -background none option Document option introduced in commit 8976e97. Signed-off-by: Michal Suchanek Reviewed-by: Jeremy Huddleston Reviewed-by: Alan Coopersmith --- man/Xserver.man | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/man/Xserver.man b/man/Xserver.man index 1a36b0956..fe2433766 100644 --- a/man/Xserver.man +++ b/man/Xserver.man @@ -100,6 +100,12 @@ specifies a file which contains a collection of authorization records used to authenticate access. See also the \fIxdm\fP(1) and \fIXsecurity\fP(__miscmansuffix__) manual pages. .TP 8 +.BI \-background\ none +Asks the driver not to clear the background on startup, if the driver supports that. +May be useful for smooth transition with eg. fbdev driver. +For security reasons this is not the default as the screen contents might +show a previous user session. +.TP 8 .B \-br sets the default root window to solid black instead of the standard root weave pattern. This is the default unless -retro or -wr is specified. From 0d4bb5442ceb8e8e4a8de6cfc4203cae469eee72 Mon Sep 17 00:00:00 2001 From: Michal Suchanek Date: Sat, 8 Oct 2011 14:13:33 +0200 Subject: [PATCH 2/4] Unload submodules. Signed-off-by: Michal Suchanek Reviewed-by: Peter Hutterer --- hw/xfree86/common/xf86Helper.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c index a8aa316ae..4e9bcad21 100644 --- a/hw/xfree86/common/xf86Helper.c +++ b/hw/xfree86/common/xf86Helper.c @@ -1643,13 +1643,7 @@ xf86LoadOneModule(char *name, pointer opt) void xf86UnloadSubModule(pointer mod) { - /* - * This is disabled for now. The loader isn't smart enough yet to undo - * relocations. - */ -#if 0 UnloadSubModule(mod); -#endif } Bool From 24d435163eb5fbd9b73cd8ba13a9b3cdbbe8a1df Mon Sep 17 00:00:00 2001 From: Michal Suchanek Date: Sat, 8 Oct 2011 14:19:34 +0200 Subject: [PATCH 3/4] Use UnloadModuleOrDriver for UnloadSubModule. Signed-off-by: Michal Suchanek Reviewed-by: Peter Hutterer --- hw/xfree86/loader/loadmod.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c index 9f820993a..2e6c667c2 100644 --- a/hw/xfree86/loader/loadmod.c +++ b/hw/xfree86/loader/loadmod.c @@ -1072,7 +1072,10 @@ UnloadModuleOrDriver(ModuleDescPtr mod) if (mod == NULL || mod->name == NULL) return; - xf86MsgVerb(X_INFO, 3, "UnloadModule: \"%s\"\n", mod->name); + if (mod->parent) + xf86MsgVerb(X_INFO, 3, "UnloadSubModule: \"%s\"\n", mod->name); + else + xf86MsgVerb(X_INFO, 3, "UnloadModule: \"%s\"\n", mod->name); if ((mod->TearDownProc) && (mod->TearDownData)) mod->TearDownProc(mod->TearDownData); @@ -1092,23 +1095,8 @@ UnloadSubModule(pointer _mod) { ModuleDescPtr mod = (ModuleDescPtr)_mod; - if (mod == NULL || mod->name == NULL) - return; - - xf86MsgVerb(X_INFO, 3, "UnloadSubModule: \"%s\"\n", mod->name); - - if ((mod->TearDownProc) && (mod->TearDownData)) - mod->TearDownProc(mod->TearDownData); - LoaderUnload(mod->name, mod->handle); - RemoveChild(mod); - - if (mod->child) - UnloadModuleOrDriver(mod->child); - - free(mod->path); - free(mod->name); - free(mod); + UnloadModuleOrDriver(mod); } static void @@ -1135,6 +1123,7 @@ RemoveChild(ModuleDescPtr child) } if (mdp == child) prevsib->sib = child->sib; + child->sib = NULL; return; } From df0dd36deea0c756819825113e825059ddd19243 Mon Sep 17 00:00:00 2001 From: Michal Suchanek Date: Sat, 8 Oct 2011 14:26:24 +0200 Subject: [PATCH 4/4] Do not uselessly reload modules in DuplicateModule The function does not initialize the module so it has no business loading it. If some user of DuplicateModule expects a module actually loaded they should use LoadModule. Signed-off-by: Michal Suchanek Reviewed-by: Peter Hutterer --- hw/xfree86/loader/loadmod.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c index 2e6c667c2..a21f43d63 100644 --- a/hw/xfree86/loader/loadmod.c +++ b/hw/xfree86/loader/loadmod.c @@ -94,6 +94,8 @@ const ModuleVersions LoaderVersionInfo = { ABI_FONT_VERSION }; +static int ModuleDuplicated[] = {}; + static void FreeStringList(char **paths) { @@ -785,7 +787,6 @@ ModuleDescPtr DuplicateModule(ModuleDescPtr mod, ModuleDescPtr parent) { ModuleDescPtr ret; - int errmaj, errmin; if (!mod) return NULL; @@ -794,14 +795,11 @@ DuplicateModule(ModuleDescPtr mod, ModuleDescPtr parent) if (ret == NULL) return NULL; - if (!(ret->handle = LoaderOpen(mod->path, &errmaj, &errmin))) { - free(ret); - return NULL; - } + ret->handle = mod->handle; ret->SetupProc = mod->SetupProc; ret->TearDownProc = mod->TearDownProc; - ret->TearDownData = NULL; + ret->TearDownData = ModuleDuplicated; ret->child = DuplicateModule(mod->child, ret); ret->sib = DuplicateModule(mod->sib, parent); ret->parent = parent; @@ -1077,9 +1075,11 @@ UnloadModuleOrDriver(ModuleDescPtr mod) else xf86MsgVerb(X_INFO, 3, "UnloadModule: \"%s\"\n", mod->name); - if ((mod->TearDownProc) && (mod->TearDownData)) - mod->TearDownProc(mod->TearDownData); - LoaderUnload(mod->name, mod->handle); + if (mod->TearDownData != ModuleDuplicated) { + if ((mod->TearDownProc) && (mod->TearDownData)) + mod->TearDownProc(mod->TearDownData); + LoaderUnload(mod->name, mod->handle); + } if (mod->child) UnloadModuleOrDriver(mod->child);