From 8cb8b27b86315b95fac04800be36ce78f8aead97 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Wed, 29 Mar 2017 02:35:46 +0200 Subject: [PATCH] Provide scripting for W530 to startx with forced NVidia GPU usage. --- dotfiles/user/thinkpad/W530/startx_force_nvidia.sh | 13 +++++++++++++ dotfiles/user/thinkpad/minimal/xinitrc | 9 +++++++++ 2 files changed, 22 insertions(+) create mode 100755 dotfiles/user/thinkpad/W530/startx_force_nvidia.sh diff --git a/dotfiles/user/thinkpad/W530/startx_force_nvidia.sh b/dotfiles/user/thinkpad/W530/startx_force_nvidia.sh new file mode 100755 index 0000000..babdbff --- /dev/null +++ b/dotfiles/user/thinkpad/W530/startx_force_nvidia.sh @@ -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 diff --git a/dotfiles/user/thinkpad/minimal/xinitrc b/dotfiles/user/thinkpad/minimal/xinitrc index 0305723..29de637 100644 --- a/dotfiles/user/thinkpad/minimal/xinitrc +++ b/dotfiles/user/thinkpad/minimal/xinitrc @@ -16,5 +16,14 @@ setxkbmap de # 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 -- 2.30.2