qemu_command_builder/
vga.rs

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