commit fd724e6ba32ab7d2d1eb1dfffa3cb1db0ea82c86
Author: Nicolas Chauvet <kwizart(a)gmail.com>
Date: Tue Jul 25 15:28:52 2017 +0200
Add nvidia-fallback service
10-nvidia.rules | 4 ++++
nvidia-fallback.service | 16 ++++++++++++++++
xorg-x11-drv-nvidia.spec | 12 ++++++++++++
3 files changed, 32 insertions(+)
---
diff --git a/10-nvidia.rules b/10-nvidia.rules
new file mode 100644
index 0000000..5b43445
--- /dev/null
+++ b/10-nvidia.rules
@@ -0,0 +1,4 @@
+# RPM Fusion nvidia udev rules
+
+SUBSYSTEM=="pci", ATTRS{vendor}=="0x12d2",
ATTRS{class}=="0x030000", TAG+="systemd",
ENV{SYSTEMD_WANTS}="nvidia-fallback.service"
+SUBSYSTEM=="pci", ATTRS{vendor}=="0x10de",
ATTRS{class}=="0x030[02]00", TAG+="systemd",
ENV{SYSTEMD_WANTS}="nvidia-fallback.service"
diff --git a/nvidia-fallback.service b/nvidia-fallback.service
new file mode 100644
index 0000000..2645446
--- /dev/null
+++ b/nvidia-fallback.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=Fallback to nouveau as nvidia did not load
+After=akmods.service
+Before=display-manager.service
+ConditionKernelCommandLine=rd.driver.blacklist=nouveau
+ConditionPathExists=!/sys/module/nvidia
+
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=-/sbin/modprobe nouveau
+
+
+[Install]
+WantedBy=graphical.target
diff --git a/xorg-x11-drv-nvidia.spec b/xorg-x11-drv-nvidia.spec
index ec385dc..2cd77d1 100644
--- a/xorg-x11-drv-nvidia.spec
+++ b/xorg-x11-drv-nvidia.spec
@@ -53,6 +53,8 @@ Source13: parse-readme.py
Source14: 60-nvidia-uvm.rules
Source15: nvidia-uvm.conf
Source16: 99-nvidia-dracut.conf
+Source20: 10-nvidia.rules
+Source21: nvidia-fallback.service
ExclusiveArch: i686 x86_64 armv7hl
@@ -392,6 +394,12 @@ fn=%{buildroot}%{_datadir}/appdata/xorg-x11-drv-nvidia.metainfo.xml
%{SOURCE13} README.txt "NVIDIA TESLA GPUS" | xargs appstream-util add-provide
${fn} modalias
%endif
+# Install nvidia-fallback
+%if 0%{?rhel} >= 6 || 0%{?fedora}
+install -p -m 0644 %{SOURCE20} %{buildroot}%{_udevrulesdir}
+install -p -m 0644 %{SOURCE21} %{buildroot}%{_unitdir}
+%endif
+
%pre
if [ "$1" -eq "1" ]; then
@@ -483,6 +491,10 @@ fi ||:
%ghost %{_sysconfdir}/X11/xorg.conf.d/99-nvidia.conf
%ghost %{_sysconfdir}/X11/xorg.conf.d/nvidia.conf
%{_datadir}/X11/xorg.conf.d/nvidia.conf
+%if 0%{?rhel} > 6 || 0%{?fedora}
+%{_udevrulesdir}/10-nvidia.rules
+%{_unitdir}/nvidia-fallback.service
+%endif
%if 0%{?fedora} >= 25
%{_datadir}/appdata/xorg-x11-drv-nvidia.metainfo.xml
%{_dracut_conf_d}/99-nvidia-dracut.conf