I have a AOC monitor which advertises two 1920x1080@60Hz timings but only of them actually works.
I can see both modes in
wlr-randr output but cannot figure out how to select the preferred one.
wlr-randr --output DP-1 --mode 1920x1080 60 doesn't change it and
swaymsg output DP-1 mode 1920x1080@60Hz doesn't change it either.
DP-1 "Unknown 2369M ABPEA9A000199 (DP-1)" Physical size: 510x290 mm Enabled: yes Modes: 1920x1080 px, 60.000000 Hz (preferred) 1920x1080 px, 60.000000 Hz (current) 1920x1080 px, 59.939999 Hz 1920x1080 px, 50.000000 Hz 1680x1050 px, 59.882999 Hz 1280x1024 px, 75.025002 Hz 1280x1024 px, 60.020000 Hz 1440x900 px, 59.901001 Hz 1280x960 px, 60.000000 Hz 1280x720 px, 60.000000 Hz 1280x720 px, 60.000000 Hz 1280x720 px, 59.939999 Hz 1280x720 px, 50.000000 Hz 1024x768 px, 75.028999 Hz 1024x768 px, 70.069000 Hz 1024x768 px, 60.004002 Hz 832x624 px, 74.551003 Hz 800x600 px, 75.000000 Hz 800x600 px, 72.188004 Hz 800x600 px, 60.317001 Hz 800x600 px, 56.250000 Hz 720x576 px, 50.000000 Hz 720x576 px, 50.000000 Hz 720x576 px, 50.000000 Hz 720x480 px, 60.000000 Hz 720x480 px, 60.000000 Hz 720x480 px, 59.939999 Hz 720x480 px, 59.939999 Hz 720x480 px, 59.939999 Hz 640x480 px, 75.000000 Hz 640x480 px, 72.808998 Hz 640x480 px, 66.667000 Hz 640x480 px, 60.000000 Hz 640x480 px, 59.939999 Hz 640x480 px, 59.939999 Hz 720x400 px, 70.082001 Hz Position: 0,0 Transform: normal Scale: 1.000000
Is there some way to select the mode by for example index or with vesa timings? And is there a feature to extract the vesa timings from the available modes to see which ones I should set?
--preferredto select the preferred mode.
Looking into monitor EDID there's
- STI (standard timing information):
X-res8 1920 pix, V-freq 60 Hz, pix_ratio 0b11.
- DTD (detailed timing descriptor):
Pixel clock Float 148.50 MHz, H-Active pix 1920 pix, H-Blank pix 280 pix, V-Active lines 1080 pix, V-Blank lines 45 pix, H-Sync offs 88 pix, H-Sync width 44pix, V-Sync offs 4pix, V-Sync width 5 pix, H-Size 509 mm, V-Size 286 mm, H-Border 0 pix, V-Border 0 pix, sync_type 0b11, Hsync_type 1, Vsync_type 1, il2w_stereo 0, stereo_mode 0b00, interlace 0
Both of these get interpreted as
1920x1080@60Hz. For some reason
wlr-randrboth use the non-preferred mode when provided with this name. That might be due to the implementation of the output management protocol in wlroots.
In EDID versions 1.3 and onwards (I have 1.3) the first DTD should be considered the preferred resolution. That is shown right by
xrandrhas ability to enable the preferred mode.
The wayland protocol used for setting modes in this tool (
zwlr_output_mode_v1to specify which mode is wanted.
I'll try to add a
--preferredoption to call the protocol with the preferred mode and make a PR if I succeed.
Currently only way I could find to set the mode without a restart is to install xorg server and run xrandr to set the mode and remove all output mode configuration for that monitor from sway/wlroots compositor config. With restart it's possible to override
drm.edid_firmwarewith a customized one (edit with for example wxEdid) where the STI entry is modified to other resolution.
wlroots just uses the modes reported by the kernel. You can inspect those via drm_info.
The modes gotten by
wlr-randrare always in the right order with preferred mode first (wlroots passes those from libdrm and kernel in right order). So when using some specific resolution and refresh rate in case of a duplicate the preferred resolution is used.
In my case it seems that some change in
i915driver from kernel, firmware or some library I haven't checked has caused that the preferred resolution is not used and cannot be used. Even weston crashes when connecting this display with assertion failing
weston: ../weston-9.0.0/libweston/backend-drm/kms.c:1409: atomic_flip_handler: Assertion `output->atomic_complete_pending' failed.. So for some reason the atomic mode change is failing. Tested with the
5.11-rc4kernel too but no luck.
So the issue isn't in wlr-randr. If it's helpful I can/will create a PR for the
--preferredoption to make the tool a little easier to use when just wanting to put a monitor back to default mode.
If it's helpful I can/will create a PR for the --preferred option to make the tool a little easier to use when just wanting to put a monitor back to default mode.
Sure, would be helpful :)