add patches and fixes [release 3.2.1-3mamba;Tue Nov 01 2022]

This commit is contained in:
Silvan Calarco 2024-01-05 21:02:00 +01:00
parent cd5c8ff90d
commit f761a4e46b
10 changed files with 437 additions and 19 deletions

View File

@ -0,0 +1,24 @@
From 5636b24fa86a005a5d2e30bd794516db13ccba56 Mon Sep 17 00:00:00 2001
From: Abuzer Rafey <abuzer@rafey.ch>
Date: Tue, 8 Dec 2015 07:00:32 -0500
Subject: [PATCH] Dirty fix for issue #699
---
src/module.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/module.c b/src/module.c
index f7b99fa..6b6cb09 100644
--- a/src/module.c
+++ b/src/module.c
@@ -96,7 +96,9 @@ int module_unload(char *driver) {
int retries = 30;
bb_log(LOG_INFO, "Unloading %s driver\n", driver);
char *mod_argv[] = {
- "rmmod",
+ "modprobe",
+ "-r",
+ "nvidia_modeset",
driver,
NULL
};

View File

@ -0,0 +1,56 @@
From 09d537e8e5313cd0f2c7bf6620ca70454de8a04a Mon Sep 17 00:00:00 2001
From: Abuzer Rafey <abuzer@rafey.ch>
Date: Tue, 8 Dec 2015 12:01:05 -0500
Subject: [PATCH] Added nvidia_modeset detection for issue #699
---
src/module.c | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/src/module.c b/src/module.c
index 6b6cb09..eea0139 100644
--- a/src/module.c
+++ b/src/module.c
@@ -92,13 +92,15 @@ int module_load(char *module_name, char *driver) {
* @return 1 if the driver is succesfully unloaded, 0 otherwise
*/
int module_unload(char *driver) {
- if (module_is_loaded(driver) == 1) {
+
+ if (module_is_loaded(driver) == 1 &&
+ module_is_loaded("nvidia_modeset") == 1) {
int retries = 30;
bb_log(LOG_INFO, "Unloading %s driver\n", driver);
char *mod_argv[] = {
"modprobe",
"-r",
- "nvidia_modeset",
+ "nvidia-modeset",
driver,
NULL
};
@@ -111,6 +113,24 @@ int module_unload(char *driver) {
return 0;
}
}
+ else if (module_is_loaded(driver) == 1) {
+ int retries = 30;
+ bb_log(LOG_INFO, "Unloading %s driver\n", driver);
+ char *mod_argv[] = {
+ "modprobe",
+ "-r",
+ driver,
+ NULL
+ };
+ bb_run_fork_wait(mod_argv, 10);
+ while (retries-- > 0 && module_is_loaded(driver) == 1) {
+ usleep(100000);
+ }
+ if (module_is_loaded(driver) == 1) {
+ bb_log(LOG_ERR, "Unloading %s driver timed out.\n", driver);
+ return 0;
+ }
+ }
return 1;
}

View File

@ -0,0 +1,76 @@
From dbbf20a38aa2bffb10c4e8af583b34dff6bfe721 Mon Sep 17 00:00:00 2001
From: Abuzer Rafey <abuzer@rafey.ch>
Date: Wed, 9 Dec 2015 21:26:29 -0500
Subject: [PATCH] Fix nvidia_uvm just like nvidia_modeset
---
src/module.c | 35 +++++++++++++++++++++++++++--------
1 file changed, 27 insertions(+), 8 deletions(-)
diff --git a/src/module.c b/src/module.c
index eea0139..b5a4d79 100644
--- a/src/module.c
+++ b/src/module.c
@@ -93,19 +93,18 @@ int module_load(char *module_name, char *driver) {
*/
int module_unload(char *driver) {
- if (module_is_loaded(driver) == 1 &&
- module_is_loaded("nvidia_modeset") == 1) {
+ if (module_is_loaded("nvidia_uvm") == 1) {
int retries = 30;
- bb_log(LOG_INFO, "Unloading %s driver\n", driver);
+ bb_log(LOG_INFO, "Unloading nvidia_uvm driver\n");
char *mod_argv[] = {
"modprobe",
"-r",
- "nvidia-modeset",
- driver,
+ "nvidia_uvm",
+ "nvidia_modeset",
NULL
};
bb_run_fork_wait(mod_argv, 10);
- while (retries-- > 0 && module_is_loaded(driver) == 1) {
+ while (retries-- > 0 && module_is_loaded("nvidia_uvm") == 1) {
usleep(100000);
}
if (module_is_loaded(driver) == 1) {
@@ -113,7 +112,27 @@ int module_unload(char *driver) {
return 0;
}
}
- else if (module_is_loaded(driver) == 1) {
+
+ else if (module_is_loaded("nvidia_modeset") == 1) {
+ int retries = 30;
+ bb_log(LOG_INFO, "Unloading nvidia_modeset driver\n");
+ char *mod_argv[] = {
+ "modprobe",
+ "-r",
+ "nvidia_modeset",
+ NULL
+ };
+ bb_run_fork_wait(mod_argv, 10);
+ while (retries-- > 0 && module_is_loaded("nvidia_modeset") == 1) {
+ usleep(100000);
+ }
+ if (module_is_loaded(driver) == 1) {
+ bb_log(LOG_ERR, "Unloading %s driver timed out.\n", driver);
+ return 0;
+ }
+ }
+
+ else if (module_is_loaded(driver) == 1) {
int retries = 30;
bb_log(LOG_INFO, "Unloading %s driver\n", driver);
char *mod_argv[] = {
@@ -130,7 +149,7 @@ int module_unload(char *driver) {
bb_log(LOG_ERR, "Unloading %s driver timed out.\n", driver);
return 0;
}
- }
+ }
return 1;
}

View File

@ -0,0 +1,44 @@
From bcfe4dd16dd6194f1edbdc53b874a4f408343c5c Mon Sep 17 00:00:00 2001
From: Abuzer Rafey <abuzer@rafey.xyz>
Date: Wed, 13 Apr 2016 01:11:09 -0400
Subject: [PATCH] Workaround for nvidia_drm in newer drivers
---
src/module.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/src/module.c b/src/module.c
index b5a4d79..db9736a 100644
--- a/src/module.c
+++ b/src/module.c
@@ -113,6 +113,25 @@ int module_unload(char *driver) {
}
}
+ else if (module_is_loaded("nvidia_drm") == 1) {
+ int retries = 30;
+ bb_log(LOG_INFO, "Unloading nvidia_drm driver\n");
+ char *mod_argv[] = {
+ "modprobe",
+ "-r",
+ "nvidia_drm",
+ NULL
+ };
+ bb_run_fork_wait(mod_argv, 10);
+ while (retries-- > 0 && module_is_loaded("nvidia_drm") == 1) {
+ usleep(100000);
+ }
+ if (module_is_loaded(driver) == 1) {
+ bb_log(LOG_ERR, "Unloading %s driver timed out.\n", driver);
+ return 0;
+ }
+ }
+
else if (module_is_loaded("nvidia_modeset") == 1) {
int retries = 30;
bb_log(LOG_INFO, "Unloading nvidia_modeset driver\n");
@@ -175,3 +194,4 @@ int module_is_available(char *module_name) {
};
return bb_run_fork(mod_argv, 1) == EXIT_SUCCESS;
}
+

View File

@ -0,0 +1,109 @@
From fcfe596eb13f62ca9dd7de272a5a87ae843b2a00 Mon Sep 17 00:00:00 2001
From: Abuzer Rafey <abuzer@rafey.xyz>
Date: Wed, 13 Apr 2016 03:09:12 -0400
Subject: [PATCH] Simplify module_unload
---
src/module.c | 72 ++++++++++--------------------------------------------------
1 file changed, 12 insertions(+), 60 deletions(-)
diff --git a/src/module.c b/src/module.c
index db9736a..38e2daa 100644
--- a/src/module.c
+++ b/src/module.c
@@ -93,56 +93,27 @@ int module_load(char *module_name, char *driver) {
*/
int module_unload(char *driver) {
- if (module_is_loaded("nvidia_uvm") == 1) {
- int retries = 30;
- bb_log(LOG_INFO, "Unloading nvidia_uvm driver\n");
- char *mod_argv[] = {
- "modprobe",
- "-r",
- "nvidia_uvm",
- "nvidia_modeset",
- NULL
- };
- bb_run_fork_wait(mod_argv, 10);
- while (retries-- > 0 && module_is_loaded("nvidia_uvm") == 1) {
- usleep(100000);
- }
- if (module_is_loaded(driver) == 1) {
- bb_log(LOG_ERR, "Unloading %s driver timed out.\n", driver);
- return 0;
- }
- }
+ char uvm[] = "nvidia_uvm";
+ char drm[] = "nvidia_drm";
+ char modeset[] = "nvidia_modeset";
+ int uvm_is_loaded = module_is_loaded(uvm);
+ int drm_is_loaded = module_is_loaded(drm);
+ int modeset_is_loaded = module_is_loaded(modeset);
- else if (module_is_loaded("nvidia_drm") == 1) {
+ if (uvm_is_loaded || drm_is_loaded || modeset_is_loaded || *driver == 1) {
int retries = 30;
- bb_log(LOG_INFO, "Unloading nvidia_drm driver\n");
+ bb_log(LOG_INFO, "Unloading UVM/DRM/MODESET driver\n");
char *mod_argv[] = {
"modprobe",
"-r",
+ "nvidia_uvm",
"nvidia_drm",
- NULL
- };
- bb_run_fork_wait(mod_argv, 10);
- while (retries-- > 0 && module_is_loaded("nvidia_drm") == 1) {
- usleep(100000);
- }
- if (module_is_loaded(driver) == 1) {
- bb_log(LOG_ERR, "Unloading %s driver timed out.\n", driver);
- return 0;
- }
- }
-
- else if (module_is_loaded("nvidia_modeset") == 1) {
- int retries = 30;
- bb_log(LOG_INFO, "Unloading nvidia_modeset driver\n");
- char *mod_argv[] = {
- "modprobe",
- "-r",
"nvidia_modeset",
+ driver,
NULL
};
bb_run_fork_wait(mod_argv, 10);
- while (retries-- > 0 && module_is_loaded("nvidia_modeset") == 1) {
+ while (retries-- > 0 && module_is_loaded(driver) == 1) {
usleep(100000);
}
if (module_is_loaded(driver) == 1) {
@@ -150,26 +121,7 @@ int module_unload(char *driver) {
return 0;
}
}
-
- else if (module_is_loaded(driver) == 1) {
- int retries = 30;
- bb_log(LOG_INFO, "Unloading %s driver\n", driver);
- char *mod_argv[] = {
- "modprobe",
- "-r",
- driver,
- NULL
- };
- bb_run_fork_wait(mod_argv, 10);
- while (retries-- > 0 && module_is_loaded(driver) == 1) {
- usleep(100000);
- }
- if (module_is_loaded(driver) == 1) {
- bb_log(LOG_ERR, "Unloading %s driver timed out.\n", driver);
- return 0;
- }
- }
- return 1;
+ return 1;
}
/**

View File

@ -0,0 +1,23 @@
From 2073f8537412aa47755eb6f3f22a114403e5285b Mon Sep 17 00:00:00 2001
From: Peter Wu <peter@lekensteyn.nl>
Date: Wed, 16 Apr 2014 18:19:01 +0200
Subject: [PATCH] Fix devices with a bus larger than 9 (GH-573)
The `-isolateDevice` option accepts a PCI ID in decimal format, not hex.
---
src/bbsecondary.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/bbsecondary.c b/src/bbsecondary.c
index 71a6b73..6b635ee 100644
--- a/src/bbsecondary.c
+++ b/src/bbsecondary.c
@@ -138,7 +138,7 @@ bool start_secondary(bool need_secondary) {
if (!bb_is_running(bb_status.x_pid)) {
char pci_id[12];
static char *x_conf_file;
- snprintf(pci_id, 12, "PCI:%02x:%02x:%o", pci_bus_id_discrete->bus,
+ snprintf(pci_id, 12, "PCI:%02d:%02d:%o", pci_bus_id_discrete->bus,
pci_bus_id_discrete->slot, pci_bus_id_discrete->func);
if (!x_conf_file) {
x_conf_file = xorg_path_w_driver(bb_config.x_conf_file, bb_config.driver);

View File

@ -0,0 +1,15 @@
--- a/src/bblogger.c
+++ b/src/bblogger.c
@@ -144,7 +144,11 @@
/* Error lines are errors. */
if (strncmp(string, "(EE)", 4) == 0){
if (strstr(string, "Failed to load module \"kbd\"") ||
- strstr(string, "No input driver matching")) {
+ strstr(string, "Failed to load module \"mouse\"") ||
+ strstr(string, "failed to set DRM interface version 1.4:") ||
+ strstr(string, "No input driver matching") ||
+ strstr(string, "systemd-logind: failed to get session:") ||
+ strstr(string, "Server terminated successfully")) {
/* non-fatal errors */
prio = LOG_DEBUG;
} else {

View File

@ -0,0 +1,26 @@
From c3ccbb7f6dd00038b1cb328898a29583e3a6c9be Mon Sep 17 00:00:00 2001
From: SolarAquarion <shlomochoina@gmail.com>
Date: Sun, 19 Feb 2017 16:53:09 -0500
Subject: [PATCH] adding workaround for libglvnd
---
src/optirun.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/optirun.c b/src/optirun.c
index 65c83d4..ec72057 100644
--- a/src/optirun.c
+++ b/src/optirun.c
@@ -203,7 +203,11 @@ static int run_primus(int argc, char **argv) {
/* primus starts the X server when needed, fixes long-standing fork issue */
setenv("BUMBLEBEE_SOCKET", bb_config.socket_path, 1);
-
+
+/* primus needs this variable workaround for libglvnd enabled mesa */
+
+ setenv("__GLVND_DISALLOW_PATCHING", "1", 0);
+
/* set LD_LIBRARY_PATH to primus_ld_path plus ld_path plus current LD_LIBRARY_PATH */
setenv("PRIMUS_DISPLAY", bb_config.x_display, 0);
char *ldpath_cur = getenv("LD_LIBRARY_PATH");

6
bumblebee.conf Normal file
View File

@ -0,0 +1,6 @@
blacklist nvidia
blacklist nvidia-drm
blacklist nvidia-modeset
blacklist nvidia-uvm
blacklist nouveau

View File

@ -2,20 +2,28 @@
%define bumblebeeuserid 65430
Name: bumblebee
Version: 3.2.1
Release: 2mamba
Release: 3mamba
Summary: A project aiming to support NVIDIA Optimus technology under Linux.
Group: System/Kernel and Hardware
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: http://www.bumblebee-project.org
URL: https://www.bumblebee-project.org/
Source: http://bumblebee-project.org/bumblebee-%{version}.tar.gz
Source1: bumblebee.conf
Patch0: bumblebee-3.2.1-0001-bb_nvidia_modeset-detection_bug699_01.patch
Patch1: bumblebee-3.2.1-0002-bb_nvidia_modeset-detection_bug699_02.patch
Patch2: bumblebee-3.2.1-0003-bb_nvidia_umv_detection_bug699.patch
Patch3: bumblebee-3.2.1-0004-bb_nvidia_drm_detection_bug699_01.patch
Patch4: bumblebee-3.2.1-0005-bb_nvidia_drm_detection_bug699_02.patch
Patch5: bumblebee-3.2.1-0006-bb_hexadicimal_bug573.patch
Patch6: bumblebee-3.2.1-0007-bb_mutebblogger.patch
Patch7: bumblebee-3.2.1-0008-libglvnd.patch
License: GPL
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
BuildRequires: libbsd-devel
BuildRequires: libglib-devel
BuildRequires: libX11-devel
BuildRequires: libglib-devel
## AUTOBUILDREQ-END
Requires: virtualgl
BuildRoot: %{_tmppath}/%{name}-%{version}-root
@ -27,16 +35,41 @@ A project aiming to support NVIDIA Optimus technology under Linux.
%prep
%setup -q
%define _default_patch_fuzz 2
%patch0 -p1 -b .0001-bb_nvidia_modeset-detection_bug699_01
%patch1 -p1 -b .0002-bb_nvidia_modeset-detection_bug699_02
%patch2 -p1 -b .0003-bb_nvidia_umv_detection_bug699
%patch3 -p1 -b .0004-bb_nvidia_drm_detection_bug699_01
%patch4 -p1 -b .0005-bb_nvidia_drm_detection_bug699_02
%patch5 -p1 -b .0006-bb_hexadicimal_bug573
%patch6 -p1 -b .0007-bb_mutebblogger
%patch7 -p1 -b .0008-libglvnd
%build
%configure
export CFLAGS="%{optflags} -fcommon"
%configure \
CONF_DRIVER_MODULE_NVIDIA=nvidia \
--with-udev-rules=%{_udevrulesdir} \
--without-pidfile
%make
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%makeinstall
%makeinstall \
completiondir=%{_datadir}/bash-completion/completions
install -D -m0755 scripts/systemd/bumblebeed.service %{buildroot}%{_unitdir}/bumblebeed.service
#install -D -m0755 scripts/systemd/bumblebeed.service %{buildroot}%{_unitdir}/bumblebeed.service
install -D -m0755 %{SOURCE1} %{buildroot}%{_modprobedir}/bumblebee.conf
# Install systemd unit
install -D -m0644 scripts/systemd/bumblebeed.service %{buildroot}%{_unitdir}/bumblebeed.service
# Fixes for bash completion
mv -v %{buildroot}%{_datadir}/bash-completion/completions/{bumblebee,optirun}
sed -i "s/have/_have/" %{buildroot}%{_datadir}/bash-completion/completions/optirun
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
@ -47,41 +80,47 @@ if [ $1 -ge 1 ]; then
/usr/sbin/useradd -u %{bumblebeeuserid} -c 'Bumblebee user' -d /dev/null -g bumblebee \
-s /bin/false bumblebee 2>/dev/null
fi
exit 0
%post
if [ $1 -ge 1 ]; then
systemctl -q daemon-reload
fi
:
%preun
%systemd_preun bumblebeed.service
if [ $1 -eq 0 ]; then
/usr/sbin/groupdel bumblebee 2>/dev/null
/usr/sbin/userdel bumblebee 2>/dev/null
fi
exit 0
:
%post
%systemd_post bumblebeed.service
:
%postun
%systemd_postun bumblebeed.service
:
%files
%defattr(-,root,root)
%config(noreplace) %{_sysconfdir}/bumblebee/bumblebee.conf
%{_sysconfdir}/bash_completion.d/bumblebee
%{_sysconfdir}/bumblebee/xorg.conf.d/10-dummy.conf
#%{_sysconfdir}/bumblebee/xorg.conf.d/busid.conf
%{_sysconfdir}/bumblebee/xorg.conf.nouveau
%{_sysconfdir}/bumblebee/xorg.conf.nvidia
%{_bindir}/bumblebee-bugreport
%{_bindir}/optirun
%{_sbindir}/bumblebeed
%{_unitdir}/bumblebeed.service
/lib/udev/rules.d/99-bumblebee-nvidia-dev.rules
%{_modprobedir}/bumblebee.conf
%{_udevrulesdir}/99-bumblebee-nvidia-dev.rules
%{_datadir}/bash-completion/completions/optirun
%{_datadir}/doc/bumblebee/README.markdown
%{_datadir}/doc/bumblebee/RELEASE_NOTES_*
%{_mandir}/man1/bumblebeed.1.gz
%{_mandir}/man1/optirun.1.gz
%{_mandir}/man1/bumblebeed.1*
%{_mandir}/man1/optirun.1*
%doc COPYING
%changelog
* Tue Nov 01 2022 Silvan Calarco <silvan.calarco@mambasoft.it> 3.2.1-3mamba
- add patches and fixes
* Sat Aug 02 2014 Silvan Calarco <silvan.calarco@mambasoft.it> 3.2.1-2mamba
- provide systemd init script