The frame buffer drivers depend heavily on four data structures. These structures are declared in include/linux/fb.h. They are fb_info, fb_var_screeninfo, fb_fix_screeninfo and fb_monospecs. The last three can be made available to and from userland.
fb_info defines the current state of a particular video card. Inside fb_info, there exists a fb_ops structure which is a collection of needed functions to make fbdev and fbcon work. fb_info is only visible to the kernel.
fb_var_screeninfo is used to describe the features of a video card that are user defined. With fb_var_screeninfo, things such as depth and the resolution may be defined.
The next structure is fb_fix_screeninfo. This defines the properties of a card that are created when a mode is set and can’t be changed otherwise. A good example of this is the start of the frame buffer memory. This “locks” the address of the frame buffer memory, so that it cannot be changed or moved.
The last structure is fb_monospecs. In the old API, there was little importance for fb_monospecs. This allowed for forbidden things such as setting a mode of 800x600 on a fix frequency monitor. With the new API, fb_monospecs prevents such things, and if used correctly, can prevent a monitor from being cooked. fb_monospecs will not be useful until kernels 2.5.x.
registers a frame buffer device
Parameters
Description
Registers a frame buffer device fb_info.
Returns negative errno on error, or zero for success.
releases a frame buffer device
Parameters
Description
Unregisters a frame buffer device fb_info.
Returns negative errno on error, or zero for success.
This function will also notify the framebuffer console to release the driver.
This is meant to be called within a driver’s module_exit() function. If this is called outside module_exit(), ensure that the driver implements fb_open() and fb_release() to check that no processes are using the device.
low level driver signals suspend
Parameters
Description
This is meant to be used by low level drivers to signal suspend/resume to the core & clients. It must be called with the console semaphore held
deallocate a colormap
Parameters
Description
Deallocates a colormap that was previously allocated with fb_alloc_cmap().
copy a colormap
Parameters
Description
Copy contents of colormap from from to to.
set the colormap
Parameters
Description
Sets the colormap cmap for a screen of device info.
Returns negative errno on error, or zero on success.
get default colormap
Parameters
Description
Gets the default colormap for a specific screen depth. len is the size of the palette for a particular screen depth.
Returns pointer to a frame buffer colormap structure.
invert all defaults colormaps
Parameters
Description
Invert all default colormaps.
test a video mode
Parameters
Description
Tries a video mode to test it’s validity for device info.
Returns 1 on success.
removed videomode entry from modelist
Parameters
NOTES
Will remove all matching mode entries
finds a valid video mode
Parameters
Description
Finds a suitable video mode, starting with the specified mode in mode_option with fallback to default_mode. If default_mode fails, all modes in the video mode database will be tried.
Valid mode specifiers for mode_option:
<xres>x<yres>[M][R][-<bpp>][@<refresh>][i][m] or <name>[-<bpp>][@<refresh>]
with <xres>, <yres>, <bpp> and <refresh> decimal numbers and <name> a string.
If ‘M’ is present after yres (and before refresh/bpp if present), the function will compute the timings using VESA(tm) Coordinated Video Timings (CVT). If ‘R’ is present after ‘M’, will compute with reduced blanking (for flatpanels). If ‘i’ is present, compute interlaced mode. If ‘m’ is present, add margins equal to 1.8% of xres rounded down to 8 pixels, and 1.8% of yres. The char ‘i’ and ‘m’ must be after ‘M’ and ‘R’. Example:
1024x768MR-8**60m** - Reduced blank with margins at 60Hz.
NOTE
to supply values for e.g. the grayscale and accel_flags fields.
Returns zero for failure, 1 if using specified mode_option, 2 if using specified mode_option with an ignored refresh rate, 3 if default mode is used, 4 if fall back to any valid mode.
convert fb_var_screeninfo to fb_videomode
Parameters
convert fb_videomode to fb_var_screeninfo
Parameters
compare 2 videomodes
Parameters
Return
1 if equal, 0 if not
find best matching videomode
Parameters
Return
struct fb_videomode, NULL if none found
IMPORTANT: This function assumes that all modelist entries in info->modelist are valid.
NOTES
Finds best matching videomode which has an equal or greater dimension than var->xres and var->yres. If more than 1 videomode is found, will return the videomode with the highest refresh rate
find closest videomode
Parameters
Description
Finds best matching videomode, smaller or greater in dimension. If more than 1 videomode is found, will return the videomode with the closest refresh rate.
find a videomode which exactly matches the timings in var
Parameters
Return
struct fb_videomode, NULL if none found
adds videomode entry to modelist
Parameters
NOTES
Will only add unmatched mode entries
destroy modelist
Parameters
convert mode array to mode list
Parameters
converts vmode/cmode pair to var structure
Parameters
Description
Converts a MacOS vmode/cmode pair to a frame buffer video mode structure.
Returns negative errno on error, or zero for success.
Convert monitor sense to vmode
Parameters
Description
Converts a Macintosh monitor sense number to a MacOS vmode number.
Returns MacOS vmode video mode number.
find a video mode
Parameters
Description
Finds a suitable video mode. Tries to set mode specified by mode_option. If the name of the wanted mode begins with ‘mac’, the Mac video mode database will be used, otherwise it will fall back to the standard video mode database.
Note
system boot.
Returns error code from fb_find_mode (see fb_find_mode function).
Refer to the file lib/fonts/fonts.c for more information.