1<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>struct vga_switcheroo_handler</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="pubstructures.html" title="Chapter 7. Public structures"><link rel="prev" href="pubstructures.html" title="Chapter 7. Public structures"><link rel="next" href="API-struct-vga-switcheroo-client-ops.html" title="struct vga_switcheroo_client_ops"></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"><span class="phrase">struct vga_switcheroo_handler</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="pubstructures.html">Prev</a> </td><th width="60%" align="center">Chapter 7. Public structures</th><td width="20%" align="right"> <a accesskey="n" href="API-struct-vga-switcheroo-client-ops.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-struct-vga-switcheroo-handler"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>struct vga_switcheroo_handler — 
2  handler callbacks
3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="programlisting">
4struct vga_switcheroo_handler {
5  int (* init) (void);
6  int (* switchto) (enum vga_switcheroo_client_id id);
7  int (* power_state) (enum vga_switcheroo_client_id id,enum vga_switcheroo_state state);
8  enum vga_switcheroo_client_id (* get_client_id) (struct pci_dev *pdev);
9};  </pre></div><div class="refsect1"><a name="id-1.5.5.2.5"></a><h2>Members</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term">init</span></dt><dd><p>
10initialize handler.
11Optional. This gets called when vga_switcheroo is enabled, i.e. when
12two vga clients have registered. It allows the handler to perform
13some delayed initialization that depends on the existence of the
14vga clients. Currently only the radeon and amdgpu drivers use this.
15The return value is ignored
16      </p></dd><dt><span class="term">switchto</span></dt><dd><p>
17switch outputs to given client.
18Mandatory. For muxless machines this should be a no-op. Returning 0
19denotes success, anything else failure (in which case the switch is
20aborted)
21      </p></dd><dt><span class="term">power_state</span></dt><dd><p>
22cut or reinstate power of given client.
23Optional. The return value is ignored
24      </p></dd><dt><span class="term">get_client_id</span></dt><dd><p>
25determine if given pci device is integrated or discrete GPU.
26Mandatory
27      </p></dd></dl></div></div><div class="refsect1"><a name="id-1.5.5.2.6"></a><h2>Description</h2><p>
28   Handler callbacks. The multiplexer itself. The <em class="parameter"><code>switchto</code></em> and <em class="parameter"><code>get_client_id</code></em>
29   methods are mandatory, all others may be set to NULL.
30</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="pubstructures.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="pubstructures.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-struct-vga-switcheroo-client-ops.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 7. Public structures </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span class="phrase">struct vga_switcheroo_client_ops</span></td></tr></table></div></body></html>
31