Skip to contentSkip to conversation

bitbake.conf: propagate 'opengl' DISTRO_FEATURE to native/nativesdk from target

PATCH New Alexander Kanavin 1 participant 8 messages Mar 27, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/8 bitbake.conf: propagate 'opengl' DISTRO_FEATURE to native/nativesdk from target

This will allow better control over native virgl/qemu configurations.

Adjust gtk+3/cairo native configurations to actually ignore opengl when building for -native: we do not need it, and it would cause build failures as only a limited subset of mesa-native is currently built.

Drop native/nativesdk overrides from virglrenderer/libepoxy recipes as opengl feature is now correctly set for those variants.

---
 meta/conf/bitbake.conf                                     | 4 ++--
 meta/recipes-gnome/gtk+/gtk+3.inc                          | 2 ++
 meta/recipes-graphics/cairo/cairo_1.16.0.bb                | 2 ++
 meta/recipes-graphics/libepoxy/libepoxy_1.5.3.bb           | 2 --
 meta/recipes-graphics/virglrenderer/virglrenderer_0.7.0.bb | 2 --
 5 files changed, 6 insertions(+), 6 deletions(-)
meta/conf/bitbake.conf +2 -2
index 7f8b043cc45..b64252eac94 100644
@@ -833,8 +833,8 @@ DISTRO_FEATURES_NATIVESDK ?= "x11"
 
 # Normally target distro features will not be applied to native builds:
 # Native distro features on this list will use the target feature value
-DISTRO_FEATURES_FILTER_NATIVE ?= "api-documentation"
-DISTRO_FEATURES_FILTER_NATIVESDK ?= "api-documentation"
+DISTRO_FEATURES_FILTER_NATIVE ?= "api-documentation opengl"
+DISTRO_FEATURES_FILTER_NATIVESDK ?= "api-documentation opengl"
 
 DISTRO_FEATURES_BACKFILL = "pulseaudio sysvinit bluez5 gobject-introspection-data ldconfig"
 MACHINE_FEATURES_BACKFILL = "rtc qemu-usermode"
meta/recipes-gnome/gtk+/gtk+3.inc +2 -0
index 77b6c31536b..2f9e05b1cd4 100644
@@ -47,6 +47,8 @@ do_compile_prepend() {
 
 PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'opengl wayland x11', d)} \
                    ${@bb.utils.contains('DISTRO_FEATURES', 'opengl x11', 'glx', '', d)}"
+PACKAGECONFIG_class-native = "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}"
+PACKAGECONFIG_class-nativesdk = "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}"
 
 PACKAGECONFIG[x11] = "--enable-x11-backend,--disable-x11-backend,at-spi2-atk fontconfig libx11 libxext libxcursor libxi libxdamage libxrandr libxrender libxcomposite libxfixes"
 # this is provided by oe-core patch that removes epoxy/gl dependency from a X11 build
meta/recipes-graphics/cairo/cairo_1.16.0.bb +2 -0
index c2628ae0ca0..e875180f6e6 100644
@@ -41,6 +41,8 @@ X11DEPENDS = "virtual/libx11 libsm libxrender libxext"
 PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'directfb', d)} \
                    ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11 xcb', '', d)} \
                    ${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl', 'opengl', '', d)}"
+PACKAGECONFIG_class-native = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11 xcb', '', d)}"
+PACKAGECONFIG_class-nativesdk = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11 xcb', '', d)}"
 
 PACKAGECONFIG[x11] = "--with-x=yes -enable-xlib,--with-x=no --disable-xlib,${X11DEPENDS}"
 PACKAGECONFIG[xcb] = "--enable-xcb,--disable-xcb,libxcb"
meta/recipes-graphics/libepoxy/libepoxy_1.5.3.bb +0 -2
index dd706a96063..66e8b476dcc 100644
@@ -14,8 +14,6 @@ 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"
meta/recipes-graphics/virglrenderer/virglrenderer_0.7.0.bb +0 -2
index 225a0b8b0c9..b1dfb85c49e 100644
@@ -18,5 +18,3 @@ inherit autotools pkgconfig distro_features_check
 BBCLASSEXTEND = "native nativesdk"
 
 REQUIRED_DISTRO_FEATURES = "opengl"
-REQUIRED_DISTRO_FEATURES_class-native = ""
-REQUIRED_DISTRO_FEATURES_class-nativesdk = ""
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/8 xorg-lib: drop native overrides for REQUIRED_DISTRO_FEATURES

x11 is actually always present in native DISTRO_FEATURES, and so it's fine to require it in all cases.

---
 meta/recipes-graphics/xorg-lib/libxcb_1.13.1.bb    | 1 -
 meta/recipes-graphics/xorg-lib/xorg-lib-common.inc | 1 -
 2 files changed, 2 deletions(-)
meta/recipes-graphics/xorg-lib/libxcb_1.13.1.bb +0 -1
index 84303e6246f..518249ee922 100644
@@ -30,7 +30,6 @@ inherit autotools pkgconfig distro_features_check
 
 # The libxau and others requires x11 in DISTRO_FEATURES
 REQUIRED_DISTRO_FEATURES = "x11"
-REQUIRED_DISTRO_FEATURES_class-native = ""
 
 export PYTHON = "python3"
 
meta/recipes-graphics/xorg-lib/xorg-lib-common.inc +0 -1
index 6f4e44454f2..09df0109cb8 100644
@@ -24,4 +24,3 @@ UNKNOWN_CONFIGURE_WHITELIST += "--enable-malloc0returnsnull --disable-malloc0ret
 "
 
 REQUIRED_DISTRO_FEATURES ?= "x11"
