# SAMPLE: Developing Windows 3.1 Video Drivers

Last reviewed: August 5, 1996
Article ID: Q103212
The information in this article applies to:

- Microsoft Windows Device Development Kit (DDK) for Windows version 3.1

Improving Windows 3.1 Display Drivers

Herman Rodent Microsoft Developer Network Technology Group

Created: January 25, 1993

### Abstract

Video device drivers have always been a major factor in controlling the overall performance of a Microsoft Windows system. The increasing use of color images, animation, and more recently, motion video in applications means that the video driver in a system is now one of its most critical components. This article discusses how display driver writers can get the best performance possible from their video drivers. The following points are covered:

- Using device-independent bitmaps (DIBs) in applications
- Supporting StretchDIBits
- Optimizing for the 386 processor
- Special-casing 1:1 palettes
- Special-casing common raster operation (ROP) codes
- Supporting the new 16- and 32-bit-per-pixel DIB formats

The VDRIVERS directory contains the following source modules and tools for developing video drivers:

- The DDTEST tool measures the frame rate that can be achieved on your current driver.
- The V7VGA driver code includes a module called BBLT.ASM, which contains the basic BitBlt code. This module invokes different pieces of code for different Blt requirements. The code is well commented and worth looking at.
- The STRETCH.ASM module from the V7VGA driver sources shows an example of 80386-specific coding.
- RLD.ASM contains the routines for drawing RLE directly to the screen or to a bitmap. This code attempts to optimize the very common case where no clipping at all is required by using special output functions for clipped and non-clipped output. The palette translation table passed down by the graphics device interface (GDI) is also checked for the identity map; if found, this is also optimized.
- DISCREEN.ASM draws a device-independent bitmap (DIB) directly to the display. This module contains the routines for drawing a 1/4/8/24-bit uncompressed DIB directly to the screen. It also supports OPAQUE or TRANSPARENT mode.

Download VDRIVERS.EXE, a self-extracting file, from the Microsoft Software Library (MSL) on the following services:

- Microsoft Download Service (MSDL)

            Dial (206) 936-6735 to connect to MSDL
            Download VDRIVERS.EXE (size: 149873 bytes)

- Internet (anonymous FTP)

            ftp ftp.microsoft.com
            Change to the \softlib\mslfiles directory
            Get VDRIVERS.EXE (size: 149873 bytes)

> Additional reference words: 3.10 softlib VDRIVERS.EXE
> KBCategory: kbprg kbfile kbwebcontent
> KBSubcategory: DthreeDispMisc

Last reviewed: August 5, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.