DefragTools #149 - Media eXperience Analyzer part 1

In this episode of Defrag Tools, Chad Beeder is joined by Jorge Novillo and Jose Baldner. We look at some of the technologies introduced in recent Windows versions to reduce power consumption and improve battery life during video playback on newer hardware, and use Media eXperience Analyzer (MXA) to see whether they are working.
Media eXperience Analyzer (formerly WindowsXRay) is a tool used to visualize ETW traces, with a particular emphasis on media scenarios such as audio/video capture and playback.
Timeline:
[00:00] Introductions and overview
[01:42] To capture a trace, refer back to Episode #149.
[02:48] Low refresh rate for video playback (48 Hz in our example)
[10:36] Processor frequency can drop during lower refresh rate playback
[11:26] Batching for video playback - allows CPU cores to be turned off more of the time
[14:15] Multiplane Overlay (MPO) - how to see if it's working on your system
[21:51] Independent Flip (IFlip) - app can render frames ahead of time and schedule them for the future
[25:18] Email us at defragtools@microsoft.com
This is an interesting video. I am curious to know what technology was used to write the XA application. C# WPF? Any C++?
Hi Gary,
The MXA engine is C++, DirectX, and GDI. MXA has a C++ managed wrapper and C# WPF UI. Let us know if you have any more questions!
Hi Jorge,
Thank you for answering my question. I would be very interested in learning how the C++ DirectX and GDI portions are brought forward and displayed within the managed visual layer. I have a desktop application that is completely unrelated but has some similar visual features, like a timeline with lots of graphical content. It is MFC based right and am interested in alternative approaches. Not sure if it is possible to pick your brain for a few minutes offline but if so please let me know.
Thanks,
Gary
HI Gary,
DirectX is used when the tool is local and GDI when used over remote desktop.
To display the DX Surface on C# we use D3DImage, note that you need to implement your rendering function where you handle the update of The D3DImage. something like
// Get the pointer to Dx surface on c++
IntPtr pSurface = WrapperTo YourC++Class.GetSurface();
if (pSurface != IntPtr.Zero)
{
m_d3dimage.Lock();
m_d3dimage.SetBackBuffer(D3DResourceType.IDirect3DSurface9, pSurface);
WrapperTo YourC++Class.Render();
m_d3dimage.AddDirtyRect(new Int32Rect(0,
0,
m_d3dimage.PixelWidth,
m_d3dimage.PixelHeight));
m_d3dimage.Unlock();
}
msdn has this sample https://msdn.microsoft.com/en-us/library/jj591490.aspx
if you Bing "D3DImage c++ sample" you will get several other useful hits,
Let me know if that helps,
Thanks
Jose
Jose,
Thank you for posting the above information. It is definitely helpful.
Gary
for those of us that would like to try the Media Analyzer tool... could you please make the "demo" driver tool (evntctrl.exe) available for download... thanks
@Tom: We had another request for that, and we're checking into it, but unfortunately I don't think we'll be able to release that tool at this time. We'll mention it on the show if this changes.