Skip to contentSkip to conversation

Enable accelerated OpenGL in qemu

PATCH Superseded Alexander Kanavin 5 participants 38 messages Jan 14, 2019 – Jan 15, 2019

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover Enable accelerated OpenGL in qemu

0. TLDR:

$ . oe-init-build-env build-virgl
$ bitbake core-image-sato-sdk
$ runqemu kvm gl
$$ run glxgears or any other GL-capable binary inside qemu

1. qemu is switched over to use gtk frontend. I simply couldn't get SDL frontend to work properly, it only displays a blank black window or doesn't start at all. Same thing happens with qemu binaries provided by Fedora and opensuse (Ubuntu's qemu lacks virgl support). Seems like SDL support has regressed.

2. While the components are built against the most minimum necessary mesa-native set (gbm, egl, dri with no drivers), libepoxy loads and uses the host GL implementation (through a chrpath hack). This is both to save build times, and because the host is likely to have a set of drivers more appropriate for the physical machine (e.g. proprietary nvidia stack, although I didn't test that).

3. I tested this with
- glamor X server
- weston compositor with drm backend (build core-image-weston, then edit weston.ini in the image to use drm backed instead of fbdev).
- kmscube
- glxgears
- https://www.geeks3d.com/gputest/

The latter two show FPS that is similar to running them directly on the host.

4. Some things I am not sure about:

- how much of a 'default' should this be for running qemu. It works for me,
but other people might find it less stable compared to the existing sdl-vmware-swrast setup.

- what other tests and demos could be run

- how could this be tested on the autobuilder. I wrote an oe-selftest for this, but it does require an X session, and ability to create opengl contexts on the host.

The following changes since commit 0c9f6e9bb18b2a52b5a5e828772a9619ee4d8515:

strace: add lost Upstream-Status (2019-01-14 11:49:07 +0000)

are available in the Git repository at:

git://git.yoctoproject.org/poky-contrib akanavin/virgl-gtk
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=akanavin/virgl-gtk

Alexander Kanavin (23):
gtk+3: enable native/nativesdk variant
gtk+3: remove the gtk-icon-utils-native recipe
shared-mime-info: update the database also in native builds gtk+: drop support for choosing between 2.x and 3.x implementations of
gtk-update-icon-cache
pixbufcache.bbclass: remove a dependency loop introduced by enabling
gtk+3-native
meta: add native and nativesdk variants to various recipes to enable
gtk+3-native/nativesdk
libepoxy: enable native/nativesdk variants
mesa: enable native and nativesdk variants
virglrenderer: add a recipe
qemu: enable virglrenderer and glx options for native/nativesdk builds
qemu: drop --with-gtkabi option, as it is no longer supported
mesa-gl: do not enable nativesdk variant to avoid clashes with main
mesa recipe
local.conf.sample: adjust the qemu config to enable gtk+ instead of
sdl
qemu: build target variant with gtk+, and nativesdk variant without
sdl
qemu: remove support for building against host sdl
atk: disable gobject-introspection for nativesdk
qemu: add a gettext-native dependency
libjpeg-turbo: fix nativesdk build in same way as native builds are
qemu: add a patch to avoid a missing include error
runqemu: add support for virgl GL acceleration
runqemu: do not check for GL libraries
qemu: add environment variable wrappers to make qemu look good with
gtk frontend
selftest: add a test for virgl GL acceleration

 meta-poky/conf/local.conf.sample              |  10 +-
 meta-selftest/lib/oeqa/runtime/cases/virgl.py |  17 +++
 meta/classes/pixbufcache.bbclass              |   2 +-
 meta/conf/machine/include/qemuboot-x86.inc    |   2 +-
 meta/lib/oeqa/selftest/cases/runtime_test.py  |  19 ++++
 meta/recipes-devtools/qemu/qemu.inc           |  40 ++++---
 .../qemu/0001-Add-a-missing-X11-include.patch |  23 ++++
 meta/recipes-devtools/qemu/qemu_3.1.0.bb      |   1 +
 .../gdk-pixbuf/gdk-pixbuf_2.36.11.bb          |   2 +-
 .../gnome/adwaita-icon-theme_3.28.0.bb        |   2 +
 meta/recipes-gnome/gtk+/gtk+.inc              |   5 +-
 meta/recipes-gnome/gtk+/gtk+3.inc             |  29 +++--
 .../gtk+/gtk-icon-utils-native_3.22.30.bb     |  63 -----------
 ...endency-from-gtk-encode-symbolic-svg.patch | 102 ------------------
 .../hicolor-icon-theme_0.17.bb                |   2 +
 meta/recipes-graphics/cairo/cairo_1.14.12.bb  |   2 +-
 .../harfbuzz/harfbuzz_2.2.0.bb                |   2 +-
 .../jpeg/libjpeg-turbo_2.0.1.bb               |   3 +-
 .../libepoxy/libepoxy_1.5.3.bb                |  12 +++
 meta/recipes-graphics/mesa/mesa-gl_18.1.9.bb  |   2 +
 meta/recipes-graphics/mesa/mesa.inc           |  12 ++-
 meta/recipes-graphics/pango/pango_1.42.4.bb   |   2 +-
 .../ttf-fonts/liberation-fonts_2.00.1.bb      |   2 +
 .../virglrenderer/virglrenderer_git.bb        |  17 +++
 .../xorg-lib/libxcomposite_0.4.4.bb           |   2 +-
 .../xorg-lib/libxdamage_1.1.4.bb              |   2 +-
 meta/recipes-graphics/xorg-lib/libxi_1.7.9.bb |   2 +
 .../xorg-lib/libxtst_1.2.3.bb                 |   1 +
 .../recipes-support/atk/at-spi2-atk_2.30.0.bb |   2 +
 .../atk/at-spi2-core_2.30.0.bb                |   1 +
 meta/recipes-support/atk/atk_2.30.0.bb        |   4 +-
 .../shared-mime-info/shared-mime-info.inc     |   2 +
 meta/recipes-support/vte/vte_0.52.2.bb        |   2 +
 scripts/runqemu                               |  46 ++------
 34 files changed, 193 insertions(+), 244 deletions(-)
 create mode 100644 meta-selftest/lib/oeqa/runtime/cases/virgl.py
 create mode 100644 meta/recipes-devtools/qemu/qemu/0001-Add-a-missing-X11-include.patch
 delete mode 100644 meta/recipes-gnome/gtk+/gtk-icon-utils-native_3.22.30.bb
 delete mode 100644 meta/recipes-gnome/gtk+/gtk-icon-utils/Remove-Gdk-dependency-from-gtk-encode-symbolic-svg.patch
 create mode 100644 meta/recipes-graphics/virglrenderer/virglrenderer_git.bb
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/23 gtk+3: enable native/nativesdk variant

Host-assisted GL in Qemu in theory works with both SDL and GTK; in practice SDL shows an empty screen. This prepares the switchover of graphical qemu to use native gtk, which also provides a neat set of menus to control the emulator.

---
 meta/recipes-gnome/gtk+/gtk+3.inc | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
meta/recipes-gnome/gtk+/gtk+3.inc +16 -0
index 519a9840f42..77e8cb33f94 100644
@@ -12,6 +12,8 @@ LICENSE = "LGPLv2 & LGPLv2+ & LGPLv2.1+"
 
 inherit autotools gettext pkgconfig gtk-doc update-alternatives gtk-immodules-cache gsettings distro_features_check gobject-introspection
 
+BBCLASSEXTEND = "native nativesdk"
+
 # versions >= 3.90 are development versions, otherwise like upstream-version-is-even
 UPSTREAM_CHECK_REGEX = "[^\d\.](?P<pver>3\.([1-8]?[02468])+(\.\d+)+)\.tar"
 
@@ -59,6 +61,11 @@ do_install_append() {
     ln ${D}${bindir}/gtk-query-immodules-3.0 ${D}${libexecdir}/${MLPREFIX}gtk-query-immodules-3.0
 }
 
+do_install_append_class-native() {
+    # provided by gtk-icon-utils-native
+    rm ${D}${bindir}/gtk-encode-symbolic-svg
+}
+
 PACKAGES =+ "${PN}-demo"
 LIBV = "3.0.0"
 
@@ -104,6 +111,15 @@ GTKBASE_RRECOMMENDS ?= "liberation-fonts \
                         shared-mime-info \
                         adwaita-icon-theme-symbolic \
                         "
+
+GTKBASE_RRECOMMENDS_class-native ?= "\
+                        gdk-pixbuf-loader-png \
+                        gdk-pixbuf-loader-jpeg \
+                        gdk-pixbuf-loader-gif \
+                        gdk-pixbuf-loader-xpm \
+                        shared-mime-info \
+                        "
+
 GTKGLIBC_RRECOMMENDS ?= "${GTKBASE_RRECOMMENDS} glibc-gconv-iso8859-1"
 
 RRECOMMENDS_${PN} = "${GTKBASE_RRECOMMENDS}"
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/23 gtk+3: remove the gtk-icon-utils-native recipe

In reply to Alexander Kanavin

As we are now build native gtk+3, it already provides the necessary utilities.

---
 meta/recipes-gnome/gtk+/gtk+3.inc             |   7 +-
 .../gtk+/gtk-icon-utils-native_3.22.30.bb     |  63 -----------
 ...endency-from-gtk-encode-symbolic-svg.patch | 102 ------------------
 3 files changed, 5 insertions(+), 167 deletions(-)
 delete mode 100644 meta/recipes-gnome/gtk+/gtk-icon-utils-native_3.22.30.bb
 delete mode 100644 meta/recipes-gnome/gtk+/gtk-icon-utils/Remove-Gdk-dependency-from-gtk-encode-symbolic-svg.patch
meta/recipes-gnome/gtk+/gtk+3.inc +5 -2
index 77e8cb33f94..ecb6abe4b5b 100644
@@ -62,10 +62,13 @@ do_install_append() {
 }
 
 do_install_append_class-native() {
-    # provided by gtk-icon-utils-native
-    rm ${D}${bindir}/gtk-encode-symbolic-svg
+        create_wrapper ${D}/${bindir}/gtk-update-icon-cache \
+                GDK_PIXBUF_MODULE_FILE=${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/2.10.0/loaders.cache
+        create_wrapper ${D}/${bindir}/gtk-encode-symbolic-svg \
+                GDK_PIXBUF_MODULE_FILE=${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/2.10.0/loaders.cache
 }
 
+PROVIDES += "gtk-icon-utils"
 PACKAGES =+ "${PN}-demo"
 LIBV = "3.0.0"
 
meta/recipes-gnome/gtk+/gtk-icon-utils-native_3.22.30.bb deleted +0 -63

63 lines not on this page · raw message

meta/recipes-gnome/gtk+/gtk-icon-utils/Remove-Gdk-dependency-from-gtk-encode-symbolic-svg.patch deleted +0 -102

102 lines not on this page · raw message

Signature · 1 line
2.17.1
#3 lore raw

PATCH 3/23 shared-mime-info: update the database also in native builds

In reply to Alexander Kanavin

Otherwise glib-compile-resources fails when building gtk+3-native.

---
 meta/recipes-support/shared-mime-info/shared-mime-info.inc | 2 ++
 1 file changed, 2 insertions(+)
meta/recipes-support/shared-mime-info/shared-mime-info.inc +2 -0
index 344da7ea77c..3fe1a445b0c 100644
@@ -30,6 +30,8 @@ do_install () {
 
 do_install_class-native () {
 	autotools_do_install
+
+	${B}/update-mime-database ${D}${datadir}/mime
 }
 
 BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.17.1
#4 lore raw

PATCH 4/23 gtk+: drop support for choosing between 2.x and 3.x implementations of gtk-update-icon-cache

In reply to Alexander Kanavin
---
 meta/recipes-gnome/gtk+/gtk+.inc  |  5 +----
 meta/recipes-gnome/gtk+/gtk+3.inc | 10 ++--------
 2 files changed, 3 insertions(+), 12 deletions(-)
meta/recipes-gnome/gtk+/gtk+.inc +1 -4
index 14ed8d812ca..eb67db20552 100644
@@ -28,7 +28,7 @@ PACKAGECONFIG[x11] = "--with-x=yes --with-gdktarget=x11,--with-x=no,${X11DEPENDS
 PACKAGECONFIG[directfb] = "--with-gdktarget=directfb,,directfb"
 PACKAGECONFIG[manpages] = "--enable-man --with-xml-catalog=${STAGING_ETCDIR_NATIVE}/xml/catalog.xml, --disable-man, libxslt-native xmlto-native"
 
-inherit autotools gtk-doc pkgconfig update-alternatives gtk-immodules-cache gobject-introspection manpages
+inherit autotools gtk-doc pkgconfig gtk-immodules-cache gobject-introspection manpages
 
 PACKAGES += "libgail gtk-demo"
 
@@ -70,9 +70,6 @@ GTKGLIBC_RRECOMMENDS ?= "${GTKBASE_RRECOMMENDS} glibc-gconv-iso8859-1"
 RRECOMMENDS_${PN} = "${GTKBASE_RRECOMMENDS}"
 RRECOMMENDS_${PN}_libc-glibc = "${GTKGLIBC_RRECOMMENDS}"
 
-ALTERNATIVE_${PN} = "gtk-update-icon-cache"
-ALTERNATIVE_TARGET[gtk-update-icon-cache] = "${bindir}/gtk-update-icon-cache-2.0"
-
 do_compile_prepend() {
         export GIR_EXTRA_LIBS_PATH="${B}/gdk/.libs"
 }
meta/recipes-gnome/gtk+/gtk+3.inc +2 -8
index ecb6abe4b5b..93f19e69944 100644
@@ -10,7 +10,7 @@ DEPENDS = "glib-2.0 cairo pango atk jpeg libpng gdk-pixbuf \
 
 LICENSE = "LGPLv2 & LGPLv2+ & LGPLv2.1+"
 
-inherit autotools gettext pkgconfig gtk-doc update-alternatives gtk-immodules-cache gsettings distro_features_check gobject-introspection
+inherit autotools gettext pkgconfig gtk-doc gtk-immodules-cache gsettings distro_features_check gobject-introspection
 
 BBCLASSEXTEND = "native nativesdk"
 
@@ -54,8 +54,6 @@ PACKAGECONFIG[wayland] = "--enable-wayland-backend,--disable-wayland-backend,way
 PACKAGECONFIG[cups] = "--enable-cups,--disable-cups,cups"
 
 do_install_append() {
-	mv ${D}${bindir}/gtk-update-icon-cache ${D}${bindir}/gtk-update-icon-cache-3.0
-
     # duplicate gtk-query-immodules for post install script update_gtk_immodules_cache
     mkdir -p ${D}${libexecdir}
     ln ${D}${bindir}/gtk-query-immodules-3.0 ${D}${libexecdir}/${MLPREFIX}gtk-query-immodules-3.0
@@ -83,7 +81,7 @@ FILES_${PN}-demo = "${bindir}/gtk3-demo \
                     ${datadir}/icons/hicolor/*/apps/gtk3-demo*.png \
                     ${datadir}/icons/hicolor/*/apps/gtk3-widget-factory*.png"
 
-FILES_${PN}_append = " ${bindir}/gtk-update-icon-cache-3.0 \
+FILES_${PN}_append = " ${bindir}/gtk-update-icon-cache \
                ${bindir}/gtk-query-immodules-3.0 \
                ${bindir}/gtk-launch \
                ${datadir}/themes ${sysconfdir} ${datadir}/glib-2.0/schemas/ \
@@ -131,10 +129,6 @@ RDEPENDS_${PN}-dev += "${@bb.utils.contains("PACKAGECONFIG", "wayland", "wayland
 
 PACKAGES_DYNAMIC += "^gtk3-immodule-.* ^gtk3-printbackend-.*"
 
-ALTERNATIVE_${PN} = "gtk-update-icon-cache"
-ALTERNATIVE_TARGET[gtk-update-icon-cache] = "${bindir}/gtk-update-icon-cache-3.0"
-ALTERNATIVE_PRIORITY = "30"
-
 python populate_packages_prepend () {
     import os.path
 
Signature · 1 line
2.17.1
#5 lore raw

PATCH 5/23 pixbufcache.bbclass: remove a dependency loop introduced by enabling gtk+3-native

In reply to Alexander Kanavin
---
 meta/classes/pixbufcache.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/pixbufcache.bbclass +1 -1
index 3378ff2c806..fb50cd49659 100644
@@ -3,7 +3,7 @@
 # packages.
 #
 
-DEPENDS += "qemu-native"
+DEPENDS_append_class-target = " qemu-native"
 inherit qemu
 
 PIXBUF_PACKAGES ??= "${PN}"
Signature · 1 line
2.17.1
#6 lore raw

PATCH 6/23 meta: add native and nativesdk variants to various recipes to enable gtk+3-native/nativesdk

In reply to Alexander Kanavin
---
 meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.36.11.bb             | 2 +-
 meta/recipes-gnome/gnome/adwaita-icon-theme_3.28.0.bb           | 2 ++
 .../recipes-gnome/hicolor-icon-theme/hicolor-icon-theme_0.17.bb | 2 ++
 meta/recipes-graphics/cairo/cairo_1.14.12.bb                    | 2 +-
 meta/recipes-graphics/harfbuzz/harfbuzz_2.2.0.bb                | 2 +-
 meta/recipes-graphics/jpeg/libjpeg-turbo_2.0.1.bb               | 2 +-
 meta/recipes-graphics/pango/pango_1.42.4.bb                     | 2 +-
 meta/recipes-graphics/ttf-fonts/liberation-fonts_2.00.1.bb      | 2 ++
 meta/recipes-graphics/xorg-lib/libxcomposite_0.4.4.bb           | 2 +-
 meta/recipes-graphics/xorg-lib/libxdamage_1.1.4.bb              | 2 +-
 meta/recipes-graphics/xorg-lib/libxi_1.7.9.bb                   | 2 ++
 meta/recipes-graphics/xorg-lib/libxtst_1.2.3.bb                 | 1 +
 meta/recipes-support/atk/at-spi2-atk_2.30.0.bb                  | 2 ++
 meta/recipes-support/atk/at-spi2-core_2.30.0.bb                 | 1 +
 meta/recipes-support/atk/atk_2.30.0.bb                          | 2 +-
 meta/recipes-support/vte/vte_0.52.2.bb                          | 2 ++
 16 files changed, 22 insertions(+), 8 deletions(-)
meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.36.11.bb +1 -1
index 99c84c6dda4..bf202ef8609 100644
@@ -99,4 +99,4 @@ do_install_append_class-native() {
 		GDK_PIXBUF_MODULE_FILE=${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/${LIBV}/loaders.cache \
 		GDK_PIXBUF_MODULEDIR=${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/${LIBV}/loaders
 }
-BBCLASSEXTEND = "native"
+BBCLASSEXTEND = "native nativesdk"
meta/recipes-gnome/gnome/adwaita-icon-theme_3.28.0.bb +2 -0
index 40dd35ba306..7102a895955 100644
@@ -42,3 +42,5 @@ FILES_${PN}-hires = "${prefix}/share/icons/Adwaita/256x256/ \
                      ${prefix}/share/icons/Adwaita/512x512/"
 FILES_${PN} = "${prefix}/share/icons/Adwaita/ \
                ${prefix}/share/pkgconfig/adwaita-icon-theme.pc"
+
+BBCLASSEXTEND = "native nativesdk"
meta/recipes-gnome/hicolor-icon-theme/hicolor-icon-theme_0.17.bb +2 -0
index 7064b1942d4..fb8033448d8 100644
@@ -12,3 +12,5 @@ SRC_URI[sha256sum] = "317484352271d18cbbcfac3868eab798d67fff1b8402e740baa6ff41d5
 inherit allarch autotools
 
 FILES_${PN} += "${datadir}/icons"
+
+BBCLASSEXTEND = "native nativesdk"
meta/recipes-graphics/cairo/cairo_1.14.12.bb +1 -1
index 18b947948a3..ad6745f60dc 100644
@@ -84,4 +84,4 @@ FILES_${PN}-script-interpreter = "${libdir}/libcairo-script-interpreter.so.*"
 FILES_${PN}-perf-utils = "${bindir}/cairo-trace* ${libdir}/cairo/*.la ${libdir}/cairo/libcairo-trace.so.*"
 FILES_${PN}-dev += "${libdir}/cairo/*.so"
 
-BBCLASSEXTEND = "native"
+BBCLASSEXTEND = "native nativesdk"
meta/recipes-graphics/harfbuzz/harfbuzz_2.2.0.bb +1 -1
index 3b1e6a8181a..b62082f53d8 100644
@@ -37,4 +37,4 @@ FILES_${PN}-icu-dev = "${libdir}/libharfbuzz-icu.la \
                        ${libdir}/pkgconfig/harfbuzz-icu.pc \
 "
 
-BBCLASSEXTEND = "native"
+BBCLASSEXTEND = "native nativesdk"
meta/recipes-graphics/jpeg/libjpeg-turbo_2.0.1.bb +1 -1
index 72706be674f..d9d877dc0df 100644
@@ -53,4 +53,4 @@ FILES_jpeg-tools = "${bindir}/*"
 DESCRIPTION_libturbojpeg = "A SIMD-accelerated JPEG codec which provides only TurboJPEG APIs"
 FILES_libturbojpeg = "${libdir}/libturbojpeg.so.*"
 
-BBCLASSEXTEND = "native"
+BBCLASSEXTEND = "native nativesdk"
meta/recipes-graphics/pango/pango_1.42.4.bb +1 -1
index 22fe3af15d7..a09f7a8e701 100644
@@ -42,4 +42,4 @@ RDEPENDS_${PN}-ptest += "liberation-fonts cantarell-fonts"
 RPROVIDES_${PN} += "pango-modules pango-module-indic-lang \
                     pango-module-basic-fc pango-module-arabic-lang"
 
-BBCLASSEXTEND = "native"
+BBCLASSEXTEND = "native nativesdk"
meta/recipes-graphics/ttf-fonts/liberation-fonts_2.00.1.bb +2 -0
index 412da48725e..f5df9efa3b7 100644
@@ -37,3 +37,5 @@ do_install () {
 
 PACKAGES = "${PN}"
 FILES_${PN} += "${sysconfdir} ${datadir}"
+
+BBCLASSEXTEND = "native nativesdk"
meta/recipes-graphics/xorg-lib/libxcomposite_0.4.4.bb +1 -1
index 73e29484047..5e26fca7cd5 100644
@@ -16,7 +16,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=3f2907aad541f6f226fbc58cc1b3cdf1"
 
 DEPENDS += " xorgproto virtual/libx11 libxfixes libxext"
 PROVIDES = "xcomposite"
-BBCLASSEXTEND = "native"
+BBCLASSEXTEND = "native nativesdk"
 
 PE = "1"
 
meta/recipes-graphics/xorg-lib/libxdamage_1.1.4.bb +1 -1
index 6d6ffadf209..530da0569c5 100644
@@ -18,7 +18,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=9fe101f30dd24134cf43146863241868"
 
 DEPENDS += "virtual/libx11 xorgproto libxfixes"
 PROVIDES = "xdamage"
-BBCLASSEXTEND = "native"
+BBCLASSEXTEND = "native nativesdk"
 
 PE = "1"
 
meta/recipes-graphics/xorg-lib/libxi_1.7.9.bb +2 -0
index 08381d9c4d5..ab49cdba3fb 100644
@@ -20,3 +20,5 @@ XORG_PN = "libXi"
 SRC_URI[md5sum] = "1f0f2719c020655a60aee334ddd26d67"
 SRC_URI[sha256sum] = "c2e6b8ff84f9448386c1b5510a5cf5a16d788f76db018194dacdc200180faf45"
 
+BBCLASSEXTEND = "native nativesdk"
+
meta/recipes-graphics/xorg-lib/libxtst_1.2.3.bb +1 -0
index 266bd1ca59c..7837f69d38b 100644
@@ -19,3 +19,4 @@ XORG_PN = "libXtst"
 SRC_URI[md5sum] = "ef8c2c1d16a00bd95b9fdcef63b8a2ca"
 SRC_URI[sha256sum] = "4655498a1b8e844e3d6f21f3b2c4e2b571effb5fd83199d428a6ba7ea4bf5204"
 
+BBCLASSEXTEND = "native nativesdk"
meta/recipes-support/atk/at-spi2-atk_2.30.0.bb +2 -0
index eb4be6b6d86..2244797071f 100644
@@ -18,3 +18,5 @@ PACKAGES =+ "${PN}-gnome ${PN}-gtk2"
 
 FILES_${PN}-gnome = "${libdir}/gnome-settings-daemon-3.0/gtk-modules"
 FILES_${PN}-gtk2 = "${libdir}/gtk-2.0/modules/libatk-bridge.*"
+
+BBCLASSEXTEND = "native nativesdk"
meta/recipes-support/atk/at-spi2-core_2.30.0.bb +1 -0
index d7ea9be87fe..fe8f9955822 100644
@@ -37,3 +37,4 @@ FILES_${PN} += "${datadir}/dbus-1/services/*.service \
                 ${datadir}/defaults/at-spi2 \
                 ${systemd_user_unitdir}/at-spi-dbus-bus.service \
                 "
+BBCLASSEXTEND = "native nativesdk"
meta/recipes-support/atk/atk_2.30.0.bb +1 -1
index c950862b6f0..481f8e89a13 100644
@@ -33,5 +33,5 @@ SRC_URI_append = " \
 SRC_URI[archive.md5sum] = "769c85005d392ad17ffbc063f2d26454"
 SRC_URI[archive.sha256sum] = "dd4d90d4217f2a0c1fee708a555596c2c19d26fef0952e1ead1938ab632c027b"
 
-BBCLASSEXTEND = "native"
+BBCLASSEXTEND = "native nativesdk"
 
meta/recipes-support/vte/vte_0.52.2.bb +2 -0
index 7324c9c63d5..62fb5288fa9 100644
@@ -44,3 +44,5 @@ EXTRA_OEMAKE_class-target = "LIBTOOL=${STAGING_BINDIR_CROSS}/${HOST_SYS}-libtool
 
 PACKAGES =+ "libvte"
 FILES_libvte = "${libdir}/*.so.* ${libdir}/girepository-1.0/*"
+
+BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.17.1
#7 lore raw

PATCH 7/23 libepoxy: enable native/nativesdk variants

In reply to Alexander Kanavin

libepoxy is a requirement of virglrenderer. Note that we strip RPATH from the library, as this allows fall-through to the host GL implementation, instead of attempting (and failing) to use mesa-native.

---
 meta/recipes-graphics/libepoxy/libepoxy_1.5.3.bb | 12 ++++++++++++
 1 file changed, 12 insertions(+)
meta/recipes-graphics/libepoxy/libepoxy_1.5.3.bb +12 -0
index 92f644c039d..45995325d2c 100644
@@ -14,9 +14,21 @@ UPSTREAM_CHECK_URI = "https://github.com/anholt/libepoxy/releases"
 inherit meson pkgconfig distro_features_check
 
 REQUIRED_DISTRO_FEATURES = "opengl"
+REQUIRED_DISTRO_FEATURES_class-native = ""
+REQUIRED_DISTRO_FEATURES_class-nativesdk = ""
 
 PACKAGECONFIG[egl] = "-Degl=yes, -Degl=no, virtual/egl"
 PACKAGECONFIG[x11] = "-Dglx=yes, -Dglx=no, virtual/libx11 virtual/libgl"
 PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)} egl"
 
 EXTRA_OEMESON += "-Dtests=false"
+
+PACKAGECONFIG_class-native = "egl"
+PACKAGECONFIG_class-nativesdk = "egl"
+
+BBCLASSEXTEND = "native nativesdk"
+
+# This will ensure that dlopen will attempt only GL libraries provided by host
+do_install_append () {
+    chrpath --delete ${D}${libdir}/*.so
+}
Signature · 1 line
2.17.1
#10 lore raw

PATCH 8/23 mesa: enable native and nativesdk variants

In reply to Alexander Kanavin

Note that only the most minimal necessary subset of mesa is built; particularly we don't build any drivers as that is offloaded to the GL implementation provided by the host.

---
 meta/recipes-graphics/mesa/mesa.inc | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
meta/recipes-graphics/mesa/mesa.inc +9 -3
index 0cc0a82de49..37ca5e39c2d 100644
@@ -26,7 +26,9 @@ PROVIDES = " \
 
 inherit autotools pkgconfig python3native gettext distro_features_check
 
-ANY_OF_DISTRO_FEATURES = "opengl vulkan"
+BBCLASSEXTEND = "native nativesdk"
+
+ANY_OF_DISTRO_FEATURES_class-target = "opengl vulkan"
 
 PLATFORMS ??= "${@bb.utils.filter('PACKAGECONFIG', 'x11 wayland', d)} \
                ${@bb.utils.contains('PACKAGECONFIG', 'gbm', 'drm', '', d)} \
@@ -42,11 +44,13 @@ EXTRA_OECONF = "--enable-shared-glapi \
                 --with-llvm-prefix=${STAGING_LIBDIR}/llvm${MESA_LLVM_RELEASE} \
                 --with-platforms='${PLATFORMS}'"
 
-PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'wayland vulkan', d)} \
-                   ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'opengl egl gles gbm dri', '', d)} \
+PACKAGECONFIG_class-target ??= "${@bb.utils.filter('DISTRO_FEATURES', 'wayland vulkan', d)} \
+                   ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'opengl egl gles gbm dri gallium', '', d)} \
                    ${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl', 'x11 dri3', '', d)} \
                    ${@bb.utils.contains('DISTRO_FEATURES', 'x11 vulkan', 'dri3', '', d)} \
 		   "
+PACKAGECONFIG_class-native ?= "gbm dri-native egl"
+PACKAGECONFIG_class-nativesdk ?= "gbm dri-native egl"
 
 # "gbm" requires "dri", "opengl"
 PACKAGECONFIG[gbm] = "--enable-gbm,--disable-gbm"
@@ -62,6 +66,8 @@ DRIDRIVERS_append_x86 = ",radeon,r200,nouveau,i965,i915"
 DRIDRIVERS_append_x86-64 = ",radeon,r200,nouveau,i965,i915"
 # "dri" requires "opengl"
 PACKAGECONFIG[dri] = "--enable-dri --with-dri-drivers=${DRIDRIVERS}, --disable-dri, xorgproto libdrm"
+# On the native builds we use host's dri drivers
+PACKAGECONFIG[dri-native] = "--enable-dri, , xorgproto libdrm"
 PACKAGECONFIG[dri3] = "--enable-dri3, --disable-dri3, xorgproto libxshmfence"
 
 # Vulkan drivers need dri3 enabled
Signature · 1 line
2.17.1
#13 lore raw

PATCH 9/23 virglrenderer: add a recipe

In reply to Alexander Kanavin

This component enables hardware-accelerated GL inside QEMU guests. For more information, see here:

https://lwn.net/Articles/767970/
https://www.collabora.com/news-and-blog/blog/2018/02/12/virtualizing-gpu-access/
https://www.collabora.com/news-and-blog/blog/2018/05/09/gpu-virtualization-update/

---
 .../virglrenderer/virglrenderer_git.bb          | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 meta/recipes-graphics/virglrenderer/virglrenderer_git.bb
meta/recipes-graphics/virglrenderer/virglrenderer_git.bb new file +17 -0
new file mode 100644
index 00000000000..60ab256aae7
@@ -0,0 +1,17 @@
+SUMMARY = "VirGL virtual OpenGL renderer"
+HOMEPAGE = "https://virgil3d.github.io/"
+
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://COPYING;md5=c81c08eeefd9418fca8f88309a76db10"
+
+DEPENDS = "libdrm mesa libepoxy"
+PV = "0.7.0"
+SRCREV = "402c228861c9893f64cffbbcb4cb23044b8c721c"
+SRC_URI = "git://anongit.freedesktop.org/virglrenderer"
+
+S = "${WORKDIR}/git"
+
+inherit autotools pkgconfig
+
+BBCLASSEXTEND = "native nativesdk"
+
Signature · 1 line
2.17.1
#14 lore raw

PATCH 10/23 qemu: enable virglrenderer and glx options for native/nativesdk builds

In reply to Alexander Kanavin
---
 meta/recipes-devtools/qemu/qemu.inc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta/recipes-devtools/qemu/qemu.inc +2 -2
index b05c1cee9eb..f943b9ee5a2 100644
@@ -74,8 +74,8 @@ PACKAGECONFIG ??= " \
     fdt sdl kvm \
     ${@bb.utils.filter('DISTRO_FEATURES', 'alsa xen', d)} \
 "
-PACKAGECONFIG_class-native ??= "fdt alsa kvm"
-PACKAGECONFIG_class-nativesdk ??= "fdt sdl kvm"
+PACKAGECONFIG_class-native ??= "fdt alsa kvm virglrenderer glx"
+PACKAGECONFIG_class-nativesdk ??= "fdt sdl kvm virglrenderer glx"
 
 # Handle distros such as CentOS 5 32-bit that do not have kvm support
 PACKAGECONFIG_class-native_remove = "${@'kvm' if not os.path.exists('/usr/include/linux/kvm.h') else ''}"
Signature · 1 line
2.17.1
#15 lore raw

PATCH 11/23 qemu: drop --with-gtkabi option, as it is no longer supported

In reply to Alexander Kanavin

Recent qemu versions support gtk+3 only.

---
 meta/recipes-devtools/qemu/qemu.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-devtools/qemu/qemu.inc +1 -1
index f943b9ee5a2..6db1facc9a5 100644
@@ -95,7 +95,7 @@ PACKAGECONFIG[vnc-png] = "--enable-vnc --enable-vnc-png,--disable-vnc-png,libpng
 PACKAGECONFIG[libcurl] = "--enable-curl,--disable-curl,libcurl,"
 PACKAGECONFIG[nss] = "--enable-smartcard,--disable-smartcard,nss,"
 PACKAGECONFIG[curses] = "--enable-curses,--disable-curses,ncurses,"
-PACKAGECONFIG[gtk+] = "--enable-gtk --with-gtkabi=3.0 --enable-vte,--disable-gtk --disable-vte,gtk+3 vte"
+PACKAGECONFIG[gtk+] = "--enable-gtk --enable-vte,--disable-gtk --disable-vte,gtk+3 vte"
 PACKAGECONFIG[libcap-ng] = "--enable-cap-ng,--disable-cap-ng,libcap-ng,"
 PACKAGECONFIG[ssh2] = "--enable-libssh2,--disable-libssh2,libssh2,"
 PACKAGECONFIG[gcrypt] = "--enable-gcrypt,--disable-gcrypt,libgcrypt,"
Signature · 1 line
2.17.1
#16 lore raw

PATCH 12/23 mesa-gl: do not enable nativesdk variant to avoid clashes with main mesa recipe

In reply to Alexander Kanavin
---
 meta/recipes-graphics/mesa/mesa-gl_18.1.9.bb | 2 ++
 1 file changed, 2 insertions(+)
meta/recipes-graphics/mesa/mesa-gl_18.1.9.bb +2 -0
index 73267eb4f0d..030db6c1440 100644
@@ -7,3 +7,5 @@ PROVIDES = "virtual/libgl virtual/mesa"
 S = "${WORKDIR}/mesa-${PV}"
 
 PACKAGECONFIG ??= "opengl dri ${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}"
+
+BBCLASSEXTEND_remove = "nativesdk"
Signature · 1 line
2.17.1
#19 lore raw

PATCH 13/23 local.conf.sample: adjust the qemu config to enable gtk+ instead of sdl

In reply to Alexander Kanavin
---
 meta-poky/conf/local.conf.sample | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
meta-poky/conf/local.conf.sample +4 -6
index cf96598819c..079b7b9945d 100644
@@ -236,12 +236,10 @@ 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-native = " sdl"
-PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl"
-#ASSUME_PROVIDED += "libsdl2-native"
+# seen. The two lines below enable the Gtk backend with virgl-assisted GL acceleration
+# support in the guest environment.
+PACKAGECONFIG_append_pn-qemu-native = " gtk+"
+PACKAGECONFIG_append_pn-nativesdk-qemu = " 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
#20 lore raw

PATCH 14/23 qemu: build target variant with gtk+, and nativesdk variant without sdl

In reply to Alexander Kanavin

As sdl is deprecated in favor of gtk+, it should not be the default.

---
 meta/recipes-devtools/qemu/qemu.inc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta/recipes-devtools/qemu/qemu.inc +2 -2
index 6db1facc9a5..531f0a04c58 100644
@@ -71,11 +71,11 @@ do_install_append() {
 # END of qemu-mips workaround
 
 PACKAGECONFIG ??= " \
-    fdt sdl kvm \
+    fdt gtk+ kvm \
     ${@bb.utils.filter('DISTRO_FEATURES', 'alsa xen', d)} \
 "
 PACKAGECONFIG_class-native ??= "fdt alsa kvm virglrenderer glx"
-PACKAGECONFIG_class-nativesdk ??= "fdt sdl kvm virglrenderer glx"
+PACKAGECONFIG_class-nativesdk ??= "fdt kvm virglrenderer glx"
 
 # Handle distros such as CentOS 5 32-bit that do not have kvm support
 PACKAGECONFIG_class-native_remove = "${@'kvm' if not os.path.exists('/usr/include/linux/kvm.h') else ''}"
Signature · 1 line
2.17.1
#21 lore raw

PATCH 15/23 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 531f0a04c58..db9c2245df9 100644
@@ -39,14 +39,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
#22 lore raw

PATCH 16/23 atk: disable gobject-introspection for nativesdk

In reply to Alexander Kanavin
---
 meta/recipes-support/atk/atk_2.30.0.bb | 2 ++
 1 file changed, 2 insertions(+)
meta/recipes-support/atk/atk_2.30.0.bb +2 -0
index 481f8e89a13..4e2dacbc4d8 100644
@@ -20,6 +20,8 @@ GTKDOC_DISABLE_FLAG = "-Ddocs=false"
 GI_ENABLE_FLAG = "-Dintrospection=true"
 GI_DISABLE_FLAG = "-Dintrospection=false"
 
+EXTRA_OEMESON_append_class-nativesdk = " ${GI_DISABLE_FLAG}"
+
 EXTRA_OEMESON_append_class-target = " ${@bb.utils.contains('GI_DATA_ENABLED', 'True', '${GI_ENABLE_FLAG}', \
                                                                                        '${GI_DISABLE_FLAG}', d)} "
 
Signature · 1 line
2.17.1
#25 lore raw

PATCH 17/23 qemu: add a gettext-native dependency

In reply to Alexander Kanavin

xgettext/msgmerge is used during do_install().

---
 meta/recipes-devtools/qemu/qemu.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-devtools/qemu/qemu.inc +1 -1
index db9c2245df9..6937bbc87b4 100644
@@ -1,7 +1,7 @@
 SUMMARY = "Fast open source processor emulator"
 HOMEPAGE = "http://qemu.org"
 LICENSE = "GPLv2 & LGPLv2.1"
-DEPENDS = "glib-2.0 zlib pixman"
+DEPENDS = "glib-2.0 zlib pixman gettext-native"
 RDEPENDS_${PN}_class-target += "bash"
 
 require qemu-targets.inc
Signature · 1 line
2.17.1
#29 lore raw

PATCH 18/23 libjpeg-turbo: fix nativesdk build in same way as native builds are

In reply to Alexander Kanavin
---
 meta/recipes-graphics/jpeg/libjpeg-turbo_2.0.1.bb | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-graphics/jpeg/libjpeg-turbo_2.0.1.bb +1 -0
index d9d877dc0df..029847ff5f4 100644
@@ -31,6 +31,7 @@ inherit cmake pkgconfig
 
 # Add nasm-native dependency consistently for all build arches is hard
 EXTRA_OECMAKE_append_class-native = " -DWITH_SIMD=False"
+EXTRA_OECMAKE_append_class-nativesdk = " -DWITH_SIMD=False"
 
 # Work around missing x32 ABI support
 EXTRA_OECMAKE_append_class-target = " ${@bb.utils.contains("TUNE_FEATURES", "mx32", "-DWITH_SIMD=False", "", d)}"
Signature · 1 line
2.17.1
#30 lore raw

PATCH 19/23 qemu: add a patch to avoid a missing include error

In reply to Alexander Kanavin
| In file included from /home/alexander/development/poky/build-virgl-gtk-64/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-qemu/3.1.0-r0/qemu-3.1.0/include/ui/egl-context.h:5,
|                  from /home/alexander/development/poky/build-virgl-gtk-64/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-qemu/3.1.0-r0/qemu-3.1.0/ui/egl-context.c:3:
| /home/alexander/development/poky/build-virgl-gtk-64/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-qemu/3.1.0-r0/qemu-3.1.0/include/ui/egl-helpers.h:46:55: error: unknown type name 'Window'; did you mean 'minor'?
|  EGLSurface qemu_egl_init_surface_x11(EGLContext ectx, Window win);
|                                                        ^~~~~~
|                                                        minor
---
 .../qemu/0001-Add-a-missing-X11-include.patch | 23 +++++++++++++++++++
 meta/recipes-devtools/qemu/qemu_3.1.0.bb      |  1 +
 2 files changed, 24 insertions(+)
 create mode 100644 meta/recipes-devtools/qemu/qemu/0001-Add-a-missing-X11-include.patch
meta/recipes-devtools/qemu/qemu/0001-Add-a-missing-X11-include.patch new file +23 -0
new file mode 100644
index 00000000000..23d3d5cfba3
@@ -0,0 +1,23 @@
+From 97aa8f9124b4673d15a7823ef9300ec05def760f Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <[email protected]>
+Date: Thu, 20 Dec 2018 18:06:29 +0100
+Subject: [PATCH] Add a missing X11 include
+
+Upstream-Status: Pending
+Signed-off-by: Alexander Kanavin <[email protected]>
+---
+ include/ui/egl-helpers.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/include/ui/egl-helpers.h b/include/ui/egl-helpers.h
+index 9db7293b..2c32d77e 100644
+--- a/include/ui/egl-helpers.h
++++ b/include/ui/egl-helpers.h
+@@ -4,6 +4,7 @@
+ #include <epoxy/gl.h>
+ #include <epoxy/egl.h>
+ #include <gbm.h>
++#include <X11/Xlib.h>
+ 
+ extern EGLDisplay *qemu_egl_display;
+ extern EGLConfig qemu_egl_config;
meta/recipes-devtools/qemu/qemu_3.1.0.bb +1 -0
index 67cebcc8308..cd7cd67a3f0 100644
@@ -21,6 +21,7 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \
            file://0009-apic-fixup-fallthrough-to-PIC.patch \
            file://0010-linux-user-Fix-webkitgtk-hangs-on-32-bit-x86-target.patch \
            file://0011-Revert-linux-user-fix-mmap-munmap-mprotect-mremap-sh.patch \
+           file://0001-Add-a-missing-X11-include.patch \
            "
 UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar"
 
Signature · 1 line
2.17.1
#31 lore raw

PATCH 20/23 runqemu: add support for virgl GL acceleration

In reply to Alexander Kanavin

Also, do not hardcode -vga option to qemu, set it according to command line parameters.

---
 meta/conf/machine/include/qemuboot-x86.inc |  2 +-
 scripts/runqemu                            | 11 +++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)
meta/conf/machine/include/qemuboot-x86.inc +1 -1
index 5fdbe4df50e..574b7bbfc7d 100644
@@ -11,7 +11,7 @@ QB_CPU_KVM_x86-64 = "-cpu core2duo"
 QB_AUDIO_DRV = "alsa"
 QB_AUDIO_OPT = "-soundhw ac97,es1370"
 QB_KERNEL_CMDLINE_APPEND = "vga=0 uvesafb.mode_option=${UVESA_MODE} oprofile.timer=1 uvesafb.task_timeout=-1"
-QB_OPT_APPEND = "-vga vmware -show-cursor -usb -device usb-tablet"
+QB_OPT_APPEND = "-show-cursor -usb -device usb-tablet"
 # Add the 'virtio-rng-pci' device otherwise the guest may run out of entropy
 QB_OPT_APPEND += "-object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0"
 
scripts/runqemu +11 -0
index c4a0ca811d9..fa88dc4583c 100755
@@ -74,6 +74,8 @@ 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
+    gl - enable virgl-based GL acceleration
+    gl-es - enable virgl-based GL acceleration, using OpenGL ES
     serial - enable a serial console on /dev/ttyS0
     serialstdio - enable a serial console on the console (regardless of graphics mode)
     slirp - enable user networking, no root privileges is required
@@ -427,12 +429,21 @@ class BaseConfig(object):
                 sys.argv.remove(quiet)
 
         unknown_arg = ""
+        if 'gl' not in sys.argv[1:] and 'gl-es' not in sys.argv[1:]:
+            self.qemu_opt_script += ' -vga vmware'
         for arg in sys.argv[1:]:
             if arg in self.fstypes + self.vmtypes:
                 self.check_arg_fstype(arg)
             elif arg == 'nographic':
                 self.qemu_opt_script += ' -nographic'
                 self.kernel_cmdline_script += ' console=ttyS0'
+            elif arg == 'gl':
+                self.qemu_opt_script += ' -vga virtio -display gtk,gl=on'
+            elif arg == 'gl-es':
+                self.qemu_opt_script += ' -vga virtio -display gtk,gl=es'
+            elif arg == 'nographic':
+                self.qemu_opt_script += ' -nographic'
+                self.kernel_cmdline_script += ' console=ttyS0'
             elif arg == 'serial':
                 self.kernel_cmdline_script += ' console=ttyS0'
                 self.serialconsole = True
Signature · 1 line
2.17.1
#34 lore raw

PATCH 21/23 runqemu: do not check for GL libraries

In reply to Alexander Kanavin

qemu has been using libepoxy for a long time, and libepoxy loads GL via dlopen() only when instructed to.

---
 scripts/runqemu | 35 -----------------------------------
 1 file changed, 35 deletions(-)
scripts/runqemu +0 -35
index fa88dc4583c..ac45dc78942 100755
@@ -117,39 +117,6 @@ def check_tun():
     if not os.access(dev_tun, os.W_OK):
         raise RunQemuError("TUN control device %s is not writable, please fix (e.g. sudo chmod 666 %s)" % (dev_tun, dev_tun))
 
-def check_libgl(qemu_bin):
-    cmd = ('ldd', qemu_bin)
-    logger.debug('Running %s...' % str(cmd))
-    need_gl = subprocess.check_output(cmd).decode('utf-8')
-    if re.search('libGLU', need_gl):
-        # We can't run without a libGL.so
-        libgl = False
-        check_files = (('/usr/lib/libGL.so', '/usr/lib/libGLU.so'), \
-            ('/usr/lib64/libGL.so', '/usr/lib64/libGLU.so'), \
-            ('/usr/lib/*-linux-gnu/libGL.so', '/usr/lib/*-linux-gnu/libGLU.so'))
-
-        for (f1, f2) in check_files:
-            if re.search('\*', f1):
-                for g1 in glob.glob(f1):
-                    if libgl:
-                        break
-                    if os.path.exists(g1):
-                        for g2 in glob.glob(f2):
-                            if os.path.exists(g2):
-                                libgl = True
-                                break
-                if libgl:
-                    break
-            else:
-                if os.path.exists(f1) and os.path.exists(f2):
-                    libgl = True
-                    break
-        if not libgl:
-            logger.error("You need libGL.so and libGLU.so to exist in your library path to run the QEMU emulator.")
-            logger.error("Ubuntu package names are: libgl1-mesa-dev and libglu1-mesa-dev.")
-            logger.error("Fedora package names are: mesa-libGL-devel mesa-libGLU-devel.")
-            raise RunQemuError('%s requires libGLU, but not found' % qemu_bin)
-
 def get_first_file(cmds):
     """Return first file found in wildcard cmds"""
     for cmd in cmds:
@@ -1166,8 +1133,6 @@ class BaseConfig(object):
         if not os.access(qemu_bin, os.X_OK):
             raise OEPathError("No QEMU binary '%s' could be found" % qemu_bin)
 
-        check_libgl(qemu_bin)
-
         self.qemu_opt = "%s %s %s %s" % (qemu_bin, self.get('NETWORK_CMD'), self.get('ROOTFS_OPTIONS'), self.get('QB_OPT_APPEND'))
 
         for ovmf in self.ovmf_bios:
Signature · 1 line
2.17.1
#35 lore raw

PATCH 22/23 qemu: add environment variable wrappers to make qemu look good with gtk frontend

In reply to Alexander Kanavin

GTK_THEME instructs gtk to use its built-in theme. Otherwise gtk attempts to use the theme from the host, which may be from a totally mismatching gtk version.

On the other hand FONTCONFIG_PATH tells it to use the host fonts, as providing fonts in the native sysroot and instructing the components to use them is a lot more tricky.

GDK_PIXBUF_MODULE_FILE is set, because otherwise qemu works but fills stdout with error messages, which eventually fill the pipe stdout is redirected to by runqemuscript , which causes the qemu process to lock up.

---
 meta/recipes-devtools/qemu/qemu.inc | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
meta/recipes-devtools/qemu/qemu.inc +22 -0
index 6937bbc87b4..23da51b5938 100644
@@ -48,6 +48,28 @@ do_install () {
 	oe_runmake 'DESTDIR=${D}' install
 }
 
+do_install_append_class-native() {
+        gdk_pixbuf_module_file=`pkg-config --variable=gdk_pixbuf_cache_file gdk-pixbuf-2.0`
+
+        for tool in `ls ${D}${bindir}/qemu-system-*`; do
+                create_wrapper $tool \
+                        GDK_PIXBUF_MODULE_FILE=$gdk_pixbuf_module_file \
+                        FONTCONFIG_PATH=/etc/fonts \
+                        GTK_THEME=Adwaita
+        done
+}
+
+do_install_append_class-nativesdk() {
+        gdk_pixbuf_module_file=`pkg-config --variable=gdk_pixbuf_cache_file gdk-pixbuf-2.0`
+
+        for tool in `ls ${D}${bindir}/qemu-system-*`; do
+                create_wrapper $tool \
+                        GDK_PIXBUF_MODULE_FILE=$gdk_pixbuf_module_file \
+                        FONTCONFIG_PATH=/etc/fonts \
+                        GTK_THEME=Adwaita
+        done
+}
+
 # The following fragment will create a wrapper for qemu-mips user emulation
 # binary in order to work around a segmentation fault issue. Basically, by
 # default, the reserved virtual address space for 32-on-64 bit is set to 4GB.
Signature · 1 line
2.17.1
#36 lore raw

PATCH 23/23 selftest: add a test for virgl GL acceleration

In reply to Alexander Kanavin

Note that the test requires that the host machine has a X display and is able to create OpenGL contexts.

---
 meta-selftest/lib/oeqa/runtime/cases/virgl.py | 17 +++++++++++++++++
 meta/lib/oeqa/selftest/cases/runtime_test.py  | 19 +++++++++++++++++++
 2 files changed, 36 insertions(+)
 create mode 100644 meta-selftest/lib/oeqa/runtime/cases/virgl.py
meta-selftest/lib/oeqa/runtime/cases/virgl.py new file +17 -0
new file mode 100644
index 00000000000..3894962eaaf
@@ -0,0 +1,17 @@
+from oeqa.runtime.case import OERuntimeTestCase
+from oeqa.core.decorator.depends import OETestDepends
+import subprocess
+
+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):
+        status, output = self.target.run('kmscube')
+        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 +19 -0
index 906e460d4f8..14837fcdd68 100644
@@ -168,6 +168,25 @@ class TestImage(OESelftestTestCase):
         # remove the oeqa-feed-sign temporal directory
         shutil.rmtree(self.gpg_home, ignore_errors=True)
 
+    @OETestID(1883)
+    def test_testimage_virgl(self):
+        """
+        Summary: Check host-assisted accelerate OpenGL functionality in qemu
+        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 <[email protected]>
+        """
+        features = 'INHERIT += "testimage"\n'
+        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_QEMUPARAMS = "-vga virtio -display gtk,gl=on"\n'
+        self.write_config(features)
+        bitbake('core-image-minimal')
+        bitbake('-c testimage core-image-minimal')
+
 class Postinst(OESelftestTestCase):
     @OETestID(1540)
     @OETestID(1545)
Signature · 1 line
2.17.1
#37 lore raw
In reply to Alexander Kanavin

Oh, I forgot the rationale:

1. I think we are heading towards a reality where some kind of working GL is a 'must' for any kind of UI work.
2. Typically people build images and then transfer them to the NUC or even target boards for testing - using qemu would be less awkward.
3. Current qemu configuration is basically useless here.

Alex

Quoted 128 lines · Alexander Kanavin

0. TLDR:

$ . oe-init-build-env build-virgl
$ bitbake core-image-sato-sdk
$ runqemu kvm gl
$$ run glxgears or any other GL-capable binary inside qemu

1. qemu is switched over to use gtk frontend. I simply couldn't get SDL frontend to work properly, it only displays a blank black window or doesn't start at all. Same thing happens with qemu binaries provided by Fedora and opensuse (Ubuntu's qemu lacks virgl support). Seems like SDL support has regressed.

2. While the components are built against the most minimum necessary mesa-native set (gbm, egl, dri with no drivers), libepoxy loads and uses the host GL implementation (through a chrpath hack). This is both to save build times, and because the host is likely to have a set of drivers more appropriate for the physical machine (e.g. proprietary nvidia stack, although I didn't test that).

3. I tested this with
- glamor X server
- weston compositor with drm backend (build core-image-weston, then edit weston.ini in the image to use drm backed instead of fbdev).
- kmscube
- glxgears
- https://www.geeks3d.com/gputest/

The latter two show FPS that is similar to running them directly on the host.

4. Some things I am not sure about:

- how much of a 'default' should this be for running qemu. It works for me,
but other people might find it less stable compared to the existing sdl-vmware-swrast setup.

- what other tests and demos could be run

- how could this be tested on the autobuilder. I wrote an oe-selftest for this, but it does require an X session, and ability to create opengl contexts on the host.

The following changes since commit 0c9f6e9bb18b2a52b5a5e828772a9619ee4d8515:

strace: add lost Upstream-Status (2019-01-14 11:49:07 +0000)

are available in the Git repository at:

git://git.yoctoproject.org/poky-contrib akanavin/virgl-gtk
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=akanavin/virgl-gtk

Alexander Kanavin (23):
gtk+3: enable native/nativesdk variant
gtk+3: remove the gtk-icon-utils-native recipe
shared-mime-info: update the database also in native builds gtk+: drop support for choosing between 2.x and 3.x implementations of
gtk-update-icon-cache
pixbufcache.bbclass: remove a dependency loop introduced by enabling
gtk+3-native
meta: add native and nativesdk variants to various recipes to enable
gtk+3-native/nativesdk
libepoxy: enable native/nativesdk variants
mesa: enable native and nativesdk variants
virglrenderer: add a recipe
qemu: enable virglrenderer and glx options for native/nativesdk builds
qemu: drop --with-gtkabi option, as it is no longer supported
mesa-gl: do not enable nativesdk variant to avoid clashes with main
mesa recipe
local.conf.sample: adjust the qemu config to enable gtk+ instead of
sdl
qemu: build target variant with gtk+, and nativesdk variant without
sdl
qemu: remove support for building against host sdl
atk: disable gobject-introspection for nativesdk
qemu: add a gettext-native dependency
libjpeg-turbo: fix nativesdk build in same way as native builds are
qemu: add a patch to avoid a missing include error
runqemu: add support for virgl GL acceleration
runqemu: do not check for GL libraries
qemu: add environment variable wrappers to make qemu look good with
gtk frontend
selftest: add a test for virgl GL acceleration

 meta-poky/conf/local.conf.sample              |  10 +-
 meta-selftest/lib/oeqa/runtime/cases/virgl.py |  17 +++
 meta/classes/pixbufcache.bbclass              |   2 +-
 meta/conf/machine/include/qemuboot-x86.inc    |   2 +-
 meta/lib/oeqa/selftest/cases/runtime_test.py  |  19 ++++
 meta/recipes-devtools/qemu/qemu.inc           |  40 ++++---
 .../qemu/0001-Add-a-missing-X11-include.patch |  23 ++++
 meta/recipes-devtools/qemu/qemu_3.1.0.bb      |   1 +
 .../gdk-pixbuf/gdk-pixbuf_2.36.11.bb          |   2 +-
 .../gnome/adwaita-icon-theme_3.28.0.bb        |   2 +
 meta/recipes-gnome/gtk+/gtk+.inc              |   5 +-
 meta/recipes-gnome/gtk+/gtk+3.inc             |  29 +++--
 .../gtk+/gtk-icon-utils-native_3.22.30.bb     |  63 -----------
 ...endency-from-gtk-encode-symbolic-svg.patch | 102 ------------------
 .../hicolor-icon-theme_0.17.bb                |   2 +
 meta/recipes-graphics/cairo/cairo_1.14.12.bb  |   2 +-
 .../harfbuzz/harfbuzz_2.2.0.bb                |   2 +-
 .../jpeg/libjpeg-turbo_2.0.1.bb               |   3 +-
 .../libepoxy/libepoxy_1.5.3.bb                |  12 +++
 meta/recipes-graphics/mesa/mesa-gl_18.1.9.bb  |   2 +
 meta/recipes-graphics/mesa/mesa.inc           |  12 ++-
 meta/recipes-graphics/pango/pango_1.42.4.bb   |   2 +-
 .../ttf-fonts/liberation-fonts_2.00.1.bb      |   2 +
 .../virglrenderer/virglrenderer_git.bb        |  17 +++
 .../xorg-lib/libxcomposite_0.4.4.bb           |   2 +-
 .../xorg-lib/libxdamage_1.1.4.bb              |   2 +-
 meta/recipes-graphics/xorg-lib/libxi_1.7.9.bb |   2 +
 .../xorg-lib/libxtst_1.2.3.bb                 |   1 +
 .../recipes-support/atk/at-spi2-atk_2.30.0.bb |   2 +
 .../atk/at-spi2-core_2.30.0.bb                |   1 +
 meta/recipes-support/atk/atk_2.30.0.bb        |   4 +-
 .../shared-mime-info/shared-mime-info.inc     |   2 +
 meta/recipes-support/vte/vte_0.52.2.bb        |   2 +
 scripts/runqemu                               |  46 ++------
 34 files changed, 193 insertions(+), 244 deletions(-)
 create mode 100644 meta-selftest/lib/oeqa/runtime/cases/virgl.py
 create mode 100644 meta/recipes-devtools/qemu/qemu/0001-Add-a-missing-X11-include.patch
 delete mode 100644 meta/recipes-gnome/gtk+/gtk-icon-utils-native_3.22.30.bb
 delete mode 100644 meta/recipes-gnome/gtk+/gtk-icon-utils/Remove-Gdk-dependency-from-gtk-encode-symbolic-svg.patch
 create mode 100644 meta/recipes-graphics/virglrenderer/virglrenderer_git.bb

--
2.17.1

#8 lore raw

Re: [PATCH 07/23] libepoxy: enable native/nativesdk variants

In reply to Alexander Kanavin
Quoted 35 lines

-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Alexander Kanavin
Sent: den 14 januari 2019 16:03
To: [email protected]
Subject: [OE-core] [PATCH 07/23] libepoxy: enable native/nativesdk variants

libepoxy is a requirement of virglrenderer. Note that we strip RPATH from the library, as this allows fall-through to the host GL implementation, instead of attempting (and failing) to use mesa-native.

---
 meta/recipes-graphics/libepoxy/libepoxy_1.5.3.bb | 12 ++++++++++++
 1 file changed, 12 insertions(+)
meta/recipes-graphics/libepoxy/libepoxy_1.5.3.bb +2 -0
index 92f644c039d..45995325d2c 100644
@@ -14,9 +14,21 @@ UPSTREAM_CHECK_URI = "https://github.com/anholt/libepoxy/releases"
 inherit meson pkgconfig distro_features_check
 
 REQUIRED_DISTRO_FEATURES = "opengl"
+REQUIRED_DISTRO_FEATURES_class-native = ""
+REQUIRED_DISTRO_FEATURES_class-nativesdk = ""
 
 PACKAGECONFIG[egl] = "-Degl=yes, -Degl=no, virtual/egl"
 PACKAGECONFIG[x11] = "-Dglx=yes, -Dglx=no, virtual/libx11 virtual/libgl"
 PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)} egl"
 
 EXTRA_OEMESON += "-Dtests=false"

meta/recipes-graphics/libepoxy/libepoxy_1.5.3.bb UPSTREAM_CHECK_URI = "https://github.com/anholt/libepoxy/releases" · line 34

Quoted 10 lines
meta/recipes-graphics/libepoxy/libepoxy_1.5.3.bb +10 -0
+
+PACKAGECONFIG_class-native = "egl"
+PACKAGECONFIG_class-nativesdk = "egl"
+
+BBCLASSEXTEND = "native nativesdk"
+
+# This will ensure that dlopen will attempt only GL libraries provided by host
+do_install_append () {
+    chrpath --delete ${D}${libdir}/*.so
+}

Shouldn't this only be done for native/nativesdk? I.e.:

do_install_append_class-native() {
	chrpath --delete ${D}${libdir}/*.so
}
do_install_append_class-nativesdk() {
	chrpath --delete ${D}${libdir}/*.so
}

(I also changed the indentation to tabs as I believe that is still the official OE-Core standard for shell code in recipes.)

Quoted 2 lines

--
2.17.1

//Peter

#11 lore raw

Re: [PATCH 08/23] mesa: enable native and nativesdk variants

In reply to Alexander Kanavin

meta/recipes-graphics/mesa/mesa.inc PROVIDES = " \ · line 31

Quoted 2 lines · Alexander Kanavin
meta/recipes-graphics/mesa/mesa.inc +1 -1
-ANY_OF_DISTRO_FEATURES = "opengl vulkan"
+ANY_OF_DISTRO_FEATURES_class-target = "opengl vulkan"

Sounds like this means we should be fiddling the native DISTRO_FEATURES instead of making a distro feature check target-only.

Ross

#23 lore raw

Re: [PATCH 16/23] atk: disable gobject-introspection for nativesdk

In reply to Alexander Kanavin

Rationale please.

Ross

Quoted 30 lines · Alexander Kanavin
---
 meta/recipes-support/atk/atk_2.30.0.bb | 2 ++
 1 file changed, 2 insertions(+)
meta/recipes-support/atk/atk_2.30.0.bb +2 -0
index 481f8e89a13..4e2dacbc4d8 100644
@@ -20,6 +20,8 @@ GTKDOC_DISABLE_FLAG = "-Ddocs=false"
 GI_ENABLE_FLAG = "-Dintrospection=true"
 GI_DISABLE_FLAG = "-Dintrospection=false"
 
+EXTRA_OEMESON_append_class-nativesdk = " ${GI_DISABLE_FLAG}"
+
 EXTRA_OEMESON_append_class-target = "
 ${@bb.utils.contains('GI_DATA_ENABLED', 'True', '${GI_ENABLE_FLAG}', \
 
              '${GI_DISABLE_FLAG}', d)} "

--
2.17.1

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#17 lore raw

Re: [PATCH 12/23] mesa-gl: do not enable nativesdk variant to avoid clashes with main mesa recipe

In reply to Alexander Kanavin

Wouldn't a preferred provider would sort this?

Ross

Quoted 26 lines · Alexander Kanavin
---
 meta/recipes-graphics/mesa/mesa-gl_18.1.9.bb | 2 ++
 1 file changed, 2 insertions(+)
meta/recipes-graphics/mesa/mesa-gl_18.1.9.bb +0 -0
index 73267eb4f0d..030db6c1440 100644
@@ -7,3 +7,5 @@ PROVIDES = "virtual/libgl virtual/mesa"
 S = "${WORKDIR}/mesa-${PV}"
 
 PACKAGECONFIG ??= "opengl dri ${@bb.utils.filter('DISTRO_FEATURES',

'x11', d)}"

meta/recipes-graphics/mesa/mesa-gl_18.1.9.bb +2 -1
+
+BBCLASSEXTEND_remove = "nativesdk"
--

2.17.1

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#32 lore raw

Re: [PATCH 20/23] runqemu: add support for virgl GL acceleration

In reply to Alexander Kanavin

You're duplicating nographic elif

Quoted 72 lines · Alexander Kanavin

Also, do not hardcode -vga option to qemu, set it according to command line parameters.

---
 meta/conf/machine/include/qemuboot-x86.inc |  2 +-
 scripts/runqemu                            | 11 +++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)
meta/conf/machine/include/qemuboot-x86.inc +0 -0
index 5fdbe4df50e..574b7bbfc7d 100644
@@ -11,7 +11,7 @@ QB_CPU_KVM_x86-64 = "-cpu core2duo"
 QB_AUDIO_DRV = "alsa"
 QB_AUDIO_OPT = "-soundhw ac97,es1370"
 QB_KERNEL_CMDLINE_APPEND = "vga=0 uvesafb.mode_option=${UVESA_MODE}

oprofile.timer=1 uvesafb.task_timeout=-1"

meta/conf/machine/include/qemuboot-x86.inc +1 -1
-QB_OPT_APPEND = "-vga vmware -show-cursor -usb -device usb-tablet"
+QB_OPT_APPEND = "-show-cursor -usb -device usb-tablet"
 # Add the 'virtio-rng-pci' device otherwise the guest may run out of

entropy
QB_OPT_APPEND += "-object rng-random,filename=/dev/urandom,id=rng0

meta/conf/machine/include/qemuboot-x86.inc +0 -1
-device virtio-rng-pci,rng=rng0"
scripts/runqemu +2 -0
index c4a0ca811d9..fa88dc4583c 100755
@@ -74,6 +74,8 @@ 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
+    gl - enable virgl-based GL acceleration
+    gl-es - enable virgl-based GL acceleration, using OpenGL ES
     serial - enable a serial console on /dev/ttyS0
     serialstdio - enable a serial console on the console (regardless of

graphics mode)
slirp - enable user networking, no root privileges is required

scripts/runqemu +9 -1
@@ -427,12 +429,21 @@ class BaseConfig(object):
                 sys.argv.remove(quiet)
 
         unknown_arg = ""
+        if 'gl' not in sys.argv[1:] and 'gl-es' not in sys.argv[1:]:
+            self.qemu_opt_script += ' -vga vmware'
         for arg in sys.argv[1:]:
             if arg in self.fstypes + self.vmtypes:
                 self.check_arg_fstype(arg)
             elif arg == 'nographic':
                 self.qemu_opt_script += ' -nographic'
                 self.kernel_cmdline_script += ' console=ttyS0'
+            elif arg == 'gl':
+                self.qemu_opt_script += ' -vga virtio -display gtk,gl=on'
+            elif arg == 'gl-es':
+                self.qemu_opt_script += ' -vga virtio -display gtk,gl=es'
+            elif arg == 'nographic':
+                self.qemu_opt_script += ' -nographic'
+                self.kernel_cmdline_script += ' console=ttyS0'
             elif arg == 'serial':
                 self.kernel_cmdline_script += ' console=ttyS0'
                 self.serialconsole = True
--

2.17.1

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#12 lore raw

Re: [PATCH 08/23] mesa: enable native and nativesdk variants

In reply to Burton, Ross
Quoted 5 lines · Ross

meta/recipes-graphics/mesa/mesa.inc PROVIDES = " \ · line 31

Quoted 2 lines
meta/recipes-graphics/mesa/mesa.inc +1 -1
-ANY_OF_DISTRO_FEATURES = "opengl vulkan"
+ANY_OF_DISTRO_FEATURES_class-target = "opengl vulkan"

Sounds like this means we should be fiddling the native DISTRO_FEATURES instead of making a distro feature check target-only.

The precedents in oe-core seem to use DISTRO_FEATURES only for target builds and I tend to agree: it's better to have a 'one size fits all' approach to native packages, both to speed up builds and to reduce complexity and need to test variants.
https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/recipes-graphics/xorg-lib/libxcb_1.13.1.bb
https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/recipes-graphics/xorg-lib/xorg-lib-common.inc

Alex

#24 lore raw

Re: [PATCH 16/23] atk: disable gobject-introspection for nativesdk

In reply to Burton, Ross
Quoted 1 line · Ross

Rationale please.

We do not support g-i for nativesdk, neverthless atk tries and fails. I added this to the commit message.

Alex

Alex

#18 lore raw

Re: [PATCH 12/23] mesa-gl: do not enable nativesdk variant to avoid clashes with main mesa recipe

In reply to Burton, Ross

Not really. For native/nativesdk builds mesa-gl is not a viable alternative to mesa, as it lacks all of the bits that make accelerated qemu possible. Using PREFERRED_PROVIDER would imply otherwise. I added this to the commit message.

Alex

Quoted 30 lines · Ross

Wouldn't a preferred provider would sort this?

Ross

Quoted 24 lines · Alexander Kanavin
---
 meta/recipes-graphics/mesa/mesa-gl_18.1.9.bb | 2 ++
 1 file changed, 2 insertions(+)
meta/recipes-graphics/mesa/mesa-gl_18.1.9.bb +2 -1
index 73267eb4f0d..030db6c1440 100644
@@ -7,3 +7,5 @@ PROVIDES = "virtual/libgl virtual/mesa"
 S = "${WORKDIR}/mesa-${PV}"
 
 PACKAGECONFIG ??= "opengl dri ${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}"
+
+BBCLASSEXTEND_remove = "nativesdk"
--

2.17.1

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#9 lore raw

Re: [PATCH 07/23] libepoxy: enable native/nativesdk variants

In reply to Peter Kjellerstedt
Quoted 6 lines · Peter Kjellerstedt

Shouldn't this only be done for native/nativesdk? I.e.:

do_install_append_class-native() {
        chrpath --delete ${D}${libdir}/*.so
}
Quoted 6 lines
do_install_append_class-nativesdk() {
        chrpath --delete ${D}${libdir}/*.so
}

(I also changed the indentation to tabs as I believe that is still the official OE-Core standard for shell code in recipes.)

Thanks, I have fixed this now. I'll resend the patchset.

Alex

#33 lore raw

Re: [PATCH 20/23] runqemu: add support for virgl GL acceleration

In reply to Martin Jansa

Thanks, I have fixed this now.

Alex

Quoted 69 lines · Martin Jansa

You're duplicating nographic elif

Quoted 65 lines · Alexander Kanavin

Also, do not hardcode -vga option to qemu, set it according to command line parameters.

---
 meta/conf/machine/include/qemuboot-x86.inc |  2 +-
 scripts/runqemu                            | 11 +++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)
meta/conf/machine/include/qemuboot-x86.inc +1 -1
index 5fdbe4df50e..574b7bbfc7d 100644
@@ -11,7 +11,7 @@ QB_CPU_KVM_x86-64 = "-cpu core2duo"
 QB_AUDIO_DRV = "alsa"
 QB_AUDIO_OPT = "-soundhw ac97,es1370"
 QB_KERNEL_CMDLINE_APPEND = "vga=0 uvesafb.mode_option=${UVESA_MODE} oprofile.timer=1 uvesafb.task_timeout=-1"
-QB_OPT_APPEND = "-vga vmware -show-cursor -usb -device usb-tablet"
+QB_OPT_APPEND = "-show-cursor -usb -device usb-tablet"
 # Add the 'virtio-rng-pci' device otherwise the guest may run out of entropy
 QB_OPT_APPEND += "-object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0"
 
scripts/runqemu +11 -1
index c4a0ca811d9..fa88dc4583c 100755
@@ -74,6 +74,8 @@ 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
+    gl - enable virgl-based GL acceleration
+    gl-es - enable virgl-based GL acceleration, using OpenGL ES
     serial - enable a serial console on /dev/ttyS0
     serialstdio - enable a serial console on the console (regardless of graphics mode)
     slirp - enable user networking, no root privileges is required
@@ -427,12 +429,21 @@ class BaseConfig(object):
                 sys.argv.remove(quiet)
 
         unknown_arg = ""
+        if 'gl' not in sys.argv[1:] and 'gl-es' not in sys.argv[1:]:
+            self.qemu_opt_script += ' -vga vmware'
         for arg in sys.argv[1:]:
             if arg in self.fstypes + self.vmtypes:
                 self.check_arg_fstype(arg)
             elif arg == 'nographic':
                 self.qemu_opt_script += ' -nographic'
                 self.kernel_cmdline_script += ' console=ttyS0'
+            elif arg == 'gl':
+                self.qemu_opt_script += ' -vga virtio -display gtk,gl=on'
+            elif arg == 'gl-es':
+                self.qemu_opt_script += ' -vga virtio -display gtk,gl=es'
+            elif arg == 'nographic':
+                self.qemu_opt_script += ' -nographic'
+                self.kernel_cmdline_script += ' console=ttyS0'
             elif arg == 'serial':
                 self.kernel_cmdline_script += ' console=ttyS0'
                 self.serialconsole = True
--

2.17.1

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#26 lore raw

Re: [PATCH 17/23] qemu: add a gettext-native dependency

In reply to Alexander Kanavin
Quoted 13 lines · Alexander Kanavin

xgettext/msgmerge is used during do_install().

---
 meta/recipes-devtools/qemu/qemu.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes- renamed from meta/recipes-devtools/qemu/qemu.inc +0 -0

devtools/qemu/qemu.inc
index db9c2245df9..6937bbc87b4 100644

meta/recipes-devtools/qemu/qemu.inc line 5

Quoted 6 lines
meta/recipes-devtools/qemu/qemu.inc +1 -1
@@ -1,7 +1,7 @@
 SUMMARY = "Fast open source processor emulator"
 HOMEPAGE = "http://qemu.org"
 LICENSE = "GPLv2 & LGPLv2.1"
-DEPENDS = "glib-2.0 zlib pixman"
+DEPENDS = "glib-2.0 zlib pixman gettext-native"
 RDEPENDS_${PN}_class-target += "bash"

gettext is a heavy enough dependency I'm tempted to suggest we do:

do_install[depends] += "gettext-native:do_populate_sysroot"

given how slow qemu is to compile...

Cheers,

Richard

#27 lore raw

Re: [PATCH 17/23] qemu: add a gettext-native dependency

Quoted 22 lines · Richard Purdie
Quoted 13 lines

xgettext/msgmerge is used during do_install().

---
 meta/recipes-devtools/qemu/qemu.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes- renamed from meta/recipes-devtools/qemu/qemu.inc +0 -0

devtools/qemu/qemu.inc
index db9c2245df9..6937bbc87b4 100644

meta/recipes-devtools/qemu/qemu.inc line 5

Quoted 6 lines
meta/recipes-devtools/qemu/qemu.inc +1 -1
@@ -1,7 +1,7 @@
 SUMMARY = "Fast open source processor emulator"
 HOMEPAGE = "http://qemu.org"
 LICENSE = "GPLv2 & LGPLv2.1"
-DEPENDS = "glib-2.0 zlib pixman"
+DEPENDS = "glib-2.0 zlib pixman gettext-native"
 RDEPENDS_${PN}_class-target += "bash"

gettext is a heavy enough dependency I'm tempted to suggest we do:

Quoted 3 lines

do_install[depends] += "gettext-native:do_populate_sysroot"

given how slow qemu is to compile...

I'm going to look a bit deeper to find out why this isn't a problem in master, but is a problem in my patchset. This was just a quick fix to get things to build, as I was eager to get to the point where opengl works :)

Alex

#28 lore raw

Re: [PATCH 17/23] qemu: add a gettext-native dependency

Quoted 11 lines · Alexander Kanavin
Quoted 6 lines

gettext is a heavy enough dependency I'm tempted to suggest we do:

do_install[depends] += "gettext-native:do_populate_sysroot"

given how slow qemu is to compile...

I'm going to look a bit deeper to find out why this isn't a problem in master, but is a problem in my patchset. This was just a quick fix to get things to build, as I was eager to get to the point where opengl works :)

qemu already unconditionally depends on glib-2.0 which has a hard dependency on gettext-native, so this wouldn't slow down the builds.

However, qemu itself depends on gettext utilities only when gtk+ is enabled:

https://github.com/qemu/qemu/blob/master/Makefile#L743

so I'll move the dependency into gtk+ PACKAGECONFIG.

Alex

Alex