Skip to contentSkip to conversation

package/virglrenderer: new package

PATCH Applied Joseph Kogut 3 participants 11 messages Jun 19, 2025 – Jul 18, 2025

v1 of 7 Applied Latest is v7 →

lore
Share & tools
lore
#0 lore raw

cover package/virglrenderer: new package

Hello,

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

Virglrenderer is a userspace library used to implement 3d rendering using the virtio-gpu protocol. It's commonly used in conjunction with qemu, mesa, and the kernel's DRM subsystem to provide accelerated rendering for virtual machines. Virglrenderer additionally facilitates Vulkan passthrough using the Venus protocol.

The first patch bumps python-glslang to the most recent version, which fixes a build error on my machine with GCC v15. I haven't found any autobuilder builds that have failed due to this yet.

The second patch adds the new virglrenderer package.

The third patch adds virglrenderer as an optional dependency to qemu, along with a corresponding config option to enable it.

Enabling virglrenderer for qemu enables OpenGL support as well. An optional config for enabling venus on virglrenderer enables vulkan passthrough.

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[0].

Feedback welcome.

Best,
Joseph

[0] https://github.com/ggml-org/llama.cpp/discussions/10879

---
Joseph Kogut (3):
package/python-glslang: bump to version 15.3.0 package/virglrenderer: new package package/qemu: add virglrenderer support

 DEVELOPERS                                 |  1 +
 package/Config.in                          |  1 +
 package/python-glslang/python-glslang.hash |  2 +-
 package/python-glslang/python-glslang.mk   |  5 +++-
 package/qemu/Config.in                     | 12 ++++++++
 package/qemu/qemu.mk                       |  8 +++++-
 package/virglrenderer/Config.in            | 46 ++++++++++++++++++++++++++++++
 package/virglrenderer/virglrenderer.hash   |  5 ++++
 package/virglrenderer/virglrenderer.mk     | 36 +++++++++++++++++++++++
 9 files changed, 113 insertions(+), 3 deletions(-)

---
base-commit: f23c810176305604c54b79611d885547f4e45c23
change-id: 20250618-virglrenderer-upstream-d17ed807041b

Best regards,

Signature · 6 lines
Joseph Kogut <[email protected]>

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 1/3 package/python-glslang: bump to version 15.3.0

See changelog https://github.com/KhronosGroup/glslang/blob/main/CHANGES.md

Fixes build issue: error: ‘uint32_t’ has not been declared, encountered on GCC v15, caused by cstdint not being implicitly included.

https://bugs.gentoo.org/937261

---
 package/python-glslang/python-glslang.hash | 2 +-
 package/python-glslang/python-glslang.mk   | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)
package/python-glslang/python-glslang.hash +1 -1
index df9127939ef9d62dc3a5eafcd7000c4ecac26866..04ec5313a0c47b4ba72e4cac73a99614ec6e31db 100644
@@ -1,3 +1,3 @@
 # Locally calculated
-sha256  592c98aeb03b3e81597ddaf83633c4e63068d14b18a766fd11033bad73127162  python-glslang-11.13.0.tar.gz
+sha256  c6c21fe1873c37e639a6a9ac72d857ab63a5be6893a589f34e09a6c757174201  python-glslang-15.3.0.tar.gz
 sha256  adb783e734e906d1f46db5df29991dbde84bdb0ceab502ac2febb44fe3c2b5f4  LICENSE.txt
package/python-glslang/python-glslang.mk +4 -1
index 94f480e30a1bccc32f0d02e1f00ee489a91904cb..5944ebdb2c18ac948e4295eab886bb46ce4dfae3 100644
@@ -4,10 +4,13 @@
 #
 ################################################################################
 
-PYTHON_GLSLANG_VERSION = 11.13.0
+PYTHON_GLSLANG_VERSION = 15.3.0
 PYTHON_GLSLANG_SITE = $(call github,KhronosGroup,glslang,$(PYTHON_GLSLANG_VERSION))
 PYTHON_GLSLANG_LICENSE = BSD-3-Clause
 PYTHON_GLSLANG_LICENSE_FILES = LICENSE.txt
 PYTHON_GLSLANG_DEPENDENCIES = host-python3
+HOST_PYTHON_GLSLANG_DEPENDENCIES += host-spirv-tools
+
+HOST_PYTHON_GLSLANG_CONF_OPTS += -DALLOW_EXTERNAL_SPIRV_TOOLS=1
 
 $(eval $(host-cmake-package))
Signature · 6 lines
2.50.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Re: [Buildroot] [PATCH 1/3] package/python-glslang: bump to version 15.3.0

Hi Joseph,

Quoted 8 lines · Joseph Kogut

See changelog https://github.com/KhronosGroup/glslang/blob/main/CHANGES.md

Fixes build issue: error: ‘uint32_t’ has not been declared, encountered on GCC v15, caused by cstdint not being implicitly included.

https://bugs.gentoo.org/937261

I applied this patch only from this series, as it fixes a gcc15 issue (and updates the package). I'll give some more time for reviews for the qemu virglrenderer patches.

