Bug 491818 - Rendering issues in foot
Summary: Rendering issues in foot
Status: RESOLVED DOWNSTREAM
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 6.1.4
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-08-17 11:39 UTC by Kacper Słomiński
Modified: 2024-09-18 11:43 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Recording of me triggering the bug (351.25 KB, video/webm)
2024-08-17 11:39 UTC, Kacper Słomiński
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kacper Słomiński 2024-08-17 11:39:08 UTC
Created attachment 172691 [details]
Recording of me triggering the bug

SUMMARY
foot (https://codeberg.org/dnkl/foot) exhibits strange rendering issues that can't be reproduced with other Wayland compositors.

STEPS TO REPRODUCE
1. Install and open foot.
2. Run some commands that produce enough output to start scrolling.
3. Quickly scroll around a bit (see attached video).

OBSERVED RESULT
Certain lines are drawn multiple times, without a clear pattern.

EXPECTED RESULT
The terminal contents render as expected.

SOFTWARE/OS VERSIONS
Operating System: Gentoo Linux 2.15
KDE Plasma Version: 6.1.4
KDE Frameworks Version: 6.5.0
Qt Version: 6.7.2
Kernel Version: 6.6.41-gentoo-dist (64-bit)

ADDITIONAL INFORMATION
I've initially filed a bug about this to foot directly: https://codeberg.org/dnkl/foot/issues/1715, but we've reached the conclusion that it's unlikely to be a bug in foot itself.
Comment 1 Vlad Zahorodnii 2024-09-18 11:43:31 UTC
> warn: render.c:2694: compositor is not releasing buffers immediately; expect lower rendering performance

It's true that kwin may require double buffering sometimes. We have had a couple of clients in the past that handled it incorrectly: they just repainted what changed in the current frame instead of ensuring that the _whole_ buffer contains valid data. You would normally observe it by the app contents flipping back and forth between old and new contents.

For the debugging purposes, I made kwin dump every shared memory client buffer to see what foot submits. From what I see is that some text can be missing in two consecutive frames, i.e.

frame N

```
❯ mkfs.ext2 test.img
mke2fs 1.47.1 (20-May-2024)
test.img contains
        created on Wed Sep 18 14:19:46 2024
Proceed anyway? (y,N) ^C⏎                                                                                                          
~
❯ mkfs.ext2 test.img
mke2fs 1.47.1 (20-May-2024)
test.img contains
        created on Wed Sep 18 14:19:46 2024
Proceed anyway? (y,N) 
```

frame N + 1

```
❯ mkfs.ext2 test.img
mke2fs 1.47.1 (20-May-2024)
test.img contains a ext2 file system
        created on Wed Sep 18 14:19:46 2024
Proceed anyway? (y,N) ^C⏎                                                                                                          
~
❯ mkfs.ext2 test.img
mke2fs 1.47.1 (20-May-2024)
test.img contains a ext2 file system
        created on Wed Sep 18 14:19:46 2024
Proceed anyway? (y,N) 
```

However, every shared memory client buffer is expected to have a complete frame. It points to foot committing shared memory client buffers with partial frame contents, which is a protocol violation.