fb_find_best_mode(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… fb_find_best_mode β€” kernel api manual, but make it cute

okay so real talk, this one's from the kernel api manual and it's literally fb_find_best_mode, and its whole job is find best matching videomode. that's the name, that's the mission. slay. ✨


🌸 SYNOPSIS 🌸

here's the signature bestie, copy it exactly, don't @ me:

const struct fb_videomode * fb_find_best_mode (const struct fb_var_screeninfo *var , struct list_head *head );

πŸŽ€ ARGUMENTS πŸŽ€

two args, both pointers, both iconic in their own way:

  • _var_ β€” pointer to struct fb_var_screeninfo. yeah. that whole thing. it's a pointer, it points, that's the vibe. 🫢
  • _head_ β€” pointer to struct list_head of modelist. it's the list head of the modelist. your modelist's main character. πŸ‘‘

πŸ’– RETURN πŸ’–

you get back a struct fb_videomode, and if nothing's found? NULL. no mode for you, bestie, sorry not sorry. 😭


πŸ¦‹ DESCRIPTION πŸ¦‹

IMPORTANT: This function assumes that all modelist entries in info->modelist are valid.

like. IMPORTANT, okay?? it assumes every single entry in info->modelist is valid. it's not out here doing vibe checks on your entries, it's trusting you completely. so if you feed it garbage, that's on you, not on her. πŸ’€


✨ NOTES ✨

so what does it actually do, you ask? it finds the best matching videomode that has a dimension equal to or greater than var->xres and var->yres. so like, big enough, never too small. 🎯

and if it finds more than 1 videomode that fits? it returns the one with the highest refresh rate. because obviously. more hertz, more slay, the smoothest one wins. the way that refresh rate just eats. πŸ”₯


🌈 SEE ALSO 🌈

go read these too, they're all in the kernel file ./drivers/video/fbdev/core/modedb.c, iykyk:

that's the whole friend group, fr fr. πŸ§šπŸ’œ


okay that's the page!! it lives at ./drivers/video/fbdev/core, dated October 2026, and it's fb_find_best_mode(9) β€” mwah, periodt, go find your best mode bestie πŸ’…πŸŽ€πŸŒŸ

πŸ“¦ where this page comes from