public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: Alexander Kanavin <alex.kanavin@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Alexander Kanavin <alex@linutronix.de>
Subject: [PATCH 1/6] runqemu: direct mesa to use its own drivers, rather than ones provided by host distro
Date: Thu, 16 Mar 2023 10:40:57 +0100	[thread overview]
Message-ID: <20230316094102.2628727-1-alex@linutronix.de> (raw)

With mesa 23.0, it is not longer possible to use the host drivers, as
mesa upstream has added strict checks for matching builds between
drivers and libraries that load them.

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 <alex@linutronix.de>
---
 scripts/runqemu | 34 ++++++++++------------------------
 1 file changed, 10 insertions(+), 24 deletions(-)

diff --git a/scripts/runqemu b/scripts/runqemu
index 38aa35fdd4..0240dd533c 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -450,30 +450,16 @@ class BaseConfig(object):
             self.set("MACHINE", arg)
 
     def set_dri_path(self):
-        # As runqemu can be run within bitbake (when using testimage, for example),
-        # we need to ensure that we run host pkg-config, and that it does not
-        # get mis-directed to native build paths set by bitbake.
-        env = os.environ.copy()
-        try:
-            del env['PKG_CONFIG_PATH']
-            del env['PKG_CONFIG_DIR']
-            del env['PKG_CONFIG_LIBDIR']
-            del env['PKG_CONFIG_SYSROOT_DIR']
-        except KeyError:
-            pass
-        try:
-            dripath = subprocess.check_output("PATH=/bin:/usr/bin:$PATH pkg-config --variable=dridriverdir dri", shell=True, env=env)
-        except subprocess.CalledProcessError as e:
-            raise RunQemuError("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.")
-        self.qemu_environ['LIBGL_DRIVERS_PATH'] = dripath.decode('utf-8').strip()
-
-        # This preloads uninative libc pieces and therefore ensures that RPATH/RUNPATH
-        # in host mesa drivers doesn't trick uninative into loading host libc.
-        preload_items = ['libdl.so.2', 'librt.so.1', 'libpthread.so.0']
-        uninative_path = os.path.dirname(self.get("UNINATIVE_LOADER"))
-        if os.path.exists(uninative_path):
-            preload_paths = [os.path.join(uninative_path, i) for i in preload_items]
-            self.qemu_environ['LD_PRELOAD'] = " ".join(preload_paths)
+        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



             reply	other threads:[~2023-03-16  9:41 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-16  9:40 Alexander Kanavin [this message]
2023-03-16  9:40 ` [PATCH 2/6] mesa: allow mesa-native/nativesdk only subject to opengl/vulkan DISTRO_FEATURE Alexander Kanavin
2023-03-16  9:40 ` [PATCH 3/6] mesa: enable a rich set of drivers for native builds Alexander Kanavin
2023-03-20 17:10   ` [OE-core] " Ross Burton
2023-03-20 17:41     ` Alexander Kanavin
2024-08-02 17:52   ` Marko, Peter
2024-08-03  5:13     ` Böszörményi Zoltán
2023-03-16  9:41 ` [PATCH 4/6] llvm: allow building libllvm in native builds, subject to PACKAGECONFIG Alexander Kanavin
2023-03-20 16:20   ` [OE-core] " Ross Burton
2023-03-20 17:36     ` Alexander Kanavin
2023-03-16  9:41 ` [PATCH 5/6] mesa: do not strip rpaths from dri drivers Alexander Kanavin
2023-03-16  9:41 ` [PATCH 6/6] mesa: update 22.3.5 -> 23.0.0 Alexander Kanavin
2023-03-18  2:47   ` [OE-core] " Khem Raj
2023-03-18  8:01     ` Alexander Kanavin
2023-03-18 18:37       ` Khem Raj
2023-03-18 18:57         ` Martin Jansa
2023-03-20  7:09         ` Alexander Kanavin
2023-03-20 10:01           ` Richard Purdie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230316094102.2628727-1-alex@linutronix.de \
    --to=alex.kanavin@gmail.com \
    --cc=alex@linutronix.de \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox