Throttle composite repaints in order not to starve everything else.
svn path=/branches/work/kwin_composite/; revision=598820
This commit is contained in:
parent
05021ecedb
commit
23b30bb2fa
2 changed files with 12 additions and 1 deletions
|
@ -53,6 +53,7 @@ void Workspace::setupCompositing()
|
|||
return;
|
||||
}
|
||||
compositeTimer.start( 20 );
|
||||
lastCompositePaint.start();
|
||||
XCompositeRedirectSubwindows( display(), rootWindow(), CompositeRedirectManual );
|
||||
if( dynamic_cast< SceneOpenGL* >( scene ))
|
||||
kDebug() << "OpenGL compositing" << endl;
|
||||
|
@ -121,6 +122,13 @@ void Workspace::compositeTimeout()
|
|||
{
|
||||
if( damage_region.isEmpty()) // no damage
|
||||
return;
|
||||
// The event loop apparently tries to fire a QTimer as often as possible, even
|
||||
// at the expense of not processing many X events. This means that the composite
|
||||
// repaints can seriously impact performance of everything else, therefore throttle
|
||||
// them - leave at least 5msec time after one repaint is finished and next one
|
||||
// is started.
|
||||
if( lastCompositePaint.elapsed() < 5 )
|
||||
return;
|
||||
ToplevelList windows;
|
||||
Window* children;
|
||||
unsigned int children_count;
|
||||
|
@ -142,6 +150,7 @@ void Workspace::compositeTimeout()
|
|||
foreach( Toplevel* c, windows )
|
||||
c->resetDamage();
|
||||
damage_region = QRegion();
|
||||
lastCompositePaint.start();
|
||||
}
|
||||
|
||||
//****************************************
|
||||
|
|
|
@ -18,6 +18,7 @@ License. See the file "COPYING" for the exact licensing terms.
|
|||
#include <QCursor>
|
||||
#include <netwm.h>
|
||||
#include <kxmessages.h>
|
||||
#include <qdatetime.h>
|
||||
|
||||
#include "utils.h"
|
||||
#include "kdecoration.h"
|
||||
|
@ -669,6 +670,7 @@ class Workspace : public QObject, public KDecorationDefines
|
|||
bool forced_global_mouse_grab;
|
||||
friend class StackingUpdatesBlocker;
|
||||
QTimer compositeTimer;
|
||||
QTime lastCompositePaint;
|
||||
QRegion damage_region;
|
||||
QSlider *transSlider;
|
||||
QPushButton *transButton;
|
||||
|
|
Loading…
Reference in a new issue