Manually add a resolution to Gnome with Wayland

12,962

Solution 1

tldr -- On Gnome, you can set kernel boot parameter to manually override the resolution of your monitor. If you're using the Weston implementation (which apparently Gnome isn't), you can configure different resolutions in ~/.config/weston.ini


I struggled with this for a long time, and I've found a compromise that works okay for now. However, I hope there's a better way, so please let me know if there is.

With Weston (untested)

At first I thought Gnome used Weston for its Wayland layer, but apparently it doesn't work that way. If, however, you are using Weston, you can supposedly configure the resolution of external displays in ~/.config/weston.ini:

[output]
name=VGA1
mode=173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync

The output name should be the name of your display. On Arch, you can run this command to find out what displays are connected:

for p in /sys/class/drm/*/status; do con=${p%/status}; echo -n "${con#*/card?-}: "; cat $p; done

To get the right value for the modeline, you can run cvt 1920 1080, or with whatever resolution you need. More information here: https://wiki.archlinux.org/index.php/Wayland#Configuration

With Gnome

It seems that Gnome doesn't have a way to configure display resolutions (at least yet). So I found a bug report that referenced this kernel boot parameter you can use to override the resolution for displays. Read the linked documentation for full details, but on my system, I needed to configure the display "DP-1" to be 1920x1080 at 60Hz, so I added this line to my boot parameters:

video=DP-1:1920x1080@60

I'm using systemd-boot, so I added that to my options line in /boot/loader/entries/arch.conf. If you're using GRUB or anything else, your steps will be different for adding this boot parameter.

I'm actually not sure what will happen now if I boot with this option set and then plug in a display that needs a different resolution. Will this boot parameter override that, or is this a fallback for when automatic detection fails? I don't know. Because I'm not sure, I added a second boot entry that omits this parameter. So sometimes I may need to reboot to get the correct resolution on an external display. But otherwise, it's working fine.

Solution 2

This answer is a repeat of the accepted answer above with a specific focus on Gnome and an explanation of how to find the device name. I was trying to connect a second screen to my laptop under Debian GNU/Linux 10 (buster) with the Gnome desktop. The recommended resolution for that screen is 1920x1200. The issue was that the resolution was lower and there were only 2 options available in the setup menu:

enter image description here

Find device name

Devices can be seen in /sys/class/drm/ the available resolutions are visible in the modes file:

$ cat /sys/class/drm/card0-DP-2/modes                                                                                                                                         
1024x768
800x600
800x600
848x480
640x480
$ cat /sys/class/drm/card0-eDP-1/modes
1920x1080
1920x1080

In my case the name of the screen in question is DP-2.

Enter device name in boot parameter

On Ask Ubuntu, this answer explains how to add a new resolution to the kernel boot parameter.

sudo vim /etc/default/grub

Then edited this line

GRUB_CMDLINE_LINUX_DEFAULT="quiet video=DP-2:1920x1200@60"

Then update grub:

 sudo update-grub

After a reboot, the new resolution becomes available:

enter image description here

Share:
12,962

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin almost 2 years

    I'm using Gnome on Arch Linux with VMWare.

    When I go in the settings window, I cannot find my resolution (which is 1920x1080).

    I was recently using LightDM and I added an entry in /etc/X11/xorg.conf.d with my resolution, but now I use GDM instead of LightDM and it seems like my configuration doesn't change anything because GDM is using Wayland (correct me if I'm wrong).

    I could not find any way to do the same thing as I did for X11 but with Wayland.

    So my question is how can we manually add a resolution in Wayland?

  • Thalys
    Thalys over 7 years
    wayland is new enough that support is probably a bit wonky. Also, in theory you can always do a one off boot parameter edit is needed, right?
  • Nathan Wallace
    Nathan Wallace over 7 years
    Yes, true -- I did a one-off boot parameter to test it before I added it to my boot-loader entry. Good point
  • Chriki
    Chriki over 3 years
    Thanks, +1. I only found the XWAYLAND1 part in the kernel parameter confusing. This string is what needs to be replaced with the display name (DP-2 in the example).
  • Paul Rougieux
    Paul Rougieux over 3 years
    @Chriki thanks I updated the answer to display the line that is actually in my /etc/default/grub and that is GRUB_CMDLINE_LINUX_DEFAULT="quiet video=DP-2:1920x1200@60"
  • 71GA
    71GA almost 3 years
    Let's point out that in a file ~/.config/weston.ini you can obtain value for name with a xrandr command. You can also obtain value for mode with cvt 1920 1080 60.00. Good luck.
  • 71GA
    71GA almost 3 years
    This does not work for me (Debian 11).
  • 71GA
    71GA almost 3 years
    I was wrong! Method that adds a resolution as a kernel parameter works! But only for llower resolutions, because my virtual machine had too little video memmory! In order for this to work 1st video memmory must be sufficient!
  • Community
    Community over 2 years
    As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.