vga_get(9)
π 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, passNULLif 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 π
- Kernel file
./drivers/pci/vgaarb.c vga_default_device(9)vga_remove_vgacon(9)vga_tryget(9)vga_put(9)vga_set_legacy_decoding(9)vga_client_register(9)
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
- 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