Framebuffer

The frame buffer or video memory ( engl. frame - frame, buffer - buffer) is part of the video RAM of computers and corresponds to a digital copy of the screen image. That is, each display pixel may be just a specific region of the frame buffer to be allocated includes the translated digital color value. Since the 1990s, the framebuffer is mainly on the graphics card.

Memory Requirements

The size of the frame buffer depends on two factors: the color depth used (more precisely, pixel format ) and the image resolution used.

Color depth

The color depth of your framebuffer defines the maximum number of displayed simultaneously on the screen colors or shades. In the IBM - PC compatible computers were and are indicated in the following table sizes common. The pixel formats specified specify how many bits per pixel in each color channel is assigned (red, green, blue, alpha channel) - with color modes that use indexed colors ( palettes ), if not specified, because it makes no sense.

  • CGA palette with 4 colors of 16 possible
  • EGA: palette of 16 colors from the 64 possible
  • VGA: 256 color palette from 262144 possible
  • Real Color: 5-5-5 pixel format, ie 5 bits per color channel (ie 32 intensity tones per channel)
  • High Color: 5-6-5 pixel format, ie 5 bits for red and blue (32 intensity gradations ) and 6 bits for green ( 64 intensity gradations )
  • Alternatively, 4-4-4-4, ie 4 bits per color channel (16 intensity gradations ), the last four bits are either unused or used as an alpha channel (see 32-bit True Color )
  • True Color: 8-8-8 pixel format, ie 8 bits per color channel ( 256 intensity gradations )
  • True Color: Pixel format 8-8-8-8, ie 8 bits per color channel ( 256 intensity gradations )
  • The opposite 24-bit True Color -added 8 bits are not normally used; on computers with 32 -bit architecture, the processing of 32 -bit values ​​is more efficient than the 24 -bit values ​​, because this corresponds exactly to the word length of the processor, which is why, despite the 33 % higher memory requirements TrueColor framebuffer mostly use 32 -bit color depth.

For graphics hardware that works with bitplanes ( eg Amiga), are for indexed colors and 3, 5, 6 and 7 bits per pixel with accordingly 8, 32, 64 or 128 colors common.

In 3D computer graphics and framebuffer with higher accuracy are used. There determining the color of a pixel often requires more computational steps, and at each intermediate result and rounding errors may occur, which are quickly visible with conventional framebuffer formats and distracting.

In these formats closer to interpret the color channel values ​​as point values ​​on a scale of 0.0 to 1.0, so when using multiple pixel formats to simplify handling.

  • FX8 per color channel 8 bit fixed point, thus scaled 256 color gradations linear
  • Identical to above 32 bits per pixel. Whether one conceives the 256 different values ​​per color channel as an integer between 0 and 255 or as a fixed-point value between 0.0 and 1.0 (), is merely a matter of interpretation.
  • Maximum contrast 255:1, making it suitable for low dynamic range ( LDR) rendering, as it can display ordinary screens of all kinds
  • Per color channel 12-bit fixed-point, thus scaled 4096 color gradations linear
  • Higher accuracy than FX8
  • Maximum contrast 4095:1, suitable for Low Dynamic Range ( LDR) rendering
  • Per color channel 16-bit fixed-point, thus scales linearly 65536 color gradations
  • Higher accuracy than FX12
  • Maximum contrast 65535:1, suitable for medium dynamic range ( MDR) rendering
  • 16-bit floating point per color channel (including 5 bit exponent and 10 bit mantissa), thus 32768 gradations of color scales exponentially
  • The exponential scale allowed compared to FX16 a much finer resolution at low values ​​, with higher values ​​but it is less precise.
  • Maximum contrast approx, suitable for High Dynamic Range ( HDR) rendering.
  • (including 7 bit exponent and 16 bit mantissa), thus more than 8 million gradations of color scales exponentially per color channel 24-bit floating point
  • Higher accuracy than FP16, therefore very suitable for HDR rendering
  • 32 bit floating point ( of which 8 bit exponent and 23 bit mantissa ), thus more than 2 billion shades of color scales exponentially per color channel
  • Even higher accuracy than FP24

Resolution

The resolution indicates how many pixels of the framebuffer is. Usually, this is the horizontal and vertical pixel count on, so you can calculate the aspect ratio directly, usual here 4:3, 5:4 and 16:10.

Typical framebuffer resolution:

  • 320 × 200: 64,000 pixels, Aspect Ratio 16:10
  • 640 × 200: 128,000 pixels, Aspect ratio 32:10 ( at conventional 4:3 screens usually displayed as anamorphic 16:10)
  • 640 × 480: 307,200 pixels, 4:3 aspect ratio
  • 800 × 600: 480,000 pixels, 4:3 aspect ratio
  • 1024 × 768: 786,432 pixels, 4:3 aspect ratio
  • 1280 × 1024: 1.31 million pixels, Aspect Ratio 5:4
  • 1440 x 900: 1.3 million pixels, a 16:10 aspect ratio
  • 1680 × 1050: 1.76 million pixels, a 16:10 aspect ratio
  • 1600 × 1200: 1.92 million pixels, 4:3 aspect ratio
  • 1920 x 1200: 2.3 million pixels, a 16:10 aspect ratio
  • 2048 × 1536: 3.15 million pixels, 4:3 aspect ratio
  • 2560 × 1600: 4.10 million pixels, a 16:10 aspect ratio

