Skip to content

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

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

Merged

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
@njhollinghurst njhollinghurst merged commit 804c013 into raspberrypi:rpi-6.12.y Mar 4, 2025
12 checks passed
popcornmix added a commit to raspberrypi/firmware that referenced this pull request Mar 5, 2025
See: raspberrypi/linux#6689

kernel: Revert "firmware: raspberrypi: Add backward compatible get_throttled"
See: raspberrypi/linux#6697

kernel: RP1 DPI: interlaced HSync/VSync alignment (6.12)
See: raspberrypi/linux#6695

kernel: dtoverlays: ov9281: Add continuous clock option as an override
See: raspberrypi/linux#6700

kernel: Fix clang compilation error for rpi5
See: raspberrypi/linux#6699

kernel: drm/vc4: Correct one logging message that got promoted from dbg to err
See: raspberrypi/linux#6702
popcornmix added a commit to raspberrypi/rpi-firmware that referenced this pull request Mar 5, 2025
See: raspberrypi/linux#6689

kernel: Revert "firmware: raspberrypi: Add backward compatible get_throttled"
See: raspberrypi/linux#6697

kernel: RP1 DPI: interlaced HSync/VSync alignment (6.12)
See: raspberrypi/linux#6695

kernel: dtoverlays: ov9281: Add continuous clock option as an override
See: raspberrypi/linux#6700

kernel: Fix clang compilation error for rpi5
See: raspberrypi/linux#6699

kernel: drm/vc4: Correct one logging message that got promoted from dbg to err
See: raspberrypi/linux#6702
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