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