I also did few minor changes from you original submission. See:
https://gitlab.com/buildroot.org/buildroot/-/commit/53076f0eba85c53bcbee43cdd81a0d584ba5be22

I had to disable glslang tests because the cmake script was failing with cmake < 3.26. Our Buildroot docker reference image is using 3.25.

Please, comment or send followup patches if I missed something.

Best regards,

Julien.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw

Re: [Buildroot] [PATCH 1/3] package/python-glslang: bump to version 15.3.0

Hello Julien,

Thank you for your time in reviewing this, your changes look correct to me. I'll keep an eye on the autobuilder results in case of any build failures.

I look forward to feedback on the rest of the series.

Best,
Joseph

Quoted 25 lines · Julien Olivain

Hi Joseph,

Quoted 9 lines · Joseph Kogut

See changelog
https://github.com/KhronosGroup/glslang/blob/main/CHANGES.md

Fixes build issue: error: ‘uint32_t’ has not been declared, encountered on GCC v15, caused by cstdint not being implicitly included.

https://bugs.gentoo.org/937261

I applied this patch only from this series, as it fixes a gcc15 issue (and updates the package). I'll give some more time for reviews for the qemu virglrenderer patches.

I also did few minor changes from you original submission. See:
https://gitlab.com/buildroot.org/buildroot/-/commit/53076f0eba85c53bcbee43cdd81a0d584ba5be22

I had to disable glslang tests because the cmake script was failing with cmake < 3.26. Our Buildroot docker reference image is using 3.25.

Quoted 5 lines

Please, comment or send followup patches if I missed something.

Best regards,

Julien.

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw

Re: [Buildroot] [PATCH 1/3] package/python-glslang: bump to version 15.3.0

In reply to Joseph Kogut

In reply of:

Quoted 8 lines

See changelog https://github.com/KhronosGroup/glslang/blob/main/CHANGES.md

Fixes build issue: error: ‘uint32_t’ has not been declared, encountered on GCC v15, caused by cstdint not being implicitly included.

https://bugs.gentoo.org/937261

Applied to 2025.05.x. Thanks

Quoted 41 lines
---
 package/python-glslang/python-glslang.hash | 2 +-
 package/python-glslang/python-glslang.mk   | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)
package/python-glslang/python-glslang.hash +1 -1
index df9127939ef9d62dc3a5eafcd7000c4ecac26866..04ec5313a0c47b4ba72e4cac73a99614ec6e31db 100644
@@ -1,3 +1,3 @@
 # Locally calculated
-sha256  592c98aeb03b3e81597ddaf83633c4e63068d14b18a766fd11033bad73127162  python-glslang-11.13.0.tar.gz
+sha256  c6c21fe1873c37e639a6a9ac72d857ab63a5be6893a589f34e09a6c757174201  python-glslang-15.3.0.tar.gz
 sha256  adb783e734e906d1f46db5df29991dbde84bdb0ceab502ac2febb44fe3c2b5f4  LICENSE.txt
package/python-glslang/python-glslang.mk +4 -1
index 94f480e30a1bccc32f0d02e1f00ee489a91904cb..5944ebdb2c18ac948e4295eab886bb46ce4dfae3 100644
@@ -4,10 +4,13 @@
 #
 ################################################################################
 
-PYTHON_GLSLANG_VERSION = 11.13.0
+PYTHON_GLSLANG_VERSION = 15.3.0
 PYTHON_GLSLANG_SITE = $(call github,KhronosGroup,glslang,$(PYTHON_GLSLANG_VERSION))
 PYTHON_GLSLANG_LICENSE = BSD-3-Clause
 PYTHON_GLSLANG_LICENSE_FILES = LICENSE.txt
 PYTHON_GLSLANG_DEPENDENCIES = host-python3
+HOST_PYTHON_GLSLANG_DEPENDENCIES += host-spirv-tools
+
+HOST_PYTHON_GLSLANG_CONF_OPTS += -DALLOW_EXTERNAL_SPIRV_TOOLS=1
 
 $(eval $(host-cmake-package))
Signature · 7 lines
-- 
2.50.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

#5 lore raw

PATCH 2/3 package/virglrenderer: new package

In reply to Joseph Kogut

Add 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          | 46 ++++++++++++++++++++++++++++++++
 package/virglrenderer/virglrenderer.hash |  5 ++++
 package/virglrenderer/virglrenderer.mk   | 36 +++++++++++++++++++++++++
 5 files changed, 89 insertions(+)
DEVELOPERS +1 -0
index 9e31f6b515578acb2fa199d31d9f6af5551a9830..21d2593b47883ea7bf8dbbd7bc5861f04359ecb3 100644
@@ -1775,6 +1775,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
index 10f6856dea5dfcc457bd2ce0145ebd5a3f5a2e25..ab082dcd3e2b9edc0c3dd0bbf11e8abae9578548 100644
@@ -1804,6 +1804,7 @@ menu "Graphics"
 	source "package/stb/Config.in"
 	source "package/tiff/Config.in"
 	source "package/unclutter-xfixes/Config.in"
+	source "package/virglrenderer/Config.in"
 	source "package/waffle/Config.in"
 	source "package/wayland/Config.in"
 	source "package/wayland-protocols/Config.in"