Examples

  • Text mode (eg during startup of an IBM - compatible PC ) In a 80 × 25 characters large console, with each character and its color with 8 bits each (ie a total of 16 bits) is stored, is the frame buffer 80 × 25 × 16 = 32000 bits = 4 KB.
  • Graphics mode (eg, Microsoft Windows or the X Window System on Linux) With a screen resolution of 1024 × 768 pixels and a color depth of 24 bits of the frame buffer is 1024 × 768 × 24 = 18,874,368 bits = 2.25 MB.

The overview was taken into account in the case of true color, that data is stored internally with 24 bits.

Improvements

Due to shortcomings in the continuity of the image sequence, and to further increase the overall quality of representation, the concept of the framebuffer has been revised over time. For example, one framebuffer on current systems, several buffers.

  • When double buffering ( double buffering ) the framebuffer is divided into two sections ( front buffer and back buffer ).
  • In the triple buffering (triple buffering ) of the framebuffer into three areas ( one front buffer and back buffer 2 ) is divided.

Linux framebuffer

The Linux framebuffer device (short fbdev ) is a hardware-independent abstraction layer in Linux to display graphics on the console or X window ( xf86_fbdev ). Here, the framebuffer device does not rely on on -system-specific libraries such as the SVGALib or the X Window System, and is thus a resource- saving alternative to the more common X server, based on the date, most graphical interfaces for Linux. It is included in the Linux kernel version 2.1.107 for all platforms in the standard kernel.

It was originally implemented for Linux/m68k to emulate on according systems (Amiga, Atari, Macintosh) with a small hardware acceleration a text console and was later extended to the IBM PC - compatible platform.

Nowadays the framebuffer directly by other programs such as MPlayer and libraries, as GGI, SDL, GTK and Qt Extended can be used. The resource-saving concept makes use of particularly interesting for embedded systems.

In particular, it is of different distributions (Ubuntu, openSUSE ) used to even allow a graphical output during bootstrapping in the form of a splash screen.

The most commonly used VESA framebuffer driver ( vesafb ) is based on uniform specifications of video standards and thus allows access to graphics cards for the most part, regardless of manufacturer. This would then also an open-source implementation is possible. In addition, several of the graphics chip manufacturers (Nvidia: rivafb, nvidiafb; AMD: radeonfb ) were proprietary drivers on the market.

The framebuffer device by the way, while the Linux kernel loading process has been known to show the user a Tux logo. For this purpose, however, it must first be included in the kernel and the next reboot by the boot loader, which loads the operating system into memory, are activated by specifying the parameter video.

The following two examples are shown by an AMD driver with an image resolution of 1024 × 768 pixels at a color depth of 8 bits per pixel and a refresh rate of 76 Hz is loaded:

# LILO configuration file boot = / dev/sda1 # Linux bootable partition config begins image = / vmlinuz append = " video = atyfb: 1024x768 -8 @ 76, font: SUN8x16 " Sample GRUB configuration file # GRUB configuration file # For booting Linux title Linux kernel (hd0, 0) / vmlinuz video = atyfb: 1024x768 -8 @ 76, font: SUN8x16 root = / dev/hda1 A kernel module does not have to be written for one hardware access to the framebuffer device. Furthermore, the application has the ability in user mode through the device file / dev / fb * access to the device and write to video memory. The following example demonstrates how can be written in the linear frame buffer with the C programming language. Here is the hexadecimal value 0x000000FF (binary: 0b00000000000000000000000011111111 ) is set for each pixel:

# include # include # include # include file # include # include # include # include   int main (int argc, char ** argv ) {     int row, col, width, height, bitspp, bytespp;     unsigned int * data;       / / Open the device     int fd = open ( " / dev/fb0 ", O_RDWR );       Catch / / Information about the framebuffer     struct fb_var_screeninfo screeninfo;     ioctl ( fd, FBIOGET_VSCREENINFO, & screeninfo );       / / Quit if the color resolution does not correspond to 32 bits per pixel     bitspp = screeninfo.bits_per_pixel;     if ( bitspp! = 32 ) {       / / Output the error message       printf (" Farbaufloesung =% i bits per pixel \ n", bitspp );       printf ( "Please Change the color depth to 32 bits per pixel \ n");       close ( fd);       return 1; / / For the program termination we give a return type! = 0.     }       width = screeninfo.xres;     height = screeninfo.yres;     bytespp = bitspp / 8; / / Calculate bytes per pixel       / / Check if the type unsigned int the same byte size has as one pixel.     / / In our case, 4 bytes (32 bits ) if not, the program is terminated     if ( sizeof (unsigned int)! = bytespp ) {        close ( fd);        return 1;     }       Request / / pointer to the frame buffer memory     data = (unsigned int * ) mmap (0, width * height * bytespp, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);       / / Write to the framebuffer memory. Here, pixel by pixel is on     / / The color 0x000000FF ( Blue ) by default because a pixel has the AARRGGBB format     for ( row = 0; row < height; row )       for ( col = 0; col < width; col )          data [ row * width col] = 0xFF;       / Release / pointer again     munmap (data, width * height * bytespp );       / / Close the device     close ( fd);     / / Return Value     return 0; } see also

  • DirectFB, Direct framebuffer, one built on top of the Linux framebuffer library program
  • Computer Graphics
  • Memory module
124677
de