Testing For DMA Support

Before using DMA operations, you must test the device for DMA support and, if it does support DMA, how much support it provides. Begin by retrieving the driver capabilities by calling the IDirectDraw2::GetCaps method, then look for the DDCAPS_CANBLTSYSMEM flag in the dwCaps member of the associated DDCAPS structure. If the flag is set, the device supports DMA.

If you know that DMA is generally supported, you also need to find out how well the driver supports it. You do so by looking at some other structure members that provide information about system-to-video, video-to-system, and system-to-system blit operations. These capabilities are provided in 12 DDCAPS structure members that are named according to blit and capability type. The following table shows these new members.

System-to-video Video-to-system System-to-system
dwSVBCaps dwVSBCaps dwSSBCaps
dwSVBCKeyCaps dwVSBCKeyCaps dwSSBCKeyCaps
dwSVBFXCaps dwVSBFXCaps dwSSBFXCaps
dwSVBRops dwVSBRops dwSSBRops

For example, the system-to-video blit capability flags are provided in the dwSVBCaps, dwSVBCKeyCaps, dwSVBFXCaps and dwSVBRops members. Similarly, video-to-system blit capabilities are in the members whose names begin with "dwVSB," and system-to system capabilities are in the "dwSSB" members. Examine the flags present in these members to determine the level of hardware support for that blit category.

The flags in these members are parallel with the blit-related flags included in the dwCaps, dwCKeyCaps, and dwFXCaps members, with respect to that member's blit type. For example, the dwSVBCaps member contains general blit capabilities as specified by the same flags you might find in the dwCaps member. Likewise, the raster operation values in the dwSVBRops, dwVSBRops, and dwSSBRops members provide information about the raster operations supported for a given type of blit operation.

One of the key features to look for in these members is support for asynchronous DMA blit operations. If the driver supports asynchronous DMA blits between surfaces, the DDCAPS_BLTQUEUE flag will be set in the dwSVBCaps, dwVSBCaps, or dwSSBCaps member. (Generally, you'll see the best support for system-memory-to-video-memory surfaces.) If the flag isn't present, the driver isn't reporting support for asynchronous DMA blit operations.