package/virglrenderer/Config.in new file +46 -0

46 lines not on this page · raw message

package/virglrenderer/virglrenderer.hash new file +5 -0
new file mode 100644
index 0000000000000000000000000000000000000000..8b6ab7adef84c9aac07eb18c55b734add067c0d2
@@ -0,0 +1,5 @@
+# Locally calculated
+sha256  1fc34ffbf2a4f5cf161228f13242e28283bd818901d7daf0027e6ae5fcaeaf9b  virglrenderer-1.1.1.tar.gz
+
+# License
+sha256  3b32caf16e2402c2aff2b716858713f3e1feded85c25e71bf829816ee5009402  COPYING
package/virglrenderer/virglrenderer.mk new file +36 -0
new file mode 100644
index 0000000000000000000000000000000000000000..710a8dcd63a584c4c71b48b9d0b45db1c4c49f07
@@ -0,0 +1,36 @@
+################################################################################
+#
+# virglrenderer
+#
+################################################################################
+
+VIRGLRENDERER_VERSION = 1.1.1
+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 \
+	libdrm \
+	libegl \
+	host-pkgconf
+VIRGLRENDERER_CPE_ID_VALID = YES
+
+ifeq ($(BR2_PACKAGE_VIRGLRENDERER_VENUS),y)
+VIRGLRENDERER_CONF_OPTS += -Dvenus=true
+VIRGLRENDERER_DEPENDENCIES += vulkan-loader
+endif
+
+ifeq ($(BR2_PACKAGE_VIRGLRENDERER_DRM_AMDGPU),y)
+VIRGLRENDERER_DRM_BACKENDS += amdgpu-experimental
+endif
+
+ifeq ($(BR2_PACKAGE_VIRGLRENDERER_DRM_MSM),y)
+VIRGLRENDERER_DRM_BACKENDS += msm
+endif
+
+ifneq ($(VIRGLRENDERER_DRM_BACKENDS),)
+VIRGLRENDERER_CONF_OPTS += -Ddrm-renderers=$(VIRGLRENDERER_DRM_BACKENDS)
+endif
+
+$(eval $(meson-package))
Signature · 6 lines
2.50.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#6 lore raw

Hi Joseph, All,

Le 19/06/2025 à 02:59, Joseph Kogut a écrit :

Quoted 55 lines

Add 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          | 46 ++++++++++++++++++++++++++++++++
 package/virglrenderer/virglrenderer.hash |  5 ++++
 package/virglrenderer/virglrenderer.mk   | 36 +++++++++++++++++++++++++
 5 files changed, 89 insertions(+)
DEVELOPERS +1 -0
index 9e31f6b515578acb2fa199d31d9f6af5551a9830..21d2593b47883ea7bf8dbbd7bc5861f04359ecb3 100644
@@ -1775,6 +1775,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
index 10f6856dea5dfcc457bd2ce0145ebd5a3f5a2e25..ab082dcd3e2b9edc0c3dd0bbf11e8abae9578548 100644
@@ -1804,6 +1804,7 @@ menu "Graphics"
 	source "package/stb/Config.in"
 	source "package/tiff/Config.in"
 	source "package/unclutter-xfixes/Config.in"
+	source "package/virglrenderer/Config.in"
 	source "package/waffle/Config.in"
 	source "package/wayland/Config.in"
 	source "package/wayland-protocols/Config.in"
package/virglrenderer/Config.in new file +12 -0
new file mode 100644
index 0000000000000000000000000000000000000000..e81fbf732286a8d87a1f1070a73905fb6633d7dd
@@ -0,0 +1,46 @@
+config BR2_PACKAGE_VIRGLRENDERER
+	bool "virglrenderer"
+	depends on BR2_TOOLCHAIN_HAS_THREADS # libdrm
+	depends on BR2_USE_MMU # libdrm
+	depends on BR2_PACKAGE_HAS_LIBEGL || BR2_PACKAGE_HAS_LIBGL # libepoxy
+	select BR2_PACKAGE_LIBEPOXY
+	select BR2_PACKAGE_LIBDRM
+	help
+	  VirGL is a virtual 3D GPU for use inside QEMU
+	  virtual machines, that allows the guest operating
+	  system to use the capabilities of the host GPU to
+	  accelerate 3D rendering.

package/virglrenderer/Config.in line 22

Quoted 10 lines
package/virglrenderer/Config.in new file +10 -0
+
+	  https://docs.mesa3d.org/drivers/virgl.html
+
+if BR2_PACKAGE_VIRGLRENDERER
+
+config BR2_PACKAGE_VIRGLRENDERER_VENUS
+	bool "venus"
+	depends on BR2_INSTALL_LIBSTDCPP # vulkan-loader
+	depends on !BR2_STATIC_LIBS # vulkan-loader
+	depends on BR2_TOOLCHAIN_HAS_THREADS # vulkan-loader

BR2_PACKAGE_MESA3D_VULKAN_DRIVER_VIRTIO (Vulkan VirtIO driver (Venus)) is likely required here (maybe as runtime dependency).

