diff --git a/selfdrive/clearpilot/dashcamd b/selfdrive/clearpilot/dashcamd index 8c325a7..654c3f4 100755 Binary files a/selfdrive/clearpilot/dashcamd and b/selfdrive/clearpilot/dashcamd differ diff --git a/selfdrive/clearpilot/dashcamd.cc b/selfdrive/clearpilot/dashcamd.cc index fb45f8d..e43f437 100644 --- a/selfdrive/clearpilot/dashcamd.cc +++ b/selfdrive/clearpilot/dashcamd.cc @@ -38,7 +38,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -121,6 +123,20 @@ int main(int argc, char *argv[]) { signal(SIGABRT, crash_handler); setpriority(PRIO_PROCESS, 0, -10); + // CLEARPILOT: pin to cores 0-3 (little cluster). Avoids cache/memory-bandwidth + // contention with the RT-pinned processes on the big cluster: + // core 4 = controlsd, core 5 = plannerd/radard, core 7 = modeld. + // OMX offloads actual H.264 work to hardware, so the main thread just copies + // frames and muxes MP4 — fine on the little cluster. + cpu_set_t mask; + CPU_ZERO(&mask); + for (int i = 0; i < 4; i++) CPU_SET(i, &mask); + if (sched_setaffinity(0, sizeof(mask), &mask) != 0) { + LOGW("dashcamd: sched_setaffinity failed (%d), continuing unpinned", errno); + } else { + LOGW("dashcamd: pinned to cores 0-3"); + } + // Ensure base output directory exists mkdir(VIDEOS_BASE.c_str(), 0755);