public inbox for buildroot@busybox.net
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v4 0/5] Add virglrenderer support
@ 2026-03-17 22:16 Joseph Kogut
  2026-03-17 22:16 ` [Buildroot] [PATCH v4 1/5] package/libepoxy: remove gl/egl dependency Joseph Kogut
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Joseph Kogut @ 2026-03-17 22:16 UTC (permalink / raw)
  To: buildroot
  Cc: Adrian Perez de Castro, Eric Le Bihan, Romain Naour, Joseph Kogut,
	Joseph Kogut

Hello,

This patch series adds support for building the virglrenderer library in
buildroot.

Virglrenderer is a userspace library used to support rendering and
compute in virtual machines over virtio-gpu. Virglrenderer supports
serialized API level access to OpenGL and Vulkan through virgl and venus
respectively, as well as mediated DRM level access using host native
context [0]. Notably libkrun [1] and rutabaga_gfx [2] are also capable of
utilizing virglrenderer.

The first patch removes libepoxy's dependency on EGL/GL(X), as it may
have depended on them in the past, but now builds without any EGL/GLX
support. This allows virglrenderer to build with its libepoxy
dependency, without actually depending on EGL/GLX.

This enables, for example, headless compute through Vulkan using Venus
or host native context inside virtual machines.

I'm interested in feedback on this change in particular, as it may have
second order effects on other packages.

The second patch adds the new virglrenderer package. Optional configs
enable VirGL (API-level OpenGL passthrough), Venus (API-level Vulkan
passthrough), hardware accelerated video encode/decode through VA-API,
and DRM driver specific backends for host native context support.

The third patch adds a patch from upstream virglrenderer that fixes a
build issue with glibc 2.43.

The fourth patch adds an OpenGL config for qemu.

The fifth patch adds a qemu virglrenderer config that selects OpenGL
support, as virgl/venus support in qemu currently requires a GL
accelerated display frontend (a patch series on the mailing list [3] is
proposing decoupling display GL support from Venus). Other VMMs
such as libkrun don't suffer from the same coupling currently.

For v4 of the series, I realized enabling DRM backends with the optional
dependency on specific Mesa drivers didn't make sense. Host native
context depends on specific *host kernel* interfaces, and the host may
or may not have Mesa at all.

If the host does have Mesa, and a specific DRM consumer (i.e. a vendor's
gallium/vulkan driver) is enabled, it's reasonable to assume that the
host supports that DRM interface, and we should enable the corresponding
DRM backend. For cases where the guest alone runs mesa (headless
compute), I introduced explicit configs to enable DRM backends.

Tested with llama-bench running with the vulkan backend in a nested VM. 
As seen below, the nested guest is sending commands to the host through
virtio-gpu twice.

        # llama-bench -m llama-2-7b.Q4_0.gguf -ngl 100 
        ggml_vulkan: Found 1 Vulkan devices:
        ggml_vulkan: 0 = Virtio-GPU Venus (Virtio-GPU Venus (AMD Radeon RX 6900 XT (RADV NAVI21))) (venus) | uma: 0 | fp16: 1 | warp size: 64 | shared memory: 65536 | int dot: 1 | matrix cores: none
        | model                          |       size |     params | backend    | ngl |            test |                  t/s |
        | ------------------------------ | ---------: | ---------: | ---------- | --: | --------------: | -------------------: |
        | llama 7B Q4_0                  |   3.56 GiB |     6.74 B | Vulkan     | 100 |           pp512 |      1220.99 ± 10.12 |
        | llama 7B Q4_0                  |   3.56 GiB |     6.74 B | Vulkan     | 100 |           tg128 |         82.24 ± 1.00 |

        build: unknown (0)

More information about the benchmark and results from other hardware on
the llama.cpp GitHub discussion here [4].

Build tested with several configs, to ensure correct dependencies and
configuration. Not all toolchains build every configuration
successfully, but every configuration has multiple passing builds.
Failures generally are from warnings treated as errors by default. 

-- qemu-virgl-egl --
BR2_PACKAGE_MESA3D=y
BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_SOFTPIPE=y
BR2_PACKAGE_MESA3D_OPENGL_EGL=y
BR2_PACKAGE_QEMU=y
BR2_PACKAGE_QEMU_SYSTEM=y
BR2_PACKAGE_QEMU_SYSTEM_TCG=y
BR2_PACKAGE_QEMU_VIRGLRENDERER=y

-- qemu-virgl-glx --
BR2_PACKAGE_MESA3D=y
BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_SOFTPIPE=y
BR2_PACKAGE_MESA3D_OPENGL_GLX=y
BR2_PACKAGE_QEMU=y
BR2_PACKAGE_QEMU_SYSTEM=y
BR2_PACKAGE_QEMU_SYSTEM_TCG=y
BR2_PACKAGE_QEMU_VIRGLRENDERER=y
BR2_PACKAGE_XORG7=y

-- virglrenderer-venus --
BR2_PACKAGE_VIRGLRENDERER=y
BR2_PACKAGE_VIRGLRENDERER_VENUS=y

-- virglrenderer-drm-amdgpu --
BR2_PACKAGE_MESA3D=y
BR2_PACKAGE_MESA3D_VULKAN_DRIVER_AMD=y
BR2_PACKAGE_VIRGLRENDERER=y

Feedback welcome.

[0] https://www.collabora.com/news-and-blog/blog/2025/01/15/the-state-of-gfx-virtualization-using-virglrenderer/
[1] https://github.com/containers/libkrun
[2] https://github.com/magma-gpu/rutabaga_gfx
[3] https://lore.kernel.org/qemu-devel/20260317182049.33848-1-lucaaamaral@gmail.com/
[4] https://github.com/ggml-org/llama.cpp/discussions/10879

Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
---
Changes in v4:
- Removed libepoxy dependency on GL/EGL
- Introduce explicit configs for virglrenderer DRM backends, virgl
  (see above note)
- Moved virglrenderer Kconfig from Libraries -> Graphics to 'Graphics
  libraries and applications' (next to mesa3d && X.org)
- Add a patch from upstream virglrenderer to fix glibc 2.43 builds
- select libdrm in virglrenderer only when required (drm backends,
  video)
- BR2_PACKAGE_VIRGLRENDERER_DRM_BACKEND_MSM depends on !BR2_arm
- Explicitly configure GLX and/or EGL when
  BR2_PACKAGE_VIRGLRENDERER_VIRGL=y
- Separate comments for qemu GL/virglrenderer [Romain]
- Split up qemu feature configs into separate commits [Romain]
- Link to v3: https://lore.kernel.org/buildroot/20260219-virglrenderer-v3-0-e2ff1a23be3f@gmail.com/

Changes in v3:
- Bump version to v1.3.0
- Add optional deps for panfrost and i915 native context (new)
- Add config for vaapi support
- Remove GLX in favor of EGL
- Update qemu docs links, as previous ones 404 [Romain]
- Fix invalid config reference in BR2_PACKAGE_QEMU_VIRGLRENDERER
  [Romain]
- Select libepoxy when enabling OpenGL support in qemu [Romain]
- Add depends on gcc >= 4.1 to virglrenderer (from meson.build)
- Add depends on libgbm to virglrenderer [Romain]
- Add comments for missing dependencies to virglrenderer Kconfig
- Select vulkan-headers when venus is enabled [Romain]
- Disable venus explicitly when the symbol isn't selected
- Link to v2: https://lore.kernel.org/buildroot/20251203-virglrenderer-v2-v2-0-2846fc1a579a@gmail.com

Changes in v2:
- Rebase onto next (python-glslang patch merged)
- Bump version to v1.2.0
- Remove hidden configs for virglrenderer vDRM backends [Romain]
- Fixed typo in qemu/Config.in [Romain]
- Split up configs for qemu OpenGL and virglrenderer support [Romain]
- More detailed qemu config help messages
- Link to v1: https://lore.kernel.org/r/20250618-virglrenderer-upstream-v1-0-57525ac8406e@gmail.com

---
Joseph Kogut (5):
      package/libepoxy: remove gl/egl dependency
      package/virglrenderer: new package
      package/virglrenderer: Fix build with glibc 2.43
      package/qemu: add OpenGL config
      package/qemu: add virglrenderer support

 DEVELOPERS                                         |   1 +
 package/Config.in                                  |   1 +
 package/libepoxy/Config.in                         |   4 -
 package/qemu/Config.in                             |  31 +++++++
 package/qemu/qemu.mk                               |  15 ++-
 .../0001-fix-build-with-glibc-2.43.patch           |  39 ++++++++
 package/virglrenderer/Config.in                    | 101 +++++++++++++++++++++
 package/virglrenderer/virglrenderer.hash           |   5 +
 package/virglrenderer/virglrenderer.mk             |  60 ++++++++++++
 9 files changed, 252 insertions(+), 5 deletions(-)
---
base-commit: e555590b94532097c1319b9450ac84fab06b758b
change-id: 20260219-virglrenderer-c4dad969ad89

Best regards,
-- 
Joseph Kogut <joseph.kogut@gmail.com>

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-03-18 19:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-17 22:16 [Buildroot] [PATCH v4 0/5] Add virglrenderer support Joseph Kogut
2026-03-17 22:16 ` [Buildroot] [PATCH v4 1/5] package/libepoxy: remove gl/egl dependency Joseph Kogut
2026-03-17 22:16 ` [Buildroot] [PATCH v4 2/5] package/virglrenderer: new package Joseph Kogut
2026-03-17 22:16 ` [Buildroot] [PATCH v4 3/5] package/virglrenderer: Fix build with glibc 2.43 Joseph Kogut
2026-03-18 19:07   ` Joseph Kogut
2026-03-17 22:16 ` [Buildroot] [PATCH v4 4/5] package/qemu: add OpenGL config Joseph Kogut
2026-03-17 22:16 ` [Buildroot] [PATCH v4 5/5] package/qemu: add virglrenderer support Joseph Kogut

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox