Ken Thomases : winemac: Use CVDisplayLink to limit window redrawing to the display refresh rate.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Nov 6 09:06:33 CST 2015


Module: wine
Branch: master
Commit: 3beec95a092a261f3c265fd30a10e0c0ead524bc
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=3beec95a092a261f3c265fd30a10e0c0ead524bc

Author: Ken Thomases <ken at codeweavers.com>
Date:   Fri Nov  6 06:57:53 2015 -0600

winemac: Use CVDisplayLink to limit window redrawing to the display refresh rate.

Some Windows apps cause user32 to flush the window surface much faster than the
display refresh rate.  The Mac driver only marks its window as needing to be
redrawn and lets Cocoa decide how often to actually redraw.  Unfortunately,
Cocoa redraws each time through the run loop and, since the Mac driver uses a
run loop source to convey messages from background threads to the main thread,
it redraws after every batch of messages.

On some versions of OS X, this excessive drawing provokes synchronization with
the window server's buffer swaps, preventing the main thread from being
responsive.  Even when that doesn't happen, it's wasteful.

So, we set our windows' autodisplay property to false so that Cocoa never
displays windows itself.  Then, we arrange to call -displayIfNeeded once per
display refresh cycle using a CVDisplayLink.  We maintain one CVDisplayLink per
display (on demand), move windows among them as the windows change screens,
start them when they acquire their first window, and stop them when they have
none left.

Signed-off-by: Ken Thomases <ken at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winemac.drv/Makefile.in    |   2 +-
 dlls/winemac.drv/cocoa_window.h |   2 +
 dlls/winemac.drv/cocoa_window.m | 167 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 170 insertions(+), 1 deletion(-)

Diff:   http://source.winehq.org/git/wine.git/?a=commitdiff;h=3beec95a092a261f3c265fd30a10e0c0ead524bc



More information about the wine-cvs mailing list