STRUCT VGA_SWITCHEROO_HANDLER(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… NAME πŸ’…

struct vga_switcheroo_handler β€” bestie, it's the handler callbacks πŸ‘‘ (the plug-and-play brain of the whole switcheroo situation)

So like, this page lives in the Kernel API Manual, and it's giving "backstage pass to the GPU glow-up department" energy ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

struct vga_switcheroo_handler {
    int (*init)(void);
    int (*switchto)(enum vga_switcheroo_client_id id);
    int (*switch_ddc)(enum vga_switcheroo_client_id id);
    int (*power_state)(enum vga_switcheroo_client_id id, enum vga_switcheroo_state state);
    enum vga_switcheroo_client_id (*get_client_id)(struct pci_dev *pdev);
};

🌸 Members 🌸

  • init β€” initialize the handler πŸ’– Optional, okurr. This gets called when vga_switcheroo is enabled, i.e. when two vga clients have registered. It lets the handler do some delayed initialization that depends on the vga clients actually existing. Currently only the radeon and amdgpu drivers use this. And the return value? Ignored. Not read. Not perceived. πŸ’€
  • switchto β€” switch the outputs to the given client πŸ–₯️ Mandatory, no skipping. For muxless machines this should be a no-op (literally nothing, on purpose). Returning 0 denotes success, anything else is failure β€” and in that failure case the switch is aborted. 🚨
  • switch_ddc β€” switch the DDC lines to the given client πŸ”Œ Optional. Should return the previous DDC owner on success, or a negative int on failure. Ngl that return value is doing double duty.
  • power_state β€” cut or reinstate power of the given client ⚑ Optional. The return value is ignored. Yeah. It just goes in the void. πŸ™ˆ
  • get_client_id β€” determine if the given pci device is an integrated or a discrete GPU 🧐 Mandatory. This one's the vibe check that tells you who's who.

πŸ’œ Description πŸ’œ

Handler callbacks, bestie β€” the multiplexer itself. Like the group-chat admin who decides whose turn it is to post. πŸ‘‘

The switchto and get_client_id methods are mandatory; all the others may be set to NULL. Periodt. πŸŽ€


πŸŽ€ SEE ALSO πŸŽ€

  • Kernel file ./include/linux/vga_switcheroo.h
  • enum vga_switcheroo_handler_flags_t(9)
  • enum vga_switcheroo_state(9)
  • enum vga_switcheroo_client_id(9)
  • struct vga_switcheroo_client_ops(9)

Okay that's the whole page, you ate that πŸ“ This one's served fresh from ./include/linux, dated October 2026 β€” mwah, go read the kernel source, ily, bye πŸ«ΆπŸ’–

πŸ“¦ where this page comes from