1<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Part III. vga_switcheroo</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Linux GPU Driver Developer's Guide"><link rel="up" href="index.html" title="Linux GPU Driver Developer's Guide"><link rel="prev" href="ch04s05.html" title="Tracing"><link rel="next" href="modes_of_use.html" title="Chapter 5. Modes of Use"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Part III. vga_switcheroo</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04s05.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="modes_of_use.html">Next</a></td></tr></table><hr></div><div class="part"><div class="titlepage"><div><div><h1 class="title"><a name="vga_switcheroo"></a>Part III. vga_switcheroo</h1></div></div></div><div class="partintro"><div></div><p>
2   </p><p>
3   vga_switcheroo is the Linux subsystem for laptop hybrid graphics.
4   These come in two flavors:
5   </p><p>
6   * muxed: Dual GPUs with a multiplexer chip to switch outputs between GPUs.
7   * muxless: Dual GPUs but only one of them is connected to outputs.
8   The other one is merely used to offload rendering, its results
9   are copied over PCIe into the framebuffer. On Linux this is
10   supported with DRI PRIME.
11   </p><p>
12   Hybrid graphics started to appear in the late Naughties and were initially
13   all muxed. Newer laptops moved to a muxless architecture for cost reasons.
14   A notable exception is the MacBook Pro which continues to use a mux.
15   Muxes come with varying capabilities: Some switch only the panel, others
16   can also switch external displays. Some switch all display pins at once
17   while others can switch just the DDC lines. (To allow EDID probing
18   for the inactive GPU.) Also, muxes are often used to cut power to the
19   discrete GPU while it is not used.
20   </p><p>
21   DRM drivers register GPUs with vga_switcheroo, these are heretoforth called
22   clients. The mux is called the handler. Muxless machines also register a
23   handler to control the power state of the discrete GPU, its -&gt;switchto
24   callback is a no-op for obvious reasons. The discrete GPU is often equipped
25   with an HDA controller for the HDMI/DP audio signal, this will also
26   register as a client so that vga_switcheroo can take care of the correct
27   suspend/resume order when changing the discrete GPU's power state. In total
28   there can thus be up to three clients: Two vga clients (GPUs) and one audio
29   client (on the discrete GPU). The code is mostly prepared to support
30   machines with more than two GPUs should they become available.
31   The GPU to which the outputs are currently switched is called the
32   active client in vga_switcheroo parlance. The GPU not in use is the
33   inactive client.
34</p><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="chapter"><a href="modes_of_use.html">5. Modes of Use</a></span></dt><dd><dl><dt><span class="sect1"><a href="modes_of_use.html#id-1.5.3.2">Manual switching and manual power control</a></span></dt><dt><span class="sect1"><a href="ch05s02.html">Driver power control</a></span></dt></dl></dd><dt><span class="chapter"><a href="pubfunctions.html">6. Public functions</a></span></dt><dd><dl><dt><span class="refentrytitle"><a href="API-vga-switcheroo-register-handler.html"><span class="phrase">vga_switcheroo_register_handler</span></a></span><span class="refpurpose"> — 
35  register handler
36 </span></dt><dt><span class="refentrytitle"><a href="API-vga-switcheroo-unregister-handler.html"><span class="phrase">vga_switcheroo_unregister_handler</span></a></span><span class="refpurpose"> — 
37     unregister handler
38 </span></dt><dt><span class="refentrytitle"><a href="API-vga-switcheroo-register-client.html"><span class="phrase">vga_switcheroo_register_client</span></a></span><span class="refpurpose"> — 
39     register vga client
40 </span></dt><dt><span class="refentrytitle"><a href="API-vga-switcheroo-register-audio-client.html"><span class="phrase">vga_switcheroo_register_audio_client</span></a></span><span class="refpurpose"> — 
41     register audio client
42 </span></dt><dt><span class="refentrytitle"><a href="API-vga-switcheroo-get-client-state.html"><span class="phrase">vga_switcheroo_get_client_state</span></a></span><span class="refpurpose"> — 
43     obtain power state of a given client
44 </span></dt><dt><span class="refentrytitle"><a href="API-vga-switcheroo-unregister-client.html"><span class="phrase">vga_switcheroo_unregister_client</span></a></span><span class="refpurpose"> — 
45     unregister client
46 </span></dt><dt><span class="refentrytitle"><a href="API-vga-switcheroo-client-fb-set.html"><span class="phrase">vga_switcheroo_client_fb_set</span></a></span><span class="refpurpose"> — 
47     set framebuffer of a given client
48 </span></dt><dt><span class="refentrytitle"><a href="API-vga-switcheroo-process-delayed-switch.html"><span class="phrase">vga_switcheroo_process_delayed_switch</span></a></span><span class="refpurpose"> — 
49     helper for delayed switching
50 </span></dt><dt><span class="refentrytitle"><a href="API-vga-switcheroo-set-dynamic-switch.html"><span class="phrase">vga_switcheroo_set_dynamic_switch</span></a></span><span class="refpurpose"> — 
51     helper for driver power control
52 </span></dt><dt><span class="refentrytitle"><a href="API-vga-switcheroo-init-domain-pm-ops.html"><span class="phrase">vga_switcheroo_init_domain_pm_ops</span></a></span><span class="refpurpose"> — 
53     helper for driver power control
54 </span></dt><dt><span class="refentrytitle"><a href="API-vga-switcheroo-init-domain-pm-optimus-hdmi-audio.html"><span class="phrase">vga_switcheroo_init_domain_pm_optimus_hdmi_audio</span></a></span><span class="refpurpose"> — 
55     helper for driver power control
56 </span></dt></dl></dd><dt><span class="chapter"><a href="pubstructures.html">7. Public structures</a></span></dt><dd><dl><dt><span class="refentrytitle"><a href="API-struct-vga-switcheroo-handler.html"><span class="phrase">struct vga_switcheroo_handler</span></a></span><span class="refpurpose"> — 
57  handler callbacks
58 </span></dt><dt><span class="refentrytitle"><a href="API-struct-vga-switcheroo-client-ops.html"><span class="phrase">struct vga_switcheroo_client_ops</span></a></span><span class="refpurpose"> — 
59  client callbacks
60 </span></dt></dl></dd><dt><span class="chapter"><a href="pubconstants.html">8. Public constants</a></span></dt><dd><dl><dt><span class="refentrytitle"><a href="API-enum-vga-switcheroo-client-id.html"><span class="phrase">enum vga_switcheroo_client_id</span></a></span><span class="refpurpose"> — 
61  client identifier
62 </span></dt><dt><span class="refentrytitle"><a href="API-enum-vga-switcheroo-state.html"><span class="phrase">enum vga_switcheroo_state</span></a></span><span class="refpurpose"> — 
63  client power state
64 </span></dt></dl></dd><dt><span class="chapter"><a href="privstructures.html">9. Private structures</a></span></dt><dd><dl><dt><span class="refentrytitle"><a href="API-struct-vgasr-priv.html"><span class="phrase">struct vgasr_priv</span></a></span><span class="refpurpose"> — 
65  vga_switcheroo private data
66 </span></dt><dt><span class="refentrytitle"><a href="API-struct-vga-switcheroo-client.html"><span class="phrase">struct vga_switcheroo_client</span></a></span><span class="refpurpose"> — 
67  registered client
68 </span></dt></dl></dd></dl></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch04s05.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="modes_of_use.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"> Tracing  </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 5. Modes of Use</td></tr></table></div></body></html>
69