Developing a Display Driver that is Prepared for DirectDraw Support (Windows Embedded CE 6.0)
1/6/2010
You can base your DirectDraw display driver on a regular display driver.
To develop a display driver that is prepared for DirectDraw support
Consult the Display Drivers topic in the device driver development guide. You should create a working display driver using the methods described in that guide.
Although it is not a requirement, Microsoft suggests that you base your display driver on the GPE C++ base classes. This is the fastest way to get your display driver up and running. It allows your driver to be extended with code provided by Microsoft that you would otherwise have to write yourself.
If you do not want to take advantage of the GPE classes, see DDHAL Callback Functions and DDHAL Structures under DDHAL reference.
Once you have written and tested a basic Windows Embedded CE GPE-based display driver, see, Extending a Display Driver with the DDGPE Classes.
Overview of Frame Buffer Handling in DirectDraw Display Driver
**The following paragraphs describe how the Windows Embedded CE 6.0 operating system maps the frame buffer into a client application space by using DirectDraw, and then describes how you should handle that frame buffer in the DirectDraw display driver.
To map the frame buffer into a client application space, DirectDraw tries to determine where the start of video memory is. It calls the function HalGetDriverInfo(GUID_GetDriverInfo_VidMemBase, &pVidMemBase)
in your video driver to find out if the driver can return information about the location of the beginning of video memory. If this call succeeds, pVidMemBase will be non-NULL. If the call fails, typically because the driver does not implement GUID_GetDriverInfo_VidMemBase, then it will assume that the first byte of the primary buffer is the first byte of video memory. Therefore, it determines where the first byte of the primary buffer is located. To do this, it calls HalCreateSurface, HalLock, HalUnlock, and then it frees the surface. It also provides logic to handle rotated surfaces.
DirectDraw performs this task when the user application creates the device. During this task, it also figures out the size of big video memory by reading the value of the DDCAPS.dwVidMemTotal
variable.
After DirectDraw has a pointer to what it has determined to be the first byte of video memory, it does a few things before it calls VirtualAllocCopyEx. It ensures that video memory is aligned to 64 KB and adjusts the pointer and size accordingly. It also tracks a single mapping per process, which enables you to call DirectDrawCreate multiple times in a single process, and all calls can share the same video memory mapping.
Another issue with DirectDraw in CE 6.0 is that it cannot handle discontinuous video memory. The primary buffer and other surfaces based on video memory must be located within a single, continuous virtual region.
To handle the frame buffer in the DirectDraw display driver, make sure that your display driver handles the GUID_GetDriverInfo_VidMemBase GUID in HalGetDriverInfo. Also, make sure that you set DDCAPS.dwVidMemTotal
correctly.**