diff mbox series

[v7,7/8] package/qemu: add virglrenderer integration

Message ID 20260515-virglrenderer-v7-7-1f1814b65ccd@gmail.com
State Changes Requested
Headers show
Series Add virglrenderer support | expand

Commit Message

Joseph Kogut May 16, 2026, 2:03 a.m. UTC
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 <joseph.kogut@gmail.com>
---
 package/qemu/Config.in | 21 +++++++++++++++++++++
 package/qemu/qemu.mk   |  7 +++++++
 2 files changed, 28 insertions(+)

Comments

Arnout Vandecappelle May 21, 2026, 8:24 p.m. UTC | #1
On 16/05/2026 04:03, Joseph Kogut wrote:
> 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 <joseph.kogut@gmail.com>
> ---
>   package/qemu/Config.in | 21 +++++++++++++++++++++
>   package/qemu/qemu.mk   |  7 +++++++
>   2 files changed, 28 insertions(+)
> 
> diff --git a/package/qemu/Config.in b/package/qemu/Config.in
> index d4e4e37a3e..dbae7c4de4 100644
> --- a/package/qemu/Config.in
> +++ b/package/qemu/Config.in
> @@ -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

  Does it actually work if you have a DRM backend but no virgl or venus? I'm 
confused again...

  Regards,
  Arnout

> +
>   config BR2_PACKAGE_QEMU_FDT
>   	bool "Enable FDT"
>   	select BR2_PACKAGE_DTC
> diff --git a/package/qemu/qemu.mk b/package/qemu/qemu.mk
> index aff1762fb9..4f4786532c 100644
> --- a/package/qemu/qemu.mk
> +++ b/package/qemu/qemu.mk
> @@ -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
>
Joseph Kogut May 21, 2026, 8:51 p.m. UTC | #2
Hello Arnout,

On Thu, May 21, 2026, 15:24 Arnout Vandecappelle <arnout@rnout.be> wrote:

>
>
> On 16/05/2026 04:03, Joseph Kogut wrote:
> > 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 <joseph.kogut@gmail.com>
> > ---
> >   package/qemu/Config.in | 21 +++++++++++++++++++++
> >   package/qemu/qemu.mk   |  7 +++++++
> >   2 files changed, 28 insertions(+)
> >
> > diff --git a/package/qemu/Config.in b/package/qemu/Config.in
> > index d4e4e37a3e..dbae7c4de4 100644
> > --- a/package/qemu/Config.in
> > +++ b/package/qemu/Config.in
> > @@ -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
>
>   Does 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
Joseph Kogut May 22, 2026, 11:29 a.m. UTC | #3
On Thu, May 21, 2026 at 3:51 PM Joseph Kogut <joseph.kogut@gmail.com> wrote:
>
> Hello Arnout,
>
> On Thu, May 21, 2026, 15:24 Arnout Vandecappelle <arnout@rnout.be> wrote:
>>
>>
>>
>> On 16/05/2026 04:03, Joseph Kogut wrote:
>> > 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 <joseph.kogut@gmail.com>
>> > ---
>> >   package/qemu/Config.in | 21 +++++++++++++++++++++
>> >   package/qemu/qemu.mk   |  7 +++++++
>> >   2 files changed, 28 insertions(+)
>> >
>> > diff --git a/package/qemu/Config.in b/package/qemu/Config.in
>> > index d4e4e37a3e..dbae7c4de4 100644
>> > --- a/package/qemu/Config.in
>> > +++ b/package/qemu/Config.in
>> > @@ -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
>>
>>   Does 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

Sorry for the HTML message. :/

That's what I get for trying to reply to a message with my phone's email client.
diff mbox series

Patch

diff --git a/package/qemu/Config.in b/package/qemu/Config.in
index d4e4e37a3e..dbae7c4de4 100644
--- a/package/qemu/Config.in
+++ b/package/qemu/Config.in
@@ -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
diff --git a/package/qemu/qemu.mk b/package/qemu/qemu.mk
index aff1762fb9..4f4786532c 100644
--- a/package/qemu/qemu.mk
+++ b/package/qemu/qemu.mk
@@ -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