From 0cbc79193b42865ab71079007cef783f6a828ff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 11 Apr 2013 09:17:58 +0200 Subject: [PATCH] Do not use stackingOrder in LanczosFilter to get all EffectWindows LanczosFilter tries to discard all cached textures in the timer event by getting the stacking order and iterating over it. But this approach seems wrong from several aspects. First of all the xStackingOrder does not include Deleted windows. So if a cached texture still exists on an EffectWindow for a Deleted it would not be discarded. Also the xStackingOrder could result in an update from X because the stacking order is currently considered dirty. Last but not least the EffectsHandler::stackingOrder creates a temporary list of EffectWindows - good for Effects but not necessarily useful inside KWin core. Instead the LanczosFilter gets the list of Clients, desktops, unmanaged and deleted and iterates over them to check whether there is a texture to discard. REVIEW: 109954 --- lanczosfilter.cpp | 31 +++++++++++++++++++++++-------- lanczosfilter.h | 2 ++ 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/lanczosfilter.cpp b/lanczosfilter.cpp index 35999e9f3c..eaeba2c4e2 100644 --- a/lanczosfilter.cpp +++ b/lanczosfilter.cpp @@ -20,7 +20,10 @@ along with this program. If not, see . *********************************************************************/ #include "lanczosfilter.h" +#include "client.h" +#include "deleted.h" #include "effects.h" +#include "unmanaged.h" #include "options.h" #include @@ -388,15 +391,27 @@ void LanczosFilter::timerEvent(QTimerEvent *event) delete m_offscreenTex; m_offscreenTarget = 0; m_offscreenTex = 0; - foreach (EffectWindow * w, effects->stackingOrder()) { - QVariant cachedTextureVariant = w->data(LanczosCacheRole); - if (cachedTextureVariant.isValid()) { - GLTexture *cachedTexture = static_cast< GLTexture*>(cachedTextureVariant.value()); - delete cachedTexture; - cachedTexture = 0; - w->setData(LanczosCacheRole, QVariant()); - } + foreach (Client *c, Workspace::self()->clientList()) { + discardCacheTexture(c->effectWindow()); } + foreach (Client *c, Workspace::self()->desktopList()) { + discardCacheTexture(c->effectWindow()); + } + foreach (Unmanaged *u, Workspace::self()->unmanagedList()) { + discardCacheTexture(u->effectWindow()); + } + foreach (Deleted *d, Workspace::self()->deletedList()) { + discardCacheTexture(d->effectWindow()); + } + } +} + +void LanczosFilter::discardCacheTexture(EffectWindow *w) +{ + QVariant cachedTextureVariant = w->data(LanczosCacheRole); + if (cachedTextureVariant.isValid()) { + delete static_cast< GLTexture*>(cachedTextureVariant.value()); + w->setData(LanczosCacheRole, QVariant()); } } diff --git a/lanczosfilter.h b/lanczosfilter.h index 538220da6f..12a844ee8c 100644 --- a/lanczosfilter.h +++ b/lanczosfilter.h @@ -33,6 +33,7 @@ along with this program. If not, see . namespace KWin { +class EffectWindow; class EffectWindowImpl; class WindowPaintData; class GLTexture; @@ -55,6 +56,7 @@ private: void init(); void updateOffscreenSurfaces(); void setUniforms(); + void discardCacheTexture(EffectWindow *w); void createKernel(float delta, int *kernelSize); void createOffsets(int count, float width, Qt::Orientation direction);