biome: 1.9.2 -> 1.9.3
[NixPkgs.git] / pkgs / tools / X11 / bumblebee / nixos.patch
blobcf6ee5add98f3f383a5c04e3b5b8bbd758f14247
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.
7 # BusID "PCI:01:00:0"
9 +@nouveauDeviceOptions@
10 EndSection
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@
23 EndSection
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;
34 + char *mod_path;
35 + int pathlen = strlen(bb_config.mod_path);
36 + if (pathlen == 0) {
37 + mod_path = mod_appends;
38 + } else {
39 + mod_path = malloc(pathlen + 1 + sizeof(mod_appends));
40 + if (!mod_path) {
41 + set_bb_error("Could not allocate memory for modules path\n");
42 + return false;
43 + }
44 + strcpy(mod_path, bb_config.mod_path);
45 + mod_path[pathlen] = ',';
46 + strcpy(mod_path + pathlen + 1, mod_appends);
47 + }
49 char *x_argv[] = {
50 XORG_BINARY,
51 bb_config.x_display,
52 @@ -153,24 +170,24 @@ bool start_secondary(bool need_secondary) {
53 "-sharevts",
54 "-nolisten", "tcp",
55 "-noreset",
56 + "-logfile", "/var/log/X.bumblebee.log",
57 "-verbose", "3",
58 "-isolateDevice", pci_id,
59 - "-modulepath", bb_config.mod_path, // keep last
60 + "-modulepath", mod_path,
61 NULL
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
66 - }
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;}
70 //create a new pipe
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);
74 return false;
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;}