Commit Graph

51 Commits

Author SHA1 Message Date
Kevin O'Connor c5a361c09a stdvga: Add stdvga_set_vertical_size() helper function
Add helper function and update the bochsvga.c code to use it.  This
emphasizes the relationship between stdvga_get_vertical_size() and
stdvga_set_vertical_size() code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-04-05 17:59:49 -04:00
Kevin O'Connor d73e18bb70 vgasrc: Use curmode_g instead of vmode_g when mode is the current video mode
Many functions are passed a pointer to the current video mode
vgamode_s struct.  Use the name 'curmode_g' for these functions and
use 'vmode_g' for functions that can accept an arbitrary video mode.
Hopefully this will make the goals of the functions more clear.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-03-15 10:58:57 -04:00
Gerd Hoffmann 083801db10 bochsvga: add edid support.
Read EDID blob from mmio bar, store in VBE_edid.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-05-15 10:11:48 +02:00
Gerd Hoffmann 004f5b3ae5 vga: move modelist from bochsvga.c to new svgamodes.c
So other drivers can simply use the same list too.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-03-14 13:07:17 +01:00
Kevin O'Connor c682ffe671 vgautil: Move generic definitions from stdvga.h to vgautil.h
Don't use stdvga.h for function definitions of code in stdvgamodes.c
and stdvgaio.c.  Move them to vgautil.h.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-08-05 11:48:20 -04:00
Kevin O'Connor 2f2ec113be vgautil: Add new header file with misc function and variable definitions
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-05 11:28:19 -04:00
Gerd Hoffmann 87f848ec2d vga: rework virtio-vga support
Unlike planned earlier virtio-vga will be compatible with
the qemu stdvga, with the framebuffer in bar 0.  Drop the
virtio-vga chunk, update comment accordingly.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-06-11 09:23:03 +02:00
Paolo Bonzini 9c29148ea6 vgabios: fix graphics operation with Bochs VGA in non-DISPI modes
For legacy VGA modes that do not set the VBE_DISPI_ENABLED bit,
bochsvga_get_linelength returns 0.  Thus all characters are squashed
into the first scanline.  Fix this by falling back to stdvga for
the legacy modes.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-01-06 09:53:39 -05:00
Gerd Hoffmann 5d598779b0 vga: rework bar detection, add virtio-vga
Replace the heuristic which checks the bar 0 attributes to
figure whenever bar 0 or bar 1 has the linear framebuffer
with a vendor id check.

Add support for virtio-vga which uses bar 2 for the linear
framebuffer.

Cc: Dave Airlie <airlied@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-03-06 10:53:14 +01:00
Kevin O'Connor 20dc419306 vgabios: Simplify save/restore mechanism.
Reorganize the save/restore functions to eliminate some boilerplate
code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-02-05 20:52:25 -05:00
Kevin O'Connor 06c6d47659 vgabios: Avoid possible divide by zero in bochsvga_set_displaystart.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-12-04 10:34:17 -05:00
Kevin O'Connor a9dcc88262 vgabios: Add bochsvga "HDTV" resolutions.
The same set of video modes were added to the "lgpl vgabios" in
release 0.7a.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-12-04 10:34:17 -05:00
Kevin O'Connor 5b6936e0e8 vgabios: Load the DAC palette in "packed" modes on Cirrus and BochsVGA.
This is a port of a patch applied to the "lgpl vgabios" tree (that was
released in its v0.7a release).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-12-04 10:34:17 -05:00
Kevin O'Connor 4ade523a9d Remove ioport.h; disperse its contents to other header files.
Move the inb(), insb(), etc. code from ioport.h to x86.h.  Move the
PORT_* definitions to their appropriate hardware files.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-09-28 22:10:31 -04:00
Kevin O'Connor 2e57c81f1d Move vbe.h to std/vbe.h.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-09-18 20:48:34 -04:00
Kevin O'Connor 2d2fa31b37 Move function definitions for output.c from util.h to new file output.h.
Also, sort the order of include files in the c files.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-09-18 20:48:34 -04:00
Kevin O'Connor 68f56aa6e9 vgabios: Rename stdvga_bpp_factor to stdvga_vram_ratio.
Invert the values returned by stdvga_bpp_factor and rename it.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-09-18 20:48:33 -04:00
Gerd Hoffmann 53663503ab bochsvga: fallback to stdvga if dispi interface isn't present
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-09-16 10:54:54 +02:00
Kevin O'Connor 5d369d8d9e Move code centered around specific hardware devices to src/hw/
Move many C files from the src/ directory to the new src/hw/ directory.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-09-02 20:48:46 -04:00
David Woodhouse 0069a314b3 Enable VGA output when settings bochs-specific mode
When used from OVMF+CSM, we got no video output. It appears that we were
never enabling the display output except when configuring a text mode.
Which never happens, in the OVMF+CSM case.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2013-02-16 20:01:39 -05:00
Kevin O'Connor d83c87bb20 Normalize POST initialization function name suffixes.
The POST phase has to invoke many initialization functions, and these
functions can have complex inter-dependencies.  Try to categorize the
functions into 4 classes:

