qemu_command_builder/
vga.rs

1use crate::to_command::ToCommand;
2
3pub enum VGA {
4    /// Cirrus Logic GD5446 Video card. All Windows versions starting
5    /// from Windows 95 should recognize and use this graphic card. For
6    /// optimal performances, use 16 bit color depth in the guest and
7    /// the host OS. (This card was the default before QEMU 2.2)
8    Cirrus,
9
10    /// Standard VGA card with Bochs VBE extensions. If your guest OS
11    /// supports the VESA 2.0 VBE extensions (e.g. Windows XP) and if
12    /// you want to use high resolution modes (>= 1280x1024x16) then you
13    /// should use this option. (This card is the default since QEMU
14    /// 2.2)
15    Std,
16
17    /// VMWare SVGA-II compatible adapter. Use it if you have
18    /// sufficiently recent XFree86/XOrg server or Windows guest with a
19    /// driver for this card.
20    Vmware,
21
22    /// QXL paravirtual graphic card. It is VGA compatible (including
23    /// VESA 2.0 VBE support). Works best with qxl guest drivers
24    /// installed though. Recommended choice when using the spice
25    /// protocol.
26    Qxl,
27
28    /// (sun4m only) Sun TCX framebuffer. This is the default
29    /// framebuffer for sun4m machines and offers both 8-bit and 24-bit
30    /// colour depths at a fixed resolution of 1024x768.
31    Tcx,
32
33    /// (sun4m only) Sun cgthree framebuffer. This is a simple 8-bit
34    /// framebuffer for sun4m machines available in both 1024x768
35    /// (OpenBIOS) and 1152x900 (OBP) resolutions aimed at people
36    /// wishing to run older Solaris versions.
37    Cg3,
38
39    /// Virtio VGA card.
40    Virtio,
41
42    /// Disable VGA card.
43    None,
44}
45
46impl ToCommand for VGA {
47    fn to_command(&self) -> Vec<String> {
48        let mut cmd = vec![];
49
50        cmd.push("-vga".to_string());
51
52        match self {
53            VGA::Cirrus => {
54                cmd.push("cirrus".to_string());
55            }
56            VGA::Std => {
57                cmd.push("std".to_string());
58            }
59            VGA::Vmware => {
60                cmd.push("vmware".to_string());
61            }
62            VGA::Qxl => {
63                cmd.push("qxl".to_string());
64            }
65            VGA::Tcx => {
66                cmd.push("tcx".to_string());
67            }
68            VGA::Cg3 => {
69                cmd.push("cg3".to_string());
70            }
71            VGA::Virtio => {
72                cmd.push("virtio".to_string());
73            }
74            VGA::None => {
75                cmd.push("none".to_string());
76            }
77        }
78        cmd
79    }
80}