Randr 1.5 wrong monitor size with viewportin

Hello,

I have a laptop with an NVIDIA card and HiDPI screen (Dell M4800 with Quadro M2200 and 3200x1800 LCD) that I’m currently using with a FullHD 1920x1080 24" external monitor using HDMI.

The DPI of both screens are quite far (235 vs 92) so I’m scaling up the external screen resolution to have 3840x2160 instead using viewportin in the metamodes.

However, when I’m doing this, the behaviour of GTK applications is not good anymore on the external screen, mainly for menus and combox boxes. They are staying in the upper-left 1920x1080 portion of the screen.

Here is a screenshot of my mate desktop where we can see that the desktop background is restricted to the 3200x1800 laptop screen on the left and on the upper-left of the external screen on the right, I’m clicking the “File” menu button on the terminal but it’s opening in the upper-left portion of the screen.

I’ve tracked down the problem in GTK3 (3.24.20) a little bit and the wrong 1920x1080 size for the second screen comes from the init_randr15() function.

The value comes from Randr 1.5 XRRGetMonitors() function which returns 1920x1080 for the scaled external monitor. The similar Xinerama function returns the proper 3840x2160 size.

I built a small executable showing this, here is the source code rrtest.c (1.1 KB) and the output:

Xinerama 0: pos=3200,0 size=3840x2160
Xinerama 1: pos=0,180 size=3200x1800
X monitor 0: pos=3200,0 size=1920x1080 msize=521x293
X monitor 1: pos=0,180 size=3200x1800 msize=346x194

I’ve looked a little bit in the RandR 1.5 protocol and it seems from chapter 1.5.1 that the Xinerama and Randr 1.5 monitors should match.

I’ve tested on a bare Ubuntu 20.04 live USB with the default “nouveau” driver and using “xrandr --scale 2x2” and it was giving me 3840x2160 for the external screen in both Xinerama and Randr 1.5 monitor.

So I think that it’s more a NVIDIA driver issue that doesn’t report the proper scaled size in Randr 1.5 monitor size when using a different viewportin size (but I’m open to suggestions).

I’m running archlinux with the 440.82 drivers and here is the nvidia bug report log: nvidia-bug-report.log (745.7 KB)

I’m sorry there are not more links to the relevant GTK code and RandR protocol, because as a new user on this forum I’m not allowed too much links (and attachments are apparently already links).

Thanks in advance for any help on this subject

I can’t reproduce it, also running the 440.82 driver, setting a scale
xrandr --output HDMI-0 --scale ‘1.14x1.14’
then the outputs of
xrandr
xrandr --listmonitors
rrtest
all output the correct resolution.
Only thing that’s different is I only have one monitor connected, so can’t test your exact setup. Please check if this is only appearing if a second monitor is connected that’s scaled.
As a workaround, is it possible to set the correct dimensions using ‘xrandr --setmonitor’ ?

Hello, thanks for your reply,

Indeed it works with xrandr, the issue seems to only appear with metamode used in the xorg configuration.

I studied a little bit the Xorg logs, and there is a “Transform” parameter that appears:

DPY-2: nvidia-auto-select @3840x2160 +3200+0 {Transform=(2.000000,0.000000,0.000000,0.000000,2.000000,0.000000,0.000000,0.000000,1.000000), ViewPortIn=3840x2160, ViewPortOut=1920x1080+0+0, ResamplingMethod=Bilinear}

Compared to my xorg.conf:

DPY-2: nvidia-auto-select @3840x2160 +3200+0 {ViewPortIn=3840x2160, ViewPortOut=1920x1080+0+0}

I tried to use this Transform parameter in my config file and I was not able to make it work yet.

So I guess there is something causing this, I will try with nvidia-settings without the xorg conf and I will try the configuration saved from nvidia-settings as well.

Ok, that’s a known issue with explicitly set metamodes, either in xorg.conf or using nvidia-settings that those are really only randr 1.1 compatible so they’re becoming more and more useless with modern desktop environments and games.
Rather annoying but I don’t think nvidia will change that, at least @aplattner told about this some (longer) time ago, because something doesn’t match something…

You could send the nvidia-bug.report.log with a description of the bug to linux-bugs[at]nvidia.com since setting at least the correct randr 1.5 monitor object should be possible for metamodes.

Thank you, I will do that,

Just a small update, I’ve tested with a single screen with no specific xorg.conf and I’m able to reproduce this by upscaling (by 1.5 here), it works in xrandr but does not work in nvidia-settings:

With “xrandr --output DP-2 --scale 1.5x1.5” it’s good.

Thanks again for your feedback !

Hi Damien,
Thanks for reporting issue to us.
Can you please tell me exact repro steps to recreate issue locally with single monitor.
I can try the same and if it repros, it will be quicker to debug for engineering team.

Start nvidia-settings, go to
“X Server Display Configuration”, hit “Advanced”. Enter different “ViewPortIn” dimensions, hit “Apply”. You should see a scaled desktop.
run
xrandr --listmonitors
to display the logical monitor objects.
Expected: ViewPortIn settings displayed
Actual result: Still set to ViewPortOut, i.e. physical resolution.

Thank you, I confirm that those steps are reproducing and showing the issue.

Looks like I am able to recreate issue locally.
Please confirm if it’s the same behavior which you guys have observed.

I changed ViewPortIn resolution to 3200 x 1800 and applied the changes.

Yes, that’s it.
The impact of this is that recent GTK+ (and probably also QT) rely on randr monitor objects correctly set for object/dialog placement once the driver announces randr 1.5 capability and monitor objects which the nvidia driver does.

FYI - I have filed a bug 200627545 internally for tracking purpose.

This issue has been fixed and will be incorporated in future driver release.

Thank you very much that’s great news !

Hello,

I’ve installed driver 460.27.04 beta and it is now properly advertised to xrandr and I don’t have the issue anymore.

Thank you for the support !

1 Like