29

Old title - "change resolution to 1280x1024 using xrandr gives: X Error of failed request: BadValue (integer parameter out of range for operation)"

I have installed a fresh Ubuntu 17.10 and have a monitor with 5:4 resolution. settings has no resolution higher than 1024x768. But I need the resolution 1280x1024 (5:4). I use the default motherboard graphics card:

# lspci|grep VGA
00:02.0 VGA compatible controller: Intel Corporation 4 Series Chipset Integrated Graphics Controller (rev 03)

Also xrandr gives the following:

$ xrandr
Screen 0: minimum 320 x 200, current 1024 x 768, maximum 8192 x 8192
XWAYLAND0 connected 1024x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
   1024x768      59.92*+

I tried to add the 1280x1024 resolution using xrandr. so first created the resolution information using gtf:

$ gtf 1280 1024 60

  # 1280x1024 @ 60.00 Hz (GTF) hsync: 63.60 kHz; pclk: 108.88 MHz
  Modeline "1280x1024_60.00"  108.88  1280 1360 1496 1712  1024 1025 1028 1060  -HSync +Vsync

Then added to resolutions:

xrandr --newmode "1280x1024_60.00"  108.88  1280 1360 1496 1712  1024 1025 1028 1060  -HSync +Vsync

then again did the command: xrandr --addmode XWAYLAND0 1280x1024_60.00

Then nothing changed. When I tried to change it using xrandr --output XWAYLAND0 --mode 1280x1024_60.00 --rate 60 But an error occurred:

$ xrandr --output XWAYLAND0 --mode 1280x1024  --rate 60
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  140 (RANDR)
  Minor opcode of failed request:  7 (RRSetScreenSize)
  Value in failed request:  0x0
  Serial number of failed request:  21
  Current serial number in output stream:  22

I don't know what did I do wrong. Or how to change resolution to the correct one: 1280x1024

6
  • 4
    You cannot use xrandr to manage the physical display under Wayland. Try logging out and selecting the Ubuntu (Xorg) session at the login screen, and see if you can change the resolution there. If your display is connected via VGA cable or does not give correct EDID information, it may not be possible currently to change the resolution under Wayland.
    – dobey
    Nov 6, 2017 at 13:07
  • 2
    @dobey what then is used on wayland? Nov 6, 2017 at 14:37
  • 2
    @George I don't think you can forcibly set a custom resolution under Wayland currently. If I knew how, I'd have posted an answer.
    – dobey
    Nov 6, 2017 at 14:51
  • 2
    @Mohammad - May I change the title of your question to "How to set a custom resolution in wayland" ?
    – Panther
    Nov 6, 2017 at 16:47
  • I saved your original title and can revert if needed.
    – Panther
    Nov 6, 2017 at 16:53

2 Answers 2

17

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

7
  • 2
    When experiencing some problems with outputs when adding .bin, point explicitly the output which you want to have custom resolution added. Example: drm_kms_helper.edid_firmware=VGA-1:edid/your_edid.bin Source
    – apex39
    Feb 2, 2018 at 19:49
  • @apex39 in Wayland there is no such thing as VGA-1 (or HDMI, DVI, DP, etc.) video output -- all I see are XWAYLAND0 / XWAYLAND1 / etc video outputs... Mar 13, 2019 at 8:28
  • On my Fedora installation I used to see VGA-1 video output. However substituting it with XWAYLAND0/XWAYLAND1/etc should do the same work
    – apex39
    Mar 13, 2019 at 10:26
  • 1
    In my case didn't work. I tested as kernel option. First created 1280x1024_60.00.bin and added to kernel options, also tried with VGA-1: as @apex39 said. Buthad no change to resolution. Now I have Ubuntu 18.04. Mar 18, 2019 at 11:26
  • 1
    ok so my question is how can gnome3 under wayland changes the resolution from the screen settings interface ? I'm sure there is an easier way to do that now because this answer is 2 years old, anyone ?
    – vdegenne
    Dec 19, 2019 at 23:50
8

Kernel + boot loader

Both Xorg and Wayland get this information from the kernel. You can ask your boot loader to tell the kernel to output specific resolution to specific video output. Let's assume we want to add full HD resolution for VGA-1 device.

Beware after a reboot your boot loader will tell your kernel that whatever is connected to VGA-1 supports 1920x1080 at 60Hz. It doesn't mean it actually does support that resolution and if it doesn't the screen might render black, therefore before making these modifications I highly recommend to make sure that:

  1. the screen actually supports desired resolution
  2. it does so at given refresh rate (e.g. @60 Hz)
  3. system's GPU has sufficient video memory to render images at that resolution (e.g. when sharing it with a virtual machine)

GRUB

sudo $EDITOR /etc/default/grub

Find GRUB_CMDLINE_LINUX_DEFAULT line, add (at the end, before the closing quotation mark):

video=VGA-1:1920x1080@60

Save, exit editor, then:

sudo update-grub

Systemd-boot

sudo $EDITOR /boot/loader/entries/arch.conf

Find options line, add:

video=VGA-1:1920x1080@60

X output

To do any of this you need to know the name of the X (video) output your screen is connected to - open your terminal and run xrandr:

$ xrandr
Screen 0: minimum 8 x 8, current 3840 x 2160, maximum 32767 x 32767
VGA-0 disconnected (normal left inverted right x axis y axis)
VGA-1 disconnected (normal left inverted right x axis y axis)
HDMI-0 disconnected (normal left inverted right x axis y axis)
HDMI-1 disconnected (normal left inverted right x axis y axis)
DP-0 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
DP-2 connected primary 3840x2160+0+0 (normal left inverted right x axis y axis) 878mm x 485mm
   3840x2160     60.00*+  30.00    29.98    24.00  
   2560x1440     59.95  
   2048x1080     59.99  
   1920x1080     60.00    59.94    50.00  
   1680x1050     59.95  
   1440x900      74.98    59.89  
   1280x1024     75.02    60.02  
   1280x960      60.00  
   1280x720      60.00    59.94    50.00  
   1024x768      75.03    60.00  
   800x600       75.00    60.32  
   720x576       50.00  
   720x480       59.94  
   640x480       75.00    72.81    59.94    59.93  
DP-3 disconnected (normal left inverted right x axis y axis)

As you can see the only X output currently reading connected on my machine is DP-2.

Ignore what's below

Real life use case for easier googling of this answer: This worked for me to run an old Samsung SyncMaster 2343NW as a 2nd display through DVI to D-SUB adapter (D-SUB is VGA, so my output name was VGA-1 and the kernel couldn't recognise supported resolutions on its own, a.k.a. connecting an old screen as a 2nd display).

3
  • 1
    Similar answers in super user: Manually add a resolution to Gnome with Wayland. Updating the kernel boot parameter does make the new screen resolution available, provided you have the correct device name. May 14, 2020 at 14:11
  • To find the correct device name, look into /sys/class/drm. This should contain directories such as card0-DP-1, card0-eDP-1 etc. Check the status file in each directory to find which devices are connected. The device name should be the directory name without the card0-.
    – heiko
    Apr 17, 2023 at 10:10
  • 1
    Great, this worked to let me use my 2560x1440 monitor at full resolution by trading off refresh rate on my low-end laptop. For me the incantation was: video=HDMI-A-1:2560x1440@30 Jun 27, 2023 at 17:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .