mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-20 07:43:48 +08:00
Double trouble
This commit is contained in:
@@ -63,6 +63,10 @@ RECORD_BITRATE = os.getenv("RECORD_BITRATE", "") # Target bitrate e.g. "2000k"
|
||||
RECORD_SPEED = int(os.getenv("RECORD_SPEED", "1")) # Speed multiplier
|
||||
OFFSCREEN = os.getenv("OFFSCREEN") == "1" # Disable FPS limiting for fast offline rendering
|
||||
|
||||
|
||||
def _raylib_target_fps(fps: int) -> int:
|
||||
return 0 if OFFSCREEN or DEVICE_TYPE == "mici" else fps
|
||||
|
||||
GL_VERSION = """
|
||||
#version 300 es
|
||||
precision highp float;
|
||||
@@ -557,7 +561,7 @@ class GuiApplication:
|
||||
fps = max(1, int(fps))
|
||||
if fps == self._target_fps:
|
||||
return
|
||||
rl.set_target_fps(0 if OFFSCREEN else fps)
|
||||
rl.set_target_fps(_raylib_target_fps(fps))
|
||||
self._target_fps = fps
|
||||
|
||||
def configure_adaptive_rendering(self, enabled: bool, idle_fps: int | None = None) -> None:
|
||||
@@ -667,8 +671,7 @@ class GuiApplication:
|
||||
self._ffmpeg_thread = threading.Thread(target=self._ffmpeg_writer_thread, daemon=True)
|
||||
self._ffmpeg_thread.start()
|
||||
|
||||
# OFFSCREEN disables FPS limiting for fast offline rendering (e.g. clips)
|
||||
rl.set_target_fps(0 if OFFSCREEN else fps)
|
||||
rl.set_target_fps(_raylib_target_fps(fps))
|
||||
|
||||
self._full_target_fps = fps
|
||||
self._target_fps = fps
|
||||
|
||||
@@ -1,6 +1,27 @@
|
||||
from openpilot.system.ui.lib import application
|
||||
|
||||
|
||||
def test_raylib_target_fps_uses_mici_display_vblank(monkeypatch):
|
||||
monkeypatch.setattr(application, "OFFSCREEN", False)
|
||||
monkeypatch.setattr(application, "DEVICE_TYPE", "mici")
|
||||
|
||||
assert application._raylib_target_fps(60) == 0
|
||||
|
||||
|
||||
def test_raylib_target_fps_limits_other_devices(monkeypatch):
|
||||
monkeypatch.setattr(application, "OFFSCREEN", False)
|
||||
monkeypatch.setattr(application, "DEVICE_TYPE", "tici")
|
||||
|
||||
assert application._raylib_target_fps(60) == 60
|
||||
|
||||
|
||||
def test_raylib_target_fps_disables_limit_for_offscreen(monkeypatch):
|
||||
monkeypatch.setattr(application, "OFFSCREEN", True)
|
||||
monkeypatch.setattr(application, "DEVICE_TYPE", "tici")
|
||||
|
||||
assert application._raylib_target_fps(60) == 0
|
||||
|
||||
|
||||
def test_burn_in_shift_transitions_between_positions(monkeypatch):
|
||||
app = object.__new__(application.GuiApplication)
|
||||
app._burn_in_start_time = 100.0
|
||||
|
||||
Reference in New Issue
Block a user