1 diff --git a/conf/xorg.conf.nouveau b/conf/xorg.conf.nouveau
2 index 87e48cb..60d6eaf 100644
3 --- a/conf/xorg.conf.nouveau
4 +++ b/conf/xorg.conf.nouveau
5 @@ -15,4 +15,5 @@ Section "Device"
6 # This Setting is needed on Ubuntu 13.04.
9 +@nouveauDeviceOptions@
11 diff --git a/conf/xorg.conf.nvidia b/conf/xorg.conf.nvidia
12 index c3107f9..17072f4 100644
13 --- a/conf/xorg.conf.nvidia
14 +++ b/conf/xorg.conf.nvidia
15 @@ -29,6 +29,6 @@ Section "Device"
16 Option "ProbeAllGpus" "false"
18 Option "NoLogo" "true"
19 - Option "UseEDID" "false"
20 - Option "UseDisplayDevice" "none"
22 +@nvidiaDeviceOptions@
24 diff --git a/src/bbsecondary.c b/src/bbsecondary.c
25 index 71a6b73..a682d8a 100644
26 --- a/src/bbsecondary.c
27 +++ b/src/bbsecondary.c
28 @@ -145,6 +145,23 @@ bool start_secondary(bool need_secondary) {
31 bb_log(LOG_INFO, "Starting X server on display %s.\n", bb_config.x_display);
32 + const char mod_appends[] = X_MODULE_APPENDS;
35 + int pathlen = strlen(bb_config.mod_path);
37 + mod_path = mod_appends;
39 + mod_path = malloc(pathlen + 1 + sizeof(mod_appends));
41 + set_bb_error("Could not allocate memory for modules path\n");
44 + strcpy(mod_path, bb_config.mod_path);
45 + mod_path[pathlen] = ',';
46 + strcpy(mod_path + pathlen + 1, mod_appends);
52 @@ -153,24 +170,24 @@ bool start_secondary(bool need_secondary) {
56 + "-logfile", "/var/log/X.bumblebee.log",
58 "-isolateDevice", pci_id,
59 - "-modulepath", bb_config.mod_path, // keep last
60 + "-modulepath", mod_path,
63 enum {n_x_args = sizeof(x_argv) / sizeof(x_argv[0])};
64 - if (!*bb_config.mod_path) {
65 - x_argv[n_x_args - 3] = 0; //remove -modulepath if not set
67 //close any previous pipe, if it (still) exists
68 if (bb_status.x_pipe[0] != -1){close(bb_status.x_pipe[0]); bb_status.x_pipe[0] = -1;}
69 if (bb_status.x_pipe[1] != -1){close(bb_status.x_pipe[1]); bb_status.x_pipe[1] = -1;}
71 if (pipe2(bb_status.x_pipe, O_NONBLOCK | O_CLOEXEC)){
72 set_bb_error("Could not create output pipe for X");
73 + if (pathlen > 0) free(mod_path);
76 bb_status.x_pid = bb_run_fork_ld_redirect(x_argv, bb_config.ld_path, bb_status.x_pipe[1]);
77 + if (pathlen > 0) free(mod_path);
78 //close the end of the pipe that is not ours
79 if (bb_status.x_pipe[1] != -1){close(bb_status.x_pipe[1]); bb_status.x_pipe[1] = -1;}