alex-courtis / way-displays

way-displays: Auto Manage Your Wayland Displays
MIT License
239 stars 12 forks source link

Prevent black flash after starting a compositor? #130

Open GrabbenD opened 10 months ago

GrabbenD commented 10 months ago

A short moment after starting Sway and RiverVM, the screen goes black for 2 seconds to apply new refresh rate and VRR mode. From user's perspective this looks like the monitor turns off and on after entering the compositor.

For comparison, if you configure output directly in Sway without Way-Displays, monitor doesn't flash black after starting since the monitor mode is applied synchronously with the start of the compositor instead of asynchronously.

/tmp/way-displays.1.game.log

I [12:48:59] way-displays version 1.8.2
I [12:48:59]
I [12:48:59] Found configuration file: /home/game/.config/way-displays/cfg.yaml
I [12:48:59]
I [12:48:59] Active configuration:
I [12:48:59]   Arrange in a ROW aligned at the TOP
I [12:48:59]   Order:
I [12:48:59]     Dell Inc. Dell AW3821DW #HLAYMxgwABTR
I [12:48:59]   Scaling: OFF
I [12:48:59]   Auto scale: OFF
I [12:48:59]   Mode:
I [12:48:59]     Dell Inc. Dell AW3821DW #HLAYMxgwABTR: 3840x1600@120Hz
I [12:49:00]
I [12:49:00] DP-3 Arrived:
I [12:49:00]   info:
I [12:49:00]     name:     'DP-3'
I [12:49:00]     make:     'Dell Inc.'
I [12:49:00]     model:    'Dell AW3821DW'
I [12:49:00]     serial:   '#HLAYMxgwABTR'
I [12:49:00]     desc:     'Dell Inc. Dell AW3821DW #HLAYMxgwABTR (DP-3)'
I [12:49:00]     width:    880mm
I [12:49:00]     height:   370mm
I [12:49:00]     dpi:      110.34 @ 3840x1600
I [12:49:00]     mode:     3840 x 1600 @ 144 Hz  143,998 mHz
I [12:49:00]     mode:     3840 x 1600 @ 120 Hz  120,045 mHz 119,982 mHz
I [12:49:00]     mode:     3840 x 1600 @ 100 Hz   99,970 mHz
I [12:49:00]     mode:     3840 x 1600 @  96 Hz   96,036 mHz
I [12:49:00]     mode:     3840 x 1600 @  85 Hz   84,971 mHz
I [12:49:00]     mode:     3840 x 1600 @  72 Hz   72,020 mHz
I [12:49:00]     mode:     3840 x 1600 @  60 Hz   60,008 mHz  59,994 mHz (preferred)
I [12:49:00]     mode:     3840 x 1600 @  50 Hz   50,003 mHz
I [12:49:00]     mode:     3840 x 1600 @  48 Hz   48,009 mHz
I [12:49:00]     mode:     3840 x 1600 @  30 Hz   30,000 mHz  29,971 mHz
I [12:49:00]     mode:     3840 x 1600 @  25 Hz   25,001 mHz
I [12:49:00]     mode:     3840 x 1600 @  24 Hz   24,002 mHz  23,976 mHz
I [12:49:00]     mode:     1920 x 1200 @  60 Hz   59,994 mHz
I [12:49:00]     mode:     1920 x 1080 @  60 Hz   59,994 mHz
I [12:49:00]     mode:     1680 x 1050 @  60 Hz   59,994 mHz
I [12:49:00]     mode:     1600 x 1200 @  60 Hz   59,994 mHz
I [12:49:00]     mode:     1440 x  900 @  60 Hz   59,994 mHz
I [12:49:00]     mode:     1280 x 1024 @  60 Hz   59,994 mHz
I [12:49:00]     mode:     1280 x  800 @  60 Hz   59,994 mHz
I [12:49:00]     mode:     1280 x  720 @  60 Hz   59,994 mHz
I [12:49:00]     mode:     1024 x  768 @  60 Hz   60,004 mHz
I [12:49:00]     mode:      800 x  600 @  60 Hz   60,317 mHz
I [12:49:00]     mode:      640 x  480 @  60 Hz   60,000 mHz  59,940 mHz
I [12:49:00]   current:
I [12:49:00]     scale:    1.000 (1.149)
I [12:49:00]     position: 0,0
I [12:49:00]     mode:     3840x1600@60Hz (59,994mHz) (preferred)
I [12:49:00]     VRR:      off
I [12:49:00]
I [12:49:00] DP-3 Changing:
I [12:49:00]   from:
I [12:49:00]     scale:    1.000 (1.149)
I [12:49:00]     position: 0,0
I [12:49:00]     mode:     3840x1600@60Hz (59,994mHz) (preferred)
I [12:49:00]     VRR:      off
I [12:49:00]   to:
I [12:49:00]     mode:     3840x1600@120Hz (120,045mHz)
I [12:49:00]
I [12:49:00] Changes successful
I [12:49:00]
I [12:49:00] DP-3 Changing:
I [12:49:00]   from:
I [12:49:00]     scale:    1.000 (1.149)
I [12:49:00]     position: 0,0
I [12:49:00]     mode:     3840x1600@120Hz (120,045mHz)
I [12:49:00]     VRR:      off
I [12:49:00]   to:
I [12:49:00]     VRR:      on
I [12:49:00]
I [12:49:00] Changes successful

I've tested this in Sway 1.8.1 (https://github.com/alex-courtis/way-displays#sway) and River git c16628c (https://github.com/alex-courtis/way-displays#river) with Way-Displays 1.8.2 by placing Way-Displays's config at the top of the default config for Sway (~/.config/sway/config) and River (~/.config/river/init).

Is there any way to prevent the screen from going black after starting the compositor (meaning is there a way to update monitor settings earlier/synchronously with the start)?

alex-courtis commented 10 months ago

wlr and compositors will always set the preferred mode on startup before way-displays is connected, hence the change in mode.

It may be possible to prevent compositors from doing this initial mode set: