DDDR/2 - 32-Bit Super VGA Display Driver

Reprint Courtesy of International Business Machines Corporation, © International Business Machines Corporation =32-Bit Super VGA Display Driver= The 32-bit Super VGA display driver, like all display drivers, provides hardware- independence for OS/2 application programs needing to perform I/O to a display device. While the general architecture and functionality of the Super VGA driver are the same as the 32-bit VGA driver, there are differences between the two. This chapter concentrates on those differences. See 32-Bit VGA Display Driver for detailed information about 32-bit VGA display drivers.

Overview
The 32-bit Super VGA display driver dynamically supports the following chip sets: The hardware is queried at runtime, and separate code paths for each chip set are taken.

The Super VGA driver supports multiple resolutions for each chip set, including 640 x 480, 800 x 600, and 1024 x 768. Each of these resolutions is supported in 256-color mode. A separate driver is built for each resolution using conditional compilation.

The 32-bit Super VGA display driver also supports several new features:
 * OS/2 Presentation Manager (PM) Palette Manager
 * Two new background mix options:
 * BM_SRCTRANSPARENT
 * BM_DESTTRANSPARENT

These new functions permit transparent overlay and transparent underlay of BitBlt operations. See for details.

32-Bit Super VGA Display Driver Architecture
The 32-bit Super VGA display driver consists of two components: IBMVGA32. DLL and IBMDEV32.DLL. This architecture was chosen to make the driver more easily portable among various hardware video cards. The device-independent functions of the driver are contained in the base DLL, IBMVGA32.DLL; the device-specific functions are contained in the device-specific DLL, IBMDEV32.DLL. In order to be used in the system, individual Super VGA drivers must be renamed to IBMDEV32.DLL when they are built.

The graphics engine calls entry points in both DLLs. The two DLLs also call exported entry points within each other. If you want to port this driver to other video cards, you must write code that supplies the functionality for the entry points in the device-specific DLL. Notice that fonts are now built in the separate DLL called DSPRES.DLL. The following figure shows the 32-bit Super VGA display driver architecture.



Building the 32-Bit Super VGA Display Driver
The supplied display drivers can be built using the NMAKE Utility in the IBM Developer Connection Device Driver Kit for OS/2. (The NMAKE Utility is particularly useful in programs consisting of several source files because it builds only those components that have changed since the program was compiled last.) The following six drivers can be built from the same source set: Each of the drivers supports all six of the previously-mentioned chip sets. The debug versions of each driver have enabled all code within the ifdef FIREWALLS conditional compilation, which provides some extra error checking and messages through the kernel debugger.

By default, all the drivers are built just by typing the NMAKE command. Individual drivers can be built by passing the following parameters to NMAKE: NMAKE [vertical resolution].[debug or retail flag]

for example:

New Background Mix Support
The background mix, BM_SRCTRANSPARENT, is used in calls to GpiBitBlt and GpiDrawBits so that pels in a source bit map that match pels in the target presentation space background color are not copied to the output bit map. Where source bit-map pels match the background color, target bit-map pels are left unchanged, which provides a transparent overlay function.

The background mix, BM_DESTTRANSPARENT, also is used in calls to GpiBitBlt and GpiDrawBits, to permit pels from the source bit map to be copied to only the target pels that match the background color of the presentation space. Pels in the target are changed where the source bit-map pels match the background color of the target, thus providing a transparent underlay function.

OS/2 PM Palette Manager Support
The supplied driver supports the OS/2 PM Palette Manager, which is a set of application-level APIs that enable an application to change a video board's palette look-up table. Refer to PM Palette Management Support for additional information. The driver must deal with logical color tables (LCTs), as well as palettes, and must be able to convert between memory-memory, memory-screen, and screen-memory bit maps.

Screen bit-map pels are physical indexes into the hardware palette, whether you are dealing with a device context (DC) that is using a palette or an LCT.

Memory bit-map pels can be any of the following:
 * Logical indexes into a palette if you are dealing with a DC that is using a palette
 * Physical indexes into the device default palette if you are dealing with a DC that is using an LCT
 * Physical indexes into the hardware palette if you are dealing with a DC that is using a realizable LCT