Notification of Actual Heap Base Addresses

A driver might need to know the linear and physical address of the base of the heap at DirectDraw initialization time (for example, during mode changes) rather than waiting for a surface creation request and looking at the heaps in the global DirectDraw surface object. To support this, DirectDraw calls the driver-supplied DdGetDriverInfo callback function with a globally unique identifier (GUID) that identifies the information to be returned by the driver. If the driver recognizes the GUID and has information to return, it copies this information into the supplied data structure and passes it back to DirectDraw.

The driver uses two GUIDs to gather and offer further information regarding Direct Draw heaps:

  • GUID_GetHeapAlignment

  • GUID_UpdateNonLocalHeap

GUID_GetHeapAlignment signals to the driver to gather heap alignment information about any DirectDraw heaps that are passed to it. The heap information is passed to the driver using the DD_GETHEAPALIGNMENTDATA structure. GUID_GetHeapAlignment is defined as:

DEFINE_GUID( GUID_GetHeapAlignment,
    0x42e02f16, 0x7b41, 0x11d2, 0x8b, 0xff, 0x0, 0xa0, 0xc9, 0x83, 0xea, 0xf6);

GUID_UpdateNonLocalHeap signals the driver to update its internal state with the heap information with the nonlocal heap structures supplied by DirectDraw. This information is contained in the DD_UPDATENONLOCALHEAPDATA structure. GUID_UpdateNonLocalHeap is defined as:

DEFINE_GUID( GUID_UpdateNonLocalHeap,
           0x42e02f17, 0x7b41, 0x11d2, 0x8b, 0xff, 0x0, 0xa0, 0xc9, 0x83, 0xea, 0xf6);

If the driver must allocate memory for AGP surfaces by itself, but has exposed heaps to DirectDraw, then HeapVidMemAllocAligned is exposed as an Eng function for this purpose. HeapVidMemAllocAligned only deals with heap addresses so it returns an offset. The driver must do whatever memory mapping work it needs to do to turn the information returned from HeapVidMemAllocAligned into a virtual address.