crosvm/rutabaga_gfx/Cargo.toml

40 lines
1.1 KiB
TOML
Raw Normal View History

[package]
rutabaga_gfx: an electrifying possibility rutabaga_gfx is a cross platform, Rust-based, Wayland and Vulkan-centric Virtual Graphics Interface (VGI). Apologies for the mega-change, but it was hard to do this piece by piece. The rationale for this change is: 1) Android graphics virtualization experts have been proposing for a VGI for many months (years?). Their goal is to boot Android anywhere, everywhere. 2) For the {wayland, cross-domain} context type prototype, it's desirable to create a {wayland, camera} connection at the appropriate time. Details can be found in the code, though the RutabagaChannels have yet to be hooked up. There's a high chance neither effort will work. As such, rutabaga is just a prototype. However, even (1) and (2) don't end up working, this refactor/cleanup by itself makes a ton of sense. Here's a summary of revelant changes: * Removed auto-generated {p_defines, p_format, virgl_protocol}. These files were added for tests when bringing up crosvm-gpu, and AFAICT these tests are not run. There's actually now a commit queue for virglrenderer changes and container boot tests that provides excellent coverage. * Removed command_buffer.rs. Used only for the previously mentioned tests. It's quite nice, but couldn't determine the right place to put it. Maybe data_model? But removed it in the interim. * Removed {write_from_guest_memory, read_to_volatile}. The same basic functionality has been moved into {transfer_write, transfer_read} in Rutabaga. * Removed VirtioResource, Virtio3DResource, Virtio2DResource, and VirtioGfxStreamResource in favor of VirtioGpuResource and RutabagaResource. This leads to less duplication and clearer separation between external library functions and VMM functions. * Moved display and hypervisor memory management functions to virtio_gpu.rs. This is because external components do not interface with this functionality, and there was a lot of duplication (for example map/unmap blob). * Added context management between gfxstream and virglrenderer. * Added separate gfxstream and virglrenderer flags. * Clearer naming. * Added simple implementations for context init and multiple timelines. These changes have no effect since all Google kernels don't pass the revelant flags, but are useful for theoretical {wayland, cross-domain} prototype. * Unify RESOURCE_CREATE_3D and RESOURCE_CREATE_2D handling. * Better error handling. BUG=b:146066070, b:173630595, b:150239451 TEST=launch virtual machine with 2D mode TEST=launch virtual machine with 3D mode TEST=boot ARCVM Change-Id: I240b0c134a3b562cbc65981837a41f6db7767c92 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2522452 Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Lingfeng Yang <lfy@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org>
2020-10-20 01:31:13 +00:00
name = "rutabaga_gfx"
version = "0.1.3"
authors = ["The ChromiumOS Authors + Android Open Source Project"]
edition = "2021"
description = "Handling virtio-gpu protocols"
license-file = "LICENSE"
[features]
gfxstream = []
gfxstream_stub = []
virgl_renderer = []
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
minigbm = []
# To try out Vulkano, delete the following line and uncomment the line in "dependencies". Vulkano
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
# features are just a prototype and not integrated yet into the ChromeOS build system.
vulkano = []
x = []
[dependencies]
cfg-if = "1.0.0"
libc = "0.2.116"
remain = "0.2"
thiserror = "1.0.23"
zerocopy = { version = "0.7", features = ["derive"] }
log = "0.4"
# To build latest Vulkano, change version to git = "https://github.com/vulkano-rs/vulkano.git"
# vulkano = { version = "0.33.0", optional = true }
[target.'cfg(any(target_os = "android", target_os = "linux"))'.dependencies]
nix = { version = "0.28", features = ["event", "feature", "fs", "mman", "socket", "uio", "ioctl"] }
rutabaga_gfx: nuke base dependency The base crate has some nifty abstractions but also pulls in things like minijail, audio_streams and various random items. This prevents true cross-platform interoperatibility, which requires the ability to upload to crates.io with relative ease. This change removes the base crate. The replacement strategy is two fold: - For things like SafeDescriptor which don't have adequate solutions on crates.io, just copy it internally. I think SafeDescriptor in particular -- since it works on bot Windows/Linux should probably be made into a separate crate long-term since it is generically valuable. Similarly for the Event and WaitContext APIs. For now, live with the duplication. - Otherwise, the nix crate does most of the Linux specific items. The cross-domain context type has a lot of dependencies on Linux sockets / epoll. This is refactored to look more like the Fuchsia solution, which uses std::sync::mspc channels to connect to an utility Wayland FIDL library. The rest of Rutabaga mostly relies just on SafeDescriptor and the ability to clone it. rutabaga_gralloc allows provides shared memory used via virtwl. Another thing to call out is zerocopy is now strongly versioned to the latest stable release on crates.io I also got rid of #[cfg(feature = "virgl_renderer_next")] on the renderer server fd, since it was complicating the refactoring. SafeDescriptor works everywhere and adding the #ifdef should be reserved for the lowest-levels of platform specific code when possible. Overall, this makes compiling on Fuchsia hosts much simpler. BUG=b:273555494 TEST= - run cross_domain context type, see Wayland apps - note there is a previous bug in cross domain when resizing windows, it occurs before this CL. The reason seems to be raciness and can likely be fixed gfxstream-like seqno. - run gfxstream + virgl on Linux, verify everything works. Change-Id: I7519f2b8ed0cd57c47980d4e76403057498cf064 Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4353700 Reviewed-by: Dennis Kempin <denniskempin@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
2023-03-14 00:49:18 +00:00
[target.'cfg(windows)'.dependencies]
winapi = {version = "0.3", features = ["winnt", "handleapi", "processthreadsapi", "winbase"]}
[build-dependencies]
pkg-config = "0.3"
anyhow = "1.0.57"