File nvidia-uvm-modeset-drm-support.patch of Package bumblebee
diff -urN bumblebee-3.2.1.orig/conf/99-bumblebee-nvidia-dev.rules bumblebee-3.2.1/conf/99-bumblebee-nvidia-dev.rules
--- bumblebee-3.2.1.orig/conf/99-bumblebee-nvidia-dev.rules 2013-04-26 17:49:03.010174177 +0200
+++ bumblebee-3.2.1/conf/99-bumblebee-nvidia-dev.rules 2016-08-07 00:47:23.863168488 +0200
@@ -1,7 +1,10 @@
# Put this file in /lib/udev/rules.d or /etc/udev/rules.d
# Prevent the nvidia card from "randomly" turning on
-DEVPATH=="/module/nvidia", ACTION=="remove", RUN+="/bin/rm -f /dev/nvidiactl /dev/nvidia0 /dev/nvidia1"
+DEVPATH=="/module/nvidia", ACTION=="remove", RUN+="/bin/rm -f /dev/nvidiactl /dev/nvidia-modeset /dev/nvidia-uvm /dev/nvidia0 /dev/nvidia1"
# Create devices files upon loading the module
DEVPATH=="/module/nvidia", ACTION=="add", RUN+="/bin/mknod -m 666 /dev/nvidiactl c 195 255"
DEVPATH=="/module/nvidia", ACTION=="add", RUN+="/bin/mknod -m 666 /dev/nvidia0 c 195 0"
+
+# Create uvm device
+KERNEL=="nvidia_uvm", RUN+="/bin/bash -c '/bin/mknod -m 666 /dev/nvidia-uvm c $(grep nvidia-uvm /proc/devices | cut -d \ -f 1) 0;'"
diff -urN bumblebee-3.2.1.orig/src/bbsecondary.c bumblebee-3.2.1/src/bbsecondary.c
--- bumblebee-3.2.1.orig/src/bbsecondary.c 2013-04-26 17:49:03.018174178 +0200
+++ bumblebee-3.2.1/src/bbsecondary.c 2016-08-07 00:44:40.441246658 +0200
@@ -119,6 +119,24 @@
if (!module_load(module_name, driver_name)) {
set_bb_error("Could not load GPU driver");
return false;
+ } else {
+ /* XXX NVIDIA UVM-DRM support */
+ if (strstr(module_name, "nvidia")) { /* We are using NVIDIA's proprietary driver */
+ char drm_module_name[1024];
+ sprintf(drm_module_name, "%s-drm", module_name);
+ if (!module_load(drm_module_name, "nvidia_drm")) {
+ char log_string[1024];
+ sprintf(log_string, "Cannot load DRM module: %s\n", drm_module_name);
+ bb_log(LOG_ERR, log_string);
+ }
+ char uvm_module_name[1024];
+ sprintf(uvm_module_name, "%s-uvm", module_name);
+ if (!module_load(uvm_module_name, "nvidia_uvm")) {
+ char log_string[1024];
+ sprintf(log_string, "Cannot load UVM module: %s\n", uvm_module_name);
+ bb_log(LOG_ERR, log_string);
+ }
+ }
}
}
return true;
@@ -232,6 +250,12 @@
}
/* unload the driver loaded by the graphica card */
if (pci_get_driver(driver, pci_bus_id_discrete, sizeof driver)) {
+ /* XXX NVIDIA UVM,MODESET support */
+ if (strstr(driver, "nvidia")) {
+ module_unload("nvidia_drm");
+ module_unload("nvidia_modeset");
+ module_unload("nvidia_uvm");
+ }
module_unload(driver);
}