drm_cvt_mode(9)

๐Ÿ“ฆ version 7.3.1, in nixpkgs unstable

โœจ drm_cvt_mode(9) โœจ

okay so bestie, welcome to the Kernel API Manual ๐Ÿ’… this one's a kernel page, and we're talking about drm_cvt_mode โ€” the lil function that builds you a modeline using the CVT algorithm. iconic behavior tbh ๐ŸŽ€


๐ŸŒธ NAME ๐ŸŒธ

drm_cvt_mode โ€” create a modeline based on the CVT algorithm โœจ


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

struct drm_display_mode * drm_cvt_mode (struct drm_device *dev , int
hdisplay , int vdisplay , int vrefresh , bool reduced , bool interlaced
, bool margins );

like, it takes a whole lil friend group of args and hands you back a struct drm_display_mode * ๐Ÿซถ


๐Ÿ’– ARGUMENTS ๐Ÿ’–

  • dev โ€” drm device ๐Ÿ’ป (the main character, obviously)
  • hdisplay โ€” hdisplay size ๐Ÿ“
  • vdisplay โ€” vdisplay size ๐Ÿ“
  • vrefresh โ€” vrefresh rate ๐Ÿ”„
  • reduced โ€” whether to use reduced blanking ๐Ÿซง
  • interlaced โ€” whether to compute an interlaced mode ๐ŸŒ€
  • margins โ€” whether to add margins (borders) ๐Ÿ–ผ๏ธ

๐Ÿ‘‘ DESCRIPTION ๐Ÿ‘‘

so this function is the one you call when you want to generate the modeline based on the CVT algorithm, using your hdisplay, vdisplay, and vrefresh values ๐Ÿ’ซ ngl it's giving math girlie and we love that for her.

the lore?? it's based from the VESA(TM) Coordinated Video Timing Generator by Graham Loveridge, dated April 9, 2003, and you can find that at http://www.elo.utfsm.cl/~elo212/docs/CVTd6r1.xls ๐Ÿ“Š (yes bestie, an .xls file, we stan a spreadsheet era ๐Ÿ’€).

and it's also copied from xf86CVTmode in xserver/hw/xfree86/modes/xf86cvt.c. what the author did โ€” and I'm quoting the vibe here โ€” is translate it by using integer calculation ๐Ÿงฎโœจ no floats, no drama, just integers slaying.


๐ŸŽ€ RETURN ๐ŸŽ€

you get the modeline based on the CVT algorithm, stored in a drm_display_mode object ๐Ÿ˜Œ๐Ÿ’– and that display mode object is allocated with drm_mode_create.

heads up bestie ๐Ÿšจ it returns NULL when no mode could be allocated โ€” so like, always check, fr fr ๐Ÿ™ˆ

๐ŸŒˆ SEE ALSO ๐ŸŒˆ

  • Kernel file ./drivers/gpu/drm/drm_modes.c ๐Ÿ—‚๏ธ

and the whole extended fam ๐Ÿ‘‡


and that's the whole page bestie!! ๐Ÿ’œ this one lives in ./drivers/gpu/drm and the version/date stamp is October 2026 โ€” so like, future-era manual page energy ๐Ÿฆ‹โœจ mwah, go forth and compute those modelines ๐Ÿ’…๐ŸŽ€

๐Ÿ“ฆ where this page comes from