crosvm/rutabaga_gfx
Ryan Neph 2a8339f85d rutabaga_gfx: make non-sandboxed opaque fd mapping explicit
When sandboxing is disabled, rutabaga.external_blob is unset and blob
resources with RUTABAGA_MEM_HANDLE_TYPE_OPAQUE_FD can be mapped via
rutabaga.map() as VmMemorySource::ExternalMapping. This is already
implicitly allowed for the Virglrenderer component, which doesn't
recognize the OPAQUE_FD handle type upon export_blob() and automatically
falls back on the ExternalMapping path. Mesa CI currently relies on this
for testing Venus in Crosvm with the host lavapipe driver.

When sandboxing is enabled, rutabaga.external_blob is set and opaque
fds MUST be mapped from the hypervisor process via Vulkano as
`VmMemorySource::Vulkan` instead.

This CL makes non-sandboxed OPAQUE_FD mapping explicit, documents the
two mapping paths, and prepares for virglrenderer to support sandboxed
OPAQUE_FD mapping.

For the non-sandboxed configuration, Crosvm exports a RutabagaHandle
with handle of type RUTABAGA_MEM_HANDLE_TYPE_OPAQUE_FD upon blob
creation with virglrenderer. When mapped, the RutabagaHandle is dropped,
closing the cloned opaque_fd, and virgl_renderer_resource_map()
completes the mapping internally by looking up the resource_id and
dispatching to the context type from which it was created.

BUG=b:244591751
TEST=`deqp-vk -n dEQP-VK.memory.mapping.*` using venus with lavapipe host driver
TEST=CQ

Change-Id: I2ff32cf8868d6c9c1eb16480456cde98d376cc65
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3900320
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Commit-Queue: Ryan Neph <ryanneph@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
2022-09-22 21:43:19 +00:00
..
ffi
src rutabaga_gfx: make non-sandboxed opaque fd mapping explicit 2022-09-22 21:43:19 +00:00
build.rs
Cargo.toml