Repository: alacritty/alacritty (language: rust)

Issue:
Slow startup after upgrading to 0.13.0.
After upgrading to version 0.13.0 this morning and converting the .yml configuration to .toml, my terminal experiences a delay of about 3 seconds during the initial startup. 
After the first instance is up, the startup time for subsequent instances is super fast. However, after some minutes, the newly spawned terminal is delayed again, even though there is already a running instance.

```
$ for i in $(seq 0 10); do time alacritty -e echo; done 2>&1 | grep real
real	0m2.529s
real	0m0.166s
real	0m0.166s
real	0m0.177s
real	0m0.174s
real	0m0.174s
real	0m0.164s
real	0m0.179s
real	0m0.180s
real	0m0.171s
real	0m0.189s
```

Here is the output of strace -T alacritty -e false, where the poll() operation takes 2.3 seconds:
[log.txt](https://github.com/alacritty/alacritty/files/13785524/log.txt)

```
...
poll([{fd=3, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=3, revents=POLLOUT}]) <0.000008>
writev(3, [{iov_base="\214\10\2\0[\5\0\0", iov_len=8}], 1) = 8 <0.000009>
poll([{fd=3, events=POLLIN}], 1, -1)    = 1 ([{fd=3, revents=POLLIN}]) <2.334551>
recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\1\0\341\0\255\0\0\0!b\0\0!b\0\0\t\0\2\0\20\0\210\0\0\0\0\0\0\0\0\0"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 836 <0.000021>
...
```

### System

OS: Arch Linux x86_64 6.6.8-arch1-1
Version: alacritty 0.13.0 (78fa4d6f)
Linux: X11, AwesomeWM, no compositor
CPU: AMD Ryzen 5 5600H with Radeon Graphics (12) @ 4.280GHz
GPU: AMD ATI Radeon RX 5500/5500M / Pro 5500M
GPU: AMD ATI Radeon Vega Series / Radeon Vega Mobile Series

### Config

````toml
[font]
size = 8.0

[font.bold]
family = "Fira Code"
style = "Bold"

[font.bold_italic]
family = "Fira Code"
style = "Bold Italic"

[font.italic]
family = "Fira Code"
style = "Italic"

[font.normal]
family = "Fira Code"
style = "Regular"

[[keyboard.bindings]]
action = "CreateNewWindow"
key = "N"
mods = "Control|Shift"

[window.padding]
x = 5
y = 0
````

### Logs

Crashes: No
Font/Terminal size: `alacritty -vv`
```
[0.000004428s] [INFO ] [alacritty] Welcome to Alacritty
[0.000046527s] [INFO ] [alacritty] Version 0.13.0 (78fa4d6f)
[0.000056666s] [INFO ] [alacritty] Running on X11
[0.000302536s] [INFO ] [alacritty] Configuration files loaded from:
                                     "/home/meo/.config/alacritty/alacritty.toml"
[0.004251665s] [INFO ] [alacritty] Using GLX 1.4
[0.035732874s] [DEBUG] [alacritty] Picked GL Config:
                                     buffer_type: Some(Rgb { r_size: 8, g_size: 8, b_size: 8 })
                                     alpha_size: 8
                                     num_samples: 0
                                     hardware_accelerated: true
                                     supports_transparency: Some(true)
                                     config_api: Api(OPENGL | GLES1 | GLES2)
                                     srgb_capable: false
[2.379749191s] [INFO ] [alacritty] Window scale factor: 1.5
[2.380777575s] [DEBUG] [alacritty] Loading "Fira Code" font
[2.413275477s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[2.430887037s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[2.449586392s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[2.467498184s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[2.471062032s] [INFO ] [alacritty] Running on AMD Radeon Graphics (radeonsi, renoir, LLVM 16.0.6, DRM 3.54, 6.6.8-arch1-1)
[2.471074956s] [INFO ] [alacritty] OpenGL version 4.6 (Core Profile) Mesa 23.3.1-arch1.1, shader_version 4.60
[2.471086638s] [INFO ] [alacritty] Using OpenGL 3.3 renderer
[2.475114052s] [DEBUG] [alacritty] Enabled debug logging for OpenGL
[2.475192670s] [DEBUG] [alacritty] Filling glyph cache with common glyphs
[2.483605830s] [INFO ] [alacritty] Cell size: 10 x 20
[2.483622782s] [INFO ] [alacritty] Padding: 7 x 0
[2.483630306s] [INFO ] [alacritty] Width: 800, Height: 600
[2.484910100s] [INFO ] [alacritty] PTY dimensions: 30 x 78
[2.487822830s] [INFO ] [alacritty] Initialisation complete
[3.696621222s] [INFO ] [alacritty] Goodbye
```

Keyboard and bindings: `alacritty --print-events`

```
[0.000004378s] [INFO ] [alacritty] Welcome to Alacritty
[0.000048681s] [INFO ] [alacritty] Version 0.13.0 (78fa4d6f)
[0.000069911s] [INFO ] [alacritty] Running on X11
[0.000357319s] [INFO ] [alacritty] Configuration files loaded from:
                                     "/home/meo/.config/alacritty/alacritty.toml"
[0.001977821s] [INFO ] [alacritty] winit event: NewEvents(Init)
[0.001993159s] [INFO ] [alacritty] winit event: Resumed
[0.003701947s] [INFO ] [alacritty] Using GLX 1.4
[2.372697339s] [INFO ] [alacritty] Window scale factor: 1.5
[2.460093040s] [INFO ] [alacritty] Running on AMD Radeon Graphics (radeonsi, renoir, LLVM 16.0.6, DRM 3.54, 6.6.8-arch1-1)
[2.460122966s] [INFO ] [alacritty] OpenGL version 4.6 (Core Profile) Mesa 23.3.1-arch1.1, shader_version 4.60
[2.460128116s] [INFO ] [alacritty] Using OpenGL 3.3 renderer
[2.472511284s] [INFO ] [alacritty] Cell size: 10 x 20
[2.472533876s] [INFO ] [alacritty] Padding: 7 x 0
[2.472539907s] [INFO ] [alacritty] Width: 800, Height: 600
[2.476853658s] [INFO ] [alacritty] PTY dimensions: 30 x 78
[2.480556887s] [INFO ] [alacritty] Initialisation complete
[2.480580531s] [INFO ] [alacritty] winit event: DeviceEvent { device_id: DeviceId(X(DeviceId(13))), event: Key(RawKeyEvent { physical_key: Code(Enter), state: Released }) }
[2.480608393s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(62914565)), event: Ime(Enabled) }
[2.480740670s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(62914565)), event: Focused(false) }
[2.480755939s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(62914565)), event: RedrawRequested }
[2.490594256s] [INFO ] [alacritty] winit event: AboutToWait
[2.490652785s] [INFO ] [alacritty] winit event: NewEvents(WaitCancelled { start: Instant { tv_sec: 6077, tv_nsec: 113296395 }, requested_resume: Some(Instant { tv_sec: 6077, tv_nsec: 120193607 }) })
[2.490789321s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(62914565)), event: Moved(PhysicalPosition { x: 0, y: 20 }) }
[2.490812424s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(62914565)), event: Resized(PhysicalSize { width: 800, height: 600 }) }
[2.491038367s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(62914565)), event: Occluded(false) }
[2.491116844s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(62914565)), event: Focused(true) }
[2.491125239s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(62914565)), event: CursorMoved { device_id: DeviceId(X(DeviceId(2))), position: PhysicalPosition { x: 610.0, y: 487.0 } } }
[2.491383202s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(62914565)), event: CursorEntered { device_id: DeviceId(X(DeviceId(2))) } }
[2.491393111s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(62914565)), event: CursorMoved { device_id: DeviceId(X(DeviceId(2))), position: PhysicalPosition { x: 610.0, y: 487.0 } } }
[2.491412717s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(62914565)), event: RedrawRequested }
[2.495907196s] [INFO ] [alacritty] winit event: AboutToWait
[2.495938084s] [INFO ] [alacritty] winit event: NewEvents(WaitCancelled { start: Instant { tv_sec: 6077, tv_nsec: 118593455 }, requested_resume: Some(Instant { tv_sec: 6077, tv_nsec: 120193477 }) })
[2.495954965s] [INFO ] [alacritty] winit event: AboutToWait
[2.497536304s] [INFO ] [alacritty] winit event: NewEvents(ResumeTimeReached { start: Instant { tv_sec: 6077, tv_nsec: 118630034 }, requested_resume: Instant { tv_sec: 6077, tv_nsec: 120193477 } })
[2.497548747s] [INFO ] [alacritty] winit event: AboutToWait
[2.497571049s] [INFO ] [alacritty] winit event: NewEvents(WaitCancelled { start: Instant { tv_sec: 6077, tv_nsec: 120233734 }, requested_resume: None })
[2.497580497s] [INFO ] [alacritty] winit event: UserEvent(Event { window_id: Some(WindowId(WindowId(62914565))), payload: Frame })
[2.497589984s] [INFO ] [alacritty] winit event: UserEvent(Event { window_id: Some(WindowId(WindowId(62914565))), payload: Frame })
[2.497603400s] [INFO ] [alacritty] winit event: AboutToWait
[2.596430729s] [INFO ] [alacritty] winit event: NewEvents(WaitCancelled { start: Instant { tv_sec: 6077, tv_nsec: 120280101 }, requested_resume: None })
[2.596457409s] [INFO ] [alacritty] winit event: UserEvent(Event { window_id: Some(WindowId(WindowId(62914565))), payload: Terminal(Title(meo@arch:~/tmp)) })
[2.596468409s] [INFO ] [alacritty] winit event: UserEvent(Event { window_id: Some(WindowId(WindowId(62914565))), payload: Terminal(Wakeup) })
[2.596478358s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(62914565)), event: RedrawRequested }
[2.597627909s] [INFO ] [alacritty] winit event: AboutToWait
[2.597655079s] [INFO ] [alacritty] winit event: NewEvents(WaitCancelled { start: Instant { tv_sec: 6077, tv_nsec: 220313476 }, requested_resume: None })
[2.597899747s] [INFO ] [alacritty] winit event: UserEvent(Event { window_id: Some(WindowId(WindowId(62914565))), payload: Terminal(Wakeup) })
[2.597916278s] [INFO ] [alacritty] winit event: UserEvent(Event { window_id: Some(WindowId(WindowId(62914565))), payload: Frame })
[2.597928090s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(62914565)), event: RedrawRequested }
[2.599278887s] [INFO ] [alacritty] winit event: AboutToWait
[2.601696420s] [INFO ] [alacritty] winit event: NewEvents(ResumeTimeReached { start: Instant { tv_sec: 6077, tv_nsec: 221965627 }, requested_resume: Instant { tv_sec: 6077, tv_nsec: 224353811 } })
[2.601710968s] [INFO ] [alacritty] winit event: AboutToWait
[2.601722439s] [INFO ] [alacritty] winit event: NewEvents(WaitCancelled { start: Instant { tv_sec: 6077, tv_nsec: 224385525 }, requested_resume: None })
[2.601729442s] [INFO ] [alacritty] winit event: UserEvent(Event { window_id: Some(WindowId(WindowId(62914565))), payload: Frame })
[2.601734842s] [INFO ] [alacritty] winit event: AboutToWait
[3.080116773s] [INFO ] [alacritty] winit event: NewEvents(WaitCancelled { start: Instant { tv_sec: 6077, tv_nsec: 224407546 }, requested_resume: None })
[3.080411274s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(62914565)), event: ModifiersChanged(Modifiers { state: ModifiersState(CONTROL), pressed_mods: ModifiersKeys(0x0) }) }
[3.080463892s] [INFO ] [alacritty] winit event: AboutToWait
[3.080860394s] [INFO ] [alacritty] winit event: NewEvents(WaitCancelled { start: Instant { tv_sec: 6077, tv_nsec: 703233067 }, requested_resume: None })
[3.080939131s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(62914565)), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), event: KeyEvent { physical_key: Code(ControlLeft), logical_key: Named(Control), text: None, location: Left, state: Pressed, repeat: false, platform_specific: KeyEventExtra { key_without_modifiers: Named(Control), text_with_all_modifiers: None } }, is_synthetic: false } }
[3.080962134s] [INFO ] [alacritty] winit event: AboutToWait
[3.215969334s] [INFO ] [alacritty] winit event: NewEvents(WaitCancelled { start: Instant { tv_sec: 6077, tv_nsec: 703641992 }, requested_resume: None })
[3.216174397s] [INFO ] [alacritty] winit event: AboutToWait
[3.216637604s] [INFO ] [alacritty] winit event: NewEvents(WaitCancelled { start: Instant { tv_sec: 6077, tv_nsec: 838856589 }, requested_resume: None })
[3.216847717s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(62914565)), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), event: KeyEvent { physical_key: Code(KeyC), logical_key: Character("c"), text: Some("c"), location: Standard, state: Pressed, repeat: false, platform_specific: KeyEventExtra { key_without_modifiers: Character("c"), text_with_all_modifiers: Some("\u{3}") } }, is_synthetic: false } }
[3.216885648s] [INFO ] [alacritty] winit event: AboutToWait
[3.217172956s] [INFO ] [alacritty] winit event: NewEvents(WaitCancelled { start: Instant { tv_sec: 6077, tv_nsec: 839585032 }, requested_resume: None })
[3.217224682s] [INFO ] [alacritty] winit event: UserEvent(Event { window_id: Some(WindowId(WindowId(62914565))), payload: Terminal(Wakeup) })
[3.217238619s] [INFO ] [alacritty] winit event: UserEvent(Event { window_id: Some(WindowId(WindowId(62914565))), payload: Terminal(Wakeup) })
[3.217246123s] [INFO ] [alacritty] winit event: UserEvent(Event { window_id: Some(WindowId(WindowId(62914565))), payload: Terminal(Title(meo@arch:~/tmp)) })
[3.217254148s] [INFO ] [alacritty] winit event: UserEvent(Event { window_id: Some(WindowId(WindowId(62914565))), payload: Terminal(Wakeup) })
[3.217263836s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(62914565)), event: RedrawRequested }
[3.219674846s] [INFO ] [alacritty] winit event: AboutToWait
[3.219708630s] [INFO ] [alacritty] winit event: NewEvents(WaitCancelled { start: Instant { tv_sec: 6077, tv_nsec: 842363460 }, requested_resume: None })
[3.220031974s] [INFO ] [alacritty] winit event: UserEvent(Event { window_id: Some(WindowId(WindowId(62914565))), payload: Terminal(Wakeup) })
[3.220047263s] [INFO ] [alacritty] winit event: UserEvent(Event { window_id: Some(WindowId(WindowId(62914565))), payload: Frame })
[3.220075245s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(62914565)), event: RedrawRequested }
[3.221189841s] [INFO ] [alacritty] winit event: AboutToWait
[3.221215960s] [INFO ] [alacritty] winit event: NewEvents(WaitCancelled { start: Instant { tv_sec: 6077, tv_nsec: 843873786 }, requested_resume: None })
[3.221230196s] [INFO ] [alacritty] winit event: UserEvent(Event { window_id: Some(WindowId(WindowId(62914565))), payload: Frame })
[3.221238251s] [INFO ] [alacritty] winit event: AboutToWait
[3.365321502s] [INFO ] [alacritty] winit event: NewEvents(WaitCancelled { start: Instant { tv_sec: 6077, tv_nsec: 843913280 }, requested_resume: None })
[3.365575407s] [INFO ] [alacritty] winit event: AboutToWait
[3.365949817s] [INFO ] [alacritty] winit event: NewEvents(WaitCancelled { start: Instant { tv_sec: 6077, tv_nsec: 988267647 }, requested_resume: None })
[3.366068540s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(62914565)), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), event: KeyEvent { physical_key: Code(KeyC), logical_key: Character("c"), text: Some("c"), location: Standard, state: Released, repeat: false, platform_specific: KeyEventExtra { key_without_modifiers: Character("c"), text_with_all_modifiers: Some("\u{3}") } }, is_synthetic: false } }
[3.366108685s] [INFO ] [alacritty] winit event: AboutToWait
[3.561178437s] [INFO ] [alacritty] winit event: NewEvents(WaitCancelled { start: Instant { tv_sec: 6077, tv_nsec: 988788101 }, requested_resume: None })
[3.561375215s] [INFO ] [alacritty] winit event: AboutToWait
[3.561882093s] [INFO ] [alacritty] winit event: NewEvents(WaitCancelled { start: Instant { tv_sec: 6078, tv_nsec: 184063067 }, requested_resume: None })
[3.562025952s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(62914565)), event: KeyboardInput { device_id: DeviceId(X(DeviceId(3))), event: KeyEvent { physical_key: Code(KeyD), logical_key: Character("d"), text: Some("d"), location: Standard, state: Pressed, repeat: false, platform_specific: KeyEventExtra { key_without_modifiers: Character("d"), text_with_all_modifiers: Some("\u{4}") } }, is_synthetic: false } }
[3.562057361s] [INFO ] [alacritty] winit event: AboutToWait
[3.562301508s] [INFO ] [alacritty] winit event: NewEvents(WaitCancelled { start: Instant { tv_sec: 6078, tv_nsec: 184750944 }, requested_resume: None })
[3.562339168s] [INFO ] [alacritty] winit event: UserEvent(Event { window_id: Some(WindowId(WindowId(62914565))), payload: Terminal(Wakeup) })
[3.562352744s] [INFO ] [alacritty] winit event: WindowEvent { window_id: WindowId(WindowId(62914565)), event: RedrawRequested }
[3.563693292s] [INFO ] [alacritty] winit event: AboutToWait
[3.563721935s] [INFO ] [alacritty] winit event: NewEvents(WaitCancelled { start: Instant { tv_sec: 6078, tv_nsec: 186379180 }, requested_resume: None })
[3.563740891s] [INFO ] [alacritty] winit event: UserEvent(Event { window_id: Some(WindowId(WindowId(62914565))), payload: Terminal(Exit) })
[3.568134100s] [INFO ] [alacritty] winit event: UserEvent(Event { window_id: Some(WindowId(WindowId(62914565))), payload: Terminal(Wakeup) })
[3.568155741s] [INFO ] [alacritty] winit event: UserEvent(Event { window_id: Some(WindowId(WindowId(62914565))), payload: Frame })
[3.568164176s] [INFO ] [alacritty] winit event: AboutToWait
[3.568172512s] [INFO ] [alacritty] winit event: LoopExiting
[3.569863927s] [INFO ] [alacritty] Goodbye
```


Discussion / hints:
Try 0.12.3 again. This is almost certainly a driver initialization issue.
Hm, it actually looks not like a driver init issue, since the GL code is not what is being executed in the relevant logs, since between the picked config and `Window scale factor` there's **no** GL codes at all.

It would be nice to know what exactly blocks for that long though... Probably window creation itself just got slower by that amount.
You may try something like that to profile

```diff
diff --git a/alacritty/src/display/window.rs b/alacritty/src/display/window.rs
index f36d05e9..0c472dff 100644
--- a/alacritty/src/display/window.rs
+++ b/alacritty/src/display/window.rs
@@ -163,6 +163,7 @@ impl Window {
             window_builder = window_builder.with_embed_parent_window(parent_window_id);
         }
 
+        let t1 = std::time::Instant::now();
         let window = window_builder
             .with_title(&identity.title)
             .with_theme(config.window.decorations_theme_variant)
@@ -172,6 +173,7 @@ impl Window {
             .with_maximized(config.window.maximized())
             .with_fullscreen(config.window.fullscreen())
             .build(event_loop)?;
+        eprintln!("Time to build window {:?}", t1.elapsed());
 
         // Text cursor.
         let current_mouse_cursor = CursorIcon::Text;

```

And then just move this `t1` logging to locale the issue. Though, if you globally updated the system a reboot might fix it.
wrt pattern it looks really like a driver issue, but I'm just confused that there's no GL/GLX code run where you actually block for that long, so maybe it's something else...
Here is your log after applying the patch:
```
[0.000004409s] [INFO ] [alacritty] Welcome to Alacritty
[0.000044544s] [INFO ] [alacritty] Version 0.14.0-dev (ea450f51)
[0.000052759s] [INFO ] [alacritty] Running on X11
[0.000309640s] [INFO ] [alacritty] Configuration files loaded from:
                                     "/home/meo/.config/alacritty/alacritty.toml"
[0.003891802s] [INFO ] [alacritty] Using GLX 1.4
[0.037016696s] [DEBUG] [alacritty] Picked GL Config:
                                     buffer_type: Some(Rgb { r_size: 8, g_size: 8, b_size: 8 })
                                     alpha_size: 8
                                     num_samples: 0
                                     hardware_accelerated: true
                                     supports_transparency: Some(true)
                                     config_api: Api(OPENGL | GLES1 | GLES2)
                                     srgb_capable: false
Time to build window 2.333872208s
[2.379002655s] [INFO ] [alacritty] Window scale factor: 1.5
[2.380403546s] [DEBUG] [alacritty] Loading "Fira Code" font
[2.412092393s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[2.430565666s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[2.448612881s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[2.465263443s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[2.469755046s] [INFO ] [alacritty] Running on AMD Radeon Graphics (radeonsi, renoir, LLVM 16.0.6, DRM 3.54, 6.6.8-arch1-1)
[2.469768311s] [INFO ] [alacritty] OpenGL version 4.6 (Core Profile) Mesa 23.3.1-arch1.1, shader_version 4.60
[2.469773731s] [INFO ] [alacritty] Using OpenGL 3.3 renderer
[2.474312683s] [DEBUG] [alacritty] Enabled debug logging for OpenGL
[2.475103603s] [DEBUG] [alacritty] Filling glyph cache with common glyphs
[2.483689477s] [INFO ] [alacritty] Cell size: 10 x 20
[2.483705587s] [INFO ] [alacritty] Padding: 7 x 0
[2.483712570s] [INFO ] [alacritty] Width: 800, Height: 600
[2.485637962s] [INFO ] [alacritty] PTY dimensions: 30 x 78
[2.488459651s] [INFO ] [alacritty] Initialisation complete
[20.360558231s] [INFO ] [alacritty] Goodbye
```
@notgull do you have an idea what could cause it, since it's likely after your x11rb changes?
Besides, @hitori1403 , I'd suggest to either reboot and then bisect this to locate the issue.
Already rebooted; the issue persists. Switched to the old version 0.12.3, and it works perfectly with no delays.
```
meo@arch ~/alacritty $ time target/release/alacritty -vv -e false
Created log file at "/tmp/Alacritty-1139.log"
[0.000286978s] [INFO ] [alacritty] Welcome to Alacritty
[0.000533099s] [INFO ] [alacritty] Version 0.14.0-dev (ea450f51)
[0.000542178s] [INFO ] [alacritty] Running on X11
[0.003092293s] [INFO ] [alacritty] Configuration files loaded from:
                                     "/home/meo/.config/alacritty/alacritty.toml"
[0.006599373s] [INFO ] [alacritty] Using GLX 1.4
[0.039565927s] [DEBUG] [alacritty] Picked GL Config:
                                     buffer_type: Some(Rgb { r_size: 8, g_size: 8, b_size: 8 })
                                     alpha_size: 8
                                     num_samples: 0
                                     hardware_accelerated: true
                                     supports_transparency: Some(true)
                                     config_api: Api(OPENGL | GLES1 | GLES2)
                                     srgb_capable: false
Time to build window 2.36044011s
[2.402346837s] [INFO ] [alacritty] Window scale factor: 1.5
[2.403383212s] [DEBUG] [alacritty] Loading "Fira Code" font
[2.435875334s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[2.453697573s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[2.470567316s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[2.486570399s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[2.491166305s] [INFO ] [alacritty] Running on AMD Radeon Graphics (radeonsi, renoir, LLVM 16.0.6, DRM 3.54, 6.6.8-arch1-1)
[2.491184953s] [INFO ] [alacritty] OpenGL version 4.6 (Core Profile) Mesa 23.3.1-arch1.1, shader_version 4.60
[2.491192495s] [INFO ] [alacritty] Using OpenGL 3.3 renderer
[2.499266847s] [DEBUG] [alacritty] Enabled debug logging for OpenGL
[2.499362459s] [DEBUG] [alacritty] Filling glyph cache with common glyphs
[2.509304646s] [INFO ] [alacritty] Cell size: 10 x 20
[2.509321338s] [INFO ] [alacritty] Padding: 7 x 0
[2.509327833s] [INFO ] [alacritty] Width: 800, Height: 600
[2.516766279s] [INFO ] [alacritty] PTY dimensions: 30 x 78
[2.520877836s] [INFO ] [alacritty] Initialisation complete
[2.536330080s] [INFO ] [alacritty] Goodbye
Deleted log file at "/tmp/Alacritty-1139.log"

real	0m2.614s
user	0m0.138s
sys	0m0.062s
```

WezTerm also affected.
```
meo@arch ~/alacritty $ time wezterm -e false
18:56:42.623  WARN   window::os::x11::connection > Unable to resolve appearance using xdg-desktop-portal: get_appearance.read_setting: Reading xdg-portal org.freedesktop.appearance color-scheme: org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.portal.Settings” on object at path /org/freedesktop/portal/desktop

real	0m2.661s
user	0m0.044s
sys	0m0.058s
meo@arch ~/alacritty $ time wezterm -e false
18:56:43.543  WARN   window::os::x11::connection > Unable to resolve appearance using xdg-desktop-portal: get_appearance.read_setting: Reading xdg-portal org.freedesktop.appearance color-scheme: org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.portal.Settings” on object at path /org/freedesktop/portal/desktop

real	0m0.126s
user	0m0.064s
sys	0m0.043s
```
yeah, but wezterm has nothing to do with anything alacritty uses and we don't use what wezterm is using, at least directly in any code I'm aware of. This error could also make GTK apps to start with delay, but at this point I'd suggest to just bisect.
After bisecting, I found that commit 80d4dacc is causing a problem.
Could you `git checkout 6071a7bf` (the last working commit), and then apply this patch:

```diff
diff --git a/alacritty/Cargo.toml b/alacritty/Cargo.toml
index 44a8bc2f..2b33bfa5 100644
--- a/alacritty/Cargo.toml
+++ b/alacritty/Cargo.toml
@@ -40,7 +40,7 @@ serde_json = "1"
 serde_yaml = "0.9.25"
 toml = "0.8.2"
 unicode-width = "0.1"
-winit = { version = "0.29.1-beta", default-features = false, features = ["serde"] }
+winit = { git = "https://github.com/kchibisov/winit", rev = "a857d3faacc62e26e49f129263bdc0a0ac2d85c2", default-features = false, features = ["serde"] }

 [build-dependencies]
 gl_generator = "0.14.0"

```

I'd expect it to fail, and then apply this

```diff
diff --git a/alacritty/Cargo.toml b/alacritty/Cargo.toml
index 44a8bc2f..fd6dff3f 100644
--- a/alacritty/Cargo.toml
+++ b/alacritty/Cargo.toml
@@ -40,7 +40,7 @@ serde_json = "1"
 serde_yaml = "0.9.25"
 toml = "0.8.2"
 unicode-width = "0.1"
-winit = { version = "0.29.1-beta", default-features = false, features = ["serde"] }
+winit = { git = "https://github.com/kchibisov/winit", rev = "a444db37fdf839e124a53deb1d886973ab339a21", default-features = false, features = ["serde"] }

 [build-dependencies]
 gl_generator = "0.14.0"

```

This thing should probably work.
I am experiencing the same issue, but to a smaller extent. The initial delay is around 1 second. Arch Linux + KDE.
The first patch failed, but the second patch is working like a charm. Thank you.
I mean, we just bisected to exact commit @hitori1403 .
Got it. I'm looking forward to your fixes in the next version. Thanks!
Can't reproduce on latest Xubuntu; on latest `master`, window builds in 3.9ms for me
I mean, it could be wm related, since for now it was kwin or awesome.
I am experiencing noticeably slow startup after this upgrade too.
@hitori1403 Can you run `xtrace` on the Alacritty executable and upload the full logs to Gist? It would give us a better picture of what's happening.
I am also experiencing a few second delay with Arch Linux package version `0.13.0-2` which does not occur after downgrading back to `0.12.3-1`. This is with i3 window manager.
@notgull I didn't see any special info in my `xtrace`. The `alacritty`'s log is the same as before.

```
meo@arch ~/alacritty $ xtrace target/release/alacritty -vv -e false
Function              File                                                  Line
--------------------------------------------------------------------------------
Press return here to close xterm(target/release/alacritty).
```
that's a different xtrace, you need the one called `x11trace`, it's canonical name is `xtrace` though, but there're other tools called like that, you may also have multiple, so `which -a xtrace`.

One of them should dump x11 events.
Here is my command: `x11trace target/release/alacritty -vv -e false`.
I noticed a delay in the trace log after the following line is printed.
```
000:>:00db: Event Generic(35) XInputExtension(131) RawKeyRelease(14) extension=0x83 length=2 evtype=0x000e data=0x03,0x00,0x4f,0xd6,0x4d,0x00,0x24,0x00,0x00,0x00,0x0b,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00;
```
[x11trace.log](https://github.com/alacritty/alacritty/files/13790427/x11trace.log)

Could you try

```diff
diff --git a/alacritty/Cargo.toml b/alacritty/Cargo.toml
index ad732cfd..71e4a630 100644
--- a/alacritty/Cargo.toml
+++ b/alacritty/Cargo.toml
@@ -39,7 +39,8 @@ serde_json = "1"
 serde_yaml = "0.9.25"
 toml = "0.8.2"
 unicode-width = "0.1"
-winit = { version = "0.29.7", default-features = false, features = ["rwh_05", "serde"] }
+winit = { git = "https://github.com/kchibisov/winit", rev = "86a702e20923358150b5ab7124f506402eb81e28", default-features = false, features = ["rwh_05", "serde"] }
+#winit = { git = "https://github.com/kchibisov/winit", rev = "f0ddc868e38c67abacfde9d3b9f762a24ee0a9d2", default-features = false, features = ["rwh_05", "serde"] }

 [build-dependencies]
 gl_generator = "0.14.0"
```

When then after it fails (or not fails, doesn't matter) comment out `winit` line and un-comment other winit line, just outs should be enough (without trace).
Also, could you test with `alacritty -o debug.prefer_egl=true`? Just from latest release.
First `winit`: Worked.
```
Created log file at "/tmp/Alacritty-30716.log"
[0.000001783s] [INFO ] [alacritty] Welcome to Alacritty
[0.000077766s] [INFO ] [alacritty] Version 0.14.0-dev (91e3cd6a)
[0.000091942s] [INFO ] [alacritty] Running on X11
[0.000551674s] [INFO ] [alacritty] Configuration files loaded from:
                                     "/home/meo/.config/alacritty/alacritty.toml"
[0.008122789s] [INFO ] [alacritty] Using GLX 1.4
[0.096483743s] [DEBUG] [alacritty] Picked GL Config:
                                     buffer_type: Some(Rgb { r_size: 8, g_size: 8, b_size: 8 })
                                     alpha_size: 8
                                     num_samples: 0
                                     hardware_accelerated: true
                                     supports_transparency: Some(true)
                                     config_api: Api(OPENGL | GLES1 | GLES2)
                                     srgb_capable: false
Time to guess random monitor thing: 491ns
[0.101849893s] [INFO ] [alacritty] Window scale factor: 1
[0.104376821s] [DEBUG] [alacritty] Loading "Fira Code" font
[0.204057257s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[0.259541843s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[0.318224243s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[0.372371371s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[0.383119312s] [INFO ] [alacritty] Running on AMD Radeon Graphics (radeonsi, renoir, LLVM 16.0.6, DRM 3.54, 6.6.8-arch1-1)
[0.383144158s] [INFO ] [alacritty] OpenGL version 4.6 (Core Profile) Mesa 23.3.1-arch1.1, shader_version 4.60
[0.383154398s] [INFO ] [alacritty] Using OpenGL 3.3 renderer
[0.395625800s] [DEBUG] [alacritty] Enabled debug logging for OpenGL
[0.397302383s] [DEBUG] [alacritty] Filling glyph cache with common glyphs
[0.421404762s] [INFO ] [alacritty] Cell size: 7 x 14
[0.421461668s] [INFO ] [alacritty] Padding: 5 x 0
[0.421477819s] [INFO ] [alacritty] Width: 800, Height: 600
[0.425813618s] [INFO ] [alacritty] PTY dimensions: 42 x 112
[0.434090005s] [INFO ] [alacritty] Initialisation complete
[0.472564609s] [INFO ] [alacritty] Goodbye
Deleted log file at "/tmp/Alacritty-30716.log"
```
[winit1_log_egl.txt](https://github.com/alacritty/alacritty/files/13790766/winit1_log_egl.txt)
[winit1_log.txt](https://github.com/alacritty/alacritty/files/13790767/winit1_log.txt)

Second `winit`: Delay happened.
[winit2_log_egl.txt](https://github.com/alacritty/alacritty/files/13790757/winit2_log_egl.txt)
[winit2_log.txt](https://github.com/alacritty/alacritty/files/13790758/winit2_log.txt)

@hitori1403 so the `EGL` is also broken?
@hitori1403 could you now apply this

```diff
diff --git a/alacritty/Cargo.toml b/alacritty/Cargo.toml
index ad732cfd..6fb2e105 100644
--- a/alacritty/Cargo.toml
+++ b/alacritty/Cargo.toml
@@ -39,7 +39,7 @@ serde_json = "1"
 serde_yaml = "0.9.25"
 toml = "0.8.2"
 unicode-width = "0.1"
-winit = { version = "0.29.7", default-features = false, features = ["rwh_05", "serde"] }
+winit = { git = "https://github.com/kchibisov/winit", rev = "7a74c3a255152fb803dbc894dfa48fe0c451df54", default-features = false, features = ["rwh_05", "serde"] }

 [build-dependencies]
 gl_generator = "0.14.0"

```

I think that should locate it even further.
Yes, when using the second `winit` line, the `EGL` is broken as well.

> @hitori1403 so the `EGL` is also broken?


> @hitori1403 could you now apply this
> 
> ```diff
> diff --git a/alacritty/Cargo.toml b/alacritty/Cargo.toml
> index ad732cfd..6fb2e105 100644
> --- a/alacritty/Cargo.toml
> +++ b/alacritty/Cargo.toml
> @@ -39,7 +39,7 @@ serde_json = "1"
>  serde_yaml = "0.9.25"
>  toml = "0.8.2"
>  unicode-width = "0.1"
> -winit = { version = "0.29.7", default-features = false, features = ["rwh_05", "serde"] }
> +winit = { git = "https://github.com/kchibisov/winit", rev = "7a74c3a255152fb803dbc894dfa48fe0c451df54", default-features = false, features = ["rwh_05", "serde"] }
> 
>  [build-dependencies]
>  gl_generator = "0.14.0"
> ```
> 
> I think that should locate it even further.

Here is your new log. `EGL` is delayed too:
```
Created log file at "/tmp/Alacritty-33949.log"
[0.000001503s] [INFO ] [alacritty] Welcome to Alacritty
[0.000080501s] [INFO ] [alacritty] Version 0.14.0-dev (91e3cd6a)
[0.000094167s] [INFO ] [alacritty] Running on X11
[0.000607489s] [INFO ] [alacritty] Configuration files loaded from:
                                     "/home/meo/.config/alacritty/alacritty.toml"
[0.008310982s] [INFO ] [alacritty] Using GLX 1.4
[0.094088061s] [DEBUG] [alacritty] Picked GL Config:
                                     buffer_type: Some(Rgb { r_size: 8, g_size: 8, b_size: 8 })
                                     alpha_size: 8
                                     num_samples: 0
                                     hardware_accelerated: true
                                     supports_transparency: Some(true)
                                     config_api: Api(OPENGL | GLES1 | GLES2)
                                     srgb_capable: false
Screen resource  2.351377094s
Randr CTRC info  8.967µs
Primary 891.992µs
Cookie 5.069µs
Some complex iterator 18.144989ms
Time to list availabe monitors: 2.37054967s
Time to query pointer: 188.273µs
[2.469847048s] [INFO ] [alacritty] Window scale factor: 1.5
[2.472761372s] [DEBUG] [alacritty] Loading "Fira Code" font
[2.562136927s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[2.613648434s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[2.660706080s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[2.712817561s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[2.723789833s] [INFO ] [alacritty] Running on AMD Radeon Graphics (radeonsi, renoir, LLVM 16.0.6, DRM 3.54, 6.6.8-arch1-1)
[2.723830629s] [INFO ] [alacritty] OpenGL version 4.6 (Core Profile) Mesa 23.3.1-arch1.1, shader_version 4.60
[2.723840868s] [INFO ] [alacritty] Using OpenGL 3.3 renderer
[2.736298705s] [DEBUG] [alacritty] Enabled debug logging for OpenGL
[2.737811091s] [DEBUG] [alacritty] Filling glyph cache with common glyphs
[2.762934694s] [INFO ] [alacritty] Cell size: 10 x 20
[2.762976482s] [INFO ] [alacritty] Padding: 7 x 0
[2.762989697s] [INFO ] [alacritty] Width: 800, Height: 600
[2.767231570s] [INFO ] [alacritty] PTY dimensions: 30 x 78
[2.775715426s] [INFO ] [alacritty] Initialisation complete
[2.812851691s] [INFO ] [alacritty] Goodbye
Deleted log file at "/tmp/Alacritty-33949.log"
```
@hitori1403 Can you try this:

```diff
diff --git a/alacritty/Cargo.toml b/alacritty/Cargo.toml
index ad732cfd..6fb2e105 100644
--- a/alacritty/Cargo.toml
+++ b/alacritty/Cargo.toml
@@ -39,7 +39,7 @@ serde_json = "1"
 serde_yaml = "0.9.25"
 toml = "0.8.2"
 unicode-width = "0.1"
-winit = { version = "0.29.7", default-features = false, features = ["rwh_05", "serde"] }
+winit = { git = "https://github.com/rust-windowing/winit", branch = "notgull/cache-randr-version", default-features = false, features = ["rwh_05", "serde"] }

 [build-dependencies]
 gl_generator = "0.14.0"
```

@notgull 
```
[0.000077074s] [INFO ] [alacritty] Version 0.14.0-dev (91e3cd6a)
[0.000091251s] [INFO ] [alacritty] Running on X11
[0.000584867s] [INFO ] [alacritty] Configuration files loaded from:
                                     "/home/meo/.config/alacritty/alacritty.toml"
[0.008668449s] [INFO ] [alacritty] Using GLX 1.4
[0.094259616s] [DEBUG] [alacritty] Picked GL Config:
                                     buffer_type: Some(Rgb { r_size: 8, g_size: 8, b_size: 8 })
                                     alpha_size: 8
                                     num_samples: 0
                                     hardware_accelerated: true
                                     supports_transparency: Some(true)
                                     config_api: Api(OPENGL | GLES1 | GLES2)
                                     srgb_capable: false
[2.468239449s] [INFO ] [alacritty] Window scale factor: 1.5
[2.471563974s] [DEBUG] [alacritty] Loading "Fira Code" font
[2.567960690s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[2.626156714s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[2.683931498s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[2.736560912s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[2.746997357s] [INFO ] [alacritty] Running on AMD Radeon Graphics (radeonsi, renoir, LLVM 16.0.6, DRM 3.54, 6.6.8-arch1-1)
[2.747018006s] [INFO ] [alacritty] OpenGL version 4.6 (Core Profile) Mesa 23.3.1-arch1.1, shader_version 4.60
[2.747026231s] [INFO ] [alacritty] Using OpenGL 3.3 renderer
[2.759414166s] [DEBUG] [alacritty] Enabled debug logging for OpenGL
[2.759824426s] [DEBUG] [alacritty] Filling glyph cache with common glyphs
[2.784159009s] [INFO ] [alacritty] Cell size: 10 x 20
[2.784197671s] [INFO ] [alacritty] Padding: 7 x 0
[2.784210676s] [INFO ] [alacritty] Width: 800, Height: 600
[2.789476272s] [INFO ] [alacritty] PTY dimensions: 30 x 78
[2.797740302s] [INFO ] [alacritty] Initialisation complete
[2.832950343s] [INFO ] [alacritty] Goodbye
```
@hitori1403 so is this working or not?
Ah, sorry, it's not working.
It is still being delayed.
@xrchz @jturner314 What is your hardware setup? My current belief is that this is tied to the GPU somehow, as I've been unable to replicate this 

@hitori1403 Thank you for your patience in helping us discover the source of this bug. Would you be able to hop onto a call (maybe Discord?) in order to debug this issue in real time? If so, when? I'm in PST, not sure where you are.
> @xrchz @jturner314 What is your hardware setup? My current belief is that this is tied to the GPU somehow, as I've been unable to replicate this

GPU-wise it's NVIDIA GeForce RTX 3060 (Driver Version: 545.29.06    CUDA Version: 12.3).
CPU is 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz, with integrated graphics VGA compatible controller: Intel Corporation TigerLake-H GT1 [UHD Graphics] (rev 01).
This is a laptop.
@notgull Sure! I'm glad to help out. I'm currently in Vietnam, and I'm usually free in the evenings. Feel free to contact me. I'm open to using Discord or any other platform.
From the original comment:
```
...
poll([{fd=3, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=3, revents=POLLOUT}]) <0.000008>
writev(3, [{iov_base="\214\10\2\0[\5\0\0", iov_len=8}], 1) = 8 <0.000009>
poll([{fd=3, events=POLLIN}], 1, -1)    = 1 ([{fd=3, revents=POLLIN}]) <2.334551>
recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\1\0\341\0\255\0\0\0!b\0\0!b\0\0\t\0\2\0\20\0\210\0\0\0\0\0\0\0\0\0"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 836 <0.000021>
...
```
Yay, decoding raw X11 data is always fun. So, the `writev(3, [{iov_base="\214\10\2\0[\5\0\0", iov_len=8}], 1) ` is major opcode `\214`. Assuming I got my octal right, that's decimal 140. `printf %o\\n 140` in a terminal confirms this.

@hitori1403  Could you run this again and without rebooting, run `$ xdpyinfo -queryExtensions | grep opcode`?
The opcodes are dynamically assigned when the X11 server is starting. For my currently running X11 server, this opcode is from RANDR, which would make a bit of sense.
```
$ xdpyinfo -queryExtensions | grep 'opcode: 140'
    RANDR  (opcode: 140, base event: 89, base error: 147)
```
Next, minor opcode is `\10`, so 8. That would then be a GetScreenResources request, which is known to be sometimes slow.
```
$ grep ' 8$' /usr/include/xcb/randr.h | grep define
#define XCB_RANDR_GET_SCREEN_RESOURCES 8
```
The next two bytes are the length of the request (2 four-byte-units) and the root window that the request is sent to (too lazy to decode that and I don't really care).

So, assuming opcode 140 is RANDR for @hitori1403 , too, this would come from this code: https://github.com/rust-windowing/winit/blob/ca1674519ab3d8df4ce231fe018196a3981c7dea/src/platform_impl/linux/x11/monitor.rs#L355

@hitori1403 Could you also run `xrandr --version`?:
```
$ xrandr --version
xrandr program version       1.5.2
Server reports RandR version 1.6
```
I am asking, because the above code is supposed to be unreachable. RandR 1.3 added a faster way for querying screen information that just queries from the X11 server's cache and does not have to (slowly) query the hardware again.

Uhm... actually.
https://github.com/rust-windowing/winit/blob/ca1674519ab3d8df4ce231fe018196a3981c7dea/src/platform_impl/linux/x11/monitor.rs#L347
This code is fishy. You are telling the X11 server that the newest RandR version you support is version 0.0. I'll ignore the fact that this does not exist, but the Xorg server might actually listen to this and disable newer features. Or at least it won't tell you about a newer version than you asked for. https://gitlab.freedesktop.org/xorg/xserver/-/blob/f59871587ea678d4c498874895f4b97687764ee1/randr/rrdispatch.c#L50-59

One of the people here could cook up a patch / experiment to change that `randr_query_version(0, 0)` to `randr_query_version(1, 3)` (or whatever version of randr winit actually "hopes for").

Edit:
```diff
diff --git a/src/platform_impl/linux/x11/monitor.rs b/src/platform_impl/linux/x11/monitor.rs
index 09e42d66..e5859ac3 100644
--- a/src/platform_impl/linux/x11/monitor.rs
+++ b/src/platform_impl/linux/x11/monitor.rs
@@ -344,7 +344,7 @@ impl ScreenResources {
         conn: &impl x11rb::connection::Connection,
         root: &x11rb::protocol::xproto::Screen,
     ) -> Result<Self, X11Error> {
-        let version = conn.randr_query_version(0, 0)?.reply()?;
+        let version = conn.randr_query_version(1, 3)?.reply()?;
 
         if (version.major_version == 1 && version.minor_version >= 3) || version.major_version > 1 {
             let reply = conn
```
Here is your requested info:
```
$ xdpyinfo -queryExtensions | grep opcode
    BIG-REQUESTS  (opcode: 133)
    Composite  (opcode: 142)
    DAMAGE  (opcode: 143, base event: 91, base error: 152)
    DOUBLE-BUFFER  (opcode: 145, base error: 153)
    DPMS  (opcode: 147)
    DRI2  (opcode: 155, base event: 119)
    DRI3  (opcode: 149)
    GLX  (opcode: 152, base event: 95, base error: 158)
    Generic Event Extension  (opcode: 128)
    MIT-SCREEN-SAVER  (opcode: 144, base event: 92)
    MIT-SHM  (opcode: 130, base event: 65, base error: 128)
    Present  (opcode: 148)
    RANDR  (opcode: 140, base event: 89, base error: 147)
    RECORD  (opcode: 146, base error: 154)
    RENDER  (opcode: 139, base error: 142)
    SECURITY  (opcode: 137, base event: 86, base error: 138)
    SHAPE  (opcode: 129, base event: 64)
    SYNC  (opcode: 134, base event: 83, base error: 134)
    X-Resource  (opcode: 150)
    XC-MISC  (opcode: 136)
    XFIXES  (opcode: 138, base event: 87, base error: 140)
    XFree86-DGA  (opcode: 154, base event: 112, base error: 179)
    XFree86-VidModeExtension  (opcode: 153, base error: 172)
    XINERAMA  (opcode: 141)
    XInputExtension  (opcode: 131, base event: 66, base error: 129)
    XKEYBOARD  (opcode: 135, base event: 85, base error: 137)
    XTEST  (opcode: 132)
    XVideo  (opcode: 151, base event: 93, base error: 155)
```
```
$ grep ' 8$' /usr/include/xcb/randr.h | grep define
#define XCB_RANDR_GET_SCREEN_RESOURCES 8
```
```
$ xrandr --version
xrandr program version       1.5.2
Server reports RandR version 1.6
```
@psychon, your patch is good; the delayed startup is gone. Here is the patch that I applied based on your guide:

```diff
diff --git a/alacritty/Cargo.toml b/alacritty/Cargo.toml
index ad732cfd..dafd18f8 100644
--- a/alacritty/Cargo.toml
+++ b/alacritty/Cargo.toml
@@ -39,7 +39,7 @@ serde_json = "1"
 serde_yaml = "0.9.25"
 toml = "0.8.2"
 unicode-width = "0.1"
-winit = { version = "0.29.7", default-features = false, features = ["rwh_05", "serde"] }
+winit = { git = "https://github.com/hitori1403/winit", default-features = false, features = ["rwh_05", "serde"] }

 [build-dependencies]
 gl_generator = "0.14.0"
```

```
$ target/release/alacritty -vv -e false
Created log file at "/tmp/Alacritty-43853.log"
[0.000001885s] [INFO ] [alacritty] Welcome to Alacritty
[0.000047212s] [INFO ] [alacritty] Version 0.14.0-dev (91e3cd6a)
[0.000056711s] [INFO ] [alacritty] Running on X11
[0.000314285s] [INFO ] [alacritty] Configuration files loaded from:
                                     "/home/meo/.config/alacritty/alacritty.toml"
[0.003836731s] [INFO ] [alacritty] Using GLX 1.4
[0.034186541s] [DEBUG] [alacritty] Picked GL Config:
                                     buffer_type: Some(Rgb { r_size: 8, g_size: 8, b_size: 8 })
                                     alpha_size: 8
                                     num_samples: 0
                                     hardware_accelerated: true
                                     supports_transparency: Some(true)
                                     config_api: Api(OPENGL | GLES1 | GLES2)
                                     srgb_capable: false
[0.036256986s] [INFO ] [alacritty] Window scale factor: 1.5
[0.037077271s] [DEBUG] [alacritty] Loading "Fira Code" font
[0.068770269s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[0.086062343s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Bold, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[0.103802798s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[0.120613246s] [DEBUG] [crossfont] Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
[0.124520237s] [INFO ] [alacritty] Running on AMD Radeon Graphics (radeonsi, renoir, LLVM 16.0.6, DRM 3.54, 6.6.8-arch1-1)
[0.124536301s] [INFO ] [alacritty] OpenGL version 4.6 (Core Profile) Mesa 23.3.1-arch1.1, shader_version 4.60
[0.124542587s] [INFO ] [alacritty] Using OpenGL 3.3 renderer
[0.129140657s] [DEBUG] [alacritty] Enabled debug logging for OpenGL
[0.130335502s] [DEBUG] [alacritty] Filling glyph cache with common glyphs
[0.139082145s] [INFO ] [alacritty] Cell size: 10 x 20
[0.139100933s] [INFO ] [alacritty] Padding: 7 x 0
[0.139108685s] [INFO ] [alacritty] Width: 800, Height: 600
[0.144409080s] [INFO ] [alacritty] PTY dimensions: 30 x 78
[0.148110598s] [INFO ] [alacritty] Initialisation complete
[0.163691072s] [INFO ] [alacritty] Goodbye
Deleted log file at "/tmp/Alacritty-43853.log"
```

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 16601355b18..f988f21dd40 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
 - Alternate keys not sent for `Shift + <number>` when using kitty protocol
 - Alternative keys being swapped in kitty protocol implementation
 - Powerline glyphs being cut for narrow fonts
+- Xmodmap not working on X11
+- Occasional slow startup on some X11 window managers
+- Blurry window when using `window.dimensions` on some Wayland compositors
+- IME input lagging behind on X11
+- xdotool modifiers input not working correctly on X11
 
 ## 0.13.0
 
diff --git a/Cargo.lock b/Cargo.lock
index 0783e44e1c2..adfbb411e7f 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2309,9 +2309,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
 
 [[package]]
 name = "winit"
-version = "0.29.7"
+version = "0.29.8"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7fd430cd4560ee9c48885a4ef473b609a56796e37b1e18222abee146143f7457"
+checksum = "0dc1a7ae1076890701c7dd71ea35b2aebaf9aeb7b8868ac2d33b1c7e8ef93c00"
 dependencies = [
  "ahash",
  "android-activity",
diff --git a/alacritty/Cargo.toml b/alacritty/Cargo.toml
index ad732cfd787..d0d6ab35a7c 100644
--- a/alacritty/Cargo.toml
+++ b/alacritty/Cargo.toml
@@ -39,7 +39,7 @@ serde_json = "1"
 serde_yaml = "0.9.25"
 toml = "0.8.2"
 unicode-width = "0.1"
-winit = { version = "0.29.7", default-features = false, features = ["rwh_05", "serde"] }
+winit = { version = "0.29.8", default-features = false, features = ["rwh_05", "serde"] }
 
 [build-dependencies]
 gl_generator = "0.14.0"


Test patch: