mirror of
https://github.com/bleackstorm/SteamFrame-FPV-Control-Center.git
synced 2026-12-03 07:31:57 +01:00
perf(core): apply code-review optimizations for latency, allocations and concurrency
- LogBuffer: add revision counter and sync only latest 50 entries when revision changes, eliminating ~180k heap string allocations/sec. - Engine: move dome_lut.apply outside of latest_frame lock guard to prevent GStreamer appsink thread contention. - Video: reuse existing Vec buffer in appsink callback, render standby pattern in-place to avoid 3.7MB/frame alloc. - GPUI: remove premature texture drain on idle ticks, spawn background threads for bash/ssh scripts to avoid zombie processes. - Nomad: add NaN guard in deg_to_crsf, track last_send_ok to prevent permanent error state latch, add CRSF packet & CRC8 unit tests. - OpenXR/Engine: enforce Acquire/Release ordering on atomic control flags, join worker thread reliably on stop.
This commit is contained in:
1 parent
0fbe184716
commit
5d81993bbe
6 files changed
+140
-73
No files matched your search
+44
-21
@@ -50,6 +50,7 @@ pub struct SteamFrameGpuiApp {
|
||||
log_entries: Vec<LogEntry>,
|
||||
log_err_count: usize,
|
||||
log_warn_count: usize,
|
||||
last_log_revision: u64,
|
||||
}
|
||||
|
||||
impl SteamFrameGpuiApp {
|
||||
@@ -77,6 +78,7 @@ impl SteamFrameGpuiApp {
|
||||
log_entries: Vec::new(),
|
||||
log_err_count: 0,
|
||||
log_warn_count: 0,
|
||||
last_log_revision: 0,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,11 +118,6 @@ impl SteamFrameGpuiApp {
|
||||
let _ = window.drop_image(old_img);
|
||||
}
|
||||
}
|
||||
} else if !self.images_to_drop.is_empty() {
|
||||
// Si le flux s'interrompt, purger les anciennes textures en attente
|
||||
for old_img in self.images_to_drop.drain(..) {
|
||||
let _ = window.drop_image(old_img);
|
||||
}
|
||||
}
|
||||
|
||||
self.usb_status = mon.usb_video_status.clone();
|
||||
@@ -132,17 +129,28 @@ impl SteamFrameGpuiApp {
|
||||
self.latest_pose = mon.latest_head_pose;
|
||||
self.latest_telem = mon.latest_telemetry.clone();
|
||||
|
||||
// 2. Synchronisation des logs
|
||||
// 2. Synchronisation sélective des logs (uniquement sur nouvelle révision)
|
||||
let lb = self.log_buffer.lock();
|
||||
self.log_err_count = lb.error_count;
|
||||
self.log_warn_count = lb.warn_count;
|
||||
self.log_entries = lb.entries.iter().cloned().collect();
|
||||
if lb.revision != self.last_log_revision {
|
||||
self.last_log_revision = lb.revision;
|
||||
self.log_err_count = lb.error_count;
|
||||
self.log_warn_count = lb.warn_count;
|
||||
self.log_entries = lb.entries.iter().rev().take(50).cloned().collect();
|
||||
}
|
||||
}
|
||||
|
||||
fn run_usb_rndis_setup(&self) {
|
||||
log::info!("[USB RNDIS] Exécution du script de configuration réseau...");
|
||||
let script_path = concat!(env!("CARGO_MANIFEST_DIR"), "/scripts/setup_usb_rndis.sh");
|
||||
let _ = Command::new("bash").arg(script_path).spawn();
|
||||
let script_path = concat!(env!("CARGO_MANIFEST_DIR"), "/scripts/setup_usb_rndis.sh").to_string();
|
||||
std::thread::spawn(move || {
|
||||
match Command::new("bash").arg(&script_path).output() {
|
||||
Ok(out) => {
|
||||
let stdout = String::from_utf8_lossy(&out.stdout);
|
||||
log::info!("[USB RNDIS] Résultat (exit={}) :\n{}", out.status, stdout.trim());
|
||||
}
|
||||
Err(e) => log::error!("[USB RNDIS] Échec d'exécution du script : {}", e),
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
fn configure_radxa_ssh(&self) {
|
||||
@@ -157,16 +165,31 @@ impl SteamFrameGpuiApp {
|
||||
"sed -i 's/^wifi_channel.*/wifi_channel = {ch}/' /etc/wifibroadcast.cfg 2>/dev/null || true; \
|
||||
iw dev wlan0 set channel {ch} HT20 2>/dev/null || true"
|
||||
);
|
||||
let _ = Command::new("ssh")
|
||||
.args([
|
||||
"-o",
|
||||
"ConnectTimeout=2",
|
||||
"-o",
|
||||
"StrictHostKeyChecking=no",
|
||||
&format!("root@{}", ip),
|
||||
&remote_cmd,
|
||||
])
|
||||
.spawn();
|
||||
std::thread::spawn(move || {
|
||||
match Command::new("ssh")
|
||||
.args([
|
||||
"-o",
|
||||
"ConnectTimeout=2",
|
||||
"-o",
|
||||
"StrictHostKeyChecking=no",
|
||||
&format!("root@{}", ip),
|
||||
&remote_cmd,
|
||||
])
|
||||
.output()
|
||||
{
|
||||
Ok(out) if out.status.success() => {
|
||||
log::info!("[Radxa Zero 3W] Canal 5.8GHz configuré avec succès sur {}", ip);
|
||||
}
|
||||
Ok(out) => {
|
||||
log::warn!(
|
||||
"[Radxa Zero 3W] SSH retour exit={} : {}",
|
||||
out.status,
|
||||
String::from_utf8_lossy(&out.stderr).trim()
|
||||
);
|
||||
}
|
||||
Err(e) => log::error!("[Radxa Zero 3W] Échec commande SSH : {}", e),
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
fn test_nomad_packet(&self) {
|
||||
|
||||
Reference in new issue
Block a user