Bug 412342 - Effects interface: windowDamaged() call sometimes missing on AMD
Summary: Effects interface: windowDamaged() call sometimes missing on AMD
Status: RESOLVED NOT A BUG
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: 5.16.5
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-09-25 22:52 UTC by Christoph Haag
Modified: 2023-01-25 13:06 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Haag 2019-09-25 22:52:07 UTC
So far it is tested on a Vega 64 on X11 with recent mesa master, and this is where this issue happens for me.

On my nvidia machine with Ubuntu 19.04 this issue does not happen.

We have an effect plugin (xrdesktop) that makes use of window textures in drawWindow(), and for performance reasons we only want to process textures when the window content is updated, i.e. after a windowDamaged() call for this window.

This works fine usually, but sometimes there is a windowDamaged() call missing even though the window renders at 60 fps on a 60 Hz display.


STEPS TO REPRODUCE

I wrote a minimal effects plugin for testing this: https://github.com/ChristophHaag/kwin-effect-test-damage
No dependencies and the plugin is enabled by default, just cmake ..; make; make install
The output happens with qDebug(), and the default window it watches for is glxgears, so run

GALLIUM_HUD=frametime glxgears
and
QT_PLUGIN_PATH=/usr/local/lib/plugins/ TEST_DAMAGE_VERBOSE=TRUE kwin_x11 --replace


OBSERVED RESULT

The plugin prints the durations between windowDamaged() calls for glxgears, and an extra message when there are two drawWindow() calls where no windowDamaged() call happens in between.
On my 60 Hz monitor the time between two windowDamaged() calls is usually ~16.67ms, but sometimes one windowDamaged() call is omitted:

damaged(): 16.6673 ms since last damage
damaged(): 16.6368 ms since last damage
damaged(): 16.6442 ms since last damage
damaged(): 16.775 ms since last damage
drawWindow(): Drawing window "glxgears" without previous damaged event!
drawWindow(): 34.7693 ms since last damage
damaged(): 35.1921 ms since last damage
damaged(): 31.3251 ms since last damage
damaged(): 16.5497 ms since last damage
damaged(): 17.5127 ms since last damage
damaged(): 15.8502 ms since last damage

I do believe that this drawWindow() call that had no preceding windowDamaged() call, actually draws a window with updated content, but I have not really dug into this issue yet.


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Archlinux
(available in About System)
KDE Plasma Version: 5.16.5
KDE Frameworks Version: 5.62.0
Qt Version: 5.13.1
Comment 1 Vlad Zahorodnii 2023-01-25 13:06:14 UTC
Note that the damaged signal is not emitted immediately when a window reports the damage. kwin will note that and fetch the damaged region before starting the next compositing cycle. If I were to guess, it sounds like some XDamage events arrive too late and some frames take too long to paint.