-REQUIRED_DISTRO_FEATURES_class-native = ""
Signature · 1 line
2.17.1
#2 lore raw

PATCH 3/8 qemu: enable virglrenderer and glx options subject to 'opengl' DISTRO_FEATURE

In reply to Alexander Kanavin

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

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

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

$ runqemu kvm egl-headless publicvnc
---
 meta/lib/oeqa/selftest/cases/runtime_test.py      | 15 ++++++---------
 .../qemu/qemu-system-native_3.1.0.bb              |  4 +++-
 meta/recipes-devtools/qemu/qemu_3.1.0.bb          |  5 ++++-
 3 files changed, 13 insertions(+), 11 deletions(-)
meta/lib/oeqa/selftest/cases/runtime_test.py +6 -9
index 6c25bb901d1..fca803ffbc5 100644
@@ -185,13 +185,12 @@ class TestImage(OESelftestTestCase):
             self.skipTest('virgl isn\'t working with Debian 8')
 
         qemu_packageconfig = get_bb_var('PACKAGECONFIG', 'qemu-system-native')
+        qemu_distrofeatures = get_bb_var('DISTRO_FEATURES', 'qemu-system-native')
         features = 'INHERIT += "testimage"\n'
         if 'gtk+' not in qemu_packageconfig:
             features += 'PACKAGECONFIG_append_pn-qemu-system-native = " gtk+"\n'
-        if 'virglrenderer' not in qemu_packageconfig:
-            features += 'PACKAGECONFIG_append_pn-qemu-system-native = " virglrenderer"\n'
-        if 'glx' not in qemu_packageconfig:
-            features += 'PACKAGECONFIG_append_pn-qemu-system-native = " glx"\n'
+        if 'opengl' not in qemu_distrofeatures:
+            features += 'DISTRO_FEATURES_append = " opengl"\n'
         features += 'TEST_SUITES = "ping ssh virgl"\n'
         features += 'IMAGE_FEATURES_append = " ssh-server-dropbear"\n'
         features += 'IMAGE_INSTALL_append = " kmscube"\n'
@@ -220,12 +219,10 @@ class TestImage(OESelftestTestCase):
             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.")
-        qemu_packageconfig = get_bb_var('PACKAGECONFIG', 'qemu-system-native')
+        qemu_distrofeatures = get_bb_var('DISTRO_FEATURES', 'qemu-system-native')
         features = 'INHERIT += "testimage"\n'
-        if 'virglrenderer' not in qemu_packageconfig:
-            features += 'PACKAGECONFIG_append_pn-qemu-system-native = " virglrenderer"\n'
-        if 'glx' not in qemu_packageconfig:
-            features += 'PACKAGECONFIG_append_pn-qemu-system-native = " glx"\n'
+        if 'opengl' not in qemu_distrofeatures:
+            features += 'DISTRO_FEATURES_append = " opengl"\n'
         features += 'TEST_SUITES = "ping ssh virgl"\n'
         features += 'IMAGE_FEATURES_append = " ssh-server-dropbear"\n'
         features += 'IMAGE_INSTALL_append = " kmscube"\n'
meta/recipes-devtools/qemu/qemu-system-native_3.1.0.bb +3 -1
index 5bf528bec12..6928592a94c 100644
@@ -9,7 +9,9 @@ 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 \
+    ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'virglrenderer glx', '' ,d)} \
+"
 
 # 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 +4 -1
index 04d8bee99f2..8113fc24e8b 100644
@@ -16,7 +16,10 @@ do_install_append_class-nativesdk() {
 PACKAGECONFIG ??= " \
     fdt sdl kvm \
     ${@bb.utils.filter('DISTRO_FEATURES', 'alsa xen', d)} \
+    ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'virglrenderer glx', '' ,d)} \
+"
+PACKAGECONFIG_class-nativesdk ??= "fdt sdl kvm \
+    ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'virglrenderer glx', '' ,d)} \
 "
-PACKAGECONFIG_class-nativesdk ??= "fdt sdl kvm"
 
 
Signature · 1 line
2.17.1
#3 lore raw

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

In reply to Alexander Kanavin

sdl frontend remains enabled and available.

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

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

In reply to Alexander Kanavin

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

---
 meta/recipes-devtools/qemu/qemu_3.1.0.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-devtools/qemu/qemu_3.1.0.bb +1 -1
index 669638a6592..16eaa54a16c 100644
@@ -18,7 +18,7 @@ PACKAGECONFIG ??= " \
     ${@bb.utils.filter('DISTRO_FEATURES', 'alsa xen', d)} \
     ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'virglrenderer glx', '' ,d)} \
 "
-PACKAGECONFIG_class-nativesdk ??= "fdt sdl kvm \
+PACKAGECONFIG_class-nativesdk ??= "fdt kvm \
     ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'virglrenderer glx', '' ,d)} \
 "
 
Signature · 1 line
2.17.1
#5 lore raw

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

In reply to Alexander Kanavin

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

---
 meta/recipes-devtools/qemu/qemu.inc | 8 --------
 1 file changed, 8 deletions(-)
meta/recipes-devtools/qemu/qemu.inc +0 -8
index e503aa866d3..dccbd83548a 100644
@@ -87,14 +87,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
#6 lore raw

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

In reply to Alexander Kanavin

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

---
 meta-poky/conf/local.conf.sample | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
meta-poky/conf/local.conf.sample +6 -5
index 9068e567dcd..2775e15d748 100644
@@ -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
#7 lore raw

PATCH 8/8 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
index 2775e15d748..00795ae6a3f 100644
@@ -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