patches and low-level development discussion
 help / color / mirror / code / Atom feed
From: Alyssa Ross <hi@alyssa.is>
To: Demi Marie Obenour <demiobenour@gmail.com>
Cc: Spectrum OS Development <devel@spectrum-os.org>
Subject: Re: [PATCH] GPU acceleration
Date: Thu, 29 Jan 2026 15:10:22 +0100	[thread overview]
Message-ID: <87bjic4ii9.fsf@alyssa.is> (raw)
In-Reply-To: <20260120-gpu-accel-2-v1-1-ab80ef58d44e@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 5314 bytes --]

Worth marking patches like this as RFC or similar in future, so
everybody looking at it is on the same page about its status.  (I'm
assuming this was meant as a proof of concept and not meant to be
applied as is.)

Demi Marie Obenour <demiobenour@gmail.com> writes:

> 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\"}"

I suppose we'll need to get some sort of graceful fallback into
crosvm/rutabaga, or to somehow detect native contexts support in this
script before we enable it on the crosvm command line?

2026-01-29 14:06:30.082434936  [2026-01-29T14:06:30.082073581+00:00 ERROR rutabaga_gfx::virgl_renderer] failed to initialize drm renderer
2026-01-29 14:06:30.082842461  [2026-01-29T14:06:30.082652949+00:00 WARN  rutabaga_gfx::rutabaga_core] error initializing gpu backend=virglrenderer, falling back to 2d.
2026-01-29 14:06:30.099779984  [2026-01-29T14:06:30.099379669+00:00 WARN  devices::virtio::gpu::virtio_gpu] virtio-gpu get_capset_info(index=1) failed. intentionally poisoning response

---

FYI: I needed the following additional diff to test the rootfs with this
patch:

diff --git a/img/app/default.nix b/img/app/default.nix
index 1ce3225..d19f5f8 100644
--- a/img/app/default.nix
+++ b/img/app/default.nix
@@ -15,9 +15,9 @@ let
     src = fetchgit {
       url = "https://codeberg.org/drakulix/wl-cross-domain-proxy";
       rev = "167b5ade788d297cd19929c2f367484a09a87316";
-      hash = "";
+      hash = "sha256-EOMkQ0aPRjsowdGuZjy5K1yKyKEzd5AVYxaECTz7n6k=";
     };
-    cargoHash = "";
+    cargoHash = "sha256-k3dmxIuCQoOrn/VwauTdzuRw/XKQB6LPLgO5ql0rE7E=";
   };
   kernelTarget =
     if stdenvNoCC.hostPlatform.isx86 then
diff --git a/img/app/file-list.mk b/img/app/file-list.mk
index 815b63a..443e6f2 100644
--- a/img/app/file-list.mk
+++ b/img/app/file-list.mk
@@ -41,7 +41,6 @@ LINKS = \
 S6_RC_FILES = \
 	image/etc/s6-rc/app/dependencies.d/dbus \
 	image/etc/s6-rc/app/dependencies.d/pipewire \
-	image/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl \
 	image/etc/s6-rc/app/run \
 	image/etc/s6-rc/app/type \
 	image/etc/s6-rc/dbus-vsock/notification-fd \
@@ -64,10 +63,10 @@ S6_RC_FILES = \
 	image/etc/s6-rc/pipewire/notification-fd \
 	image/etc/s6-rc/pipewire/run \
 	image/etc/s6-rc/pipewire/type \
-	image/etc/s6-rc/wayland-proxy-virtwl/notification-fd \
-	image/etc/s6-rc/wayland-proxy-virtwl/run \
-	image/etc/s6-rc/wayland-proxy-virtwl/type \
 	image/etc/s6-rc/wireplumber/dependencies.d/dbus \
 	image/etc/s6-rc/wireplumber/dependencies.d/pipewire \
 	image/etc/s6-rc/wireplumber/run \
-	image/etc/s6-rc/wireplumber/type
+	image/etc/s6-rc/wireplumber/type \
+	image/etc/s6-rc/wl-cross-domain-proxy/notification-fd \
+	image/etc/s6-rc/wl-cross-domain-proxy/run \
+	image/etc/s6-rc/wl-cross-domain-proxy/type
diff --git a/img/app/image/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl b/img/app/image/etc/s6-rc/app/dependencies.d/wayland-proxy-virtwl
deleted file mode 100644
index e69de29..0000000

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

  parent reply	other threads:[~2026-01-29 14:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-21  3:26 [PATCH] GPU acceleration Demi Marie Obenour
2026-01-29 13:11 ` Alyssa Ross
2026-01-29 14:10 ` Alyssa Ross [this message]
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=87bjic4ii9.fsf@alyssa.is \
    --to=hi@alyssa.is \
    --cc=demiobenour@gmail.com \
    --cc=devel@spectrum-os.org \
    /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).