Loading...
Searching...
No Matches
PacedFramePump.hpp File Reference

Vendor-neutral VBI/clock-paced frame submission. More...

Detailed Description

Vendor-neutral VBI/clock-paced frame submission.

Decouples score's render() (producer) from a card's output clock (consumer). Every capture-card output addon needs the same machinery: a small lock-free SPSC ring the render thread pushes frame pointers into, and a consumer thread that — on each output tick (SDI VBI / ScheduleFrame callback / sync) — pops the most recent frame and submits it to the card. If the producer outruns the clock the ring overflows and the oldest in-flight frame is dropped; if it falls behind, an underrun is counted and the card replays its previous frame.

This is the generalisation of AJA's AJAConsumerThread. The vendor supplies three hooks; everything else (ring, thread lifecycle, drain-to-newest, drop/underrun accounting) lives here once:

  • waitForTick() block until the next output tick; return false on a timeout so the loop can re-check shutdown (it just loops).
  • canAccept() optional card-side back-pressure probe; nullptr => always accept. Returning false drops the frame (counted).
  • submit(ptr) DMA/schedule the frame at ptr; return false on failure.

Pacing order: the pump first waits until at least one frame has been push()ed, and only THEN calls waitForTick(). Consequences vendors can rely on: (a) waitForTick() is never invoked with an empty ring, so a hook that consumes a scarce resource per call (e.g. a free-output-slot permit) never loses it to an idle tick; (b) an always-true waitForTick() does not busy-spin — the pump blocks on frame arrival, not on the hook; (c) if waitForTick() returns false (timeout), the pending frame stays queued and the tick is retried.

The producer must ensure all GPU work filling ptr is complete before push() (the pump does no cross-backend sync — strategies sync inside prepareNextFrame).

ptr is opaque: a GPU device pointer (GPU-direct path) or a pinned host pointer (host-staged path) — the pump never dereferences it.

Go to the source code of this file.

Classes

class  score::gfx::interop::PacedFramePump
 
struct  score::gfx::interop::PacedFramePump::Hooks
 

Namespaces

namespace  score
 Base toolkit upon which the software is built.
 
namespace  score::gfx
 Graphics rendering pipeline for ossia score.