https://bugs.kde.org/show_bug.cgi?id=526306

            Bug ID: 526306
           Summary: Strong flickering/stopping to update the thumbnailed
                    window when changing the active desktop
    Classification: Plasma
           Product: kwin
      Version First unspecified
       Reported In:
          Platform: Ubuntu
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: effects-various
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

DESCRIPTION

I have Ubuntu 26.04 with KDE, Wayland, old Intel laptop GPU. I used to use the
Thumbnail Aside effect to minimize a chrome/youtube video, navigating to a
separate desktop and continue to work. Now the animation/thumbnailed windows
stops updating when I leave the desktop where it is minimized and there is a
strong flickering of the thumbnail area on the screen. The video continues in
the background, I hear the audio, but its minimized version does not update the
visual content. The thumbnail update continues if I switch back to the desktop
where the thumbnailed window was minimized.

STEPS TO REPRODUCE
1. Put a youtube window with thumbnail aside on Desktop 2.
2. Move to Desktop 1. The thumbnailed window update stops.
3. Move to Desktop 2 to continue the updates.

OBSERVED RESULT

The thumbnailed window stops the updates and strong flickering is observed.

EXPECTED RESULT

The thumbnailed window works as expected, visual content is updated and no
flickering.

SOFTWARE/OS VERSIONS
Operating System: Ubuntu 26.04
KDE Plasma Version:  6.6.4 or 6.6.6 (Wayland)
KDE Frameworks Version:  5.116.0
Qt Version: 6.10.2

ADDITIONAL INFORMATION

There is a discrepancy between Thumbnail Aside and the WindowThumbnail
implementation. WindowThumbnailSource in src/scripting/windowthumbnailitem.cpp
explicitly calls:

m_handle->refOffscreenRendering();

while the thumbnail exists, and calls:

m_handle->unrefOffscreenRendering();

when the thumbnail source is destroyed.

By contrast, ThumbnailAsideEffect::addThumbnail() in
src/plugins/thumbnailaside/thumbnailaside.cpp only stores the EffectWindow and
does not request offscreen rendering.

This seems to be relevant on Wayland when the source window becomes
invisible/minimized/on another virtual desktop. I don't know if it is
reproducible on other hardware or on my old laptop (Intel i7-6600U),

The following minimal patch fixes to call w->window()->refOffscreenRendering()
when adding a Thumbnail Aside window and balance it with
unrefOffscreenRendering() when removing the thumbnail/effect. It fixes the
problem on my system and both the window updates and the flickering is solved:

diff --git a/src/plugins/thumbnailaside/thumbnailaside.h
b/src/plugins/thumbnailaside/thumbnailaside.h
--- a/src/plugins/thumbnailaside/thumbnailaside.h
+++ b/src/plugins/thumbnailaside/thumbnailaside.h
@@ -30,6 +30,7 @@ class ThumbnailAsideEffect
     Q_PROPERTY(int screen READ configuredScreen)
 public:
     ThumbnailAsideEffect();
+    ~ThumbnailAsideEffect() override;
     void reconfigure(ReconfigureFlags) override;
     void paintScreen(const RenderTarget &renderTarget, const RenderViewport
&viewport, int mask, const Region &deviceRegion, LogicalOutput *screen)
override;
     void paintWindow(const RenderTarget &renderTarget, const RenderViewport
&viewport, EffectWindow *w, int mask, const Region &deviceRegion,
WindowPaintData &data) override;
diff --git a/src/plugins/thumbnailaside/thumbnailaside.cpp
b/src/plugins/thumbnailaside/thumbnailaside.cpp
--- a/src/plugins/thumbnailaside/thumbnailaside.cpp
+++ b/src/plugins/thumbnailaside/thumbnailaside.cpp
@@ -10,6 +10,7 @@
 #include "thumbnailaside.h"
 #include "core/renderviewport.h"
 #include "effect/effecthandler.h"
+#include "window.h"
 // KConfigSkeleton
 #include "thumbnailasideconfig.h"

@@ -40,6 +41,13 @@ ThumbnailAsideEffect::ThumbnailAsideEffect()
     reconfigure(ReconfigureAll);
 }

+ThumbnailAsideEffect::~ThumbnailAsideEffect()
+{
+    for (const Data &d : std::as_const(windows)) {
+        d.window->window()->unrefOffscreenRendering();
+    }
+}
+
 void ThumbnailAsideEffect::reconfigure(ReconfigureFlags)
 {
     ThumbnailAsideConfig::self()->read();
@@ -116,6 +124,9 @@ void ThumbnailAsideEffect::toggleCurrentThumbnail()

 void ThumbnailAsideEffect::addThumbnail(EffectWindow *w)
 {
     repaintAll(); // repaint old areas
+
+    w->window()->refOffscreenRendering();
+
     Data d;
     d.window = w;
     d.index = windows.count();
@@ -128,6 +139,9 @@ void ThumbnailAsideEffect::removeThumbnail(EffectWindow *w)
         return;
     }
     repaintAll(); // repaint old areas
+
+    w->window()->unrefOffscreenRendering();
+
     int index = windows[w].index;
     windows.remove(w);
     for (QHash<EffectWindow *, Data>::Iterator it = windows.begin();

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to