vga_get(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… vga_get(9) β€” like, the Kernel API Manual page, but make it make sense

okay bestie, so you know how the kernel manual has this thing called vga_get(9)? yeah. that's what we're doing today. it's the VGA arbiter's main character moment and honestly it ate. let's get into it ✨


🌸 NAME 🌸

vga_get β€” acquire & lock VGA resources πŸŽ€


✨ SYNOPSIS ✨

int vga_get (struct pci_dev *pdev , unsigned int rsrc , int
interruptible );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • pdev β€” the PCI device of the VGA card you're after. or like, pass NULL if you just want the system default, no biggie πŸ’β€β™€οΈ
  • rsrc β€” bit mask of the resources to acquire and lock. yeah, a mask. you got this 🫢
  • interruptible β€” okay so this one's literally just a question: should the blocking be interruptible by signals? yes or no, bestie πŸ’…

πŸ‘‘ DESCRIPTION πŸ‘‘

So what it does: it acquires VGA resources for the given card and marks those resources as locked. periodt.

Now here's the little plot twist 🌈 β€” if the resources you requested are "normal" (and not legacy) resources, the arbiter will first check whether the card is doing legacy decoding for that type of resource. and if yes? the lock gets "converted" into a legacy resource lock. it's giving glow-up, honestly.

Then the arbiter does its thing: it will first look for all VGA cards that might conflict and disable their IOs and/or Memory access β€” including VGA forwarding on P2P bridges if necessary β€” so that the requested resources can actually be used. after that, the card is marked as locking these resources, and the IO and/or Memory accesses are enabled on the card (including VGA forwarding on parent P2P bridges if any). iconic behavior, no notes πŸ”₯

This function will block if some conflicting card is already locking one of the required resources (or any resource on a different bus segment, since P2P bridges don't differentiate VGA memory and IO afaik β€” and yes, "afaik" is verbatim from the source, the kernel devs said it not me πŸ’€). You can indicate whether this blocking should be interruptible by a signal (for userland interface) or not.

⚠️ Must not be called at interrupt time or in atomic context. like, do not. that's the vibe check and you will fail it 😭

If the card already owns the resources, the function succeeds β€” slay, no work needed πŸ’– Nested calls are supported (a per-resource counter is maintained). yes bestie, it keeps count. it's organized like that.

On success, release the VGA resource again with vga_put.

And the return sitch: 0 on success, negative error code on failure. that's it. that's the tea πŸ“


πŸ’œ SEE ALSO πŸ’œ

go read those too, iykyk 🧚


and that's the whole page, bestie 🫢 this little gem lives under ./drivers/pci and it's dated October 2026, and the header/title situation is vga_get(9) from the Kernel API Manual β€” the way that versioning said "future" and meant it πŸ’€βœ¨ bye, go lock some resources responsibly πŸ’–

πŸ“¦ where this page comes from