drm_sysfb_build_fourcc_list(9)

๐Ÿ“ฆ version 7.3.1, in nixpkgs unstable

โœจ drm_sysfb_build_fourcc_list ๐Ÿ’…

okay so bestie, welcome to the drm_sysfb_build_fourcc_list(9) page of the Kernel API Manual โ€” yes that's the manual name, and yes we're diving straight in because this one's actually kind of a bop ๐ŸŽ€


๐ŸŒธ NAME ๐ŸŒธ

drm_sysfb_build_fourcc_list โ€” it filters a list of supported color formats against the device's native formats, no cap โœจ


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

size_t drm_sysfb_build_fourcc_list (struct drm_device *dev , const u32
*native_fourccs , size_t native_nfourccs , u32 *fourccs_out , size_t
nfourccs_out );

like, that's the whole signature, take it in, it's giving function ๐Ÿ’œ


๐ŸŽ€ ARGUMENTS ๐ŸŽ€

  • dev โ€” the DRM device itself, the main character ๐Ÿ‘‘
  • native_fourccs โ€” the 4CC codes of natively supported color formats ๐Ÿ–ผ๏ธ
  • native_nfourccs โ€” the number of entries in native_fourccs, literally just the count ๐Ÿงฎ
  • fourccs_out โ€” where the 4CC codes of supported color formats get returned to you ๐Ÿซถ
  • nfourccs_out โ€” the number of available entries in fourccs_out, so it knows how much room it's got ๐ŸŒธ

๐Ÿ’– DESCRIPTION ๐Ÿ’–

So this function creates a list of supported color formats from the natively supported formats plus some additional emulated formats. periodt โœจ

At a minimum, most userspace programs expect at least support for XRGB8888 on the primary plane โ€” that's the floor, bestie, don't go below it ๐Ÿ˜ญ

Sysfb devices that have to emulate the format should use drm_sysfb_build_fourcc_list to create a list of supported color formats. The returned list can be handed over to drm_universal_plane_init et al. โ€” yes, "et al.", very fancy ๐Ÿ’…

Now the important ranking tea โ˜•:

  • Native formats will go before emulated formats. native stays winning ๐Ÿฅ‡
  • Native formats with an alpha channel will be replaced by equal formats without an alpha channel, because primary planes usually don't support alpha ๐Ÿ™ˆ
  • Other heuristics might be applied to optimize the sorting order โ€” so the order isn't totally fixed, iykyk ๐Ÿคซ
  • Formats near the beginning of the list are usually preferred over formats near the end of the list. front of the line = main character energy ๐Ÿ”ฅ

โญ RETURN โญ

It returns the number of color-formats 4CC codes returned in fourccs_out. that's it, that's the return value, slay ๐Ÿ’ซ


๐ŸŒˆ SEE ALSO ๐ŸŒˆ

  • Kernel file ./drivers/gpu/drm/sysfb/drm_sysfb_modeset.c โ€” go read it, it's right there ๐Ÿฆ‹

๐Ÿ’€ heads up: the sorting order involves heuristics, so "might be applied" means might โ€” don't go assuming a guaranteed order beyond what's written here, fr fr.

and that's the page!! brought to you by ./drivers/gpu/drm/sysfb, dated October 2026 โ€” mwah, go build those fourcc lists bestie ๐Ÿซถ๐Ÿ’–โœจ

๐Ÿ“ฆ where this page comes from