Wayland how to set a custom resolution

Solution 1:

You can try to set a custom resolution with wayland with some effort and mixed results.

You should probably start by filing a bug report, including your graphics card and monitor(s), against wayland

How do I report a bug?

https://help.ubuntu.com/community/ReportingBugs


Adding a Custom Resolution

xrandr will NOT work with Wayland !!

You can try to add a custom resolution using your modline similar to how you would with xrandr, but with a few additional steps.

First, I am not sure if this works with secure boot, so I advise you start by Disabling secure boot

From https://ask.fedoraproject.org/en/question/99867/how-to-add-a-custom-resolution-to-weyland-fedora-25/ and https://wiki.archlinux.org/index.php/Kernel_mode_setting#Forcing_modes_and_EDID

First, you'll need to clone edid-generator. Then you can pass it your modeline (with the same arguments you gave xrandr --newmode

From https://github.com/akatrevorjay/edid-generator

Install requirements

sudo apt install zsh edid-decode automake dos2unix

Download & extract

wget https://github.com/akatrevorjay/edid-generator/archive/master.zip
unzip master.zip 
cd edid-generator-master

The binary is in ~/edid-generator-master as modeline2edid

Run modeline2edid with your modline, using the example in askfedora link,

./modeline2edid - <<< 'Modeline "3840x2160" 533.6 3840 3982 4027 4064 2160 2170 2180 2190 +hsync +vsync'
Searching for runaway unicorns in '/dev/stdin'
-- Found naughty unicorn: Modeline "3840x2160" 533.6 3840 3982 4027 4064 2160 2170 2180 2190 +hsync +vsync
Wrote 3840x2160.S

Modify that command to your desired resolution.

See How to set a custom resolution? for details (if needed)

Then generate the edid binary with make

make #output not posted

You will now have your new .bin , 3840x2160.bin in this case.

Now, from The Arch wiki enable your custom resoulution

sudo mkdir /usr/lib/firmware/edid
sudo cp 3840x2160.bin /usr/lib/firmware/edid

Change 3840x2160.bin to your custom resolution.

Note: There are already some custom .bin included, you can see them with ls *.bin I am not sure if you can use them without make or not.

Test by rebooting

When you reboot, edit the kernel line in grub, adding

drm_kms_helper.edid_firmware=edid/3840x2160.bin

See How do I add a kernel boot parameter? and https://wiki.ubuntu.com/Kernel/KernelBootParameters

Go down to the line starting with linux and add drm_kms_helper.edid_firmware=edid/3840x2160.bin at the end of the line after ro quiet splash

Assuming all that works, make it permanent

sudo nano /etc/default/grub

Add in the custom resolutoin

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash drm_kms_helper.edid_firmware=edid/3840x2160.bin"

Save your edit Ctrl+x

update grub

sudo update-grub

Reboot and enjoy your custom resolution

Solution 2:

sudo $EDITOR /etc/default/grub

Find GRUB_CMDLINE_LINUX_DEFAULT line, add in quotes at the end (usually after splash):

video=VGA-1:1920x1080@60

Replace VGA-1 with your X output (i.e. HDMI-1, DVI-0, DP-1, etc.), save, exit editor, then:

sudo update-grub

After reboot your grub will tell your kernel that whatever is connected to VGA-1 supports 1920x1080 at 60Hz. Both Xorg and Wayland get this information from the kernel. Worked for me to run old Samsung SyncMaster 2343NW as a 2nd screen through DVI to D-SUB adapter.