Skip to content

Conversation

njhollinghurst
Copy link
Contributor

@njhollinghurst njhollinghurst commented Aug 19, 2025

By avoiding VEC's built-in interlaced DMA modes, and sending individual fields (adapting the "field wobble" trick from the DPI driver), it looks like we can get VEC to update at full field rate.

This changes the pattern of VSync pulses on the VEC's FE->BE interface. Some jiggery-pokery with the NTSC vertical settings was required before the BE would tolerate this (my guess is that the offset between "frame datum" and VSync, which is nonzero in conventional NTSC line numbering, made it more sensitive to FE VSync timings?)

Needs more testing to ensure it's reliable in all modes (including the "vintage" ones). Unlike the DPI case we can't use PIO to infer correct field polarity. If it ever gets out of step, it won't recover!

To clarify: The first of these two commits relates to progressive modes, and is unrelated.

@njhollinghurst
Copy link
Contributor Author

Simulations suggest that the issue with NTSC timings may be the small distance between the last active (or FE-inserted "vfp") line and the field datum (rather than the vertical sync sequence per se).

It seems the BE stops accepting pixels just before it gets to see the first pixel of the second field, the one with VSync. In the native interlace mode it won't be expecting a VSync here, but in the hacked mode it seems to lock up if one is not present!

Fortunately (and still rather mysteriously) the workaround works.

@njhollinghurst
Copy link
Contributor Author

Do we have a policy about "chicken parameters"? e.g. a module parameter called fast-update or some such, default true.

Even once 60fps is (we hope) proven reliable, it's just conceivable some users might want to keep the old 30fps rate (though VC4 was always 60fps).

@pelwell
Copy link
Contributor

pelwell commented Aug 22, 2025

Do we have a policy about "chicken parameters"?

Use them when necessary? Module parameters have the advantage that they can be set in their own module.conf file, which makes maintenance easier for distros.

@njhollinghurst
Copy link
Contributor Author

Done some more testing.

  • Inducing VEC under-runs using the AXI burst breaker, seems benign. The picture breaks up but VEC FE maintains sync, as it should, and interrupts continue.
  • Dropping an RP1 VEC interrupt causes hideous vertical jitter (as predicted) but nothing fatal; the display remains usable for many purposes. It persists until the next mode change (or another dropped interrupt).
  • Soak testing with kmstest --flip in different modes with random (odd and even) numbers of flips, seems fine.

I might not bother with a parameter.

To work around the 30fps buffer-flip rate limit when using VEC's
"native" interlaced modes, switch to sending individual fields
to the VEC BE, using an ISR to flip between fields.

When the TV mode is NTSC, change advertised progressive modes to
have 263 total lines; this ameliorates colour artifacts, although
it reduces the frame rate slightly from 60.05Hz to 59.83Hz.
Progressive modes with 262 lines remain supported.

Fix an error in equalising pulse configuration for PAL-M/PAL60.

Signed-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>
@njhollinghurst njhollinghurst marked this pull request as ready for review August 26, 2025 16:26
@njhollinghurst njhollinghurst merged commit a76b7b2 into raspberrypi:rpi-6.12.y Aug 27, 2025
12 checks passed
@njhollinghurst njhollinghurst deleted the vec-202508 branch August 27, 2025 11:08
popcornmix added a commit to raspberrypi/firmware that referenced this pull request Aug 29, 2025
kernel: RP1 Video Out: Hack for 50fps/60fps buffer-flips in interlaced modes
See: raspberrypi/linux#7010

kernel: Splash Screen: bug fix
See: raspberrypi/linux#7021
popcornmix added a commit to raspberrypi/rpi-firmware that referenced this pull request Aug 29, 2025
kernel: RP1 Video Out: Hack for 50fps/60fps buffer-flips in interlaced modes
See: raspberrypi/linux#7010

kernel: Splash Screen: bug fix
See: raspberrypi/linux#7021
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.

2 participants