Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RP1 DPI: interlaced HSync/VSync alignment (6.12) #6695

Open
wants to merge 1 commit into
base: rpi-6.12.y
Choose a base branch
from

Conversation

njhollinghurst
Copy link
Contributor

@njhollinghurst njhollinghurst commented Feb 28, 2025

Instead of trying to minimize the HSync -> VSync lag, count cycles to predict the next HSync.

It reduces the HSync->VSync offset from about (+30ns .. +35ns), to about (-5ns .. +10ns). There is some mode-dependent rounding error, but for a given video mode the jitter is ~5ns as before.

This is mainly for the benefit of SCART Hats, particularly those that use an XNOR gate to generate Composite Sync, which otherwise could produce glitchier output when used in an interlaced mode with Raspberry Pi 5.

A fringe benefit is that 6 PIO instructions are now free (enough for some RGB LEDs but not for PWM...)

Instead of trying to minimize the delay between seeing HSYNC edge
and asserting VSYNC, try to predict the next HSYNC edge precisely.
This eliminates the round-trip delay but introduces mode-dependent
rounding error. HSYNC->VSYNC lag reduced from ~30ns to -5ns..+10ns
(plus up to 5ns synchronization jitter as before).

This may benefit e.g. SCART HATs, particularly those that generate
Composite Sync using a XNOR gate.

Signed-off-by: Nick Hollinghurst <[email protected]>
@njhollinghurst njhollinghurst marked this pull request as ready for review March 3, 2025 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant