Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) ===========================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) The Frame Buffer Device API
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) ===========================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) Last revised: June 21, 2011
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) 0. Introduction
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) ---------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) This document describes the frame buffer API used by applications to interact
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) with frame buffer devices. In-kernel APIs between device drivers and the frame
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) buffer core are not described.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) Due to a lack of documentation in the original frame buffer API, drivers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) behaviours differ in subtle (and not so subtle) ways. This document describes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) the recommended API implementation, but applications should be prepared to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) deal with different behaviours.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 1. Capabilities
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) ---------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) Device and driver capabilities are reported in the fixed screen information
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) capabilities field::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)   struct fb_fix_screeninfo {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 	__u16 capabilities;		/* see FB_CAP_*			*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 	...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)   };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) Application should use those capabilities to find out what features they can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) expect from the device and driver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) - FB_CAP_FOURCC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) The driver supports the four character code (FOURCC) based format setting API.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) When supported, formats are configured using a FOURCC instead of manually
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) specifying color components layout.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 2. Types and visuals
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) --------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) Pixels are stored in memory in hardware-dependent formats. Applications need
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) to be aware of the pixel storage format in order to write image data to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) frame buffer memory in the format expected by the hardware.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) Formats are described by frame buffer types and visuals. Some visuals require
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) additional information, which are stored in the variable screen information
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) bits_per_pixel, grayscale, red, green, blue and transp fields.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) Visuals describe how color information is encoded and assembled to create
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) macropixels. Types describe how macropixels are stored in memory. The following
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) types and visuals are supported.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) - FB_TYPE_PACKED_PIXELS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) Macropixels are stored contiguously in a single plane. If the number of bits
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) per macropixel is not a multiple of 8, whether macropixels are padded to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) next multiple of 8 bits or packed together into bytes depends on the visual.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) Padding at end of lines may be present and is then reported through the fixed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) screen information line_length field.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) - FB_TYPE_PLANES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) Macropixels are split across multiple planes. The number of planes is equal to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) the number of bits per macropixel, with plane i'th storing i'th bit from all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) macropixels.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) Planes are located contiguously in memory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) - FB_TYPE_INTERLEAVED_PLANES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) Macropixels are split across multiple planes. The number of planes is equal to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) the number of bits per macropixel, with plane i'th storing i'th bit from all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) macropixels.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) Planes are interleaved in memory. The interleave factor, defined as the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) distance in bytes between the beginning of two consecutive interleaved blocks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) belonging to different planes, is stored in the fixed screen information
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) type_aux field.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) - FB_TYPE_FOURCC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) Macropixels are stored in memory as described by the format FOURCC identifier
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) stored in the variable screen information grayscale field.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) - FB_VISUAL_MONO01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) Pixels are black or white and stored on a number of bits (typically one)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) specified by the variable screen information bpp field.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) Black pixels are represented by all bits set to 1 and white pixels by all bits
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) set to 0. When the number of bits per pixel is smaller than 8, several pixels
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) are packed together in a byte.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) FB_VISUAL_MONO01 is currently used with FB_TYPE_PACKED_PIXELS only.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) - FB_VISUAL_MONO10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) Pixels are black or white and stored on a number of bits (typically one)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) specified by the variable screen information bpp field.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) Black pixels are represented by all bits set to 0 and white pixels by all bits
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) set to 1. When the number of bits per pixel is smaller than 8, several pixels
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) are packed together in a byte.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) FB_VISUAL_MONO01 is currently used with FB_TYPE_PACKED_PIXELS only.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) - FB_VISUAL_TRUECOLOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) Pixels are broken into red, green and blue components, and each component
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) indexes a read-only lookup table for the corresponding value. Lookup tables
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) are device-dependent, and provide linear or non-linear ramps.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) Each component is stored in a macropixel according to the variable screen
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) information red, green, blue and transp fields.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) - FB_VISUAL_PSEUDOCOLOR and FB_VISUAL_STATIC_PSEUDOCOLOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) Pixel values are encoded as indices into a colormap that stores red, green and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) blue components. The colormap is read-only for FB_VISUAL_STATIC_PSEUDOCOLOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) and read-write for FB_VISUAL_PSEUDOCOLOR.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) Each pixel value is stored in the number of bits reported by the variable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) screen information bits_per_pixel field.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) - FB_VISUAL_DIRECTCOLOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) Pixels are broken into red, green and blue components, and each component
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) indexes a programmable lookup table for the corresponding value.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) Each component is stored in a macropixel according to the variable screen
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) information red, green, blue and transp fields.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) - FB_VISUAL_FOURCC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) Pixels are encoded and  interpreted as described by the format FOURCC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) identifier stored in the variable screen information grayscale field.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 3. Screen information
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) ---------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) Screen information are queried by applications using the FBIOGET_FSCREENINFO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) and FBIOGET_VSCREENINFO ioctls. Those ioctls take a pointer to a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) fb_fix_screeninfo and fb_var_screeninfo structure respectively.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) struct fb_fix_screeninfo stores device independent unchangeable information
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) about the frame buffer device and the current format. Those information can't
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) be directly modified by applications, but can be changed by the driver when an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) application modifies the format::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)   struct fb_fix_screeninfo {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	char id[16];			/* identification string eg "TT Builtin" */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	unsigned long smem_start;	/* Start of frame buffer mem */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 					/* (physical address) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	__u32 smem_len;			/* Length of frame buffer mem */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	__u32 type;			/* see FB_TYPE_*		*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	__u32 type_aux;			/* Interleave for interleaved Planes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	__u32 visual;			/* see FB_VISUAL_*		*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	__u16 xpanstep;			/* zero if no hardware panning  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	__u16 ypanstep;			/* zero if no hardware panning  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	__u16 ywrapstep;		/* zero if no hardware ywrap    */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	__u32 line_length;		/* length of a line in bytes    */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	unsigned long mmio_start;	/* Start of Memory Mapped I/O   */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 					/* (physical address) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	__u32 mmio_len;			/* Length of Memory Mapped I/O  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	__u32 accel;			/* Indicate to driver which	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 					/*  specific chip/card we have	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	__u16 capabilities;		/* see FB_CAP_*			*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	__u16 reserved[2];		/* Reserved for future compatibility */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)   };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) struct fb_var_screeninfo stores device independent changeable information
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) about a frame buffer device, its current format and video mode, as well as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) other miscellaneous parameters::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)   struct fb_var_screeninfo {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	__u32 xres;			/* visible resolution		*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	__u32 yres;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	__u32 xres_virtual;		/* virtual resolution		*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	__u32 yres_virtual;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	__u32 xoffset;			/* offset from virtual to visible */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	__u32 yoffset;			/* resolution			*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	__u32 bits_per_pixel;		/* guess what			*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	__u32 grayscale;		/* 0 = color, 1 = grayscale,	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 					/* >1 = FOURCC			*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	struct fb_bitfield red;		/* bitfield in fb mem if true color, */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	struct fb_bitfield green;	/* else only length is significant */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	struct fb_bitfield blue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	struct fb_bitfield transp;	/* transparency			*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	__u32 nonstd;			/* != 0 Non standard pixel format */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	__u32 activate;			/* see FB_ACTIVATE_*		*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	__u32 height;			/* height of picture in mm    */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	__u32 width;			/* width of picture in mm     */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	__u32 accel_flags;		/* (OBSOLETE) see fb_info.flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	/* Timing: All values in pixclocks, except pixclock (of course) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	__u32 pixclock;			/* pixel clock in ps (pico seconds) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	__u32 left_margin;		/* time from sync to picture	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	__u32 right_margin;		/* time from picture to sync	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	__u32 upper_margin;		/* time from sync to picture	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	__u32 lower_margin;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	__u32 hsync_len;		/* length of horizontal sync	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	__u32 vsync_len;		/* length of vertical sync	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	__u32 sync;			/* see FB_SYNC_*		*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	__u32 vmode;			/* see FB_VMODE_*		*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	__u32 rotate;			/* angle we rotate counter clockwise */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	__u32 colorspace;		/* colorspace for FOURCC-based modes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	__u32 reserved[4];		/* Reserved for future compatibility */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220)   };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) To modify variable information, applications call the FBIOPUT_VSCREENINFO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) ioctl with a pointer to a fb_var_screeninfo structure. If the call is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) successful, the driver will update the fixed screen information accordingly.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) Instead of filling the complete fb_var_screeninfo structure manually,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) applications should call the FBIOGET_VSCREENINFO ioctl and modify only the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) fields they care about.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 4. Format configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) -----------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) Frame buffer devices offer two ways to configure the frame buffer format: the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) legacy API and the FOURCC-based API.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) The legacy API has been the only frame buffer format configuration API for a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) long time and is thus widely used by application. It is the recommended API
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) for applications when using RGB and grayscale formats, as well as legacy
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) non-standard formats.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) To select a format, applications set the fb_var_screeninfo bits_per_pixel field
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) to the desired frame buffer depth. Values up to 8 will usually map to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) monochrome, grayscale or pseudocolor visuals, although this is not required.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) - For grayscale formats, applications set the grayscale field to one. The red,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248)   blue, green and transp fields must be set to 0 by applications and ignored by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)   drivers. Drivers must fill the red, blue and green offsets to 0 and lengths
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250)   to the bits_per_pixel value.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) - For pseudocolor formats, applications set the grayscale field to zero. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253)   red, blue, green and transp fields must be set to 0 by applications and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254)   ignored by drivers. Drivers must fill the red, blue and green offsets to 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255)   and lengths to the bits_per_pixel value.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) - For truecolor and directcolor formats, applications set the grayscale field
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)   to zero, and the red, blue, green and transp fields to describe the layout of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259)   color components in memory::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261)     struct fb_bitfield {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 	__u32 offset;			/* beginning of bitfield	*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 	__u32 length;			/* length of bitfield		*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 	__u32 msb_right;		/* != 0 : Most significant bit is */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 					/* right */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266)     };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268)   Pixel values are bits_per_pixel wide and are split in non-overlapping red,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269)   green, blue and alpha (transparency) components. Location and size of each
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270)   component in the pixel value are described by the fb_bitfield offset and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271)   length fields. Offset are computed from the right.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273)   Pixels are always stored in an integer number of bytes. If the number of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274)   bits per pixel is not a multiple of 8, pixel values are padded to the next
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275)   multiple of 8 bits.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) Upon successful format configuration, drivers update the fb_fix_screeninfo
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) type, visual and line_length fields depending on the selected format.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) The FOURCC-based API replaces format descriptions by four character codes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) (FOURCC). FOURCCs are abstract identifiers that uniquely define a format
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) without explicitly describing it. This is the only API that supports YUV
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) formats. Drivers are also encouraged to implement the FOURCC-based API for RGB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) and grayscale formats.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) Drivers that support the FOURCC-based API report this capability by setting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) the FB_CAP_FOURCC bit in the fb_fix_screeninfo capabilities field.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) FOURCC definitions are located in the linux/videodev2.h header. However, and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) despite starting with the V4L2_PIX_FMT_prefix, they are not restricted to V4L2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) and don't require usage of the V4L2 subsystem. FOURCC documentation is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) available in Documentation/userspace-api/media/v4l/pixfmt.rst.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) To select a format, applications set the grayscale field to the desired FOURCC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) For YUV formats, they should also select the appropriate colorspace by setting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) the colorspace field to one of the colorspaces listed in linux/videodev2.h and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) documented in Documentation/userspace-api/media/v4l/colorspaces.rst.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) The red, green, blue and transp fields are not used with the FOURCC-based API.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) For forward compatibility reasons applications must zero those fields, and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) drivers must ignore them. Values other than 0 may get a meaning in future
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) extensions.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) Upon successful format configuration, drivers update the fb_fix_screeninfo
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) type, visual and line_length fields depending on the selected format. The type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) and visual fields are set to FB_TYPE_FOURCC and FB_VISUAL_FOURCC respectively.