package/virglrenderer/Config.in line 24

Quoted 2 lines
package/virglrenderer/Config.in new file +2 -0
+	select BR2_PACKAGE_VULKAN_HEADERS
+	select BR2_PACKAGE_VULKAN_LOADER

BR2_PACKAGE_VULKAN_LOADER already select BR2_PACKAGE_VULKAN_HEADERS.

package/virglrenderer/Config.in line 36

Quoted 12 lines
package/virglrenderer/Config.in new file +12 -0
+	help
+	  Venus is a virtio-gpu protocol for Vulkan command
+	  serialization.
+
+	  Say 'y' if you want to run applications with Vulkan
+	  acceleration in virtualized guests.
+
+	  https://docs.mesa3d.org/drivers/venus.html
+
+config BR2_PACKAGE_VIRGLRENDERER_DRM_AMDGPU
+	bool
+	default y if BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_RADEONSI

Why an hidden symbol here?
is virglrenderer can work without mesa3d ?

package/virglrenderer/Config.in line 37

Quoted 1 line
package/virglrenderer/Config.in new file +1 -0
+	depends on BR2_PACKAGE_USE_MMU # libdrm-amdgpu

s/BR2_PACKAGE_USE_MMU/BR2_USE_MMU/

package/virglrenderer/Config.in line 38

Quoted 1 line
package/virglrenderer/Config.in new file +1 -0
+	select BR2_PACKAGE_LIBDRM_AMDGPU

libdrm_amdgpu is already selected by BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_RADEONSI

package/virglrenderer/Config.in line 41

Quoted 3 lines
package/virglrenderer/Config.in new file +3 -0
+
+config BR2_PACKAGE_VIRGLRENDERER_DRM_MSM
+	bool

Why an hidden symbol here?

package/virglrenderer/Config.in line 44

Quoted 3 lines
package/virglrenderer/Config.in new file +3 -0
+	default y if BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_FREEDRENO
+	depends on BR2_arm || BR2_aarch64 || BR2_aarch64_be # libdrm-freedreno
+	select BR2_PACKAGE_LIBDRM_FREEDRENO

libdrm_dreedreno is already selected by BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_FREEDRENO

Quoted 24 lines
package/virglrenderer/Config.in new file +2 -0
+
+endif
package/virglrenderer/virglrenderer.hash new file +5 -0
new file mode 100644
index 0000000000000000000000000000000000000000..8b6ab7adef84c9aac07eb18c55b734add067c0d2
@@ -0,0 +1,5 @@
+# Locally calculated
+sha256  1fc34ffbf2a4f5cf161228f13242e28283bd818901d7daf0027e6ae5fcaeaf9b  virglrenderer-1.1.1.tar.gz
+
+# License
+sha256  3b32caf16e2402c2aff2b716858713f3e1feded85c25e71bf829816ee5009402  COPYING
package/virglrenderer/virglrenderer.mk new file +5 -0
new file mode 100644
index 0000000000000000000000000000000000000000..710a8dcd63a584c4c71b48b9d0b45db1c4c49f07
@@ -0,0 +1,36 @@
+################################################################################
+#
+# virglrenderer
+#
+################################################################################

package/virglrenderer/virglrenderer.mk line 15

Quoted 10 lines
package/virglrenderer/virglrenderer.mk new file +10 -0
+
+VIRGLRENDERER_VERSION = 1.1.1
+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 \
+	libdrm \
+	libegl \

What if BR2_PACKAGE_HAS_LIBGL=y ?
libegl should be used with BR2_PACKAGE_HAS_LIBEGL=y libgl should be used with BR2_PACKAGE_HAS_LIBGL=y

package/virglrenderer/virglrenderer.mk line 21

Quoted 6 lines
package/virglrenderer/virglrenderer.mk new file +6 -0
+	host-pkgconf
+VIRGLRENDERER_CPE_ID_VALID = YES
+
+ifeq ($(BR2_PACKAGE_VIRGLRENDERER_VENUS),y)
+VIRGLRENDERER_CONF_OPTS += -Dvenus=true
+VIRGLRENDERER_DEPENDENCIES += vulkan-loader

Is vulkan-headers or vulkan-loader needed at buildtime?

package/virglrenderer/virglrenderer.mk line 24

Quoted 3 lines
package/virglrenderer/virglrenderer.mk new file +3 -0
+endif
+
+ifeq ($(BR2_PACKAGE_VIRGLRENDERER_DRM_AMDGPU),y)

Have you considered using BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_RADEONSI here? (ok, it force to use mesa3d driver but is virglrenderer can work without mesa3d?)

ifeq ($(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_RADEONSI),y)

package/virglrenderer/virglrenderer.mk line 28

Quoted 4 lines
package/virglrenderer/virglrenderer.mk new file +4 -0
+VIRGLRENDERER_DRM_BACKENDS += amdgpu-experimental
+endif
+
+ifeq ($(BR2_PACKAGE_VIRGLRENDERER_DRM_MSM),y)

Same here with BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_FREEDRENO.

Best regards,
Romain

package/virglrenderer/virglrenderer.mk line 36

Quoted 8 lines
package/virglrenderer/virglrenderer.mk new file +8 -0
+VIRGLRENDERER_DRM_BACKENDS += msm
+endif
+
+ifneq ($(VIRGLRENDERER_DRM_BACKENDS),)
+VIRGLRENDERER_CONF_OPTS += -Ddrm-renderers=$(VIRGLRENDERER_DRM_BACKENDS)
+endif
+
+$(eval $(meson-package))

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#7 lore raw

Hello Romain,

Quoted 64 lines · Romain Naour

Hi Joseph, All,

Quoted 60 lines · Joseph Kogut

Add 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          | 46 ++++++++++++++++++++++++++++++++
 package/virglrenderer/virglrenderer.hash |  5 ++++
 package/virglrenderer/virglrenderer.mk   | 36 +++++++++++++++++++++++++
 5 files changed, 89 insertions(+)
DEVELOPERS +1 -0
index 9e31f6b515578acb2fa199d31d9f6af5551a9830..21d2593b47883ea7bf8dbbd7bc5861f04359ecb3 100644
@@ -1775,6 +1775,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
index 10f6856dea5dfcc457bd2ce0145ebd5a3f5a2e25..ab082dcd3e2b9edc0c3dd0bbf11e8abae9578548 100644
@@ -1804,6 +1804,7 @@ menu "Graphics"
      source "package/stb/Config.in"
      source "package/tiff/Config.in"
      source "package/unclutter-xfixes/Config.in"
+     source "package/virglrenderer/Config.in"
      source "package/waffle/Config.in"
      source "package/wayland/Config.in"
      source "package/wayland-protocols/Config.in"
package/virglrenderer/Config.in new file +17 -0
new file mode 100644
index 0000000000000000000000000000000000000000..e81fbf732286a8d87a1f1070a73905fb6633d7dd
@@ -0,0 +1,46 @@
+config BR2_PACKAGE_VIRGLRENDERER
+     bool "virglrenderer"
+     depends on BR2_TOOLCHAIN_HAS_THREADS # libdrm
+     depends on BR2_USE_MMU # libdrm
+     depends on BR2_PACKAGE_HAS_LIBEGL || BR2_PACKAGE_HAS_LIBGL # libepoxy
+     select BR2_PACKAGE_LIBEPOXY
+     select BR2_PACKAGE_LIBDRM
+     help
+       VirGL is a virtual 3D GPU for use inside QEMU
+       virtual machines, that allows the guest operating
+       system to use the capabilities of the host GPU to
+       accelerate 3D rendering.
+
+       https://docs.mesa3d.org/drivers/virgl.html
+
+if BR2_PACKAGE_VIRGLRENDERER
+
Quoted 9 lines

package/virglrenderer/Config.in line 22

Quoted 5 lines
package/virglrenderer/Config.in new file +5 -0
+config BR2_PACKAGE_VIRGLRENDERER_VENUS
+     bool "venus"
+     depends on BR2_INSTALL_LIBSTDCPP # vulkan-loader
+     depends on !BR2_STATIC_LIBS # vulkan-loader
+     depends on BR2_TOOLCHAIN_HAS_THREADS # vulkan-loader

BR2_PACKAGE_MESA3D_VULKAN_DRIVER_VIRTIO (Vulkan VirtIO driver (Venus)) is likely required here (maybe as runtime dependency).

The Mesa virtio vulkan driver is for guests to utilize the venus protocol to forward vulkan commands to the host through a virtio-gpu device. It's not required on the host, which uses virglrenderer to deserialize commands from the guest and do the actual rendering, unless the host's GPU is itself virtualized using virtio-gpu (nested).

Quoted 5 lines

package/virglrenderer/Config.in line 24

Quoted 2 lines
package/virglrenderer/Config.in new file +2 -0
+     select BR2_PACKAGE_VULKAN_HEADERS
+     select BR2_PACKAGE_VULKAN_LOADER

BR2_PACKAGE_VULKAN_LOADER already select BR2_PACKAGE_VULKAN_HEADERS.

Quoted 16 lines

package/virglrenderer/Config.in line 36

Quoted 12 lines
package/virglrenderer/Config.in new file +12 -0
+     help
+       Venus is a virtio-gpu protocol for Vulkan command
+       serialization.
+
+       Say 'y' if you want to run applications with Vulkan
+       acceleration in virtualized guests.
+
+       https://docs.mesa3d.org/drivers/venus.html
+
+config BR2_PACKAGE_VIRGLRENDERER_DRM_AMDGPU
+     bool
+     default y if BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_RADEONSI

Why an hidden symbol here?
is virglrenderer can work without mesa3d ?

I considered making this an explicitly configurable boolean, but it seems to me to always make sense to enable it when the associated DRM driver is enabled. I'm open to changing this to an explicit config if that's the preferred approach.

For additional context, virglrenderer has the capability to support OpenGL and Vulkan over virtio-gpu using the virgl and venus protocols respectively, which comes with significant performance overhead, or it can make the host GPU appear in the guest using vDRM, and the native driver can be used. The virglrenderer drm configs for amdgpu and freedreno enable vDRM support for these host drivers.

