Skip to contentSkip to conversation

qemu: remove glx/virgl/gtk options from darwin/mingw targets

PATCH In review Alexander Kanavin 2 participants 10 messages Feb 28, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/8 qemu: remove glx/virgl/gtk options from darwin/mingw targets

As they are not supported, and would lead to build failures.

---
 meta/recipes-devtools/qemu/qemu.inc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
meta/recipes-devtools/qemu/qemu.inc +3 -3
index ebee2974d2f..985289f5426 100644
@@ -122,9 +122,9 @@ make_qemu_wrapper() {
         done
 }
 
-# Disable kvm on targets that do not support it
-PACKAGECONFIG_remove_darwin = "kvm"
-PACKAGECONFIG_remove_mingw32 = "kvm"
+# Disable kvm/virgl/mesa on targets that do not support it
+PACKAGECONFIG_remove_darwin = "kvm virglrenderer glx gtk+"
+PACKAGECONFIG_remove_mingw32 = "kvm virglrenderer glx gtk+"
 
 PACKAGECONFIG[sdl] = "--enable-sdl --with-sdlabi=2.0,--disable-sdl,libsdl2"
 PACKAGECONFIG[virtfs] = "--enable-virtfs --enable-attr,--disable-virtfs,libcap attr,"
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/8 qemu: enable virglrenderer and glx options for qemu-system-native and nativesdk-qemu

Note that to actually use accelerated GL passthrough, there are two options

1) a suitable frontend need to be also enabled - gtk+ seems to work well, sdl was found to be buggy.

2) it is also possible to render off-screen with -display egl-headless option, and see the output with a VNC viewer (for which, qemu needs to be started with a VNC server):

$ runqemu kvm egl-headless publicvnc
---
 meta/recipes-devtools/qemu/qemu-system-native_3.1.0.bb | 2 +-
 meta/recipes-devtools/qemu/qemu_3.1.0.bb               | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
meta/recipes-devtools/qemu/qemu-system-native_3.1.0.bb +1 -1
index 5bf528bec12..95369d7f6a2 100644
@@ -9,7 +9,7 @@ DEPENDS = "glib-2.0-native zlib-native pixman-native qemu-native"
 
 EXTRA_OECONF_append = " --target-list=${@get_qemu_system_target_list(d)}"
 
-PACKAGECONFIG ??= "fdt alsa kvm"
+PACKAGECONFIG ??= "fdt alsa kvm virglrenderer glx"
 
 # Handle distros such as CentOS 5 32-bit that do not have kvm support
 PACKAGECONFIG_remove = "${@'kvm' if not os.path.exists('/usr/include/linux/kvm.h') else ''}"
meta/recipes-devtools/qemu/qemu_3.1.0.bb +1 -1
index 04d8bee99f2..3c404d408d0 100644
@@ -17,6 +17,6 @@ PACKAGECONFIG ??= " \
     fdt sdl kvm \
     ${@bb.utils.filter('DISTRO_FEATURES', 'alsa xen', d)} \
 "
-PACKAGECONFIG_class-nativesdk ??= "fdt sdl kvm"
+PACKAGECONFIG_class-nativesdk ??= "fdt sdl kvm virglrenderer glx"
 
 
Signature · 1 line
2.17.1
#2 lore raw

PATCH 3/8 qemu: add a gtk+ frontend to target builds

In reply to Alexander Kanavin

sdl frontend remains enabled and available

---
 meta/recipes-devtools/qemu/qemu_3.1.0.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-devtools/qemu/qemu_3.1.0.bb +1 -1
index 3c404d408d0..26a33b4d860 100644
@@ -14,7 +14,7 @@ do_install_append_class-nativesdk() {
 }
 
 PACKAGECONFIG ??= " \
-    fdt sdl kvm \
+    fdt sdl gtk+ kvm \
     ${@bb.utils.filter('DISTRO_FEATURES', 'alsa xen', d)} \
 "
 PACKAGECONFIG_class-nativesdk ??= "fdt sdl kvm virglrenderer glx"
Signature · 1 line
2.17.1
#3 lore raw

PATCH 4/8 qemu: remove sdl option from PACKAGECONFIG default

In reply to Alexander Kanavin

This removes confusion over where qemu frontends are enabled for native/nativesdk builds: currently they are also set in local.conf.sample from poky distro, and with this change that becomes the only place.

---
 meta/recipes-devtools/qemu/qemu_3.1.0.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-devtools/qemu/qemu_3.1.0.bb +1 -1
index 26a33b4d860..8457e2c2f87 100644
@@ -17,6 +17,6 @@ PACKAGECONFIG ??= " \
     fdt sdl gtk+ kvm \
     ${@bb.utils.filter('DISTRO_FEATURES', 'alsa xen', d)} \
 "
-PACKAGECONFIG_class-nativesdk ??= "fdt sdl kvm virglrenderer glx"
+PACKAGECONFIG_class-nativesdk ??= "fdt kvm virglrenderer glx"
 
 
Signature · 1 line
2.17.1
#4 lore raw

PATCH 5/8 qemu: remove support for building against host sdl

In reply to Alexander Kanavin

This hasn't been the default for a long time (as some distros don't support it), and with gtk+ being the new default shouldn't be needed at all.

---
 meta/recipes-devtools/qemu/qemu.inc | 8 --------
 1 file changed, 8 deletions(-)
meta/recipes-devtools/qemu/qemu.inc +0 -8
index 985289f5426..a9d28bf5a38 100644
@@ -80,14 +80,6 @@ export LIBTOOL="${HOST_SYS}-libtool"
 
 B = "${WORKDIR}/build"
 
-do_configure_prepend_class-native() {
-	# Append build host pkg-config paths for native target since the host may provide sdl
-	BHOST_PKGCONFIG_PATH=$(PATH=/usr/bin:/bin pkg-config --variable pc_path pkg-config || echo "")
-	if [ ! -z "$BHOST_PKGCONFIG_PATH" ]; then
-		export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$BHOST_PKGCONFIG_PATH
-	fi
-}
-
 do_configure() {
     ${S}/configure ${EXTRA_OECONF}
 }
Signature · 1 line
2.17.1
#5 lore raw

PATCH 6/8 selftest: add tests for virgl GL acceleration

In reply to Alexander Kanavin

Note that the tests require that the host machine has a X display, has mesa development files installed and is able to create OpenGL contexts.

---
 meta-selftest/lib/oeqa/runtime/cases/virgl.py | 28 ++++++++++
 meta/lib/oeqa/selftest/cases/runtime_test.py  | 52 +++++++++++++++++++
 2 files changed, 80 insertions(+)
 create mode 100644 meta-selftest/lib/oeqa/runtime/cases/virgl.py
meta-selftest/lib/oeqa/runtime/cases/virgl.py new file +28 -0
new file mode 100644
index 00000000000..cc25e77d9c0
@@ -0,0 +1,28 @@
+from oeqa.runtime.case import OERuntimeTestCase
+from oeqa.core.decorator.depends import OETestDepends
+import subprocess
+import oe
+
+class VirglTest(OERuntimeTestCase):
+
+    @OETestDepends(['ssh.SSHTest.test_ssh'])
+    def test_kernel_driver(self):
+        status, output = self.target.run('dmesg|grep virgl')
+        self.assertEqual(status, 0, "Checking for virgl driver in dmesg returned non-zero: %d\n%s" % (status, output))
+        self.assertIn("virgl 3d acceleration enabled", output, "virgl acceleration seems to be disabled:\n%s" %(output))
+
+    @OETestDepends(['virgl.VirglTest.test_kernel_driver'])
+    def test_kmscube(self):
+        from fnmatch import fnmatch
+
+        try:
+            distro = oe.lsb.distro_identifier()
+        except Exception:
+            distro = None
+
+        if distro and fnmatch(distro, 'centos-7'):
+            self.skipTest('kmscube is not working when centos 7 is the host OS')
+
+        status, output = self.target.run('kmscube', timeout=30)
+        self.assertEqual(status, 0, "kmscube exited with non-zero status %d and output:\n%s" %(status, output))
+        self.assertIn('renderer: "virgl"', output, "kmscube does not seem to use virgl:\n%s" %(output))
meta/lib/oeqa/selftest/cases/runtime_test.py +52 -0

58 lines not on this page · raw message

Signature · 1 line
2.17.1
#6 lore raw

PATCH 7/8 runqemu: add an option to choose the SDL frontend instead of Gtk+ default

In reply to Alexander Kanavin

When Gtk+ and SDL are both enabled, qemu defaults to Gtk+. This option allows to revert to the 'classic' frontend.

---
 scripts/runqemu | 3 +++
 1 file changed, 3 insertions(+)
scripts/runqemu +3 -0
index ec6188ba4a2..bbf539a8e67 100755
@@ -74,6 +74,7 @@ of the following environment variables (in any order):
   MACHINE - the machine name (optional, autodetected from KERNEL filename if unspecified)
   Simplified QEMU command-line options can be passed with:
     nographic - disable video console
+    sdl - choose the SDL frontend instead of the Gtk+ default
     gl - enable virgl-based GL acceleration
     gl-es - enable virgl-based GL acceleration, using OpenGL ES
     egl-headless - enable headless EGL output; use vnc or spice to see it
@@ -404,6 +405,8 @@ class BaseConfig(object):
             elif arg == 'nographic':
                 self.qemu_opt_script += ' -nographic'
                 self.kernel_cmdline_script += ' console=ttyS0'
