Add virglrenderer support
v7 cover Add virglrenderer support
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 two patches prepare for removing libepoxy's dependency on GL/EGL, and the third patch removes it. 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.
The fourth 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 fifth patch adds a patch from upstream virglrenderer that fixes a build issue with glibc 2.43.
The sixth patch adds an OpenGL config for qemu.
The seventh 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.
The eighth and last patch adds a new runtime test for virglrenderer with qemu using a software GL driver and a nested guest.
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/[email protected]/
[4] https://github.com/ggml-org/llama.cpp/discussions/10879
---
Changes in v7:
- History cleanup
- Link to v6: https://patch.msgid.link/[email protected]
Changes in v6:
- Add explicit EGL dependency for weston XWayland support, and only
enable XWayland glamor when libepoxy has EGL support
- Fix stale libepoxy dependency comments in wpewebkit
- Document why libepoxy can be built without GLX or EGL support
- Improve qemu OpenGL dependency comment
- Add qemu and virglrenderer comments warning when no virglrenderer
backend is enabled
- Add a runtime test for virglrenderer using nested qemu and virgl
- Link to v5: https://lore.kernel.org/r/[email protected]
Changes in v5:
- Fixed authorship, Signed-off-by, and sent from address
- Link to v4: https://lore.kernel.org/r/[email protected]
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/[email protected]/
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/[email protected]
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/[email protected]
To: [email protected]
Cc: Raphael Pavlidis <[email protected]>
Cc: Thomas Petazzoni <[email protected]>
Cc: Adrian Perez de Castro <[email protected]>
Cc: Eric Le Bihan <[email protected]>
Cc: Joseph Kogut <[email protected]>
Cc: Romain Naour <[email protected]>
---
Joseph Kogut (8):
package/weston: add EGL dependency for XWayland package/wpewebkit: fix stale libepoxy dependency comments 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 integration support/testing: add virglrenderer test
DEVELOPERS | 2 + package/Config.in | 1 + package/libepoxy/Config.in | 8 +- package/qemu/Config.in | 35 ++++++ package/qemu/qemu.mk | 15 ++- .../0001-fix-build-with-glibc-2.43.patch | 39 +++++++ package/virglrenderer/Config.in | 117 +++++++++++++++++++++ package/virglrenderer/virglrenderer.hash | 5 + package/virglrenderer/virglrenderer.mk | 60 +++++++++++ package/weston/Config.in | 6 +- package/wpewebkit/Config.in | 4 +- package/x11r7/xwayland/xwayland.mk | 2 +- .../testing/tests/package/test_virglrenderer.py | 117 +++++++++++++++++++++ .../test_virglrenderer/linux-virgl.fragment | 6 ++ .../test_virglrenderer/remove-qemu-blobs.sh | 12 +++ .../rootfs-overlay/etc/profile.d/stty-raw.sh | 3 + 16 files changed, 422 insertions(+), 10 deletions(-)
---
base-commit: 4ed01e7ed30379b0c1167a2173361269184a3c5d
change-id: 20260219-virglrenderer-c4dad969ad89
Best regards,
Signature · 6 lines
Joseph Kogut <[email protected]> _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v7 1/8 package/weston: add EGL dependency for XWayland
BR2_PACKAGE_WESTON_XWAYLAND currently depends on BR2_PACKAGE_LIBEPOXY, which implicitly requires either libGL or libEGL. However, the XWayland glamor support uses libepoxy with EGL, so express that dependency directly.
This avoids relying on libepoxy's package-level dependencies to provide the EGL backend.
--- package/weston/Config.in | 6 ++++-- package/x11r7/xwayland/xwayland.mk | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-)
package/weston/Config.in +4 -2
@@ -123,6 +123,7 @@ comment "X11 (nested) compositor needs X.org enabled" config BR2_PACKAGE_WESTON_XWAYLAND bool "XWayland support" + depends on BR2_PACKAGE_HAS_LIBEGL depends on BR2_PACKAGE_LIBEPOXY depends on BR2_PACKAGE_XORG7 # xwayland depends on BR2_USE_MMU # xwayland
@@ -136,8 +137,9 @@ config BR2_PACKAGE_WESTON_XWAYLAND select BR2_PACKAGE_XLIB_LIBXCURSOR select BR2_PACKAGE_XWAYLAND -comment "XWayland support needs libepoxy and X.org enabled" - depends on !BR2_PACKAGE_XORG7 || !BR2_PACKAGE_LIBEPOXY +comment "XWayland support needs libepoxy w/ EGL and X.org enabled" + depends on !BR2_PACKAGE_HAS_LIBEGL || !BR2_PACKAGE_XORG7 || \ + !BR2_PACKAGE_LIBEPOXY comment "XWayland support needs a toolchain w/ threads, dynamic library" depends on BR2_USE_MMU
package/x11r7/xwayland/xwayland.mk +1 -1
@@ -30,7 +30,7 @@ XWAYLAND_CONF_OPTS = \ -Ddtrace=false \ -Ddocs=false -ifeq ($(BR2_PACKAGE_LIBEPOXY),y) +ifeq ($(BR2_PACKAGE_HAS_LIBEGL)$(BR2_PACKAGE_LIBEPOXY),yy) XWAYLAND_CONF_OPTS += -Dglamor=true XWAYLAND_DEPENDENCIES += libepoxy else
Signature · 6 lines
2.54.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH v7 1/8] package/weston: add EGL dependency for XWayland
Quoted 3 lines · Joseph Kogut
BR2_PACKAGE_WESTON_XWAYLANDcurrently depends onBR2_PACKAGE_LIBEPOXY, which implicitly requires either libGL or libEGL. However, the XWayland glamor support uses libepoxy with EGL, so express that dependency
This sounds like the current situation was actually wrong, because we could
enable glamor in xwayland when libgl and no libegl is available.
BR2_aarch64=y
BR2_TOOLCHAIN_EXTERNAL=y BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_AARCH64_GLIBC_STABLE=y BR2_PACKAGE_MESA3D=y BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_ETNAVIV=y BR2_PACKAGE_MESA3D_OPENGL_GLX=y BR2_PACKAGE_XORG7=y
BR2_PACKAGE_XWAYLAND=y
BR2_PACKAGE_LIBEPOXY=y
fails with:
In file included from ../glamor/glamor_priv.h:73,
from ../glamor/glamor_composite_glyphs.c:25:../glamor/glamor_context.h:27:10: fatal error: epoxy/egl.h: No such file or directory 27 | #include <epoxy/egl.h>
| ^~~~~~~~~~~~~
Therefore I updated the commit message and applied to master, thanks.
Regards,
Arnout
Quoted 41 lines
directly.
This avoids relying on libepoxy's package-level dependencies to provide the EGL backend.
Signed-off-by Joseph Kogut <[email protected]>--- package/weston/Config.in | 6 ++++-- package/x11r7/xwayland/xwayland.mk | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-)package/weston/Config.in +4
-2@@ -123,6 +123,7 @@ comment "X11 (nested) compositor needs X.org enabled" config BR2_PACKAGE_WESTON_XWAYLAND bool "XWayland support" + depends on BR2_PACKAGE_HAS_LIBEGL depends on BR2_PACKAGE_LIBEPOXY depends on BR2_PACKAGE_XORG7 # xwayland depends on BR2_USE_MMU # xwayland@@ -136,8 +137,9 @@ config BR2_PACKAGE_WESTON_XWAYLAND select BR2_PACKAGE_XLIB_LIBXCURSOR select BR2_PACKAGE_XWAYLAND -comment "XWayland support needs libepoxy and X.org enabled" - depends on !BR2_PACKAGE_XORG7 || !BR2_PACKAGE_LIBEPOXY +comment "XWayland support needs libepoxy w/ EGL and X.org enabled" + depends on !BR2_PACKAGE_HAS_LIBEGL || !BR2_PACKAGE_XORG7 || \ + !BR2_PACKAGE_LIBEPOXY comment "XWayland support needs a toolchain w/ threads, dynamic library" depends on BR2_USE_MMUpackage/x11r7/xwayland/xwayland.mk +0
-0
package/x11r7/xwayland/xwayland.mk XWAYLAND_CONF_OPTS = \ · line 36
Quoted 8 lines
package/x11r7/xwayland/xwayland.mk +1
-1@@ -30,7 +30,7 @@ XWAYLAND_CONF_OPTS = \ -Ddtrace=false \ -Ddocs=false -ifeq ($(BR2_PACKAGE_LIBEPOXY),y) +ifeq ($(BR2_PACKAGE_HAS_LIBEGL)$(BR2_PACKAGE_LIBEPOXY),yy) XWAYLAND_CONF_OPTS += -Dglamor=true XWAYLAND_DEPENDENCIES += libepoxy else
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Thomas Perale via buildroot
AppliedRe: [Buildroot] [PATCH v7 1/8] package/weston: add EGL dependency for XWayland
In reply to Joseph KogutIn reply of:
Quoted 9 lines
BR2_PACKAGE_WESTON_XWAYLANDcurrently depends onBR2_PACKAGE_LIBEPOXY, which implicitly requires either libGL or libEGL. However, the XWayland glamor support uses libepoxy with EGL, so express that dependency directly.This avoids relying on libepoxy's package-level dependencies to provide the EGL backend.
Signed-off-by Joseph Kogut <[email protected]>
Applied to 2025.02.x & 2026.02.x. Thanks
Quoted 50 lines
--- package/weston/Config.in | 6 ++++-- package/x11r7/xwayland/xwayland.mk | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-)package/weston/Config.in +4
-2@@ -123,6 +123,7 @@ comment "X11 (nested) compositor needs X.org enabled" config BR2_PACKAGE_WESTON_XWAYLAND bool "XWayland support" + depends on BR2_PACKAGE_HAS_LIBEGL depends on BR2_PACKAGE_LIBEPOXY depends on BR2_PACKAGE_XORG7 # xwayland depends on BR2_USE_MMU # xwayland@@ -136,8 +137,9 @@ config BR2_PACKAGE_WESTON_XWAYLAND select BR2_PACKAGE_XLIB_LIBXCURSOR select BR2_PACKAGE_XWAYLAND -comment "XWayland support needs libepoxy and X.org enabled" - depends on !BR2_PACKAGE_XORG7 || !BR2_PACKAGE_LIBEPOXY +comment "XWayland support needs libepoxy w/ EGL and X.org enabled" + depends on !BR2_PACKAGE_HAS_LIBEGL || !BR2_PACKAGE_XORG7 || \ + !BR2_PACKAGE_LIBEPOXY comment "XWayland support needs a toolchain w/ threads, dynamic library" depends on BR2_USE_MMUpackage/x11r7/xwayland/xwayland.mk +1
-1@@ -30,7 +30,7 @@ XWAYLAND_CONF_OPTS = \ -Ddtrace=false \ -Ddocs=false -ifeq ($(BR2_PACKAGE_LIBEPOXY),y) +ifeq ($(BR2_PACKAGE_HAS_LIBEGL)$(BR2_PACKAGE_LIBEPOXY),yy) XWAYLAND_CONF_OPTS += -Dglamor=true XWAYLAND_DEPENDENCIES += libepoxy elseSignature · 7 lines
-- 2.54.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v7 2/8 package/wpewebkit: fix stale libepoxy dependency comments
In reply to Joseph Kogutwpewebkit depends directly on OpenGL ES and EGL support, but those dependencies are not imposed by libepoxy itself. Update the inline comments so they describe the actual dependency source before relaxing libepoxy's package-level EGL/GL dependency.
--- package/wpewebkit/Config.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
package/wpewebkit/Config.in +2 -2
@@ -38,8 +38,8 @@ config BR2_PACKAGE_WPEWEBKIT depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL depends on BR2_TOOLCHAIN_GCC_AT_LEAST_11 depends on BR2_USE_WCHAR # icu, libsoup3 - depends on BR2_PACKAGE_HAS_LIBGLES # libepoxy - depends on BR2_PACKAGE_HAS_LIBEGL # libepoxy + depends on BR2_PACKAGE_HAS_LIBGLES + depends on BR2_PACKAGE_HAS_LIBEGL # wpebackend-fdo depends on BR2_PACKAGE_WPEWEBKIT_ARCH_SUPPORTS select BR2_HOST_CMAKE_AT_LEAST_3_20 select BR2_PACKAGE_CAIRO if BR2_ENDIAN = "BIG"
Signature · 6 lines
2.54.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH v7 2/8] package/wpewebkit: fix stale libepoxy dependency comments
Quoted 6 lines · Joseph Kogut
wpewebkit depends directly on OpenGL ES and EGL support, but those dependencies are not imposed by libepoxy itself. Update the inline comments so they describe the actual dependency source before relaxing libepoxy's package-level EGL/GL dependency.
Signed-off-by Joseph Kogut <[email protected]>
Applied to master, thanks.
Regards,
Arnout
Quoted 10 lines
--- package/wpewebkit/Config.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)package/wpewebkit/Config.in +0
-0
package/wpewebkit/Config.in config BR2_PACKAGE_WPEWEBKIT · line 45
Quoted 10 lines
package/wpewebkit/Config.in +2
-2@@ -38,8 +38,8 @@ config BR2_PACKAGE_WPEWEBKIT depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL depends on BR2_TOOLCHAIN_GCC_AT_LEAST_11 depends on BR2_USE_WCHAR # icu, libsoup3 - depends on BR2_PACKAGE_HAS_LIBGLES # libepoxy - depends on BR2_PACKAGE_HAS_LIBEGL # libepoxy + depends on BR2_PACKAGE_HAS_LIBGLES + depends on BR2_PACKAGE_HAS_LIBEGL # wpebackend-fdo depends on BR2_PACKAGE_WPEWEBKIT_ARCH_SUPPORTS select BR2_HOST_CMAKE_AT_LEAST_3_20 select BR2_PACKAGE_CAIRO if BR2_ENDIAN = "BIG"
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Thomas Perale via buildroot
AppliedRe: [Buildroot] [PATCH v7 2/8] package/wpewebkit: fix stale libepoxy dependency comments
In reply to Joseph KogutIn reply of:
Quoted 6 lines
wpewebkit depends directly on OpenGL ES and EGL support, but those dependencies are not imposed by libepoxy itself. Update the inline comments so they describe the actual dependency source before relaxing libepoxy's package-level EGL/GL dependency.
Signed-off-by Joseph Kogut <[email protected]>
Applied to 2025.02.x & 2026.02.x. Thanks
Quoted 27 lines
--- package/wpewebkit/Config.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)package/wpewebkit/Config.in +2
-2@@ -38,8 +38,8 @@ config BR2_PACKAGE_WPEWEBKIT depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL depends on BR2_TOOLCHAIN_GCC_AT_LEAST_11 depends on BR2_USE_WCHAR # icu, libsoup3 - depends on BR2_PACKAGE_HAS_LIBGLES # libepoxy - depends on BR2_PACKAGE_HAS_LIBEGL # libepoxy + depends on BR2_PACKAGE_HAS_LIBGLES + depends on BR2_PACKAGE_HAS_LIBEGL # wpebackend-fdo depends on BR2_PACKAGE_WPEWEBKIT_ARCH_SUPPORTS select BR2_HOST_CMAKE_AT_LEAST_3_20 select BR2_PACKAGE_CAIRO if BR2_ENDIAN = "BIG"Signature · 7 lines
-- 2.54.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v7 3/8 package/libepoxy: remove gl/egl dependency
In reply to Joseph KogutLibepoxy is a library for handling OpenGL function pointer management.
It has backends for egl/glx, which may at one point have been mandatory to enable, but the library now builds with none of the above enabled features, as seen below.
libepoxy 1.5.10
User defined options
Cross files : /home/joseph/br-test-pkg/arm-aarch64/build/libepoxy-1.5.10//buildroot-build/cross-compilation.conf
b_pie : false
b_staticpic : true
buildtype : release
build.cmake_prefix_path: /home/joseph/br-test-pkg/arm-aarch64/host/lib/cmake
default_library : shared
docs : false
egl : no
glx : no
libdir : lib
build.pkg_config_path : /home/joseph/br-test-pkg/arm-aarch64/host/lib/pkgconfig
prefix : /usr
strip : false
tests : false
x11 : false
Removing these dependencies allows for some applications that require it as a build dependency, but otherwise can run headless or without GL, to build and function, using other graphics APIs or display pipelines.
Weston, for example, can still use Vulkan and DRM when linked to libepoxy without GL/EGL/X11 support.
--- package/libepoxy/Config.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
package/libepoxy/Config.in +4 -4
@@ -1,12 +1,12 @@ config BR2_PACKAGE_LIBEPOXY bool "libepoxy" - depends on BR2_PACKAGE_HAS_LIBEGL || BR2_PACKAGE_HAS_LIBGL select BR2_PACKAGE_XUTIL_UTIL_MACROS help Epoxy is a library for handling OpenGL function pointer management for you. - https://github.com/anholt/libepoxy + It can be built without EGL or GLX support for packages + that use libepoxy as a mandatory dependency but do not need + OpenGL entry points at runtime. -comment "libepoxy needs an OpenGL and/or OpenGL EGL backend" - depends on !BR2_PACKAGE_HAS_LIBEGL && !BR2_PACKAGE_HAS_LIBGL + https://github.com/anholt/libepoxy
Signature · 6 lines
2.54.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH v7 3/8] package/libepoxy: remove gl/egl dependency
Quoted 25 lines · Joseph Kogut
Libepoxy is a library for handling OpenGL function pointer management.
It has backends for egl/glx, which may at one point have been mandatory to enable, but the library now builds with none of the above enabled features, as seen below.
libepoxy 1.5.10
User defined options
Cross files :/home/joseph/br-test-pkg/arm-aarch64/build/libepoxy-1.5.10//buildroot-build/cross-compilation.conf
b_pie: false
b_staticpic: true
buildtype : release
build.cmake_prefix_path:/home/joseph/br-test-pkg/arm-aarch64/host/lib/cmake
default_library: shared
docs : false
egl : no
glx : no
libdir : lib
build.pkg_config_path :/home/joseph/br-test-pkg/arm-aarch64/host/lib/pkgconfig
prefix : /usr
strip : false
tests : false
x11 : false
Quoted 8 lines
Removing these dependencies allows for some applications that require it as a build dependency, but otherwise can run headless or without GL, to build and function, using other graphics APIs or display pipelines.
Weston, for example, can still use Vulkan and DRM when linked to libepoxy without GL/EGL/X11 support.
Signed-off-by Joseph Kogut <[email protected]>
Looks good to me. However, now I applied the first two patches to master, so I
can't really apply this one to next. Fortunately :-) I have some comments later in the series, so I'll just mark the rest as Changes Requested, and you can repost after the 2026.05 release and next is merged back in master.
When you do, you can add on this patch my
(BTW if you post it around June 8, you have the biggest chance that I'll
actually pick it up and it won't be ignored for another six months.)
Regards,
Arnout
Quoted 16 lines
--- package/libepoxy/Config.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)package/libepoxy/Config.in +0
-1@@ -1,12 +1,12 @@ config BR2_PACKAGE_LIBEPOXY bool "libepoxy" - depends on BR2_PACKAGE_HAS_LIBEGL || BR2_PACKAGE_HAS_LIBGL select BR2_PACKAGE_XUTIL_UTIL_MACROS help Epoxy is a library for handling OpenGL function pointer
package/libepoxy/Config.in line 12
Quoted 10 lines
package/libepoxy/Config.in +4
-3management for you. - https://github.com/anholt/libepoxy + It can be built without EGL or GLX support for packages + that use libepoxy as a mandatory dependency but do not need + OpenGL entry points at runtime. -comment "libepoxy needs an OpenGL and/or OpenGL EGL backend" - depends on !BR2_PACKAGE_HAS_LIBEGL && !BR2_PACKAGE_HAS_LIBGL + https://github.com/anholt/libepoxy
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH v7 3/8] package/libepoxy: remove gl/egl dependency
Hello Arnout,
Sounds good, I'll repost after the release and include the Acked-by.
Best,
Joseph
Quoted 80 lines · On Thu, May 21, 2026, 14:03 Arnout Vandecappelle <[email protected]> wrote:
Quoted 10 lines · Joseph Kogut
Libepoxy is a library for handling OpenGL function pointer management.
It has backends for egl/glx, which may at one point have been mandatory to enable, but the library now builds with none of the above enabled features, as seen below.
libepoxy 1.5.10
User defined options
Cross files :
/home/joseph/br-test-pkg/arm-aarch64/build/libepoxy-1.5.10//buildroot-build/cross-compilation.confQuoted 4 lines
b_pie : false b_staticpic : true buildtype : releasebuild.cmake_prefix_path:
/home/joseph/br-test-pkg/arm-aarch64/host/lib/cmakeQuoted 6 lines
default_library : shared docs : false egl : no glx : no libdir : lib build.pkg_config_path :
/home/joseph/br-test-pkg/arm-aarch64/host/lib/pkgconfigQuoted 5 lines
prefix : /usr strip : false tests : false x11 : falseQuoted 8 lines
Removing these dependencies allows for some applications that require it as a build dependency, but otherwise can run headless or without GL, to build and function, using other graphics APIs or display pipelines.
Weston, for example, can still use Vulkan and DRM when linked to libepoxy without GL/EGL/X11 support.
Signed-off-by Joseph Kogut <[email protected]>Looks good to me. However, now I applied the first two patches to
master, so I
can't really apply this one to next. Fortunately :-) I have some comments later
in the series, so I'll just mark the rest as Changes Requested, and you can
repost after the 2026.05 release and next is merged back in master.When you do, you can add on this patch my
(BTW if you post it around June 8, you have the biggest chance that I'll
actually pick it up and it won't be ignored for another six months.)Regards,
ArnoutQuoted 22 lines
--- package/libepoxy/Config.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)package/libepoxy/Config.in +3
-2@@ -1,12 +1,12 @@ config BR2_PACKAGE_LIBEPOXY bool "libepoxy" - depends on BR2_PACKAGE_HAS_LIBEGL || BR2_PACKAGE_HAS_LIBGL select BR2_PACKAGE_XUTIL_UTIL_MACROS help Epoxy is a library for handling OpenGL function pointer management for you. - https://github.com/anholt/libepoxy + It can be built without EGL or GLX support for packages + that use libepoxy as a mandatory dependency but do not need + OpenGL entry points at runtime.
Quoted 6 lines
package/libepoxy/Config.in line 12
Quoted 4 lines
package/libepoxy/Config.in +1
-2-comment "libepoxy needs an OpenGL and/or OpenGL EGL backend" - depends on !BR2_PACKAGE_HAS_LIBEGL && !BR2_PACKAGE_HAS_LIBGL + https://github.com/anholt/libepoxy
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v7 4/8 package/virglrenderer: new package
In reply to Joseph KogutAdd virglrenderer, an optional dependency of QEMU, which facilitates acceleration of rendering and optionally video decode through virtio-gpu.
--- DEVELOPERS | 1 + package/Config.in | 1 + package/virglrenderer/Config.in | 117 +++++++++++++++++++++++++++++++ package/virglrenderer/virglrenderer.hash | 5 ++ package/virglrenderer/virglrenderer.mk | 60 ++++++++++++++++ 5 files changed, 184 insertions(+)
DEVELOPERS +1 -0
@@ -1765,6 +1765,7 @@ F: package/python-xlib/ F: package/sentry-cli/ F: package/sentry-native/ F: package/unclutter-xfixes/ +F: package/virglrenderer/ N: Joshua Henderson <[email protected]> F: package/qt5/qt5wayland/
package/Config.in +1 -0
@@ -365,6 +365,7 @@ comment "Graphic libraries" source "package/sdl2_ttf/Config.in" source "package/spirv-headers/Config.in" source "package/tk/Config.in" + source "package/virglrenderer/Config.in" source "package/vulkan-headers/Config.in" source "package/vulkan-loader/Config.in" source "package/vulkan-sdk/Config.in"
package/virglrenderer/Config.in new file +117 -0
117 lines not on this page · raw message
package/virglrenderer/virglrenderer.hash new file +5 -0
@@ -0,0 +1,5 @@ +# Locally calculated +sha256 065bc56e89e6f631f96101cd62eba0748e48eb888b434edc86e89d05395e76f3 virglrenderer-1.3.0.tar.gz + +# License +sha256 3b32caf16e2402c2aff2b716858713f3e1feded85c25e71bf829816ee5009402 COPYING
package/virglrenderer/virglrenderer.mk new file +60 -0
60 lines not on this page · raw message
Signature · 6 lines
2.54.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH v7 4/8] package/virglrenderer: new package
Quoted 3 lines · Joseph Kogut
Add virglrenderer, an optional dependency of QEMU, which facilitates acceleration of rendering and optionally video decode through virtio-gpu.
I'm not entirely sure how this works. Do you just have the driver for the
host's hardware in your guest OS? So e.g. you have ti-sgx-um and virglrenderer in your guest OS, and voila, you get acceleration?
Or is virglrender just the library that you have to link into qemu to enable
this feature to begin with? What do you need in the guest then to be able to make use of it? Do you need the same driver in the host and the guest? What if they have different versions? Or can you have e.g. etnaviv in the host and vivante in the guest?
Or maybe on the host you don't need anything other than virglrenderer, and the
actual driver is purely in the guest? If that's the case, all the "default y if ..." in this commit are incorrect.
I looked at the test, but it doesn't help much because the test uses the same
kernel/rootfs for the host and the guest...
I have quite a few comments to this patch. In some cases, I expect that what
you wrote is actually good but I misunderstood things. It would be good to add more explanation in the commit message about such situations.
Quoted 40 lines
Signed-off-by Joseph Kogut <[email protected]>--- DEVELOPERS | 1 + package/Config.in | 1 + package/virglrenderer/Config.in | 117 +++++++++++++++++++++++++++++++ package/virglrenderer/virglrenderer.hash | 5 ++ package/virglrenderer/virglrenderer.mk | 60 ++++++++++++++++ 5 files changed, 184 insertions(+)DEVELOPERS +1
-0@@ -1765,6 +1765,7 @@ F: package/python-xlib/ F: package/sentry-cli/ F: package/sentry-native/ F: package/unclutter-xfixes/ +F: package/virglrenderer/ N: Joshua Henderson <[email protected]> F: package/qt5/qt5wayland/package/Config.in +1
-0@@ -365,6 +365,7 @@ comment "Graphic libraries" source "package/sdl2_ttf/Config.in" source "package/spirv-headers/Config.in" source "package/tk/Config.in" + source "package/virglrenderer/Config.in" source "package/vulkan-headers/Config.in" source "package/vulkan-loader/Config.in" source "package/vulkan-sdk/Config.in"package/virglrenderer/Config.in new file +0
-0
package/virglrenderer/Config.in line 3
Quoted 3 lines
package/virglrenderer/Config.in new file +3
-0@@ -0,0 +1,117 @@ +config BR2_PACKAGE_VIRGLRENDERER + bool "virglrenderer" + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9
We usually have a comment here why it needs GCC 4.9 - typically a minimal C++
standard version, or C11.
package/virglrenderer/Config.in line 11
Quoted 8 lines
package/virglrenderer/Config.in new file +8
-0+ depends on BR2_TOOLCHAIN_HAS_THREADS + depends on BR2_USE_MMU # fork() + select BR2_PACKAGE_LIBEPOXY + help + A library for accelerated graphics and compute in + virtualized guests. + + virglrenderer can be built without virgl, venus, or DRM
I wouldn't enumerate all the backends here but just say "can be built without
any backend".
package/virglrenderer/Config.in line 18
Quoted 7 lines
package/virglrenderer/Config.in new file +7
-0+ backends, although such a build will not provide guest + graphics or compute acceleration by itself. + + https://qemu.readthedocs.io/en/v10.0.3/system/devices/virtio-gpu.html#virtio-gpu-virglrenderer + +if BR2_PACKAGE_VIRGLRENDERER +comment "virglrenderer needs virgl, venus, or a DRM backend for guest acceleration"
We don't normally put such comments that are just a hint for people who don't
want to read the help text.
Quoted 4 lines
package/virglrenderer/Config.in new file +4
-0+ depends on !BR2_PACKAGE_VIRGLRENDERER_HAS_BACKEND + +config BR2_PACKAGE_VIRGLRENDERER_VIRGL + bool "virgl"
package/virglrenderer/Config.in line 32
Quoted 10 lines
package/virglrenderer/Config.in new file +10
-0+ default y + depends on (BR2_PACKAGE_HAS_LIBEGL && BR2_PACKAGE_HAS_LIBGBM) \ + || BR2_PACKAGE_HAS_LIBGL + select BR2_PACKAGE_VIRGLRENDERER_HAS_BACKEND + help + Enable API-level OpenGL acceleration over virtio-gpu. + + Say 'y' if you want to run applications with OpenGL + acceleration in virtualized guests. Requires host + support for OpenGL.
We don't use the "Say 'y'" formulation. I also don't know what "virtualized
guests" means - guests are always virtualized, right? And "Requires" may sound like a build-time dependency on the build system. So I'd just make the help text "Enable API-level OpenGL acceleration over virtio-gpu. Requires the virtualization host to support OpenGL." Similarly for the other help texts.
package/virglrenderer/Config.in line 42
Quoted 9 lines
package/virglrenderer/Config.in new file +9
-0+ https://docs.mesa3d.org/drivers/virgl.html + +comment "virgl needs OpenGL or OpenGL EGL and libgbm" + depends on !((BR2_PACKAGE_HAS_LIBEGL && BR2_PACKAGE_HAS_LIBGBM) \ + || BR2_PACKAGE_HAS_LIBGL) + +config BR2_PACKAGE_VIRGLRENDERER_VENUS + bool "venus" + default y if BR2_PACKAGE_MESA3D_VULKAN_DRIVER
I don't understand this default y. Is it just that there's no other way to
know if the hardware supports Vulkan?
Quoted 7 lines
package/virglrenderer/Config.in new file +7
-0+ depends on BR2_INSTALL_LIBSTDCPP # vulkan-loader + depends on !BR2_STATIC_LIBS # vulkan-loader + depends on BR2_TOOLCHAIN_HAS_THREADS # vulkan-loader + select BR2_PACKAGE_VIRGLRENDERER_HAS_BACKEND + select BR2_PACKAGE_VULKAN_HEADERS + select BR2_PACKAGE_VULKAN_LOADER + help
package/virglrenderer/Config.in line 59
Quoted 10 lines
package/virglrenderer/Config.in new file +10
-0+ Enable API-level Vulkan acceleration over virtio-gpu. + + Say 'y' if you want to run applications with Vulkan + acceleration in virtualized guests. Requires host + support for Vulkan. + + https://docs.mesa3d.org/drivers/venus.html + +config BR2_PACKAGE_VIRGLRENDERER_VAAPI + bool "vaapi support"
I would move this either to the beginning or the end to separate it from the
backends. E.g.
comment "Virtio backends"
...
comment "DRM backends"
...
comment "Other options"
bool "vaapi support"
package/virglrenderer/Config.in line 67
Quoted 8 lines
package/virglrenderer/Config.in new file +8
-0+ depends on BR2_PACKAGE_LIBGBM_HAS_FEATURE_DMA_BUF + select BR2_PACKAGE_LIBDRM + select BR2_PACKAGE_LIBVA + help + Enable hardware accelerated video encode/decode through + libva over virtio-gpu. + +comment "DRM backends"
Not sure what is the distinction between virtio and DRM backends, but I don't
suppose I really need to know :-)
Quoted 80 lines
package/virglrenderer/Config.in new file +50
-0+ +config BR2_PACKAGE_VIRGLRENDERER_DRM_BACKEND_AMDGPU + bool "amdgpu" + default y if BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_RADEONSI + default y if BR2_PACKAGE_MESA3D_VULKAN_DRIVER_AMD + select BR2_PACKAGE_VIRGLRENDERER_HAS_BACKEND + select BR2_PACKAGE_LIBDRM + select BR2_PACKAGE_LIBDRM_AMDGPU + help + Enable DRM backend for amdgpu, used by Gallium radeonsi + and RADV vulkan drivers. + +config BR2_PACKAGE_VIRGLRENDERER_DRM_BACKEND_INTEL + bool "intel" + default y if BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_I915 + default y if BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_IRIS + default y if BR2_PACKAGE_MESA3D_VULKAN_DRIVER_INTEL + select BR2_PACKAGE_VIRGLRENDERER_HAS_BACKEND + select BR2_PACKAGE_LIBDRM + help + Enable DRM backend for i915, used by Gallium i915/Iris + and Intel vulkan drivers. + +config BR2_PACKAGE_VIRGLRENDERER_DRM_BACKEND_MSM + bool "msm" + default y if BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_FREEDRENO + depends on !BR2_arm + select BR2_PACKAGE_VIRGLRENDERER_HAS_BACKEND + select BR2_PACKAGE_LIBDRM + help + Enable DRM backend for msm, used by Gallium freedreno + driver. + +config BR2_PACKAGE_VIRGLRENDERER_DRM_BACKEND_PANFROST + bool "panfrost" + default y if BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_PANFROST + default y if BR2_PACKAGE_MESA3D_VULKAN_DRIVER_PANFROST + select BR2_PACKAGE_VIRGLRENDERER_HAS_BACKEND + select BR2_PACKAGE_LIBDRM + help + Enable DRM backend for Panfrost, used by the panfrost + Gallium/vulkan drivers. + +endif + +comment "virglrenderer needs a toolchain w/ gcc >= 4.9" + depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 + +config BR2_PACKAGE_VIRGLRENDERER_HAS_BACKEND + boolpackage/virglrenderer/virglrenderer.hash new file +5
-0@@ -0,0 +1,5 @@ +# Locally calculated +sha256 065bc56e89e6f631f96101cd62eba0748e48eb888b434edc86e89d05395e76f3 virglrenderer-1.3.0.tar.gz + +# License +sha256 3b32caf16e2402c2aff2b716858713f3e1feded85c25e71bf829816ee5009402 COPYINGpackage/virglrenderer/virglrenderer.mk new file +13
-0@@ -0,0 +1,60 @@ +################################################################################ +# +# virglrenderer +# +################################################################################ + +VIRGLRENDERER_VERSION = 1.3.0 +VIRGLRENDERER_SITE = https://gitlab.freedesktop.org/virgl/virglrenderer/-/archive/$(VIRGLRENDERER_VERSION) +VIRGLRENDERER_LICENSE = MIT +VIRGLRENDERER_LICENSE_FILES = COPYING +VIRGLRENDERER_INSTALL_STAGING = YES +VIRGLRENDERER_DEPENDENCIES = \ + libepoxy \
package/virglrenderer/virglrenderer.mk line 23
Quoted 10 lines
package/virglrenderer/virglrenderer.mk new file +10
-0+ host-pkgconf \ + host-python3 \ + host-python-pyyaml +VIRGLRENDERER_CPE_ID_VALID = YES + +ifeq ($(BR2_PACKAGE_VIRGLRENDERER_VIRGL),y) +ifeq ($(BR2_PACKAGE_HAS_LIBEGL)$(BR2_PACKAGE_HAS_LIBGBM),yy) +VIRGLRENDERER_PLATFORMS += egl +VIRGLRENDERER_DEPENDENCIES += libegl \ + libgbm
The indentation is a bit wonky here. Either put it all on a single line, or
put the values on separate lines indented with a single tab (so 3 lines total).
Regards,
Arnout
Quoted 28 lines
package/virglrenderer/virglrenderer.mk new file +27
-0+endif + +ifeq ($(BR2_PACKAGE_HAS_LIBGL),y) +VIRGLRENDERER_PLATFORMS += glx +VIRGLRENDERER_DEPENDENCIES += libgl +endif +endif # BR2_PACKAGE_VIRGLRENDERER_VIRGL + +VIRGLRENDERER_CONF_OPTS += -Dplatforms=$(subst $(space),$(comma),$(VIRGLRENDERER_PLATFORMS)) + +ifeq ($(BR2_PACKAGE_VIRGLRENDERER_VENUS),y) +VIRGLRENDERER_CONF_OPTS += -Dvenus=true +VIRGLRENDERER_DEPENDENCIES += vulkan-headers \ + vulkan-loader +else +VIRGLRENDERER_CONF_OPTS += -Dvenus=false +endif + +VIRGLRENDERER_DRM_BACKENDS-$(BR2_PACKAGE_VIRGLRENDERER_DRM_BACKEND_AMDGPU) += amdgpu-experimental +VIRGLRENDERER_DRM_BACKENDS-$(BR2_PACKAGE_VIRGLRENDERER_DRM_BACKEND_INTEL) += i915-experimental +VIRGLRENDERER_DRM_BACKENDS-$(BR2_PACKAGE_VIRGLRENDERER_DRM_BACKEND_MSM) += msm +VIRGLRENDERER_DRM_BACKENDS-$(BR2_PACKAGE_VIRGLRENDERER_DRM_BACKEND_PANFROST) += panfrost-experimental + +VIRGLRENDERER_CONF_OPTS += -Ddrm-renderers=$(subst $(space),$(comma),$(VIRGLRENDERER_DRM_BACKENDS-y)) + +ifneq ($(VIRGLRENDERER_DRM_BACKENDS-y),) +VIRGLRENDERER_DEPENDENCIES += libdrm
package/virglrenderer/virglrenderer.mk line 60
Quoted 10 lines
package/virglrenderer/virglrenderer.mk new file +10
-0+endif + +ifeq ($(BR2_PACKAGE_VIRGLRENDERER_VAAPI),y) +VIRGLRENDERER_CONF_OPTS += -Dvideo=true +VIRGLRENDERER_DEPENDENCIES += libva libdrm +else +VIRGLRENDERER_CONF_OPTS += -Dvideo=false +endif + +$(eval $(meson-package))
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH v7 4/8] package/virglrenderer: new package
Hello Arnout,
Looks like I missed this message earlier while I was at Open Source Summit NA, so I'm following up now while I'm preparing the next version of this patch series. I think we've already covered some of this, but I'll respond inline anyway for posterity.
Quoted 12 lines · Arnout Vandecappelle
Quoted 3 lines · Joseph Kogut
Add virglrenderer, an optional dependency of QEMU, which facilitates acceleration of rendering and optionally video decode through virtio-gpu.
I'm not entirely sure how this works. Do you just have the driver for the
host's hardware in your guest OS? So e.g. you have ti-sgx-um and virglrenderer in your guest OS, and voila, you get acceleration?
Basically yes, but not just any driver. For the moment, the only supported DRM backends are Mesa drivers. This is because modifying the UMD to submit DRM commands over virtio-gpu is required. Virglrenderer receives these commands on the host and submits them to the actual device node.
Quoted 6 lines
Or is virglrender just the library that you have to link into qemu to enable
this feature to begin with? What do you need in the guest then to be able to make use of it? Do you need the same driver in the host and the guest? What if they have different versions? Or can you have e.g. etnaviv in the host and vivante in the guest?
In the guest, you need mesa with the virtio-gpu UMD for VirGL or Venus. VirGL requires host support for OpenGL, and venus requires host support for Vulkan.
For lower overhead and arguably better security, you can use the native UMD (e.g. radeonsi, freedreno) in the guest with host native context, but this requires both Mesa and virglrenderer to have this enabled.
Quoted 4 lines
Or maybe on the host you don't need anything other than virglrenderer, and the
actual driver is purely in the guest? If that's the case, all the "default y if ..." in this commit are incorrect.
The virglrenderer DRM backends only require the corresponding DRM KMD loaded on the host at runtime. If you're using a DRM backend and running the native UMD inside a guest, you can get accelerated render/compute in the guest without any UMD on the host.
In practice, many users will probably also have a graphics stack (UMD) on the host, because they'll want an accelerated pipeline for presenting rendered frames from guests. In this case, enabling e.g. radeonsi or radv in the host Mesa build implies that the host has the amdgpu KMD (and the hardware to use it), so we can safely enable the amdgpu backend for virglrenderer. This enables guests to use radeonsi/radv directly.
Quoted 3 lines
I looked at the test, but it doesn't help much because the test uses the same
kernel/rootfs for the host and the guest...
I was hoping to avoid building two kernels/rootfses for expediency, but I see how this would illustrate the setup poorly.
Quoted 42 lines
I have quite a few comments to this patch. In some cases, I expect that what
you wrote is actually good but I misunderstood things. It would be good to add more explanation in the commit message about such situations.Quoted 38 lines
Signed-off-by Joseph Kogut <[email protected]>--- DEVELOPERS | 1 + package/Config.in | 1 + package/virglrenderer/Config.in | 117 +++++++++++++++++++++++++++++++ package/virglrenderer/virglrenderer.hash | 5 ++ package/virglrenderer/virglrenderer.mk | 60 ++++++++++++++++ 5 files changed, 184 insertions(+)DEVELOPERS +1
-0@@ -1765,6 +1765,7 @@ F: package/python-xlib/ F: package/sentry-cli/ F: package/sentry-native/ F: package/unclutter-xfixes/ +F: package/virglrenderer/ N: Joshua Henderson <[email protected]> F: package/qt5/qt5wayland/package/Config.in +1
-0@@ -365,6 +365,7 @@ comment "Graphic libraries" source "package/sdl2_ttf/Config.in" source "package/spirv-headers/Config.in" source "package/tk/Config.in" + source "package/virglrenderer/Config.in" source "package/vulkan-headers/Config.in" source "package/vulkan-loader/Config.in" source "package/vulkan-sdk/Config.in"package/virglrenderer/Config.in new file +0
-1--- /dev/null
Quoted 9 lines
package/virglrenderer/Config.in line 3
Quoted 5 lines
+++ b/package/virglrenderer/Config.in
package/virglrenderer/Config.in new file +3
-0@@ -0,0 +1,117 @@ +config BR2_PACKAGE_VIRGLRENDERER + bool "virglrenderer" + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9We usually have a comment here why it needs GCC 4.9 - typically a minimal C++
standard version, or C11.
Agreed, I'll look into this again and add a comment.
Quoted 9 lines
package/virglrenderer/Config.in line 11
Quoted 8 lines
package/virglrenderer/Config.in new file +8
-0+ depends on BR2_TOOLCHAIN_HAS_THREADS + depends on BR2_USE_MMU # fork() + select BR2_PACKAGE_LIBEPOXY + help + A library for accelerated graphics and compute in + virtualized guests. + + virglrenderer can be built without virgl, venus, or DRM
Quoted 3 lines
I wouldn't enumerate all the backends here but just say "can be built without
any backend".
+1
Quoted 23 lines
package/virglrenderer/Config.in line 18
Quoted 7 lines
package/virglrenderer/Config.in new file +7
-0+ backends, although such a build will not provide guest + graphics or compute acceleration by itself. + + https://qemu.readthedocs.io/en/v10.0.3/system/devices/virtio-gpu.html#virtio-gpu-virglrenderer + +if BR2_PACKAGE_VIRGLRENDERER +comment "virglrenderer needs virgl, venus, or a DRM backend for guest acceleration"We don't normally put such comments that are just a hint for people who don't
want to read the help text.Quoted 12 lines
package/virglrenderer/Config.in new file +12
-0+ depends on !BR2_PACKAGE_VIRGLRENDERER_HAS_BACKEND + +config BR2_PACKAGE_VIRGLRENDERER_VIRGL + bool "virgl" + default y + depends on (BR2_PACKAGE_HAS_LIBEGL && BR2_PACKAGE_HAS_LIBGBM) \ + || BR2_PACKAGE_HAS_LIBGL + select BR2_PACKAGE_VIRGLRENDERER_HAS_BACKEND + help + Enable API-level OpenGL acceleration over virtio-gpu. + + Say 'y' if you want to run applications with OpenGL
Quoted 9 lines
package/virglrenderer/Config.in line 32
Quoted 2 lines
package/virglrenderer/Config.in new file +2
-0+ acceleration in virtualized guests. Requires host + support for OpenGL.We don't use the "Say 'y'" formulation. I also don't know what "virtualized
guests" means - guests are always virtualized, right? And "Requires" may sound like a build-time dependency on the build system. So I'd just make the help text "Enable API-level OpenGL acceleration over virtio-gpu. Requires the virtualization host to support OpenGL." Similarly for the other help texts.
Yep, I think that's clearer.
Quoted 4 lines
Quoted 4 lines
package/virglrenderer/Config.in new file +4
-0+ https://docs.mesa3d.org/drivers/virgl.html + +comment "virgl needs OpenGL or OpenGL EGL and libgbm" + depends on !((BR2_PACKAGE_HAS_LIBEGL && BR2_PACKAGE_HAS_LIBGBM) \
Quoted 9 lines
package/virglrenderer/Config.in line 42
Quoted 5 lines
package/virglrenderer/Config.in new file +5
-0+ || BR2_PACKAGE_HAS_LIBGL) + +config BR2_PACKAGE_VIRGLRENDERER_VENUS + bool "venus" + default y if BR2_PACKAGE_MESA3D_VULKAN_DRIVERI don't understand this default y. Is it just that there's no other way to
know if the hardware supports Vulkan?
As above, Venus requires Vulkan support on the host. It makes sense to enable virglrenderer support when we know we have it, even though this isn't the only Vulkan provider. If somebody is using, for example, the proprietary Nvidia vulkan driver, they can explicitly select this config to enable Venus support.
Quoted 25 lines
Quoted 7 lines
package/virglrenderer/Config.in new file +7
-0+ depends on BR2_INSTALL_LIBSTDCPP # vulkan-loader + depends on !BR2_STATIC_LIBS # vulkan-loader + depends on BR2_TOOLCHAIN_HAS_THREADS # vulkan-loader + select BR2_PACKAGE_VIRGLRENDERER_HAS_BACKEND + select BR2_PACKAGE_VULKAN_HEADERS + select BR2_PACKAGE_VULKAN_LOADER + helppackage/virglrenderer/Config.in line 59
Quoted 10 lines
package/virglrenderer/Config.in new file +10
-0+ Enable API-level Vulkan acceleration over virtio-gpu. + + Say 'y' if you want to run applications with Vulkan + acceleration in virtualized guests. Requires host + support for Vulkan. + + https://docs.mesa3d.org/drivers/venus.html + +config BR2_PACKAGE_VIRGLRENDERER_VAAPI + bool "vaapi support"I would move this either to the beginning or the end to separate it from the
backends. E.g.comment "Virtio backends"
...
Quoted 9 lines
comment "DRM backends"
...
comment "Other options"
bool "vaapi support"
+1
Quoted 97 lines
package/virglrenderer/Config.in line 67
Quoted 8 lines
package/virglrenderer/Config.in new file +8
-0+ depends on BR2_PACKAGE_LIBGBM_HAS_FEATURE_DMA_BUF + select BR2_PACKAGE_LIBDRM + select BR2_PACKAGE_LIBVA + help + Enable hardware accelerated video encode/decode through + libva over virtio-gpu. + +comment "DRM backends"Not sure what is the distinction between virtio and DRM backends, but I don't
suppose I really need to know :-)Quoted 85 lines
package/virglrenderer/Config.in new file +50
-0+ +config BR2_PACKAGE_VIRGLRENDERER_DRM_BACKEND_AMDGPU + bool "amdgpu" + default y if BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_RADEONSI + default y if BR2_PACKAGE_MESA3D_VULKAN_DRIVER_AMD + select BR2_PACKAGE_VIRGLRENDERER_HAS_BACKEND + select BR2_PACKAGE_LIBDRM + select BR2_PACKAGE_LIBDRM_AMDGPU + help + Enable DRM backend for amdgpu, used by Gallium radeonsi + and RADV vulkan drivers. + +config BR2_PACKAGE_VIRGLRENDERER_DRM_BACKEND_INTEL + bool "intel" + default y if BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_I915 + default y if BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_IRIS + default y if BR2_PACKAGE_MESA3D_VULKAN_DRIVER_INTEL + select BR2_PACKAGE_VIRGLRENDERER_HAS_BACKEND + select BR2_PACKAGE_LIBDRM + help + Enable DRM backend for i915, used by Gallium i915/Iris + and Intel vulkan drivers. + +config BR2_PACKAGE_VIRGLRENDERER_DRM_BACKEND_MSM + bool "msm" + default y if BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_FREEDRENO + depends on !BR2_arm + select BR2_PACKAGE_VIRGLRENDERER_HAS_BACKEND + select BR2_PACKAGE_LIBDRM + help + Enable DRM backend for msm, used by Gallium freedreno + driver. + +config BR2_PACKAGE_VIRGLRENDERER_DRM_BACKEND_PANFROST + bool "panfrost" + default y if BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_PANFROST + default y if BR2_PACKAGE_MESA3D_VULKAN_DRIVER_PANFROST + select BR2_PACKAGE_VIRGLRENDERER_HAS_BACKEND + select BR2_PACKAGE_LIBDRM + help + Enable DRM backend for Panfrost, used by the panfrost + Gallium/vulkan drivers. + +endif + +comment "virglrenderer needs a toolchain w/ gcc >= 4.9" + depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 + +config BR2_PACKAGE_VIRGLRENDERER_HAS_BACKEND + boolpackage/virglrenderer/virglrenderer.hash new file +5
-0@@ -0,0 +1,5 @@ +# Locally calculated +sha256 065bc56e89e6f631f96101cd62eba0748e48eb888b434edc86e89d05395e76f3 virglrenderer-1.3.0.tar.gz + +# License +sha256 3b32caf16e2402c2aff2b716858713f3e1feded85c25e71bf829816ee5009402 COPYINGpackage/virglrenderer/virglrenderer.mk new file +18
-0@@ -0,0 +1,60 @@ +################################################################################ +# +# virglrenderer +# +################################################################################ + +VIRGLRENDERER_VERSION = 1.3.0 +VIRGLRENDERER_SITE = https://gitlab.freedesktop.org/virgl/virglrenderer/-/archive/$(VIRGLRENDERER_VERSION) +VIRGLRENDERER_LICENSE = MIT +VIRGLRENDERER_LICENSE_FILES = COPYING +VIRGLRENDERER_INSTALL_STAGING = YES +VIRGLRENDERER_DEPENDENCIES = \ + libepoxy \ + host-pkgconf \ + host-python3 \ + host-python-pyyaml +VIRGLRENDERER_CPE_ID_VALID = YES +
Quoted 9 lines
package/virglrenderer/virglrenderer.mk line 23
Quoted 5 lines
package/virglrenderer/virglrenderer.mk new file +5
-0+ifeq ($(BR2_PACKAGE_VIRGLRENDERER_VIRGL),y) +ifeq ($(BR2_PACKAGE_HAS_LIBEGL)$(BR2_PACKAGE_HAS_LIBGBM),yy) +VIRGLRENDERER_PLATFORMS += egl +VIRGLRENDERER_DEPENDENCIES += libegl \ + libgbmThe indentation is a bit wonky here. Either put it all on a single line, or
put the values on separate lines indented with a single tab (so 3 lines total).
Yes, it is... I'll fix it, thanks for the feedback.
Quoted 34 lines
Regards,
ArnoutQuoted 30 lines
package/virglrenderer/virglrenderer.mk new file +30
-0+endif + +ifeq ($(BR2_PACKAGE_HAS_LIBGL),y) +VIRGLRENDERER_PLATFORMS += glx +VIRGLRENDERER_DEPENDENCIES += libgl +endif +endif # BR2_PACKAGE_VIRGLRENDERER_VIRGL + +VIRGLRENDERER_CONF_OPTS += -Dplatforms=$(subst $(space),$(comma),$(VIRGLRENDERER_PLATFORMS)) + +ifeq ($(BR2_PACKAGE_VIRGLRENDERER_VENUS),y) +VIRGLRENDERER_CONF_OPTS += -Dvenus=true +VIRGLRENDERER_DEPENDENCIES += vulkan-headers \ + vulkan-loader +else +VIRGLRENDERER_CONF_OPTS += -Dvenus=false +endif + +VIRGLRENDERER_DRM_BACKENDS-$(BR2_PACKAGE_VIRGLRENDERER_DRM_BACKEND_AMDGPU) += amdgpu-experimental +VIRGLRENDERER_DRM_BACKENDS-$(BR2_PACKAGE_VIRGLRENDERER_DRM_BACKEND_INTEL) += i915-experimental +VIRGLRENDERER_DRM_BACKENDS-$(BR2_PACKAGE_VIRGLRENDERER_DRM_BACKEND_MSM) += msm +VIRGLRENDERER_DRM_BACKENDS-$(BR2_PACKAGE_VIRGLRENDERER_DRM_BACKEND_PANFROST) += panfrost-experimental + +VIRGLRENDERER_CONF_OPTS += -Ddrm-renderers=$(subst $(space),$(comma),$(VIRGLRENDERER_DRM_BACKENDS-y)) + +ifneq ($(VIRGLRENDERER_DRM_BACKENDS-y),) +VIRGLRENDERER_DEPENDENCIES += libdrm +endif + +ifeq ($(BR2_PACKAGE_VIRGLRENDERER_VAAPI),y)
Quoted 9 lines
package/virglrenderer/virglrenderer.mk line 60
Quoted 8 lines
package/virglrenderer/virglrenderer.mk new file +7
-0+VIRGLRENDERER_CONF_OPTS += -Dvideo=true +VIRGLRENDERER_DEPENDENCIES += libva libdrm +else +VIRGLRENDERER_CONF_OPTS += -Dvideo=false +endif + +$(eval $(meson-package))
Best,
Joseph
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v7 5/8 package/virglrenderer: Fix build with glibc 2.43
In reply to Joseph KogutAdd an upstream patch to fix the build with glibc 2.43, not present in a stable release yet.
--- .../0001-fix-build-with-glibc-2.43.patch | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+)
package/virglrenderer/0001-fix-build-with-glibc-2.43.patch new file +39 -0
@@ -0,0 +1,39 @@ +From 986b5fc57b07c06b5e0b3a3694d06898ebc80163 Mon Sep 17 00:00:00 2001 +From: Maximilian Hofmann <[email protected]> +Date: Thu, 26 Feb 2026 23:28:58 +0100 +Subject: [PATCH] fix: build with glibc 2.43 + +Several glibc functions now return a const pointer if the input is a +const pointer and a non-const pointer if the input is non-const, causing +a build failure. + +Fix this by declaring the output pointers as const if they are never +modified, and for the lone failure where the output is modified, instead +make the input non-const. + +Signed-off-by: Maximilian Hofmann <[email protected]> +Part-of: <https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/1599> + +Upstream: https://gitlab.freedesktop.org/virgl/virglrenderer/-/commit/986b5fc57b07c06b5e0b3a3694d06898ebc80163 + +Signed-off-by: Joseph Kogut <[email protected]> +--- + src/gallium/auxiliary/tgsi/tgsi_text.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c +index db7d7b95..7e37bf79 100644 +--- a/src/gallium/auxiliary/tgsi/tgsi_text.c ++++ b/src/gallium/auxiliary/tgsi/tgsi_text.c +@@ -84,7 +84,7 @@ streq_nocase_uprcase(const char *str1, + static inline bool skip_n_chars(const char **pcur, + int n) + { +- char* str = memchr(*pcur, '\0', n); ++ const char* str = memchr(*pcur, '\0', n); + if (unlikely(str)) { + *pcur = str; + return false; +-- +2.53.0 +
Signature · 6 lines
2.54.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH v7 5/8] package/virglrenderer: Fix build with glibc 2.43
Quoted 2 lines · Joseph Kogut
Add an upstream patch to fix the build with glibc 2.43, not present in a stable release yet.
This should be squashed with the previous commit. No special mention in the
commit message is needed, it's clear from the patch itself why it is needed.
Regards,
Arnout
Quoted 42 lines
Signed-off-by Joseph Kogut <[email protected]>--- .../0001-fix-build-with-glibc-2.43.patch | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+)package/virglrenderer/0001-fix-build-with-glibc-2.43.patch new file +29
-0@@ -0,0 +1,39 @@ +From 986b5fc57b07c06b5e0b3a3694d06898ebc80163 Mon Sep 17 00:00:00 2001 +From: Maximilian Hofmann <[email protected]> +Date: Thu, 26 Feb 2026 23:28:58 +0100 +Subject: [PATCH] fix: build with glibc 2.43 + +Several glibc functions now return a const pointer if the input is a +const pointer and a non-const pointer if the input is non-const, causing +a build failure. + +Fix this by declaring the output pointers as const if they are never +modified, and for the lone failure where the output is modified, instead +make the input non-const. + +Signed-off-by: Maximilian Hofmann <[email protected]> +Part-of: <https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/1599> + +Upstream: https://gitlab.freedesktop.org/virgl/virglrenderer/-/commit/986b5fc57b07c06b5e0b3a3694d06898ebc80163 + +Signed-off-by: Joseph Kogut <[email protected]> +--- + src/gallium/auxiliary/tgsi/tgsi_text.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c +index db7d7b95..7e37bf79 100644 +--- a/src/gallium/auxiliary/tgsi/tgsi_text.c ++++ b/src/gallium/auxiliary/tgsi/tgsi_text.c +@@ -84,7 +84,7 @@ streq_nocase_uprcase(const char *str1, + static inline bool skip_n_chars(const char **pcur,
package/virglrenderer/0001-fix-build-with-glibc-2.43.patch line 39
Quoted 10 lines
package/virglrenderer/0001-fix-build-with-glibc-2.43.patch new file +10
-0+ int n) + { +- char* str = memchr(*pcur, '\0', n); ++ const char* str = memchr(*pcur, '\0', n); + if (unlikely(str)) { + *pcur = str; + return false; +-- +2.53.0 +
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v7 6/8 package/qemu: add OpenGL config
In reply to Joseph Kogut--- package/qemu/Config.in | 14 ++++++++++++++ package/qemu/qemu.mk | 8 +++++++- 2 files changed, 21 insertions(+), 1 deletion(-)
package/qemu/Config.in +14 -0
@@ -112,6 +112,20 @@ config BR2_PACKAGE_QEMU_SDL Say 'y' to enable the SDL frontend, that is, a graphical window presenting the VM's display. +config BR2_PACKAGE_QEMU_OPENGL + bool "Enable OpenGL" + depends on BR2_PACKAGE_HAS_LIBEGL || BR2_PACKAGE_HAS_LIBGL # needs libepoxy w/ EGL or GL + select BR2_PACKAGE_LIBEPOXY + help + Say 'y' to enable OpenGL accelerated display frontend support. + This is necessary to efficiently display frames rendered in a + guest on the host. + + Run qemu with `-display sdl,gl=on` + +comment "OpenGL support needs an OpenGL and/or OpenGL EGL backend" + depends on !(BR2_PACKAGE_HAS_LIBEGL || BR2_PACKAGE_HAS_LIBGL) + config BR2_PACKAGE_QEMU_FDT bool "Enable FDT" select BR2_PACKAGE_DTC
package/qemu/qemu.mk +7 -1
@@ -272,6 +272,13 @@ else QEMU_OPTS += --disable-usb-redir endif +ifeq ($(BR2_PACKAGE_QEMU_OPENGL),y) +QEMU_OPTS += --enable-opengl +QEMU_DEPENDENCIES += libepoxy +else +QEMU_OPTS += --disable-opengl +endif + ifeq ($(BR2_STATIC_LIBS),y) QEMU_OPTS += --static endif
@@ -329,7 +336,6 @@ define QEMU_CONFIGURE_CMDS --disable-membarrier \ --disable-mpath \ --disable-netmap \ - --disable-opengl \ --disable-oss \ --disable-pa \ --disable-plugins \
Signature · 6 lines
2.54.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH v7 6/8] package/qemu: add OpenGL config
Quoted 11 lines · Joseph Kogut
Signed-off-by Joseph Kogut <[email protected]>--- package/qemu/Config.in | 14 ++++++++++++++ package/qemu/qemu.mk | 8 +++++++- 2 files changed, 21 insertions(+), 1 deletion(-)package/qemu/Config.in +0
-0
package/qemu/Config.in config BR2_PACKAGE_QEMU_SDL · line 117
Quoted 6 lines
package/qemu/Config.in +3
-0@@ -112,6 +112,20 @@ config BR2_PACKAGE_QEMU_SDL Say 'y' to enable the SDL frontend, that is, a graphical window presenting the VM's display. +config BR2_PACKAGE_QEMU_OPENGL + bool "Enable OpenGL" + depends on BR2_PACKAGE_HAS_LIBEGL || BR2_PACKAGE_HAS_LIBGL # needs libepoxy w/ EGL or GL
Even though it only includes epoxy/egl.h and not EGL/egl.h, it's still using
symbols from EGL/egl.h so I think the comment is not needed.
But basically you can add my
Regards,
Arnout
Quoted 34 lines
package/qemu/Config.in +11
-0+ select BR2_PACKAGE_LIBEPOXY + help + Say 'y' to enable OpenGL accelerated display frontend support. + This is necessary to efficiently display frames rendered in a + guest on the host. + + Run qemu with `-display sdl,gl=on` + +comment "OpenGL support needs an OpenGL and/or OpenGL EGL backend" + depends on !(BR2_PACKAGE_HAS_LIBEGL || BR2_PACKAGE_HAS_LIBGL) + config BR2_PACKAGE_QEMU_FDT bool "Enable FDT" select BR2_PACKAGE_DTCpackage/qemu/qemu.mk +7
-0@@ -272,6 +272,13 @@ else QEMU_OPTS += --disable-usb-redir endif +ifeq ($(BR2_PACKAGE_QEMU_OPENGL),y) +QEMU_OPTS += --enable-opengl +QEMU_DEPENDENCIES += libepoxy +else +QEMU_OPTS += --disable-opengl +endif + ifeq ($(BR2_STATIC_LIBS),y) QEMU_OPTS += --static endif
package/qemu/qemu.mk define QEMU_CONFIGURE_CMDS · line 341
Quoted 7 lines
package/qemu/qemu.mk +0
-1@@ -329,7 +336,6 @@ define QEMU_CONFIGURE_CMDS --disable-membarrier \ --disable-mpath \ --disable-netmap \ - --disable-opengl \ --disable-oss \ --disable-pa \ --disable-plugins \
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v7 7/8 package/qemu: add virglrenderer integration
In reply to Joseph KogutAdd optional virglrenderer integration, along with enabling OpenGL when necessary.
https://qemu.readthedocs.io/en/v10.0.3/system/devices/virtio-gpu.html#virtio-gpu-virglrenderer
--- package/qemu/Config.in | 21 +++++++++++++++++++++ package/qemu/qemu.mk | 7 +++++++ 2 files changed, 28 insertions(+)
package/qemu/Config.in +21 -0
@@ -126,6 +126,27 @@ config BR2_PACKAGE_QEMU_OPENGL comment "OpenGL support needs an OpenGL and/or OpenGL EGL backend" depends on !(BR2_PACKAGE_HAS_LIBEGL || BR2_PACKAGE_HAS_LIBGL) +config BR2_PACKAGE_QEMU_VIRGLRENDERER + bool "Enable virglrenderer" + depends on BR2_PACKAGE_HAS_LIBEGL || BR2_PACKAGE_HAS_LIBGL + select BR2_PACKAGE_QEMU_OPENGL + select BR2_PACKAGE_VIRGLRENDERER + help + Say 'y' to enable qemu support for virglrenderer. + virglrenderer backends such as virgl, venus, or DRM native + context are configured under the virglrenderer package. + + Run qemu with `-device virtio-gpu-gl` + + https://qemu.readthedocs.io/en/v10.0.3/system/devices/virtio-gpu.html#virtio-gpu-virglrenderer + +comment "virglrenderer needs OpenGL accelerated display frontend support" + depends on !(BR2_PACKAGE_HAS_LIBEGL || BR2_PACKAGE_HAS_LIBGL) + +comment "virglrenderer needs virgl, venus, or a DRM backend for guest acceleration" + depends on BR2_PACKAGE_QEMU_VIRGLRENDERER + depends on !BR2_PACKAGE_VIRGLRENDERER_HAS_BACKEND + config BR2_PACKAGE_QEMU_FDT bool "Enable FDT" select BR2_PACKAGE_DTC
package/qemu/qemu.mk +7 -0
@@ -279,6 +279,13 @@ else QEMU_OPTS += --disable-opengl endif +ifeq ($(BR2_PACKAGE_QEMU_VIRGLRENDERER),y) +QEMU_OPTS += --enable-virglrenderer +QEMU_DEPENDENCIES += virglrenderer +else +QEMU_OPTS += --disable-virglrenderer +endif + ifeq ($(BR2_STATIC_LIBS),y) QEMU_OPTS += --static endif
Signature · 6 lines
2.54.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH v7 7/8] package/qemu: add virglrenderer integration
Quoted 29 lines · Joseph Kogut
Add optional virglrenderer integration, along with enabling OpenGL when necessary.
https://qemu.readthedocs.io/en/v10.0.3/system/devices/virtio-gpu.html#virtio-gpu-virglrenderer
Signed-off-by Joseph Kogut <[email protected]>--- package/qemu/Config.in | 21 +++++++++++++++++++++ package/qemu/qemu.mk | 7 +++++++ 2 files changed, 28 insertions(+)package/qemu/Config.in +10
-0@@ -126,6 +126,27 @@ config BR2_PACKAGE_QEMU_OPENGL comment "OpenGL support needs an OpenGL and/or OpenGL EGL backend" depends on !(BR2_PACKAGE_HAS_LIBEGL || BR2_PACKAGE_HAS_LIBGL) +config BR2_PACKAGE_QEMU_VIRGLRENDERER + bool "Enable virglrenderer" + depends on BR2_PACKAGE_HAS_LIBEGL || BR2_PACKAGE_HAS_LIBGL + select BR2_PACKAGE_QEMU_OPENGL + select BR2_PACKAGE_VIRGLRENDERER + help + Say 'y' to enable qemu support for virglrenderer. + virglrenderer backends such as virgl, venus, or DRM native + context are configured under the virglrenderer package. +
package/qemu/Config.in config BR2_PACKAGE_QEMU_OPENGL · line 148
Quoted 10 lines
package/qemu/Config.in +10
-0+ Run qemu with `-device virtio-gpu-gl` + + https://qemu.readthedocs.io/en/v10.0.3/system/devices/virtio-gpu.html#virtio-gpu-virglrenderer + +comment "virglrenderer needs OpenGL accelerated display frontend support" + depends on !(BR2_PACKAGE_HAS_LIBEGL || BR2_PACKAGE_HAS_LIBGL) + +comment "virglrenderer needs virgl, venus, or a DRM backend for guest acceleration" + depends on BR2_PACKAGE_QEMU_VIRGLRENDERER + depends on !BR2_PACKAGE_VIRGLRENDERER_HAS_BACKEND
Does it actually work if you have a DRM backend but no virgl or venus? I'm
confused again...
Regards,
Arnout
Quoted 13 lines
package/qemu/Config.in +1
-0+ config BR2_PACKAGE_QEMU_FDT bool "Enable FDT" select BR2_PACKAGE_DTCpackage/qemu/qemu.mk +0
-0@@ -279,6 +279,13 @@ else QEMU_OPTS += --disable-opengl endif
package/qemu/qemu.mk else · line 291
Quoted 10 lines
package/qemu/qemu.mk +7
-0+ifeq ($(BR2_PACKAGE_QEMU_VIRGLRENDERER),y) +QEMU_OPTS += --enable-virglrenderer +QEMU_DEPENDENCIES += virglrenderer +else +QEMU_OPTS += --disable-virglrenderer +endif + ifeq ($(BR2_STATIC_LIBS),y) QEMU_OPTS += --static endif
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH v7 7/8] package/qemu: add virglrenderer integration
Hello Arnout,
Quoted 44 lines · On Thu, May 21, 2026, 15:24 Arnout Vandecappelle <[email protected]> wrote:
Quoted 4 lines · Joseph Kogut
Add optional virglrenderer integration, along with enabling OpenGL when necessary.
https://qemu.readthedocs.io/en/v10.0.3/system/devices/virtio-gpu.html#virtio-gpu-virglrenderer
Quoted 18 lines
Signed-off-by Joseph Kogut <[email protected]>--- package/qemu/Config.in | 21 +++++++++++++++++++++ package/qemu/qemu.mk | 7 +++++++ 2 files changed, 28 insertions(+)package/qemu/Config.in +3
-0@@ -126,6 +126,27 @@ config BR2_PACKAGE_QEMU_OPENGL comment "OpenGL support needs an OpenGL and/or OpenGL EGL backend" depends on !(BR2_PACKAGE_HAS_LIBEGL || BR2_PACKAGE_HAS_LIBGL) +config BR2_PACKAGE_QEMU_VIRGLRENDERER + bool "Enable virglrenderer" + depends on BR2_PACKAGE_HAS_LIBEGL || BR2_PACKAGE_HAS_LIBGLpackage/qemu/Config.in config BR2_PACKAGE_QEMU_OPENGL · line 141
Quoted 10 lines
package/qemu/Config.in +10
-0+ select BR2_PACKAGE_QEMU_OPENGL + select BR2_PACKAGE_VIRGLRENDERER + help + Say 'y' to enable qemu support for virglrenderer. + virglrenderer backends such as virgl, venus, or DRM native + context are configured under the virglrenderer package. + + Run qemu with `-device virtio-gpu-gl` + +https://qemu.readthedocs.io/en/v10.0.3/system/devices/virtio-gpu.html#virtio-gpu-virglrenderer
package/qemu/Config.in config BR2_PACKAGE_QEMU_OPENGL · line 143
Quoted 2 lines
package/qemu/Config.in +2
-0+ +comment "virglrenderer needs OpenGL accelerated display frontendsupport"
package/qemu/Config.in config BR2_PACKAGE_QEMU_OPENGL
Quoted 3 lines
package/qemu/Config.in +3
-0+ depends on !(BR2_PACKAGE_HAS_LIBEGL || BR2_PACKAGE_HAS_LIBGL) + +comment "virglrenderer needs virgl, venus, or a DRM backend for guestacceleration"
Quoted 7 lines
package/qemu/Config.in config BR2_PACKAGE_QEMU_OPENGL · line 148
Quoted 2 lines
package/qemu/Config.in +2
-0+ depends on BR2_PACKAGE_QEMU_VIRGLRENDERER + depends on !BR2_PACKAGE_VIRGLRENDERER_HAS_BACKENDDoes it actually work if you have a DRM backend but no virgl or venus?
I'm
confused again...
Yes, it does actually work. I understand your confusion though. :)
TL;DR: VirGL forwards OpenGL to the host, Venus does the same but for Vulkan. The host requirement is OpenGL or Vulkan support.
DRM backends are used in combination with the native UMD (radeonsi, i1915, freedreno, etc.) running inside the guest, which generally provide both GL and Vulkan, with better security and less overhead. However, you need specific GPU hardware on the host, which is why the test uses VirGL.
Best,
Joseph
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH v7 7/8] package/qemu: add virglrenderer integration
Quoted 53 lines · Joseph Kogut
Hello Arnout,
Quoted 38 lines · On Thu, May 21, 2026, 15:24 Arnout Vandecappelle <[email protected]> wrote:
Quoted 34 lines · Joseph Kogut
Add optional virglrenderer integration, along with enabling OpenGL when necessary.
https://qemu.readthedocs.io/en/v10.0.3/system/devices/virtio-gpu.html#virtio-gpu-virglrenderer
Signed-off-by Joseph Kogut <[email protected]>--- package/qemu/Config.in | 21 +++++++++++++++++++++ package/qemu/qemu.mk | 7 +++++++ 2 files changed, 28 insertions(+)package/qemu/Config.in +15
-0@@ -126,6 +126,27 @@ config BR2_PACKAGE_QEMU_OPENGL comment "OpenGL support needs an OpenGL and/or OpenGL EGL backend" depends on !(BR2_PACKAGE_HAS_LIBEGL || BR2_PACKAGE_HAS_LIBGL) +config BR2_PACKAGE_QEMU_VIRGLRENDERER + bool "Enable virglrenderer" + depends on BR2_PACKAGE_HAS_LIBEGL || BR2_PACKAGE_HAS_LIBGL + select BR2_PACKAGE_QEMU_OPENGL + select BR2_PACKAGE_VIRGLRENDERER + help + Say 'y' to enable qemu support for virglrenderer. + virglrenderer backends such as virgl, venus, or DRM native + context are configured under the virglrenderer package. + + Run qemu with `-device virtio-gpu-gl` + + https://qemu.readthedocs.io/en/v10.0.3/system/devices/virtio-gpu.html#virtio-gpu-virglrenderer + +comment "virglrenderer needs OpenGL accelerated display frontend support"Quoted 8 lines
package/qemu/Config.in config BR2_PACKAGE_QEMU_OPENGL · line 148
Quoted 5 lines
package/qemu/Config.in +5
-0+ depends on !(BR2_PACKAGE_HAS_LIBEGL || BR2_PACKAGE_HAS_LIBGL) + +comment "virglrenderer needs virgl, venus, or a DRM backend for guest acceleration" + depends on BR2_PACKAGE_QEMU_VIRGLRENDERER + depends on !BR2_PACKAGE_VIRGLRENDERER_HAS_BACKENDDoes it actually work if you have a DRM backend but no virgl or venus? I'm
confused again...
Quoted 8 lines
Yes, it does actually work. I understand your confusion though. :)
TL;DR: VirGL forwards OpenGL to the host, Venus does the same but for Vulkan. The host requirement is OpenGL or Vulkan support.
DRM backends are used in combination with the native UMD (radeonsi, i1915, freedreno, etc.) running inside the guest, which generally provide both GL and Vulkan, with better security and less overhead. However, you need specific GPU hardware on the host, which is why the test uses VirGL.
Best,
Joseph
Sorry for the HTML message. :/
That's what I get for trying to reply to a message with my phone's email client.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v7 8/8 support/testing: add virglrenderer test
In reply to Joseph KogutAdd basic smoke test for glmark2 running in a nested qemu guest with virtio-gpu-gl-pci.
The outer machine uses the Mesa softpipe driver for GLES support with minimal dependencies. Just test virgl for now, as lavapipe (software Vulkan driver) requires LLVM, and this validates virglrenderer.
--- DEVELOPERS | 1 + .../testing/tests/package/test_virglrenderer.py | 117 +++++++++++++++++++++ .../test_virglrenderer/linux-virgl.fragment | 6 ++ .../test_virglrenderer/remove-qemu-blobs.sh | 12 +++ .../rootfs-overlay/etc/profile.d/stty-raw.sh | 3 + 5 files changed, 139 insertions(+)
DEVELOPERS +1 -0
@@ -1766,6 +1766,7 @@ F: package/sentry-cli/ F: package/sentry-native/ F: package/unclutter-xfixes/ F: package/virglrenderer/ +F: support/testing/tests/package/test_virglrenderer.py N: Joshua Henderson <[email protected]> F: package/qt5/qt5wayland/
support/testing/tests/package/test_virglrenderer.py new file +117 -0
117 lines not on this page · raw message
support/testing/tests/package/test_virglrenderer/linux-virgl.fragment new file +6 -0
@@ -0,0 +1,6 @@ +CONFIG_BLK_DEV_INITRD=y +CONFIG_DRM_VGEM=y +CONFIG_NET_9P=y +CONFIG_NET_9P_VIRTIO=y +CONFIG_9P_FS=y +CONFIG_9P_FS_POSIX_ACL=y
support/testing/tests/package/test_virglrenderer/remove-qemu-blobs.sh new file +12 -0
@@ -0,0 +1,12 @@ +#!/bin/sh + +set -eu + +qemu_dir="${TARGET_DIR}/usr/share/qemu" + +find "${qemu_dir}" -type f \ + ! -name 'bios-256k.bin' \ + ! -name 'kvmvapic.bin' \ + ! -name 'linuxboot.bin' \ + ! -name 'linuxboot_dma.bin' \ + -delete
support/testing/tests/package/test_virglrenderer/rootfs-overlay/etc/profile.d/stty-raw.sh new file +3 -0
@@ -0,0 +1,3 @@ +# Avoid double-cooking the nested serial console, otherwise the test +# infrastructure cannot reliably retrieve return codes. +grep -Fq br-nested-virgl /proc/cmdline && stty raw
Signature · 6 lines
2.54.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH v7 8/8] support/testing: add virglrenderer test
Quoted 35 lines · Joseph Kogut
Add basic smoke test for glmark2 running in a nested qemu guest with virtio-gpu-gl-pci.
The outer machine uses the Mesa softpipe driver for GLES support with minimal dependencies. Just test virgl for now, as lavapipe (software Vulkan driver) requires LLVM, and this validates virglrenderer.
Signed-off-by Joseph Kogut <[email protected]>--- DEVELOPERS | 1 + .../testing/tests/package/test_virglrenderer.py | 117 +++++++++++++++++++++ .../test_virglrenderer/linux-virgl.fragment | 6 ++ .../test_virglrenderer/remove-qemu-blobs.sh | 12 +++ .../rootfs-overlay/etc/profile.d/stty-raw.sh | 3 + 5 files changed, 139 insertions(+)DEVELOPERS +1
-0@@ -1766,6 +1766,7 @@ F: package/sentry-cli/ F: package/sentry-native/ F: package/unclutter-xfixes/ F: package/virglrenderer/ +F: support/testing/tests/package/test_virglrenderer.py N: Joshua Henderson <[email protected]> F: package/qt5/qt5wayland/EGL_NOT_INITIALIZEDsupport/testing/tests/package/test_virglrenderer.py new file +0
-0
support/testing/tests/package/test_virglrenderer.py line 8
Quoted 8 lines
support/testing/tests/package/test_virglrenderer.py new file +8
-0@@ -0,0 +1,117 @@ +import os + +import infra +import infra.basetest + + +class TestVirglrendererNestedQemu(infra.basetest.BRTest): + # We reuse the same initramfs-enabled kernel for the outer target and
I think it's better to separate them, that makes it more clear what should be
enabled in the host and what should be enabled in the guest. For the kernel it's OK to reuse them, but I think the rootfs's should be separated.
Therefore also I think it's better to use a cpio than an initramfs.
support/testing/tests/package/test_virglrenderer.py line 11
Quoted 3 lines
support/testing/tests/package/test_virglrenderer.py new file +3
-0+ # nested guest. This fragment adds initramfs and 9p support so the outer + # target can mount the runner's images directory and launch the same kernel + # under target-side QEMU. We also enable DRM_VGEM to create the necessary
I guess that's the only reason why one of the prebuilt kernels can't be used...
support/testing/tests/package/test_virglrenderer.py line 21
Quoted 10 lines
support/testing/tests/package/test_virglrenderer.py new file +10
-0+ # DRI device node, a requirement of qemu when using virgl. + kern_frag = \ + infra.filepath("tests/package/test_virglrenderer/linux-virgl.fragment") + post_build = \ + infra.filepath("tests/package/test_virglrenderer/remove-qemu-blobs.sh") + rootfs_overlay = \ + infra.filepath("tests/package/test_virglrenderer/rootfs-overlay") + + # Softpipe has no hardware dependencies and does not pull LLVM into the + # build, unlike llvmpipe/lavapipe.
Since there are no hardware dependencies, we can actually run it on aarch64
(or arm) instead off x86_64, no? That is preferable, because that we detect cross-compilation issues and everything is emulated so there's definitely no dependency on the build environment.
support/testing/tests/package/test_virglrenderer.py line 28
Quoted 7 lines
support/testing/tests/package/test_virglrenderer.py new file +7
-0+ config = \ + f""" + BR2_x86_64=y + BR2_x86_nehalem=y + BR2_TOOLCHAIN_EXTERNAL=y + BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_X86_64_CORE_I7_GLIBC_STABLE=y + BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
Why do we need eudev?
Quoted 6 lines
support/testing/tests/package/test_virglrenderer.py new file +6
-0+ BR2_TARGET_GENERIC_GETTY_PORT="ttyS0" + BR2_ROOTFS_OVERLAY="{rootfs_overlay}" + BR2_ROOTFS_POST_BUILD_SCRIPT="{post_build}" + BR2_LINUX_KERNEL=y + BR2_LINUX_KERNEL_CUSTOM_VERSION=y + BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.18.21"
support/testing/tests/package/test_virglrenderer.py line 44
Quoted 10 lines
support/testing/tests/package/test_virglrenderer.py new file +10
-0+ BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y + BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/x86_64/linux.config" + BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="{kern_frag}" + BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y + # BR2_PACKAGE_EUDEV_ENABLE_HWDB is not set + BR2_PACKAGE_GLMARK2=y + BR2_PACKAGE_LIBGLVND=y + BR2_PACKAGE_MESA3D=y + BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_SOFTPIPE=y + BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_VIRGL=y
This again confuses me - why do you need both softpipe and virgl? Or is it
just because we are reusing the same binary in the host and guest?
Quoted 19 lines
support/testing/tests/package/test_virglrenderer.py new file +19
-0+ BR2_PACKAGE_MESA3D_OPENGL_EGL=y + BR2_PACKAGE_MESA3D_OPENGL_ES=y + BR2_PACKAGE_QEMU=y + BR2_PACKAGE_QEMU_SYSTEM=y + # BR2_PACKAGE_QEMU_SYSTEM_KVM is not set + BR2_PACKAGE_QEMU_SYSTEM_TCG=y + BR2_PACKAGE_QEMU_CHOOSE_TARGETS=y + BR2_PACKAGE_QEMU_TARGET_X86_64=y + BR2_PACKAGE_QEMU_VIRGLRENDERER=y + BR2_TARGET_ROOTFS_INITRAMFS=y + # BR2_TARGET_ROOTFS_TAR is not set + """ + + def boot_outer(self): + kern = os.path.join(self.builddir, "images", "bzImage") + img_dir = os.path.join(self.builddir, "images") + virtfs_tag = "br-imgs" + virtfs_opts = [ + f"local,path={img_dir}",
support/testing/tests/package/test_virglrenderer.py line 73
Quoted 10 lines
support/testing/tests/package/test_virglrenderer.py new file +10
-0+ f"mount_tag={virtfs_tag}", + "security_model=mapped-xattr", + "readonly=on" + ] + self.emulator.boot(arch="x86_64", + kernel=kern, + kernel_cmdline=["console=ttyS0"], + options=["-cpu", "Nehalem", + "-m", "1536M", + "-smp", "4",
Any reason to use more than one CPU?
Quoted 30 lines
support/testing/tests/package/test_virglrenderer.py new file +30
-0+ "-vga", "none", + "-virtfs", ",".join(virtfs_opts)]) + self.emulator.login() + self.assertRunOk(f"mount -t 9p {virtfs_tag} /mnt/") + + def boot_nested(self): + qemu_cmd = "env LIBGL_ALWAYS_SOFTWARE=1 GALLIUM_DRIVER=softpipe" + qemu_cmd += " qemu-system-x86_64" + qemu_cmd += " -M q35,accel=tcg" + qemu_cmd += " -cpu Nehalem" + qemu_cmd += " -m 512M" + qemu_cmd += " -smp 4" + qemu_cmd += " -nodefaults" + qemu_cmd += " -display egl-headless,gl=on" + qemu_cmd += " -device virtio-gpu-gl-pci" + qemu_cmd += " -serial stdio" + qemu_cmd += " -kernel /mnt/bzImage" + qemu_cmd += " -append 'console=ttyS0 br-nested-virgl'" + + # qemu runs in the foreground on the current serial console. Once it + # starts, the next login prompt belongs to the nested guest. + self.emulator.qemu.sendline(qemu_cmd) + self.emulator.login(timeout=180) + + def test_run(self): + self.boot_outer() + self.assertRunOk("while [ ! -e /dev/dri/renderD128 ]; do sleep 1; done", + timeout=30) + + self.boot_nested()
support/testing/tests/package/test_virglrenderer.py line 113
Quoted 10 lines
support/testing/tests/package/test_virglrenderer.py new file +10
-0+ + out, ret = self.emulator.run("cat /proc/cmdline") + self.assertEqual(ret, 0) + self.assertIn("br-nested-virgl", out[0]) + + cmd = "env MESA_LOADER_DRIVER_OVERRIDE=virtio_gpu" + cmd += " glmark2-es2-drm --validate --off-screen" + cmd += " --benchmark build:use-vbo=false" + out, ret = self.emulator.run(cmd, timeout=60) + self.assertEqual(ret, 0)
So, this would fail if qemu wasn't built with virglrenderer?
support/testing/tests/package/test_virglrenderer.py line 116
Quoted 3 lines
support/testing/tests/package/test_virglrenderer.py new file +3
-0+ + renderer = "\n".join([line for line in out if "GL_RENDERER:" in line]) + self.assertRegex(renderer, r"(?i)virgl")
Or just this one?
Quoted 21 lines
support/testing/tests/package/test_virglrenderer.py new file +1
-0+ self.assertRegex(renderer, r"(?i)softpipe")support/testing/tests/package/test_virglrenderer/linux-virgl.fragment new file +6
-0@@ -0,0 +1,6 @@ +CONFIG_BLK_DEV_INITRD=y +CONFIG_DRM_VGEM=y +CONFIG_NET_9P=y +CONFIG_NET_9P_VIRTIO=y +CONFIG_9P_FS=y +CONFIG_9P_FS_POSIX_ACL=ysupport/testing/tests/package/test_virglrenderer/remove-qemu-blobs.sh new file +2
-0@@ -0,0 +1,12 @@ +#!/bin/sh +
support/testing/tests/package/test_virglrenderer/remove-qemu-blobs.sh line 12
Quoted 10 lines
support/testing/tests/package/test_virglrenderer/remove-qemu-blobs.sh new file +10
-0+set -eu + +qemu_dir="${TARGET_DIR}/usr/share/qemu" + +find "${qemu_dir}" -type f \ + ! -name 'bios-256k.bin' \ + ! -name 'kvmvapic.bin' \ + ! -name 'linuxboot.bin' \ + ! -name 'linuxboot_dma.bin' \ + -delete
Why do you need to remove those? Is it just because otherwise the cpio becomes
too big to be used for an initramfs?
Regards,
Arnout
support/testing/tests/package/test_virglrenderer/rootfs-overlay/etc/profile.d/stty-raw.sh line 3
Quoted 10 lines
support/testing/tests/package/test_virglrenderer/rootfs-overlay/etc/profile.d/stty-raw.sh new file +3
-0@@ -0,0 +1,3 @@ +# Avoid double-cooking the nested serial console, otherwise the test +# infrastructure cannot reliably retrieve return codes. +grep -Fq br-nested-virgl /proc/cmdline && stty raw
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH v7 8/8] support/testing: add virglrenderer test
Hello Arnout,
Quoted 52 lines · Arnout Vandecappelle
Quoted 35 lines · Joseph Kogut
Add basic smoke test for glmark2 running in a nested qemu guest with virtio-gpu-gl-pci.
The outer machine uses the Mesa softpipe driver for GLES support with minimal dependencies. Just test virgl for now, as lavapipe (software Vulkan driver) requires LLVM, and this validates virglrenderer.
Signed-off-by Joseph Kogut <[email protected]>--- DEVELOPERS | 1 + .../testing/tests/package/test_virglrenderer.py | 117 +++++++++++++++++++++ .../test_virglrenderer/linux-virgl.fragment | 6 ++ .../test_virglrenderer/remove-qemu-blobs.sh | 12 +++ .../rootfs-overlay/etc/profile.d/stty-raw.sh | 3 + 5 files changed, 139 insertions(+)DEVELOPERS +1
-0@@ -1766,6 +1766,7 @@ F: package/sentry-cli/ F: package/sentry-native/ F: package/unclutter-xfixes/ F: package/virglrenderer/ +F: support/testing/tests/package/test_virglrenderer.py N: Joshua Henderson <[email protected]> F: package/qt5/qt5wayland/EGL_NOT_INITIALIZEDsupport/testing/tests/package/test_virglrenderer.py new file +0
-0support/testing/tests/package/test_virglrenderer.py line 8
Quoted 8 lines
support/testing/tests/package/test_virglrenderer.py new file +8
-0@@ -0,0 +1,117 @@ +import os + +import infra +import infra.basetest + + +class TestVirglrendererNestedQemu(infra.basetest.BRTest): + # We reuse the same initramfs-enabled kernel for the outer target andI think it's better to separate them, that makes it more clear what should be
enabled in the host and what should be enabled in the guest. For the kernel it's OK to reuse them, but I think the rootfs's should be separated.
Quoted 2 lines
Therefore also I think it's better to use a cpio than an initramfs.
Okay, I'll update this before resubmitting for the next release.
Quoted 17 lines
support/testing/tests/package/test_virglrenderer.py line 11
Quoted 3 lines
support/testing/tests/package/test_virglrenderer.py new file +3
-0+ # nested guest. This fragment adds initramfs and 9p support so the outer + # target can mount the runner's images directory and launch the same kernel + # under target-side QEMU. We also enable DRM_VGEM to create the necessaryI guess that's the only reason why one of the prebuilt kernels can't be used...
support/testing/tests/package/test_virglrenderer.py line 21
Quoted 10 lines
support/testing/tests/package/test_virglrenderer.py new file +10
-0+ # DRI device node, a requirement of qemu when using virgl. + kern_frag = \ + infra.filepath("tests/package/test_virglrenderer/linux-virgl.fragment") + post_build = \ + infra.filepath("tests/package/test_virglrenderer/remove-qemu-blobs.sh") + rootfs_overlay = \ + infra.filepath("tests/package/test_virglrenderer/rootfs-overlay") + + # Softpipe has no hardware dependencies and does not pull LLVM into the + # build, unlike llvmpipe/lavapipe.
Quoted 5 lines
Since there are no hardware dependencies, we can actually run it on aarch64
(or arm) instead offx86_64, no? That is preferable, because that we detect cross-compilation issues and everything is emulated so there's definitely no dependency on the build environment.
I see no reason this shouldn't work. I'll give it a shot.
Quoted 10 lines
support/testing/tests/package/test_virglrenderer.py line 28
Quoted 7 lines
support/testing/tests/package/test_virglrenderer.py new file +7
-0+ config = \ + f""" + BR2_x86_64=y + BR2_x86_nehalem=y + BR2_TOOLCHAIN_EXTERNAL=y + BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_X86_64_CORE_I7_GLIBC_STABLE=y + BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=yWhy do we need eudev?
Unfortunately, glmark2 depends on BR2_PACKAGE_HAS_UDEV, though we may be able to replace it with a different test, or even drop this dependency from the package.
Quoted 17 lines
Quoted 6 lines
support/testing/tests/package/test_virglrenderer.py new file +6
-0+ BR2_TARGET_GENERIC_GETTY_PORT="ttyS0" + BR2_ROOTFS_OVERLAY="{rootfs_overlay}" + BR2_ROOTFS_POST_BUILD_SCRIPT="{post_build}" + BR2_LINUX_KERNEL=y + BR2_LINUX_KERNEL_CUSTOM_VERSION=y + BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.18.21"support/testing/tests/package/test_virglrenderer.py line 44
Quoted 10 lines
support/testing/tests/package/test_virglrenderer.py new file +10
-0+ BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y + BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/x86_64/linux.config" + BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="{kern_frag}" + BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y + # BR2_PACKAGE_EUDEV_ENABLE_HWDB is not set + BR2_PACKAGE_GLMARK2=y + BR2_PACKAGE_LIBGLVND=y + BR2_PACKAGE_MESA3D=y + BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_SOFTPIPE=y + BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_VIRGL=y
Quoted 3 lines
This again confuses me - why do you need both softpipe and virgl? Or is it
just because we are reusing the same binary in the host and guest?
Softpipe is used in the outer guest, for software GLES rendering. VirGL forwards GL calls from the inner guest to the outer guest. The application (glmark2) shows the renderer as something like "VirGL( softpipe )", indicating that VirGL is being used, and the backend is softpipe.
Quoted 30 lines
Quoted 19 lines
support/testing/tests/package/test_virglrenderer.py new file +19
-0+ BR2_PACKAGE_MESA3D_OPENGL_EGL=y + BR2_PACKAGE_MESA3D_OPENGL_ES=y + BR2_PACKAGE_QEMU=y + BR2_PACKAGE_QEMU_SYSTEM=y + # BR2_PACKAGE_QEMU_SYSTEM_KVM is not set + BR2_PACKAGE_QEMU_SYSTEM_TCG=y + BR2_PACKAGE_QEMU_CHOOSE_TARGETS=y + BR2_PACKAGE_QEMU_TARGET_X86_64=y + BR2_PACKAGE_QEMU_VIRGLRENDERER=y + BR2_TARGET_ROOTFS_INITRAMFS=y + # BR2_TARGET_ROOTFS_TAR is not set + """ + + def boot_outer(self): + kern = os.path.join(self.builddir, "images", "bzImage") + img_dir = os.path.join(self.builddir, "images") + virtfs_tag = "br-imgs" + virtfs_opts = [ + f"local,path={img_dir}",support/testing/tests/package/test_virglrenderer.py line 73
Quoted 10 lines
support/testing/tests/package/test_virglrenderer.py new file +10
-0+ f"mount_tag={virtfs_tag}", + "security_model=mapped-xattr", + "readonly=on" + ] + self.emulator.boot(arch="x86_64", + kernel=kern, + kernel_cmdline=["console=ttyS0"], + options=["-cpu", "Nehalem", + "-m", "1536M", + "-smp", "4",
Quoted 2 lines
Any reason to use more than one CPU?
It should work with one CPU, but enabling a few more allows for additional throughput for the software renderer, so the test should complete a little faster.
Quoted 34 lines
Quoted 34 lines
support/testing/tests/package/test_virglrenderer.py new file +34
-0+ "-vga", "none", + "-virtfs", ",".join(virtfs_opts)]) + self.emulator.login() + self.assertRunOk(f"mount -t 9p {virtfs_tag} /mnt/") + + def boot_nested(self): + qemu_cmd = "env LIBGL_ALWAYS_SOFTWARE=1 GALLIUM_DRIVER=softpipe" + qemu_cmd += " qemu-system-x86_64" + qemu_cmd += " -M q35,accel=tcg" + qemu_cmd += " -cpu Nehalem" + qemu_cmd += " -m 512M" + qemu_cmd += " -smp 4" + qemu_cmd += " -nodefaults" + qemu_cmd += " -display egl-headless,gl=on" + qemu_cmd += " -device virtio-gpu-gl-pci" + qemu_cmd += " -serial stdio" + qemu_cmd += " -kernel /mnt/bzImage" + qemu_cmd += " -append 'console=ttyS0 br-nested-virgl'" + + # qemu runs in the foreground on the current serial console. Once it + # starts, the next login prompt belongs to the nested guest. + self.emulator.qemu.sendline(qemu_cmd) + self.emulator.login(timeout=180) + + def test_run(self): + self.boot_outer() + self.assertRunOk("while [ ! -e /dev/dri/renderD128 ]; do sleep 1; done", + timeout=30) + + self.boot_nested() + + out, ret = self.emulator.run("cat /proc/cmdline") + self.assertEqual(ret, 0) + self.assertIn("br-nested-virgl", out[0])
Quoted 8 lines
support/testing/tests/package/test_virglrenderer.py line 113
Quoted 6 lines
support/testing/tests/package/test_virglrenderer.py new file +6
-0+ + cmd = "env MESA_LOADER_DRIVER_OVERRIDE=virtio_gpu" + cmd += " glmark2-es2-drm --validate --off-screen" + cmd += " --benchmark build:use-vbo=false" + out, ret = self.emulator.run(cmd, timeout=60) + self.assertEqual(ret, 0)So, this would fail if qemu wasn't built with virglrenderer?
I can double check, but the virtio_gpu UMD should fail to load, and not fall back.
Quoted 6 lines
support/testing/tests/package/test_virglrenderer.py line 116
Quoted 3 lines
support/testing/tests/package/test_virglrenderer.py new file +3
-0+ + renderer = "\n".join([line for line in out if "GL_RENDERER:" in line]) + self.assertRegex(renderer, r"(?i)virgl")Or just this one?
This one will definitely fail without qemu virglrenderer support.
Quoted 26 lines
Quoted 26 lines
support/testing/tests/package/test_virglrenderer.py new file +1
-0+ self.assertRegex(renderer, r"(?i)softpipe")support/testing/tests/package/test_virglrenderer/linux-virgl.fragment new file +6
-0@@ -0,0 +1,6 @@ +CONFIG_BLK_DEV_INITRD=y +CONFIG_DRM_VGEM=y +CONFIG_NET_9P=y +CONFIG_NET_9P_VIRTIO=y +CONFIG_9P_FS=y +CONFIG_9P_FS_POSIX_ACL=ysupport/testing/tests/package/test_virglrenderer/remove-qemu-blobs.sh new file +7
-0@@ -0,0 +1,12 @@ +#!/bin/sh + +set -eu + +qemu_dir="${TARGET_DIR}/usr/share/qemu" + +find "${qemu_dir}" -type f \
Quoted 9 lines
support/testing/tests/package/test_virglrenderer/remove-qemu-blobs.sh line 12
Quoted 5 lines
support/testing/tests/package/test_virglrenderer/remove-qemu-blobs.sh new file +5
-0+ ! -name 'bios-256k.bin' \ + ! -name 'kvmvapic.bin' \ + ! -name 'linuxboot.bin' \ + ! -name 'linuxboot_dma.bin' \ + -deleteWhy do you need to remove those? Is it just because otherwise the cpio becomes
too big to be used for an initramfs?
Dropping additional firmware just allows this test to run with < 2 GB of memory. It works fine without this, but we must increase the guest memory allocation.
Quoted 14 lines
Regards,
Arnoutsupport/testing/tests/package/test_virglrenderer/rootfs-overlay/etc/profile.d/stty-raw.sh line 3
Quoted 10 lines
support/testing/tests/package/test_virglrenderer/rootfs-overlay/etc/profile.d/stty-raw.sh new file +3
-0@@ -0,0 +1,3 @@ +# Avoid double-cooking the nested serial console, otherwise the test +# infrastructure cannot reliably retrieve return codes. +grep -Fq br-nested-virgl /proc/cmdline && stty raw
Thanks for the review.
Best,
Joseph
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot