drm_line_printer(9)
π drm_line_printer(9) β the kernel API manual, but make it bestie-coded β¨
Heyyy so this is a page about drm_line_printer, which lives in the Kernel API Manual and is genuinely one of those little helpers that eats. Like, it constructs a &drm_printer that prefixes its outputs with line numbers. No cap. π«Ά
πΈ NAME πΈ
drm_line_printer β construct a &drm_printer that prefixes outputs with line numbers. That's it, that's the whole vibe. π
π SYNOPSIS π
struct drm_printer drm_line_printer (struct drm_printer *p , const char *prefix , unsigned int series );
Like, it takes three things and gives you back a struct drm_printer. Iconic behavior honestly. β¨
π¦ ARGUMENTS π¦
pβ thestruct drm_printerwhich actually generates the output. It's the main character here, fr fr. πprefixβ optional output prefix, orNULLfor no prefix. So if you don't want a lil' label, just passNULLand keep it lowkey. πseriesβ optional unique series identifier, or0to omit the identifier in the output. Like a little ID tag for your dump, but you can skip it with0if you're feeling minimal. π
β¨ DESCRIPTION β¨
Okay so here's the tea: this printer can be used to increase the robustness of the captured output to make sure we didn't lose any intermediate lines of the output. It's giving "safety net for your crash data" energy. Helpful while capturing some crash data. Periodt. π
π Example 1 π
void crash_dump(struct drm_device *drm)
{
static unsigned int id;
struct drm_printer p = drm_err_printer(drm, "crash");
struct drm_printer lp = drm_line_printer(p, "dump", ++id);
drm_printf(lp, "foo");
drm_printf(lp, "bar");
}
Above code will print into the dmesg something like:
[ ] 0000:00:00.0: [drm] *ERROR* crash dump 1.1: foo
[ ] 0000:00:00.0: [drm] *ERROR* crash dump 1.2: bar
See the 1.1 and 1.2? That's the series ID plus line numbers doing their lil' thing. Slay. π₯
π§ Example 2 π§
void line_dump(struct device *dev)
{
struct drm_printer p = drm_info_printer(dev);
struct drm_printer lp = drm_line_printer(p, NULL, 0);
drm_printf(lp, "foo");
drm_printf(lp, "bar");
}
Above code will print:
[ ] 0000:00:00.0: [drm] 1: foo
[ ] 0000:00:00.0: [drm] 2: bar
No prefix (NULL) and no series ID (0), so you just get the line numbers. Minimalist queen. π
π RETURN π
The drm_printer object. That's the whole return. It gives you the object, bestie. π«Ά
β SEE ALSO β
Okay this list is long but we don't skip, we appreciate every single reference. All of these are literally right here in the original, no cap:
- Kernel file
./include/drm/drm_print.hprint(9) enum drm_debug_category(9)struct drm_printer(9)drm_vprintf(9)drm_printf_indent(9)struct drm_print_iterator(9)drm_coredump_printer(9)drm_coredump_printer_is_full(9)drm_seq_file_printer(9)drm_info_printer(9)drm_dbg_printer(9)drm_err_printer(9)DRM_DEV_ERROR(9)DRM_DEV_ERROR_RATELIMITED(9)DRM_DEV_DEBUG(9)DRM_DEV_DEBUG_DRIVER(9)DRM_DEV_DEBUG_KMS(9)
Go read them if you're curious, iykyk. ππ
Okay that's the whole page! This one came from ./include/drm and the date on it is October 2026. Byeee, go print some lines with numbers on them, bestie! π¦π
πΈ
π¦ 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