Hardware Overlay - Overview

Overview

The use of a hardware overlay is important for several reasons:

  1. in a graphical user interface (GUI) operating system such as Windows, one display-device can typically display multiple applications simultaneously.
  2. consider how a display works without a hardware overlay. When each application draws to the screen, the operating system's graphical subsystem must constantly check to ensure that the objects being drawn appear on the appropriate location on the screen, and that they don't collide with overlapping and neighboring windows. The graphical subsystem must clip objects while they are being drawn when a collision occurs. This constant checking and clipping ensures that different applications can cooperate with one another in sharing a display, but also consumes a significant proportion of computing power.

A computer draws on its display by writing a bitmapped representation of the graphics into a special portion of its memory known as video memory. Without any hardware overlays, only one chunk of video memory exists which all applications must share - and the location of a given application's video memory moves whenever the user changes the position of the application's window. With shared video memory, an application must constantly check that it is only writing to memory that belongs to that application.

When running a high-bandwidth video application such as a movie player or some games, the computing power and complexity needed to perform constant clipping and checking negatively impacts performance and compatibility. To escape these limitations, the hardware overlay was invented. In addition, the graphics processing unit (GPU) provides an efficient way to scale the video in size and often performs color-format conversions (such as MPEG-2's YCbCr into RGB).

An application using a hardware overlay gets a completely separate section of video memory that belongs only to that application. Because nothing else uses it, the program never needs to waste resources in checking whether a given piece of the memory belongs to it, nor does it need to monitor whether the user moves the window and changes the location of the video memory. To get the image from the separate video memory to display in tandem with the remaining shared elements on the display, the graphical subsystem associates a certain attribute (for example, a particular color) as a "mask" for that overlay, which the graphics card understands to mean that it is to draw from the separate overlay buffer onto the screen. (This technique has become known as "chroma key".)

As an example, assume that the graphical subsystem defines the color "purple" as the mask color that triggers the overlay to appear. An application that plays a DVD will draw a solid purple rectangle on the shared screen, and then "play" the DVD into the special region of memory dedicated to the overlay. The graphics card will render the DVD playback only inside the purple area. If another window moves over top of the purple area and obscures a part of it, then the graphics hardware performs the clipping by itself. In practice, the actual color "purple" is not used - rather, either a nondescript near-black color is used (as the system often has thousands of such shades to choose from), or the mask region is denoted using some similar masking method not involving colors.

Read more about this topic:  Hardware Overlay