preinit - functions called very early in POST where function ordering
    is very important and the code has limited access to other
    interfaces.

init - functions that initialize internal interfaces and standard
    external interfaces.  This code is generally not dependent on
    particular hardware and typically does not communicate directly
    with any hardware devices.

setup - functions which access hardware or are dependent on particular
    hardware or platform devices.

prepboot - functions that finalize internal interfaces and that
    prepare for the boot phase.

This patch attempts to normalize the suffixes - functions that used
_init(), _setup(), _finalize(), or similar that did not follow the
above pattern were renamed.  Other than function name changes, there
should be no code impact to this patch.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-02-05 20:00:29 -05:00
Kevin O'Connor 49ddd9ebbe vgabios: Check for relocatable windows before advertising support for it.
Use the VBE_win_granularity field to determine if the memory windows
are relocatable.  (Bochs and Cirrus vga support relocatable windows
while the standard vga controller does not.)

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-09-04 13:16:36 -04:00
Gerd Hoffmann 091dd17e8d vga: fix bochs lfb size display
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-02-06 19:14:41 -05:00
Kevin O'Connor 2469f89528 vgabios: Implement VBE save/restore state function (func 04).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-02-04 12:41:13 -05:00
Kevin O'Connor e737b178e1 vgabios: Add support for VBE get/set dac palette format (func 08).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-02-04 11:08:39 -05:00
Kevin O'Connor cfd7ef9d8b vgabios: Handle VGA option rom being re-run.
Check for the case where the option rom is executed a second time - in
that case re-init the hardware, but do not set any variables.  This
should make the rom better behaving when run from S3 resume.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-02-02 22:52:17 -05:00
Kevin O'Connor 933bb76da7 vgabios: Move bocshvga mode checking from runtime to init.
Check mode validity at init.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-02-01 22:00:05 -05:00
Kevin O'Connor c8845029a7 vgabios: Rework bochsvga mode switching.
Make the bochsvga mode switch more similar to the original lgpl
vgabios code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-02-01 21:58:49 -05:00
Kevin O'Connor 3524453b5d vgabios: Fix linelength calculations in bochsvga and vbe.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-02-01 21:58:38 -05:00
Kevin O'Connor 2bd4531436 vgabios: handle vmware vga in bochsvga.
The vmware vga emulated by qemu has a I/O region in pci bar 0.
The framebuffer is in pci bar 1.  Handle that by checking the
type of bar 0 in case it is a I/O bar use bar 1 instead.

