aboutsummaryrefslogtreecommitdiff
path: root/vgasrc/vgafb.c
AgeCommit message (Collapse)AuthorFilesLines
2019-03-14vga: make memcpy_high() publicGerd Hoffmann1-2/+1
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2016-08-05vgautil: Add new header file with misc function and variable definitionsKevin O'Connor1-1/+2
Move the generic function and variable definitions from vgabios.h to a new file vgautil.h. This reduces the size and complexity of vgabios.h. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-08-04vgafb: Move header definitions from vgabios.h to new file vgafb.hKevin O'Connor1-0/+1
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-08-04swcursor: Concentrate swcursor logic in swcursor.cKevin O'Connor1-5/+0
The software cursor code is not frequently used (only the coreboot framebuffer vga code uses it). Move its logic out of the main code and into swcursor.c. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-08-04swcursor: Move swcursor code from vgafb.c to new file swcursor.cKevin O'Connor1-57/+0
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-07-21vgabios: Simplify scroll logicKevin O'Connor1-22/+48
Introduce a new function vgafb_scroll() to scroll a window on the screen and update vgabios.c to use only that function for scrolling. This makes the low-level vgafb_move_chars() and vgafb_clear_chars() local to vgafb.c, and it simplifies the callers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-07-04vgabios: Don't check for special case of page==0xff on external callsKevin O'Connor1-1/+1
The original "lgpl vgabios" internally used page=0xff as a mechanism for specifying the current page. It also would allow int1013 calls to externally specify bh==0xff for the current page. However, there is no documentation supporting this as an externally available feature. SeaVGABIOS does not need the internal shortcut; this patch removes the code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-08-04vgafb: Minor - move gfx_common() variables outside of switch statementKevin O'Connor1-12/+5
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-01-07vgabios: Support emulated text in gfx_read_char()Kevin O'Connor1-6/+19
When emulating text mode on "coreboot framebuffer" SeaVGABIOS, return a foreground and background attribute from gfx_read_char() and prefer returning a space character (instead of null) on blank cells. This also returns the foreground color (instead of always returning zero) for regular graphics mode gfx_read_char() calls. This seems fine as tests show other vgabios implementations also return various values here. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-01-06vgabios: implement read char in graphics modePaolo Bonzini1-12/+41
GWBasic relies on this, so implement it to enable some serious retrocomputing. There is no better way to do it than trying to match all characters one by one against the current font. This makes it possible to actually do something in SCREEN 1 and SCREEN 2 (without it, you can use graphics in the programs but not in direct mode). I couldn't find documentation for what to return as the attribute, but experimenting with DOSBox suggests 0 (and GWBasic accepts it). Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-11-12vgabios: Add software cursor capabilityKevin O'Connor1-0/+63
Add mechanism for drawing a cursor to the framebuffer to implement a cursor in software. The timer interrupt is "hooked" so that the cursor can blink. This can be useful for "coreboot native vga". Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-11-12vgabios: Support emulating text mode attributes while in graphics modeKevin O'Connor1-3/+23
Add support for simple text mode attribute emulation while in graphics mode. This improves text highlighting and background color on some boot-loaders. Enable it only for CBVGA vgabios and only when a text mode is requested. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-10-27vgabios: Add support for reading framebuffer in "direct" modeKevin O'Connor1-5/+32
Support reading high memory "direct" framebuffers and translating the results to 8 bit attribute values. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-10-27vgabios: Don't pass vmode_g to vgafb_move_chars() / vgafb_clear_chars()Kevin O'Connor1-2/+10
Now that a pointer to the current video mode info struct is cached in memory, it's not necessary to pass the struct into the vgafb code. The vgafb code can lookup the struct itself. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-04-11vgabios: Initial support for coreboot native vga vgabios.Kevin O'Connor1-2/+2
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-04-11vgabios: Add support for manipulating framebuffers in high memory.Kevin O'Connor1-0/+111
Add code for manipulating "direct" style linear RGB framebuffers that may be in high memory. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-04-11vgabios: Introduce text_address().Kevin O'Connor1-28/+19
Factor out code that calculates the text mode address of a given character. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-04-11vgabios: Rewrite vgafb.c graphics operations to set of 4 standard operators.Kevin O'Connor1-363/+284
The vgabios graphics manipulations can all be implemented on top of 4 basic primitives: read 8 pixels, write 8 pixels, move pixels, and clear pixels. Implement these four operators for all the graphics modes and rewrite the graphics functions in vgafb.c to use them. This simplifies the graphics code as the high level logic no longer needs to be implemented for each graphical framebuffer type. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-04-11vgabios: Split vgafb_scroll() into separate move and clear functions.Kevin O'Connor1-109/+122
Rewrite the low-level scroll code so that it is implemented using two basic operations: move text and clear text. This simplifies the low-level code as it no longer needs to handle up scrolling vs down scrolling. Determining the direction of the scroll is now done in the higher level (vgabios.c) code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-04-11vgabios: Add option to control use of standard VGA IO ports.Kevin O'Connor1-0/+8
Add option CONFIG_VGA_STDVGA_PORTS. When this option is disabled, the main BIOS code will not attempt to access any of the legacy VGA IO ports. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-12-04vgabios: Support custom fonts in vga framebuffer text writing.Kevin O'Connor1-54/+67
Obtain the font data from int 0x43 and int 0x1f, and obtain the font height from the BDA. This enables application overrides for the font data. This patch also unifies the variable naming between the planar/CGA/linear character writing functions and uses the same names that the screen scrolling functions use. This patch also optimizes the inner loop of the CGA font writing to reduce overall stack usage. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-09-18Move function definitions for output.c from util.h to new file output.h.Kevin O'Connor1-2/+2
Also, sort the order of include files in the c files. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-09-18Rename util.c to string.c and introduce string.h.Kevin O'Connor1-1/+2
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-09-02Use cpu_to_be32() (and related) instead of htonl (and related).Kevin O'Connor1-1/+2
Unify the syntax for byte swab calls. This also fixes a bug in coreboot due to the lack of a be64_to_cpu() call. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-04-14Misc compile fixes for gcc v3.4.rel-1.7.0Kevin O'Connor1-0/+6
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-02-02vgabios: Fix screen attrs on cga scroll.Kevin O'Connor1-0/+4
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-02-02vgabios: Simplify cga/packed character screen writing.Kevin O'Connor1-37/+17
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-02-01vgabios: Move stdvga_set_mode() to stdvgamodes.c.Kevin O'Connor1-0/+1
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-01-21vgabios: Extract out current mode finding into new function.Kevin O'Connor1-6/+5
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-01-19vgabios: Simplify planar4 vgafb code.Kevin O'Connor1-49/+44
Don't bother programming the vga registers to manipulate the framebuffer when in planar4 mode. Instead, just switch between the four planes and do the manipulation with regular reads and writes. This makes the code simpler to understand (the vga hardware manipulations are arcane and complex). Note, this could make text scrolling in planar4 mode slower and more likely to result in tearing. However, it's unlikely anything important uses the vgabios in planar4 mode. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-01-14vgabios: Extract out common parts of struct vgamode_s.Kevin O'Connor1-6/+6
Extract out the fields in 'struct vgamode_s' that are used in the main code. The remaining fields are specific to the standard vga hardware driver. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-01-14vgabios: Unify page size calculations; remove page size from vgamode_s.Kevin O'Connor1-14/+6
The previous code could obtain the page size in different ways - from vmode_g->sslength, from SCREEN_MEM_START, or by manually multiplying cols and rows. Add a new func (calc_page_size) and use that in areas that need to calculate the page size. Convert readers of the page size to read it from the "video_pagesize" entry in the BDA instead of recalculating it. Remove the page size from struct vgamode_s (slength) as it is now calculated dynamically. The new calculated versions are different from the existing values exported in video_param_table. However, the existing values (for CGA) did not look correct - I compared the values to those exported by two other VGA BIOS manufacturers and used the values that look more standard. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-01-14vgabios: Make struct vgamode_s more similar to bochs/cirrus mode tables.Kevin O'Connor1-5/+5
For graphics modes, store pixel width/height instead of text width/height. Add explicit char width field. Where needed, calculate text width/height from pixel width/height by dividing pixel count by character size. Rename some fields and change field sizes to match cirrus/bochs definitions. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-01-14vgabios: Use vesa style memory model flags in stdvga code.Kevin O'Connor1-25/+23
Replace the custom flags with the flags defined in the VBE spec. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-01-01vgabios: Add scrolling for linear (packed pixel) graphics mode.Kevin O'Connor1-2/+32
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-01-01vgabios: Minor - make FB scroll functions look similar.Kevin O'Connor1-26/+31
All three scroll function variants have the same format, but those that have an implicit character width or height of 1 have those multiplications omitted. Add those multiplications back in (the compiler will optimize them away) so all the variants look similar. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-01-01vgabios: Framebuffer fixes for CGA and planar graphics modes.Kevin O'Connor1-7/+7
Fix missing divide by 2 in CGA mode scroll. Consistently use cheight/2 for all uses. Planar graphics character write has a read to video memory with a side effect - mark that as volatile so the compiler doesn't optimize it away. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2011-12-31vgabios: Refactor vga_set_mode and stdvga_set_mode.Kevin O'Connor1-18/+0
Split out the BDA setup part of vga_set_mode to new function modeswitch_set_bda. Move the remaining parts (palette loading, screen clearing, font loading) of vga_set_mode into stdvga_set_mode. Add new mode switching flags and pass them to stdvga_set_mode, so it does not need to inspect modeset_ctl directly. Move code needed by stdvga_set_mode (perform_gray_scale_summing, clear_screen) to stdvga.c. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2011-12-31vgabios: Move vgafb_load_font to stdvga.c.Kevin O'Connor1-19/+0
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2011-12-31vgabios: Rename vgahw_* functions to stdvga_*.Kevin O'Connor1-19/+19
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2011-12-31vgabios: Rename vgaio.c to stdvga.c.Kevin O'Connor1-0/+1
Also, introduce stdvga.h. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2011-12-31vgabios: Rename vga.c to vgabios.c.Kevin O'Connor1-1/+1
Also, rename vgatables.h to vgabios.h. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2011-12-27vgabios: Use vgamode_s instead of video_param_table in code.Kevin O'Connor1-6/+3
Now that all the info in video_param_table is also in vgamode_s, use the info in vgamode_s throughout the code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2009-05-31VGA: Move direct in/out calls out of vgafb.c.Kevin O'Connor1-27/+21
Implement wrapper calls in vgaio.c and use them instead.
2009-05-31VGA: Comment and name update.Kevin O'Connor1-28/+27
Remove remaining "biosfn_" prefixes from functions. Don't use register names as function parameters. vgafb_read_pixel should return a value (instead of passing in a pointer)
2009-05-31VGA: Further simplify scrolling code.Kevin O'Connor1-163/+84
Introduce memcpy_stride and memset_stride functions. Simplify the moves and fills using src and dest pointers. Don't nest for loops - just use one loop for copies.
2009-05-31VGA: Simplify scrolling implementation.Kevin O'Connor1-48/+9
Check for nblines==0 in calling function. Eliminate full screen clearing optimization.
2009-05-31VGA: Fix bad commit to vgafb.c - missing '}'.Kevin O'Connor1-0/+1
2009-05-31VGA: Define clear_screen in terms of memmodel.Kevin O'Connor1-10/+12
Use vmode_g->memmodel instead of memmodel and svgamode.
2009-05-31VGA: Breakup biosfn_scroll.Kevin O'Connor1-145/+187
Rename biosfn_scroll to vgafb_scroll. Break function up into per-mode scroll function. Pass row/col params in a 'struct cursorpos'. Encode direction as sign in nblines. Move parameter checking to callers. Add enhancement to 'attr' for using mode specific default attribute. Also, make get_cursor_pos local to vga.c.