In
computing
Computing is any goal-oriented activity requiring, benefiting from, or creating computer, computing machinery. It includes the study and experimentation of algorithmic processes, and the development of both computer hardware, hardware and softw ...
, hardware overlay, a type of
video overlay, provides a method of rendering an image to a display screen with a dedicated memory buffer inside computer
video hardware. The technique aims to improve the display of a fast-moving video
image
An image or picture is a visual representation. An image can be Two-dimensional space, two-dimensional, such as a drawing, painting, or photograph, or Three-dimensional space, three-dimensional, such as a carving or sculpture. Images may be di ...
— such as a
computer game, a
DVD, or the signal from a
TV card. Most
video cards manufactured since about 1998 and most
media players support hardware overlay.
The overlay is a dedicated buffer into which one app can render (typically video), without incurring the significant performance cost of checking for
clipping and overlapping rendering by other apps. The framebuffer has hardware support for importing and rendering the buffer contents without going through the GPU.
Overview
The use of a hardware overlay is important for several reasons:
# In a
graphical user interface
A graphical user interface, or GUI, is a form of user interface that allows user (computing), users to human–computer interaction, interact with electronic devices through Graphics, graphical icon (computing), icons and visual indicators such ...
(GUI)
operating system
An operating system (OS) is system software that manages computer hardware and software resources, and provides common daemon (computing), services for computer programs.
Time-sharing operating systems scheduler (computing), schedule tasks for ...
such as
Windows
Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
, one display-device can typically display multiple applications simultaneously.
# 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. A hardware overlay escapes these limitations. 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
YCbCr, Y′CbCr, also written as YCBCR or Y′CBCR, is a family of color spaces used as a part of the color image pipeline in digital video and digital photography, photography systems. Like YPbPr, YPBPR, it is based on RGB primaries; the two ...
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
Chroma key compositing, or chroma keying, is a Visual effects, visual-effects and post-production technique for compositing (layering) two or more images or video streams together based on colour hues (colorfulness, chroma range). The techniq ...
".)
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.
Screen shots
As a consequence of hardware overlay use, a
screenshot program (for example, the one automatically built into Windows that activates when a user presses the PrtSc key) often does not capture the content appearing in the hardware overlay window. Rather, a blank region containing only the special mask color is captured. This is because the screen capture routine doesn't consider the special video memory regions dedicated to overlays – it simply captures the shared main screen as rendered by the software's graphical subsystem.
Secondary displays
Many graphics cards can support more than one monitor and/or a TV screen as output devices. Typically one of these output devices has to be declared the "primary" device, and only the primary device can display hardware overlays. There are exceptions: Intel writes in the FAQ for their Embedded Graphics Drivers that the overlay can be attached to either one of the displays but not to both (note: the Intel 945, G33-Q965 chipsets have dual hardware overlay, and are capable of good quality mpeg2 on secondary monitors when appropriate software is installed), and some newer Matrox graphics card support overlay on both displays (for example, the Parhelia Series).
Secondary displays require both hardware and driver support; some graphics cards may support overlay on the second display while their drivers may not yet support it (note: graphics chipset driver bugs can cause most video formats apart from mpeg2 to work on both monitors, and mpeg2 only on the primary with most players).
Some users note that DVD movies display properly on a laptop screen but don't display on a TV connected to the laptop; in these cases it may be possible to designate the TV as the primary display. Sometimes, the use of hardware overlays may have to be disabled in the media player. However, some graphics cards have the option to completely redirect hardware overlay to the TV screen. In this case, starting a DVD player on the main screen with overlay enabled would result in video being displayed on the attached TV screen.
Implementations in various operating systems
Windows Vista
Windows Vista is a major release of the Windows NT operating system developed by Microsoft. It was the direct successor to Windows XP, released five years earlier, which was then the longest time span between successive releases of Microsoft W ...
's enhanced graphics capabilities replace the basic concept of hardware overlays with full hardware
compositing for every application window running on the system, not just movie players or games, through the
Desktop Window Manager.
Mac OS X
macOS, previously OS X and originally Mac OS X, is a Unix, Unix-based operating system developed and marketed by Apple Inc., Apple since 2001. It is the current operating system for Apple's Mac (computer), Mac computers. With ...
has used hardware compositing since the introduction of
Quartz Extreme into
Mac OS X 10.2. To improve performance, each program draws to its own independent memory buffer instead of to a slow graphical subsystem. (In Windows Vista, each hardware overlay is more correctly known as a Direct3D surface). Then the system's
GPU assembles each of the windows into a single display screen in real time. With modern GPUs capable of advanced 3D graphics (as a consequence of the video game industry), operating systems can apply computationally intensive motion, scaling, and lighting effects to normal 2D windows.
Due to a need to reduce power consumption,
Windows 7
Windows 7 is a major release of the Windows NT operating system developed by Microsoft. It was Software release life cycle#Release to manufacturing (RTM), released to manufacturing on July 22, 2009, and became generally available on October 22, ...
added back limited support for overlays, and
Windows 8.1 added support for multi-plane overlays.
Multi-plane overlays allow the
Desktop Window Manager to automatically render portions of the desktop into overlays, saving power in more circumstances.
In the
X Window System
The X Window System (X11, or simply X) is a windowing system for bitmap displays, common on Unix-like operating systems.
X originated as part of Project Athena at Massachusetts Institute of Technology (MIT) in 1984. The X protocol has been at ...
, the windowing system of most
Unix
Unix (, ; trademarked as UNIX) is a family of multitasking, multi-user computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, a ...
operating systems, the
XVideo extension can allow applications to employ hardware overlays. Compositing is also used, with
compiz
Compiz () is a compositing window manager for the X Window System, using 3D graphics hardware to create fast compositing desktop effects for window management. Effects, such as a minimization animation or a cube workspace, are implemented as loa ...
and
Beryl
Beryl ( ) is a mineral composed of beryllium aluminium Silicate minerals#Cyclosilicates, silicate with the chemical formula Be3Al2(SiO3)6. Well-known varieties of beryl include emerald and Aquamarine (gem), aquamarine. Naturally occurring Hex ...
compositing window manager
A compositing manager, or compositor, is software that provides applications with an off-screen data buffer, buffer for each window, then Compositing, composites these window buffers into an image representing the screen and writes the result into ...
s being the most prominent examples since 2006. They are able to take advantage of
OpenGL
OpenGL (Open Graphics Library) is a Language-independent specification, cross-language, cross-platform application programming interface (API) for rendering 2D computer graphics, 2D and 3D computer graphics, 3D vector graphics. The API is typic ...
(through glx extension) for 3D and 2D overlay visual effects. Other implementations like
Metacity and
xfwm have been available since 2004.
Some dedicated hardware overlay devices use embedded
Linux
Linux ( ) is a family of open source Unix-like operating systems based on the Linux kernel, an kernel (operating system), operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically package manager, pac ...
as an operating system, for example the video logge
by Racelogic uses a
Texas Instruments DM355 micro-controller to blend a
frame buffer containing graphics onto a live video feed, and then store the result in
MPEG-4 format on a flash card.
Overlay support aka Picture In Picture (PIP) was introduced to
AmigaOS
AmigaOS is a family of proprietary native operating systems of the Amiga and AmigaOne personal computers. It was developed first by Commodore International and introduced with the launch of the first Amiga, the Amiga 1000, in 1985. Early versions ...
with the introduction of the PC graphic cards, Picasso96 and
CyberGraphX graphic driver systems aka
ReTargetable Graphics, for Picasso IV and
Voodoo3 cards, picasso’96 driver system became standard in AmigaOS 3.5. Moovid was one of the first video players that supported hardware overlay (PIP) on
AmigaOS
AmigaOS is a family of proprietary native operating systems of the Amiga and AmigaOne personal computers. It was developed first by Commodore International and introduced with the launch of the first Amiga, the Amiga 1000, in 1985. Early versions ...
.
References
{{reflist
Graphics hardware