next up previous

2.4 I/O     continued...

With the fall in memory prices and the rising demand for higher performance, modern systems use a dedicated memory known as a frame buffer for holding bit patterns that control the displays. On inexpensive systems the main processor will compute the patterns and transfer them to the frame buffer. On high performance systems, though, the main processor sends information to the ``graphics engine'', a dedicated processor that performs the computations. For example, if the user wants to draw a rectangle, the CPU can send the coordinates to the graphics processor, and the latter will figure out which pixels lie within the rectangle and turn on the corresponding bits in the frame buffer. Sophisticated graphics processors do all the work required in complex shading, texturing, overlapping of objects (deciding what is visible and what is not), and other operations required in 3D images.

The discussion so far has dealt only with black and white images. Color displays are based on the same principles: a raster scan illuminates regions on a phosphor, with the information that controls the display coming from a frame buffer. However, instead of one gun there are three, one for each primary color. When combining light, the primary colors are red, green, and blue, which is why these displays are known as RGB monitor.gif Since we need to specify whether or not each gun should be on for each pixel, the frame buffer will have at least three bits per pixel. To have a wide variety of colors, though, it is not enough just to turn a gun on or off; we need to control its intensity. For example, a violet color can be formed by painting a pixel with the red gun at 61% of full intensity, green at 24%, and blue at 80%.

Typically a system will divide the range of intensities into 256 discrete values, which means the intensity can be represented by an 8-bit number. 8 bits times 3 guns means 24 bits are required for each pixel. Recall that high resolution displays have 1024 rows of 1280 pixels each, for a total of 1.3 million pixels. Dedicating 24 bits to each pixel would require almost 32MB of RAM for the frame buffer alone. What is done instead is to create a color map with a fixed number of entries, typically 256. Each entry in the color map is a full 24 bits wide. Each pixel only needs to identify a location in the map that contains its color, and since a color map of 256 entries requires only 8 bits per pixel to specify one of the entries there is a savings of 16 bits per pixel. The drawback is that only 256 different colors can be displayed in any one image, but this is enough for all applications except those that need to create highly realistic images.