Closed ismay closed 3 weeks ago
This will just be more Wayland fuckery. Easily confirmed by putting linux_display_server x11 in your kitty.conf. Am guessing the compositor is simply drawing the window with the pre-resize buffer. Probably because of the ridiculous dance wayland requires of only committing window surfaces after a resized buffer is attached, as if compositors are not capable of scaling things. Crazy design. Someday when the only alternative is gouging my eyeballs out with a spoon, I'll spend some time looking into whatever new elaborate dance kitty needs to perform to get sway to render it properly. The irony is that one of the early selling points of Wayland was pixel perfect frames. In practice, it is the exact opposite of that.
linux_display_server x11
You're right, that resolved it. Sorry to hear that wayland support is such a chore, that does not sound pleasant! Let me know if there's anything I can do to help debug, I'd be happy to.
On Sun, Apr 21, 2024 at 12:19:12AM -0700, ismay wrote:
linux_display_server x11
You're right, that resolved it. Sorry to hear that wayland support is such a chore, that does not sound pleasant! Let me know if there's anything I can do to help debug, I'd be happy to.
I will try to replicate it when I am next working on Wayland. If I can replicate, you don't need to do anything, if I cant, then we will see...
I tried it in sway, doesnt replicate for me. Steps I tried:
1) Run kitty --config=NONE with sway 2) Run: swaymsg layout splith 3) Press ctrl+shift+n to create new kitty OS window 4) Both old and new windows are rendered correctly
sway version 1.9
You can try setting
sync_to_monitor n
in kitty.conf, that might workaround the issue.
You can also post the logs from running
WAYLAND_DEBUG=1 kitty --debug-rendering
and doing the minimum to reproduce the issue.
Strange, I can reliably reproduce it. Here are the debug logs:
edit: I've tried with sync_to_monitor disabled, the issue still occurs.
did u try with sync_to_monitor n
I did yes, that did not resolve the issue.
Also post the log without WAYLAND_DEBUG as WAYLAND_DEBUG is extremely noisy.
Yeah it is. These are the logs without WAYLAND_DEBUG:
[0.302] Compositor missing capabilities: blur
[0.369] Creating window at size: 2560x1405 and scale 1
[0.400] GL version string: '4.6 (Core Profile) Mesa 24.0.5' Detected version: 4.6
[0.406] XDG top-level configure event: size: 0x0 states:
[0.406] XDG decoration configure event received: has_server_side_decorations: 1
[0.406] XDG surface configure event received and acknowledged
[0.406] Final window content size: 2560x1405 resized: 0
[0.406] Setting window "visible area" geometry in configure event: x=0 y=0 2560x1405 viewport: 2560x1405
[0.406] Attached temp buffer during window creation of size: 2560x1405 and rgba(42, 31, 29, 255)
[0.406] Waiting for compositor to send fractional scale for window
[0.406] XDG top-level configure event: size: 1262x1383 states: TOPLEVEL_STATE_ACTIVATED TOPLEVEL_STATE_TILED_LEFT TOPLEVEL_STATE_TILED_RIGHT TOPLEVEL_STATE_TILED_TOP TOPLEVEL_STATE_TILED_BOTTOM
[0.406] XDG surface configure event received and acknowledged
[0.406] Resizing framebuffer to: 1262x1383 window size: 1262x1383 at scale: 1.00
[0.406] Final window content size: 1262x1383 resized: 1
[0.406] Setting window "visible area" geometry in configure event: x=0 y=0 1262x1383 viewport: 1262x1383
[0.406] Attached temp buffer during window creation of size: 1262x1383 and rgba(42, 31, 29, 255)
[0.408] Fractional scale requested: 120/120 = 1.00
[0.408] Resizing framebuffer to: 1262x1383 window size: 1262x1383 at scale: 1.00
[0.480] OS Window created
[0.509] Child launched
[0.521] Waiting for swap to commit: swap has happened, window surface committed
[0.521] Changing cursor shape to: WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_TEXT with serial: 0
[1.704] Creating window at size: 2560x1405 and scale 1
[1.705] XDG top-level configure event: size: 0x0 states:
[1.705] XDG decoration configure event received: has_server_side_decorations: 1
[1.705] XDG surface configure event received and acknowledged
[1.705] Final window content size: 2560x1405 resized: 0
[1.705] Setting window "visible area" geometry in configure event: x=0 y=0 2560x1405 viewport: 2560x1405
[1.705] Attached temp buffer during window creation of size: 2560x1405 and rgba(42, 31, 29, 255)
[1.705] Waiting for compositor to send fractional scale for window
[1.706] XDG top-level configure event: size: 836x1383 states: TOPLEVEL_STATE_ACTIVATED TOPLEVEL_STATE_TILED_LEFT TOPLEVEL_STATE_TILED_RIGHT TOPLEVEL_STATE_TILED_TOP TOPLEVEL_STATE_TILED_BOTTOM
[1.706] XDG surface configure event received and acknowledged
[1.706] Resizing framebuffer to: 836x1383 window size: 836x1383 at scale: 1.00
[1.706] Final window content size: 836x1383 resized: 1
[1.706] Setting window "visible area" geometry in configure event: x=0 y=0 836x1383 viewport: 836x1383
[1.706] Attached temp buffer during window creation of size: 836x1383 and rgba(42, 31, 29, 255)
[1.706] XDG top-level configure event: size: 837x1383 states: TOPLEVEL_STATE_TILED_LEFT TOPLEVEL_STATE_TILED_RIGHT TOPLEVEL_STATE_TILED_TOP TOPLEVEL_STATE_TILED_BOTTOM
[1.706] XDG surface configure event received and acknowledged
[1.706] Resizing framebuffer to: 837x1383 window size: 837x1383 at scale: 1.00
[1.707] Final window content size: 837x1383 resized: 1
[1.707] Setting window "visible area" geometry in configure event: x=0 y=0 837x1383 viewport: 837x1383
[1.906] Fractional scale requested: 120/120 = 1.00
[1.906] Resizing framebuffer to: 836x1383 window size: 836x1383 at scale: 1.00
[1.906] OS Window created
[1.955] Child launched
[1.956] SIGWINCH sent to child in window: 1 with size: (51, 104, 832, 1377)
[1.957] Waiting for swap to commit: swap has happened, window surface committed
[1.958] Waiting for swap to commit: swap has happened, window surface committed
[3.657] XDG top-level configure event: size: 1262x1383 states: TOPLEVEL_STATE_ACTIVATED TOPLEVEL_STATE_TILED_LEFT TOPLEVEL_STATE_TILED_RIGHT TOPLEVEL_STATE_TILED_TOP TOPLEVEL_STATE_TILED_BOTTOM
[3.657] XDG surface configure event received and acknowledged
[3.657] Resizing framebuffer to: 1262x1383 window size: 1262x1383 at scale: 1.00
[3.657] Final window content size: 1262x1383 resized: 1
[3.657] Setting window "visible area" geometry in configure event: x=0 y=0 1262x1383 viewport: 1262x1383
[3.658] Waiting for swap to commit: swap has happened, window surface committed
[3.765] SIGWINCH sent to child in window: 1 with size: (51, 157, 1256, 1377)
This is me opening a new os-window with ctrl-shift-enter (map kitty_mod+enter launch --cwd=oldest --type=os-window
) to reproduce the issue. After verifying it reproduced I closed the new window with ctrl-d and then the original window with ctrl-d as well.
That's helpful, can you try it with this commit included:
https://github.com/kovidgoyal/kitty/commit/fbefd8600fe622f1956104038d899d0280a1653f
it will help for debugging issues with multiple OS windows. Either build form source as described in: https://sw.kovidgoyal.net/kitty/build/
or wait a few hours for the next nightly to be automatically built.
Thanks, will debug again once the nightly has built (I tried the installer but it failed).
On a related note, I asked for some feedback in the #sway channel. They mentioned the following:
Just ensure that wl_egl_surface_resize is called after eglMakeCurrent and ensure that there's no current context when new window is created.
So it seems their explanation for the bug is that wl_egl_surface_resize is called **before** eglMakeCurrent
, if I'm quoting that correctly.
On Mon, Apr 22, 2024 at 02:25:22AM -0700, ismay wrote:
Thanks, will debug again once the nightly has built (I tried the installer but it failed).
On a related note, I asked for some feedback in the #sway channel. They mentioned the following:
Just ensure that wl_egl_surface_resize is called after eglMakeCurrent and ensure that there's no current context when new window is created.
So it seems their explanation for the bug is that
wl_egl_surface_resize is called **before** eglMakeCurrent
, if I'm quoting that correctly.
Not sure what that is, do you mean wl_egl_window_resize?
Not sure tbh, I'm just quoting them verbatim. I don't really have any understanding of this myself. Might be that they misspelled it.
I've downloaded the latest nightly build and tested. I can still reproduce the issue. At this point I'm not sure what causes it, I'll keep an eye out and let you know if I learn more or anything changes.
Post the log from the latest nightly with --debug-rendering it includes window ids so should be more helpful
N.p., this is the log:
[0.050] Compositor missing capabilities: blur
[0.128] Creating window 1 at size: 836x1383 and scale 1
[0.158] GL version string: '4.6 (Core Profile) Mesa 24.0.5' Detected version: 4.6
[0.166] XDG top-level configure event for window 1: size: 0x0 states:
[0.166] XDG decoration configure event received for window 1: has_server_side_decorations: 1
[0.166] XDG surface configure event received and acknowledged for window 1
[0.166] Final window 1 content size: 836x1383 resized: 0
[0.166] Setting window 1 "visible area" geometry in configure event: x=0 y=0 836x1383 viewport: 836x1383
[0.166] Attached temp buffer during window 1 creation of size: 836x1383 and rgba(42, 31, 29, 255)
[0.166] Waiting for compositor to send fractional scale for window 1
[0.166] XDG top-level configure event for window 1: size: 1262x1383 states: TOPLEVEL_STATE_ACTIVATED TOPLEVEL_STATE_TILED_LEFT TOPLEVEL_STATE_TILED_RIGHT TOPLEVEL_STATE_TILED_TOP TOPLEVEL_STATE_TILED_BOTTOM
[0.167] XDG surface configure event received and acknowledged for window 1
[0.167] Resizing framebuffer of window: 1 to: 1262x1383 window size: 1262x1383 at scale: 1.000
[0.167] Final window 1 content size: 1262x1383 resized: 1
[0.167] Setting window 1 "visible area" geometry in configure event: x=0 y=0 1262x1383 viewport: 1262x1383
[0.167] Attached temp buffer during window 1 creation of size: 1262x1383 and rgba(42, 31, 29, 255)
[0.182] Fractional scale requested: 120/120 = 1.00 for window 1
[0.182] Resizing framebuffer of window: 1 to: 1262x1383 window size: 1262x1383 at scale: 1.000
[0.203] OS Window created
[0.214] Child launched
[0.248] Waiting for swap to commit window 1: swap has happened, window surface committed
[0.248] Changing cursor shape to: WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_TEXT with serial: 0
[1.265] Creating window 2 at size: 836x1383 and scale 1
[1.269] XDG top-level configure event for window 2: size: 0x0 states:
[1.269] XDG decoration configure event received for window 2: has_server_side_decorations: 1
[1.269] XDG surface configure event received and acknowledged for window 2
[1.269] Final window 2 content size: 836x1383 resized: 0
[1.269] Setting window 2 "visible area" geometry in configure event: x=0 y=0 836x1383 viewport: 836x1383
[1.269] Attached temp buffer during window 2 creation of size: 836x1383 and rgba(42, 31, 29, 255)
[1.269] Waiting for compositor to send fractional scale for window 2
[1.269] XDG top-level configure event for window 2: size: 836x1383 states: TOPLEVEL_STATE_ACTIVATED TOPLEVEL_STATE_TILED_LEFT TOPLEVEL_STATE_TILED_RIGHT TOPLEVEL_STATE_TILED_TOP TOPLEVEL_STATE_TILED_BOTTOM
[1.269] XDG surface configure event received and acknowledged for window 2
[1.270] Final window 2 content size: 836x1383 resized: 0
[1.270] Setting window 2 "visible area" geometry in configure event: x=0 y=0 836x1383 viewport: 836x1383
[1.270] Attached temp buffer during window 2 creation of size: 836x1383 and rgba(42, 31, 29, 255)
[1.270] XDG top-level configure event for window 1: size: 837x1383 states: TOPLEVEL_STATE_TILED_LEFT TOPLEVEL_STATE_TILED_RIGHT TOPLEVEL_STATE_TILED_TOP TOPLEVEL_STATE_TILED_BOTTOM
[1.270] XDG surface configure event received and acknowledged for window 1
[1.270] Resizing framebuffer of window: 1 to: 837x1383 window size: 837x1383 at scale: 1.000
[1.270] Final window 1 content size: 837x1383 resized: 1
[1.270] Setting window 1 "visible area" geometry in configure event: x=0 y=0 837x1383 viewport: 837x1383
[1.470] Fractional scale requested: 120/120 = 1.00 for window 2
[1.470] Resizing framebuffer of window: 2 to: 836x1383 window size: 836x1383 at scale: 1.000
[1.470] OS Window created
[1.497] Child launched
[1.498] SIGWINCH sent to child in window: 1 with size: (47, 104, 832, 1363)
[1.499] Waiting for swap to commit window 1: swap has happened, window surface committed
[1.500] Waiting for swap to commit window 2: swap has happened, window surface committed
[8.833] XDG top-level configure event for window 1: size: 1262x1383 states: TOPLEVEL_STATE_ACTIVATED TOPLEVEL_STATE_TILED_LEFT TOPLEVEL_STATE_TILED_RIGHT TOPLEVEL_STATE_TILED_TOP TOPLEVEL_STATE_TILED_BOTTOM
[8.833] XDG surface configure event received and acknowledged for window 1
[8.833] Resizing framebuffer of window: 1 to: 1262x1383 window size: 1262x1383 at scale: 1.000
[8.834] Final window 1 content size: 1262x1383 resized: 1
[8.834] Setting window 1 "visible area" geometry in configure event: x=0 y=0 1262x1383 viewport: 1262x1383
[8.835] Waiting for swap to commit window 1: swap has happened, window surface committed
[8.948] SIGWINCH sent to child in window: 1 with size: (47, 157, 1256, 1363)
I dont see anything off in that log and in kitty all OS windows share the same OpenGL context, so it's not surprising that the fix had no effect.
Also what GPU are you on, there are various NVIDIA bugs that could be relevant. For example: https://github.com/NVIDIA/egl-wayland/issues/52
On sway nvidia doesn't work very well, so I use an AMD GPU.
I tested on a system with an AMD GPU as well
Strange. Well I suppose since it's both hard to reproduce and debug it might be worth it to wait and see if anyone else encounters it. Maybe that'll yield some new clues as to what's going on.
Describe the bug
When launching a new kitty window from kitty with ctrl-shift-enter (and the shortcut
map kitty_mod+enter launch --cwd=oldest --type=os-window
in kitty.conf), I'm getting a weird visual bug. The content in the oldest window will get squished once it loses focus. Once it regains focus it will be repainted and look good again. This bug will sometimes affect other kitty windows as well. So not just the window that initiated the spawn.Strangely enough, it does not happen when I manually run
kitty @ launch --type=os-window
from my shell. But, it does happen when I spawn a new window from my editor with a keybind that executeskitty @ launch --type=os-window
.To Reproduce Steps to reproduce the behavior:
Screenshots
Open first window:
After pressing ctrl-shift-enter (notice the squished and misaligned prompt on the left):
After focusing the original window again:
Happens in other unfocused windows (notice left and right window):
But not always (only in the center window):
Environment details
Additional context
I can reproduce it with
kitty --config NONE -o map='kitty_mod+enter launch --cwd=oldest --type=os-window'
. Steps:It does not happen when I do this from bash.