I just bought an external monitor, and my computer crashes when I call xrandr to setup my display. Here is my situation:
Laptop: Dell XPS 13 (3200x1800, Edit: HiDPI),
Monitor: Asus VZ279 (1920x1080),
OS: Ubuntu 18.04.
The monitor is in front of me and my laptop is to my right. What happens if I go through Ubuntu's display settings is either I choose the 200% scale and the external monitor shows everything 2x too large, or I choose the 100% scale and the laptop shows everything 2x too small. When I didn't have an external monitor, I would just have it on 200%.
I looked up some solutions on here and through Google, and I know there are two solutions to make both displays simultaneously regular-sized:
- Lower the resolution of the laptop to 1600x900, and scale everything 100%. This is what I am doing as a temporary solution, but I am losing the good resolution on the laptop.
- Use xrandr to set different scales. This is what I am trying to do, but my laptop crashes when I do it.
Here is the code I use:
xrandr --output DP1 --scale 2x2 --mode 1920x1080 --fb 7040x2160 --pos 0x0 --output eDP1 --scale 1x1 --mode 3200x1800 --pos 3840x0
Let me break it down:
--output DP1
is the external monitor,
--scale 2x2
this is supposed to make the display 2x smaller,
--mode 1920x1080
this is the display of the monitor,
--fb 7040x2160
this is the framebuffer size, which I get through (2*1920+3200)x(2*1080), which must span the total size of both monitors,
--pos 0x0
is the location of the monitor,
--output eDP1
is my laptop screen,
--scale 1x1
the laptop display doesn't need to be made smaller,
--mode 3200x1800
the display of my laptop,
--pos 3840x0
the position of the laptop display, which is (2*1920)x0.
Now when I run this, I see both screens assume exactly the resolutions that I want and my mouse pointer moves from one screen to the other exactly like I want, but stuff is moved around weirdly (e.g. a part of my laptop display is on my big screen and vice-versa), and everything but the mouse pointer is frozen. I have to shut down my laptop by pressing the power button 5 seconds, and reboot, for it to unfreeze.
Do you have any idea what I may be doing wrong?
Thanks!
EDIT: Following a comment, I am adding the solutions I had already tried before posting this.
Most of my trials initially didn't have the --fb
option. I added it following a solution found somewhere else on stackexchange, and I left it in because it's the only way that I get the desired result (the resolutions are correct, but everything crashes).
If I remove the --fb
option and go one monitor at a time, here's what happens.
I start by setting everything back to "normal" since I've been trying stuff out:
xrandr --output DP1 --scale 1x1 --mode 1920x1080 --pos 0x0 --output eDP1 --scale 1x1 --mode 3200x1800 --right-of DP1
. In the Ubuntu display GUI, I check that each monitor is in their correct resolution (3200x1800 for my laptop, 1920x1080 for my external monitor) and that the scale to 100%. What it looks like now: external monitor looks good, laptop is high-resolution but everything is 2x too small.To make laptop a nice size, I go in the Ubuntu display GUI, and set the scale to 200%. What it looks like now: my laptop has the correct size and resolution, but the external monitor looks twice too big.
To make the external monitor look a nice size, I change its scale "individually":
xrandr --output DP1 --scale 2x2
. What it looks like now: Many problems! First, the scaling of everything is back to 100%, which I can confirm by looking at the Ubuntu diplasy GUI. My laptop scaling is back to the 2x too small size and the external monitor is not twice too big anymore, but on top of that it seems like the external monitor is also following the--scale 2x2
instruction, so now the external monitor is 2x too small. In other words, I wanted to use the overall scaling of 200% from the Ubuntu display GUI, and then individually set the external monitor scaling to 2x2 (so 2x smaller), but now I have an overall scaling of 100% and the external monitor 2x smaller. And finally, the position of my laptop screen is still based on the 1x1 scale of the external monitor, so the display of the external monitor covers half my laptop screen.. The xrandr output is:Screen 0: minimum 8 x 8, current 5120 x 2160, maximum 32767 x 32767 eDP1 connected 3200x1800+1920+0 (...) DP1 connected primary 3840x2160+0+0
Seems like this could be fixed by just going back in the Ubuntu display GUI and taking the scaling back to 200%. This is what I do. What it looks like now: The external monitor is back to be 2x too large, like it forgot its
--scale 2x2
instruction, and the laptop is 2x too small with only the top left of it being used. The xrandr output isScreen 0: minimum 8 x 8, current 5120 x 1800 (...) eDP1 connected 6400x3600+1920+0 (...) DP1 connected primary 1920x1080+0+0
.Now the problem appears to be the resolution of the laptop monitor, so I set it back to 3200x1800 with
xrandr --output eDP1 --mode 3200x1800
... and as I ran it, my computer crashed! Thanks askubuntu for saving this draft.
I have tried doing these steps in various orders, and it always seems like there's a crash at some point before I reach the desired resolution. Is it possible that what I am trying to do is not doable? Like, that my computer or OS doesn't support it?
EDIT 2: As suggested by user.dz, I ran sudo sh -c "lsb_release -sd; dmidecode -s system-product-name; echo ==; lshw -c display; echo ==; xrandr --verbose; echo ==; cat /etc/X11/xorg.conf"
, while both monitors were connected and on 1x1 scaling, and the output can be found here: https://paste.ubuntu.com/p/T6JrpwHqs7/. Hope this helps someone help me!
-fb
option – user.dz Apr 15 '20 at 21:47--fb
option, I only added it while looking at various solutions posted online, some of which said it was very important. I added a long edit to my original post, that shows what happens when I try testing one monitor separately, with the xrandr outputs. My suspicion is that the scaling % in the Ubuntu display GUI is a separate parameter not directly controlled by xrandr, and that I cannot set a different % for each monitor. And that in the end, I cannot really solve my problem. Would that make sense? – vinc.mack Apr 16 '20 at 16:12sudo sh -c "lsb_release -sd; dmidecode -s system-product-name; echo ==; lshw -c display; echo ==; xrandr --verbose; echo ==; cat /etx/X11/xorg.conf"
then add output to the question, may be some can find similar setup with same hardware. – user.dz Apr 16 '20 at 17:01xrandr --output LVDS-1 --scale 1x1 --left-of VGA-1 --output VGA-1 --scale 2x2
– user.dz Apr 16 '20 at 23:13--scale 1x1
it's 2x too small, and with--scale 0.5x0.5
it's good, but low res). What I should've mentioned in my original question (added) is my laptop is HiDPI but not my 2nd monitor. I was digging in that thread before posting my question: https://askubuntu.com/questions/393400/is-it-possible-to-have-different-dpi-configurations-for-two-different-screens. The solutions which seem closest to my problem (e.g. that of Daniel Bower), are those causing the crash. – vinc.mack Apr 17 '20 at 02:45xrandr
then it could be pushed to driver level. Probably final trial for me :), Two things to collect (1) try withxtrace xrandr --verbose ... > xrandr.log
for the case that crashes, share it also in your report. (2) try without-fb
setting and by adding 1px gap between monitors using--pos ..
– user.dz Apr 20 '20 at 14:02