Case Study: ATI Device Power Management In Windows Vista Phil Mummah Software Architect ATI
Agenda Device power management Overview ATI PowerPlay TM technology Integrating with Windows Vista Power Manager Windows Vista enhancements Implementation details DemoSummary Additional resources
Power Management Overview Device Run time idle detection Transition an inactive device into a low power, non-working power state (e.g., D2) Wake and transition to D0 on I/O traffic, interrupt Device-specific tradeoff of performance for reduced power consumption In the context of the device’s On state (D0) Examples: scale device clock rates and core voltages, clock gating, vary transmit power or communication speed, etc. Device performance states Analogous to ACPI processor performance states Discrete combinations of power consumption and performance Application performance tradeoff for reduced power Reduce unnecessary activity in battery mode
Device Power Management Opportunities and goals Extend mobile PC battery life Customers want extended battery life and are willing to pay for it Differentiate your products Add significant value to your device Drive down system power consumption Reduce fan noise, system thermal output Equally applicable to mobile and desktop systems
Device Power Management Opportunities and goals Devices, services and applications all help to reduce system power consumption Watts Max CPU Max LCD Max Animation Min LCD MinAnimation Min CPU Max LCD Max Animation Min LCD MinAnimation
Device Power Management ATI PowerPlay Reduces the power consumption of ATI Mobile RadeonTM graphics devices When the device is idle When the system is running on battery Exposes API for OEM enhancements Offers users the optimal balance of performance and power consumption ATI PowerPlayTM drives continuing innovation and advancement in graphics power management Integrated with Windows Vista power management
Device Power Management ATI PowerPlay PowerPlay capabilities GPU core voltage and frequency scaling Memory clock scaling Refresh rate reduction PCI Express dynamic lane width switching Thermal throttling …and more
Windows Vista Power Policy Benefits of integration Offers users a seamless power management experience Provide unified power management controls Allows the entire platform to respond to the user’s current power policy Devices automatically respond to changing system conditions Active power scheme/personality AC/DC power source changes
Windows Vista Power Policy Enhancements Extensible power setting store Devices or applications can define and install custom power settings Windows power manager stores setting data, friendly names, values, etc. All power settings appear in Windows Power Options Including custom third-party power settings No need to provide additional configuration UI Robust command-line tool for system administrator Makes testing, debugging easier
Windows Vista Power Policy User experience improvements Simplified power plans Three default power plans Power Saver, Automatic, High Performance Indicates the overall power management policy to the system Each plans has a personality setting Users can easily change the active power plans One-click from the desktop with the battery meter
Windows Vista Power Policy Steps to driver integration Define custom power policy settings Install custom power settings Prepare the device driver to Register for power events of interest Respond appropriately to these events Optionally, provide additional power management UI
Implementation Details Defining a power setting A custom power setting definition contains A GUID uniquely identifying the setting Friendly name, description strings One or more setting values Range, e.g., 0 – 100% Value: 10 minutes Discrete values E.g., {Enabled, Disabled}; {High, Medium, Low}
Implementation Details Defining a power setting Critical step: Define appropriate defaults Each power scheme personality’s defaults Users might not change the power policy for your power setting System power source (AC/DC) Each device can define multiple power settings Power settings can be placed in subgroups
Implementation Details Example: Defining a power setting GUID{191F65B5-D45C-4a4f-8AAE-1AB8BFD980E6} Friendly Name “ATI Graphics Engine PowerPlay” Description “Configures the GPU Power Management Mode” Values (discrete) ATI Max Performance Mode ATI Balanced Mode ATI Max Battery Mode Subgroup New subgroup created for all ATI PowerPlay settings
Implementation Details Installing a power setting Add the setting and its definition to the power policy store Two methods supported INF-based installation Ideal for device drivers New INF directives for describing power setting, subgroup, possible values Multiple settings can be described in the same INF file API-based installation Win32 APIs in Power Profiles Library (powrprof.dll)
[DeviceName] AddPowerSetting=AtiPowerPolicy [AtiPowerPolicy] Subgroup = {2566CF20-D01A-456f-BFE1-C6C6E76D15A6}, "ATI Graphics Main Power Settings", "Set all graphics power settings " {191F65B5-D45C-4a4f-8AAE-1AB8BFD980E6}, Setting = {191F65B5-D45C-4a4f-8AAE-1AB8BFD980E6}, “ATI Graphics Engine PowerPlay Settings”, “Configures the GPU Power Management Mode” Value=0, "Max Battery Mode", "Minimum Power Setting", REG_DWORD, Value=1, "Balanced Mode", "Medium Power Setting", REG_DWORD, Value=2, "Max Performance Mode", "Max Power Setting", REG_DWORD, Default = %GUID_MAX_POWER_SAVINGS%, %AC%, 1 Default = %GUID_MAX_POWER_SAVINGS%, %DC%, 0 Default = %GUID_TYPICAL_POWER_SAVINGS%, %AC%, 2 Default = %GUID_TYPICAL_POWER_SAVINGS%, %DC%, 0 Default = %GUID_MIN_POWER_SAVINGS%, %AC%, 2 Default = %GUID_MIN_POWER_SAVINGS%, %DC%, 1 Range of Values can also be done, ie 0 – 100% Implementation Details Example: Installing a power setting Setting Friendly Name, Description Power Setting Defined By GUID Discrete List of Values Default Values for Each Power Scheme Personality
Implementation Details Register for notifications Register within device or application initialization code PoRegisterPowerSettingNotification() Register with custom power setting GUID De-register when your device is stopped Kernel-mode registration function includes context parameter Most drivers will pass device extension in context Enables drivers to handle registration for multiple devices
KRSContext::RegisterPowerSettingCallback( IN PDEVICE_OBJECT DeviceObject, OUT HANDLE PowerSettingCallbackHandle ) { NTSTATUS Status = STATUS_SUCCESS; PoRegisterPowerSettingCallback Status = PoRegisterPowerSettingCallback( DeviceObject, (LPGUID)(&GUID_GRAPHICS_ENGINE_POWER_PLAY_MODE), &PowerSettingCallback, (PPOWER_SETTING_CALLBACK)&PowerSettingCallback, DeviceObject->DeviceObjectExtension, &PowerSettingCallbackHandle ); return Status; } Power Setting GUID De-register When Device is Stopped Implementation Details Example: Register for notifications
NTSTATUS PowerSettingCallback PowerSettingCallback( IN CONST LPGUID SettingGuid, IN PULONG NewValue, IN ULONG ValueLength, IN PVOID Context ) { NTSTATUS Status = STATUS_INVALID_PARAMETER; // Check for correct GUID, Data if (IsEqualGUID( GUID_GRAPHICS_ENGINE_POWER_PLAY_MODE (LPGUID)(&GUID_GRAPHICS_ENGINE_POWER_PLAY_MODE), SettingGUID ) && (ValueLength == sizeof(DWORD)) && (NewValue != NULL) ) { // NOT SHOWN: Any necessary locks // Change graphics engine power mode } return Status; } Power Setting GUID Change the Device Power Management Behavior Implementation Details Example: Driver callback function
NTSTATUS UnRegisterPowerSettingCallback( IN HANDLE PowerSettingCallbackHandle ) { NTSTATUS Status = STATUS_SUCCESS; PoUnRegisterPowerSettingCallback Status = PoUnRegisterPowerSettingCallback( &PowerSettingCallbackHandle ); return Status; } Implementation Details Example: Deregister for notifications
Note: Power settings may be system-specific Implementation Details Power configuration user interface Default power settings
UI extended with custom power settings Implementation Details Power configuration user interface
Implementation Details User interface summary Windows automatically adds custom power settings to Power Options Advanced Settings UI Multiple settings can be contained in a new subgroup Each setting has an AC and DC value Settings can be discrete or range of values
UI extended with additional property sheet Implementation Details Power configuration user interface
Implementation Details User interface summary Property sheets may be added for more advanced UI May have a superset of functionality E.g., battery degrade behaviors Property sheets can leverage Power Policy APIs ATI exposes PowerPlay functionality OEM does not need to write special UI to add features
Integrating PowerPlay With Windows Vista Phil Mummah SW Architect ATI
Call To Action Implement device power management technologies in your hardware designs Take advantage of Windows Vista power management integration opportunities Review Integrating with Windows Vista Power Policy white paper
Additional Resources ATI Technologies, Inc. ATI PowerPlayTM white paper Windows Hardware and Driver Central Power Management, ACPI on WHDC default.mspx Integrating with Windows Vista Power Policy white paper
© 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.