[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kwin
Subject:    Re: [Patch] Redundant vsync code (CPU improvements)
From:       Lubos Lunak <l.lunak () suse ! cz>
Date:       2008-07-31 14:27:41
Message-ID: 200807311627.41260.l.lunak () suse ! cz
[Download RAW message or body]

On Sunday 27 of July 2008, Lucas Murray wrote:
> Attached is a patch to remove some, from what I see, redundant
> vsyncing code.

svn log -r806443
Redo timing of next painting with vsync used, try harder not to miss
every other sync just by a small time.

> Removing this also lowers my KWin usage from 18% down 
> to 8% (Presumably because it was constantly creating 1ms timers).

 I doubt that would be the reason. I can't see how triggering a timer 100(?) 
times a second could cause this.

> From what I can see when compositeTimer is first started it already
> has a delay equal to the vsync time; if the frame renders faster it
> waits the difference, if it's slower it fires ASAP and triggers
> performCompositing() 1ms rule. Now although the timer is not synced
> exactly with vblank, sceneOpenGL::waitSync() already takes care of
> that.

 As said in the commit, the point of the code is not to be aligned to "some" 
vsync, but to the next one. Which is why it is scheduled to be 10ms in 
advance, otherwise the vsync often (due to variations) occurs a moment before 
it's synced to it, effectively missing one vsync and waiting only for every 
second one, thus halving the FPS rate.

 Which could explain the decrease in CPU usage, although probably not as high 
as 18%->8%. I don't see what else could be causing that though, that code 
just triggers the next repaint slightly sooner.

> I have verified that vsync is actually working as I cannot see any
> tearing when it's enabled while I can when it's not and also the FPS
> has decreased by around 10% or so on my system which conforms to vsync
> theory.

 Bad theory then :). If you have vsync afterwards, you had it also before. 
Therefore the FPS drop is caused only by the code managing to draw less 
frames in time.

-- 
Lubos Lunak
KDE developer
--------------------------------------------------------------
SUSE LINUX, s.r.o.   e-mail: l.lunak@suse.cz , l.lunak@kde.org
Lihovarska 1060/12   tel: +420 284 028 972
190 00 Prague 9      fax: +420 284 028 951
Czech Republic       http://www.suse.cz
_______________________________________________
kwin mailing list
kwin@kde.org
https://mail.kde.org/mailman/listinfo/kwin
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic