runqemu: add an option to choose the SDL frontend instead of Gtk+ default
PATCH 1/9 runqemu: add an option to choose the SDL frontend instead of Gtk+ default
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
@@ -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
PATCH 2/9 runqemu: make gl options gtk+-specific
If in the future GL is enabled for SDL frontend, or some other frontend, it would be useful to be able to differentiate.
--- scripts/runqemu | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
scripts/runqemu +4 -4
@@ -75,8 +75,8 @@ of the following environment variables (in any order): 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 + gtk-gl - enable virgl-based GL acceleration using Gtk+ frontend + gtk-gl-es - enable virgl-based GL acceleration, using OpenGL ES and Gtk+ frontend egl-headless - enable headless EGL output; use vnc or spice to see it serial - enable a serial console on /dev/ttyS0 serialstdio - enable a serial console on the console (regardless of graphics mode)
@@ -407,9 +407,9 @@ class BaseConfig(object): self.kernel_cmdline_script += ' console=ttyS0' elif arg == 'sdl': self.qemu_opt_script += ' -display sdl' - elif arg == 'gl': + elif arg == 'gtk-gl': self.qemu_opt_script += ' -vga virtio -display gtk,gl=on' - elif arg == 'gl-es': + elif arg == 'gtk-gl-es': self.qemu_opt_script += ' -vga virtio -display gtk,gl=es' elif arg == 'egl-headless': self.qemu_opt_script += ' -vga virtio -display egl-headless'
Signature · 1 line
2.17.1
PATCH 3/9 qemu: enable virglrenderer and glx options for qemu-system-native and nativesdk-qemu
In reply to Alexander KanavinNote 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
@@ -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
@@ -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
PATCH 4/9 qemu: add a gtk+ frontend to target builds
In reply to Alexander Kanavinsdl 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
@@ -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
PATCH 5/9 qemu: remove sdl option from PACKAGECONFIG default
In reply to Alexander KanavinThis 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
@@ -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
PATCH 6/9 qemu: remove support for building against host sdl
In reply to Alexander KanavinThis 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
@@ -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
PATCH 7/9 selftest: add tests for virgl GL acceleration
In reply to Alexander KanavinNote 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
@@ -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
PATCH 8/9 local.conf.sample: enable gtk+ frontend in addition to sdl
In reply to Alexander KanavinAs 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 | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
meta-poky/conf/local.conf.sample +6 -5
@@ -238,11 +238,12 @@ 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" +# seen. The two lines below enable the SDL and Gtk UI frontends as well. +# +# 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 gtk+" +PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl gtk+" #ASSUME_PROVIDED += "libsdl2-native" # CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to
Signature · 1 line
2.17.1
PATCH 9/9 local.conf.sample: remove support for building against host libsdl
In reply to Alexander Kanavin--- meta-poky/conf/local.conf.sample | 4 ---- 1 file changed, 4 deletions(-)
meta-poky/conf/local.conf.sample +0 -4
@@ -239,12 +239,8 @@ BB_DISKMON_DIRS ??= "\ # # By default qemu will build with a builtin VNC server where graphical output can be # seen. The two lines below enable the SDL and Gtk UI frontends as well. -# -# 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 gtk+" PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl gtk+" -#ASSUME_PROVIDED += "libsdl2-native" # 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