Also make bochsbios report lfb size in debug output.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-02-01 20:42:06 -05:00
Kevin O'Connor d9211ee9e3 vgabios: Update copyright statements in bochsvga.c and vbe.c.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-02-01 20:40:47 -05:00
Kevin O'Connor d61fc53a60 vgabios: Add support for VBE get/set display start function.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-02-01 20:39:03 -05:00
Kevin O'Connor 3876b53122 vgabios: Add support for vbe get/set line length function.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-02-01 20:38:49 -05:00
Kevin O'Connor 9961f9958c vgabios: Add support for vesa get/set window function.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-02-01 20:37:02 -05:00
Kevin O'Connor e6bc4c1c58 vgabios: Move BDA setting from driver code to common code.
Always setup the BDA on a mode switch.  Call that BDA setup code
unconditionally.

Also, always set vbe_mode and use that for finding the current mode
and for reporting the mode to vbe callers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-02-01 20:35:48 -05:00
Kevin O'Connor 0377602ae6 vgabios: Set cwidth/cheight/sstart in vgamode_s for cirrus/bochs.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-01-21 11:00:11 -05:00
Kevin O'Connor 8cf8f8e6ce vgabios: Check that the PCI BDF passed in is valid before using.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-01-19 21:34:44 -05:00
Kevin O'Connor b3df857fe6 vgabios: Make VBE code depend on a config setting.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-01-16 12:02:44 -05:00
Kevin O'Connor 184705fc8c vgabios: Use standard VGA IO wrapper functions in bochsvga.
Also, this alters some of the IO port settings in bochsvga_set_mode to
fix what looks like errors during the asm to C conversion.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-01-16 11:52:46 -05:00
Kevin O'Connor 97cc354a02 vgabios: Add cirrus linear framebuffer detection; enable VBE in cirrus.
Extract Cirrus framebuffer address from PCI config space.

Enable VBE code for Cirrus cards.

Also, rework bochsvga code to use direct PCI accesses instead of
calling into the BIOS.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-01-14 17:20:07 -05:00
Kevin O'Connor 3339c05f19 vgabios: Make VBE code independent of bochsvga.
Introduce new global variables (VBE_enabled, VBE_total_memory,
VBE_capabilities, VBE_framebuffer) to replace the need for function
calls that were specific to bochsvga.

Replace info received from bochsvga_mode_info with info found in
vgahw_find_mode.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-01-14 17:19:45 -05:00
Kevin O'Connor 34203cdf8a vgabios: Unify code to generate the vbe mode list.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-01-14 17:19:39 -05:00
Kevin O'Connor c4a0b976c0 vgabios: Use vgamode_s in cirrus and bochsvga mode tables.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-01-14 17:19:30 -05:00
Kevin O'Connor bb17d84468 vgabios: Add memmodel field to bochsvga mode list.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2012-01-14 17:19:12 -05:00
Kevin O'Connor 161d201aff vgabios: Unify X_init() functions.
Use the same function signature for cirrus, bochsvga, geodelx, and
stdvga init code.

Have each hardware type explicitly call stdvga_init when needed.

To unify bochsvga_init() signature, store the device BDF passed into
the optionrom init code in a global variable (VgaBDF).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2011-12-31 19:45:14 -05:00
Kevin O'Connor 5108c69c47 vgabios: Unify X_set_mode() functions.
Use the same function signature for cirrus, bochsvga, and stdvga
set_mode code.

Make both the int1000 interface and the VBE 104f02 interface use the
same set_mode function.

Where clext and bochsvga need to fallback to the standard vga mode
switching, have them call vgastd_mode_switch directly.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2011-12-31 19:21:23 -05:00
Kevin O'Connor 821d6b410e vgabios: Refactor vga_set_mode and stdvga_set_mode.
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-31 18:19:22 -05:00
Kevin O'Connor ed68e5b601 vgabios: Rename vgaio.c to stdvga.c.
Also, introduce stdvga.h.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2011-12-31 04:17:44 -05:00
Kevin O'Connor e1e000b177 vgabios: Rename vga.c to vgabios.c.
Also, rename vgatables.h to vgabios.h.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2011-12-31 03:30:40 -05:00
Kevin O'Connor f1e217dc18 vgabios: Use bochsvga_ prefix for bochs vga functions.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2011-12-31 03:20:32 -05:00