Additionally, virglrenderer *can* work on the host without mesa, so long as there's support for the required APIs. For example, the nvidia-driver package would satisfy the runtime dependencies of OpenGL and Vulkan. On the guest side, mesa is required.

This blog post goes into more detail:
https://www.collabora.com/news-and-blog/blog/2025/01/15/the-state-of-gfx-virtualization-using-virglrenderer/

Quoted 9 lines

package/virglrenderer/Config.in line 37

Quoted 2 lines
package/virglrenderer/Config.in new file +1 -0
+     depends on BR2_PACKAGE_USE_MMU # libdrm-amdgpu

s/BR2_PACKAGE_USE_MMU/BR2_USE_MMU/

package/virglrenderer/Config.in line 38

Quoted 1 line
package/virglrenderer/Config.in new file +1 -0
+     select BR2_PACKAGE_LIBDRM_AMDGPU

libdrm_amdgpu is already selected by BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_RADEONSI

Thanks, I'll revise this.

Quoted 6 lines

package/virglrenderer/Config.in line 41

Quoted 3 lines
package/virglrenderer/Config.in new file +3 -0
+
+config BR2_PACKAGE_VIRGLRENDERER_DRM_MSM
+     bool

Why an hidden symbol here?

See the above about the amdgpu vDRM support.

Quoted 6 lines

package/virglrenderer/Config.in line 44

Quoted 3 lines
package/virglrenderer/Config.in new file +3 -0
+     default y if BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_FREEDRENO
+     depends on BR2_arm || BR2_aarch64 || BR2_aarch64_be # libdrm-freedreno
+     select BR2_PACKAGE_LIBDRM_FREEDRENO

libdrm_dreedreno is already selected by BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_FREEDRENO

I'll fix this too.

Quoted 30 lines
Quoted 30 lines
package/virglrenderer/Config.in new file +2 -0
+
+endif
package/virglrenderer/virglrenderer.hash new file +5 -0
new file mode 100644
index 0000000000000000000000000000000000000000..8b6ab7adef84c9aac07eb18c55b734add067c0d2
@@ -0,0 +1,5 @@
+# Locally calculated
+sha256  1fc34ffbf2a4f5cf161228f13242e28283bd818901d7daf0027e6ae5fcaeaf9b  virglrenderer-1.1.1.tar.gz
+
+# License
+sha256  3b32caf16e2402c2aff2b716858713f3e1feded85c25e71bf829816ee5009402  COPYING
package/virglrenderer/virglrenderer.mk new file +11 -0
new file mode 100644
index 0000000000000000000000000000000000000000..710a8dcd63a584c4c71b48b9d0b45db1c4c49f07
@@ -0,0 +1,36 @@
+################################################################################
+#
+# virglrenderer
+#
+################################################################################
+
+VIRGLRENDERER_VERSION = 1.1.1
+VIRGLRENDERER_SITE = https://gitlab.freedesktop.org/virgl/virglrenderer/-/archive/$(VIRGLRENDERER_VERSION)
+VIRGLRENDERER_LICENSE = MIT
+VIRGLRENDERER_LICENSE_FILES = COPYING
+VIRGLRENDERER_INSTALL_STAGING = YES
Quoted 9 lines

package/virglrenderer/virglrenderer.mk line 15

Quoted 4 lines
package/virglrenderer/virglrenderer.mk new file +4 -0
+VIRGLRENDERER_DEPENDENCIES = \
+     libepoxy \
+     libdrm \
+     libegl \

What if BR2_PACKAGE_HAS_LIBGL=y ?
libegl should be used with BR2_PACKAGE_HAS_LIBEGL=y libgl should be used with BR2_PACKAGE_HAS_LIBGL=y

Libepoxy adds egl and libgl to its dependencies when selected. Should they still be added here as well?

Quoted 9 lines

package/virglrenderer/virglrenderer.mk line 21

Quoted 6 lines
package/virglrenderer/virglrenderer.mk new file +6 -0
+     host-pkgconf
+VIRGLRENDERER_CPE_ID_VALID = YES
+
+ifeq ($(BR2_PACKAGE_VIRGLRENDERER_VENUS),y)
+VIRGLRENDERER_CONF_OPTS += -Dvenus=true
+VIRGLRENDERER_DEPENDENCIES += vulkan-loader

Is vulkan-headers or vulkan-loader needed at buildtime?

I'll have to double check, I believe vulkan-headers is required at build time, and vulkan-loader is only required at runtime.

Quoted 6 lines

package/virglrenderer/virglrenderer.mk line 24

Quoted 3 lines
package/virglrenderer/virglrenderer.mk new file +3 -0
+endif
+
+ifeq ($(BR2_PACKAGE_VIRGLRENDERER_DRM_AMDGPU),y)

Have you considered using BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_RADEONSI here? (ok, it force to use mesa3d driver but is virglrenderer can work without mesa3d?)

Quoted 9 lines

ifeq ($(BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_RADEONSI),y)

package/virglrenderer/virglrenderer.mk line 28

