Display drivers and hardware

Source: Internet
Author: User
Microsoft Windows CE display driver and hardware

Introduction

The graphic display style of Microsoft Windows ce OS has greatly changed in version 2.0. In Version 1.0, the graphic design interface (GDI) is directly connected to the display hardware, in version 2.0, GDI is connected to one or more display drivers, which in turn are connected to the display hardware. This display technology enables Windows CE to use a variety of display devices without having to have hardware code programs for each device. The new Windows ce gdi combines small steps with multiple purposes.

In this thesis, we first consider the features of a good Windows CE display driver. It discusses the display driver, the interface functions of the device driver that should be executed, and the original graphics engine level, it can be used to simplify writing and display drivers. The devices supported by GDI are also discussed.

This paper lists the details of each pixel depth supported by Windows CE, the display buffer format, and discusses the display hardware, because the display driver is the hardware support for the channel and display driver between the GDI and the display device, you also need to support the GDI.

Windows CE display driver

Like most Windows CE instances, the driver interface (DDI) is a subset of Microsoft Windows nt ddi. If you are not familiar with Windows nt ddi, before writing your Windows CE display driver, read the display driver section of the Windows NT Device Driver package.

Windows CE only uses the most basic graphics engine and driver functions in Windows nt ddi. The differences between Windows CE and Windows NT include the following details:

  • Windows CE displays that drivers have the same functions, and GDI does not query driver capability information;
  • The Windows CE display driver does not reject complex operations. It calls it back to GDI to separate the operations into a few simple steps because all Windows CE display drivers support the same functionality, GD can break down complex operations before calling the display driver for the first time.
  • Windows CE displays that the driver is edited as a dynamic link library (. dll file) instead of a library function (. Lib file ).

All Windows CE display drivers must execute a set of DDI functions, which are composed. in addition to the DDI function, this set of VC ++ classes calls the graphics Primary engine (GPE) class, the display driver uses it to make hardware acceleration easier. The standard display driver calls The GPE class and the acceleration is based on s3trio64 display hardware. If your display hardware uses different video chips, you can change the GPE call method to suit your hardware capabilities.

Note that GPE classes are optional. You can write your display driver without them. The cost is to make the execution of DDI functions more complex, the GPE class provided by Microsoft requires your display hardware to have a flat frame buffer. If your display hardware does not exist, for example, it uses a custom removable window to connect to the entire video memory, it may not use the GPE class. For more detailsWindows CE display hardware recommendationPart, especiallyDirty rec driversSub-division.

Windows CE display drivers differ in many ways from the usual device drivers. The main difference is that they do not expose I/O interfaces. Therefore, they cannot be managed by the Device Manager, so registers cannot be called by them. As a result, there are no special device files or other file system records to coordinate with the active display driver. The display driver loading mechanism is an application that uses the display driver, callCreate DCFunction Dynamic Link file. This enables Windows CE to load the display driver and initialize it so that the device context can return and call the default display driver of the application. Of course, it is automatically loaded.


DDI Functions


The following table lists the DDI function display drivers for displaying and printing drivers. You should execute all the DDI functions listed here. The print driver should execute all the print DDI functions. However, only the drve enable drive must be output by the dynamic link library (DLL) of the display driver. Therefore, only drvenabledrive must have a name, and other functions can be called at will, because they are returned by the DRR enable driver and the function pointer is output to GDI. No matter who is called, it is always defined in win DDI. the prototype in the H file.

