DirectDraw and GDI

GDI automatically enables DirectDraw when the display driver is initialized. To provide better interaction between DirectDraw and the graphics DDI portion of the driver, a driver that also supports the DirectDraw DDI can implement or call the following functions:

DrvDeriveSurface

A driver-implemented function that wraps a GDI driver surface around a DirectDraw driver surface, allowing any GDI drawing to DirectDraw video memory or AGP surfaces to be hardware accelerated (rather than being drawn in software via the DIB engine). Typically, if the driver already supports off-screen device bitmaps, this function should require only a few additional lines of code.

DrvDeriveSurface improves the performance of DirectDraw applications that also use GDI, and it also eliminates cursor flicker when a software cursor is used with DirectDraw or Direct3D applications.

HeapVidMemAllocAligned and VidMemFree

Driver-called functions that use the DirectDraw heap manager for all off-screen memory management. DrvCreateDeviceBitmap should call HeapVidMemAllocAligned to request DirectDraw to allocate space for GDI bitmaps; DrvDeleteDeviceBitmap should call VidMemFree to free this allocation.

DirectDraw has priority over the graphics DDI portion of the driver for off-screen memory allocation. The driver should hook the DirectDraw DdFreeDriverMemory callback, which allows the driver to remove GDI surfaces from off-screen memory to make space for higher priority DirectDraw surface allocations.

Both HeapVidMemAllocAligned and VidMemFree are declared in dmemmgr.h, which ships with the Windows Driver Kit (WDK). A driver might have to define __NTDDKCOMP__ before including this header file.

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft