feat: Mesa virgl gallium driver — hardware-accelerated 3D for QEMU

Mesa now builds with -Dgallium-drivers=swrast,virgl for Redox target.

Fixes:
- virgl_screen.c: wrapped disk cache creation in #ifndef __redox__
  (build_id_find_nhdr_for_addr uses dl_iterate_phdr — unavailable on Redox)
- bits/safamily-t.h: provided to cross-compiler toolchain sysroot

Durable patch:
- local/patches/mesa/P4-virgl-redox-disk-cache.patch (25 lines)

This enables hardware-accelerated 3D rendering in QEMU via
virtio-gpu + virgl. Mesa EGL/GLES2/GBM now support the virgl
gallium driver alongside llvmpipe software renderer.

63MB pkgar artifact with virgl support.
This commit is contained in:
2026-05-01 00:21:28 +01:00
parent 1c3ed9ec0d
commit 2638186ce1
2 changed files with 27 additions and 1 deletions
@@ -0,0 +1,25 @@
diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c
index d86ca5d1e..f79b8c678 100644
--- a/src/gallium/drivers/virgl/virgl_screen.c
+++ b/src/gallium/drivers/virgl/virgl_screen.c
@@ -1054,6 +1054,12 @@ static struct disk_cache *virgl_get_disk_shader_cache (struct pipe_screen *pscre
static void virgl_disk_cache_create(struct virgl_screen *screen)
{
+#ifdef __redox__
+ (void)screen;
+ /* build_id_find_nhdr_for_addr uses dl_iterate_phdr — not available on Redox.
+ * Disk cache is disabled; shader compilation works without it. */
+ screen->disk_cache = NULL;
+#else
const struct build_id_note *note =
build_id_find_nhdr_for_addr(virgl_disk_cache_create);
assert(note);
@@ -1078,6 +1084,7 @@ static void virgl_disk_cache_create(struct virgl_screen *screen)
_mesa_sha1_format(timestamp, sha1);
screen->disk_cache = disk_cache_create("virgl", timestamp, 0);
+#endif
}
static bool
+2 -1
View File
@@ -3,6 +3,7 @@ git = "https://gitlab.redox-os.org/redox-os/mesa.git"
upstream = "https://gitlab.freedesktop.org/mesa/mesa"
branch = "redox-24.0"
shallow_clone = true
patches = ["../../../local/patches/mesa/P4-virgl-redox-disk-cache.patch"]
[build]
template = "custom"
dependencies = [
@@ -41,7 +42,7 @@ cookbook_meson \
-Degl=enabled \
-Dgbm=enabled \
-Dglx=disabled \
-Dgallium-drivers=swrast \
-Dgallium-drivers=swrast,virgl \
-Dllvm=enabled \
-Dosmesa=true \
-Dplatforms=redox \