Optimus - HDMI

Optimus - HDMI

Mise à jour : Debian 9.3

Sur un PC portable équipé d'une technologie d'affichage Optimus (utilisation de deux cartes graphiques, l'une (intel) pour les fonctions d'affichage "de base", l'autre (nvidia) pour les applications nécessitant une accélération graphique), l'interface HDMI (High-Definition Multimedia Interface) peut-être connectée soit sur la carte graphique intel, soit sur la carte graphique Nvidia.

On s'intéresse ici à la mise en œuvre de l'interface HDMI

La solution décrite est directement reproduite à partir de la référence ci-dessous :

Référence :

1 - Installation

# apt install xserver-xorg-video-intel
# nano /usr/share/X11/xorg.conf.d/20-intel.conf
Section "Device"
Identifier "intelgpu0"
Driver "intel"
Option "VirtualHeads" "2"
EndSection
# nano /etc/bumblebee/xorg.conf.nvidia
Section "ServerLayout"
Identifier "Layout0"
Option "AutoAddDevices" "true"
Option "AutoAddGPU" "false"
EndSection

Section "Device"
Identifier "DiscreteNvidia"
Driver "nvidia"
VendorName "NVIDIA Corporation"

# If the X server does not automatically detect your VGA device,
# you can manually set it here.
# To get the BusID prop, run `lspci | egrep 'VGA|3D'` and input the data
# as you see in the commented example.
# This Setting may be needed in some platforms with more than one
# nvidia card, which may confuse the proprietary driver (e.g.,
# trying to take ownership of the wrong device). Also needed on Ubuntu 13.04.
# BusID "PCI:01:00:0"

# Setting ProbeAllGpus to false prevents the new proprietary driver
# instance spawned to try to control the integrated graphics card,
# which is already being managed outside bumblebee.
# This option doesn't hurt and it is required on platforms running
# more than one nvidia graphics card with the proprietary driver.
# (E.g. Macbook Pro pre-2010 with nVidia 9400M + 9600M GT).
# If this option is not set, the new Xorg may blacken the screen and
# render it unusable (unless you have some way to run killall Xorg).

Option "ProbeAllGpus" "false"
Option "NoLogo" "true"
# Option "UseEDID" "false"
# Option "UseDisplayDevice" "none"
Option "AllowEmptyInitialConfiguration"
EndSection

Section "Screen"
Identifier "Screen0"
Device "DiscreteNvidia"
EndSection
$ lsmod |grep nvidia

$ optirun lsmod |grep nvidia
nvidia_modeset 790528 2
nvidia 12701696 41 nvidia_modeset

2 - Utilisation

2.1 - Activation

$ systemctl status bumblebeed.service 
● bumblebeed.service - Bumblebee C Daemon
Loaded: loaded (/lib/systemd/system/bumblebeed.service; enabled; vendor prese
Active: active (running) since Sun 2017-12-10 12:13:13 CET; 51min ago
............
$ intel-virtual-output -b

Ce qui doit avoir pour effet

$ cat /proc/acpi/bbswitch
0000:01:00.0 ON

$ lsmod |grep nvidia
nvidia_modeset 790528 2
nvidia 12701696 41 nvidia_modeset
$ xrandr --listactivemonitors
Monitors: 2
0: +*LVDS1 1600/340x900/190+0+0 LVDS1
1: +VIRTUAL1 1024/271x768/203+0+0 VIRTUAL1
$ xrandr 
....
VIRTUAL1 connected 1920x1080+1600+0 (normal left inverted right x axis y axis) 0mm x 0mm
VIRTUAL1.637-1920x1080 60.00*
VIRTUAL1.638-1920x1080 59.94
VIRTUAL1.639-1920x1080 50.00
VIRTUAL1.640-1920x1080 29.97
VIRTUAL1.641-1920x1080 25.00
VIRTUAL1.642-1920x1080 24.00
VIRTUAL1.643-1920x1080 23.97
VIRTUAL1.644-1920x1080 60.05
VIRTUAL1.645-1920x1080 60.00
VIRTUAL1.646-1920x1080 50.04
VIRTUAL1.647-1600x1200 60.00
VIRTUAL1.648-1360x765 60.00
VIRTUAL1.649-1280x1024 60.02
VIRTUAL1.650-1280x720 59.94
VIRTUAL1.651-1280x720 50.00
1024x768 60.00
800x600 60.32
VIRTUAL1.654-720x576 50.00
VIRTUAL1.655-720x480 59.94
640x480 59.94
VIRTUAL1.657-640x480 59.93
.....

2.2 - Utilisation

$ xrandr --output LVDS1 --mode 1600x900 --output VIRTUAL1 --mode VIRTUAL1.637-1920x1080 --same-as LVDS1
$ mode_max=$(xrandr |grep "VIRTUAL1\." |awk '{print $1}'|head -1)

Cette valeur est utilisable pour automatiser le lancement d'un périphérique HDMI dont on ignore à priori la résolution maximale :

$ xrandr --output VIRTUAL1 --mode $mode_max --same-as LVDS1
$ optirun glxspheres64

2.3 - Désactivation

Pour désactiver la sortie virtuelle, tuer le process intel-virtual-output :

$ pkill -e intel-virtual-output
intel-virtual-o killed (pid 4788)

3 - Debuggage

En cas de problème, les logs générés par bumblebee dans /var/log/Xorg.8.log peuvent fournir des informations intéressantes. Il peut également être nécessaire de redémarrer le PC pour établir la première connexion.