Bug 486432 - Wayland: Screen-wide Repaint Triggered by Any Application Change
Summary: Wayland: Screen-wide Repaint Triggered by Any Application Change
Status: RESOLVED NOT A BUG
Alias: None
Product: kwin
Classification: Plasma
Component: compositing (show other bugs)
Version: master
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-05-02 06:51 UTC by Alex Fiestas
Modified: 2024-06-08 08:20 UTC (History)
2 users (show)

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


Attachments
Output of org.kde.KWin.supportInformation (7.01 KB, text/plain)
2024-05-02 06:51 UTC, Alex Fiestas
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Fiestas 2024-05-02 06:51:13 UTC
Created attachment 169088 [details]
Output of org.kde.KWin.supportInformation

SUMMARY
I believe that it is unnecessary to repaint the entire screen when updating an application's display. If this is incorrect, I apologize for the added noise.

STEPS TO REPRODUCE
1.  Enable paint effect
2.  Launch konsole
3.  type something

OBSERVED RESULT
After every character is drawn, a full display refresh can be observed in the paint effect

EXPECTED RESULT
Only the konsole modified line should be repainted.


SOFTWARE/OS VERSIONS

Kernel: 6.8.8-arch1-1
KDE Plasma Version:  master
KDE Frameworks Version:  master
Qt Version:  6.7.1 self compiled from 6.7 branch

ADDITIONAL INFORMATION
Attached you can find the output of org.kde.KWin.supportInformation
Comment 1 Nate Graham 2024-05-03 20:52:09 UTC
Can confirm with everything from git master and Qt 6.7, but are we sure this is a KWin bug and not a Konsole bug?
Comment 2 Alex Fiestas 2024-05-04 21:41:12 UTC
(In reply to Nate Graham from comment #1)
> Can confirm with everything from git master and Qt 6.7, but are we sure this
> is a KWin bug and not a Konsole bug?

It can be reproduced with any app, not just konsole.

I'm not an expert but as far as I know one of the most important architectural changes in wayland was that Apps can only operate on local coordinates which should make it impossible for konsole (or any other app) to send damage events that include the entire screen.

(In reply to Nate Graham from comment #1)
> Can confirm with everything from git master and Qt 6.7, but are we sure this
> is a KWin bug and not a Konsole bug?
Comment 3 Alex Fiestas 2024-05-04 21:48:01 UTC
Additional info:
I tried to bisect it and went as far as 0c8b3251e5818, beyond that point KWin either did not compile or did not run.

With that commit I still could reproduce the full repaint in either screen with any app.
Comment 4 Alex Fiestas 2024-05-15 17:22:30 UTC
I did some extra testing

This is reproducible with Plasma 6.0.4, stable from distro packages
It is reproducible with just one screen (built-in eDP)

Testcase: Open konsole, place it close to 0,0 and just write a letter. The expected
damage should be somewhere close to 0x0 and narrow.

Without knowing what I'm doing I've added a few qDebugs in 
Compositor::prePaintPass

This might be perfectly normal behavior, just writing it down in case it is of any help
- The incoming QRegion is always null
- It always obtains the correct  QRegion from layer->delegate()->prePaint();

I added another qDebug in paintPass, damages were ok as well.
I added another in SceneDelegate::paint, here the QRegion finally changes
From QRegion(4,44 1066x21)
To QRegion(1809,44 1066x21)
which looks about right as well.

I haven't dug deeper, perhaps this is just the paint effect being silly or me not understanding the paint effect correctly.
Comment 5 David Edmundson 2024-05-29 09:43:37 UTC
I investigated things I could see on my laptop and whilst it looked valid, closer inspection showed something else.

We're double buffered on wayland, if we flip between the new and old buffers without repainting those areas you will see the old buffer buffer with the old overlays. It doesn't mean it's actually repainted. 

i.e flipping between all 8 colours shows we're repainting, going between 2 colours is not necessarily a sign of anything.

Please reopen if we have something more concrete to show we're fully repainting, otherwise I think this is just the effect giving (very!) confusing results.
Comment 6 Alex Fiestas 2024-06-08 08:20:54 UTC
(In reply to David Edmundson from comment #5)
> I investigated things I could see on my laptop and whilst it looked valid,
> closer inspection showed something else.
> 
> We're double buffered on wayland, if we flip between the new and old buffers
> without repainting those areas you will see the old buffer buffer with the
> old overlays. It doesn't mean it's actually repainted. 
> 
> i.e flipping between all 8 colours shows we're repainting, going between 2
> colours is not necessarily a sign of anything.
> 
> Please reopen if we have something more concrete to show we're fully
> repainting, otherwise I think this is just the effect giving (very!)
> confusing results.

I suspected as much.

Thanks for looking into this 🫶