Bitmaps in Display Drivers

Certain devices, such as the 16-color VGA display, can perform bit block transfers much faster from nonstandard bitmaps. To support this, a driver can choose to be given the chance to create such surfaces by hooking DrvCreateDeviceBitmap. This allows the driver to create a bitmap that a driver manages completely. When a driver creates such a bitmap, the driver can store it in any format. The driver examines the passed parameters and provides a bitmap with at least as many bits-per-pixel as requested. The contents of the bitmap are undefined after creation. If the application has requested a device-managed bitmap, GDI would call the driver for drawing functions after DrvCreateDeviceBitmap returns control. If the driver returns FALSE, the driver-managed bitmap is not created, so GDI can handle drawing operations on an engine-managed surface.

Few display drivers manage their own bitmaps. Driver-managed bitmaps are provided only for specific devices like the VGA adapter card, which can perform a DrvBitBlt much faster from a bitmap in nonstandard format.

Another function related to bit block transfers in display drivers is the DrvSaveScreenBits function. Some display drivers can move data to or from off-screen device memory much faster than an area can be redrawn or copied from a DIB. Such a driver can hook DrvSaveScreenBits, allowing the driver to be called to save or restore a specified rectangle of a displayed image more speedily when a menu or dialog box is popped up.

Note For bit block transfer calls, the driver does not have to deal with pointer exclusion or clip region locking because GDI handles this.

Drivers that implement device bitmaps in off-screen memory can significantly improve system performance. Off-screen device bitmaps improve system performance by:

·using accelerator hardware in place of GDI to do drawing

·improving the speed of bitmap-to-screen bit block transfers

·reducing demands on main memory (a bitmap stored in off-screen memory isn't taking up space in main memory)

·taking advantage of hardware to perform such operations as mask bit block transfers and double-buffering in support of OpenGL.

Drivers should implement device bitmaps in off-screen memory through DrvCreateDeviceBitmap. The sample S3 driver implements device bitmaps in off-screen memory and should be referred to for a complete example.