Quoted 4 lines
package/virglrenderer/virglrenderer.mk new file +4 -0
+VIRGLRENDERER_DRM_BACKENDS += amdgpu-experimental
+endif
+
+ifeq ($(BR2_PACKAGE_VIRGLRENDERER_DRM_MSM),y)

Same here with BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_FREEDRENO.

I think you're right, we could either have explicit configs to enable the DRM backends for virglrenderer, or just enable them implicitly when the corresponding mesa drivers are enabled, without the hidden configs. I think this is a remnant of an earlier revision I worked on where the configs were explicit, and there's no reason to retain the hidden configs.

Quoted 4 lines

Best regards,
Romain

Thanks for the review.

Best,
Joseph
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#8 lore raw

PATCH 3/3 package/qemu: add virglrenderer support

In reply to Joseph Kogut

Add optional virglrenderer support.

This feature isn't very useful with opengl disabled, so enable that too.

https://www.qemu.org/docs/master/system/devices/virtio-gpu.html#virtio-gpu-virglrenderer

---
 package/qemu/Config.in | 12 ++++++++++++
 package/qemu/qemu.mk   |  8 +++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)
package/qemu/Config.in +12 -0
index 2d15ab1ea9c7889939e3fa4c532f3403c26edaed..334f1dcf5f68a2b3c5e72b4e67e68f94ac665e33 100644
@@ -100,6 +100,18 @@ config BR2_PACKAGE_QEMU_SDL
 	  Say 'y' to enable the SDL frontend, that is, a graphical
 	  window presenting the VM's display.
 
+comment "OpenGL and virglrenderer need an OpenGL and/or OpenGL EGL backend"
+	depends on !(BR2_PACKAGE_HAS_LIBEGL || BR2_PACKAGE_HASLIBGL)
+
+config BR2_PACKAGE_QEMU_VIRGLRENDERER
+	bool "Enable virglrenderer"
+	depends on BR2_PACKAGE_HAS_LIBEGL || BR2_PACKAGE_HAS_LIBGL # virglrenderer
+	select BR2_PACKAGE_VIRGLRENDERER
+	help
+	  Say 'y' to enable virglrenderer, enabling GL and
+	  Vulkan passthrough from the host to the guest
+	  through virtio-gpu.
+
 config BR2_PACKAGE_QEMU_FDT
 	bool "Enable FDT"
 	select BR2_PACKAGE_DTC
package/qemu/qemu.mk +7 -1
index fdc8591e546ab6b96fdb02b3742b75f587be239f..4221e027c07924f681359179692743420ffaa38e 100644
@@ -261,6 +261,13 @@ else
 QEMU_OPTS += --disable-usb-redir
 endif
 
+ifeq ($(BR2_PACKAGE_QEMU_VIRGLRENDERER),y)
+QEMU_OPTS += --enable-virglrenderer --enable-opengl
+QEMU_DEPENDENCIES += virglrenderer libepoxy
+else
+QEMU_OPTS += --disable-virglrenderer --disable-opengl
+endif
+
 ifeq ($(BR2_STATIC_LIBS),y)
 QEMU_OPTS += --static
 endif
@@ -310,7 +317,6 @@ define QEMU_CONFIGURE_CMDS
 			--disable-membarrier \
 			--disable-mpath \
 			--disable-netmap \
-			--disable-opengl \
 			--disable-oss \
 			--disable-pa \
 			--disable-plugins \
Signature · 6 lines
2.50.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#9 lore raw

Re: [Buildroot] [PATCH 3/3] package/qemu: add virglrenderer support

Hello Joseph, All,

Le 19/06/2025 à 02:59, Joseph Kogut a écrit :

Quoted 6 lines

Add optional virglrenderer support.

This feature isn't very useful with opengl disabled, so enable that too.

https://www.qemu.org/docs/master/system/devices/virtio-gpu.html#virtio-gpu-virglrenderer

Is host-qemu package could use virglrenderer (host-virglrenderer)? (probably not due to host-mesa)

Quoted 12 lines
---
 package/qemu/Config.in | 12 ++++++++++++
 package/qemu/qemu.mk   |  8 +++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)
package/qemu/Config.in +0 -0
index 2d15ab1ea9c7889939e3fa4c532f3403c26edaed..334f1dcf5f68a2b3c5e72b4e67e68f94ac665e33 100644

package/qemu/Config.in config BR2_PACKAGE_QEMU_SDL · line 104

Quoted 5 lines
package/qemu/Config.in +2 -0
@@ -100,6 +100,18 @@ config BR2_PACKAGE_QEMU_SDL
 	  Say 'y' to enable the SDL frontend, that is, a graphical
 	  window presenting the VM's display.
 
+comment "OpenGL and virglrenderer need an OpenGL and/or OpenGL EGL backend"
+	depends on !(BR2_PACKAGE_HAS_LIBEGL || BR2_PACKAGE_HASLIBGL)

s/BR2_PACKAGE_HASLIBGL/BR2_PACKAGE_HAS_LIBGL/

