SCRIPT_DIR="$(pwd)"
+git config --global user.email "mesa@example.com"
+git config --global user.name "Mesa CI"
+
CROSVM_VERSION=c7cd0e0114c8363b884ba56d8e12adee718dcc93
git clone --single-branch -b main --no-checkout https://chromium.googlesource.com/chromiumos/platform/crosvm /platform/crosvm
pushd /platform/crosvm
git checkout "$CROSVM_VERSION"
git submodule update --init
# Apply all crosvm patches for Mesa CI
-cat "$SCRIPT_DIR"/.gitlab-ci/container/build-crosvm_*.patch |
- patch -p1
+git am "$SCRIPT_DIR"/.gitlab-ci/container/build-crosvm_*.patch
VIRGLRENDERER_VERSION=dd301caf7e05ec9c09634fb7872067542aad89b7
rm -rf third_party/virglrenderer
--- /dev/null
+From 1cac06ceb16f73448b61e96c02956ec222bf681b Mon Sep 17 00:00:00 2001
+From: Omar Akkila <omar.akkila@collabora.com>
+Date: Tue, 12 Apr 2022 12:30:08 -0400
+Subject: [PATCH 1/1] Map opaque fd resources
+
+Signed-off-by: Omar Akkila <omar.akkila@collabora.com>
+---
+ devices/src/virtio/gpu/virtio_gpu.rs | 24 +++++++++++++++++++-----
+ rutabaga_gfx/src/virgl_renderer.rs | 1 +
+ 2 files changed, 20 insertions(+), 5 deletions(-)
+
+diff --git a/devices/src/virtio/gpu/virtio_gpu.rs b/devices/src/virtio/gpu/virtio_gpu.rs
+index 1c4f4f68..d26d7eb0 100644
+--- a/devices/src/virtio/gpu/virtio_gpu.rs
++++ b/devices/src/virtio/gpu/virtio_gpu.rs
+@@ -698,19 +698,33 @@ impl VirtioGpu {
+ let vulkan_info_opt = self.rutabaga.vulkan_info(resource_id).ok();
+
+ let source = if let Ok(export) = self.rutabaga.export_blob(resource_id) {
+- match vulkan_info_opt {
+- Some(vulkan_info) => VmMemorySource::Vulkan {
++ if let Some(vulkan_info) = vulkan_info_opt {
++ VmMemorySource::Vulkan {
+ descriptor: export.os_handle,
+ handle_type: export.handle_type,
+ memory_idx: vulkan_info.memory_idx,
+ physical_device_idx: vulkan_info.physical_device_idx,
+ size: resource.size,
+- },
+- None => VmMemorySource::Descriptor {
++ }
++ } else if export.handle_type == rutabaga_gfx::RUTABAGA_MEM_HANDLE_TYPE_OPAQUE_FD {
++ let mapping = self.rutabaga.map(resource_id)?;
++ // Scope for lock
++ {
++ let mut map_req = self.map_request.lock();
++ if map_req.is_some() {
++ return Err(ErrUnspec);
++ }
++ *map_req = Some(mapping);
++ }
++ VmMemorySource::ExternalMapping {
++ size: resource.size,
++ }
++ } else {
++ VmMemorySource::Descriptor {
+ descriptor: export.os_handle,
+ offset: 0,
+ size: resource.size,
+- },
++ }
+ }
+ } else {
+ if self.external_blob {
+diff --git a/rutabaga_gfx/src/virgl_renderer.rs b/rutabaga_gfx/src/virgl_renderer.rs
+index b29854f5..7110a69d 100644
+--- a/rutabaga_gfx/src/virgl_renderer.rs
++++ b/rutabaga_gfx/src/virgl_renderer.rs
+@@ -284,6 +284,7 @@ impl VirglRenderer {
+ let handle_type = match fd_type {
+ VIRGL_RENDERER_BLOB_FD_TYPE_DMABUF => RUTABAGA_MEM_HANDLE_TYPE_DMABUF,
+ VIRGL_RENDERER_BLOB_FD_TYPE_SHM => RUTABAGA_MEM_HANDLE_TYPE_SHM,
++ VIRGL_RENDERER_BLOB_FD_TYPE_OPAQUE => RUTABAGA_MEM_HANDLE_TYPE_OPAQUE_FD,
+ _ => {
+ return Err(RutabagaError::Unsupported);
+ }
+--
+2.25.1
+
variables:
DEBIAN_X86_BUILD_BASE_IMAGE: "debian/x86_build-base"
- DEBIAN_BASE_TAG: "2022-08-04-crosvm-base"
+ DEBIAN_BASE_TAG: "2022-08-04-crosvm-opaque-fd"
DEBIAN_X86_BUILD_IMAGE_PATH: "debian/x86_build"
- DEBIAN_BUILD_TAG: "2022-08-04-zstd"
+ DEBIAN_BUILD_TAG: "2022-07-14-directx-headers"
DEBIAN_X86_BUILD_MINGW_IMAGE_PATH: "debian/x86_build-mingw"
- DEBIAN_BUILD_MINGW_TAG: "2022-08-04-zstd"
+ DEBIAN_BUILD_MINGW_TAG: "2022-07-14-directx-headers"
DEBIAN_X86_TEST_BASE_IMAGE: "debian/x86_test-base"
DEBIAN_X86_TEST_IMAGE_PATH: "debian/x86_test-gl"
- DEBIAN_X86_TEST_GL_TAG: "2022-08-04-crosvm-base"
- DEBIAN_X86_TEST_VK_TAG: "2022-08-04-crosvm-base"
+ DEBIAN_X86_TEST_GL_TAG: "2022-08-04-crosvm-opaque-fd"
+ DEBIAN_X86_TEST_VK_TAG: "2022-08-04-crosvm-opaque-fd"
FEDORA_X86_BUILD_TAG: "2022-04-24-spirv-tools-5"
- KERNEL_ROOTFS_TAG: "2022-08-04-virgl-update"
+ KERNEL_ROOTFS_TAG: "2022-07-06-virgl-update"
WINDOWS_X64_VS_PATH: "windows/x64_vs"
WINDOWS_X64_VS_TAG: "2022-06-15-vs-winsdk"