Luviaz wrote: ↑22 Aug 2024, 23:00
Fastinating how these stuff work !
Chief, where exactly is the Vblank signal in the Vertical blanking interval ? Is it sanwiched between the 2 porch or is it at the very end of the back porch ?
Does VRR manipulate the vblank signal in its operation ?
This is what I suppose happends in a VSync on VRR operation:
Yes.
The GPU is outputting pixel rows at a perfectly fixed rate (the horizontal scan rate, or horizontal refresh rate). A 1080p signal (with a 45 pixel row VBI for a total of 1125 pixel rows per 1080p refresh cycle) has a scan rate of 1125x60 = 67 kilohertz.
Now VRR doesn't vary the scan rate. So the GPU just adds additional scanlines to the end of the VBI until the frame is presented. Varying-size blanking intervals is how VRR refresh cycles are temporally separated. This is true for all VRR techonologies including FreeSync, VESA Adaptive Sync, HDMI VRR, and G-SYNC (although G-SYNC had some proprietary extensions).
Here's the structure of a video signal, imagine an extended virtual resolution (overscan) beyond the visible desktop:

From this old thread:
viewtopic.php?t=8889#p69658
Since the next refresh cycle is immediately after, VBI (Vertical Blanking Interval) is a contiguous sequence of [Vertical Front Porch + Vertical Sync + Vertical Back Porch]. VBI is the spacer temporally spacing apart refresh cycles.
(Did you know? For 1080p with 45 scan lines in VBI (total of porches and sync), that's a Vertical Total of 1125 pixel rows per refresh cycle. So 1080/1125ths of a refresh cycle is spent scanning out, and 45/1125ths of a refresh cycle is spent idling. This was formerly done in the analog days to allow the CRT electron beam to return to the top, but today it's just a defacto guard delay between refresh cycles (to give displays time to initialize a new refresh cycle). It's temporally identical between analog and digital eras, which is why a passive adaptor can successfully convert 1080i between analog and digital back in the early HDTV days. In fact, today's modern 1080p 60Hz can still display the picture from a 1985 Japanese MUSE HD videotape recording since it was 1125 scanlines interlaced (and most 1080p displays still can display 1080i visible of a 1125i signal) -- when piped through such an adaptor. It's still the same standardized temporal timings, across both the analog to digital domain.)
It will be the Vertical Back Porch that is dynamic, all VRR technologies use a varying Vertical Back Porch, since that's at the end of the the overscan above the top edge of the screen. It's most convenient for VRR to be a simple bolt-on to classical display refreshing, if we're inserting a variable number of extra Vertical Back Porch rows dynamically right above the first visible scan line (topmost pixel row of visible frame).
In other words, when a game presents a frame, the GPU will begin immediately outputting the first pixel row of a new refresh cycle instead of continuing to output Vertical Back Porch pixel rows (in a looping fashion at the current horizontal scan rate). As long as this is done within the VRR range, the display will begin to refresh immediately right on the spot.
So yes, the display has defacto sync'd to the software, because when the software presents the frame, the frame is the new refresh cycle, as long as the frametime is in the VRR range (e.g. 1/144sec thru 1/48sec, for a 48-144Hz VRR display). Frametimes longer than min Hz will cause the drivers or display to independently refresh the previous refresh cycle (LFC aka Low Framerate Compensation), and frametimes briefer than max Hz will automatically switch to the fallback sync technology.
Luviaz wrote: ↑22 Aug 2024, 23:00
How can VRR can detect that a frame has miss a vblank and extend the VBI for it exactly ?
There's no such thing, so the question is non-sequitur.
VRR
intentionally keeps the GPU in permanent vblank as long as frametime is still within VRR range. Vertical Back Porch is a subset of vblank. Therefore, there's no such concept of "missing the vblank" when the frametime (instantaneous framerate) is perfectly within VRR range.
Let's take a 144 Hz VRR display as an example, with a 48-144Hz VRR range.
It will generally take exactly 1/144sec to scanout a refresh cycle (plus minimum-size vblank, which only occurs at maxHz of VRR range). Then the display is idling (at least until minHz, aka 1/48sec later from the start of previous refresh cycle). As the GPU is looping on extending the vblank by looping on outputting Vertical Back Porch scanlines. It will only exit the vblank the instant the software Present()'s a new frame and the GPU begins outputting the first pixel row of the frame.
The beauty of this, is when frametimes are completely inside VRR range, there's no such concept of "missing the vblank". Because the display is guaranteed to be in vblank (because the GPU is looping on Vertical Back Porch scanlines) when a game presents a new frame, as long as it is presented [1/144sec...1/48sec] after the prevent frame presented.
During 300fps operation on 360Hz display, you can have 300 different unique refresh rates (instantaneous frametimes = refreshtimes) per second. Amazing, isn't it?