Quoted 18 lines
package/qemu/Config.in +10 -0
+
+config BR2_PACKAGE_QEMU_VIRGLRENDERER
+	bool "Enable virglrenderer"
+	depends on BR2_PACKAGE_HAS_LIBEGL || BR2_PACKAGE_HAS_LIBGL # virglrenderer
+	select BR2_PACKAGE_VIRGLRENDERER
+	help
+	  Say 'y' to enable virglrenderer, enabling GL and
+	  Vulkan passthrough from the host to the guest
+	  through virtio-gpu.
+
 config BR2_PACKAGE_QEMU_FDT
 	bool "Enable FDT"
 	select BR2_PACKAGE_DTC
package/qemu/qemu.mk +0 -0
index fdc8591e546ab6b96fdb02b3742b75f587be239f..4221e027c07924f681359179692743420ffaa38e 100644

package/qemu/qemu.mk else · line 265

Quoted 5 lines
package/qemu/qemu.mk +2 -0
@@ -261,6 +261,13 @@ else
 QEMU_OPTS += --disable-usb-redir
 endif
 
+ifeq ($(BR2_PACKAGE_QEMU_VIRGLRENDERER),y)
+QEMU_OPTS += --enable-virglrenderer --enable-opengl

I'm wondering (I would prefer) if we need a separate option to enable opengl support in Qemu.

Best regards,
Romain

Quoted 9 lines
package/qemu/qemu.mk +5 -0
+QEMU_DEPENDENCIES += virglrenderer libepoxy
+else
+QEMU_OPTS += --disable-virglrenderer --disable-opengl
+endif
+
 ifeq ($(BR2_STATIC_LIBS),y)
 QEMU_OPTS += --static
 endif

package/qemu/qemu.mk define QEMU_CONFIGURE_CMDS · line 322

Quoted 7 lines
package/qemu/qemu.mk +0 -1
@@ -310,7 +317,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

#10 lore raw

Re: [Buildroot] [PATCH 3/3] package/qemu: add virglrenderer support

Hello Romain,

Quoted 6 lines · Romain Naour

Hello Joseph, All,

Quoted 2 lines · Joseph Kogut

Add optional virglrenderer support.

Quoted 8 lines
Quoted 4 lines

This feature isn't very useful with opengl disabled, so enable that too.

https://www.qemu.org/docs/master/system/devices/virtio-gpu.html#virtio-gpu-virglrenderer

Is host-qemu package could use virglrenderer (host-virglrenderer)? (probably not due to host-mesa)

I think I looked into this when developing this patch series, and while it's technically feasible (and useful for testing!), there were blockers. It's something that could be explored in later patches. As you mention, we'd have to have libgl on the host, libepoxy, libegl, etc.

Quoted 15 lines
Quoted 15 lines
---
 package/qemu/Config.in | 12 ++++++++++++
 package/qemu/qemu.mk   |  8 +++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)
package/qemu/Config.in +0 -0
index 2d15ab1ea9c7889939e3fa4c532f3403c26edaed..334f1dcf5f68a2b3c5e72b4e67e68f94ac665e33 100644
@@ -100,6 +100,18 @@ config BR2_PACKAGE_QEMU_SDL
        Say 'y' to enable the SDL frontend, that is, a graphical
        window presenting the VM's display.
 
Quoted 5 lines

package/qemu/Config.in config BR2_PACKAGE_QEMU_SDL · line 104

Quoted 2 lines
package/qemu/Config.in +2 -0
+comment "OpenGL and virglrenderer need an OpenGL and/or OpenGL EGL backend"
+     depends on !(BR2_PACKAGE_HAS_LIBEGL || BR2_PACKAGE_HASLIBGL)

s/BR2_PACKAGE_HASLIBGL/BR2_PACKAGE_HAS_LIBGL/

Thanks, I'll fix this.

Quoted 21 lines
Quoted 21 lines
package/qemu/Config.in +10 -0
+
+config BR2_PACKAGE_QEMU_VIRGLRENDERER
+     bool "Enable virglrenderer"
+     depends on BR2_PACKAGE_HAS_LIBEGL || BR2_PACKAGE_HAS_LIBGL # virglrenderer
+     select BR2_PACKAGE_VIRGLRENDERER
+     help
+       Say 'y' to enable virglrenderer, enabling GL and
+       Vulkan passthrough from the host to the guest
+       through virtio-gpu.
+
 config BR2_PACKAGE_QEMU_FDT
      bool "Enable FDT"
      select BR2_PACKAGE_DTC
package/qemu/qemu.mk +0 -0
index fdc8591e546ab6b96fdb02b3742b75f587be239f..4221e027c07924f681359179692743420ffaa38e 100644
@@ -261,6 +261,13 @@ else
 QEMU_OPTS += --disable-usb-redir
 endif
 
Quoted 6 lines

package/qemu/qemu.mk else · line 265

Quoted 2 lines
package/qemu/qemu.mk +2 -0
+ifeq ($(BR2_PACKAGE_QEMU_VIRGLRENDERER),y)
+QEMU_OPTS += --enable-virglrenderer --enable-opengl

I'm wondering (I would prefer) if we need a separate option to enable opengl support in Qemu.

I think this makes sense. The virglrenderer config could just select this.

Best,
Joseph
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot