|
Coalesced UpdatesMac OS X 10.4 introduces a new behavior of coalescing updates that enables Quartz to more efficiently update the frame buffer during each display refresh. In addition to increasing system efficiency, Coalescing updates improved visual consistency and eliminates "tearing" during scrolling and animation. To coalesce updates, the Quartz window server composites all window buffers into a single offscreen frame buffer before flushing it to the screen. When your application issues a command to flush, the system doesn't actually flush that content until the next available display refresh. This allows all updates for multiple applications to happen at the same time. Window server operations (window resize or move, for example) are handled in the same manner—coalesced into a system-wide screen update. How does this affect applications?The majority of applications gain the benefit of coalesced updates, however, there are some situations where it can cause performance regressions. Regressions tend to fall into two categories:
What tools can I use to tell if an application is being affected by coalesced updates?If an application that has been built and linked on 10.4 is spending more time drawing than the same application built and linked on a previous system, then it is probably being affected by coalesced updates. Their are two tools that can be used to verify if an application is or isn't being affected by coalesced updates, Quartz Debug and Shark. Quartz DebugQuartz Debug is a debugging tool for the Quartz graphics system with several powerful features to help you identify a number of graphics display and performance problems. Once the Mac OS X developer tools have been installed, the Quartz Debug application is located in: /Developer/Applications/Performance Tools/. To see the affect of effects of coalesced updates on applications, including CFM applications and applications linked on systems previous to 10.4, enable forced beam synchronization in Quartz Debug. An application that is being affected by coalesced updates will have a lowered frame rate when beam synchronization is enabled then when beam synchronization is disabled, and often will have increased CPU usage. To learn more about using Quartz Debug to see the effect of coalesced updates see Q&A 1234, Debugging Graphics with QuartzDebug. SharkShark is a profiling tool included with the Mac OS X developer tools distribution. Shark can be used to profile an application and see if too much time is being spent in drawing operations, signaling that an application is having its updates coalesced. Once the Mac OS X developer tools have been installed, the Shark profiling tool is located on the system at: /Developer/Applications/Performance Tools/. If needed use Quartz Debug to force beam synchronization, then in Shark, sample your application using the "Time Profile (All Thread States)" mode. If you see time more time spent in the To learn more about using Shark for profiling please see Apple Developer Connections performance page at http://developer.apple.com/performance/. RecommendationsTo applications, this doesn't really change what they should be doing; it just enforces what has been recomended in the past. General recommendations
Best Practices
A last resortIf your application cannot adopt any of the above solutions, it is possible to disable coalesced updates for your application. To disable coalesced updates for your application, set the the key Listing 1: Using CGDisableCoalescedUpdates, in an applications Info.plist, to disable coalesced updates on 10.4.4 and later. <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleExecutable</key> <string>GraphicsApp</string> <key>CFBundleName</key> <string>GraphicsApp</string> ... <key>CGDisableCoalescedUpdates</key> <true/> ... <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleSignature</key> <string>grap</string> <key>CFBundleVersion</key> <string>1.0</string> </dict> </plist> IMPORTANT: In order to maximize compatibility, all applications linked on systems before 10.4 (including all CFM apps, even if linked on 10.4) will not have their flush operations forced into a coalesced update cycle if that flush would only go out by itself. All accelerated surface flushes that go through the window server will be done via a coalesced update cycle. If an older application or one that disables coalesced updates in its Info.plist issues a flush and a coalesced update is already in progress though, then that flush will become part of the current coalesced update. This means that newer apps that want visual correctness will take precedence over older apps that are potentially trying to flush too quickly. Document Revision History
Posted: 2006-01-20 |
|