mirror of
https://github.com/DeeJanuz/frametop.git
synced 2026-10-06 01:00:06 +02:00
Gaze: the hidden panel waits for a command instead of waking every 50 ms
The calibration panel runs for as long as the gaze service does, hidden nearly all the time, and it woke 20 to 30 times a second to look at its socket and SteamVR's events: about 0.9% of a core, the main cost left with gaze idle. It now waits in poll() on its command socket: up to a second while hidden, and up to 10 ms while shown, as before (it still drains SteamVR's events each pass, so a quit is acknowledged within a second while hidden). A command wakes it at once, so "show" draws sooner than before. With --watch-stdin, its stdin closing wakes it as well, so stopping it doesn't wait. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
95c5d056cf
commit
e44837cee6
1 file changed
+6
-1
@@ -47,6 +47,7 @@
|
||||
#include <drm_fourcc.h>
|
||||
#include <fcntl.h>
|
||||
#include <gbm.h>
|
||||
#include <poll.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#include <unistd.h>
|
||||
@@ -524,7 +525,11 @@ int main(int argc, char **argv) {
|
||||
if (!shown) ov->ShowOverlay(h), shown = true;
|
||||
dirty = false;
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(visible ? 10 : 50));
|
||||
// Until a command comes, or 10 ms while shown (SteamVR's events). Hidden, it waits up to a
|
||||
// second: it woke 20 to 30 times a second for nothing, the main cost left with gaze idle.
|
||||
// A closed stdin (--watch-stdin) wakes it too, so quitting doesn't wait.
|
||||
pollfd fds[2] = {{sock, POLLIN, 0}, {0, POLLIN, 0}};
|
||||
poll(fds, watchStdin ? 2 : 1, visible ? 10 : 1000);
|
||||
}
|
||||
ov->DestroyOverlay(h);
|
||||
buffers.Drop();
|
||||
|
||||
Reference in new issue
Block a user