Platform SDK: DirectX |
The information in this topic pertains only to applications written in C++.
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 IDirectDrawSurface7::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 IDirectDraw7::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 IDirectDrawSurface7::PageUnlock call is made. If the device driver requires page locking, DirectDraw will allow asynchronous DMA operations only on system memory surfaces that the application has page locked. If you do not call IDirectDrawSurface7::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 IDirectDrawSurface7::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.