Skip to content

R8: dither state advances on frame attempt, not presentation, and dropped frames consume a phase #4347

Closed

Description

@zackees

docs/color-pipeline-contracts.md, dither cadence:

Dither accuracy is based on time-weighted emitted XYZ over a declared cadence and observation window... State advances on presentation according to the documented driver contract, with explicit tests for dropped submissions and irregular dwell.

This is an implementation requirement, and it is unmet. Stating that plainly because I got the framing wrong twice recently: the addendum is a requirements list, not a description, so this is "requirement not yet met, here is the exposure", not "the doc is wrong".

Where the state advances

detail::advanceDitherFrame() is called from EngineEvents::onBeginFrame() — at the start of a frame, before encode, before enqueue, before anything reaches a driver.

Measured

A channel whose frame is not presented (driver enqueue suppressed):

value
ditherFrame() before 25
after onBeginFrame() 26 — advanced
frames actually enqueued 0 — nothing presented

So a frame that never reaches the wire still consumes a dither phase.

Why it matters, and how much

Binary dither is an 8-frame cycle whose correctness is an average over the cycle: each phase must be displayed equally often for the time-weighted mean to land on the intended sub-LSB value. Drops that correlate with phase — a driver busy on a regular cadence, a channel disabled for part of a sequence, an irregular frame rate — make some phases render more often than others.

The bias is bounded by the dither amplitude itself, which is about one output LSB per channel (e[i] = 256/s + 1 before scaling, d[i] <= e[i]). That is the same order as the correction dither exists to apply, so a systematically phase-correlated drop pattern can cancel or invert the benefit rather than merely degrading it.

Uncorrelated drops average out and cost nothing but noise. The exposure is entirely about whether drops correlate with phase, and nothing currently observes that.

What is missing

Both halves of the sentence:

  • state advancing on presentation rather than attempt
  • "explicit tests for dropped submissions and irregular dwell" — there are none; this is the first measurement of the behaviour

The second is cheaper than the first and worth having regardless of when the first lands, since it pins what the current behaviour is.

Why not fixed here

Advancing on presentation means the counter cannot live in onBeginFrame(). It needs either per-channel dither state advanced when a submission lands, or a presentation callback the drivers honour — both architecture changes with a throughput cost, and P8's dithering deliverable will move this ground anyway. That is a decision, not a patch.

Related: #4342 (the power estimate is taken pre-dither), which is the other place dither and a contract disagree.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MLhWkMfzLjrnLTDMBE6Fj9

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions