Double buffering

from Wikipedia, the free encyclopedia

Double buffering (English double buffering ) describes a concept in computer technology in which a data buffer, which will be described simultaneously and read is performed twice, in order to avoid mutual interference.

How it works in hard disk technology

With one rotation of the hard disk, the entire data track is written to the buffer memory at once. While the content of this buffer memory is being transferred to the main memory, the other buffer can in turn be filled with data from the hard disk. If there was only one buffer and its contents were transferred to main memory at the same time, the data would be inconsistent. Double buffering is therefore functionally relevant here.

Functionality for the image output

The frame buffer of the video RAM of a graphics card is divided into two areas. The aim of the process is to ensure a continuous frame rate without flickering.

Before double buffering was introduced, the framebuffer was not divided. Image calculation and monitor output took place in parallel. The frame rate fluctuated depending on the complexity of the scene and the image flickered. This occurs if the same frame buffer is still being written to during output.

The frame buffer of the graphics card memory is divided into front and back buffers. While the front buffer is read out by the RAMDAC and displayed on the screen, the GPU calculates the next image in the back buffer. After completion of this calculation, the execution of the swap command - that is, the exchange of the memory addresses of the front and back buffers ( page flip ) - depends on VSync.

  • If VSync is deactivated , the exchange is carried out immediately, regardless of how far the RAMDAC is with the image display from the front buffer. However, the image build-up does not start from the beginning - it continues at the point where it left off before the buffer exchange. As a result, an image displayed on the monitor is partially composed of several successive partial images. This effect is called tearing .
  • If VSync is activated, the interchanging is waited until the RAMDAC has finished displaying the current image from the front buffer. This is indicated with the VSync signal. In the meantime, no new image calculation can take place because the results cannot be stored in any free buffer. This artificially reduces the performance of the graphics card. This problem is in the triple buffering ( triple buffering compensated by introduction of a further back buffer).

After executing the swap command (swapping the front and back buffers) the whole cycle starts all over again.

Advantages and disadvantages of double buffering

advantages

  • Fluid and judder-free image structure
  • Lower latency than triple or quadruple buffering

disadvantage

  • Deactivating VSync leads to tearing , especially if the refresh rate of the monitor is low but the graphics card achieves a high frame rate
  • Activated VSync sometimes leads to a high loss of performance
  • Double frame buffer size compared to single buffering

Use in Microsoft Windows

When in Microsoft Windows from Vista , the Windows Aero skin was selected, which uses desktop window manager by default double buffering to prevent tearing.

Change buffer technology

In other areas (especially in real-time applications) double buffering is referred to as alternating buffer technology. A change buffer corresponds to a ring buffer with two places ( producer-consumer problem ).

Individual evidence

  1. The Windows Aero feature uses double buffering for drawing on the screen.
  2. http://blogs.msdn.com/b/greg_schechter/archive/2006/03/19/555087.aspx The DWM avoids window tearing during refresh