##### Using DMA

Hardware transfers use physical memory addresses, not the virtual addresses which are home to applications. Some device drivers require that you provide the surface’s physical memory address. This mechanism is implemented by the IDirectDrawSurface3::PageLock method. If the device driver does not require page locking, the DDCAPS2_NOPAGELOCKREQUIRED flag will be set when you retrieve the hardware capabilities by calling the IDirectDraw2::GetCaps method.

Page locking a surface prevents the system from committing a surface’s physical memory to other uses, and guarantees that the surface’s physical address will remain constant until a corresponding IDirectDrawSurface3::PageUnlock call is made. If the device driver requires page locking, DirectDraw will only allow DMA operations on system memory surfaces that the application has page locked. If you do not call IDirectDrawSurface3::PageLock in such a situation, DirectDraw will perform the transfers by using software emulation. Note that locking a large amount of system memory will make Windows run poorly. Therefore, it is highly recommended that only full-screen exclusive mode applications use IDirectDrawSurface3::PageLock for large amounts of system memory, and that such applications take care to unlock these surfaces when the application is minimized. Of course, when the application is restored, you should page lock the system memory surface again.

Responsibility for managing page locking is entirely in the hands of the application developer. DirectDraw will never page lock or page unlock a surface. Additionally, it is up to you to determine how much memory you can safely page lock without adversely affecting system performance.