summaryrefslogtreecommitdiff
path: root/hw/xfree86/common
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2012-07-10 02:02:58 +0100
committerKeith Packard <keithp@keithp.com>2012-07-09 23:06:41 -0700
commitd35884da2f5a250ff6dd5131dc23ac629eccdd0c (patch)
treef275fe8e409bda1b53db7544e43f0117d0a3df30 /hw/xfree86/common
parent4170e4e1f8e879394c896c490d9f08a38ecfdefd (diff)
Add xf86ExtensionInit for DDX extension configuration
xf86ExtensionInit is called after configuration file parsing, so it can perform the two parts of extension initialisation currently done by extmod: enabling and disabling of extensions through an 'omit' option, and SELinux configuration. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'hw/xfree86/common')
-rw-r--r--hw/xfree86/common/Makefile.am1
-rw-r--r--hw/xfree86/common/xf86.h3
-rw-r--r--hw/xfree86/common/xf86Extensions.c82
-rw-r--r--hw/xfree86/common/xf86Init.c2
4 files changed, 88 insertions, 0 deletions
diff --git a/hw/xfree86/common/Makefile.am b/hw/xfree86/common/Makefile.am
index 5fbb89095..556b9ccc7 100644
--- a/hw/xfree86/common/Makefile.am
+++ b/hw/xfree86/common/Makefile.am
@@ -46,6 +46,7 @@ libcommon_la_SOURCES = xf86Configure.c xf86Bus.c xf86Config.c \
xf86VidMode.c xf86fbman.c xf86cmap.c \
xf86Helper.c xf86PM.c xf86Xinput.c xisb.c \
xf86Mode.c xorgHelper.c xf86Extensions.h \
+ xf86Extensions.c \
$(XVSOURCES) $(BUSSOURCES) $(RANDRSOURCES)
nodist_libcommon_la_SOURCES = xf86DefModeSet.c xf86Build.h
libcommon_la_LIBADD = $(top_builddir)/config/libconfig.la
diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h
index 1e122cf6a..8dc7dcccf 100644
--- a/hw/xfree86/common/xf86.h
+++ b/hw/xfree86/common/xf86.h
@@ -449,6 +449,9 @@ xf86RandRSetNewVirtualAndDimensions(ScreenPtr pScreen,
Bool resetMode);
#endif
+/* xf86Extensions.c */
+extern void xf86ExtensionInit(void);
+
/* convert ScreenPtr to ScrnInfoPtr */
extern _X_EXPORT ScrnInfoPtr xf86ScreenToScrn(ScreenPtr pScreen);
/* convert ScrnInfoPtr to ScreenPtr */
diff --git a/hw/xfree86/common/xf86Extensions.c b/hw/xfree86/common/xf86Extensions.c
new file mode 100644
index 000000000..15c96b444
--- /dev/null
+++ b/hw/xfree86/common/xf86Extensions.c
@@ -0,0 +1,82 @@
+/*
+ * Copyright © 2011 Daniel Stone
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Author: Daniel Stone <daniel@fooishbar.org>
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "extension.h"
+#include "globals.h"
+
+#include "xf86.h"
+#include "xf86Config.h"
+#include "xf86Module.h"
+#include "xf86Extensions.h"
+#include "xf86Opt.h"
+#include "optionstr.h"
+
+/*
+ * DDX-specific extensions.
+ */
+static ExtensionModule extensionModules[] = {
+};
+
+static void
+load_extension_config(void)
+{
+ XF86ConfModulePtr mod_con = xf86configptr->conf_modules;
+ XF86LoadPtr modp;
+
+ /* Only the best. */
+ if (!mod_con)
+ return;
+
+ nt_list_for_each_entry(modp, mod_con->mod_load_lst, list.next) {
+ InputOption *opt;
+
+ if (strcasecmp(modp->load_name, "extmod") != 0)
+ continue;
+
+ /* extmod options are of the form "omit <extension-name>" */
+ nt_list_for_each_entry(opt, modp->load_opt, list.next) {
+ const char *key = input_option_get_key(opt);
+ if (strncasecmp(key, "omit", 4) != 0 || strlen(key) < 5)
+ continue;
+ if (EnableDisableExtension(key + 4, FALSE))
+ xf86MarkOptionUsed(opt);
+ }
+ }
+}
+
+void
+xf86ExtensionInit(void)
+{
+ int i;
+
+ load_extension_config();
+
+ for (i = 0; i < ARRAY_SIZE(extensionModules); i++)
+ LoadExtension(&extensionModules[i], TRUE);
+}
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 058d09f56..16991b38b 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -471,6 +471,8 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
xf86OSPMClose = xf86OSPMOpen();
#endif
+ xf86ExtensionInit();
+
/* Load all modules specified explicitly in the config file */
if ((modulelist = xf86ModulelistFromConfig(&optionlist))) {
xf86LoadModules(modulelist, optionlist);