Can't disable panning on external HDMI display, on Optimus Laptop with GeForce GTX 870M

Hello,

I just bought an external display to use with my laptop.
When I plug it and run “xrandr --output HDMI-0 --left-of eDP-1-0”, the HDMI screen is set in panning mode to my despair. I tried xrandr --output HDMI-0 --panning 0x0, xrandr --output HDMI-0 --panning 1920x1080 but neither changed the panning region of the screen.
If instead of using --left-of I manually set my internal screen to position 1920x0, the same panning problem appear but if I then run xrandr --output HDMI-0 --panning 0x0 the screen get back to cloning mode.

I updated my driver from 358.16 to 361.28 but that did not solve the problem.

Please find nvidia-bug-report.log.gz here : http://loulouxiv.sdf.org/nvidia-bug-report.log.gz
Here is my Xorg configuration :

Section “Module”
Load “modesetting”
EndSection

Section “Device”
Identifier “nvidia”
Driver “nvidia”
#VendorName “NVIDIA Corporation”
BusID “PCI:1:0:0”
Option “AllowEmptyInitialConfiguration”
Option “nvidiaXineramaInfo” “false”
Option “PanAllDisplays” “false”
Option “metamodes” “HDMI-0: NULL”
Option “DPI” “96 x 96”
EndSection

These options

Option “nvidiaXineramaInfo” “false”
Option “PanAllDisplays” “false”
Option “metamodes” “HDMI-0: NULL”

are just wild guesses that did not change the situation.

Here is my xinit script :

#!/bin/sh
/opt/bin/nvidia-settings --load-config-only
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto

xrandr output before

Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 16384 x 16384
HDMI-0 connected primary (normal left inverted right x axis y axis)
1920x1080 60.00 + 59.94 50.00 60.05 60.00 50.04
1680x1050 59.95
1600x900 60.00
1280x1024 75.02 60.02
1280x800 59.81
1280x720 60.00 59.94 50.00
1024x768 75.03 60.00
800x600 75.00 60.32
720x576 50.00 50.08
720x480 59.94 60.05
640x480 75.00 59.94 59.93
DP-0 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
eDP-1-0 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 382mm x 215mm
1920x1080 60.02*+
1400x1050 59.98
1280x1024 60.02
1280x960 60.00
1024x768 60.04 60.00
960x720 60.00
928x696 60.05
896x672 60.01
800x600 60.00 60.32 56.25
700x525 59.98
640x512 60.02
640x480 60.00 59.94
512x384 60.00
400x300 60.32 56.34
320x240 60.05
VGA-1-0 disconnected (normal left inverted right x axis y axis)
1280x1024 (0x47) 108.000MHz
h: width 1280 start 1328 end 1440 total 1688 skew 0 clock 63.98KHz
v: height 1024 start 1025 end 1028 total 1066 clock 60.02Hz
1024x768 (0x4a) 65.000MHz
h: width 1024 start 1048 end 1184 total 1344 skew 0 clock 48.36KHz
v: height 768 start 771 end 777 total 806 clock 60.00Hz
800x600 (0x4f) 40.000MHz
h: width 800 start 840 end 968 total 1056 skew 0 clock 37.88KHz
v: height 600 start 601 end 605 total 628 clock 60.32Hz
640x480 (0x54) 25.175MHz
h: width 640 start 656 end 752 total 800 skew 0 clock 31.47KHz
v: height 480 start 490 end 492 total 525 clock 59.94Hz

I then run
xrandr --output HDMI-0 --auto
xrandr --output HDMI-0 --left-of eDP-1-0

xrandr output after :
Screen 0: minimum 8 x 8, current 3840 x 1080, maximum 16384 x 16384
HDMI-0 connected primary 1920x1080+217+0 (normal left inverted right x axis y axis) 476mm x 268mm panning 3840x1080+0+0
1920x1080 60.00*+ 59.94 50.00 60.05 60.00 50.04
1680x1050 59.95
1600x900 60.00
1280x1024 75.02 60.02
1280x800 59.81
1280x720 60.00 59.94 50.00
1024x768 75.03 60.00
800x600 75.00 60.32
720x576 50.00 50.08
720x480 59.94 60.05
640x480 75.00 59.94 59.93
DP-0 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
eDP-1-0 connected 1920x1080+1920+0 (normal left inverted right x axis y axis) 382mm x 215mm
1920x1080 60.02*+
1400x1050 59.98
1280x1024 60.02
1280x960 60.00
1024x768 60.04 60.00
960x720 60.00
928x696 60.05
896x672 60.01
800x600 60.00 60.32 56.25
700x525 59.98
640x512 60.02
640x480 60.00 59.94
512x384 60.00
400x300 60.32 56.34
320x240 60.05
VGA-1-0 disconnected (normal left inverted right x axis y axis)
1280x1024 (0x47) 108.000MHz
h: width 1280 start 1328 end 1440 total 1688 skew 0 clock 63.98KHz
v: height 1024 start 1025 end 1028 total 1066 clock 60.02Hz
1024x768 (0x4a) 65.000MHz
h: width 1024 start 1048 end 1184 total 1344 skew 0 clock 48.36KHz
v: height 768 start 771 end 777 total 806 clock 60.00Hz
800x600 (0x4f) 40.000MHz
h: width 800 start 840 end 968 total 1056 skew 0 clock 37.88KHz
v: height 600 start 601 end 605 total 628 clock 60.32Hz
640x480 (0x54) 25.175MHz
h: width 640 start 656 end 752 total 800 skew 0 clock 31.47KHz
v: height 480 start 490 end 492 total 525 clock 59.94Hz

After testing for a while I got to think that the problem was my GeForce did not sense the internal laptop screen, and so believed that half of the X screen was not displayed anywhere, causing it to force panning

I used the method described here : https://wiki.gentoo.org/wiki/NVIDIA/Optimus#Using_a_specific_monitor_via_EDID
to extract my internal screen EDID and my XOrg configuration is now as follow :

Section “Module”
Load “modesetting”
EndSection

Section “Device”
Identifier “nvidia”
Driver “nvidia”
VendorName “NVIDIA Corporation”
BusID “PCI:1:0:0”
Option “ConnectedMonitor” “DFP-0, DFP-1”
Option “CustomEDID” “DFP-1:/lib/firmware/edid/1920x1080_MSI_GT70.bin”
Option “ModeValidation” “NoVirtualSizeCheck”
Option “DPI” “96 x 96”
EndSection

Does anyone knows if its possible to have a different DPI configuration on each screen ?

This is a known problem with RandR panning configuration with combinations of prime and non-prime displays, which I’m tracking in bug 1749129.

RandR does have a per-display DPI value, but I don’t know whether applications look at it, and I don’t think there’s a way to override it on a per-display basis.