Files
parallel-gx1/Source/Core/Common/FrameClock.h
T
LibretroAdmin 1e2dbf6616 Remove all sleeping and wall-clock pacing from the core
retro_run runs one video frame and the frontend paces it, so the core no
longer paces itself:

- The speed limiter is gone: CoreTiming::Throttle and its host-time
  targets, VI skip, the presenter's presentation-time wait,
  PrecisionTimer, PerformanceMetrics/PerformanceTracker, and the
  emulation speed, precision timing, rush/smooth presentation and VI
  skip settings and core options. The Dolphin IOS device reports 100%
  and ignores speed limits a guest asks for.
- Common/FrameClock.c (C89) counts retro_run calls. Background threads
  that acted every so many milliseconds wait for a number of frames
  instead: real-Wiimote pool upkeep, scanning, write tests and
  reconnect retries, USB scanning, the USB Gecko and GBA link
  listeners, the BBA read thread, memory card flushing and the WC24
  scheduler. Shutdown wakes every waiter.
- Waits that polled or timed out now block until signalled: dual-core
  boot, PauseAndLock in the GPU loop, CPU thread jobs, shader
  compilation progress, BlockingLoop and ParallelFor setup and
  teardown.
- Bluetooth passthrough submits transfers straight to libusb; the
  output worker and its timed sleep are deleted, HCI command timeouts
  count emulated time, and blocking firmware commands wait for the
  adapter's events.
- Real Wiimote reports go out when produced; delayed ones carry a
  frame number.
- Common::Flag sits on retro_atomic.
- Deleted: SleepCurrentThread, YieldCPU, Common::SleepUntil,
  Event::WaitFor, BlockingLoop::WaitYield, timer resolution changes,
  the play-time tracker, Host_YieldToUI, FrameTiming::ThrottleFrame
  leftovers and the never-used DO_WAIT_FOR_WIIMOTES mode.
2026-11-05 22:05:03 +01:00

46 lines
1.4 KiB
C

/* Copyright 2026 Dolphin Emulator Project
* SPDX-License-Identifier: GPL-2.0-or-later */
#ifndef DOLPHIN_COMMON_FRAMECLOCK_H
#define DOLPHIN_COMMON_FRAMECLOCK_H
#include <boolean.h>
#include <stdint.h>
#include <retro_atomic.h>
#ifdef __cplusplus
extern "C" {
#endif
/* The core's only timebase outside emulated time: the count of
* retro_run calls. Background threads that used to act every so many
* milliseconds wait for a number of frames instead, so they run at
* the frontend's pace, stop while it pauses, and never sleep or read a
* clock. */
/* Called once per retro_run, by the frontend's thread. */
void frame_clock_advance(void);
uint64_t frame_clock_now(void);
/* Blocks until frame target has begun or *running reads zero. running
* may be NULL. Returns false when no longer running. Whoever clears
* *running calls frame_clock_wake_all afterwards. */
bool frame_clock_wait_until(uint64_t target, const retro_atomic_int_t *running);
/* Wakes every waiter to look at its running flag again. */
void frame_clock_wake_all(void);
/* For a wait on frames and something else at once: the other thing's
* producer calls frame_clock_wake_all. Same protocol as
* retro_eventcount: prepare, check, then cancel or commit. */
int frame_clock_prepare_wait(void);
void frame_clock_cancel_wait(void);
void frame_clock_commit_wait(int key);
#ifdef __cplusplus
}
#endif
#endif