Merge pull request 'qemu-wayland: upgrade to latest 8.2.0 & enable virtio-audio' (#657) from Mic92-wayland-update into main
All checks were successful
assets1 / test (push) Successful in 20s
checks / test (push) Successful in 29s
checks-impure / test (push) Successful in 1m3s

This commit is contained in:
clan-bot 2023-12-21 14:54:23 +00:00
commit d73b04bdfa
8 changed files with 61 additions and 38 deletions

View File

@ -1,19 +1,28 @@
{ clangStdenv
, fetchgit
, cmake
, lib
}:
clangStdenv.mkDerivation {
pname = "aemu";
version = "unstable-2023-11-10";
version = "unstable-2023-08-31";
src = fetchgit {
url = "https://android.googlesource.com/platform/hardware/google/aemu";
rev = "ed69e33fb47e6cbe1b1d07c63d4d293dabc770f6";
hash = "sha256-HYwGT48fPC3foqYvhw+RUsnkoEHgQXfMFGQVSpDu4v4=";
rev = "caf5a079f321b6c60ab7b4bf6e5516378c6a7b37";
hash = "sha256-JE0w9/1cSXDIfyISxE/CHv35gv1xyNwbrW24rAKAZVs=";
};
cmakeFlags = [
"-DAEMU_COMMON_GEN_PKGCONFIG=ON"
"-DAEMU_COMMON_BUILD_CONFIG=gfxstream"
];
nativeBuildInputs = [ cmake ];
meta = with lib; {
description = "Utility library for common functions used in the Android Emulator";
homepage = "https://android.googlesource.com/platform/hardware/google/aemu";
license = licenses.asl20;
platforms = platforms.linux;
maintainers = [ maintainers.mic92 ];
};
}

View File

@ -19,9 +19,11 @@ log = logging.getLogger(__name__)
def graphics_options(vm: VmConfig) -> list[str]:
common = ["-audio", "driver=pa,model=virtio"]
if vm.wayland:
# fmt: off
return [
*common,
"-nographic",
"-vga", "none",
"-device", "virtio-gpu-rutabaga,gfxstream-vulkan=on,cross-domain=on,hostmem=4G,wsi=headless",
@ -30,9 +32,7 @@ def graphics_options(vm: VmConfig) -> list[str]:
else:
# fmt: off
return [
"-audiodev", "spice,id=audio0",
"-device", "intel-hda",
"-device", "hda-duplex,audiodev=audio0",
*common,
"-vga", "none",
"-display", "gtk,gl=on",
"-device", "virtio-gpu-gl",

View File

@ -10,19 +10,21 @@
, glm
, libglvnd
, xorg
, lib
, vulkan-loader
}:
clangStdenv.mkDerivation {
pname = "gfxstream";
version = "unstable-2023-12-11";
version = "unstable-2023-12-19";
src = fetchgit {
url = "https://android.googlesource.com/platform/hardware/google/gfxstream";
rev = "000a701a0c52c90e0c1e1fcd605be94b85b55f92";
hash = "sha256-j8oBT/7xnvIv6IhNrPxHG5fr2nodWbeHX7KalCGStY0=";
rev = "5ef37b16f4777f6052903ffcdf96ad0bb87e1572";
hash = "sha256-xUKDGTwF05oojuFhs1ruDPmRdOnkGuYo4IK7KdTYZ0k=";
};
postPatch = ''
ln common/etc/etc.cpp host/compressedTextureFormats/etc.cpp
ln common/etc/etc.cpp host/gl/glestranslator/GLcommon/etc.cpp
ln -s common/etc/etc.cpp host/compressedTextureFormats/etc.cpp
ln -s common/etc/etc.cpp host/gl/glestranslator/GLcommon/etc.cpp
'';
preConfigure = ''
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I$(pwd)/common/etc/include"
@ -38,10 +40,21 @@ clangStdenv.mkDerivation {
mesonFlags = [
"-Ddecoders=gles,vulkan,composer"
];
postFixup = ''
patchelf --set-rpath "$(patchelf --print-rpath "$f"):${vulkan-loader}/lib" "$out/lib/libgfxstream_backend.so"
'';
nativeBuildInputs = [
meson
pkg-config
ninja
python3
];
meta = with lib; {
description = "Graphics Streaming Kit is a code generator that makes it easier to serialize and forward graphics API calls i.e. for remote rendering.";
homepage = "https://android.googlesource.com/platform/hardware/google/gfxstream";
license = licenses.asl20;
platforms = platforms.linux;
maintainers = with maintainers; [ mic92 ];
};
}

View File

@ -1,15 +1,9 @@
{ qemu_kvm, rutabaga-gfx-ffi, fetchurl, lib, vulkan-loader }:
{ qemu_kvm, rutabaga-gfx-ffi, fetchurl }:
qemu_kvm.overrideAttrs (old: {
src = fetchurl {
url = "https://download.qemu.org/qemu-8.2.0-rc3.tar.xz";
hash = "sha256-YkHs19gZ+TbPd3O5RnBV9av3mJzdrrEcFKGIDv8AOrs=";
url = "https://download.qemu.org/qemu-8.2.0.tar.xz";
hash = "sha256-vwDS+hIBDfiwrekzcd71jmMssypr/cX1oP+Oah+xvzI=";
};
postFixup = (old.postFixup or "") + ''
for bin in $out/bin/qemu-system-*; do
wrapProgram $bin \
--prefix LD_LIBRARY_PATH ':' ${lib.getLib vulkan-loader}/lib
done
'';
buildInputs = old.buildInputs ++ [ rutabaga-gfx-ffi ];
})

View File

@ -1,4 +1,4 @@
From 7ca362d01f265ef7eac0532e0e2b3b8acce1287c Mon Sep 17 00:00:00 2001
From 4cbcc9a9dab2a88d864e19000fdffd7623540002 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
Date: Thu, 7 Dec 2023 17:09:28 +0100
Subject: [PATCH 1/3] rutabaga_gfx: don't clone wayland memfd file descriptor
@ -51,10 +51,10 @@ index d15fe81bd..885c6c9d8 100644
map_info: u32,
) -> RutabagaResult<MemoryMapping> {
diff --git a/rutabaga_gfx/src/rutabaga_os/sys/linux/memory_mapping.rs b/rutabaga_gfx/src/rutabaga_os/sys/linux/memory_mapping.rs
index 73e5db169..f18e3b80a 100644
index 7eeb33f40..6d9f19124 100644
--- a/rutabaga_gfx/src/rutabaga_os/sys/linux/memory_mapping.rs
+++ b/rutabaga_gfx/src/rutabaga_os/sys/linux/memory_mapping.rs
@@ -38,7 +38,7 @@ fn drop(&mut self) {
@@ -39,7 +39,7 @@ fn drop(&mut self) {
impl MemoryMapping {
pub fn from_safe_descriptor(

View File

@ -1,4 +1,4 @@
From 76c69111118b9a63cde378f754897f8bdaf123dd Mon Sep 17 00:00:00 2001
From cfeedccee6c6e7c309369b5dc37b6525aac859b6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
Date: Thu, 7 Dec 2023 18:45:37 +0100
Subject: [PATCH 2/3] rutabaga_gfx: super ugly workaround to get private
@ -9,11 +9,11 @@ Content-Transfer-Encoding: 8bit
Signed-off-by: Jörg Thalheim <joerg@thalheim.io>
---
.../rutabaga_os/sys/linux/memory_mapping.rs | 35 +++++++++++++++++--
1 file changed, 33 insertions(+), 2 deletions(-)
.../rutabaga_os/sys/linux/memory_mapping.rs | 34 +++++++++++++++++--
1 file changed, 32 insertions(+), 2 deletions(-)
diff --git a/rutabaga_gfx/src/rutabaga_os/sys/linux/memory_mapping.rs b/rutabaga_gfx/src/rutabaga_os/sys/linux/memory_mapping.rs
index f18e3b80a..fe5eb684e 100644
index 6d9f19124..afd8771c8 100644
--- a/rutabaga_gfx/src/rutabaga_os/sys/linux/memory_mapping.rs
+++ b/rutabaga_gfx/src/rutabaga_os/sys/linux/memory_mapping.rs
@@ -9,6 +9,7 @@
@ -24,11 +24,9 @@ index f18e3b80a..fe5eb684e 100644
use crate::rutabaga_os::descriptor::SafeDescriptor;
use crate::rutabaga_utils::RutabagaError;
@@ -51,15 +52,45 @@ pub fn from_safe_descriptor(
};
if let Some(non_zero_size) = non_zero_opt {
+
@@ -55,14 +56,43 @@ pub fn from_safe_descriptor(
// TODO(b/315870313): Add safety comment
#[allow(clippy::undocumented_unsafe_blocks)]
let addr = unsafe {
- mmap(
+ let mut res = mmap(

View File

@ -1,4 +1,4 @@
From 37d51bb5bcf329bd098a0365dcbfbafc2222fddf Mon Sep 17 00:00:00 2001
From 83d8aa249fb4cd221aa7dbb75403553d5c96e04b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
Date: Thu, 14 Dec 2023 14:54:51 +0100
Subject: [PATCH 3/3] rutabaga_gfx: fix stale cross-domain keymap resources
@ -16,7 +16,7 @@ Signed-off-by: Jörg Thalheim <joerg@thalheim.io>
1 file changed, 68 insertions(+), 87 deletions(-)
diff --git a/rutabaga_gfx/src/cross_domain/mod.rs b/rutabaga_gfx/src/cross_domain/mod.rs
index 6eb7ec988..34b51d4da 100644
index 260c1b6b7..2a1fb00e3 100644
--- a/rutabaga_gfx/src/cross_domain/mod.rs
+++ b/rutabaga_gfx/src/cross_domain/mod.rs
@@ -69,7 +69,7 @@ pub enum CrossDomainToken {

View File

@ -4,17 +4,18 @@
, pkg-config
, gfxstream
, libdrm
, lib
}:
rustPlatform.buildRustPackage {
pname = "rutabaga_gfx_ffi";
version = "unstable-2023-12-05";
version = "unstable-2023-12-20";
src = fetchFromGitHub {
owner = "google";
repo = "crosvm";
rev = "65b30e2ecede8056fdbfe8adbe52e9ff51d2a4e2";
hash = "sha256-9jzLFBqMGw3wYCL5006+7b9l/f1N2Jy3rw5rEzOr4M0=";
rev = "46279a0c03f8892f22ebd8c0dc19e4a6dc8aac41";
hash = "sha256-xHT3uWPGVqXFr5G08jliti5RXSsZLb6fH8eiy8cyzNY=";
fetchSubmodules = true;
};
@ -33,8 +34,16 @@ rustPlatform.buildRustPackage {
make install prefix=$out
'';
cargoHash = "sha256-jEhobp/ZNx5t20hBjisXR8SSn0776Jehy+RJZNSd2iA=";
cargoHash = "sha256-lOC0bK/nePSQCkxKHjD6xAVyvx0xGRFm/5+2jEKfwQs=";
nativeBuildInputs = [ pkg-config ];
buildInputs = [ gfxstream aemu libdrm ];
meta = with lib; {
description = "FFI bindings for rutabaga_gfx";
homepage = "https://crosvm.dev/book/appendix/rutabaga_gfx.html";
license = licenses.bsd3;
platforms = platforms.linux;
maintainers = with maintainers; [ mic92 ];
};
}