Mapsd: move on the CPU (#30349)

* mapsd -> cpu

* link directly to mesa

* Fix gitignore

* without launcher script

* dont change that

* dont need that

* add to files_common

* rename to configure cpu rendering

* without a symlink!

* update time refs

* update ref

* update ref

* remove duplicate include

* bump up again

---------

Co-authored-by: Comma Device <device@comma.ai>
old-commit-hash: bdf2fa0f83
testing-closet
Justin Newberry 1 year ago committed by GitHub
parent 7587e8a44f
commit 40757d9d01
  1. 2
      selfdrive/navd/SConscript
  2. 5
      selfdrive/navd/main.cc
  3. 27
      selfdrive/navd/tests/test_map_renderer.py
  4. 2
      selfdrive/test/process_replay/model_replay_ref_commit
  5. 4
      selfdrive/test/test_onroad.py
  6. 2
      system/hardware/base.h
  7. 5
      system/hardware/pc/hardware.h
  8. 5
      system/hardware/tici/hardware.h

@ -4,7 +4,7 @@ map_env = qt_env.Clone()
libs = ['qt_widgets', 'qt_util', 'qmapboxgl', common, messaging, cereal, visionipc, transformations,
'zmq', 'capnp', 'kj', 'm', 'OpenCL', 'ssl', 'crypto', 'pthread', 'json11'] + map_env["LIBS"]
if arch == 'larch64':
libs.append('EGL')
libs.append(':libEGL_mesa.so.0')
if arch in ['larch64', 'aarch64', 'x86_64']:
if arch == 'x86_64':

@ -4,14 +4,19 @@
#include <QApplication>
#include <QDebug>
#include "common/util.h"
#include "selfdrive/ui/qt/util.h"
#include "selfdrive/ui/qt/maps/map_helpers.h"
#include "selfdrive/navd/map_renderer.h"
#include "system/hardware/hw.h"
int main(int argc, char *argv[]) {
Hardware::config_cpu_rendering();
qInstallMessageHandler(swagLogMessageHandler);
setpriority(PRIO_PROCESS, 0, -20);
int ret = util::set_core_affinity({0, 1, 2, 3});
assert(ret == 0);
QApplication app(argc, argv);
std::signal(SIGINT, sigTermHandler);

@ -34,19 +34,12 @@ def gen_llk(location=LOCATION1):
class MapBoxInternetDisabledRequestHandler(http.server.BaseHTTPRequestHandler):
INTERNET_ACTIVE = True
def setup(self):
if self.INTERNET_ACTIVE:
super().setup()
def handle(self):
if self.INTERNET_ACTIVE:
super().handle()
def finish(self):
if self.INTERNET_ACTIVE:
super().finish()
def do_GET(self):
if not self.INTERNET_ACTIVE:
self.send_response(500)
self.end_headers()
return
url = f'https://api.mapbox.com{self.path}'
headers = dict(self.headers)
@ -218,12 +211,12 @@ class TestMapRenderer(unittest.TestCase):
tol = (nominal / (1+tol)), (nominal * (1+tol))
self.assertTrue(tol[0] < stat < tol[1], f"{stat} not in tolerance {tol}")
assert_stat(_mean, 0.0035)
assert_stat(_median, 0.0034)
assert_stat(_stddev, 0.00093, tol=0.5)
assert_stat(_mean, 0.030)
assert_stat(_median, 0.027)
assert_stat(_stddev, 0.0078)
self.assertLess(_max, 0.2)
self.assertGreater(_min, 0.0010)
self.assertLess(_max, 0.065)
self.assertGreater(_min, 0.015)
if __name__ == "__main__":

@ -1 +1 @@
eec02217169e6f5d71b8a376368ea96e83b10e4a
ca18755cd1a1bc28c06e85a280d79d7e48a8438c

@ -33,7 +33,7 @@ PROCS = {
"./encoderd": 17.0,
"./camerad": 14.5,
"./locationd": 11.0,
"./mapsd": 2.0,
"./mapsd": 1.5,
"selfdrive.controls.plannerd": 16.5,
"./_ui": 18.0,
"selfdrive.locationd.paramsd": 9.0,
@ -301,7 +301,7 @@ class TestOnroad(unittest.TestCase):
self.assertLessEqual(max(mems) - min(mems), 3.0)
def test_gpu_usage(self):
self.assertEqual(self.gpu_procs, {"weston", "_ui", "mapsd", "camerad", "selfdrive.modeld.modeld"})
self.assertEqual(self.gpu_procs, {"weston", "_ui", "camerad", "selfdrive.modeld.modeld"})
def test_camera_processing_time(self):
result = "\n"

@ -34,6 +34,8 @@ public:
static bool get_ssh_enabled() { return false; }
static void set_ssh_enabled(bool enabled) {}
static void config_cpu_rendering();
static bool PC() { return false; }
static bool TICI() { return false; }
static bool AGNOS() { return false; }

@ -20,4 +20,9 @@ public:
snprintf(volume_str, sizeof(volume_str), "%.3f", volume);
std::system(("pactl set-sink-volume @DEFAULT_SINK@ " + std::string(volume_str)).c_str());
}
static void config_cpu_rendering() {
setenv("QT_QPA_PLATFORM", "offscreen", 1);
setenv("__GLX_VENDOR_LIBRARY_NAME", "mesa", 1);
}
};

@ -103,4 +103,9 @@ public:
static bool get_ssh_enabled() { return Params().getBool("SshEnabled"); }
static void set_ssh_enabled(bool enabled) { Params().putBool("SshEnabled", enabled); }
static void config_cpu_rendering() {
setenv("QT_QPA_PLATFORM", "eglfs", 1); // offscreen doesn't work with EGL/GLES
setenv("LP_NUM_THREADS", "0", 1); // disable threading so we stay on our assigned CPU
}
};

Loading…
Cancel
Save