summaryrefslogtreecommitdiff
path: root/hw/xfree86/common
diff options
context:
space:
mode:
authorHans De Goede <hdegoede@redhat.com>2016-12-12 17:03:17 +0100
committerTimo Aaltonen <tjaalton@debian.org>2018-02-13 10:32:45 +0200
commitecd9d73f2af51885c5aa17e73d747663a2689a49 (patch)
treeddba2944fc2ef8ef0ecd64977381f5df39ae33a5 /hw/xfree86/common
parent58462152ac7e64641ca2ea6480bbb7a08e9022c7 (diff)
xfree86: Add ModulePath support for OutputClass config Sections
Allow OutputClass config snippets to modify the module-path. Note that any specified ModulePaths will be pre-pended to the normal ModulePath. The idea behind this is that any output hardware specific modules should have preference over the normal modules. One use-case for this is the nvidia binary driver, this allows a config snippet like this: Section "OutputClass" MatchDriver "nvidia" Modulepath "/usr/lib64/nvidia/modules" EndSection To get the nvidia glx specific glx module loaded, but only when the nvidia kernel driver is loaded. Together with the glvnd work done recently, this allows the nouveau + mesa and nvidia-binary userspace stacks to co-exist on the same system without any ldconfig / xorg.conf tweaking and the xserver will automatically do the right thing depending on which kernel driver (nouveau or nvidia) is loaded. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> (cherry picked from commit b5dffbbac193aa640ffcfa0a431c21b862854e53)
Diffstat (limited to 'hw/xfree86/common')
-rw-r--r--hw/xfree86/common/xf86platformBus.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index fc17d1504..0b5795fe7 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -40,6 +40,7 @@
#include "hotplug.h"
#include "systemd-logind.h"
+#include "loaderProcs.h"
#include "xf86.h"
#include "xf86_OSproc.h"
#include "xf86Priv.h"
@@ -287,6 +288,7 @@ xf86platformProbe(void)
int i;
Bool pci = TRUE;
XF86ConfOutputClassPtr cl;
+ char *old_path, *path = NULL;
config_odev_probe(xf86PlatformDeviceProbe);
@@ -300,8 +302,29 @@ xf86platformProbe(void)
if (pci && (strncmp(busid, "pci:", 4) == 0)) {
platform_find_pci_info(&xf86_platform_devices[i], busid);
}
+
+ /*
+ * Deal with OutputClass ModulePath directives, these must be
+ * processed before we do any module loading.
+ */
+ for (cl = xf86configptr->conf_outputclass_lst; cl; cl = cl->list.next) {
+ if (!OutputClassMatches(cl, &xf86_platform_devices[i]))
+ continue;
+
+ if (cl->modulepath && xf86ModPathFrom != X_CMDLINE) {
+ old_path = path;
+ XNFasprintf(&path, "%s,%s", cl->modulepath,
+ path ? path : xf86ModulePath);
+ free(old_path);
+ xf86Msg(X_CONFIG, "OutputClass \"%s\" ModulePath extended to \"%s\"\n",
+ cl->identifier, path);
+ LoaderSetPath(path);
+ }
+ }
}
+ free(path);
+
/* First see if there is an OutputClass match marking a device as primary */
for (i = 0; i < xf86_num_platform_devices; i++) {
struct xf86_platform_device *dev = &xf86_platform_devices[i];