This makes native opengl (and thus accelerated graphics in qemu) opt-in;
the reason is that latest mesa tightly couples hardware drivers with its 
libraries,
so we have to build both in mesa-native. Doing so significantly lengthens
the builds, and so cannot be imposed by default.

Add a check and a hint to runqemu so that there is a helpful error when
there is no native/nativesdk opengl/virgl support.

Signed-off-by: Alexander Kanavin <a...@linutronix.de>
---
 meta/conf/bitbake.conf                       |  4 ++--
 meta/lib/oeqa/selftest/cases/runtime_test.py |  4 ++--
 scripts/runqemu                              | 11 ++++++++++-
 3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index afd9e2f552..d1dc428583 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -912,8 +912,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 debuginfod opengl wayland"
-DISTRO_FEATURES_FILTER_NATIVESDK ?= "api-documentation debuginfod opengl 
wayland"
+DISTRO_FEATURES_FILTER_NATIVE ?= "api-documentation debuginfod wayland"
+DISTRO_FEATURES_FILTER_NATIVESDK ?= "api-documentation debuginfod wayland"
 
 DISTRO_FEATURES_BACKFILL = "pulseaudio sysvinit gobject-introspection-data 
ldconfig"
 MACHINE_FEATURES_BACKFILL = "rtc qemu-usermode"
diff --git a/meta/lib/oeqa/selftest/cases/runtime_test.py 
b/meta/lib/oeqa/selftest/cases/runtime_test.py
index e32c4aff85..74d8a1c23b 100644
--- a/meta/lib/oeqa/selftest/cases/runtime_test.py
+++ b/meta/lib/oeqa/selftest/cases/runtime_test.py
@@ -232,7 +232,7 @@ class TestImage(OESelftestTestCase):
         if 'sdl' not in qemu_packageconfig:
             features += 'PACKAGECONFIG:append:pn-qemu-system-native = " sdl"\n'
         if 'opengl' not in qemu_distrofeatures:
-            features += 'DISTRO_FEATURES:append = " opengl"\n'
+            features += 'DISTRO_FEATURES_NATIVE:append = " opengl"\n'
         features += 'TEST_SUITES = "ping ssh virgl"\n'
         features += 'IMAGE_FEATURES:append = " ssh-server-dropbear"\n'
         features += 'IMAGE_INSTALL:append = " kmscube"\n'
@@ -263,7 +263,7 @@ class TestImage(OESelftestTestCase):
         qemu_distrofeatures = get_bb_var('DISTRO_FEATURES', 
'qemu-system-native')
         features = 'IMAGE_CLASSES += "testimage"\n'
         if 'opengl' not in qemu_distrofeatures:
-            features += 'DISTRO_FEATURES:append = " opengl"\n'
+            features += 'DISTRO_FEATURES_NATIVE:append = " opengl"\n'
         features += 'TEST_SUITES = "ping ssh virgl"\n'
         features += 'IMAGE_FEATURES:append = " ssh-server-dropbear"\n'
         features += 'IMAGE_INSTALL:append = " kmscube"\n'
diff --git a/scripts/runqemu b/scripts/runqemu
index 8e915f3d4c..9f82aa12f1 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -447,7 +447,16 @@ class BaseConfig(object):
             self.set("MACHINE", arg)
 
     def set_dri_path(self):
-        self.qemu_environ['LIBGL_DRIVERS_PATH'] = 
os.path.join(self.bindir_native, '../lib/dri')
+        drivers_path = os.path.join(self.bindir_native, '../lib/dri')
+        if not os.path.exists(drivers_path) or not os.listdir(drivers_path):
+            raise RunQemuError("""
+qemu has been built without opengl support and accelerated graphics support is 
not available.
+To enable it, add:
+DISTRO_FEATURES_NATIVE:append = " opengl"
+DISTRO_FEATURES_NATIVESDK:append = " opengl"
+to your build configuration.
+""")
+        self.qemu_environ['LIBGL_DRIVERS_PATH'] = drivers_path
 
     def check_args(self):
         for debug in ("-d", "--debug"):
-- 
2.30.2

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#178191): 
https://lists.openembedded.org/g/openembedded-core/message/178191
Mute This Topic: https://lists.openembedded.org/mt/97480126/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to