allow onscreen cpu rendering (#30510)

* spinner POC cpu

* should be single threaded

* how tf did that get added

* allow non offscreen

---------

Co-authored-by: Comma Device <device@comma.ai>
old-commit-hash: 7f14bdfb22d25abed6af275c4006461bcceb5f99
This commit is contained in:
Justin Newberry
2023-11-22 12:44:32 -08:00
committed by GitHub
parent 872b9cc6e9
commit 0c43599b93
4 changed files with 10 additions and 6 deletions
+1 -1
View File
@@ -11,7 +11,7 @@
#include "system/hardware/hw.h"
int main(int argc, char *argv[]) {
Hardware::config_cpu_rendering();
Hardware::config_cpu_rendering(true);
qInstallMessageHandler(swagLogMessageHandler);
setpriority(PRIO_PROCESS, 0, -20);
+1 -1
View File
@@ -34,7 +34,7 @@ public:
static bool get_ssh_enabled() { return false; }
static void set_ssh_enabled(bool enabled) {}
static void config_cpu_rendering();
static void config_cpu_rendering(bool offscreen);
static bool PC() { return false; }
static bool TICI() { return false; }
+4 -2
View File
@@ -21,8 +21,10 @@ public:
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);
static void config_cpu_rendering(bool offscreen) {
if (offscreen) {
setenv("QT_QPA_PLATFORM", "offscreen", 1);
}
setenv("__GLX_VENDOR_LIBRARY_NAME", "mesa", 1);
setenv("LP_NUM_THREADS", "0", 1); // disable threading so we stay on our assigned CPU
}
+4 -2
View File
@@ -104,8 +104,10 @@ 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
static void config_cpu_rendering(bool offscreen) {
if (offscreen) {
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
}
};