Function Purpose
Drvanyblt Extended or transparent bit Transfer
Drvbitplt Common bit transfer with cut and shield
DRV constrostcontrol Allow control and adjustment of software and hardware
Drvcopybits Send the print segment designed by GDI to the print driver
Drvcreatedevicebitmap Design and manage bitmap
Drvdeletedevicebitmap Delete design bitmap
Drvdisabledriver The notification driver GDI no longer needs it and is ready to uninstall it.
Drvdisablep. D. Ev. Notification driver GDI no longer requires special printing or display devices
Drvdisableswrface Notice driver GDI no longer requires special draw Surface
Drvenabledriver The initial records are output by the driver, which is the pointer returned by the DDI function of GDI.
Drvenablepdev Returns a pdev for GDI, which is the logical representation of a physical display device.
Drvenablesface Design a drawing interface and connect it to pdev
Drvemddoc Send any required complete print file control information
Drvfillpath Fill the path with a brush
Drvgetmask Obtain color shielding for current display device Mode
Drvgetmode Lists display modes supported by display devices.
Drvmorepointer Move the pointer to ensure that GDI does not interfere
Drvpaint Paint a specific area with a brush
Drvpowerhandler Call processing, power-on, power-down notifications
Drvaweryfont Obtain the font metric Information
Drvrealizebrush Create a brush with the specified parameters by GDI
Drvreamocecolor Map an RGB color to the color that is most likely to be obtained by the device
Drvseepalette Set display device color palette
Drvseepointershape Set a new shape for the cursor and update the display
Drvstaredoc Send arbitrary start printing File Information
Drvstartpage Send any new page printing information
Drvshokepath Delete path
Drvtransparentbrt Transparent Bit Transfer
Drvunrealizecolor Returns the color of the display device to an RGB value.


Use GPE class

The standard display driver uses the graphics engine Engineering (GPE) class. When the GPE class is optional, it is easy to use them to write the display driver. If you use the GPE class, you only need to provide the required new code to accelerate the normal operation of the display hardware function.

The GPE class requires your display hardware to use a flat frame buffer, that is, the video memory must be in a neighboring memory range. It is very effort-consuming to modify the GPE class to use an discontinuous frame buffer.

To create a GPE-based display driver, follow these steps:

  1. Set a subdirectory for the project;
  2. Copy files to your project directory from the standard drive directory, such as the s3trio64 directory;
  3. Change the device name in the file. For example, change "s3trio64" to your device name;
  4. Change config. cpp to put your display device in a linear frame-buffer mode;
  5. Invalidates the specified hardware;
  6. Establish and test these non-accelerated driver Gpe, and use the software to generate the output;
  7. Add your hardware acceleration mode.


Display Driver service provided by GDI

Windows ce gdi provides services to support the display driver in the form of pre-defined function structures and independent C functions, the predefined structure provides support for brush, cut area, color palette, delete and fill path, conversion, and independent C functions to provide device bitmap and Interface Support.

Function Structure Purpose
Brvshobj Indicates a brush for filling with solid line or grid deletion.
Brvshobj_pvallocrbrush Allocate memory for the brush
Brushobj_pvgeerbrush Returns a pointer to a specific brush.
Clipobj Represents the structure of the cut area
CLIPOBJ-BESUM List the functions used to cut a rectangle from the cut area.
Clipobj-cenumstart Set parameters for list cut rectangles in the cut area
Engcreatedericebitmap Enable GDI to process device bitmap
Engcreatedevicesurface Create a display driver management device interface through GDI
Engdeletesurface Notice that the driver no longer needs the device interface
PALOBJ-C getcolors Copy colors to the color palette
Pathdat Storage part drawing Path Structure
Pathobj-benum List pathdata records in the drawing path
Pathobj-venumstart A draw path lists its linear parts.
PATHOBJ-V getboints Returns the restricted rectangle of the draw path.
Xlateobj Used to transfer colors between the color palette
XLATEOBJ-C get palette Returns the color from the specified color palette.


Display Buffer format

Windows ce gdi supports a wide range of color depth and color modes, from one color to the adjustable true 32-bit RGB, each format also supports several pixel order, this depends on whether the display is 1, 2, or 4.

All display buffer formats, assuming the display pixel order from left to right, from top to bottom, that is, the pixel () in the upper left corner of the pixel (Wisth-1, height-1) in the lower right corner.

1 pixel bit format

It is a simple black/white display. 0 indicates black, and 1 indicates white. Pixels are stored in bytes, so that the pixels (0, 0) are placed at the highest bit of the first byte in the display memory.

2-pixel location format

Although any 4-entry palette can work, the two-pixel format is typically used as a level 4 grayscale display, which is represented by the following list:

1 digit 0 Gray Level
0 0 Black
0 1 Gray
1 0 Bright gray
1 1 White

4-pixel location format

It is usually an adjustable color format. frame buffer can be 2 pixels/1 byte or 1 pixel/1 byte.

If you choose to execute in one pixel/byte mode, the driver will display in the 8-bit/pixel mode of the 16-color palette. The correlation bit in each byte is the low byte, and the high byte is all 0.

