kovidgoyal / kitty

Cross-platform, fast, feature-rich, GPU based terminal
https://sw.kovidgoyal.net/kitty/
GNU General Public License v3.0
24.25k stars 976 forks source link

Segmentation fault when using window decorations (CSD) with GNOME wayland fractional scaling #7894

Closed vandalt closed 3 weeks ago

vandalt commented 3 weeks ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Open kitty with hide_window_decorations no (CSD enabled) on GNOME wayland with two monitors with fractional scaling enabled, one with 100% scaling and one with > 100% scaling
  2. If kitty is on the 100% scaling, it crashed direct.
  3. If kitty starts on the >100% scaling monitor, it crashed when moved to the 100% scaling
  4. See error

Environment details

Environment details ``` kitty 0.36.2 (100f472a08) created by Kovid Goyal Linux yoga 6.10.10-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 12 Sep 2024 17:21:02 +0000 x86_64 Arch Linux 6.10.10-arch1-1 (/dev/tty) Running under: Wayland (GNOME Shell 47.0) missing: layer_shell OpenGL: '4.6 (Core Profile) Mesa 24.2.3-arch1.1' Detected version: 4.6 Frozen: False Fonts: medium: JetBrainsMonoNF-Regular: /usr/share/fonts/TTF/JetBrainsMonoNerdFont-Regular.ttf:0 Features: () bold: JetBrainsMonoNF-SemiBold: /usr/share/fonts/TTF/JetBrainsMonoNerdFont-SemiBold.ttf:0 Features: () italic: JetBrainsMonoNF-Italic: /usr/share/fonts/TTF/JetBrainsMonoNerdFont-Italic.ttf:0 Features: () bi: JetBrainsMonoNF-SemiBoldItalic: /usr/share/fonts/TTF/JetBrainsMonoNerdFont-SemiBoldItalic.ttf:0 Features: () Paths: kitty: /usr/bin/kitty base dir: /usr/lib/kitty extensions dir: /usr/lib/kitty/kitty system shell: /usr/bin/zsh Loaded config files: /home/vandal/.config/kitty/kitty.conf Config options different from defaults: allow_remote_control yes disable_ligatures 1 enable_audio_bell False font_family JetBrainsMono Nerd Font font_size 10.0 listen_on unix:/tmp/mykitty mouse_hide_wait 0.0 remember_window_size False shell_integration frozenset({'no-cursor'}) Changed mouse actions: ctrl+shift+right press ungrabbed → combine : mouse_select_command_output : kitty_scrollback_nvim --config ksb_builtin_last_visited_cmd_output Added shortcuts: ctrl+alt+enter → launch --cwd=current kitty_mod+alt+w → set_window_title kitty_mod+m → new_os_window_with_cwd Changed shortcuts: kitty_mod+g → kitty_scrollback_nvim --config ksb_builtin_last_cmd_output kitty_mod+h → kitty_scrollback_nvim Colors: active_border_color #82aaff active_tab_background #82aaff active_tab_foreground #1e2030 background #222436 color0 #1b1d2b color1 #ff757f color10 #c3e88d color11 #ffc777 color12 #82aaff color13 #c099ff color14 #86e1fc color15 #c8d3f5 color16 #ff966c color17 #c53b53 color2 #c3e88d color3 #ffc777 color4 #82aaff color5 #c099ff color6 #86e1fc color7 #828bb8 color8 #444a73 color9 #ff757f cursor #c8d3f5 cursor_text_color #222436 foreground #c8d3f5 inactive_border_color #2f334d inactive_tab_background #2f334d inactive_tab_foreground #545c7e selection_background #3654a7 selection_foreground #c8d3f5 url_color #4fd6be Important environment variables seen by the kitty process: PATH /home/vandal/.local/bin:/home/vandal/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/var/lib/flatpak/exports/bin:/opt/fv:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl LANG en_CA.UTF-8 EDITOR nvim SHELL /usr/bin/zsh DISPLAY :0 WAYLAND_DISPLAY wayland-0 USER vandal XDG_DATA_DIRS /home/vandal/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/ XDG_RUNTIME_DIR /run/user/1000 XDG_CURRENT_DESKTOP GNOME XDG_MENU_PREFIX gnome- XDG_SESSION_CLASS user XDG_SESSION_DESKTOP gnome XDG_SESSION_TYPE wayland ```

