* [PATCH 2/8] qemu: enable virglrenderer and glx options for qemu-system-native and nativesdk-qemu
2019-02-28 13:15 [PATCH 1/8] qemu: remove glx/virgl/gtk options from darwin/mingw targets Alexander Kanavin
@ 2019-02-28 13:15 ` Alexander Kanavin
2019-02-28 13:15 ` [PATCH 3/8] qemu: add a gtk+ frontend to target builds Alexander Kanavin
` (5 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Alexander Kanavin @ 2019-02-28 13:15 UTC (permalink / raw)
To: openembedded-core
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
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
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(-)
diff --git a/meta/recipes-devtools/qemu/qemu-system-native_3.1.0.bb b/meta/recipes-devtools/qemu/qemu-system-native_3.1.0.bb
index 5bf528bec12..95369d7f6a2 100644
--- a/meta/recipes-devtools/qemu/qemu-system-native_3.1.0.bb
+++ b/meta/recipes-devtools/qemu/qemu-system-native_3.1.0.bb
@@ -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 ''}"
diff --git a/meta/recipes-devtools/qemu/qemu_3.1.0.bb b/meta/recipes-devtools/qemu/qemu_3.1.0.bb
index 04d8bee99f2..3c404d408d0 100644
--- a/meta/recipes-devtools/qemu/qemu_3.1.0.bb
+++ b/meta/recipes-devtools/qemu/qemu_3.1.0.bb
@@ -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"
--
2.17.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 3/8] qemu: add a gtk+ frontend to target builds
2019-02-28 13:15 [PATCH 1/8] qemu: remove glx/virgl/gtk options from darwin/mingw targets Alexander Kanavin
2019-02-28 13:15 ` [PATCH 2/8] qemu: enable virglrenderer and glx options for qemu-system-native and nativesdk-qemu Alexander Kanavin
@ 2019-02-28 13:15 ` Alexander Kanavin
2019-02-28 13:15 ` [PATCH 4/8] qemu: remove sdl option from PACKAGECONFIG default Alexander Kanavin
` (4 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Alexander Kanavin @ 2019-02-28 13:15 UTC (permalink / raw)
To: openembedded-core
sdl frontend remains enabled and available
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
meta/recipes-devtools/qemu/qemu_3.1.0.bb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meta/recipes-devtools/qemu/qemu_3.1.0.bb b/meta/recipes-devtools/qemu/qemu_3.1.0.bb
index 3c404d408d0..26a33b4d860 100644
--- a/meta/recipes-devtools/qemu/qemu_3.1.0.bb
+++ b/meta/recipes-devtools/qemu/qemu_3.1.0.bb
@@ -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"
--
2.17.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 4/8] qemu: remove sdl option from PACKAGECONFIG default
2019-02-28 13:15 [PATCH 1/8] qemu: remove glx/virgl/gtk options from darwin/mingw targets Alexander Kanavin
2019-02-28 13:15 ` [PATCH 2/8] qemu: enable virglrenderer and glx options for qemu-system-native and nativesdk-qemu Alexander Kanavin
2019-02-28 13:15 ` [PATCH 3/8] qemu: add a gtk+ frontend to target builds Alexander Kanavin
@ 2019-02-28 13:15 ` Alexander Kanavin
2019-02-28 13:15 ` [PATCH 5/8] qemu: remove support for building against host sdl Alexander Kanavin
` (3 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Alexander Kanavin @ 2019-02-28 13:15 UTC (permalink / raw)
To: openembedded-core
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.
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
meta/recipes-devtools/qemu/qemu_3.1.0.bb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meta/recipes-devtools/qemu/qemu_3.1.0.bb b/meta/recipes-devtools/qemu/qemu_3.1.0.bb
index 26a33b4d860..8457e2c2f87 100644
--- a/meta/recipes-devtools/qemu/qemu_3.1.0.bb
+++ b/meta/recipes-devtools/qemu/qemu_3.1.0.bb
@@ -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"
--
2.17.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 5/8] qemu: remove support for building against host sdl
2019-02-28 13:15 [PATCH 1/8] qemu: remove glx/virgl/gtk options from darwin/mingw targets Alexander Kanavin
` (2 preceding siblings ...)
2019-02-28 13:15 ` [PATCH 4/8] qemu: remove sdl option from PACKAGECONFIG default Alexander Kanavin
@ 2019-02-28 13:15 ` Alexander Kanavin
2019-02-28 13:15 ` [PATCH 6/8] selftest: add tests for virgl GL acceleration Alexander Kanavin
` (2 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Alexander Kanavin @ 2019-02-28 13:15 UTC (permalink / raw)
To: openembedded-core
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.
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
meta/recipes-devtools/qemu/qemu.inc | 8 --------
1 file changed, 8 deletions(-)
diff --git a/meta/recipes-devtools/qemu/qemu.inc b/meta/recipes-devtools/qemu/qemu.inc
index 985289f5426..a9d28bf5a38 100644
--- a/meta/recipes-devtools/qemu/qemu.inc
+++ b/meta/recipes-devtools/qemu/qemu.inc
@@ -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}
}
--
2.17.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 6/8] selftest: add tests for virgl GL acceleration
2019-02-28 13:15 [PATCH 1/8] qemu: remove glx/virgl/gtk options from darwin/mingw targets Alexander Kanavin
` (3 preceding siblings ...)
2019-02-28 13:15 ` [PATCH 5/8] qemu: remove support for building against host sdl Alexander Kanavin
@ 2019-02-28 13:15 ` Alexander Kanavin
2019-02-28 13:15 ` [PATCH 7/8] runqemu: add an option to choose the SDL frontend instead of Gtk+ default Alexander Kanavin
2019-02-28 13:15 ` [PATCH 8/8] local.conf.sample: enable gtk+ frontend in addition to sdl Alexander Kanavin
6 siblings, 0 replies; 10+ messages in thread
From: Alexander Kanavin @ 2019-02-28 13:15 UTC (permalink / raw)
To: openembedded-core
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.
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
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
diff --git a/meta-selftest/lib/oeqa/runtime/cases/virgl.py b/meta-selftest/lib/oeqa/runtime/cases/virgl.py
new file mode 100644
index 00000000000..cc25e77d9c0
--- /dev/null
+++ b/meta-selftest/lib/oeqa/runtime/cases/virgl.py
@@ -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))
diff --git a/meta/lib/oeqa/selftest/cases/runtime_test.py b/meta/lib/oeqa/selftest/cases/runtime_test.py
index 906e460d4f8..3cecdc8e42b 100644
--- a/meta/lib/oeqa/selftest/cases/runtime_test.py
+++ b/meta/lib/oeqa/selftest/cases/runtime_test.py
@@ -168,6 +168,58 @@ class TestImage(OESelftestTestCase):
# remove the oeqa-feed-sign temporal directory
shutil.rmtree(self.gpg_home, ignore_errors=True)
+ @OETestID(1883)
+ def test_testimage_virgl_gtk(self):
+ """
+ Summary: Check host-assisted accelerate OpenGL functionality in qemu with gtk frontend
+ Expected: 1. Check that virgl kernel driver is loaded and 3d acceleration is enabled
+ 2. Check that kmscube demo runs without crashing.
+ Product: oe-core
+ Author: Alexander Kanavin <alex.kanavin@gmail.com>
+ """
+ if "DISPLAY" not in os.environ:
+ self.skipTest("virgl gtk test must be run inside a X session")
+ qemu_packageconfig = get_bb_var('PACKAGECONFIG', 'qemu-native')
+ features = 'INHERIT += "testimage"\n'
+ if 'gtk+' not in qemu_packageconfig:
+ features += 'PACKAGECONFIG_append_pn-qemu-native = " gtk+"\n'
+ features += 'TEST_SUITES = "ping ssh virgl"\n'
+ features += 'IMAGE_FEATURES_append = " ssh-server-dropbear"\n'
+ features += 'IMAGE_INSTALL_append = " kmscube"\n'
+ features += 'TEST_RUNQEMUPARAMS = "gl"\n'
+ self.write_config(features)
+ bitbake('core-image-minimal')
+ bitbake('-c testimage core-image-minimal')
+
+ @OETestID(1883)
+ def test_testimage_virgl_headless(self):
+ """
+ Summary: Check host-assisted accelerate OpenGL functionality in qemu with egl-headless frontend
+ Expected: 1. Check that virgl kernel driver is loaded and 3d acceleration is enabled
+ 2. Check that kmscube demo runs without crashing.
+ Product: oe-core
+ Author: Alexander Kanavin <alex.kanavin@gmail.com>
+ """
+ import subprocess, os
+ try:
+ content = os.listdir("/dev/dri")
+ if len([i for i in content if i.startswith('render')]) == 0:
+ self.skipTest("No render nodes found in /dev/dri: %s" %(content))
+ except FileNotFoundError:
+ self.skipTest("/dev/dri directory does not exist; no render nodes available on this machine.")
+ try:
+ dripath = subprocess.check_output("pkg-config --variable=dridriverdir dri", shell=True)
+ except subprocess.CalledProcessError as e:
+ self.skipTest("Could not determine the path to dri drivers on the host via pkg-config.\nPlease install Mesa development files (particularly, dri.pc) on the host machine.")
+ features = 'INHERIT += "testimage"\n'
+ features += 'TEST_SUITES = "ping ssh virgl"\n'
+ features += 'IMAGE_FEATURES_append = " ssh-server-dropbear"\n'
+ features += 'IMAGE_INSTALL_append = " kmscube"\n'
+ features += 'TEST_RUNQEMUPARAMS = "egl-headless"\n'
+ self.write_config(features)
+ bitbake('core-image-minimal')
+ bitbake('-c testimage core-image-minimal')
+
class Postinst(OESelftestTestCase):
@OETestID(1540)
@OETestID(1545)
--
2.17.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 7/8] runqemu: add an option to choose the SDL frontend instead of Gtk+ default
2019-02-28 13:15 [PATCH 1/8] qemu: remove glx/virgl/gtk options from darwin/mingw targets Alexander Kanavin
` (4 preceding siblings ...)
2019-02-28 13:15 ` [PATCH 6/8] selftest: add tests for virgl GL acceleration Alexander Kanavin
@ 2019-02-28 13:15 ` Alexander Kanavin
2019-02-28 14:14 ` Martin Jansa
2019-02-28 13:15 ` [PATCH 8/8] local.conf.sample: enable gtk+ frontend in addition to sdl Alexander Kanavin
6 siblings, 1 reply; 10+ messages in thread
From: Alexander Kanavin @ 2019-02-28 13:15 UTC (permalink / raw)
To: openembedded-core
When Gtk+ and SDL are both enabled, qemu defaults to Gtk+.
This option allows to revert to the 'classic' frontend.
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
scripts/runqemu | 3 +++
1 file changed, 3 insertions(+)
diff --git a/scripts/runqemu b/scripts/runqemu
index ec6188ba4a2..bbf539a8e67 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -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':
--
2.17.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH 7/8] runqemu: add an option to choose the SDL frontend instead of Gtk+ default
2019-02-28 13:15 ` [PATCH 7/8] runqemu: add an option to choose the SDL frontend instead of Gtk+ default Alexander Kanavin
@ 2019-02-28 14:14 ` Martin Jansa
2019-02-28 14:16 ` Alexander Kanavin
0 siblings, 1 reply; 10+ messages in thread
From: Martin Jansa @ 2019-02-28 14:14 UTC (permalink / raw)
To: Alexander Kanavin; +Cc: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 1836 bytes --]
On Thu, Feb 28, 2019 at 02:15:09PM +0100, Alexander Kanavin wrote:
> When Gtk+ and SDL are both enabled, qemu defaults to Gtk+.
> This option allows to revert to the 'classic' frontend.
>
> Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
> ---
> scripts/runqemu | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/scripts/runqemu b/scripts/runqemu
> index ec6188ba4a2..bbf539a8e67 100755
> --- a/scripts/runqemu
> +++ b/scripts/runqemu
> @@ -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
> gl-es - enable virgl-based GL acceleration, using OpenGL ES
and gtk-gl-es
to make it easier to add sdl-gl?
> 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':
> --
> 2.17.1
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
--
Martin 'JaMa' Jansa jabber: Martin.Jansa@gmail.com
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 201 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 7/8] runqemu: add an option to choose the SDL frontend instead of Gtk+ default
2019-02-28 14:14 ` Martin Jansa
@ 2019-02-28 14:16 ` Alexander Kanavin
0 siblings, 0 replies; 10+ messages in thread
From: Alexander Kanavin @ 2019-02-28 14:16 UTC (permalink / raw)
To: Martin Jansa; +Cc: OE-core
On Thu, 28 Feb 2019 at 15:14, Martin Jansa <martin.jansa@gmail.com> wrote:
> > When Gtk+ and SDL are both enabled, qemu defaults to Gtk+.
> > This option allows to revert to the 'classic' frontend.
> >
> > Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
> > ---
> > scripts/runqemu | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/scripts/runqemu b/scripts/runqemu
> > index ec6188ba4a2..bbf539a8e67 100755
> > --- a/scripts/runqemu
> > +++ b/scripts/runqemu
> > @@ -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
>
> > 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 8/8] local.conf.sample: enable gtk+ frontend in addition to sdl
2019-02-28 13:15 [PATCH 1/8] qemu: remove glx/virgl/gtk options from darwin/mingw targets Alexander Kanavin
` (5 preceding siblings ...)
2019-02-28 13:15 ` [PATCH 7/8] runqemu: add an option to choose the SDL frontend instead of Gtk+ default Alexander Kanavin
@ 2019-02-28 13:15 ` Alexander Kanavin
6 siblings, 0 replies; 10+ messages in thread
From: Alexander Kanavin @ 2019-02-28 13:15 UTC (permalink / raw)
To: openembedded-core
As SDL was found to be buggy for virgl-based GL passthrough,
gtk+ is enabled to allow that use case.
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
meta-poky/conf/local.conf.sample | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/meta-poky/conf/local.conf.sample b/meta-poky/conf/local.conf.sample
index 9068e567dcd..00795ae6a3f 100644
--- a/meta-poky/conf/local.conf.sample
+++ b/meta-poky/conf/local.conf.sample
@@ -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
--
2.17.1
^ permalink raw reply related [flat|nested] 10+ messages in thread