8-pixel location format

It is the standard of the palette that can be controlled by software. It maps eight bits into 24 bits.

For running, compatibility, and image quality reasons, Microsoft recommends a default Windows CE color palette.


15 or 16 pixel bit format

It is a blocking format and cannot be colored. 15 or 16-bit pixels are stored every two bytes, 15 pixel bits, wasting the highest bit of each word. Microsoft recommends the following pure red, green, and blue matching:

Color 15-bit (5-5-5rgb) 16-bit (5-6-5rgb)
Red 0x7c00 0xf800
Green 0x3e00 0x07e0
Blue 0x001f 0x001f

Among the 15-bit/pixel match characters, each command contains 15 low bits of pixel data, with no bits of 0.

24-bit/pixel format

It is a true color format. Each pixel stores 8 bits for red, green, and blue. This format has its advantages and disadvantages. The advantage is that the image quality is good because each pixel occupies 3 bytes, they do not waste memory. The disadvantage is that since half of the pixels in the design cross the character boundary, the operation will be affected when the pixels are connected and decoded.

32-bit/pixel format

It is another true color format, which will not make pixels exceed the DWORD boundary, but the memory utilization efficiency is not high, it has two ways to arrange the color channel, one is blue as the weakest byte in each pixel, and the other is red as the weakest byte, corresponding to the PAL-BGR and PAL-RGB pattern, in each pixel, you can extract the following matching channels of red, green, and blue.

Color Pal_rgb mask Pal_bgr mask
Red 0x000000ff 0x00ff0000
Green 0x0000ff00 0x0000ff00
Blue 0x00ff0000 0x000000ff


Windows CE display hardware recommendation

Microsoft recommends 10 display hardware types for Windows CE operating systems, which are proven to be operational and make development of your display driver easier, even if your hardware is not recommended, you can still write a fully functional display, driver, or if it is difficult to change the hardware design at the end of the product design, the cost is to attach effort to the driver and/or reduce operations.

Memory Layout

Microsoft strongly recommends that you use linear frame buffer for hardware display, and you can read and write data to the buffer. All the Display memory should be continuous and suitable. In addition, it should be a linear connection window covering the entire frame buffer, when using hardware not recommended by Microsoft, if you choose to use it, you needGPE classFor more information, see The GPE Department used in this thesis.

Your display hardware should also use the supported pixel format, storage and pixel order combination, detailed information, read this paper,Show cache format. This display hardware frame buffer should have the following properties:

  • From top to bottom, pixels (0, 0) are in the upper left corner, and pixels (width-1, height-1) are in the lower right corner;
  • Frame Buffer. The memory is used to represent the number of bytes of A scanned row in the display. It should be a group of four bytes, or even fill the end of each scanned row with unused bytes;
  • The entire frame buffer must be connectable to the CPU, rather than the CPU running blank selection.
  • Frame Buffer: Bit-planes is not used. Each color channel or darkness of a frame has a separated frame buffer.

Dirty rect Buffer

If you want to use the GPE class to execute the display driver, but your display hardware is not supported by the GPE class (for example, if the frame buffer is non-linear ), then you may consider writing "Dirty rece driver ".

In this mode, The GPE class maintains a device-only Bitmap (DIB) in the memory, which represents the frame buffer. When the dib of the memory is modified, The GPE notifies the dirty rect driver, to copy the dib changed or "dirty" part to the display device for conversion.

Direy rect drivers takes up memory and sacrifices the speed of running. They should only be the final means to support hardware when these hardware cannot meet GPE requirements.

Acceleration

Microsoft recommends that you use the display hardware that can accelerate the following operations, sorted by importance as follows:

  • Solid color fill, especially bit operations, its pb0-isolid color number is not oxfffffff.
  • Srccopy bit operation;
  • Cursor Display, if your platform uses the cursor;
  • Draw solid lines with sub-pixels;
  • Match the srccopy bit operation;
  • Other image operations are performed by Windows CE devices.


Summary

In Windows CE 2.0, the display driver plays a key role in the visual display technology and is consistent with the design strategy mentioned in this article, the display driver and display hardware will allow Windows CE-based devices to take full advantage of the enhanced image display capabilities of the new GDI.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.