510 likes | 1.15k Views
New Developments in WDM Audio Drivers in Windows XP Martin Puryear Development Lead Windows Core Audio Microsoft Corporation. Agenda. Slides to be posted on WinHEC site New features DDK documentation additions/updates New/updated DDK samples New DDK tools Important OS changes
E N D
New Developments in WDM Audio Drivers in Windows XP Martin PuryearDevelopment LeadWindows Core AudioMicrosoft Corporation
Agenda • Slides to be posted on WinHEC site • New features • DDK documentation additions/updates • New/updated DDK samples • New DDK tools • Important OS changes • Common problems • Resources for WDM audio developers • What can you do next?
New FeaturesAdded in Windows XP • Improved multi-channel support • Support for multi-channel volume/mute KS topology nodes • Translates into appropriate mixer controls • No Mixer API changes needed • (waveOutSetVolume, DirectSound SetPan APIs not yet revised, still stereo only) • DDK documentation and relevant sample code (in ac97smpl) to be added post-Beta 2 • Increased SysAudio numChans 6->24
New FeaturesAdded in Windows XP (2) • Additional multi-channel support • Multi-channel volume property page • Invoked from SndVol32 and Sounds CPL (Volume|Speaker Volume…) • Manipulates individual volumes of multi-channel controls • DirectSound SetSpeakerConfig API and CPL Volume|Advanced|Speakers pane • New enums for 7.1 and “No speakers” • Revamped bitmaps to better express configs • Fixed KMixer SuperMix defaults
New FeaturesAdded in Windows XP (3) • Extended capabilities • Returns GUIDs for MID & PID, ULONGs for driver version & revision, plus GUID to specify a long name stored in registry (MediaCategories) by INF • KS property on wave filter • KSPROPSETID_General • KSPROPERTY_GENERAL_COMPONENTID • DDK sample: MSVAD\simple • 1394 audio class driver (AVCAudio.sys) • AC97 controller drivers • Intel (ICH2), VIA, ALi, SiS • Strong suggestion: new codecs pass all WHQL tests with Windows XP in-box controller drivers
New FeaturesAdded in Windows XP (4) • 64-bit support • All core components and DDK samples ported • HW drivers for USBAudio, CS4281, AVCAudio • Native 64-bit API support: • DirectSound, DirectShow, KsProxy/KSUSER • waveOut/In, midiOut/In, mixer, aux, MCI, ACM • Not enabled: DirectMusic • 32-bit WOW API support: • DirectSound (emulation only), DirectShow • waveOut/In, midiOut, mixer, aux, MCI, ACM • Not enabled: KsProxy/KSUSER, DirectSound (non-emulated), midiIn, DirectMusic
New FeaturesAdded in Windows XP (5) • Acoustic Echo Cancellation support • Noise Suppression and Automatic Gain Control are optionally included • Inserted at lowest level (post-mixer) • Accessed via DSound8 full duplex object • Can be hardware-accelerated • MS system-supplied AEC • AVStream component • 8 kHz-22 kHz, 16-bit mono • No clock rate matching for input/output
New FeaturesAdded in Windows XP (6) • Global Effects Filters (GFX) • Recommended for hardware-specific master effects (speaker compensation, mic array filters) • Also useful for general audio processing (EQ) • Applied to final playback mix or original capture signal for all APIs • Hardware-specific effects automatically added • Sounds control panel (Audio|Advanced…|Effects) used to add, reorder, manipulate effects • Vendor-supplied UI invoked from Sounds CPL • Vendor implements effect as AVStream filter • Restricted to USB devices on Windows XP • Future OS releases will allow application to any audio device with supporting HW driver
New FeaturesAdded in Windows Me • Secure Audio Path (kernel mode DRM) • Now required for Windows XP logo • USB MIDI • WinME QFE available for MIDI/audio devices • Non-PCM output • Also in Windows 2000 Service Pack 2 • Also available in Windows 98 SE QFE • Contact Microsoft Product Support Services for this • Peakmeter support and supporting SndVol UI
New FeaturesAdded in QFE Releases • QFEs are supersets, backward-inclusive • Windows 98 SE QFE – 269601USA8.EXE • Non-PCM, Windows 2000 fixes, SoftFM • Not included: volume persistence, DSound cloning, waveOutGetPosition (non-PCM), IPortClsVersion • Windows Me QFE – 280127USAM.EXE • USB MIDI, CD slider, glitch reduction • Talk to PSS for redist rights for 9x QFEs
New FeaturesAdded in Service Pack Releases • Windows 2000 Service Pack 1 • No audio changes • Windows 2000 Service Pack 2 • Non-PCM, volume persistence, DSound cloning, IPortClsVersion • No further SP work expected at this time
(Un)FeaturesWhat’s not present in Windows XP • HW acceleration of DirectX 8 • Planned for subsequent release • USB2 support • Support for tons of 1394 devices (mLan) • Very low-latency PCM via DSound/wave • Multi-channel peakmeters, SetPan, waveOutSetVolume, supermix API • Dynamic changes in topology or format • Support for custom mixer line controls
DDK Documentation Additions and Updates(big thanks to Windows DDK doc team, particularly Jerry Van Aken!)
DDK Doc ChangesNew Material • Hardware Events • DirectSound HW Acceleration Slider • DirectSound speaker configuration settings • Supporting non-PCM wave formats • From hwdev/audio White Paper • Digital Rights Management • From Windows 2000 DDK addendum • WDM Audio platform differences
DDK Doc ChangesNew Material (2) • KMixer driver Sample Rate Conversion and mixing policy • Factors governing Wave-output latency • DirectSound capture effects • Including AEC, AGC, NS • Multifunction audio devices • Installing and configuring Audio drivers • Windows 2000 device-interface limits
DDK Doc ChangesNew Material (3) • Extensions to legacy Windows Multimedia APIs • Extended capabilities in WDM Audio drivers • Accessing the preferred Device ID • Media-Class INF Extensions • AlsoInstall, Known Files • Data-intersection handlers • Power management for Audio drivers • Version numbering for Audio drivers
DDK Doc ChangesExisting information augmented • USB Audio/MIDI class driver description • Supporting hardware acceleration of DirectSound 2-dimensional mixing • Kernel Streaming topology to Audio Mixer API translation • Clarified use of: • PcNewRegistryKey, NewMasterDmaChannel, PcRegisterPhysicalConnection*, PcAddAdapterDevice, and so on
DDK Doc ChangesNew Material Already Added post-Beta • Global Effects filters • AEC system filter • Media-Class INF Extensions • KnownRegEntries, SetupPreferredAudioDevices • Control Panel branding by vendors • Speaker configuration update • Elaboration of driver implementation of DSSPEAKER_SURROUND and DSSPEAKER_DIRECTOUT modes
DDK Doc ChangesNew Material To Be Added post-Beta • Update information about Microsoft’s AEC implementation • 64-bit driver and API specifics • Detecting different WDM platforms • Including how to detect which QFE/SP is installed • Differences between WDM audio platforms • Including a taxonomy of the different QFEs/SPs • Explain MME device limits in Win XP • Chart showing non-PCM support among different WDM OSes • Additional DRM documentation
DDK Doc ChangesNew Material To Be Added post-Beta (2) • Using the migration DLL to retain a 9x WDM driver during upgrade to NTOS • Document how a driver exposes multi-channel volume/mute nodes • New default settings for sliders in Win XP • DirectSound HW acceleration slider • SRC quality (used for DSound output only) • DSound support for mix of 2D/3D pins • Overriding the IDmaChannel interface • Info for audio bus drivers • “Which sample to start with?” - Overview of the various DDK samples
Windows DDK Sample Driver Additions and Upgrades • New: • GFX – global effect filter • MSVAD – virtual audio device • Improved: • AC97smpl – Intel ICH2 • DDKSynth – kernel software synth • DMusUART – MPU miniport • SB16 – ISA sample
AC97 SampleAdditions and Upgrades • New interactive INF Viewer tool • Contains migration DLL sample code • New property page & CPL • Speaker configuration property • KSPROPERTY_AUDIO_CHANNEL_CONFIG • Driver writes to registry upon set • Driver reads registry value upon get • Also at Miniport::Init • Other custom properties - Get (and Set)
AC97 SampleAdditions and Upgrades (2) • WAVEFORMATPCMEX support for multi-channel streams • Support for Intel 820 (multi-channel ac97 codecs) • Multi-channel volume workarounds for past versions of Windows: • How to add additional nodes/connections for surround and center/LFE • Send sample rate change requests there, etc. • How to add virtual master volume (mono) if 4 or 6 channel present • How to change data range depending on number of ac97 codecs detected • Multi-channel mute and volume handlers
AC97 SampleAdditions and Upgrades (3) • DRM support • Note that it can't detect presence of S/PDIF on non-compliant ac97 codecs, so this is questionable • Vastly improved INF • Significant DataRangeIntersection handler cleanup • Better synchronization • MapLock not held during PortStream->GetMapping
AC97 SampleAdditions and Upgrades (4) • Treat D2 exactly like D3 now • Disconnect interrupt anytime not in D0 now • Note bug fix at minwave.cpp, line 570-72 (Win9x remove/add doesn’t destroy filter descriptor) • GetAllocatorFraming FrameSize must be sample block aligned • Pin's DataRange.SampleSize should be set to non-zero! • Code clean up from Windows 2000
DDKSynth SampleAdditions and Upgrades • Vastly improved INF/install • Now appropriate for SW devices • FP protection • Fixes for memory leaks, KS property handling
DMusUART SampleAdditions and Upgrades • Added IMusicTechnology, for clients to specify • KSMUSIC_TECHNOLOGY_PORT • KSMUSIC_TECHNOLOGY_WAVETABLE • (KSMUSIC_TECHNOLOGY_SWSYNTH, _SQSYNTH and _FMSYNTH are N/A) • Fixes for KS property handling • Added IPowerNotify for proper power management behavior • Reset MPU when returning to D0 • Removed UART sample
Global Effects SampleAdditions and Upgrades • AVStream filter (GFXSwap) that performs global audio processing (in this case, L/R channel swap) • Vendor UI property page, including custom KS property (Get and Set) • INF for installation, with optional INF lines for hardware-specific installation
Virtual Audio Driver (MSVAD)Additions and Upgrades • Simple • Baseline miniport driver template • Extended caps (MID, PID) • AC3 • AC3-over-SPDIF output pin • Non-PCM DataRangeIntersection handler • DrmSimp • SetContentId implementation for simple IDrmAudioStream • Emulates muting of HW with savedata
MSVADAdditions and Upgrades (2) • DrmMult • CreateContentMixed, GetContentRights, DestroyContent • Like DrmSimp, emulates muting of individual HW streams with savedata • Doesn't actually mix • ds2dhw • Volume, sum, SRC properties and nodes • Correct node ordering for DS mixing • MultStr • > 1 output stream
MSVADAdditions and Upgrades (3) • PcmEx • Intersection handler for extensible format • DDK sample migration paths: • Simple --> AC3, PcmEx, DrmSimp, MultStr • MultStr --> ds2dhw, DrmMult • (DrmSimp --> DrmMult)
SB16Additions and Upgrades • HW event support (volume control callbacks) • KSEVENT_CONTROL_CHANGE automation table and event handler AddEventToEventList • Then on ISR we GenerateEventList • DRM • Also better comments in SetContentId • IDmaChannel for indirection/buffer tweaking • Resume from S4 SR fix
SB16Additions and Upgrades (2) • Extended caps (MID, PID) • INF MediaCategories entry for NameGuid • IPortClsVersion • Plus comments for how to detect pre-IPortClsVersion QFEs • DataRangeIntersection handler cleanup • SetNotificationFreq FramingSize must be sample block aligned • General code clean up
DDK Samples New Material To Be Added post-Beta • Migration DLL sample with complete INF • MSVAD sample for DSound 3D mixing • Inclusion of AddContentHandlers and other DRM calls into MSVAD\DrmMult
New DDK Tools • KsStudio (Grapher.2) • Tons of great new features • Interactive INF viewer • Multi-channel streaming tool • New WHQL tests • DRMTest • AC3Test • DmDrvTst • KsDmTst • GfxTest
Lib and .h File ChangesPortCls.lib • Removed from PortCls.lib: • PcNewIrpStreamPhysical, PcNewIrpStreamVirtual • Added to PortCls.lib: • PcAddContentHandlers, PcForwardContentToDeviceObject • Not in Windows Me • PcCompleteIrp, plus five DRM exports • PcCreateContentMixed, PcDestroyContent, • PcForwardContentToInterface, PcGetContentRights • PcForwardContentToFileObject (deprecated)
Lib and .h File ChangesPortCls.h • New PortCls interfaces added to PortCls.h: • IDrmPort interface declaration and implementation macro • IDrmPort2, built on IDrmPort from Windows Me • Adds AddContentHandlers & ForwardContentToDeviceObject • IPortClsVersion for WDM audio platform detection • IDmaOperations for HalAllocateCommonBuffer (since it is obsolete) • Could use IDmaChannel • IMusicTechnology for non-MPU devices with a UART interface
Lib and .h File ChangesPortCls.h • Removed from PortCls.h: • NewIrpStream #defines • PcRegisterIrpHandler • Other Vtable declaration cleanup for ForwardContentToInterface • Managment --> Management
INFs/Setup • Dynamic Update • Logo’d driver on Windows Update automatically pushed during upgrade if no in-box PNP ID match • Windows 9x WDM drivers’ INF files are deleted upon upgrade to NTOS • Unless Win 9x INF contains special section and installs Migration DLL • Migration DLL entries shown in INF viewer tool • Legacy detection removed for Windows XP • PreCopySection removed for NT-only INFs • Only needed for Windows 9x legacy detection • Sample INFs’ 9x vs. NT sections cleaned up
Common ProblemsWith WDM Audio Drivers • Power Management • Scatter-gather lists gets scrambled • Test aggressively with PMTE & Lullaby • Plug and Play • Incorrect treatment of child devices • Test aggressively with HCT tests • FP problems • Not saving FP state appropriately • Direct CR0 manipulation • Interrupt Storms • Failures with new Verifier (deadlock, I/O)
Common ProblemsWith Audio Devices • Power Management HW issues • C3 state issues • Repeated power cycles, HW does not awaken • Plug and Play HW issues • Interactions with on-chip video, modem devices • Not separable into MF-compliant subdevices • HW cannot be partitioned • HW incapable of redirecting final output to host • Renderer includes analog processing • USB: not providing a low-bandwidth pipe (non-zero, <20%) for bandwidth reservation
Resources for WDM Audio Driver Writers • Windows DDK (of course!) • Web resources • www.microsoft.com/winhec • www.microsoft.com/winhec/winhec2000.htm • www.microsoft.com/hwdev/audio • support.microsoft.com/directory/ • groups.yahoo.com/group/wdmaudiodev • Good external resource for audio developers • Archive is full of lore • Numerous books on WDM (Oney, et al)
Call to Action • Take advantage of new audio features of Windows XP to create full-featured drivers • Logo your drivers for Windows XP • Keep in touch! DDK feedback is appreciated: • Are samples/docs unclear or incomplete? • What new samples or docs are needed? • What features should be added to WDM audio? • Send DDK feedback to HakonS@microsoft.com (program manager for WDM audio drivers) • WinHEC is over; go forth and be fruitful