"--scale 2x2" in xrandr causes the monitor to not display anything
Just wanted to add that this is something I've been fighting with for a long time, and each time I just gave up - until I decided to figure it out once and for all. The solution below works for me, hope it does for you as well.
tl;dr: Configure ForceFullCompositionPipeline=On
Background
Some of this is also in hopes of providing more keywords in case someone with a similar problem ends up looking for the solution.
My setup is:
- ThinkPad P50 with a built-in 4K display at 3840×2160 (primary)
- An external monitor as a secondary display - Dell U2412M - 1920×1200
I use Ubuntu Gnome 16.04 LTS.
When I plug in the monitor via a HDMI cable + a HDMI-to-DVI converter (as the monitor doesn't have an HDMI input), everything was too large. Various articles online suggested using xrandr
to configure --scale 2x2
on that display, which resulted in it being almost completely black, with only a thin line visible on top.
I bumped into this question and while the 2x2.001
scaling solution enabled the monitor to actually display stuff, it also added an extra pixel below the X screen which resulted in slight up/down scrolling when the cursors reaches the top/bottom of the screen.
After a lot of Googling, much of which yielded problems and no solutions, I stumbled upon this: https://devtalk.nvidia.com/default/topic/891207/-355-11-358-09-viewportin-on-2nd-monitor-results-in-garbled-display-for-values-over-3211x1800
So to test it out, I configured this using the following commands - assume xrandr
hasn't been configured with scaling yet.
$ nvidia-settings -q CurrentMetaMode
Attribute 'CurrentMetaMode' (lilicorp:1.0): id=50, switchable=no, source=RandR :: DPY-4: nvidia-auto-select @3840x2160 +0+0 {ViewPortIn=3840x2160, ViewPortOut=3840x2160+0+0}, DPY-1: nvidia-auto-select @1920x1200 +3840+0 {ViewPortIn=1920x1200, ViewPortOut=1920x1200+0+0}
This displays the CurrentMetaMode
value and this is where I added the ForceFullCompositionPipeline=On
option to both displays. Note that DPY-4
is my built-in laptop display, whereas DPY-1
is the external monitor.
The actual string that needs to be configured is the one after ::
in the output of that command.
$ nvidia-settings --assign CurrentMetaMode="DPY-4: nvidia-auto-select @3840x2160 +0+0 {ViewPortIn=3840x2160, ViewPortOut=3840x2160+0+0, ForceFullCompositionPipeline=On}, DPY-1: nvidia-auto-select @1920x1200 +3840+0 {ViewPortIn=1920x1200, ViewPortOut=1920x1200+0+0, ForceFullCompositionPipeline=On}"
After this, I ran:
$ xrandr --output DP-1 --scale=2x2
Finally, the external display resolution was fine with no scrolling or any other issues.
Note that after running those commands, the CurrentMetaMode
is a bit different from what was assigned, probably due to the scaling getting applied:
$ nvidia-settings -q CurrentMetaMode
Attribute 'CurrentMetaMode' (lilicorp:1.0): id=50, switchable=no, source=RandR :: DPY-4: nvidia-auto-select @3840x2160 +0+0 {ViewPortIn=3840x2160, ViewPortOut=3840x2160+0+0, ForceCompositionPipeline=On, ForceFullCompositionPipeline=On}, DPY-1: nvidia-auto-select @3840x2400 +3840+0 {Transform=(2.000000,0.000000,0.000000,0.000000,2.000000,0.000000,0.000000,0.000000,1.000000), ViewPortIn=3840x2400, ViewPortOut=1920x1200+0+0, ResamplingMethod=Bilinear, ForceCompositionPipeline=On, ForceFullCompositionPipeline=On}
Hope this solves the problem for someone else too!
I had exactly the same problem. I got it resolved with --scale 2x2.001
. Oddly enough, --scale 2x1.999
or 2x2.0001
didn't work, so be sure to try several numbers around 2.
Thank you Milos for your excellent solution, which worked well for me!
I've a small addition. Besides using the command line you can also comfortably set the ForceFullCompositionPipeline
in the Nvidia-Settings UI. For this you've to go to "X Server Display Configuration", click on "Advanced" and just activate the option "Force Full Composition Pipeline".
Please see https://imgur.com/a/3jE78 for an example.
PS: I'm using a triple-head setup with two external monitors (1920x1080; 1680x1050) and an internal 3k monitor (3840x2160). For this to work I apply the following xrandr-config:
xrandr --output eDP-1-1 --auto --output HDMI-0 --auto --scale 2x2 --above eDP-1-1 --output DP-1 --auto --scale 2x2 --rotate left --right-of eDP-1-1