home · contact · privacy
Provide scripting for W530 to startx with forced NVidia GPU usage.
authorChristian Heller <c.heller@plomlompom.de>
Wed, 29 Mar 2017 00:35:46 +0000 (02:35 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Wed, 29 Mar 2017 00:35:46 +0000 (02:35 +0200)
dotfiles/user/thinkpad/W530/startx_force_nvidia.sh [new file with mode: 0755]
dotfiles/user/thinkpad/minimal/xinitrc

diff --git a/dotfiles/user/thinkpad/W530/startx_force_nvidia.sh b/dotfiles/user/thinkpad/W530/startx_force_nvidia.sh
new file mode 100755 (executable)
index 0000000..babdbff
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# Undo bumblebee setup.
+sudo service bumblebeed stop
+sudo modprobe nvidia-drm
+sudo update-alternatives --set glx /usr/lib/nvidia
+
+# Use special xorg.conf and pass NVIDIA_DIRECT directive to .xinitrc.
+NVIDIA_DIRECT=1 startx -- -config xorg.conf.alt
+
+# Recreate bumblebee setup.
+sudo service bumblebeed start
+sudo update-alternatives --auto glx 
index 030572315aa972f9228d9c2dcd14f2bbb9cc8b68..29de637537464ac1917972941dab8e38f32d5436 100644 (file)
@@ -16,5 +16,14 @@ setxkbmap de
 # Set up compose key.
 xmodmap ~/.Xmodmap
 
 # Set up compose key.
 xmodmap ~/.Xmodmap
 
+# Optionally, for certain Optimus systems with a first GPU connected to the
+# display and a second (NVidia) GPU providing 3D acceleration, use the first GPU
+# as sink for the second. This may confuse DPI settings, so re-set those.
+if [ "${NVIDIA_DIRECT}" ]; then
+  xrandr --setprovideroutputsource modesetting NVIDIA-0
+  xrandr --auto
+  xrandr --dpi 96
+fi
+
 # Launch window manager.
 i3 -c ~/.i3
 # Launch window manager.
 i3 -c ~/.i3