Bug 435361 - Graphical glitches (flashing) under wayland in kate
Summary: Graphical glitches (flashing) under wayland in kate
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords: wayland
: 436576 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-04-04 21:00 UTC by Alice McLafferty
Modified: 2022-02-03 23:04 UTC (History)
5 users (show)

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


Attachments
A recording of the symptom. (1.50 MB, video/mp4)
2021-04-04 21:00 UTC, Alice McLafferty
Details
screen recording on neon unstable (333.77 KB, video/x-matroska)
2021-10-30 19:44 UTC, Patrick Silva
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alice McLafferty 2021-04-04 21:00:25 UTC
Created attachment 137332 [details]
A recording of the symptom.

SUMMARY
This is likely related to kwin but kate is the most common one that I noticed, whenever I press Ctrl+S, the line number column has a big chance of producing a flash. Fast flashing images really makes me uncomfortable so this makes kate very difficult use for me.

STEPS TO REPRODUCE
1. Launch kate in a plasma wayland session
2. Press Ctrl+S
3. If you don't see it, press Ctrl+S again and again (but do not hold it down)

OBSERVED RESULT
The line number column sometimes flashes.

EXPECTED RESULT
There should be no graphical glitches.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora 34, kernel 5.11.11
(available in About System)
KDE Plasma Version: 5.21.3
KDE Frameworks Version: 5.80.0
Qt Version: 5.5.2

ADDITIONAL INFORMATION
Changing compositor rendering backends does not help with this situation, and this does not happen in x11 sessions.
I am using an RX550 with the amdgpu driver.
Comment 1 David Edmundson 2021-04-04 21:33:17 UTC
>Qt Version: 5.5.2

Please confirm
Comment 2 Alice McLafferty 2021-04-04 21:40:46 UTC
Apologies, I meant 5.15.2.
Comment 3 Nate Graham 2021-04-06 00:45:16 UTC
Interesting, cannot reproduce myself.
Comment 4 Alice McLafferty 2021-04-06 17:46:58 UTC
I highly suspect this is an issue with the graphics driver/graphics card but I do not have enough supporting evidence to prove it. Never had this kind of issues with i915. I don't see any error messages unfortunately.
Comment 5 Patrick Silva 2021-05-31 11:30:00 UTC
*** Bug 436576 has been marked as a duplicate of this bug. ***
Comment 6 geisserml 2021-05-31 15:39:33 UTC
I am on Intel HD Graphics 4000 and am experiencing this bug, too.
It sounds rather unlikely to me that it would be related to the graphics card/driver, however.
Comment 7 Vlad Zahorodnii 2021-06-07 07:07:07 UTC
This looks like a client buffer or damage related issue in kate or qtwayland. If you run kwin with KWIN_USE_BUFFER_AGE=0, for example by putting it in /etc/environment, is the issue still reproducible?
Comment 8 Alice McLafferty 2021-06-08 10:39:15 UTC
Software versions have since changed so here are the new versions:

Kate: 21.04.1
Linux/KDE Plasma: Fedora 34, kernel 5.12.8
KDE Plasma Version: 5.21.5
KDE Frameworks Version: 5.82.0
Qt Version: 5.15.2

KWIN_USE_BUFFER_AGE=0 was placed into /etc/environment, computer was rebooted and I confirmed this variable has been set, but it's still very much reproducible just like the video showed.

Another curious thing is that having Firefox running (doesn't matter if it's xwayland or wayland native) makes this issue significantly more difficult to reproduce with keyboard presses, but I can confirm it is still present. 

Additionally, I found another more effective way to reproduce this, it's holding Ctrl and keep scrolling up and down with the mouse wheel to repeatedly zoom in and out. This way I was able to reproduce this problem even with Firefox running, where it's incredibly difficult to reproduce the issue with F5 or Ctrl + S.
Comment 9 geisserml 2021-06-08 12:02:52 UTC
I confirm Alice McLafferty's statement that setting KWIN_USE_BUFFER_AGE=0 does not eliminate the visual glitches.
I can't endorse that Firefox would affect the behaviour in any way, though. It sounds rather esoteric to me.
Comment 10 Alice McLafferty 2021-06-11 13:34:18 UTC
Indeed, I have no idea why having Firefox open would affect this behavior, but it is something I have noticed on my computer. I had about four windows open in Firefox, not sure if it's reproducible with only one window open.
Comment 11 David Edmundson 2021-06-12 22:07:11 UTC
>This looks like a client buffer or damage related issue in kate or qtwayland.

Does to me too, moving.
Comment 12 Patrick Silva 2021-10-30 19:44:17 UTC
Created attachment 143039 [details]
screen recording on neon unstable

I also see this bug on neon unstable. I have recorded a video showing what
happens to line number column while I create/remove lines.
Comment 13 Christoph Cullmann 2022-01-29 19:47:05 UTC
I can reproduce the flashing, it occurs on resize of the widget.
Comment 14 Christoph Cullmann 2022-01-29 19:57:01 UTC
The reason is the update() for the size change we trigger in the paint function after updateGeometry().
Comment 15 Bug Janitor Service 2022-01-29 20:09:04 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/272
Comment 16 Christoph Cullmann 2022-01-30 17:29:14 UTC
Git commit 61a1bee1ac286ee9e5293fd8faeb7e6162ce043a by Christoph Cullmann.
Committed on 29/01/2022 at 20:07.
Pushed by cullmann into branch 'master'.

avoid flicker for border on size changes

if you type and e.g. the line count crosses the X -> XX
border without this, a short flicker will occur

M  +13   -6    src/view/kateviewhelpers.cpp
M  +1    -0    src/view/kateviewhelpers.h

https://invent.kde.org/frameworks/ktexteditor/commit/61a1bee1ac286ee9e5293fd8faeb7e6162ce043a