+            elif arg == 'sdl':
+                self.qemu_opt_script += ' -display sdl'
             elif arg == 'gl':
                 self.qemu_opt_script += ' -vga virtio -display gtk,gl=on'
             elif arg == 'gl-es':
Signature · 1 line
2.17.1
#7 lore raw

Re: [PATCH 7/8] runqemu: add an option to choose the SDL frontend instead of Gtk+ default

Quoted 13 lines · Alexander Kanavin

When Gtk+ and SDL are both enabled, qemu defaults to Gtk+. This option allows to revert to the 'classic' frontend.

---
 scripts/runqemu | 3 +++
 1 file changed, 3 insertions(+)
scripts/runqemu +0 -0
index ec6188ba4a2..bbf539a8e67 100755

scripts/runqemu of the following environment variables (in any order): · line 78

Quoted 5 lines
scripts/runqemu +1 -0
@@ -74,6 +74,7 @@ of the following environment variables (in any order):
   MACHINE - the machine name (optional, autodetected from KERNEL filename if unspecified)
   Simplified QEMU command-line options can be passed with:
     nographic - disable video console
+    sdl - choose the SDL frontend instead of the Gtk+ default
     gl - enable virgl-based GL acceleration

can we call this gtk-gl

scripts/runqemu of the following environment variables (in any order): · line 79

Quoted 1 line
scripts/runqemu +0 -0
     gl-es - enable virgl-based GL acceleration, using OpenGL ES

and gtk-gl-es

to make it easier to add sdl-gl?

Quoted 18 lines
scripts/runqemu +2 -0
     egl-headless - enable headless EGL output; use vnc or spice to see it
@@ -404,6 +405,8 @@ class BaseConfig(object):
             elif arg == 'nographic':
                 self.qemu_opt_script += ' -nographic'
                 self.kernel_cmdline_script += ' console=ttyS0'
+            elif arg == 'sdl':
+                self.qemu_opt_script += ' -display sdl'
             elif arg == 'gl':
                 self.qemu_opt_script += ' -vga virtio -display gtk,gl=on'
             elif arg == 'gl-es':
Signature · 7 lines
2.17.1

-- 
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#8 lore raw

Re: [PATCH 7/8] runqemu: add an option to choose the SDL frontend instead of Gtk+ default

Quoted 21 lines · Martin Jansa
Quoted 13 lines

When Gtk+ and SDL are both enabled, qemu defaults to Gtk+. This option allows to revert to the 'classic' frontend.

---
 scripts/runqemu | 3 +++
 1 file changed, 3 insertions(+)
scripts/runqemu +0 -0
index ec6188ba4a2..bbf539a8e67 100755

scripts/runqemu of the following environment variables (in any order): · line 78

Quoted 5 lines
scripts/runqemu +1 -0
@@ -74,6 +74,7 @@ of the following environment variables (in any order):
   MACHINE - the machine name (optional, autodetected from KERNEL filename if unspecified)
   Simplified QEMU command-line options can be passed with:
     nographic - disable video console
+    sdl - choose the SDL frontend instead of the Gtk+ default
     gl - enable virgl-based GL acceleration

can we call this gtk-gl

Quoted 5 lines

scripts/runqemu of the following environment variables (in any order): · line 79

Quoted 1 line
scripts/runqemu +0 -0
     gl-es - enable virgl-based GL acceleration, using OpenGL ES

and gtk-gl-es

to make it easier to add sdl-gl?

Sure. I'll add a patch.

Alex

#9 lore raw

PATCH 8/8 local.conf.sample: enable gtk+ frontend in addition to sdl

In reply to Alexander Kanavin

As SDL was found to be buggy for virgl-based GL passthrough, gtk+ is enabled to allow that use case.

---
 meta-poky/conf/local.conf.sample | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
meta-poky/conf/local.conf.sample +3 -6
index 9068e567dcd..00795ae6a3f 100644
@@ -238,12 +238,9 @@ BB_DISKMON_DIRS ??= "\
 # Qemu configuration
 #
 # By default qemu will build with a builtin VNC server where graphical output can be
-# seen. The two lines below enable the SDL backend too. By default libsdl2-native will
-# be built, if you want to use your host's libSDL instead of the minimal libsdl built
-# by libsdl2-native then uncomment the ASSUME_PROVIDED line below.
-PACKAGECONFIG_append_pn-qemu-system-native = " sdl"
-PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl"
-#ASSUME_PROVIDED += "libsdl2-native"
+# seen. The two lines below enable the SDL and Gtk UI frontends as well.
+PACKAGECONFIG_append_pn-qemu-system-native = " sdl gtk+"
+PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl gtk+"
 
 # CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to
 # track the version of this file when it was generated. This can safely be ignored if
Signature · 1 line
2.17.1