drm_crtc_vb...nk_timestamp(9)
π drm_crtc_vblank_helper_get_vblank_timestamp(9) π
okay so bestie, welcome to section 9 of the Kernel API Manual β yes it's the kernel, yes it's a whole vibe, and the page title is literally drm_crtc_vb...nk_timestamp(9) (they truncated it in the header bc it's a long icon name and we respect the hustle β¨). This is the function that tells you exactly when a vblank happened, no guessing, no cap. π
πΈ NAME πΈ
drm_crtc_vblank_helper_get_vblank_timestamp β the precise vblank timestamp helper. it's giving "I know exactly when the screen refreshed" energy and honestly? obsessed. π
β¨ SYNOPSIS β¨
bool drm_crtc_vblank_helper_get_vblank_timestamp (struct drm_crtc *crtc
, int *max_error , ktime_t *vblank_time , bool in_vblank_irq );
that's the whole signature, bestie, copy it exactly, no typos, we do not miss a single character in this house π«Ά
π¦ ARGUMENTS π¦
crtcβ the CRTC whose vblank timestamp you're trying to retrieve. it's the main character here, obviously. πmax_errorβ the desired maximum allowable error in timestamps, in nanoseconds. and on return it contains the true maximum error of the timestamp β so it comes in as your wish and leaves as the receipts. πvblank_timeβ pointer to the time that should receive the timestamp. yes it's an out-param, yes it gets the glow-up. β¨in_vblank_irqβtruewhen it's called fromdrm_crtc_handle_vblank. some drivers need to apply some workarounds for gpu-specific vblank irq quirks if this flag is set. lowkey cursed but we move. π
π DESCRIPTION π
okay so what does it actually do: it implements calculation of exact vblank timestamps from the given drm_display_mode timings plus the current video scanout position of a CRTC. that's the whole bit. π₯
and here's the slay part β you can use it directly as the drm_crtc_funcs.get_vblank_timestamp implementation of a kms driver, as long as drm_crtc_helper_funcs.get_scanout_position is implemented. plug and play, periodt. π
ngl there's a catch tho: the current implementation only handles standard video modes. for double scan and interlaced modes, the driver is supposed to adjust the hardware mode (taken from drm_crtc_state.adjusted mode for atomic modeset drivers) to match the scanout position reported. so like, do your homework, bestie.
also β and this is important β note that atomic drivers must call drm_calc_timestamping_constants before enabling a CRTC. good news tho: the atomic helpers already take care of that in drm_atomic_helper_calc_timestamping_constants. so you're covered, but now you know. π
β RETURN β
returns true on success, and false on failure β i.e. when no accurate timestamp could be acquired. flop era only when the timestamp is genuinely unavailable, no cap. π€
π SEE ALSO π
- Kernel file
./drivers/gpu/drm/drm_vblank.cβvblank handling(9) drm_crtc_accurate_vblank_count(9)drm_vblank_init(9)drm_dev_has_vblank(9)drm_crtc_vblank_waitqueue(9)drm_calc_timestamping_constants(9)drm_crtc_vblank_helper_get_vblank_timestamp_internal(9)drm_crtc_get_last_vbltimestamp(9)drm_crtc_vblank_count(9)drm_vblank_count_and_time(9)drm_crtc_vblank_count_and_time(9)drm_crtc_next_vblank_start(9)drm_crtc_arm_vblank_event(9)drm_crtc_send_vblank_event(9)drm_crtc_vblank_get(9)drm_crtc_vblank_put(9)drm_crtc_wait_one_vblank(9)drm_crtc_vblank_off(9)drm_crtc_vblank_reset(9)drm_crtc_set_max_vblank_count(9)drm_crtc_vblank_on_config(9)drm_crtc_vblank_on(9)drm_crtc_vblank_restore(9)drm_handle_vblank(9)drm_crtc_handle_vblank(9)drm_crtc_vblank_start_timer(9)drm_crtc_vblank_cancel_timer(9)drm_crtc_vblank_get_vblank_timeout(9)
like, the whole vblank friend group showed up to the party. πΈπ¦
that's the page, bestie!! sourced from ./drivers/gpu/drm, dated October 2026, and living in section 9 of the Kernel API Manual β go forth and timestamp your vblanks precisely, ily, mwah ππ§ββοΈ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms