Incorrect Panning with lower resolution on GeForce GT 650M

I recently installed the nvidia proprietary driver on my Macbook Pro with retina display. Selecting a lower resolution using the “nvidia-settings” app works. Saving those settings to xorg is fine. But when the server is restarted, the lower resolution is ok, but now there’s panning on the screen. I tried this on gnome-shell, openbox and others with the same result. xrandr shows:

DP-2 connected primary 1680x1050+0+0 (0x282) normal (normal left inverted right x axis y axis) 331mm x 207mm panning 2880x1800+0+0

After launching ‘nvidia-settings’ and just toggling on and off any option (e.g. “Force composition pipeline”), the padding goes away. xrandr shows:

DP-2 connected primary 1680x1050+0+0 (0x282) normal (normal left inverted right x axis y axis) 331mm x 207mm

There are many apps that don’t scale well even using modern compositors and the only option is to use a lower resolution. How can I make the nvidia driver not use panning in this case?

Or is this a bug with the nvidia-settings or the nvidia driver?

panning.nvidia-bug-report.log.gz (244 KB)
correct.nvidia-bug-report.log.gz (244 KB)

I also have a MacBookPro with a GT 650M. Its native resolution is 2880x1800.

In my case, when I configured the resolution to 1440x900 in nvidia-settings, there was no panning. Instead, the xfwm4 window manager continued to position everything in the 2880x1800 region, but I could only see the topleft quadrant. Restarting X didn’t help.

I found a way to fix it, though – I ran the command:

xrandr --output DP-2 --scale 0.5x0.5

Using xrandr --verbose, I noticed that xrandr --scale changes the transformation matrix, but apparently NVIDIA’s default scaled resolution setting doesn’t?

This is the xrandr output after running --scale:

DP-2 connected 1440x900+0+0 (0x282) normal (normal left inverted right x axis y axis) 331mm x 207mm
    Identifier: 0x281
    Timestamp:  6021731
    Subpixel:   unknown
    Gamma:      1.0:1.0:1.0
    Brightness: 1.0
    CRTC:       0
    CRTCs:      0 1 2 3
    Transform:  0.500000 0.000000 0.000000
                0.000000 0.500000 0.000000
                0.000000 0.000000 1.000000
    CscMatrix: 65536 0 0 0 0 65536 0 0 0 0 65536 0
    BorderDimensions: 4
        supported: 4
    Border: 0 0 0 0
        range: (0, 65535)
    SignalFormat: DisplayPort
        supported: DisplayPort
    ConnectorType: Panel
    ConnectorNumber: 0
    _ConnectorLocation: 0
  2880x1800 (0x282) 337.750MHz +HSync -VSync *current +preferred
        h: width  2880 start 2928 end 2960 total 3040 skew    0 clock 111.10KHz
        v: height 1800 start 1803 end 1809 total 1852           clock  59.99Hz

Notice how the Transform matrix is (0.5, 0.5, 1.0) along the diagonal.

I was able to persist this change between X restarts by generating an xorg.conf with nvidia-settings, then changing the “metamodes” setting from:

(default xorg.conf with the 2880x1800 resolution – I think? This makes no sense to me.)

Option         "metamodes" "nvidia-auto-select +0+0; nvidia-auto-select +0+0 {viewportin=1440x900}"

(xorg.conf after setting 1440x900 scaled resolution in nvidia-settings)

Option         "metamodes" "nvidia-auto-select +0+0 {viewportin=1440x900}"

(Fixed – sets the xrandr transformation matrix and everything works.)

Option         "metamodes" "nvidia-auto-select +0+0 {transform=(0.5,0,0, 0,0.5,0, 0,0,1)}"

My full screen section is:

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "Stereo" "0"
    Option         "nvidiaXineramaInfoOrder" "DFP-3"
    Option         "metamodes" "nvidia-auto-select +0+0 {transform=(0.5,0,0, 0,0.5,0, 0,0,1)}"
    Option         "SLI" "Off"
    Option         "MultiGPU" "Off"
    Option         "BaseMosaic" "off"
    SubSection     "Display"
        Depth       24

I got the idea by reading NVIDIA’s documentation, which explained that ViewPortIn was just shorthand for Transform. I don’t understand what’s going on, but I suppose I got it to work, for now.

Thanks @rprichard for the answer! The scaling is indeed wrong (i.e. 1x1). To make it work I had to run these 3 commands:

xrandr --output DP-2 --scale 0.583333x0.583333
xrandr --output DP-2 --scale 1x1
xrandr --output DP-2 --scale 0.583333x0.583333

The first xrandr wouldn’t do a thing. Setting it back to 1x1 and then to the right scaling fixes the panning issue :)

But setting the transform on xorg.conf doesn’t work. I tried some other combinations of the metamodes options but none stopped the panning from appearing. I would say this is certainly a bug with the driver or in any case with the nvidia-settings program for not setting the right xorg.conf settings.