diff --git a/common/libcommon.a b/common/libcommon.a index c19133a7..26cf3ca2 100644 Binary files a/common/libcommon.a and b/common/libcommon.a differ diff --git a/common/watchdog.cc b/common/watchdog.cc index 44e8c83e..09a8d88e 100644 --- a/common/watchdog.cc +++ b/common/watchdog.cc @@ -8,5 +8,5 @@ const std::string watchdog_fn_prefix = Path::shm_path() + "/wd_"; // + bool watchdog_kick(uint64_t ts) { static std::string fn = watchdog_fn_prefix + std::to_string(getpid()); - return util::write_file(fn.c_str(), &ts, sizeof(ts), O_WRONLY | O_CREAT) > 0; + return util::write_file(fn.c_str(), &ts, sizeof(ts), O_WRONLY | O_CREAT) == 0; } diff --git a/panda/board/obj/body_h7.bin.signed b/panda/board/obj/body_h7.bin.signed index 00b64394..56ef0889 100644 Binary files a/panda/board/obj/body_h7.bin.signed and b/panda/board/obj/body_h7.bin.signed differ diff --git a/panda/board/obj/body_h7/bootstub.elf b/panda/board/obj/body_h7/bootstub.elf index 4b825b85..b0b86da1 100755 Binary files a/panda/board/obj/body_h7/bootstub.elf and b/panda/board/obj/body_h7/bootstub.elf differ diff --git a/panda/board/obj/body_h7/main.bin b/panda/board/obj/body_h7/main.bin index b1143d3b..28de00ec 100755 Binary files a/panda/board/obj/body_h7/main.bin and b/panda/board/obj/body_h7/main.bin differ diff --git a/panda/board/obj/body_h7/main.elf b/panda/board/obj/body_h7/main.elf index 0a8a6309..8585b244 100755 Binary files a/panda/board/obj/body_h7/main.elf and b/panda/board/obj/body_h7/main.elf differ diff --git a/panda/board/obj/bootstub.body_h7.bin b/panda/board/obj/bootstub.body_h7.bin index 27fca965..926cbbe4 100755 Binary files a/panda/board/obj/bootstub.body_h7.bin and b/panda/board/obj/bootstub.body_h7.bin differ diff --git a/panda/board/obj/bootstub.panda.bin b/panda/board/obj/bootstub.panda.bin index 727efc64..5189d04a 100755 Binary files a/panda/board/obj/bootstub.panda.bin and b/panda/board/obj/bootstub.panda.bin differ diff --git a/panda/board/obj/bootstub.panda_h7.bin b/panda/board/obj/bootstub.panda_h7.bin index a3d0184a..32a7acc2 100755 Binary files a/panda/board/obj/bootstub.panda_h7.bin and b/panda/board/obj/bootstub.panda_h7.bin differ diff --git a/panda/board/obj/bootstub.panda_h7_remote.bin b/panda/board/obj/bootstub.panda_h7_remote.bin index a3d0184a..32a7acc2 100755 Binary files a/panda/board/obj/bootstub.panda_h7_remote.bin and b/panda/board/obj/bootstub.panda_h7_remote.bin differ diff --git a/panda/board/obj/bootstub.panda_jungle_h7.bin b/panda/board/obj/bootstub.panda_jungle_h7.bin index c50d1d11..ec86303c 100755 Binary files a/panda/board/obj/bootstub.panda_jungle_h7.bin and b/panda/board/obj/bootstub.panda_jungle_h7.bin differ diff --git a/panda/board/obj/bootstub.panda_remote.bin b/panda/board/obj/bootstub.panda_remote.bin index 727efc64..5189d04a 100755 Binary files a/panda/board/obj/bootstub.panda_remote.bin and b/panda/board/obj/bootstub.panda_remote.bin differ diff --git a/panda/board/obj/gitversion.h b/panda/board/obj/gitversion.h index 0c2869e8..d9951076 100644 --- a/panda/board/obj/gitversion.h +++ b/panda/board/obj/gitversion.h @@ -1,2 +1,2 @@ extern const uint8_t gitversion[19]; -const uint8_t gitversion[19] = "DEV-4b5ec507-DEBUG"; +const uint8_t gitversion[19] = "DEV-96ce4808-DEBUG"; diff --git a/panda/board/obj/panda.bin.signed b/panda/board/obj/panda.bin.signed index ac55238f..ac4665d0 100644 Binary files a/panda/board/obj/panda.bin.signed and b/panda/board/obj/panda.bin.signed differ diff --git a/panda/board/obj/panda/bootstub.elf b/panda/board/obj/panda/bootstub.elf index aa2304a5..8be03172 100755 Binary files a/panda/board/obj/panda/bootstub.elf and b/panda/board/obj/panda/bootstub.elf differ diff --git a/panda/board/obj/panda/main.bin b/panda/board/obj/panda/main.bin index 1daeb011..c9ae65de 100755 Binary files a/panda/board/obj/panda/main.bin and b/panda/board/obj/panda/main.bin differ diff --git a/panda/board/obj/panda/main.elf b/panda/board/obj/panda/main.elf index 1d35cc68..7219dcdc 100755 Binary files a/panda/board/obj/panda/main.elf and b/panda/board/obj/panda/main.elf differ diff --git a/panda/board/obj/panda_h7.bin.signed b/panda/board/obj/panda_h7.bin.signed index d72491e9..7186741d 100644 Binary files a/panda/board/obj/panda_h7.bin.signed and b/panda/board/obj/panda_h7.bin.signed differ diff --git a/panda/board/obj/panda_h7/bootstub.elf b/panda/board/obj/panda_h7/bootstub.elf index 7f9384b5..77baaebd 100755 Binary files a/panda/board/obj/panda_h7/bootstub.elf and b/panda/board/obj/panda_h7/bootstub.elf differ diff --git a/panda/board/obj/panda_h7/main.bin b/panda/board/obj/panda_h7/main.bin index 6524e66d..423b361a 100755 Binary files a/panda/board/obj/panda_h7/main.bin and b/panda/board/obj/panda_h7/main.bin differ diff --git a/panda/board/obj/panda_h7/main.elf b/panda/board/obj/panda_h7/main.elf index 3d8ef7fb..a6b83781 100755 Binary files a/panda/board/obj/panda_h7/main.elf and b/panda/board/obj/panda_h7/main.elf differ diff --git a/panda/board/obj/panda_h7_remote.bin.signed b/panda/board/obj/panda_h7_remote.bin.signed index 28654fea..c8e78265 100644 Binary files a/panda/board/obj/panda_h7_remote.bin.signed and b/panda/board/obj/panda_h7_remote.bin.signed differ diff --git a/panda/board/obj/panda_h7_remote/bootstub.elf b/panda/board/obj/panda_h7_remote/bootstub.elf index ff5b504c..193ac75d 100755 Binary files a/panda/board/obj/panda_h7_remote/bootstub.elf and b/panda/board/obj/panda_h7_remote/bootstub.elf differ diff --git a/panda/board/obj/panda_h7_remote/main.bin b/panda/board/obj/panda_h7_remote/main.bin index 0b0e339a..c3195075 100755 Binary files a/panda/board/obj/panda_h7_remote/main.bin and b/panda/board/obj/panda_h7_remote/main.bin differ diff --git a/panda/board/obj/panda_h7_remote/main.elf b/panda/board/obj/panda_h7_remote/main.elf index 6ee53777..82e427fa 100755 Binary files a/panda/board/obj/panda_h7_remote/main.elf and b/panda/board/obj/panda_h7_remote/main.elf differ diff --git a/panda/board/obj/panda_jungle_h7.bin.signed b/panda/board/obj/panda_jungle_h7.bin.signed index 9a8b5c54..0bcd309e 100644 Binary files a/panda/board/obj/panda_jungle_h7.bin.signed and b/panda/board/obj/panda_jungle_h7.bin.signed differ diff --git a/panda/board/obj/panda_jungle_h7/bootstub.elf b/panda/board/obj/panda_jungle_h7/bootstub.elf index 7bcb99e9..151ff4de 100755 Binary files a/panda/board/obj/panda_jungle_h7/bootstub.elf and b/panda/board/obj/panda_jungle_h7/bootstub.elf differ diff --git a/panda/board/obj/panda_jungle_h7/main.bin b/panda/board/obj/panda_jungle_h7/main.bin index 49c3c263..c5c69bfc 100755 Binary files a/panda/board/obj/panda_jungle_h7/main.bin and b/panda/board/obj/panda_jungle_h7/main.bin differ diff --git a/panda/board/obj/panda_jungle_h7/main.elf b/panda/board/obj/panda_jungle_h7/main.elf index 061720d0..6251efe8 100755 Binary files a/panda/board/obj/panda_jungle_h7/main.elf and b/panda/board/obj/panda_jungle_h7/main.elf differ diff --git a/panda/board/obj/panda_remote.bin.signed b/panda/board/obj/panda_remote.bin.signed index 4e9d3318..83a687ba 100644 Binary files a/panda/board/obj/panda_remote.bin.signed and b/panda/board/obj/panda_remote.bin.signed differ diff --git a/panda/board/obj/panda_remote/bootstub.elf b/panda/board/obj/panda_remote/bootstub.elf index d2de86dd..cd1c97fe 100755 Binary files a/panda/board/obj/panda_remote/bootstub.elf and b/panda/board/obj/panda_remote/bootstub.elf differ diff --git a/panda/board/obj/panda_remote/main.bin b/panda/board/obj/panda_remote/main.bin index 70373a26..7cc612bf 100755 Binary files a/panda/board/obj/panda_remote/main.bin and b/panda/board/obj/panda_remote/main.bin differ diff --git a/panda/board/obj/panda_remote/main.elf b/panda/board/obj/panda_remote/main.elf index c38d47a1..81a879af 100755 Binary files a/panda/board/obj/panda_remote/main.elf and b/panda/board/obj/panda_remote/main.elf differ diff --git a/panda/board/obj/version b/panda/board/obj/version index d1ae0651..ab4b4465 100644 --- a/panda/board/obj/version +++ b/panda/board/obj/version @@ -1 +1 @@ -DEV-4b5ec507-DEBUG \ No newline at end of file +DEV-96ce4808-DEBUG \ No newline at end of file diff --git a/selfdrive/ui/qt/window.cc b/selfdrive/ui/qt/window.cc index ccc63d54..9a6767d3 100644 --- a/selfdrive/ui/qt/window.cc +++ b/selfdrive/ui/qt/window.cc @@ -13,17 +13,6 @@ MainWindow::MainWindow(QWidget *parent) : QWidget(parent) { QObject::connect(homeWindow, &HomeWindow::openSettings, this, &MainWindow::openSettings); QObject::connect(homeWindow, &HomeWindow::closeSettings, this, &MainWindow::closeSettings); - settingsWindow = new SettingsWindow(this); - main_layout->addWidget(settingsWindow); - QObject::connect(settingsWindow, &SettingsWindow::closeSettings, this, &MainWindow::closeSettings); - QObject::connect(settingsWindow, &SettingsWindow::reviewTrainingGuide, [=]() { - onboardingWindow->showTrainingGuide(); - main_layout->setCurrentWidget(onboardingWindow); - }); - QObject::connect(settingsWindow, &SettingsWindow::showDriverView, [=] { - homeWindow->showDriverView(true); - }); - onboardingWindow = new OnboardingWindow(this); main_layout->addWidget(onboardingWindow); QObject::connect(onboardingWindow, &OnboardingWindow::onboardingDone, [=]() { @@ -39,7 +28,7 @@ MainWindow::MainWindow(QWidget *parent) : QWidget(parent) { } }); QObject::connect(device(), &Device::interactiveTimeout, [=]() { - if (main_layout->currentWidget() == settingsWindow) { + if (settingsWindow != nullptr && main_layout->currentWidget() == settingsWindow) { closeSettings(); } }); @@ -65,7 +54,25 @@ MainWindow::MainWindow(QWidget *parent) : QWidget(parent) { setAttribute(Qt::WA_NoSystemBackground); } +void MainWindow::ensureSettingsWindow() { + if (settingsWindow != nullptr) { + return; + } + + settingsWindow = new SettingsWindow(this); + main_layout->insertWidget(1, settingsWindow); + QObject::connect(settingsWindow, &SettingsWindow::closeSettings, this, &MainWindow::closeSettings); + QObject::connect(settingsWindow, &SettingsWindow::reviewTrainingGuide, [=]() { + onboardingWindow->showTrainingGuide(); + main_layout->setCurrentWidget(onboardingWindow); + }); + QObject::connect(settingsWindow, &SettingsWindow::showDriverView, [=] { + homeWindow->showDriverView(true); + }); +} + void MainWindow::openSettings(int index, const QString ¶m) { + ensureSettingsWindow(); main_layout->setCurrentWidget(settingsWindow); settingsWindow->setCurrentPanel(index, param); } diff --git a/selfdrive/ui/qt/window.h b/selfdrive/ui/qt/window.h index 88f4b241..762f2ca5 100644 --- a/selfdrive/ui/qt/window.h +++ b/selfdrive/ui/qt/window.h @@ -15,12 +15,13 @@ public: private: bool eventFilter(QObject *obj, QEvent *event) override; + void ensureSettingsWindow(); void openSettings(int index = 0, const QString ¶m = ""); void closeSettings(); QStackedLayout *main_layout; HomeWindow *homeWindow; - SettingsWindow *settingsWindow; + SettingsWindow *settingsWindow = nullptr; OnboardingWindow *onboardingWindow; Params params; diff --git a/selfdrive/ui/stall_monitor.py b/selfdrive/ui/stall_monitor.py index 0e9ced8c..d53f2d2a 100644 --- a/selfdrive/ui/stall_monitor.py +++ b/selfdrive/ui/stall_monitor.py @@ -3,6 +3,7 @@ import sys import time import traceback import threading +from collections import deque from pathlib import Path from openpilot.common.swaglog import cloudlog @@ -32,6 +33,8 @@ class UIStallMonitor: self._stalled_phase = self._phase self._lock = threading.Lock() + self._history = deque(maxlen=max(1, int(os.getenv("UI_STALL_HISTORY_LEN", "64")))) + self._history.append((now, self._phase)) self._stop_event = threading.Event() self._thread = threading.Thread(target=self._run, name=f"{name}_stall_probe", daemon=True) @@ -54,6 +57,7 @@ class UIStallMonitor: if phase != self._phase: self._phase = phase self._phase_entered = now + self._history.append((now, phase)) self._last_progress = now if self._stall_reported: @@ -101,6 +105,15 @@ class UIStallMonitor: "", ] + with self._lock: + history = list(self._history) + + lines.append("Recent phase transitions:") + for ts, phase_name in history: + age_s = now - ts + lines.append(f" - {ts:.6f} ({age_s:.3f}s ago) {phase_name}") + lines.append("") + ordered_idents = sorted(frames.keys(), key=lambda ident: ident != self._main_thread_id) for ident in ordered_idents: thread = threads.get(ident) diff --git a/selfdrive/ui/ui b/selfdrive/ui/ui index bd6617d9..349ef058 100755 Binary files a/selfdrive/ui/ui and b/selfdrive/ui/ui differ diff --git a/system/ui/lib/application.py b/system/ui/lib/application.py index 90ec25a8..bb3c6c91 100644 --- a/system/ui/lib/application.py +++ b/system/ui/lib/application.py @@ -569,13 +569,19 @@ class GuiApplication: continue if self._render_texture: - self._mark_progress("gui_app.begin_texture_mode") + self._mark_progress("gui_app.before_begin_texture_mode") rl.begin_texture_mode(self._render_texture) + self._mark_progress("gui_app.after_begin_texture_mode") + self._mark_progress("gui_app.before_clear_background") rl.clear_background(rl.BLACK) + self._mark_progress("gui_app.after_clear_background") else: - self._mark_progress("gui_app.begin_drawing") + self._mark_progress("gui_app.before_begin_drawing") rl.begin_drawing() + self._mark_progress("gui_app.after_begin_drawing") + self._mark_progress("gui_app.before_clear_background") rl.clear_background(rl.BLACK) + self._mark_progress("gui_app.after_clear_background") # Handle modal overlay rendering and input processing if self._render_nav_stack(): @@ -594,19 +600,24 @@ class GuiApplication: if self._render_texture: self._mark_progress("gui_app.end_texture_mode") rl.end_texture_mode() - self._mark_progress("gui_app.begin_present") + self._mark_progress("gui_app.before_present_begin_drawing") rl.begin_drawing() + self._mark_progress("gui_app.after_present_begin_drawing") + self._mark_progress("gui_app.before_present_clear_background") rl.clear_background(rl.BLACK) + self._mark_progress("gui_app.after_present_clear_background") src_rect = rl.Rectangle(0, 0, float(self._width), -float(self._height)) dst_rect = rl.Rectangle(0, 0, float(self._scaled_width), float(self._scaled_height)) texture = self._render_texture.texture if texture: + self._mark_progress("gui_app.before_present_draw_texture") if BURN_IN_MODE and self._burn_in_shader: rl.begin_shader_mode(self._burn_in_shader) rl.draw_texture_pro(texture, src_rect, dst_rect, rl.Vector2(0, 0), 0.0, rl.WHITE) rl.end_shader_mode() else: rl.draw_texture_pro(texture, src_rect, dst_rect, rl.Vector2(0, 0), 0.0, rl.WHITE) + self._mark_progress("gui_app.after_present_draw_texture") if self._show_fps: rl.draw_fps(10, 10)