crosvm/Cargo.toml

229 lines
5.9 KiB
TOML
Raw Normal View History

[package]
name = "crosvm"
version = "0.1.0"
authors = ["The Chromium OS Authors"]
edition = "2021"
default-run = "crosvm"
# b:223855233
resolver = "1"
[[bin]]
name = "crosvm"
path = "src/main.rs"
[[bin]]
name = "crosvm-direct"
path = "src/main.rs"
required-features = [ "direct" ]
[profile.release]
panic = 'abort'
overflow-checks = true
[profile.release-test]
inherits = 'release'
panic = 'unwind'
# Reproduces the options used when building crosvm for Chrome OS.
[profile.chromeos]
inherits = "release"
opt-level = "s"
# Enables LTO to further reduce the size of the binary.
[profile.lto]
inherits = "chromeos"
lto = true
# We currently need to exclude some crates from the workspace to allow
# these crates to be independently built by portage. These crates will
# eventually be moved into separate repositories.
# The only workspace members that need to be explicitly specified here are those
# that are not dependencies of the crosvm root crate.
[workspace]
members = [
"aarch64",
"acpi_tables",
"arch",
"argh_helpers",
"base",
"bit_field",
"broker_ipc",
"cros_async",
"crosvm-fuzz",
"crosvm_control",
"crosvm_plugin",
"devices",
"disk",
"fuse",
"gpu_display",
"hypervisor",
"integration_tests",
"io_uring",
"kernel_cmdline",
"kernel_loader",
"kvm",
"kvm_sys",
"linux_input_sys",
virtio: video: decoder: add ffmpeg-based software decoder backend The virtio video decoder device is currently only available under very drastic conditions: a build linked against libvda (a ChromeOS-only library that needs the cros chroot to be built and linked against), and a ChromeOS-flavored Chrome instance running alongside crosvm, so the browser can provide the video decoding service through Mojo. This makes the decoder device very difficult to develop on for non-Chromies, and also for Chromies actually since they will always need a DUT to test it on. This patch introduces an alternative decoder backend based on ffmpeg's libraries that performs decoding on the host's CPU. It supports both guest pages and virtio objects as target, and can be considered a reliable and predictable way to test the decoder in any environment. We introduce our own ffmpeg bindings after a quick state of the art revealed that the existing ones were all unsuitable, either for technical or licensing reasons. Doing so is also not a big effort and does not add any new external crate dependency to crosvm. BUG=b:169295147 TEST=cargo test --features "video-decoder,ffmpeg" -p devices ffmpeg TEST=v4l2r's simple_decoder example decodes test-25fps.h264 properly with the following command: ./simple_decoder test-25fps.h264 /dev/video0 --input_format h264 --save test-25fps.nv12 TEST=ARCVM Android youtube plays videos correctly when the ffmpeg backend is used. Change-Id: Ic9c586193f7939f2a3fe59d009c3666585a8bbc7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3026355 Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Alexandre Courbot <acourbot@chromium.org> Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2022-06-02 02:18:48 +00:00
"media/ffmpeg",
"media/libvda",
"net_sys",
"net_util",
"power_monitor",
"protos",
"qcow_utils",
"resources",
"rutabaga_gfx",
"serde_keyvalue",
"tpm2",
"tpm2-sys",
"tracing",
"usb_sys",
"usb_util",
"vfio_sys",
"vhost",
"virtio_sys",
"vm_control",
"vm_memory",
"x86_64",
"third_party/vmm_vhost",
]
exclude = [
"common/assertions",
"common/audio_streams",
"common/balloon_control",
"common/cros-fuzz",
"common/cros_async",
cros_asyncv2: Add crate Based on the previous proposal in [1]. * The Executor is now completely platform-agnostic and only relies on the platform to provide a type that implements the `PlatformState` trait. * The crate provides concrete high-level types rather than forcing users to deal with trait objects and async-trait. Currently, only File and Event are supported. Support for timers, sockets, and pipes will be added in subsequent changes. * Each high-level type delegates the implementation to a platform-specific type and exists mainly as a place to hold documentation and tests. * On Unix the io_driver module provides async versions of various IO-related syscalls, which are used by the platform-specific File and Event types to implement the required behavior. * io-uring support can be disabled at compile time. When uring support is enabled, we make a runtime check to decide whether or not to use it. The actual io-uring driver is currently unimplemented and will be added in a subsequent change. One non-trivial downside of this change is that the futures returned by the various async methods are !Send and !Sync, which means that they can only be awaited from the same thread on which they were started. In practice this should be fine since current crosvm (and Chrome OS) code doesn't really make use of sending futures to different threads. This can also be mitigated by using `Executor::spawn_local` and a `oneshot::channel` to isolate the !Send future from the outer async fn (as long as the output of the future is Send). See the crate documentation and the `outer_future_is_send` test in `src/executor.rs` for more details. [1]: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3062166 BUG=b:195468578 TEST=unit tests Change-Id: I1aad0885e67a957149e2ec3b4d9df215d9b20d81 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3222223 Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
2021-07-13 06:14:25 +00:00
"common/cros_asyncv2",
"common/data_model",
"common/io_uring",
"common/p9",
"common/sync",
"tube_transporter",
"win_util",
"tools/examples/baremetal"
]
[features]
all-linux = [
# TODO(b/203105868): Enable remaining features on linux builds.
"composite-disk",
"default",
"gdb",
"tpm",
"virgl_renderer_next",
"virgl_renderer",
"x",
]
win64 = []
audio = ["devices/audio"]
audio_cras = ["devices/audio_cras"]
chromeos = ["base/chromeos", "audio_cras", "devices/chromeos"]
composite-disk = ["protos/composite-disk", "protobuf", "disk/composite-disk"]
default = ["audio", "gpu", "usb"]
default-no-sandbox = []
direct = ["devices/direct", "arch/direct", "x86_64/direct"]
virtio: video: decoder: add ffmpeg-based software decoder backend The virtio video decoder device is currently only available under very drastic conditions: a build linked against libvda (a ChromeOS-only library that needs the cros chroot to be built and linked against), and a ChromeOS-flavored Chrome instance running alongside crosvm, so the browser can provide the video decoding service through Mojo. This makes the decoder device very difficult to develop on for non-Chromies, and also for Chromies actually since they will always need a DUT to test it on. This patch introduces an alternative decoder backend based on ffmpeg's libraries that performs decoding on the host's CPU. It supports both guest pages and virtio objects as target, and can be considered a reliable and predictable way to test the decoder in any environment. We introduce our own ffmpeg bindings after a quick state of the art revealed that the existing ones were all unsuitable, either for technical or licensing reasons. Doing so is also not a big effort and does not add any new external crate dependency to crosvm. BUG=b:169295147 TEST=cargo test --features "video-decoder,ffmpeg" -p devices ffmpeg TEST=v4l2r's simple_decoder example decodes test-25fps.h264 properly with the following command: ./simple_decoder test-25fps.h264 /dev/video0 --input_format h264 --save test-25fps.nv12 TEST=ARCVM Android youtube plays videos correctly when the ffmpeg backend is used. Change-Id: Ic9c586193f7939f2a3fe59d009c3666585a8bbc7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3026355 Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Alexandre Courbot <acourbot@chromium.org> Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2022-06-02 02:18:48 +00:00
ffmpeg = ["devices/ffmpeg"]
gdb = ["gdbstub", "gdbstub_arch", "arch/gdb", "vm_control/gdb", "x86_64/gdb"]
gfxstream = ["devices/gfxstream"]
gpu = ["devices/gpu"]
haxm = ["hypervisor/haxm"]
whpx = ["hypervisor/whpx"]
libvda = ["devices/libvda"]
linux-armhf = [
"composite-disk",
"default",
"gdb",
"tpm",
]
linux-x86_64 = ["all-linux", "plugin"]
linux-aarch64 = ["all-linux"]
plugin = ["protos/plugin", "crosvm_plugin", "kvm", "kvm_sys", "protobuf"]
plugin-render-server = []
power-monitor-powerd = ["arch/power-monitor-powerd"]
slirp = ["devices/slirp"]
tpm = ["devices/tpm"]
usb = ["devices/usb"]
video-decoder = ["devices/video-decoder"]
video-encoder = ["devices/video-encoder"]
virgl_renderer = ["devices/virgl_renderer"]
virgl_renderer_next = ["rutabaga_gfx/virgl_renderer_next"]
rutabaga_gfx: rutabaga_gralloc: a shimmering beacon of hope rutabaga_gralloc is a cross-platform, Rust-based buffer manager. The rationale for this change is: 1) For the {cross-domain, wayland} context type, we need to have a good story for the crucial "wl-dmabuf" feature. As minigbm has been thoroughly tested on ChromeOS and currently powers the "wl-dmabuf" feature, it only makes sense for us to have a path to minigbm for the cross-domain prototype. This will be used by Sommelier. 2) While minigbm allocation works well on Chromebooks, it is not sufficient for cross-platform purposes. For their Virtual Graphics Interface (VGI) initiative, Android graphics virtualization experts have expressed their desire for a Vulkan based allocator. This will to go alongside cros_gralloc in minigbm, which is considered by many to be the ""world's premiere gralloc implementation". 3) Android graphics virtualization experts have expressed their desire for vkMapMemory(..) to be used when crosvm is in multi-process mode. Currently, only dma-buf mmap() is supported for zero-copy blobs in multi-process mode. dma-buf mmap() is not guaranteed to work on Nvidia (a "must have" for Cuttlefish) or any other driver for that matter (we *make* it work for ChromeOS). Possibly only solution: vkMapMemory ;-) With these goals in mind, here's a summary of the revelant changes: * Renamed the {gpu_allocator.rs, GpuMemoryAllocator trait} to be {gralloc.rs, Gralloc trait}. * Moved all GPU allocation out of the resources crate and into the rutabaga_gfx crate. This will allow the resources crate to be focused on managing resources for virtual machines. * Moved the gpu_buffer crate into the gralloc module in the rutabaga_gfx crate. The same functionality is now under "minigbm.rs", "minigbm_bindings.rs" and "rendernode.rs" * Added an optional dependency on vulkano.rs. vulkano.rs is a safe Rust wrapper around the Vulkan api [a]. It's emphasis on type safety makes a good fit for crosvm, though there are other high quality crates out there (gfx-rs, ash.rs). Though development has slowed down, it should satisfy goals (2) and (3) quite easily. * Added a system_gralloc implementation based on memfd. This can be used when minigbm or Vulkano features are not used, to replicate the highly useful "wl-shm" feature in Sommelier. Astute observers will note this can also enable seamless Wayland windowing without GPU features for Android too. Some minor changes to the base crate were needed. * Cut down on the amount of DrmFormats to the subset needed by Sommelier and cros_gralloc. * Moved checked arithmetic into it's own file. * Internally renamed to "wl-dmabuf" feature to be the "minigbm" feature. This is because "wl-dmabuf" has a dependency on minigbm. * Small rutabaga_gfx cleanups [a] https://github.com/vulkano-rs/vulkano/blob/master/DESIGN.md BUG=b:146066070, b:173630595, b:150239451 TEST=launch virtual machine with 2D mode TEST=launch virtual machine with 3D mode TEST=run sommelier with "wl-dmabuf" and "wl-shm" Change-Id: I693a39cef64cd98e56d843d3c60caa7983d4d6e1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2626487 Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org> Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
2020-12-09 18:44:13 +00:00
wl-dmabuf = ["devices/minigbm"]
x = ["devices/x"]
[dependencies]
anyhow = "1.0.32"
arch = { path = "arch" }
argh = "0.1"
argh_helpers = { path = "argh_helpers" }
assertions = { path = "common/assertions" }
audio_streams = "*"
base = "*"
bit_field = { path = "bit_field" }
broker_ipc = { path = "broker_ipc" }
cfg-if = "1.0.0"
crosvm_plugin = { path = "crosvm_plugin", optional = true }
data_model = "*"
devices = { path = "devices" }
disk = { path = "disk" }
enumn = "0.1.0"
gdbstub = { version = "0.6.1", optional = true }
gdbstub_arch = { version = "0.2.2", optional = true }
rutabaga_gfx: rutabaga_gralloc: a shimmering beacon of hope rutabaga_gralloc is a cross-platform, Rust-based buffer manager. The rationale for this change is: 1) For the {cross-domain, wayland} context type, we need to have a good story for the crucial "wl-dmabuf" feature. As minigbm has been thoroughly tested on ChromeOS and currently powers the "wl-dmabuf" feature, it only makes sense for us to have a path to minigbm for the cross-domain prototype. This will be used by Sommelier. 2) While minigbm allocation works well on Chromebooks, it is not sufficient for cross-platform purposes. For their Virtual Graphics Interface (VGI) initiative, Android graphics virtualization experts have expressed their desire for a Vulkan based allocator. This will to go alongside cros_gralloc in minigbm, which is considered by many to be the ""world's premiere gralloc implementation". 3) Android graphics virtualization experts have expressed their desire for vkMapMemory(..) to be used when crosvm is in multi-process mode. Currently, only dma-buf mmap() is supported for zero-copy blobs in multi-process mode. dma-buf mmap() is not guaranteed to work on Nvidia (a "must have" for Cuttlefish) or any other driver for that matter (we *make* it work for ChromeOS). Possibly only solution: vkMapMemory ;-) With these goals in mind, here's a summary of the revelant changes: * Renamed the {gpu_allocator.rs, GpuMemoryAllocator trait} to be {gralloc.rs, Gralloc trait}. * Moved all GPU allocation out of the resources crate and into the rutabaga_gfx crate. This will allow the resources crate to be focused on managing resources for virtual machines. * Moved the gpu_buffer crate into the gralloc module in the rutabaga_gfx crate. The same functionality is now under "minigbm.rs", "minigbm_bindings.rs" and "rendernode.rs" * Added an optional dependency on vulkano.rs. vulkano.rs is a safe Rust wrapper around the Vulkan api [a]. It's emphasis on type safety makes a good fit for crosvm, though there are other high quality crates out there (gfx-rs, ash.rs). Though development has slowed down, it should satisfy goals (2) and (3) quite easily. * Added a system_gralloc implementation based on memfd. This can be used when minigbm or Vulkano features are not used, to replicate the highly useful "wl-shm" feature in Sommelier. Astute observers will note this can also enable seamless Wayland windowing without GPU features for Android too. Some minor changes to the base crate were needed. * Cut down on the amount of DrmFormats to the subset needed by Sommelier and cros_gralloc. * Moved checked arithmetic into it's own file. * Internally renamed to "wl-dmabuf" feature to be the "minigbm" feature. This is because "wl-dmabuf" has a dependency on minigbm. * Small rutabaga_gfx cleanups [a] https://github.com/vulkano-rs/vulkano/blob/master/DESIGN.md BUG=b:146066070, b:173630595, b:150239451 TEST=launch virtual machine with 2D mode TEST=launch virtual machine with 3D mode TEST=run sommelier with "wl-dmabuf" and "wl-shm" Change-Id: I693a39cef64cd98e56d843d3c60caa7983d4d6e1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2626487 Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org> Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
2020-12-09 18:44:13 +00:00
rutabaga_gfx = { path = "rutabaga_gfx"}
hypervisor = { path = "hypervisor" }
kernel_cmdline = { path = "kernel_cmdline" }
kernel_loader = { path = "kernel_loader" }
kvm = { path = "kvm", optional = true }
kvm_sys = { path = "kvm_sys", optional = true }
libc = "0.2.93"
libcras = "*"
# Compile out trace statements in release builds
log = { version = "0", features = ["release_max_level_debug"]}
metrics = { path = "metrics" }
minijail = "*" # provided by ebuild
net_util = { path = "net_util" }
p9 = "*"
protobuf = { version = "2.3", optional = true }
protos = { path = "protos", optional = true }
remain = "*"
resources = { path = "resources" }
scudo = { version = "0.1", optional = true }
serde = "*"
serde_json = "*"
serde_keyvalue = { path = "serde_keyvalue", features = ["argh_derive"] }
sync = { path = "common/sync" }
tempfile = "3"
terminal_size = "0.1.17"
thiserror = { version = "1.0.20" }
uuid = { version = "0.8.2" }
vhost = { path = "vhost" }
vm_control = { path = "vm_control" }
acpi_tables = { path = "acpi_tables" }
vm_memory = { path = "vm_memory" }
[target.'cfg(target_arch = "x86_64")'.dependencies]
x86_64 = { path = "x86_64" }
[target.'cfg(any(target_arch = "aarch64", target_arch = "arm"))'.dependencies]
aarch64 = { path = "aarch64" }
[target.'cfg(windows)'.dependencies]
tube_transporter = { path = "tube_transporter" }
[dev-dependencies]
base = "*"
lazy_static = "*"
[patch.crates-io]
assertions = { path = "common/assertions" }
audio_streams = { path = "common/audio_streams" }
base = { path = "base" }
cros_async = { path = "cros_async" }
cros_fuzz = { path = "common/cros-fuzz" } # ignored by ebuild
data_model = { path = "common/data_model" }
libcras = { path = "libcras_stub" } # ignored by ebuild
p9 = { path = "common/p9" } # ignored by ebuild
sync = { path = "common/sync" }
system_api = { path = "system_api_stub" } # ignored by ebuild
wire_format_derive = { path = "common/p9/wire_format_derive" } # ignored by ebuild
minijail = { path = "third_party/minijail/rust/minijail" } # ignored by ebuild