Managing AGP Heaps
This topic applies only to Windows NT-based operating systems.
A driver can manage AGP heaps using notifications that it receives from the DirectX runtime. The driver receives the notifications from the runtime as GetDriverInfo2 requests that use the following values:
For more information about the GetDriverInfo2 request, see Supporting GetDriverInfo2.
When the display device is created, the display driver receives a GetDriverInfo2 request with the D3DGDI2_TYPE_DEFERRED_AGP_AWARE notification, which the driver uses to determine if it should disable its other mechanisms that handle AGP heaps and instead use the D3DGDI2_TYPE_FREE_DEFERRED_AGP and D3DGDI2_TYPE_DEFER_AGP_FREES notifications that the runtime subsequently sends. In the D3DGDI2_TYPE_DEFERRED_AGP_AWARE notification, the DirectX runtime provides a pointer to a DD_DEFERRED_AGP_AWARE_DATA structure in the lpvData member of the DD_GETDRIVERINFODATA data structure.
The driver sometimes receives a GetDriverInfo2 request with the D3DGDI2_TYPE_DEFER_AGP_FREES notification before a display mode change occurs. The DirectX runtime only sends this notification if the runtime performs the display mode change. The driver should check the process identifier (PID) of the process destroying the surface against the process that created the surface. If the PIDs are different, the driver should not destroy the user-mode mappings of the AGP memory because an application might still be using the memory.
The driver receives a GetDriverInfo2 request with the D3DGDI2_TYPE_FREE_DEFERRED_AGP notification when all display devices within the process stop using surfaces, textures, vertex buffers, and index buffers that were locked at the time of the display mode change. The notification informs the driver that it can safely destroy all of the user-mode mappings of the AGP memory.
In the D3DGDI2_TYPE_DEFER_AGP_FREES and D3DGDI2_TYPE_FREE_DEFERRED_AGP notifications, the runtime provides a pointer to a DD_FREE_DEFERRED_AGP_DATA structure in the lpvData member of the DD_GETDRIVERINFODATA data structure. The dwProcessId member of DD_FREE_DEFERRED_AGP_DATA specifies the PID of the process that destroys the AGP memory.
Note that an application can terminate without the runtime sending the D3DGDI2_TYPE_FREE_DEFERRED_AGP notification to the driver. Therefore, the driver should free all of the user-mode mappings of the AGP memory when it receives a call to its D3dDestroyDDLocal function.