Additional context I can reproduce the problem with kitty --config NONE, but not when setting hide_window_decorations yes.

I could only test on GNOME wayland. It occurs only with two monitors, one with 100% scaling and one with > 100% scaling with fractional scaling (gsettings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer']"). When both are at 100% scaling or both at >100% scaling, the error does not occur.

kitty --debug-gl Output ``` [0.048] Compositor missing capabilities: layer_shell [0.063] Creating window 1 at size: 640x400 and scale 1 [0.063] CSD: old.size: 0x0 new.size: 640x400 needs_update: 1 size_changed: 1 state_changed: 0 buffer_destroyed: 0 [0.063] Created decoration buffers at scale: 1.000000 [0.071] Fractional scale requested: 240/120 = 2.00 for window 1 [0.072] Resizing framebuffer of window: 1 to: 1280x800 window size: 640x400 at scale: 2.000 [0.072] Waiting for swap to commit Wayland surface for window: 1 [0.072] CSD: old.size: 640x400 new.size: 640x400 needs_update: 1 size_changed: 1 state_changed: 0 buffer_destroyed: 0 [0.072] Created decoration buffers at scale: 2.000000 [0.072] Preferred integer buffer scale changed to: 2 for window 1 [0.072] Compositor set top-level bounds of: 1920x1048 for window 1 [0.072] Compositor top-level capabilities: maximize=1 minimize=1 window_menu=1 fullscreen=1 [0.073] XDG top-level configure event for window 1: size: 0x0 states: [0.073] XDG surface configure event received and acknowledged for window 1 [0.073] Waiting for swap to commit Wayland surface for window: 1 [0.073] CSD: old.size: 640x400 new.size: 640x400 needs_update: 0 size_changed: 0 state_changed: 0 buffer_destroyed: 0 [0.073] Final window 1 content size: 640x400 resized: 0 [0.073] Setting window 1 "visible area" geometry in configure event: x=0 y=-24 640x424 viewport: 640x400 [0.073] Creating OpenGL context and attaching it to window [0.093] Window 1 swapped committing surface [0.117] CSD: old.size: 640x400 new.size: 640x400 needs_update: 0 size_changed: 0 state_changed: 0 buffer_destroyed: 0 [0.120] OS Window created [0.135] Child launched [0.135] CSD: old.size: 640x400 new.size: 640x400 needs_update: 0 size_changed: 0 state_changed: 0 buffer_destroyed: 0 [0.137] Compositor set top-level bounds of: 1920x1048 for window 1 [0.137] XDG top-level configure event for window 1: size: 640x424 states: TOPLEVEL_STATE_ACTIVATED [0.137] XDG surface configure event received and acknowledged for window 1 [0.137] CSD: old.size: 640x400 new.size: 640x400 needs_update: 1 size_changed: 0 state_changed: 1 buffer_destroyed: 1 [0.140] Created decoration buffers at scale: 2.000000 [0.140] Final window 1 content size: 640x400 resized: 0 [0.140] Setting window 1 "visible area" geometry in configure event: x=0 y=-24 640x424 viewport: 640x400 [0.165] Calling wl_pointer_set_cursor in setCursorImage with surface: 0x64b011540f10 and serial: 0 [0.165] Got notification server capabilities: frozenset({'body', 'body-markup', 'sound', 'icon-static', 'actions', 'persistence'}) [0.252] CSD: old.size: 640x400 new.size: 640x400 needs_update: 1 size_changed: 0 state_changed: 0 buffer_destroyed: 1 [0.253] Created decoration buffers at scale: 2.000000 [1.331] Fractional scale requested: 120/120 = 1.00 for window 1 [1.331] Resizing framebuffer of window: 1 to: 640x400 window size: 640x400 at scale: 1.000 [1.331] Waiting for swap to commit Wayland surface for window: 1 [1.331] CSD: old.size: 640x400 new.size: 640x400 needs_update: 1 size_changed: 1 state_changed: 0 buffer_destroyed: 1 zsh: segmentation fault (core dumped) kitty --debug-gl ```
kovidgoyal commented 3 weeks ago

Post the backtrace from the segfault.