From: Demi Marie Obenour <demiobenour@gmail.com>
To: Spectrum OS Development <devel@spectrum-os.org>
Cc: Alyssa Ross <hi@alyssa.is>, Demi Marie Obenour <demiobenour@gmail.com>
Subject: [PATCH] GPU acceleration
Date: Tue, 20 Jan 2026 22:26:39 -0500 [thread overview]
Message-ID: <20260120-gpu-accel-2-v1-1-ab80ef58d44e@gmail.com> (raw)
This exposes GPU acceleration to VMs via virtio-GPU native contexts on
AMD and Qualcomm GPUs. Apple GPU support also exists but might require
patches to virglrenderer that are not upstream yet.
On a system with an AMD GPU, this has been tested by running vkcube in
the VM. It reports that the AMD GPU is being used for rendering.
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
---
I used an empty string for the hashes in 'gitfetch' and
'buildRustPackage'. This is, of course, incorrect. The correct value
according to my own testing is
"sha256-EOMkQ0aPRjsowdGuZjy5K1yKyKEzd5AVYxaECTz7n6k=" (git hash) and
"sha256-k3dmxIuCQoOrn/VwauTdzuRw/XKQB6LPLgO5ql0rE7E=" (cargoHash).
However, these should be validated before applying them, which is why I
didn't include them in the patch themselves. This is a security
precaution: anyone who wants to inject malicious content must serve it
to multiple people, not just one.
---
.../template/data/service/vhost-user-gpu/run | 2 +-
img/app/Makefile | 2 +-
img/app/default.nix | 14 ++++++++++++--
img/app/image/etc/mdev.conf | 1 +
.../notification-fd | 0
.../notification-fd.license | 0
.../{wayland-proxy-virtwl => wl-cross-domain-proxy}/run | 17 +++++------------
.../type | 0
.../type.license | 0
9 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/host/rootfs/image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/vhost-user-gpu/run b/host/rootfs/image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/vhost-user-gpu/run
index fb9ac9971aef82dabe0b54c1299ac8c66d133eb5..87d72f55e293ea81b6f4aa12786a993bafc623e2 100755
--- a/host/rootfs/image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/vhost-user-gpu/run
+++ b/host/rootfs/image/etc/s6-linux-init/run-image/service/vm-services/template/data/service/vhost-user-gpu/run
@@ -42,4 +42,4 @@ bwrap
crosvm --no-syslog device gpu
--fd 0
--wayland-sock $WAYLAND_DISPLAY
- --params "{\"context-types\":\"cross-domain\"}"
+ --params "{\"context-types\":\"cross-domain:drm\"}"
diff --git a/img/app/Makefile b/img/app/Makefile
index 2e720a91b4cc98a780aae90435f018ba2dd2d965..d34bcf2604d43eaa55d9100711374eba689bfdce 100644
--- a/img/app/Makefile
+++ b/img/app/Makefile
@@ -77,7 +77,7 @@ start-vhost-user-gpu:
$(CROSVM_DEVICE_GPU) \
--socket build/vhost-user-gpu.sock \
--wayland-sock "$$XDG_RUNTIME_DIR/$$WAYLAND_DISPLAY" \
- --params '{"context-types":"cross-domain"}' &
+ --params '{"context-types":"cross-domain:drm"}' &
while ! [ -S build/vhost-user-gpu.sock ] && sleep .1; do :; done
.PHONY: start-vhost-user-gpu
diff --git a/img/app/default.nix b/img/app/default.nix
index 71e6fa02e78553d027d59f5b2ff728830276d480..1ce32258edf3f0ae535e050745e60d1d193a838e 100644
--- a/img/app/default.nix
+++ b/img/app/default.nix
@@ -5,10 +5,20 @@ import ../../lib/call-package.nix (
{ spectrum-app-tools, spectrum-build-tools, src, terminfo
, lib, appimageTools, buildFHSEnv, runCommand, stdenvNoCC, writeClosure
, erofs-utils, jq, s6-rc, util-linux, xorg
-, cacert, linux_latest
+, cacert, linux_latest, rustPlatform, fetchgit
}:
let
+ wl-cross-domain-proxy = rustPlatform.buildRustPackage rec {
+ pname = "wl-cross-domain-proxy";
+ version = "0.0.0";
+ src = fetchgit {
+ url = "https://codeberg.org/drakulix/wl-cross-domain-proxy";
+ rev = "167b5ade788d297cd19929c2f367484a09a87316";
+ hash = "";
+ };
+ cargoHash = "";
+ };
kernelTarget =
if stdenvNoCC.hostPlatform.isx86 then
# vmlinux.bin is the stripped version of vmlinux.
@@ -75,7 +85,6 @@ let
pkgs.s6-rc
pkgs.socat
pkgs.systemd
- pkgs.wayland-proxy-virtwl
pkgs.wireplumber
pkgs.xdg-desktop-portal
pkgs.xdg-desktop-portal-gtk
@@ -84,6 +93,7 @@ let
kernel.modules
spectrum-app-tools
terminfo
+ wl-cross-domain-proxy
];
})).fhsenv;
diff --git a/img/app/image/etc/mdev.conf b/img/app/image/etc/mdev.conf
index 33a07d6b1001bd883a3d54e706bc2eb30ca32d0b..bdfdf4b1688dff612c8a5a219c6530c7434668e7 100644
--- a/img/app/image/etc/mdev.conf
+++ b/img/app/image/etc/mdev.conf
@@ -5,6 +5,7 @@
$INTERFACE=.* 0:0 0 ! +/etc/mdev/iface
$MODALIAS=virtio:d0000001Av.* 0:0 0 ! +/etc/mdev/virtiofs
dri/card0 user:user 660 +background { /etc/mdev/listen card0 }
+dri/renderD128 user:user 660 +background { /etc/mdev/listen renderD128 }
-SUBSYSTEM=sound;.* pipewire:pipewire 660
snd/controlC0 pipewire:pipewire 660 +background { /etc/mdev/listen controlC0 }
diff --git a/img/app/image/etc/s6-rc/wayland-proxy-virtwl/notification-fd b/img/app/image/etc/s6-rc/wl-cross-domain-proxy/notification-fd
similarity index 100%
rename from img/app/image/etc/s6-rc/wayland-proxy-virtwl/notification-fd
rename to img/app/image/etc/s6-rc/wl-cross-domain-proxy/notification-fd
diff --git a/img/app/image/etc/s6-rc/wayland-proxy-virtwl/notification-fd.license b/img/app/image/etc/s6-rc/wl-cross-domain-proxy/notification-fd.license
similarity index 100%
rename from img/app/image/etc/s6-rc/wayland-proxy-virtwl/notification-fd.license
rename to img/app/image/etc/s6-rc/wl-cross-domain-proxy/notification-fd.license
diff --git a/img/app/image/etc/s6-rc/wayland-proxy-virtwl/run b/img/app/image/etc/s6-rc/wl-cross-domain-proxy/run
similarity index 50%
rename from img/app/image/etc/s6-rc/wayland-proxy-virtwl/run
rename to img/app/image/etc/s6-rc/wl-cross-domain-proxy/run
index 5d06b7aea93d790a0aff4c3aed0e821caddadfee..5ae3b96aa639053ff2f70e6b7ddc420fae3c53f1 100755
--- a/img/app/image/etc/s6-rc/wayland-proxy-virtwl/run
+++ b/img/app/image/etc/s6-rc/wl-cross-domain-proxy/run
@@ -1,19 +1,11 @@
#!/bin/execlineb -P
# SPDX-License-Identifier: EUPL-1.2+
# SPDX-FileCopyrightText: 2023-2024 Alyssa Ross <hi@alyssa.is>
-#
-# Directory creation (if it's copyrightable):
-# SPDX-License-Identifier: MIT
-# SPDX-FileCopyrightText: 2022 Unikie
-
-foreground { mkdir /tmp/.X11-unix }
+# SPDX-FileCopyrightText: 2026 Demi Marie Obenour <demiobenour@gmail.com>
s6-ipcserver-socketbinder -B /run/wayland
fdmove -c 3 0
-s6-ipcserver-socketbinder -B /tmp/.X11-unix/X0
-fdmove -c 4 0
-
redirfd -r 0 /dev/null
# Notify readiness.
@@ -21,11 +13,12 @@ if { fdmove 1 5 echo }
fdclose 5
if { /etc/mdev/wait card0 }
+if { /etc/mdev/wait renderD128 }
-export LISTEN_FDS 2
-export LISTEN_FDNAMES wayland:x11
+export LISTEN_FDS 1
+export LISTEN_FDNAMES wayland
getpid LISTEN_PID
s6-setuidgid user
-wayland-proxy-virtwl --virtio-gpu --x-display=0
+wl-cross-domain-proxy --listen-fd
diff --git a/img/app/image/etc/s6-rc/wayland-proxy-virtwl/type b/img/app/image/etc/s6-rc/wl-cross-domain-proxy/type
similarity index 100%
rename from img/app/image/etc/s6-rc/wayland-proxy-virtwl/type
rename to img/app/image/etc/s6-rc/wl-cross-domain-proxy/type
diff --git a/img/app/image/etc/s6-rc/wayland-proxy-virtwl/type.license b/img/app/image/etc/s6-rc/wl-cross-domain-proxy/type.license
similarity index 100%
rename from img/app/image/etc/s6-rc/wayland-proxy-virtwl/type.license
rename to img/app/image/etc/s6-rc/wl-cross-domain-proxy/type.license
---
base-commit: 8a6e4f03951d80382e5dcf1a159d37dec8376a0b
change-id: 20260120-gpu-accel-2-7eec0ac9b071
--
Sincerely,
Demi Marie Obenour (she/her/hers)
next reply other threads:[~2026-01-21 3:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-21 3:26 Demi Marie Obenour [this message]
2026-01-29 13:11 ` [PATCH] GPU acceleration Alyssa Ross
2026-01-29 14:10 ` Alyssa Ross
2026-02-01 19:38 ` Demi Marie Obenour
2026-02-02 10:56 ` Alyssa Ross
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260120-gpu-accel-2-v1-1-ab80ef58d44e@gmail.com \
--to=demiobenour@gmail.com \
--cc=devel@spectrum-os.org \
--cc=hi@alyssa.is \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://spectrum-os.org/git/crosvm
https://spectrum-os.org/git/doc
https://spectrum-os.org/git/mktuntap
https://spectrum-os.org/git/nixpkgs
https://spectrum-os.org/git/spectrum
https://spectrum-os.org/git/ucspi-vsock
https://spectrum-os.org/git/www
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).