drm_cvt_mode(9)
โจ 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 ๐
drm_mode_debug_printmodeline(9)drm_mode_create(9)drm_mode_destroy(9)drm_mode_probed_add(9)drm_analog_tv_mode(9)drm_gtf_mode_complex(9)drm_gtf_mode(9)drm_display_mode_from_videomode(9)drm_display_mode_to_videomode(9)drm_bus_flags_from_videomode(9)of_get_drm_display_mode(9)of_get_drm_panel_display_mode(9)drm_mode_set_name(9)drm_mode_vrefresh(9)drm_mode_get_hv_timing(9)drm_mode_set_crtcinfo(9)drm_mode_copy(9)drm_mode_init(9)drm_mode_duplicate(9)drm_mode_match(9)drm_mode_equal(9)drm_mode_equal_no_clocks(9)drm_mode_equal_no_clocks_no_stereo(9)drm_mode_validate_driver(9)drm_mode_validate_size(9)drm_mode_validate_ycbcr420(9)drm_mode_prune_invalid(9)drm_mode_compare(9)drm_mode_sort(9)drm_connector_list_update(9)drm_mode_parse_command_line_for_connector(9)drm_mode_create_from_cmdline_mode(9)drm_mode_convert_to_umode(9)drm_mode_convert_umode(9)drm_mode_is_420_only(9)drm_mode_is_420_also(9)drm_mode_is_420(9)drm_set_preferred_mode(9)
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
- 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