drm_line_printer(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 β€” the struct drm_printer which actually generates the output. It's the main character here, fr fr. πŸ‘‘
  • prefix β€” optional output prefix, or NULL for no prefix. So if you don't want a lil' label, just pass NULL and keep it lowkey. πŸ™ˆ
  • series β€” optional unique series identifier, or 0 to omit the identifier in the output. Like a little ID tag for your dump, but you can skip it with 0 if 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:

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