Ubuntu – “–scale 2×2” in xrandr causes the monitor to not display anything

displaydisplay-resolutionmultiple-monitorsnvidiaxrandr

I've got a 4k external main monitor and I'm trying to connect a 1680×1050 external monitor to the left of it.

I've tried using:

 xrandr --output HDMI-0 --scale 2x2 --pos 0x0 --fb 7200x2160 --output DP-4 --pos 3360x0

which seems like it should work, and when I look at what the computer thinks is going on in nvidia-settings it correctly displays a 3200×2160 monitor to the left of my 4k one.

However on my external monitor just shows black with a flickering line at the top of it.

The only way I can correct this is to reset the scaling back to 1×1 at which point the image returns (while maintaining the X-server size. This means there's just deadspace that I have to scroll through to get between my monitors).

So I think the problem is specifically to do with the 2×2 scaling in xrandr. I'm not sure what to do?

The computer is running 14.04 and has a nvidia GTX960 in it with the recommended driver (352.63)

Here's my xrandr output:

  Screen 0: minimum 8 x 8, current 7200 x 2160, maximum 16384 x 16384
  DVI-I-0 disconnected (normal left inverted right x axis y axis)
  DVI-I-1 disconnected (normal left inverted right x axis y axis)
  DP-0 disconnected (normal left inverted right x axis y axis)
  DP-1 disconnected (normal left inverted right x axis y axis)
  DP-2 disconnected (normal left inverted right x axis y axis)
  DP-3 disconnected (normal left inverted right x axis y axis)
  HDMI-0 connected 1680x1050+0+0 (normal left inverted right x axis y axis) 474mm x 296mm
     1680x1050      59.9*+   60.0  
     1280x1024      75.0     60.0  
     1280x960       60.0  
     1152x864       75.0  
     1024x768       75.0     70.1     60.0  
     800x600        75.0     72.2     60.3     56.2  
     640x480        75.0     72.8     59.9  
  DP-4 connected primary 3840x2160+3360+0 (normal left inverted right x axis y axis) 527mm x 296mm
     3840x2160      60.0*+   30.0  
     2560x1440      60.0  
     2048x1280      60.0  
     1920x1200      59.9  
     1920x1080      60.0     60.0     59.9     50.0     24.0     60.0     50.0  
     1600x1200      60.0  
     1600x900       60.0  
     1280x1024      75.0     60.0  
     1280x720       60.0     59.9     50.0  
     1152x864       75.0  
     1024x768       75.0     60.0  
     800x600        75.0     60.3  
     720x576        50.0     50.1  
     720x480        59.9     60.1  
     640x480        75.0     59.9     59.9  

Best Answer

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!