1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
3	"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>
4
5<book id="gpuDevelopersGuide">
6  <bookinfo>
7    <title>Linux GPU Driver Developer's Guide</title>
8
9    <authorgroup>
10      <author>
11	<firstname>Jesse</firstname>
12	<surname>Barnes</surname>
13	<contrib>Initial version</contrib>
14	<affiliation>
15	  <orgname>Intel Corporation</orgname>
16	  <address>
17	    <email>jesse.barnes@intel.com</email>
18	  </address>
19	</affiliation>
20      </author>
21      <author>
22	<firstname>Laurent</firstname>
23	<surname>Pinchart</surname>
24	<contrib>Driver internals</contrib>
25	<affiliation>
26	  <orgname>Ideas on board SPRL</orgname>
27	  <address>
28	    <email>laurent.pinchart@ideasonboard.com</email>
29	  </address>
30	</affiliation>
31      </author>
32      <author>
33	<firstname>Daniel</firstname>
34	<surname>Vetter</surname>
35	<contrib>Contributions all over the place</contrib>
36	<affiliation>
37	  <orgname>Intel Corporation</orgname>
38	  <address>
39	    <email>daniel.vetter@ffwll.ch</email>
40	  </address>
41	</affiliation>
42      </author>
43      <author>
44	<firstname>Lukas</firstname>
45	<surname>Wunner</surname>
46	<contrib>vga_switcheroo documentation</contrib>
47	<affiliation>
48	  <address>
49	    <email>lukas@wunner.de</email>
50	  </address>
51	</affiliation>
52      </author>
53    </authorgroup>
54
55    <copyright>
56      <year>2008-2009</year>
57      <year>2013-2014</year>
58      <holder>Intel Corporation</holder>
59    </copyright>
60    <copyright>
61      <year>2012</year>
62      <holder>Laurent Pinchart</holder>
63    </copyright>
64    <copyright>
65      <year>2015</year>
66      <holder>Lukas Wunner</holder>
67    </copyright>
68
69    <legalnotice>
70      <para>
71	The contents of this file may be used under the terms of the GNU
72	General Public License version 2 (the "GPL") as distributed in
73	the kernel source COPYING file.
74      </para>
75    </legalnotice>
76
77    <revhistory>
78      <!-- Put document revisions here, newest first. -->
79      <revision>
80	<revnumber>1.0</revnumber>
81	<date>2012-07-13</date>
82	<authorinitials>LP</authorinitials>
83	<revremark>Added extensive documentation about driver internals.
84	</revremark>
85      </revision>
86      <revision>
87	<revnumber>1.1</revnumber>
88	<date>2015-10-11</date>
89	<authorinitials>LW</authorinitials>
90	<revremark>Added vga_switcheroo documentation.
91	</revremark>
92      </revision>
93    </revhistory>
94  </bookinfo>
95
96<toc></toc>
97
98<part id="drmCore">
99  <title>DRM Core</title>
100  <partintro>
101    <para>
102      This first part of the GPU Driver Developer's Guide documents core DRM
103      code, helper libraries for writing drivers and generic userspace
104      interfaces exposed by DRM drivers.
105    </para>
106  </partintro>
107
108  <chapter id="drmIntroduction">
109    <title>Introduction</title>
110    <para>
111      The Linux DRM layer contains code intended to support the needs
112      of complex graphics devices, usually containing programmable
113      pipelines well suited to 3D graphics acceleration.  Graphics
114      drivers in the kernel may make use of DRM functions to make
115      tasks like memory management, interrupt handling and DMA easier,
116      and provide a uniform interface to applications.
117    </para>
118    <para>
119      A note on versions: this guide covers features found in the DRM
120      tree, including the TTM memory manager, output configuration and
121      mode setting, and the new vblank internals, in addition to all
122      the regular features found in current kernels.
123    </para>
124    <para>
125      [Insert diagram of typical DRM stack here]
126    </para>
127  </chapter>
128
129  <!-- Internals -->
130
131  <chapter id="drmInternals">
132    <title>DRM Internals</title>
133    <para>
134      This chapter documents DRM internals relevant to driver authors
135      and developers working to add support for the latest features to
136      existing drivers.
137    </para>
138    <para>
139      First, we go over some typical driver initialization
140      requirements, like setting up command buffers, creating an
141      initial output configuration, and initializing core services.
142      Subsequent sections cover core internals in more detail,
143      providing implementation notes and examples.
144    </para>
145    <para>
146      The DRM layer provides several services to graphics drivers,
147      many of them driven by the application interfaces it provides
148      through libdrm, the library that wraps most of the DRM ioctls.
149      These include vblank event handling, memory
150      management, output management, framebuffer management, command
151      submission &amp; fencing, suspend/resume support, and DMA
152      services.
153    </para>
154
155  <!-- Internals: driver init -->
156
157  <sect1>
158    <title>Driver Initialization</title>
159    <para>
160      At the core of every DRM driver is a <structname>drm_driver</structname>
161      structure. Drivers typically statically initialize a drm_driver structure,
162      and then pass it to <function>drm_dev_alloc()</function> to allocate a
163      device instance. After the device instance is fully initialized it can be
164      registered (which makes it accessible from userspace) using
165      <function>drm_dev_register()</function>.
166    </para>
167    <para>
168      The <structname>drm_driver</structname> structure contains static
169      information that describes the driver and features it supports, and
170      pointers to methods that the DRM core will call to implement the DRM API.
171      We will first go through the <structname>drm_driver</structname> static
172      information fields, and will then describe individual operations in
173      details as they get used in later sections.
174    </para>
175    <sect2>
176      <title>Driver Information</title>
177      <sect3>
178        <title>Driver Features</title>
179        <para>
180          Drivers inform the DRM core about their requirements and supported
181          features by setting appropriate flags in the
182          <structfield>driver_features</structfield> field. Since those flags
183          influence the DRM core behaviour since registration time, most of them
184          must be set to registering the <structname>drm_driver</structname>
185          instance.
186        </para>
187        <synopsis>u32 driver_features;</synopsis>
188        <variablelist>
189          <title>Driver Feature Flags</title>
190          <varlistentry>
191            <term>DRIVER_USE_AGP</term>
192            <listitem><para>
193              Driver uses AGP interface, the DRM core will manage AGP resources.
194            </para></listitem>
195          </varlistentry>
196          <varlistentry>
197            <term>DRIVER_REQUIRE_AGP</term>
198            <listitem><para>
199              Driver needs AGP interface to function. AGP initialization failure
200              will become a fatal error.
201            </para></listitem>
202          </varlistentry>
203          <varlistentry>
204            <term>DRIVER_PCI_DMA</term>
205            <listitem><para>
206              Driver is capable of PCI DMA, mapping of PCI DMA buffers to
207              userspace will be enabled. Deprecated.
208            </para></listitem>
209          </varlistentry>
210          <varlistentry>
211            <term>DRIVER_SG</term>
212            <listitem><para>
213              Driver can perform scatter/gather DMA, allocation and mapping of
214              scatter/gather buffers will be enabled. Deprecated.
215            </para></listitem>
216          </varlistentry>
217          <varlistentry>
218            <term>DRIVER_HAVE_DMA</term>
219            <listitem><para>
220              Driver supports DMA, the userspace DMA API will be supported.
221              Deprecated.
222            </para></listitem>
223          </varlistentry>
224          <varlistentry>
225            <term>DRIVER_HAVE_IRQ</term><term>DRIVER_IRQ_SHARED</term>
226            <listitem><para>
227              DRIVER_HAVE_IRQ indicates whether the driver has an IRQ handler
228              managed by the DRM Core. The core will support simple IRQ handler
229              installation when the flag is set. The installation process is
230              described in <xref linkend="drm-irq-registration"/>.</para>
231              <para>DRIVER_IRQ_SHARED indicates whether the device &amp; handler
232              support shared IRQs (note that this is required of PCI  drivers).
233            </para></listitem>
234          </varlistentry>
235          <varlistentry>
236            <term>DRIVER_GEM</term>
237            <listitem><para>
238              Driver use the GEM memory manager.
239            </para></listitem>
240          </varlistentry>
241          <varlistentry>
242            <term>DRIVER_MODESET</term>
243            <listitem><para>
244              Driver supports mode setting interfaces (KMS).
245            </para></listitem>
246          </varlistentry>
247          <varlistentry>
248            <term>DRIVER_PRIME</term>
249            <listitem><para>
250              Driver implements DRM PRIME buffer sharing.
251            </para></listitem>
252          </varlistentry>
253          <varlistentry>
254            <term>DRIVER_RENDER</term>
255            <listitem><para>
256              Driver supports dedicated render nodes.
257            </para></listitem>
258          </varlistentry>
259          <varlistentry>
260            <term>DRIVER_ATOMIC</term>
261            <listitem><para>
262              Driver supports atomic properties.  In this case the driver
263              must implement appropriate obj->atomic_get_property() vfuncs
264              for any modeset objects with driver specific properties.
265            </para></listitem>
266          </varlistentry>
267        </variablelist>
268      </sect3>
269      <sect3>
270        <title>Major, Minor and Patchlevel</title>
271        <synopsis>int major;
272int minor;
273int patchlevel;</synopsis>
274        <para>
275          The DRM core identifies driver versions by a major, minor and patch
276          level triplet. The information is printed to the kernel log at
277          initialization time and passed to userspace through the
278          DRM_IOCTL_VERSION ioctl.
279        </para>
280        <para>
281          The major and minor numbers are also used to verify the requested driver
282          API version passed to DRM_IOCTL_SET_VERSION. When the driver API changes
283          between minor versions, applications can call DRM_IOCTL_SET_VERSION to
284          select a specific version of the API. If the requested major isn't equal
285          to the driver major, or the requested minor is larger than the driver
286          minor, the DRM_IOCTL_SET_VERSION call will return an error. Otherwise
287          the driver's set_version() method will be called with the requested
288          version.
289        </para>
290      </sect3>
291      <sect3>
292        <title>Name, Description and Date</title>
293        <synopsis>char *name;
294char *desc;
295char *date;</synopsis>
296        <para>
297          The driver name is printed to the kernel log at initialization time,
298          used for IRQ registration and passed to userspace through
299          DRM_IOCTL_VERSION.
300        </para>
301        <para>
302          The driver description is a purely informative string passed to
303          userspace through the DRM_IOCTL_VERSION ioctl and otherwise unused by
304          the kernel.
305        </para>
306        <para>
307          The driver date, formatted as YYYYMMDD, is meant to identify the date of
308          the latest modification to the driver. However, as most drivers fail to
309          update it, its value is mostly useless. The DRM core prints it to the
310          kernel log at initialization time and passes it to userspace through the
311          DRM_IOCTL_VERSION ioctl.
312        </para>
313      </sect3>
314    </sect2>
315    <sect2>
316      <title>Device Instance and Driver Handling</title>
317<para>
318   </para><para>
319   A device instance for a drm driver is represented by struct <structname>drm_device</structname>. This
320   is allocated with <function>drm_dev_alloc</function>, usually from bus-specific -&gt;<function>probe</function>
321   callbacks implemented by the driver. The driver then needs to initialize all
322   the various subsystems for the drm device like memory management, vblank
323   handling, modesetting support and intial output configuration plus obviously
324   initialize all the corresponding hardware bits. An important part of this is
325   also calling <function>drm_dev_set_unique</function> to set the userspace-visible unique name of
326   this device instance. Finally when everything is up and running and ready for
327   userspace the device instance can be published using <function>drm_dev_register</function>.
328   </para><para>
329   There is also deprecated support for initalizing device instances using
330   bus-specific helpers and the -&gt;<function>load</function> callback. But due to
331   backwards-compatibility needs the device instance have to be published too
332   early, which requires unpretty global locking to make safe and is therefore
333   only support for existing drivers not yet converted to the new scheme.
334   </para><para>
335   When cleaning up a device instance everything needs to be done in reverse:
336   First unpublish the device instance with <function>drm_dev_unregister</function>. Then clean up
337   any other resources allocated at device initialization and drop the driver's
338   reference to <structname>drm_device</structname> using <function>drm_dev_unref</function>.
339   </para><para>
340   Note that the lifetime rules for <structname>drm_device</structname> instance has still a lot of
341   historical baggage. Hence use the reference counting provided by
342   <function>drm_dev_ref</function> and <function>drm_dev_unref</function> only carefully.
343   </para><para>
344   Also note that embedding of <structname>drm_device</structname> is currently not (yet) supported (but
345   it would be easy to add). Drivers can store driver-private data in the
346   dev_priv field of <structname>drm_device</structname>.
347</para>
348
349<!-- drivers/gpu/drm/drm_drv.c -->
350<refentry id="API-drm-put-dev">
351<refentryinfo>
352 <title>LINUX</title>
353 <productname>Kernel Hackers Manual</productname>
354 <date>July 2017</date>
355</refentryinfo>
356<refmeta>
357 <refentrytitle><phrase>drm_put_dev</phrase></refentrytitle>
358 <manvolnum>9</manvolnum>
359 <refmiscinfo class="version">4.4.14</refmiscinfo>
360</refmeta>
361<refnamediv>
362 <refname>drm_put_dev</refname>
363 <refpurpose>
364  Unregister and release a DRM device
365 </refpurpose>
366</refnamediv>
367<refsynopsisdiv>
368 <title>Synopsis</title>
369  <funcsynopsis><funcprototype>
370   <funcdef>void <function>drm_put_dev </function></funcdef>
371   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
372  </funcprototype></funcsynopsis>
373</refsynopsisdiv>
374<refsect1>
375 <title>Arguments</title>
376 <variablelist>
377  <varlistentry>
378   <term><parameter>dev</parameter></term>
379   <listitem>
380    <para>
381     DRM device
382    </para>
383   </listitem>
384  </varlistentry>
385 </variablelist>
386</refsect1>
387<refsect1>
388<title>Description</title>
389<para>
390   Called at module unload time or when a PCI device is unplugged.
391   </para><para>
392
393   Cleans up all DRM device, calling <function>drm_lastclose</function>.
394</para>
395</refsect1>
396<refsect1>
397<title>Note</title>
398<para>
399   Use of this function is deprecated. It will eventually go away
400   completely.  Please use <function>drm_dev_unregister</function> and <function>drm_dev_unref</function> explicitly
401   instead to make sure that the device isn't userspace accessible any more
402   while teardown is in progress, ensuring that userspace can't access an
403   inconsistent state.
404</para>
405</refsect1>
406</refentry>
407
408<refentry id="API-drm-dev-alloc">
409<refentryinfo>
410 <title>LINUX</title>
411 <productname>Kernel Hackers Manual</productname>
412 <date>July 2017</date>
413</refentryinfo>
414<refmeta>
415 <refentrytitle><phrase>drm_dev_alloc</phrase></refentrytitle>
416 <manvolnum>9</manvolnum>
417 <refmiscinfo class="version">4.4.14</refmiscinfo>
418</refmeta>
419<refnamediv>
420 <refname>drm_dev_alloc</refname>
421 <refpurpose>
422     Allocate new DRM device
423 </refpurpose>
424</refnamediv>
425<refsynopsisdiv>
426 <title>Synopsis</title>
427  <funcsynopsis><funcprototype>
428   <funcdef>struct drm_device * <function>drm_dev_alloc </function></funcdef>
429   <paramdef>struct drm_driver * <parameter>driver</parameter></paramdef>
430   <paramdef>struct device * <parameter>parent</parameter></paramdef>
431  </funcprototype></funcsynopsis>
432</refsynopsisdiv>
433<refsect1>
434 <title>Arguments</title>
435 <variablelist>
436  <varlistentry>
437   <term><parameter>driver</parameter></term>
438   <listitem>
439    <para>
440     DRM driver to allocate device for
441    </para>
442   </listitem>
443  </varlistentry>
444  <varlistentry>
445   <term><parameter>parent</parameter></term>
446   <listitem>
447    <para>
448     Parent device object
449    </para>
450   </listitem>
451  </varlistentry>
452 </variablelist>
453</refsect1>
454<refsect1>
455<title>Description</title>
456<para>
457   Allocate and initialize a new DRM device. No device registration is done.
458   Call <function>drm_dev_register</function> to advertice the device to user space and register it
459   with other core subsystems. This should be done last in the device
460   initialization sequence to make sure userspace can't access an inconsistent
461   state.
462   </para><para>
463
464   The initial ref-count of the object is 1. Use <function>drm_dev_ref</function> and
465   <function>drm_dev_unref</function> to take and drop further ref-counts.
466   </para><para>
467
468   Note that for purely virtual devices <parameter>parent</parameter> can be NULL.
469</para>
470</refsect1>
471<refsect1>
472<title>RETURNS</title>
473<para>
474   Pointer to new DRM device, or NULL if out of memory.
475</para>
476</refsect1>
477</refentry>
478
479<refentry id="API-drm-dev-ref">
480<refentryinfo>
481 <title>LINUX</title>
482 <productname>Kernel Hackers Manual</productname>
483 <date>July 2017</date>
484</refentryinfo>
485<refmeta>
486 <refentrytitle><phrase>drm_dev_ref</phrase></refentrytitle>
487 <manvolnum>9</manvolnum>
488 <refmiscinfo class="version">4.4.14</refmiscinfo>
489</refmeta>
490<refnamediv>
491 <refname>drm_dev_ref</refname>
492 <refpurpose>
493     Take reference of a DRM device
494 </refpurpose>
495</refnamediv>
496<refsynopsisdiv>
497 <title>Synopsis</title>
498  <funcsynopsis><funcprototype>
499   <funcdef>void <function>drm_dev_ref </function></funcdef>
500   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
501  </funcprototype></funcsynopsis>
502</refsynopsisdiv>
503<refsect1>
504 <title>Arguments</title>
505 <variablelist>
506  <varlistentry>
507   <term><parameter>dev</parameter></term>
508   <listitem>
509    <para>
510     device to take reference of or NULL
511    </para>
512   </listitem>
513  </varlistentry>
514 </variablelist>
515</refsect1>
516<refsect1>
517<title>Description</title>
518<para>
519   This increases the ref-count of <parameter>dev</parameter> by one. You *must* already own a
520   reference when calling this. Use <function>drm_dev_unref</function> to drop this reference
521   again.
522   </para><para>
523
524   This function never fails. However, this function does not provide *any*
525   guarantee whether the device is alive or running. It only provides a
526   reference to the object and the memory associated with it.
527</para>
528</refsect1>
529</refentry>
530
531<refentry id="API-drm-dev-unref">
532<refentryinfo>
533 <title>LINUX</title>
534 <productname>Kernel Hackers Manual</productname>
535 <date>July 2017</date>
536</refentryinfo>
537<refmeta>
538 <refentrytitle><phrase>drm_dev_unref</phrase></refentrytitle>
539 <manvolnum>9</manvolnum>
540 <refmiscinfo class="version">4.4.14</refmiscinfo>
541</refmeta>
542<refnamediv>
543 <refname>drm_dev_unref</refname>
544 <refpurpose>
545     Drop reference of a DRM device
546 </refpurpose>
547</refnamediv>
548<refsynopsisdiv>
549 <title>Synopsis</title>
550  <funcsynopsis><funcprototype>
551   <funcdef>void <function>drm_dev_unref </function></funcdef>
552   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
553  </funcprototype></funcsynopsis>
554</refsynopsisdiv>
555<refsect1>
556 <title>Arguments</title>
557 <variablelist>
558  <varlistentry>
559   <term><parameter>dev</parameter></term>
560   <listitem>
561    <para>
562     device to drop reference of or NULL
563    </para>
564   </listitem>
565  </varlistentry>
566 </variablelist>
567</refsect1>
568<refsect1>
569<title>Description</title>
570<para>
571   This decreases the ref-count of <parameter>dev</parameter> by one. The device is destroyed if the
572   ref-count drops to zero.
573</para>
574</refsect1>
575</refentry>
576
577<refentry id="API-drm-dev-register">
578<refentryinfo>
579 <title>LINUX</title>
580 <productname>Kernel Hackers Manual</productname>
581 <date>July 2017</date>
582</refentryinfo>
583<refmeta>
584 <refentrytitle><phrase>drm_dev_register</phrase></refentrytitle>
585 <manvolnum>9</manvolnum>
586 <refmiscinfo class="version">4.4.14</refmiscinfo>
587</refmeta>
588<refnamediv>
589 <refname>drm_dev_register</refname>
590 <refpurpose>
591     Register DRM device
592 </refpurpose>
593</refnamediv>
594<refsynopsisdiv>
595 <title>Synopsis</title>
596  <funcsynopsis><funcprototype>
597   <funcdef>int <function>drm_dev_register </function></funcdef>
598   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
599   <paramdef>unsigned long <parameter>flags</parameter></paramdef>
600  </funcprototype></funcsynopsis>
601</refsynopsisdiv>
602<refsect1>
603 <title>Arguments</title>
604 <variablelist>
605  <varlistentry>
606   <term><parameter>dev</parameter></term>
607   <listitem>
608    <para>
609     Device to register
610    </para>
611   </listitem>
612  </varlistentry>
613  <varlistentry>
614   <term><parameter>flags</parameter></term>
615   <listitem>
616    <para>
617     Flags passed to the driver's .<function>load</function> function
618    </para>
619   </listitem>
620  </varlistentry>
621 </variablelist>
622</refsect1>
623<refsect1>
624<title>Description</title>
625<para>
626   Register the DRM device <parameter>dev</parameter> with the system, advertise device to user-space
627   and start normal device operation. <parameter>dev</parameter> must be allocated via <function>drm_dev_alloc</function>
628   previously.
629   </para><para>
630
631   Never call this twice on any device!
632</para>
633</refsect1>
634<refsect1>
635<title>NOTE</title>
636<para>
637   To ensure backward compatibility with existing drivers method this
638   function calls the -&gt;<function>load</function> method after registering the device nodes,
639   creating race conditions. Usage of the -&gt;<function>load</function> methods is therefore
640   deprecated, drivers must perform all initialization before calling
641   <function>drm_dev_register</function>.
642</para>
643</refsect1>
644<refsect1>
645<title>RETURNS</title>
646<para>
647   0 on success, negative error code on failure.
648</para>
649</refsect1>
650</refentry>
651
652<refentry id="API-drm-dev-unregister">
653<refentryinfo>
654 <title>LINUX</title>
655 <productname>Kernel Hackers Manual</productname>
656 <date>July 2017</date>
657</refentryinfo>
658<refmeta>
659 <refentrytitle><phrase>drm_dev_unregister</phrase></refentrytitle>
660 <manvolnum>9</manvolnum>
661 <refmiscinfo class="version">4.4.14</refmiscinfo>
662</refmeta>
663<refnamediv>
664 <refname>drm_dev_unregister</refname>
665 <refpurpose>
666     Unregister DRM device
667 </refpurpose>
668</refnamediv>
669<refsynopsisdiv>
670 <title>Synopsis</title>
671  <funcsynopsis><funcprototype>
672   <funcdef>void <function>drm_dev_unregister </function></funcdef>
673   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
674  </funcprototype></funcsynopsis>
675</refsynopsisdiv>
676<refsect1>
677 <title>Arguments</title>
678 <variablelist>
679  <varlistentry>
680   <term><parameter>dev</parameter></term>
681   <listitem>
682    <para>
683     Device to unregister
684    </para>
685   </listitem>
686  </varlistentry>
687 </variablelist>
688</refsect1>
689<refsect1>
690<title>Description</title>
691<para>
692   Unregister the DRM device from the system. This does the reverse of
693   <function>drm_dev_register</function> but does not deallocate the device. The caller must call
694   <function>drm_dev_unref</function> to drop their final reference.
695   </para><para>
696
697   This should be called first in the device teardown code to make sure
698   userspace can't access the device instance any more.
699</para>
700</refsect1>
701</refentry>
702
703<refentry id="API-drm-dev-set-unique">
704<refentryinfo>
705 <title>LINUX</title>
706 <productname>Kernel Hackers Manual</productname>
707 <date>July 2017</date>
708</refentryinfo>
709<refmeta>
710 <refentrytitle><phrase>drm_dev_set_unique</phrase></refentrytitle>
711 <manvolnum>9</manvolnum>
712 <refmiscinfo class="version">4.4.14</refmiscinfo>
713</refmeta>
714<refnamediv>
715 <refname>drm_dev_set_unique</refname>
716 <refpurpose>
717     Set the unique name of a DRM device
718 </refpurpose>
719</refnamediv>
720<refsynopsisdiv>
721 <title>Synopsis</title>
722  <funcsynopsis><funcprototype>
723   <funcdef>int <function>drm_dev_set_unique </function></funcdef>
724   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
725   <paramdef>const char * <parameter>fmt</parameter></paramdef>
726   <paramdef> <parameter>...</parameter></paramdef>
727  </funcprototype></funcsynopsis>
728</refsynopsisdiv>
729<refsect1>
730 <title>Arguments</title>
731 <variablelist>
732  <varlistentry>
733   <term><parameter>dev</parameter></term>
734   <listitem>
735    <para>
736     device of which to set the unique name
737    </para>
738   </listitem>
739  </varlistentry>
740  <varlistentry>
741   <term><parameter>fmt</parameter></term>
742   <listitem>
743    <para>
744     format string for unique name
745    </para>
746   </listitem>
747  </varlistentry>
748  <varlistentry>
749   <term><parameter>...</parameter></term>
750   <listitem>
751    <para>
752     variable arguments
753    </para>
754   </listitem>
755  </varlistentry>
756 </variablelist>
757</refsect1>
758<refsect1>
759<title>Description</title>
760<para>
761   Sets the unique name of a DRM device using the specified format string and
762   a variable list of arguments. Drivers can use this at driver probe time if
763   the unique name of the devices they drive is static.
764</para>
765</refsect1>
766<refsect1>
767<title>Return</title>
768<para>
769   0 on success or a negative error code on failure.
770</para>
771</refsect1>
772</refentry>
773
774    </sect2>
775    <sect2>
776      <title>Driver Load</title>
777      <sect3 id="drm-irq-registration">
778        <title>IRQ Registration</title>
779        <para>
780          The DRM core tries to facilitate IRQ handler registration and
781          unregistration by providing <function>drm_irq_install</function> and
782          <function>drm_irq_uninstall</function> functions. Those functions only
783          support a single interrupt per device, devices that use more than one
784          IRQs need to be handled manually.
785        </para>
786        <sect4>
787          <title>Managed IRQ Registration</title>
788          <para>
789            <function>drm_irq_install</function> starts by calling the
790            <methodname>irq_preinstall</methodname> driver operation. The operation
791            is optional and must make sure that the interrupt will not get fired by
792            clearing all pending interrupt flags or disabling the interrupt.
793          </para>
794          <para>
795            The passed-in IRQ will then be requested by a call to
796            <function>request_irq</function>. If the DRIVER_IRQ_SHARED driver
797            feature flag is set, a shared (IRQF_SHARED) IRQ handler will be
798            requested.
799          </para>
800          <para>
801            The IRQ handler function must be provided as the mandatory irq_handler
802            driver operation. It will get passed directly to
803            <function>request_irq</function> and thus has the same prototype as all
804            IRQ handlers. It will get called with a pointer to the DRM device as the
805            second argument.
806          </para>
807          <para>
808            Finally the function calls the optional
809            <methodname>irq_postinstall</methodname> driver operation. The operation
810            usually enables interrupts (excluding the vblank interrupt, which is
811            enabled separately), but drivers may choose to enable/disable interrupts
812            at a different time.
813          </para>
814          <para>
815            <function>drm_irq_uninstall</function> is similarly used to uninstall an
816            IRQ handler. It starts by waking up all processes waiting on a vblank
817            interrupt to make sure they don't hang, and then calls the optional
818            <methodname>irq_uninstall</methodname> driver operation. The operation
819            must disable all hardware interrupts. Finally the function frees the IRQ
820            by calling <function>free_irq</function>.
821          </para>
822        </sect4>
823        <sect4>
824          <title>Manual IRQ Registration</title>
825          <para>
826            Drivers that require multiple interrupt handlers can't use the managed
827            IRQ registration functions. In that case IRQs must be registered and
828            unregistered manually (usually with the <function>request_irq</function>
829            and <function>free_irq</function> functions, or their devm_* equivalent).
830          </para>
831          <para>
832            When manually registering IRQs, drivers must not set the DRIVER_HAVE_IRQ
833            driver feature flag, and must not provide the
834	    <methodname>irq_handler</methodname> driver operation. They must set the
835	    <structname>drm_device</structname> <structfield>irq_enabled</structfield>
836	    field to 1 upon registration of the IRQs, and clear it to 0 after
837	    unregistering the IRQs.
838          </para>
839        </sect4>
840      </sect3>
841      <sect3>
842        <title>Memory Manager Initialization</title>
843        <para>
844          Every DRM driver requires a memory manager which must be initialized at
845          load time. DRM currently contains two memory managers, the Translation
846          Table Manager (TTM) and the Graphics Execution Manager (GEM).
847          This document describes the use of the GEM memory manager only. See
848          <xref linkend="drm-memory-management"/> for details.
849        </para>
850      </sect3>
851      <sect3>
852        <title>Miscellaneous Device Configuration</title>
853        <para>
854          Another task that may be necessary for PCI devices during configuration
855          is mapping the video BIOS. On many devices, the VBIOS describes device
856          configuration, LCD panel timings (if any), and contains flags indicating
857          device state. Mapping the BIOS can be done using the pci_map_rom() call,
858          a convenience function that takes care of mapping the actual ROM,
859          whether it has been shadowed into memory (typically at address 0xc0000)
860          or exists on the PCI device in the ROM BAR. Note that after the ROM has
861          been mapped and any necessary information has been extracted, it should
862          be unmapped; on many devices, the ROM address decoder is shared with
863          other BARs, so leaving it mapped could cause undesired behaviour like
864          hangs or memory corruption.
865  <!--!Fdrivers/pci/rom.c pci_map_rom-->
866        </para>
867      </sect3>
868    </sect2>
869    <sect2>
870      <title>Bus-specific Device Registration and PCI Support</title>
871      <para>
872        A number of functions are provided to help with device registration.
873	The functions deal with PCI and platform devices respectively and are
874	only provided for historical reasons. These are all deprecated and
875	shouldn't be used in new drivers. Besides that there's a few
876	helpers for pci drivers.
877      </para>
878<!-- drivers/gpu/drm/drm_pci.c -->
879<refentry id="API-drm-pci-alloc">
880<refentryinfo>
881 <title>LINUX</title>
882 <productname>Kernel Hackers Manual</productname>
883 <date>July 2017</date>
884</refentryinfo>
885<refmeta>
886 <refentrytitle><phrase>drm_pci_alloc</phrase></refentrytitle>
887 <manvolnum>9</manvolnum>
888 <refmiscinfo class="version">4.4.14</refmiscinfo>
889</refmeta>
890<refnamediv>
891 <refname>drm_pci_alloc</refname>
892 <refpurpose>
893  Allocate a PCI consistent memory block, for DMA.
894 </refpurpose>
895</refnamediv>
896<refsynopsisdiv>
897 <title>Synopsis</title>
898  <funcsynopsis><funcprototype>
899   <funcdef>drm_dma_handle_t * <function>drm_pci_alloc </function></funcdef>
900   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
901   <paramdef>size_t <parameter>size</parameter></paramdef>
902   <paramdef>size_t <parameter>align</parameter></paramdef>
903  </funcprototype></funcsynopsis>
904</refsynopsisdiv>
905<refsect1>
906 <title>Arguments</title>
907 <variablelist>
908  <varlistentry>
909   <term><parameter>dev</parameter></term>
910   <listitem>
911    <para>
912     DRM device
913    </para>
914   </listitem>
915  </varlistentry>
916  <varlistentry>
917   <term><parameter>size</parameter></term>
918   <listitem>
919    <para>
920     size of block to allocate
921    </para>
922   </listitem>
923  </varlistentry>
924  <varlistentry>
925   <term><parameter>align</parameter></term>
926   <listitem>
927    <para>
928     alignment of block
929    </para>
930   </listitem>
931  </varlistentry>
932 </variablelist>
933</refsect1>
934<refsect1>
935<title>Return</title>
936<para>
937   A handle to the allocated memory block on success or NULL on
938   failure.
939</para>
940</refsect1>
941</refentry>
942
943<refentry id="API-drm-pci-free">
944<refentryinfo>
945 <title>LINUX</title>
946 <productname>Kernel Hackers Manual</productname>
947 <date>July 2017</date>
948</refentryinfo>
949<refmeta>
950 <refentrytitle><phrase>drm_pci_free</phrase></refentrytitle>
951 <manvolnum>9</manvolnum>
952 <refmiscinfo class="version">4.4.14</refmiscinfo>
953</refmeta>
954<refnamediv>
955 <refname>drm_pci_free</refname>
956 <refpurpose>
957     Free a PCI consistent memory block
958 </refpurpose>
959</refnamediv>
960<refsynopsisdiv>
961 <title>Synopsis</title>
962  <funcsynopsis><funcprototype>
963   <funcdef>void <function>drm_pci_free </function></funcdef>
964   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
965   <paramdef>drm_dma_handle_t * <parameter>dmah</parameter></paramdef>
966  </funcprototype></funcsynopsis>
967</refsynopsisdiv>
968<refsect1>
969 <title>Arguments</title>
970 <variablelist>
971  <varlistentry>
972   <term><parameter>dev</parameter></term>
973   <listitem>
974    <para>
975     DRM device
976    </para>
977   </listitem>
978  </varlistentry>
979  <varlistentry>
980   <term><parameter>dmah</parameter></term>
981   <listitem>
982    <para>
983     handle to memory block
984    </para>
985   </listitem>
986  </varlistentry>
987 </variablelist>
988</refsect1>
989</refentry>
990
991<refentry id="API-drm-get-pci-dev">
992<refentryinfo>
993 <title>LINUX</title>
994 <productname>Kernel Hackers Manual</productname>
995 <date>July 2017</date>
996</refentryinfo>
997<refmeta>
998 <refentrytitle><phrase>drm_get_pci_dev</phrase></refentrytitle>
999 <manvolnum>9</manvolnum>
1000 <refmiscinfo class="version">4.4.14</refmiscinfo>
1001</refmeta>
1002<refnamediv>
1003 <refname>drm_get_pci_dev</refname>
1004 <refpurpose>
1005     Register a PCI device with the DRM subsystem
1006 </refpurpose>
1007</refnamediv>
1008<refsynopsisdiv>
1009 <title>Synopsis</title>
1010  <funcsynopsis><funcprototype>
1011   <funcdef>int <function>drm_get_pci_dev </function></funcdef>
1012   <paramdef>struct pci_dev * <parameter>pdev</parameter></paramdef>
1013   <paramdef>const struct pci_device_id * <parameter>ent</parameter></paramdef>
1014   <paramdef>struct drm_driver * <parameter>driver</parameter></paramdef>
1015  </funcprototype></funcsynopsis>
1016</refsynopsisdiv>
1017<refsect1>
1018 <title>Arguments</title>
1019 <variablelist>
1020  <varlistentry>
1021   <term><parameter>pdev</parameter></term>
1022   <listitem>
1023    <para>
1024     PCI device
1025    </para>
1026   </listitem>
1027  </varlistentry>
1028  <varlistentry>
1029   <term><parameter>ent</parameter></term>
1030   <listitem>
1031    <para>
1032     entry from the PCI ID table that matches <parameter>pdev</parameter>
1033    </para>
1034   </listitem>
1035  </varlistentry>
1036  <varlistentry>
1037   <term><parameter>driver</parameter></term>
1038   <listitem>
1039    <para>
1040     DRM device driver
1041    </para>
1042   </listitem>
1043  </varlistentry>
1044 </variablelist>
1045</refsect1>
1046<refsect1>
1047<title>Description</title>
1048<para>
1049   Attempt to gets inter module <quote>drm</quote> information. If we are first
1050   then register the character device and inter module information.
1051   Try and register, if we fail to register, backout previous work.
1052</para>
1053</refsect1>
1054<refsect1>
1055<title>NOTE</title>
1056<para>
1057   This function is deprecated, please use <function>drm_dev_alloc</function> and
1058   <function>drm_dev_register</function> instead and remove your -&gt;<function>load</function> callback.
1059</para>
1060</refsect1>
1061<refsect1>
1062<title>Return</title>
1063<para>
1064   0 on success or a negative error code on failure.
1065</para>
1066</refsect1>
1067</refentry>
1068
1069<refentry id="API-drm-pci-init">
1070<refentryinfo>
1071 <title>LINUX</title>
1072 <productname>Kernel Hackers Manual</productname>
1073 <date>July 2017</date>
1074</refentryinfo>
1075<refmeta>
1076 <refentrytitle><phrase>drm_pci_init</phrase></refentrytitle>
1077 <manvolnum>9</manvolnum>
1078 <refmiscinfo class="version">4.4.14</refmiscinfo>
1079</refmeta>
1080<refnamediv>
1081 <refname>drm_pci_init</refname>
1082 <refpurpose>
1083     Register matching PCI devices with the DRM subsystem
1084 </refpurpose>
1085</refnamediv>
1086<refsynopsisdiv>
1087 <title>Synopsis</title>
1088  <funcsynopsis><funcprototype>
1089   <funcdef>int <function>drm_pci_init </function></funcdef>
1090   <paramdef>struct drm_driver * <parameter>driver</parameter></paramdef>
1091   <paramdef>struct pci_driver * <parameter>pdriver</parameter></paramdef>
1092  </funcprototype></funcsynopsis>
1093</refsynopsisdiv>
1094<refsect1>
1095 <title>Arguments</title>
1096 <variablelist>
1097  <varlistentry>
1098   <term><parameter>driver</parameter></term>
1099   <listitem>
1100    <para>
1101     DRM device driver
1102    </para>
1103   </listitem>
1104  </varlistentry>
1105  <varlistentry>
1106   <term><parameter>pdriver</parameter></term>
1107   <listitem>
1108    <para>
1109     PCI device driver
1110    </para>
1111   </listitem>
1112  </varlistentry>
1113 </variablelist>
1114</refsect1>
1115<refsect1>
1116<title>Description</title>
1117<para>
1118   Initializes a drm_device structures, registering the stubs and initializing
1119   the AGP device.
1120</para>
1121</refsect1>
1122<refsect1>
1123<title>NOTE</title>
1124<para>
1125   This function is deprecated. Modern modesetting drm drivers should use
1126   <function>pci_register_driver</function> directly, this function only provides shadow-binding
1127   support for old legacy drivers on top of that core pci function.
1128</para>
1129</refsect1>
1130<refsect1>
1131<title>Return</title>
1132<para>
1133   0 on success or a negative error code on failure.
1134</para>
1135</refsect1>
1136</refentry>
1137
1138<refentry id="API-drm-pci-exit">
1139<refentryinfo>
1140 <title>LINUX</title>
1141 <productname>Kernel Hackers Manual</productname>
1142 <date>July 2017</date>
1143</refentryinfo>
1144<refmeta>
1145 <refentrytitle><phrase>drm_pci_exit</phrase></refentrytitle>
1146 <manvolnum>9</manvolnum>
1147 <refmiscinfo class="version">4.4.14</refmiscinfo>
1148</refmeta>
1149<refnamediv>
1150 <refname>drm_pci_exit</refname>
1151 <refpurpose>
1152     Unregister matching PCI devices from the DRM subsystem
1153 </refpurpose>
1154</refnamediv>
1155<refsynopsisdiv>
1156 <title>Synopsis</title>
1157  <funcsynopsis><funcprototype>
1158   <funcdef>void <function>drm_pci_exit </function></funcdef>
1159   <paramdef>struct drm_driver * <parameter>driver</parameter></paramdef>
1160   <paramdef>struct pci_driver * <parameter>pdriver</parameter></paramdef>
1161  </funcprototype></funcsynopsis>
1162</refsynopsisdiv>
1163<refsect1>
1164 <title>Arguments</title>
1165 <variablelist>
1166  <varlistentry>
1167   <term><parameter>driver</parameter></term>
1168   <listitem>
1169    <para>
1170     DRM device driver
1171    </para>
1172   </listitem>
1173  </varlistentry>
1174  <varlistentry>
1175   <term><parameter>pdriver</parameter></term>
1176   <listitem>
1177    <para>
1178     PCI device driver
1179    </para>
1180   </listitem>
1181  </varlistentry>
1182 </variablelist>
1183</refsect1>
1184<refsect1>
1185<title>Description</title>
1186<para>
1187   Unregisters one or more devices matched by a PCI driver from the DRM
1188   subsystem.
1189</para>
1190</refsect1>
1191<refsect1>
1192<title>NOTE</title>
1193<para>
1194   This function is deprecated. Modern modesetting drm drivers should use
1195   <function>pci_unregister_driver</function> directly, this function only provides shadow-binding
1196   support for old legacy drivers on top of that core pci function.
1197</para>
1198</refsect1>
1199</refentry>
1200
1201<!-- drivers/gpu/drm/drm_platform.c -->
1202<refentry id="API-drm-platform-init">
1203<refentryinfo>
1204 <title>LINUX</title>
1205 <productname>Kernel Hackers Manual</productname>
1206 <date>July 2017</date>
1207</refentryinfo>
1208<refmeta>
1209 <refentrytitle><phrase>drm_platform_init</phrase></refentrytitle>
1210 <manvolnum>9</manvolnum>
1211 <refmiscinfo class="version">4.4.14</refmiscinfo>
1212</refmeta>
1213<refnamediv>
1214 <refname>drm_platform_init</refname>
1215 <refpurpose>
1216  Register a platform device with the DRM subsystem
1217 </refpurpose>
1218</refnamediv>
1219<refsynopsisdiv>
1220 <title>Synopsis</title>
1221  <funcsynopsis><funcprototype>
1222   <funcdef>int <function>drm_platform_init </function></funcdef>
1223   <paramdef>struct drm_driver * <parameter>driver</parameter></paramdef>
1224   <paramdef>struct platform_device * <parameter>platform_device</parameter></paramdef>
1225  </funcprototype></funcsynopsis>
1226</refsynopsisdiv>
1227<refsect1>
1228 <title>Arguments</title>
1229 <variablelist>
1230  <varlistentry>
1231   <term><parameter>driver</parameter></term>
1232   <listitem>
1233    <para>
1234     DRM device driver
1235    </para>
1236   </listitem>
1237  </varlistentry>
1238  <varlistentry>
1239   <term><parameter>platform_device</parameter></term>
1240   <listitem>
1241    <para>
1242     platform device to register
1243    </para>
1244   </listitem>
1245  </varlistentry>
1246 </variablelist>
1247</refsect1>
1248<refsect1>
1249<title>Description</title>
1250<para>
1251   Registers the specified DRM device driver and platform device with the DRM
1252   subsystem, initializing a drm_device structure and calling the driver's
1253   .<function>load</function> function.
1254</para>
1255</refsect1>
1256<refsect1>
1257<title>NOTE</title>
1258<para>
1259   This function is deprecated, please use <function>drm_dev_alloc</function> and
1260   <function>drm_dev_register</function> instead and remove your -&gt;<function>load</function> callback.
1261</para>
1262</refsect1>
1263<refsect1>
1264<title>Return</title>
1265<para>
1266   0 on success or a negative error code on failure.
1267</para>
1268</refsect1>
1269</refentry>
1270
1271    </sect2>
1272  </sect1>
1273
1274  <!-- Internals: memory management -->
1275
1276  <sect1 id="drm-memory-management">
1277    <title>Memory management</title>
1278    <para>
1279      Modern Linux systems require large amount of graphics memory to store
1280      frame buffers, textures, vertices and other graphics-related data. Given
1281      the very dynamic nature of many of that data, managing graphics memory
1282      efficiently is thus crucial for the graphics stack and plays a central
1283      role in the DRM infrastructure.
1284    </para>
1285    <para>
1286      The DRM core includes two memory managers, namely Translation Table Maps
1287      (TTM) and Graphics Execution Manager (GEM). TTM was the first DRM memory
1288      manager to be developed and tried to be a one-size-fits-them all
1289      solution. It provides a single userspace API to accommodate the need of
1290      all hardware, supporting both Unified Memory Architecture (UMA) devices
1291      and devices with dedicated video RAM (i.e. most discrete video cards).
1292      This resulted in a large, complex piece of code that turned out to be
1293      hard to use for driver development.
1294    </para>
1295    <para>
1296      GEM started as an Intel-sponsored project in reaction to TTM's
1297      complexity. Its design philosophy is completely different: instead of
1298      providing a solution to every graphics memory-related problems, GEM
1299      identified common code between drivers and created a support library to
1300      share it. GEM has simpler initialization and execution requirements than
1301      TTM, but has no video RAM management capabilities and is thus limited to
1302      UMA devices.
1303    </para>
1304    <sect2>
1305      <title>The Translation Table Manager (TTM)</title>
1306      <para>
1307        TTM design background and information belongs here.
1308      </para>
1309      <sect3>
1310        <title>TTM initialization</title>
1311        <warning><para>This section is outdated.</para></warning>
1312        <para>
1313          Drivers wishing to support TTM must fill out a drm_bo_driver
1314          structure. The structure contains several fields with function
1315          pointers for initializing the TTM, allocating and freeing memory,
1316          waiting for command completion and fence synchronization, and memory
1317          migration. See the radeon_ttm.c file for an example of usage.
1318        </para>
1319        <para>
1320          The ttm_global_reference structure is made up of several fields:
1321        </para>
1322        <programlisting>
1323          struct ttm_global_reference {
1324                  enum ttm_global_types global_type;
1325                  size_t size;
1326                  void *object;
1327                  int (*init) (struct ttm_global_reference *);
1328                  void (*release) (struct ttm_global_reference *);
1329          };
1330        </programlisting>
1331        <para>
1332          There should be one global reference structure for your memory
1333          manager as a whole, and there will be others for each object
1334          created by the memory manager at runtime.  Your global TTM should
1335          have a type of TTM_GLOBAL_TTM_MEM.  The size field for the global
1336          object should be sizeof(struct ttm_mem_global), and the init and
1337          release hooks should point at your driver-specific init and
1338          release routines, which probably eventually call
1339          ttm_mem_global_init and ttm_mem_global_release, respectively.
1340        </para>
1341        <para>
1342          Once your global TTM accounting structure is set up and initialized
1343          by calling ttm_global_item_ref() on it,
1344          you need to create a buffer object TTM to
1345          provide a pool for buffer object allocation by clients and the
1346          kernel itself.  The type of this object should be TTM_GLOBAL_TTM_BO,
1347          and its size should be sizeof(struct ttm_bo_global).  Again,
1348          driver-specific init and release functions may be provided,
1349          likely eventually calling ttm_bo_global_init() and
1350          ttm_bo_global_release(), respectively.  Also, like the previous
1351          object, ttm_global_item_ref() is used to create an initial reference
1352          count for the TTM, which will call your initialization function.
1353        </para>
1354      </sect3>
1355    </sect2>
1356    <sect2 id="drm-gem">
1357      <title>The Graphics Execution Manager (GEM)</title>
1358      <para>
1359        The GEM design approach has resulted in a memory manager that doesn't
1360        provide full coverage of all (or even all common) use cases in its
1361        userspace or kernel API. GEM exposes a set of standard memory-related
1362        operations to userspace and a set of helper functions to drivers, and let
1363        drivers implement hardware-specific operations with their own private API.
1364      </para>
1365      <para>
1366        The GEM userspace API is described in the
1367        <ulink url="http://lwn.net/Articles/283798/"><citetitle>GEM - the Graphics
1368        Execution Manager</citetitle></ulink> article on LWN. While slightly
1369        outdated, the document provides a good overview of the GEM API principles.
1370        Buffer allocation and read and write operations, described as part of the
1371        common GEM API, are currently implemented using driver-specific ioctls.
1372      </para>
1373      <para>
1374        GEM is data-agnostic. It manages abstract buffer objects without knowing
1375        what individual buffers contain. APIs that require knowledge of buffer
1376        contents or purpose, such as buffer allocation or synchronization
1377        primitives, are thus outside of the scope of GEM and must be implemented
1378        using driver-specific ioctls.
1379      </para>
1380      <para>
1381        On a fundamental level, GEM involves several operations:
1382        <itemizedlist>
1383          <listitem>Memory allocation and freeing</listitem>
1384          <listitem>Command execution</listitem>
1385          <listitem>Aperture management at command execution time</listitem>
1386        </itemizedlist>
1387        Buffer object allocation is relatively straightforward and largely
1388        provided by Linux's shmem layer, which provides memory to back each
1389        object.
1390      </para>
1391      <para>
1392        Device-specific operations, such as command execution, pinning, buffer
1393        read &amp; write, mapping, and domain ownership transfers are left to
1394        driver-specific ioctls.
1395      </para>
1396      <sect3>
1397        <title>GEM Initialization</title>
1398        <para>
1399          Drivers that use GEM must set the DRIVER_GEM bit in the struct
1400          <structname>drm_driver</structname>
1401          <structfield>driver_features</structfield> field. The DRM core will
1402          then automatically initialize the GEM core before calling the
1403          <methodname>load</methodname> operation. Behind the scene, this will
1404          create a DRM Memory Manager object which provides an address space
1405          pool for object allocation.
1406        </para>
1407        <para>
1408          In a KMS configuration, drivers need to allocate and initialize a
1409          command ring buffer following core GEM initialization if required by
1410          the hardware. UMA devices usually have what is called a "stolen"
1411          memory region, which provides space for the initial framebuffer and
1412          large, contiguous memory regions required by the device. This space is
1413          typically not managed by GEM, and must be initialized separately into
1414          its own DRM MM object.
1415        </para>
1416      </sect3>
1417      <sect3>
1418        <title>GEM Objects Creation</title>
1419        <para>
1420          GEM splits creation of GEM objects and allocation of the memory that
1421          backs them in two distinct operations.
1422        </para>
1423        <para>
1424          GEM objects are represented by an instance of struct
1425          <structname>drm_gem_object</structname>. Drivers usually need to extend
1426          GEM objects with private information and thus create a driver-specific
1427          GEM object structure type that embeds an instance of struct
1428          <structname>drm_gem_object</structname>.
1429        </para>
1430        <para>
1431          To create a GEM object, a driver allocates memory for an instance of its
1432          specific GEM object type and initializes the embedded struct
1433          <structname>drm_gem_object</structname> with a call to
1434          <function>drm_gem_object_init</function>. The function takes a pointer to
1435          the DRM device, a pointer to the GEM object and the buffer object size
1436          in bytes.
1437        </para>
1438        <para>
1439          GEM uses shmem to allocate anonymous pageable memory.
1440          <function>drm_gem_object_init</function> will create an shmfs file of
1441          the requested size and store it into the struct
1442          <structname>drm_gem_object</structname> <structfield>filp</structfield>
1443          field. The memory is used as either main storage for the object when the
1444          graphics hardware uses system memory directly or as a backing store
1445          otherwise.
1446        </para>
1447        <para>
1448          Drivers are responsible for the actual physical pages allocation by
1449          calling <function>shmem_read_mapping_page_gfp</function> for each page.
1450          Note that they can decide to allocate pages when initializing the GEM
1451          object, or to delay allocation until the memory is needed (for instance
1452          when a page fault occurs as a result of a userspace memory access or
1453          when the driver needs to start a DMA transfer involving the memory).
1454        </para>
1455        <para>
1456          Anonymous pageable memory allocation is not always desired, for instance
1457          when the hardware requires physically contiguous system memory as is
1458          often the case in embedded devices. Drivers can create GEM objects with
1459          no shmfs backing (called private GEM objects) by initializing them with
1460          a call to <function>drm_gem_private_object_init</function> instead of
1461          <function>drm_gem_object_init</function>. Storage for private GEM
1462          objects must be managed by drivers.
1463        </para>
1464        <para>
1465          Drivers that do not need to extend GEM objects with private information
1466          can call the <function>drm_gem_object_alloc</function> function to
1467          allocate and initialize a struct <structname>drm_gem_object</structname>
1468          instance. The GEM core will call the optional driver
1469          <methodname>gem_init_object</methodname> operation after initializing
1470          the GEM object with <function>drm_gem_object_init</function>.
1471          <synopsis>int (*gem_init_object) (struct drm_gem_object *obj);</synopsis>
1472        </para>
1473        <para>
1474          No alloc-and-init function exists for private GEM objects.
1475        </para>
1476      </sect3>
1477      <sect3>
1478        <title>GEM Objects Lifetime</title>
1479        <para>
1480          All GEM objects are reference-counted by the GEM core. References can be
1481          acquired and release by <function>calling drm_gem_object_reference</function>
1482          and <function>drm_gem_object_unreference</function> respectively. The
1483          caller must hold the <structname>drm_device</structname>
1484          <structfield>struct_mutex</structfield> lock. As a convenience, GEM
1485          provides the <function>drm_gem_object_reference_unlocked</function> and
1486          <function>drm_gem_object_unreference_unlocked</function> functions that
1487          can be called without holding the lock.
1488        </para>
1489        <para>
1490          When the last reference to a GEM object is released the GEM core calls
1491          the <structname>drm_driver</structname>
1492          <methodname>gem_free_object</methodname> operation. That operation is
1493          mandatory for GEM-enabled drivers and must free the GEM object and all
1494          associated resources.
1495        </para>
1496        <para>
1497          <synopsis>void (*gem_free_object) (struct drm_gem_object *obj);</synopsis>
1498          Drivers are responsible for freeing all GEM object resources, including
1499          the resources created by the GEM core. If an mmap offset has been
1500          created for the object (in which case
1501          <structname>drm_gem_object</structname>::<structfield>map_list</structfield>::<structfield>map</structfield>
1502          is not NULL) it must be freed by a call to
1503          <function>drm_gem_free_mmap_offset</function>. The shmfs backing store
1504          must be released by calling <function>drm_gem_object_release</function>
1505          (that function can safely be called if no shmfs backing store has been
1506          created).
1507        </para>
1508      </sect3>
1509      <sect3>
1510        <title>GEM Objects Naming</title>
1511        <para>
1512          Communication between userspace and the kernel refers to GEM objects
1513          using local handles, global names or, more recently, file descriptors.
1514          All of those are 32-bit integer values; the usual Linux kernel limits
1515          apply to the file descriptors.
1516        </para>
1517        <para>
1518          GEM handles are local to a DRM file. Applications get a handle to a GEM
1519          object through a driver-specific ioctl, and can use that handle to refer
1520          to the GEM object in other standard or driver-specific ioctls. Closing a
1521          DRM file handle frees all its GEM handles and dereferences the
1522          associated GEM objects.
1523        </para>
1524        <para>
1525          To create a handle for a GEM object drivers call
1526          <function>drm_gem_handle_create</function>. The function takes a pointer
1527          to the DRM file and the GEM object and returns a locally unique handle.
1528          When the handle is no longer needed drivers delete it with a call to
1529          <function>drm_gem_handle_delete</function>. Finally the GEM object
1530          associated with a handle can be retrieved by a call to
1531          <function>drm_gem_object_lookup</function>.
1532        </para>
1533        <para>
1534          Handles don't take ownership of GEM objects, they only take a reference
1535          to the object that will be dropped when the handle is destroyed. To
1536          avoid leaking GEM objects, drivers must make sure they drop the
1537          reference(s) they own (such as the initial reference taken at object
1538          creation time) as appropriate, without any special consideration for the
1539          handle. For example, in the particular case of combined GEM object and
1540          handle creation in the implementation of the
1541          <methodname>dumb_create</methodname> operation, drivers must drop the
1542          initial reference to the GEM object before returning the handle.
1543        </para>
1544        <para>
1545          GEM names are similar in purpose to handles but are not local to DRM
1546          files. They can be passed between processes to reference a GEM object
1547          globally. Names can't be used directly to refer to objects in the DRM
1548          API, applications must convert handles to names and names to handles
1549          using the DRM_IOCTL_GEM_FLINK and DRM_IOCTL_GEM_OPEN ioctls
1550          respectively. The conversion is handled by the DRM core without any
1551          driver-specific support.
1552        </para>
1553        <para>
1554          GEM also supports buffer sharing with dma-buf file descriptors through
1555          PRIME. GEM-based drivers must use the provided helpers functions to
1556          implement the exporting and importing correctly. See <xref linkend="drm-prime-support" />.
1557          Since sharing file descriptors is inherently more secure than the
1558          easily guessable and global GEM names it is the preferred buffer
1559          sharing mechanism. Sharing buffers through GEM names is only supported
1560          for legacy userspace. Furthermore PRIME also allows cross-device
1561          buffer sharing since it is based on dma-bufs.
1562        </para>
1563      </sect3>
1564      <sect3 id="drm-gem-objects-mapping">
1565        <title>GEM Objects Mapping</title>
1566        <para>
1567          Because mapping operations are fairly heavyweight GEM favours
1568          read/write-like access to buffers, implemented through driver-specific
1569          ioctls, over mapping buffers to userspace. However, when random access
1570          to the buffer is needed (to perform software rendering for instance),
1571          direct access to the object can be more efficient.
1572        </para>
1573        <para>
1574          The mmap system call can't be used directly to map GEM objects, as they
1575          don't have their own file handle. Two alternative methods currently
1576          co-exist to map GEM objects to userspace. The first method uses a
1577          driver-specific ioctl to perform the mapping operation, calling
1578          <function>do_mmap</function> under the hood. This is often considered
1579          dubious, seems to be discouraged for new GEM-enabled drivers, and will
1580          thus not be described here.
1581        </para>
1582        <para>
1583          The second method uses the mmap system call on the DRM file handle.
1584          <synopsis>void *mmap(void *addr, size_t length, int prot, int flags, int fd,
1585             off_t offset);</synopsis>
1586          DRM identifies the GEM object to be mapped by a fake offset passed
1587          through the mmap offset argument. Prior to being mapped, a GEM object
1588          must thus be associated with a fake offset. To do so, drivers must call
1589          <function>drm_gem_create_mmap_offset</function> on the object. The
1590          function allocates a fake offset range from a pool and stores the
1591          offset divided by PAGE_SIZE in
1592          <literal>obj-&gt;map_list.hash.key</literal>. Care must be taken not to
1593          call <function>drm_gem_create_mmap_offset</function> if a fake offset
1594          has already been allocated for the object. This can be tested by
1595          <literal>obj-&gt;map_list.map</literal> being non-NULL.
1596        </para>
1597        <para>
1598          Once allocated, the fake offset value
1599          (<literal>obj-&gt;map_list.hash.key &lt;&lt; PAGE_SHIFT</literal>)
1600          must be passed to the application in a driver-specific way and can then
1601          be used as the mmap offset argument.
1602        </para>
1603        <para>
1604          The GEM core provides a helper method <function>drm_gem_mmap</function>
1605          to handle object mapping. The method can be set directly as the mmap
1606          file operation handler. It will look up the GEM object based on the
1607          offset value and set the VMA operations to the
1608          <structname>drm_driver</structname> <structfield>gem_vm_ops</structfield>
1609          field. Note that <function>drm_gem_mmap</function> doesn't map memory to
1610          userspace, but relies on the driver-provided fault handler to map pages
1611          individually.
1612        </para>
1613        <para>
1614          To use <function>drm_gem_mmap</function>, drivers must fill the struct
1615          <structname>drm_driver</structname> <structfield>gem_vm_ops</structfield>
1616          field with a pointer to VM operations.
1617        </para>
1618        <para>
1619          <synopsis>struct vm_operations_struct *gem_vm_ops
1620
1621  struct vm_operations_struct {
1622          void (*open)(struct vm_area_struct * area);
1623          void (*close)(struct vm_area_struct * area);
1624          int (*fault)(struct vm_area_struct *vma, struct vm_fault *vmf);
1625  };</synopsis>
1626        </para>
1627        <para>
1628          The <methodname>open</methodname> and <methodname>close</methodname>
1629          operations must update the GEM object reference count. Drivers can use
1630          the <function>drm_gem_vm_open</function> and
1631          <function>drm_gem_vm_close</function> helper functions directly as open
1632          and close handlers.
1633        </para>
1634        <para>
1635          The fault operation handler is responsible for mapping individual pages
1636          to userspace when a page fault occurs. Depending on the memory
1637          allocation scheme, drivers can allocate pages at fault time, or can
1638          decide to allocate memory for the GEM object at the time the object is
1639          created.
1640        </para>
1641        <para>
1642          Drivers that want to map the GEM object upfront instead of handling page
1643          faults can implement their own mmap file operation handler.
1644        </para>
1645      </sect3>
1646      <sect3>
1647        <title>Memory Coherency</title>
1648        <para>
1649          When mapped to the device or used in a command buffer, backing pages
1650          for an object are flushed to memory and marked write combined so as to
1651          be coherent with the GPU. Likewise, if the CPU accesses an object
1652          after the GPU has finished rendering to the object, then the object
1653          must be made coherent with the CPU's view of memory, usually involving
1654          GPU cache flushing of various kinds. This core CPU&lt;-&gt;GPU
1655          coherency management is provided by a device-specific ioctl, which
1656          evaluates an object's current domain and performs any necessary
1657          flushing or synchronization to put the object into the desired
1658          coherency domain (note that the object may be busy, i.e. an active
1659          render target; in that case, setting the domain blocks the client and
1660          waits for rendering to complete before performing any necessary
1661          flushing operations).
1662        </para>
1663      </sect3>
1664      <sect3>
1665        <title>Command Execution</title>
1666        <para>
1667          Perhaps the most important GEM function for GPU devices is providing a
1668          command execution interface to clients. Client programs construct
1669          command buffers containing references to previously allocated memory
1670          objects, and then submit them to GEM. At that point, GEM takes care to
1671          bind all the objects into the GTT, execute the buffer, and provide
1672          necessary synchronization between clients accessing the same buffers.
1673          This often involves evicting some objects from the GTT and re-binding
1674          others (a fairly expensive operation), and providing relocation
1675          support which hides fixed GTT offsets from clients. Clients must take
1676          care not to submit command buffers that reference more objects than
1677          can fit in the GTT; otherwise, GEM will reject them and no rendering
1678          will occur. Similarly, if several objects in the buffer require fence
1679          registers to be allocated for correct rendering (e.g. 2D blits on
1680          pre-965 chips), care must be taken not to require more fence registers
1681          than are available to the client. Such resource management should be
1682          abstracted from the client in libdrm.
1683        </para>
1684      </sect3>
1685      <sect3>
1686        <title>GEM Function Reference</title>
1687<!-- drivers/gpu/drm/drm_gem.c -->
1688<refentry id="API-drm-gem-object-init">
1689<refentryinfo>
1690 <title>LINUX</title>
1691 <productname>Kernel Hackers Manual</productname>
1692 <date>July 2017</date>
1693</refentryinfo>
1694<refmeta>
1695 <refentrytitle><phrase>drm_gem_object_init</phrase></refentrytitle>
1696 <manvolnum>9</manvolnum>
1697 <refmiscinfo class="version">4.4.14</refmiscinfo>
1698</refmeta>
1699<refnamediv>
1700 <refname>drm_gem_object_init</refname>
1701 <refpurpose>
1702  initialize an allocated shmem-backed GEM object
1703 </refpurpose>
1704</refnamediv>
1705<refsynopsisdiv>
1706 <title>Synopsis</title>
1707  <funcsynopsis><funcprototype>
1708   <funcdef>int <function>drm_gem_object_init </function></funcdef>
1709   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
1710   <paramdef>struct drm_gem_object * <parameter>obj</parameter></paramdef>
1711   <paramdef>size_t <parameter>size</parameter></paramdef>
1712  </funcprototype></funcsynopsis>
1713</refsynopsisdiv>
1714<refsect1>
1715 <title>Arguments</title>
1716 <variablelist>
1717  <varlistentry>
1718   <term><parameter>dev</parameter></term>
1719   <listitem>
1720    <para>
1721     drm_device the object should be initialized for
1722    </para>
1723   </listitem>
1724  </varlistentry>
1725  <varlistentry>
1726   <term><parameter>obj</parameter></term>
1727   <listitem>
1728    <para>
1729     drm_gem_object to initialize
1730    </para>
1731   </listitem>
1732  </varlistentry>
1733  <varlistentry>
1734   <term><parameter>size</parameter></term>
1735   <listitem>
1736    <para>
1737     object size
1738    </para>
1739   </listitem>
1740  </varlistentry>
1741 </variablelist>
1742</refsect1>
1743<refsect1>
1744<title>Description</title>
1745<para>
1746   Initialize an already allocated GEM object of the specified size with
1747   shmfs backing store.
1748</para>
1749</refsect1>
1750</refentry>
1751
1752<refentry id="API-drm-gem-private-object-init">
1753<refentryinfo>
1754 <title>LINUX</title>
1755 <productname>Kernel Hackers Manual</productname>
1756 <date>July 2017</date>
1757</refentryinfo>
1758<refmeta>
1759 <refentrytitle><phrase>drm_gem_private_object_init</phrase></refentrytitle>
1760 <manvolnum>9</manvolnum>
1761 <refmiscinfo class="version">4.4.14</refmiscinfo>
1762</refmeta>
1763<refnamediv>
1764 <refname>drm_gem_private_object_init</refname>
1765 <refpurpose>
1766     initialize an allocated private GEM object
1767 </refpurpose>
1768</refnamediv>
1769<refsynopsisdiv>
1770 <title>Synopsis</title>
1771  <funcsynopsis><funcprototype>
1772   <funcdef>void <function>drm_gem_private_object_init </function></funcdef>
1773   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
1774   <paramdef>struct drm_gem_object * <parameter>obj</parameter></paramdef>
1775   <paramdef>size_t <parameter>size</parameter></paramdef>
1776  </funcprototype></funcsynopsis>
1777</refsynopsisdiv>
1778<refsect1>
1779 <title>Arguments</title>
1780 <variablelist>
1781  <varlistentry>
1782   <term><parameter>dev</parameter></term>
1783   <listitem>
1784    <para>
1785     drm_device the object should be initialized for
1786    </para>
1787   </listitem>
1788  </varlistentry>
1789  <varlistentry>
1790   <term><parameter>obj</parameter></term>
1791   <listitem>
1792    <para>
1793     drm_gem_object to initialize
1794    </para>
1795   </listitem>
1796  </varlistentry>
1797  <varlistentry>
1798   <term><parameter>size</parameter></term>
1799   <listitem>
1800    <para>
1801     object size
1802    </para>
1803   </listitem>
1804  </varlistentry>
1805 </variablelist>
1806</refsect1>
1807<refsect1>
1808<title>Description</title>
1809<para>
1810   Initialize an already allocated GEM object of the specified size with
1811   no GEM provided backing store. Instead the caller is responsible for
1812   backing the object and handling it.
1813</para>
1814</refsect1>
1815</refentry>
1816
1817<refentry id="API-drm-gem-handle-delete">
1818<refentryinfo>
1819 <title>LINUX</title>
1820 <productname>Kernel Hackers Manual</productname>
1821 <date>July 2017</date>
1822</refentryinfo>
1823<refmeta>
1824 <refentrytitle><phrase>drm_gem_handle_delete</phrase></refentrytitle>
1825 <manvolnum>9</manvolnum>
1826 <refmiscinfo class="version">4.4.14</refmiscinfo>
1827</refmeta>
1828<refnamediv>
1829 <refname>drm_gem_handle_delete</refname>
1830 <refpurpose>
1831     deletes the given file-private handle
1832 </refpurpose>
1833</refnamediv>
1834<refsynopsisdiv>
1835 <title>Synopsis</title>
1836  <funcsynopsis><funcprototype>
1837   <funcdef>int <function>drm_gem_handle_delete </function></funcdef>
1838   <paramdef>struct drm_file * <parameter>filp</parameter></paramdef>
1839   <paramdef>u32 <parameter>handle</parameter></paramdef>
1840  </funcprototype></funcsynopsis>
1841</refsynopsisdiv>
1842<refsect1>
1843 <title>Arguments</title>
1844 <variablelist>
1845  <varlistentry>
1846   <term><parameter>filp</parameter></term>
1847   <listitem>
1848    <para>
1849     drm file-private structure to use for the handle look up
1850    </para>
1851   </listitem>
1852  </varlistentry>
1853  <varlistentry>
1854   <term><parameter>handle</parameter></term>
1855   <listitem>
1856    <para>
1857     userspace handle to delete
1858    </para>
1859   </listitem>
1860  </varlistentry>
1861 </variablelist>
1862</refsect1>
1863<refsect1>
1864<title>Description</title>
1865<para>
1866   Removes the GEM handle from the <parameter>filp</parameter> lookup table and if this is the last
1867   handle also cleans up linked resources like GEM names.
1868</para>
1869</refsect1>
1870</refentry>
1871
1872<refentry id="API-drm-gem-dumb-destroy">
1873<refentryinfo>
1874 <title>LINUX</title>
1875 <productname>Kernel Hackers Manual</productname>
1876 <date>July 2017</date>
1877</refentryinfo>
1878<refmeta>
1879 <refentrytitle><phrase>drm_gem_dumb_destroy</phrase></refentrytitle>
1880 <manvolnum>9</manvolnum>
1881 <refmiscinfo class="version">4.4.14</refmiscinfo>
1882</refmeta>
1883<refnamediv>
1884 <refname>drm_gem_dumb_destroy</refname>
1885 <refpurpose>
1886     dumb fb callback helper for gem based drivers
1887 </refpurpose>
1888</refnamediv>
1889<refsynopsisdiv>
1890 <title>Synopsis</title>
1891  <funcsynopsis><funcprototype>
1892   <funcdef>int <function>drm_gem_dumb_destroy </function></funcdef>
1893   <paramdef>struct drm_file * <parameter>file</parameter></paramdef>
1894   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
1895   <paramdef>uint32_t <parameter>handle</parameter></paramdef>
1896  </funcprototype></funcsynopsis>
1897</refsynopsisdiv>
1898<refsect1>
1899 <title>Arguments</title>
1900 <variablelist>
1901  <varlistentry>
1902   <term><parameter>file</parameter></term>
1903   <listitem>
1904    <para>
1905     drm file-private structure to remove the dumb handle from
1906    </para>
1907   </listitem>
1908  </varlistentry>
1909  <varlistentry>
1910   <term><parameter>dev</parameter></term>
1911   <listitem>
1912    <para>
1913     corresponding drm_device
1914    </para>
1915   </listitem>
1916  </varlistentry>
1917  <varlistentry>
1918   <term><parameter>handle</parameter></term>
1919   <listitem>
1920    <para>
1921     the dumb handle to remove
1922    </para>
1923   </listitem>
1924  </varlistentry>
1925 </variablelist>
1926</refsect1>
1927<refsect1>
1928<title>Description</title>
1929<para>
1930   This implements the -&gt;dumb_destroy kms driver callback for drivers which use
1931   gem to manage their backing storage.
1932</para>
1933</refsect1>
1934</refentry>
1935
1936<refentry id="API-drm-gem-handle-create">
1937<refentryinfo>
1938 <title>LINUX</title>
1939 <productname>Kernel Hackers Manual</productname>
1940 <date>July 2017</date>
1941</refentryinfo>
1942<refmeta>
1943 <refentrytitle><phrase>drm_gem_handle_create</phrase></refentrytitle>
1944 <manvolnum>9</manvolnum>
1945 <refmiscinfo class="version">4.4.14</refmiscinfo>
1946</refmeta>
1947<refnamediv>
1948 <refname>drm_gem_handle_create</refname>
1949 <refpurpose>
1950     create a gem handle for an object
1951 </refpurpose>
1952</refnamediv>
1953<refsynopsisdiv>
1954 <title>Synopsis</title>
1955  <funcsynopsis><funcprototype>
1956   <funcdef>int <function>drm_gem_handle_create </function></funcdef>
1957   <paramdef>struct drm_file * <parameter>file_priv</parameter></paramdef>
1958   <paramdef>struct drm_gem_object * <parameter>obj</parameter></paramdef>
1959   <paramdef>u32 * <parameter>handlep</parameter></paramdef>
1960  </funcprototype></funcsynopsis>
1961</refsynopsisdiv>
1962<refsect1>
1963 <title>Arguments</title>
1964 <variablelist>
1965  <varlistentry>
1966   <term><parameter>file_priv</parameter></term>
1967   <listitem>
1968    <para>
1969     drm file-private structure to register the handle for
1970    </para>
1971   </listitem>
1972  </varlistentry>
1973  <varlistentry>
1974   <term><parameter>obj</parameter></term>
1975   <listitem>
1976    <para>
1977     object to register
1978    </para>
1979   </listitem>
1980  </varlistentry>
1981  <varlistentry>
1982   <term><parameter>handlep</parameter></term>
1983   <listitem>
1984    <para>
1985     pionter to return the created handle to the caller
1986    </para>
1987   </listitem>
1988  </varlistentry>
1989 </variablelist>
1990</refsect1>
1991<refsect1>
1992<title>Description</title>
1993<para>
1994   Create a handle for this object. This adds a handle reference
1995   to the object, which includes a regular reference count. Callers
1996   will likely want to dereference the object afterwards.
1997</para>
1998</refsect1>
1999</refentry>
2000
2001<refentry id="API-drm-gem-free-mmap-offset">
2002<refentryinfo>
2003 <title>LINUX</title>
2004 <productname>Kernel Hackers Manual</productname>
2005 <date>July 2017</date>
2006</refentryinfo>
2007<refmeta>
2008 <refentrytitle><phrase>drm_gem_free_mmap_offset</phrase></refentrytitle>
2009 <manvolnum>9</manvolnum>
2010 <refmiscinfo class="version">4.4.14</refmiscinfo>
2011</refmeta>
2012<refnamediv>
2013 <refname>drm_gem_free_mmap_offset</refname>
2014 <refpurpose>
2015     release a fake mmap offset for an object
2016 </refpurpose>
2017</refnamediv>
2018<refsynopsisdiv>
2019 <title>Synopsis</title>
2020  <funcsynopsis><funcprototype>
2021   <funcdef>void <function>drm_gem_free_mmap_offset </function></funcdef>
2022   <paramdef>struct drm_gem_object * <parameter>obj</parameter></paramdef>
2023  </funcprototype></funcsynopsis>
2024</refsynopsisdiv>
2025<refsect1>
2026 <title>Arguments</title>
2027 <variablelist>
2028  <varlistentry>
2029   <term><parameter>obj</parameter></term>
2030   <listitem>
2031    <para>
2032     obj in question
2033    </para>
2034   </listitem>
2035  </varlistentry>
2036 </variablelist>
2037</refsect1>
2038<refsect1>
2039<title>Description</title>
2040<para>
2041   This routine frees fake offsets allocated by <function>drm_gem_create_mmap_offset</function>.
2042</para>
2043</refsect1>
2044</refentry>
2045
2046<refentry id="API-drm-gem-create-mmap-offset-size">
2047<refentryinfo>
2048 <title>LINUX</title>
2049 <productname>Kernel Hackers Manual</productname>
2050 <date>July 2017</date>
2051</refentryinfo>
2052<refmeta>
2053 <refentrytitle><phrase>drm_gem_create_mmap_offset_size</phrase></refentrytitle>
2054 <manvolnum>9</manvolnum>
2055 <refmiscinfo class="version">4.4.14</refmiscinfo>
2056</refmeta>
2057<refnamediv>
2058 <refname>drm_gem_create_mmap_offset_size</refname>
2059 <refpurpose>
2060     create a fake mmap offset for an object
2061 </refpurpose>
2062</refnamediv>
2063<refsynopsisdiv>
2064 <title>Synopsis</title>
2065  <funcsynopsis><funcprototype>
2066   <funcdef>int <function>drm_gem_create_mmap_offset_size </function></funcdef>
2067   <paramdef>struct drm_gem_object * <parameter>obj</parameter></paramdef>
2068   <paramdef>size_t <parameter>size</parameter></paramdef>
2069  </funcprototype></funcsynopsis>
2070</refsynopsisdiv>
2071<refsect1>
2072 <title>Arguments</title>
2073 <variablelist>
2074  <varlistentry>
2075   <term><parameter>obj</parameter></term>
2076   <listitem>
2077    <para>
2078     obj in question
2079    </para>
2080   </listitem>
2081  </varlistentry>
2082  <varlistentry>
2083   <term><parameter>size</parameter></term>
2084   <listitem>
2085    <para>
2086     the virtual size
2087    </para>
2088   </listitem>
2089  </varlistentry>
2090 </variablelist>
2091</refsect1>
2092<refsect1>
2093<title>Description</title>
2094<para>
2095   GEM memory mapping works by handing back to userspace a fake mmap offset
2096   it can use in a subsequent mmap(2) call.  The DRM core code then looks
2097   up the object based on the offset and sets up the various memory mapping
2098   structures.
2099   </para><para>
2100
2101   This routine allocates and attaches a fake offset for <parameter>obj</parameter>, in cases where
2102   the virtual size differs from the physical size (ie. obj-&gt;size).  Otherwise
2103   just use <function>drm_gem_create_mmap_offset</function>.
2104</para>
2105</refsect1>
2106</refentry>
2107
2108<refentry id="API-drm-gem-create-mmap-offset">
2109<refentryinfo>
2110 <title>LINUX</title>
2111 <productname>Kernel Hackers Manual</productname>
2112 <date>July 2017</date>
2113</refentryinfo>
2114<refmeta>
2115 <refentrytitle><phrase>drm_gem_create_mmap_offset</phrase></refentrytitle>
2116 <manvolnum>9</manvolnum>
2117 <refmiscinfo class="version">4.4.14</refmiscinfo>
2118</refmeta>
2119<refnamediv>
2120 <refname>drm_gem_create_mmap_offset</refname>
2121 <refpurpose>
2122     create a fake mmap offset for an object
2123 </refpurpose>
2124</refnamediv>
2125<refsynopsisdiv>
2126 <title>Synopsis</title>
2127  <funcsynopsis><funcprototype>
2128   <funcdef>int <function>drm_gem_create_mmap_offset </function></funcdef>
2129   <paramdef>struct drm_gem_object * <parameter>obj</parameter></paramdef>
2130  </funcprototype></funcsynopsis>
2131</refsynopsisdiv>
2132<refsect1>
2133 <title>Arguments</title>
2134 <variablelist>
2135  <varlistentry>
2136   <term><parameter>obj</parameter></term>
2137   <listitem>
2138    <para>
2139     obj in question
2140    </para>
2141   </listitem>
2142  </varlistentry>
2143 </variablelist>
2144</refsect1>
2145<refsect1>
2146<title>Description</title>
2147<para>
2148   GEM memory mapping works by handing back to userspace a fake mmap offset
2149   it can use in a subsequent mmap(2) call.  The DRM core code then looks
2150   up the object based on the offset and sets up the various memory mapping
2151   structures.
2152   </para><para>
2153
2154   This routine allocates and attaches a fake offset for <parameter>obj</parameter>.
2155</para>
2156</refsect1>
2157</refentry>
2158
2159<refentry id="API-drm-gem-get-pages">
2160<refentryinfo>
2161 <title>LINUX</title>
2162 <productname>Kernel Hackers Manual</productname>
2163 <date>July 2017</date>
2164</refentryinfo>
2165<refmeta>
2166 <refentrytitle><phrase>drm_gem_get_pages</phrase></refentrytitle>
2167 <manvolnum>9</manvolnum>
2168 <refmiscinfo class="version">4.4.14</refmiscinfo>
2169</refmeta>
2170<refnamediv>
2171 <refname>drm_gem_get_pages</refname>
2172 <refpurpose>
2173     helper to allocate backing pages for a GEM object from shmem
2174 </refpurpose>
2175</refnamediv>
2176<refsynopsisdiv>
2177 <title>Synopsis</title>
2178  <funcsynopsis><funcprototype>
2179   <funcdef>struct page ** <function>drm_gem_get_pages </function></funcdef>
2180   <paramdef>struct drm_gem_object * <parameter>obj</parameter></paramdef>
2181  </funcprototype></funcsynopsis>
2182</refsynopsisdiv>
2183<refsect1>
2184 <title>Arguments</title>
2185 <variablelist>
2186  <varlistentry>
2187   <term><parameter>obj</parameter></term>
2188   <listitem>
2189    <para>
2190     obj in question
2191    </para>
2192   </listitem>
2193  </varlistentry>
2194 </variablelist>
2195</refsect1>
2196<refsect1>
2197<title>Description</title>
2198<para>
2199   This reads the page-array of the shmem-backing storage of the given gem
2200   object. An array of pages is returned. If a page is not allocated or
2201   swapped-out, this will allocate/swap-in the required pages. Note that the
2202   whole object is covered by the page-array and pinned in memory.
2203   </para><para>
2204
2205   Use <function>drm_gem_put_pages</function> to release the array and unpin all pages.
2206   </para><para>
2207
2208   This uses the GFP-mask set on the shmem-mapping (see <function>mapping_set_gfp_mask</function>).
2209   If you require other GFP-masks, you have to do those allocations yourself.
2210   </para><para>
2211
2212   Note that you are not allowed to change gfp-zones during runtime. That is,
2213   <function>shmem_read_mapping_page_gfp</function> must be called with the same gfp_zone(gfp) as
2214   set during initialization. If you have special zone constraints, set them
2215   after <function>drm_gem_init_object</function> via <function>mapping_set_gfp_mask</function>. shmem-core takes care
2216   to keep pages in the required zone during swap-in.
2217</para>
2218</refsect1>
2219</refentry>
2220
2221<refentry id="API-drm-gem-put-pages">
2222<refentryinfo>
2223 <title>LINUX</title>
2224 <productname>Kernel Hackers Manual</productname>
2225 <date>July 2017</date>
2226</refentryinfo>
2227<refmeta>
2228 <refentrytitle><phrase>drm_gem_put_pages</phrase></refentrytitle>
2229 <manvolnum>9</manvolnum>
2230 <refmiscinfo class="version">4.4.14</refmiscinfo>
2231</refmeta>
2232<refnamediv>
2233 <refname>drm_gem_put_pages</refname>
2234 <refpurpose>
2235     helper to free backing pages for a GEM object
2236 </refpurpose>
2237</refnamediv>
2238<refsynopsisdiv>
2239 <title>Synopsis</title>
2240  <funcsynopsis><funcprototype>
2241   <funcdef>void <function>drm_gem_put_pages </function></funcdef>
2242   <paramdef>struct drm_gem_object * <parameter>obj</parameter></paramdef>
2243   <paramdef>struct page ** <parameter>pages</parameter></paramdef>
2244   <paramdef>bool <parameter>dirty</parameter></paramdef>
2245   <paramdef>bool <parameter>accessed</parameter></paramdef>
2246  </funcprototype></funcsynopsis>
2247</refsynopsisdiv>
2248<refsect1>
2249 <title>Arguments</title>
2250 <variablelist>
2251  <varlistentry>
2252   <term><parameter>obj</parameter></term>
2253   <listitem>
2254    <para>
2255     obj in question
2256    </para>
2257   </listitem>
2258  </varlistentry>
2259  <varlistentry>
2260   <term><parameter>pages</parameter></term>
2261   <listitem>
2262    <para>
2263     pages to free
2264    </para>
2265   </listitem>
2266  </varlistentry>
2267  <varlistentry>
2268   <term><parameter>dirty</parameter></term>
2269   <listitem>
2270    <para>
2271     if true, pages will be marked as dirty
2272    </para>
2273   </listitem>
2274  </varlistentry>
2275  <varlistentry>
2276   <term><parameter>accessed</parameter></term>
2277   <listitem>
2278    <para>
2279     if true, the pages will be marked as accessed
2280    </para>
2281   </listitem>
2282  </varlistentry>
2283 </variablelist>
2284</refsect1>
2285</refentry>
2286
2287<refentry id="API-drm-gem-object-free">
2288<refentryinfo>
2289 <title>LINUX</title>
2290 <productname>Kernel Hackers Manual</productname>
2291 <date>July 2017</date>
2292</refentryinfo>
2293<refmeta>
2294 <refentrytitle><phrase>drm_gem_object_free</phrase></refentrytitle>
2295 <manvolnum>9</manvolnum>
2296 <refmiscinfo class="version">4.4.14</refmiscinfo>
2297</refmeta>
2298<refnamediv>
2299 <refname>drm_gem_object_free</refname>
2300 <refpurpose>
2301     free a GEM object
2302 </refpurpose>
2303</refnamediv>
2304<refsynopsisdiv>
2305 <title>Synopsis</title>
2306  <funcsynopsis><funcprototype>
2307   <funcdef>void <function>drm_gem_object_free </function></funcdef>
2308   <paramdef>struct kref * <parameter>kref</parameter></paramdef>
2309  </funcprototype></funcsynopsis>
2310</refsynopsisdiv>
2311<refsect1>
2312 <title>Arguments</title>
2313 <variablelist>
2314  <varlistentry>
2315   <term><parameter>kref</parameter></term>
2316   <listitem>
2317    <para>
2318     kref of the object to free
2319    </para>
2320   </listitem>
2321  </varlistentry>
2322 </variablelist>
2323</refsect1>
2324<refsect1>
2325<title>Description</title>
2326<para>
2327   Called after the last reference to the object has been lost.
2328   Must be called holding struct_ mutex
2329   </para><para>
2330
2331   Frees the object
2332</para>
2333</refsect1>
2334</refentry>
2335
2336<refentry id="API-drm-gem-mmap-obj">
2337<refentryinfo>
2338 <title>LINUX</title>
2339 <productname>Kernel Hackers Manual</productname>
2340 <date>July 2017</date>
2341</refentryinfo>
2342<refmeta>
2343 <refentrytitle><phrase>drm_gem_mmap_obj</phrase></refentrytitle>
2344 <manvolnum>9</manvolnum>
2345 <refmiscinfo class="version">4.4.14</refmiscinfo>
2346</refmeta>
2347<refnamediv>
2348 <refname>drm_gem_mmap_obj</refname>
2349 <refpurpose>
2350     memory map a GEM object
2351 </refpurpose>
2352</refnamediv>
2353<refsynopsisdiv>
2354 <title>Synopsis</title>
2355  <funcsynopsis><funcprototype>
2356   <funcdef>int <function>drm_gem_mmap_obj </function></funcdef>
2357   <paramdef>struct drm_gem_object * <parameter>obj</parameter></paramdef>
2358   <paramdef>unsigned long <parameter>obj_size</parameter></paramdef>
2359   <paramdef>struct vm_area_struct * <parameter>vma</parameter></paramdef>
2360  </funcprototype></funcsynopsis>
2361</refsynopsisdiv>
2362<refsect1>
2363 <title>Arguments</title>
2364 <variablelist>
2365  <varlistentry>
2366   <term><parameter>obj</parameter></term>
2367   <listitem>
2368    <para>
2369     the GEM object to map
2370    </para>
2371   </listitem>
2372  </varlistentry>
2373  <varlistentry>
2374   <term><parameter>obj_size</parameter></term>
2375   <listitem>
2376    <para>
2377     the object size to be mapped, in bytes
2378    </para>
2379   </listitem>
2380  </varlistentry>
2381  <varlistentry>
2382   <term><parameter>vma</parameter></term>
2383   <listitem>
2384    <para>
2385     VMA for the area to be mapped
2386    </para>
2387   </listitem>
2388  </varlistentry>
2389 </variablelist>
2390</refsect1>
2391<refsect1>
2392<title>Description</title>
2393<para>
2394   Set up the VMA to prepare mapping of the GEM object using the gem_vm_ops
2395   provided by the driver. Depending on their requirements, drivers can either
2396   provide a fault handler in their gem_vm_ops (in which case any accesses to
2397   the object will be trapped, to perform migration, GTT binding, surface
2398   register allocation, or performance monitoring), or mmap the buffer memory
2399   synchronously after calling drm_gem_mmap_obj.
2400   </para><para>
2401
2402   This function is mainly intended to implement the DMABUF mmap operation, when
2403   the GEM object is not looked up based on its fake offset. To implement the
2404   DRM mmap operation, drivers should use the <function>drm_gem_mmap</function> function.
2405   </para><para>
2406
2407   <function>drm_gem_mmap_obj</function> assumes the user is granted access to the buffer while
2408   <function>drm_gem_mmap</function> prevents unprivileged users from mapping random objects. So
2409   callers must verify access restrictions before calling this helper.
2410   </para><para>
2411
2412   Return 0 or success or -EINVAL if the object size is smaller than the VMA
2413   size, or if no gem_vm_ops are provided.
2414</para>
2415</refsect1>
2416</refentry>
2417
2418<refentry id="API-drm-gem-mmap">
2419<refentryinfo>
2420 <title>LINUX</title>
2421 <productname>Kernel Hackers Manual</productname>
2422 <date>July 2017</date>
2423</refentryinfo>
2424<refmeta>
2425 <refentrytitle><phrase>drm_gem_mmap</phrase></refentrytitle>
2426 <manvolnum>9</manvolnum>
2427 <refmiscinfo class="version">4.4.14</refmiscinfo>
2428</refmeta>
2429<refnamediv>
2430 <refname>drm_gem_mmap</refname>
2431 <refpurpose>
2432     memory map routine for GEM objects
2433 </refpurpose>
2434</refnamediv>
2435<refsynopsisdiv>
2436 <title>Synopsis</title>
2437  <funcsynopsis><funcprototype>
2438   <funcdef>int <function>drm_gem_mmap </function></funcdef>
2439   <paramdef>struct file * <parameter>filp</parameter></paramdef>
2440   <paramdef>struct vm_area_struct * <parameter>vma</parameter></paramdef>
2441  </funcprototype></funcsynopsis>
2442</refsynopsisdiv>
2443<refsect1>
2444 <title>Arguments</title>
2445 <variablelist>
2446  <varlistentry>
2447   <term><parameter>filp</parameter></term>
2448   <listitem>
2449    <para>
2450     DRM file pointer
2451    </para>
2452   </listitem>
2453  </varlistentry>
2454  <varlistentry>
2455   <term><parameter>vma</parameter></term>
2456   <listitem>
2457    <para>
2458     VMA for the area to be mapped
2459    </para>
2460   </listitem>
2461  </varlistentry>
2462 </variablelist>
2463</refsect1>
2464<refsect1>
2465<title>Description</title>
2466<para>
2467   If a driver supports GEM object mapping, mmap calls on the DRM file
2468   descriptor will end up here.
2469   </para><para>
2470
2471   Look up the GEM object based on the offset passed in (vma-&gt;vm_pgoff will
2472   contain the fake offset we created when the GTT map ioctl was called on
2473   the object) and map it with a call to <function>drm_gem_mmap_obj</function>.
2474   </para><para>
2475
2476   If the caller is not granted access to the buffer object, the mmap will fail
2477   with EACCES. Please see the vma manager for more information.
2478</para>
2479</refsect1>
2480</refentry>
2481
2482      </sect3>
2483    </sect2>
2484    <sect2>
2485      <title>VMA Offset Manager</title>
2486<para>
2487   </para><para>
2488   The vma-manager is responsible to map arbitrary driver-dependent memory
2489   regions into the linear user address-space. It provides offsets to the
2490   caller which can then be used on the address_space of the drm-device. It
2491   takes care to not overlap regions, size them appropriately and to not
2492   confuse mm-core by inconsistent fake vm_pgoff fields.
2493   Drivers shouldn't use this for object placement in VMEM. This manager should
2494   only be used to manage mappings into linear user-space VMs.
2495   </para><para>
2496   We use drm_mm as backend to manage object allocations. But it is highly
2497   optimized for alloc/free calls, not lookups. Hence, we use an rb-tree to
2498   speed up offset lookups.
2499   </para><para>
2500   You must not use multiple offset managers on a single address_space.
2501   Otherwise, mm-core will be unable to tear down memory mappings as the VM will
2502   no longer be linear.
2503   </para><para>
2504   This offset manager works on page-based addresses. That is, every argument
2505   and return code (with the exception of <function>drm_vma_node_offset_addr</function>) is given
2506   in number of pages, not number of bytes. That means, object sizes and offsets
2507   must always be page-aligned (as usual).
2508   If you want to get a valid byte-based user-space address for a given offset,
2509   please see <function>drm_vma_node_offset_addr</function>.
2510   </para><para>
2511   Additionally to offset management, the vma offset manager also handles access
2512   management. For every open-file context that is allowed to access a given
2513   node, you must call <function>drm_vma_node_allow</function>. Otherwise, an <function>mmap</function> call on this
2514   open-file with the offset of the node will fail with -EACCES. To revoke
2515   access again, use <function>drm_vma_node_revoke</function>. However, the caller is responsible
2516   for destroying already existing mappings, if required.
2517</para>
2518
2519<!-- drivers/gpu/drm/drm_vma_manager.c -->
2520<refentry id="API-drm-vma-offset-manager-init">
2521<refentryinfo>
2522 <title>LINUX</title>
2523 <productname>Kernel Hackers Manual</productname>
2524 <date>July 2017</date>
2525</refentryinfo>
2526<refmeta>
2527 <refentrytitle><phrase>drm_vma_offset_manager_init</phrase></refentrytitle>
2528 <manvolnum>9</manvolnum>
2529 <refmiscinfo class="version">4.4.14</refmiscinfo>
2530</refmeta>
2531<refnamediv>
2532 <refname>drm_vma_offset_manager_init</refname>
2533 <refpurpose>
2534  Initialize new offset-manager
2535 </refpurpose>
2536</refnamediv>
2537<refsynopsisdiv>
2538 <title>Synopsis</title>
2539  <funcsynopsis><funcprototype>
2540   <funcdef>void <function>drm_vma_offset_manager_init </function></funcdef>
2541   <paramdef>struct drm_vma_offset_manager * <parameter>mgr</parameter></paramdef>
2542   <paramdef>unsigned long <parameter>page_offset</parameter></paramdef>
2543   <paramdef>unsigned long <parameter>size</parameter></paramdef>
2544  </funcprototype></funcsynopsis>
2545</refsynopsisdiv>
2546<refsect1>
2547 <title>Arguments</title>
2548 <variablelist>
2549  <varlistentry>
2550   <term><parameter>mgr</parameter></term>
2551   <listitem>
2552    <para>
2553     Manager object
2554    </para>
2555   </listitem>
2556  </varlistentry>
2557  <varlistentry>
2558   <term><parameter>page_offset</parameter></term>
2559   <listitem>
2560    <para>
2561     Offset of available memory area (page-based)
2562    </para>
2563   </listitem>
2564  </varlistentry>
2565  <varlistentry>
2566   <term><parameter>size</parameter></term>
2567   <listitem>
2568    <para>
2569     Size of available address space range (page-based)
2570    </para>
2571   </listitem>
2572  </varlistentry>
2573 </variablelist>
2574</refsect1>
2575<refsect1>
2576<title>Description</title>
2577<para>
2578   Initialize a new offset-manager. The offset and area size available for the
2579   manager are given as <parameter>page_offset</parameter> and <parameter>size</parameter>. Both are interpreted as
2580   page-numbers, not bytes.
2581   </para><para>
2582
2583   Adding/removing nodes from the manager is locked internally and protected
2584   against concurrent access. However, node allocation and destruction is left
2585   for the caller. While calling into the vma-manager, a given node must
2586   always be guaranteed to be referenced.
2587</para>
2588</refsect1>
2589</refentry>
2590
2591<refentry id="API-drm-vma-offset-manager-destroy">
2592<refentryinfo>
2593 <title>LINUX</title>
2594 <productname>Kernel Hackers Manual</productname>
2595 <date>July 2017</date>
2596</refentryinfo>
2597<refmeta>
2598 <refentrytitle><phrase>drm_vma_offset_manager_destroy</phrase></refentrytitle>
2599 <manvolnum>9</manvolnum>
2600 <refmiscinfo class="version">4.4.14</refmiscinfo>
2601</refmeta>
2602<refnamediv>
2603 <refname>drm_vma_offset_manager_destroy</refname>
2604 <refpurpose>
2605     Destroy offset manager
2606 </refpurpose>
2607</refnamediv>
2608<refsynopsisdiv>
2609 <title>Synopsis</title>
2610  <funcsynopsis><funcprototype>
2611   <funcdef>void <function>drm_vma_offset_manager_destroy </function></funcdef>
2612   <paramdef>struct drm_vma_offset_manager * <parameter>mgr</parameter></paramdef>
2613  </funcprototype></funcsynopsis>
2614</refsynopsisdiv>
2615<refsect1>
2616 <title>Arguments</title>
2617 <variablelist>
2618  <varlistentry>
2619   <term><parameter>mgr</parameter></term>
2620   <listitem>
2621    <para>
2622     Manager object
2623    </para>
2624   </listitem>
2625  </varlistentry>
2626 </variablelist>
2627</refsect1>
2628<refsect1>
2629<title>Description</title>
2630<para>
2631   Destroy an object manager which was previously created via
2632   <function>drm_vma_offset_manager_init</function>. The caller must remove all allocated nodes
2633   before destroying the manager. Otherwise, drm_mm will refuse to free the
2634   requested resources.
2635   </para><para>
2636
2637   The manager must not be accessed after this function is called.
2638</para>
2639</refsect1>
2640</refentry>
2641
2642<refentry id="API-drm-vma-offset-lookup-locked">
2643<refentryinfo>
2644 <title>LINUX</title>
2645 <productname>Kernel Hackers Manual</productname>
2646 <date>July 2017</date>
2647</refentryinfo>
2648<refmeta>
2649 <refentrytitle><phrase>drm_vma_offset_lookup_locked</phrase></refentrytitle>
2650 <manvolnum>9</manvolnum>
2651 <refmiscinfo class="version">4.4.14</refmiscinfo>
2652</refmeta>
2653<refnamediv>
2654 <refname>drm_vma_offset_lookup_locked</refname>
2655 <refpurpose>
2656     Find node in offset space
2657 </refpurpose>
2658</refnamediv>
2659<refsynopsisdiv>
2660 <title>Synopsis</title>
2661  <funcsynopsis><funcprototype>
2662   <funcdef>struct drm_vma_offset_node * <function>drm_vma_offset_lookup_locked </function></funcdef>
2663   <paramdef>struct drm_vma_offset_manager * <parameter>mgr</parameter></paramdef>
2664   <paramdef>unsigned long <parameter>start</parameter></paramdef>
2665   <paramdef>unsigned long <parameter>pages</parameter></paramdef>
2666  </funcprototype></funcsynopsis>
2667</refsynopsisdiv>
2668<refsect1>
2669 <title>Arguments</title>
2670 <variablelist>
2671  <varlistentry>
2672   <term><parameter>mgr</parameter></term>
2673   <listitem>
2674    <para>
2675     Manager object
2676    </para>
2677   </listitem>
2678  </varlistentry>
2679  <varlistentry>
2680   <term><parameter>start</parameter></term>
2681   <listitem>
2682    <para>
2683     Start address for object (page-based)
2684    </para>
2685   </listitem>
2686  </varlistentry>
2687  <varlistentry>
2688   <term><parameter>pages</parameter></term>
2689   <listitem>
2690    <para>
2691     Size of object (page-based)
2692    </para>
2693   </listitem>
2694  </varlistentry>
2695 </variablelist>
2696</refsect1>
2697<refsect1>
2698<title>Description</title>
2699<para>
2700   Find a node given a start address and object size. This returns the _best_
2701   match for the given node. That is, <parameter>start</parameter> may point somewhere into a valid
2702   region and the given node will be returned, as long as the node spans the
2703   whole requested area (given the size in number of pages as <parameter>pages</parameter>).
2704   </para><para>
2705
2706   Note that before lookup the vma offset manager lookup lock must be acquired
2707   with <function>drm_vma_offset_lock_lookup</function>. See there for an example. This can then be
2708   used to implement weakly referenced lookups using <function>kref_get_unless_zero</function>.
2709</para>
2710</refsect1>
2711<refsect1>
2712<title>Example</title>
2713<informalexample><programlisting>
2714       drm_vma_offset_lock_lookup(mgr);
2715       node = drm_vma_offset_lookup_locked(mgr);
2716       if (node)
2717           kref_get_unless_zero(container_of(node, sth, entr));
2718       drm_vma_offset_unlock_lookup(mgr);
2719</programlisting></informalexample>
2720</refsect1>
2721<refsect1>
2722<title>RETURNS</title>
2723<para>
2724   Returns NULL if no suitable node can be found. Otherwise, the best match
2725   is returned. It's the caller's responsibility to make sure the node doesn't
2726   get destroyed before the caller can access it.
2727</para>
2728</refsect1>
2729</refentry>
2730
2731<refentry id="API-drm-vma-offset-add">
2732<refentryinfo>
2733 <title>LINUX</title>
2734 <productname>Kernel Hackers Manual</productname>
2735 <date>July 2017</date>
2736</refentryinfo>
2737<refmeta>
2738 <refentrytitle><phrase>drm_vma_offset_add</phrase></refentrytitle>
2739 <manvolnum>9</manvolnum>
2740 <refmiscinfo class="version">4.4.14</refmiscinfo>
2741</refmeta>
2742<refnamediv>
2743 <refname>drm_vma_offset_add</refname>
2744 <refpurpose>
2745     Add offset node to manager
2746 </refpurpose>
2747</refnamediv>
2748<refsynopsisdiv>
2749 <title>Synopsis</title>
2750  <funcsynopsis><funcprototype>
2751   <funcdef>int <function>drm_vma_offset_add </function></funcdef>
2752   <paramdef>struct drm_vma_offset_manager * <parameter>mgr</parameter></paramdef>
2753   <paramdef>struct drm_vma_offset_node * <parameter>node</parameter></paramdef>
2754   <paramdef>unsigned long <parameter>pages</parameter></paramdef>
2755  </funcprototype></funcsynopsis>
2756</refsynopsisdiv>
2757<refsect1>
2758 <title>Arguments</title>
2759 <variablelist>
2760  <varlistentry>
2761   <term><parameter>mgr</parameter></term>
2762   <listitem>
2763    <para>
2764     Manager object
2765    </para>
2766   </listitem>
2767  </varlistentry>
2768  <varlistentry>
2769   <term><parameter>node</parameter></term>
2770   <listitem>
2771    <para>
2772     Node to be added
2773    </para>
2774   </listitem>
2775  </varlistentry>
2776  <varlistentry>
2777   <term><parameter>pages</parameter></term>
2778   <listitem>
2779    <para>
2780     Allocation size visible to user-space (in number of pages)
2781    </para>
2782   </listitem>
2783  </varlistentry>
2784 </variablelist>
2785</refsect1>
2786<refsect1>
2787<title>Description</title>
2788<para>
2789   Add a node to the offset-manager. If the node was already added, this does
2790   nothing and return 0. <parameter>pages</parameter> is the size of the object given in number of
2791   pages.
2792   After this call succeeds, you can access the offset of the node until it
2793   is removed again.
2794   </para><para>
2795
2796   If this call fails, it is safe to retry the operation or call
2797   <function>drm_vma_offset_remove</function>, anyway. However, no cleanup is required in that
2798   case.
2799   </para><para>
2800
2801   <parameter>pages</parameter> is not required to be the same size as the underlying memory object
2802   that you want to map. It only limits the size that user-space can map into
2803   their address space.
2804</para>
2805</refsect1>
2806<refsect1>
2807<title>RETURNS</title>
2808<para>
2809   0 on success, negative error code on failure.
2810</para>
2811</refsect1>
2812</refentry>
2813
2814<refentry id="API-drm-vma-offset-remove">
2815<refentryinfo>
2816 <title>LINUX</title>
2817 <productname>Kernel Hackers Manual</productname>
2818 <date>July 2017</date>
2819</refentryinfo>
2820<refmeta>
2821 <refentrytitle><phrase>drm_vma_offset_remove</phrase></refentrytitle>
2822 <manvolnum>9</manvolnum>
2823 <refmiscinfo class="version">4.4.14</refmiscinfo>
2824</refmeta>
2825<refnamediv>
2826 <refname>drm_vma_offset_remove</refname>
2827 <refpurpose>
2828     Remove offset node from manager
2829 </refpurpose>
2830</refnamediv>
2831<refsynopsisdiv>
2832 <title>Synopsis</title>
2833  <funcsynopsis><funcprototype>
2834   <funcdef>void <function>drm_vma_offset_remove </function></funcdef>
2835   <paramdef>struct drm_vma_offset_manager * <parameter>mgr</parameter></paramdef>
2836   <paramdef>struct drm_vma_offset_node * <parameter>node</parameter></paramdef>
2837  </funcprototype></funcsynopsis>
2838</refsynopsisdiv>
2839<refsect1>
2840 <title>Arguments</title>
2841 <variablelist>
2842  <varlistentry>
2843   <term><parameter>mgr</parameter></term>
2844   <listitem>
2845    <para>
2846     Manager object
2847    </para>
2848   </listitem>
2849  </varlistentry>
2850  <varlistentry>
2851   <term><parameter>node</parameter></term>
2852   <listitem>
2853    <para>
2854     Node to be removed
2855    </para>
2856   </listitem>
2857  </varlistentry>
2858 </variablelist>
2859</refsect1>
2860<refsect1>
2861<title>Description</title>
2862<para>
2863   Remove a node from the offset manager. If the node wasn't added before, this
2864   does nothing. After this call returns, the offset and size will be 0 until a
2865   new offset is allocated via <function>drm_vma_offset_add</function> again. Helper functions like
2866   <function>drm_vma_node_start</function> and <function>drm_vma_node_offset_addr</function> will return 0 if no
2867   offset is allocated.
2868</para>
2869</refsect1>
2870</refentry>
2871
2872<refentry id="API-drm-vma-node-allow">
2873<refentryinfo>
2874 <title>LINUX</title>
2875 <productname>Kernel Hackers Manual</productname>
2876 <date>July 2017</date>
2877</refentryinfo>
2878<refmeta>
2879 <refentrytitle><phrase>drm_vma_node_allow</phrase></refentrytitle>
2880 <manvolnum>9</manvolnum>
2881 <refmiscinfo class="version">4.4.14</refmiscinfo>
2882</refmeta>
2883<refnamediv>
2884 <refname>drm_vma_node_allow</refname>
2885 <refpurpose>
2886     Add open-file to list of allowed users
2887 </refpurpose>
2888</refnamediv>
2889<refsynopsisdiv>
2890 <title>Synopsis</title>
2891  <funcsynopsis><funcprototype>
2892   <funcdef>int <function>drm_vma_node_allow </function></funcdef>
2893   <paramdef>struct drm_vma_offset_node * <parameter>node</parameter></paramdef>
2894   <paramdef>struct file * <parameter>filp</parameter></paramdef>
2895  </funcprototype></funcsynopsis>
2896</refsynopsisdiv>
2897<refsect1>
2898 <title>Arguments</title>
2899 <variablelist>
2900  <varlistentry>
2901   <term><parameter>node</parameter></term>
2902   <listitem>
2903    <para>
2904     Node to modify
2905    </para>
2906   </listitem>
2907  </varlistentry>
2908  <varlistentry>
2909   <term><parameter>filp</parameter></term>
2910   <listitem>
2911    <para>
2912     Open file to add
2913    </para>
2914   </listitem>
2915  </varlistentry>
2916 </variablelist>
2917</refsect1>
2918<refsect1>
2919<title>Description</title>
2920<para>
2921   Add <parameter>filp</parameter> to the list of allowed open-files for this node. If <parameter>filp</parameter> is
2922   already on this list, the ref-count is incremented.
2923   </para><para>
2924
2925   The list of allowed-users is preserved across <function>drm_vma_offset_add</function> and
2926   <function>drm_vma_offset_remove</function> calls. You may even call it if the node is currently
2927   not added to any offset-manager.
2928   </para><para>
2929
2930   You must remove all open-files the same number of times as you added them
2931   before destroying the node. Otherwise, you will leak memory.
2932   </para><para>
2933
2934   This is locked against concurrent access internally.
2935</para>
2936</refsect1>
2937<refsect1>
2938<title>RETURNS</title>
2939<para>
2940   0 on success, negative error code on internal failure (out-of-mem)
2941</para>
2942</refsect1>
2943</refentry>
2944
2945<refentry id="API-drm-vma-node-revoke">
2946<refentryinfo>
2947 <title>LINUX</title>
2948 <productname>Kernel Hackers Manual</productname>
2949 <date>July 2017</date>
2950</refentryinfo>
2951<refmeta>
2952 <refentrytitle><phrase>drm_vma_node_revoke</phrase></refentrytitle>
2953 <manvolnum>9</manvolnum>
2954 <refmiscinfo class="version">4.4.14</refmiscinfo>
2955</refmeta>
2956<refnamediv>
2957 <refname>drm_vma_node_revoke</refname>
2958 <refpurpose>
2959     Remove open-file from list of allowed users
2960 </refpurpose>
2961</refnamediv>
2962<refsynopsisdiv>
2963 <title>Synopsis</title>
2964  <funcsynopsis><funcprototype>
2965   <funcdef>void <function>drm_vma_node_revoke </function></funcdef>
2966   <paramdef>struct drm_vma_offset_node * <parameter>node</parameter></paramdef>
2967   <paramdef>struct file * <parameter>filp</parameter></paramdef>
2968  </funcprototype></funcsynopsis>
2969</refsynopsisdiv>
2970<refsect1>
2971 <title>Arguments</title>
2972 <variablelist>
2973  <varlistentry>
2974   <term><parameter>node</parameter></term>
2975   <listitem>
2976    <para>
2977     Node to modify
2978    </para>
2979   </listitem>
2980  </varlistentry>
2981  <varlistentry>
2982   <term><parameter>filp</parameter></term>
2983   <listitem>
2984    <para>
2985     Open file to remove
2986    </para>
2987   </listitem>
2988  </varlistentry>
2989 </variablelist>
2990</refsect1>
2991<refsect1>
2992<title>Description</title>
2993<para>
2994   Decrement the ref-count of <parameter>filp</parameter> in the list of allowed open-files on <parameter>node</parameter>.
2995   If the ref-count drops to zero, remove <parameter>filp</parameter> from the list. You must call
2996   this once for every <function>drm_vma_node_allow</function> on <parameter>filp</parameter>.
2997   </para><para>
2998
2999   This is locked against concurrent access internally.
3000   </para><para>
3001
3002   If <parameter>filp</parameter> is not on the list, nothing is done.
3003</para>
3004</refsect1>
3005</refentry>
3006
3007<refentry id="API-drm-vma-node-is-allowed">
3008<refentryinfo>
3009 <title>LINUX</title>
3010 <productname>Kernel Hackers Manual</productname>
3011 <date>July 2017</date>
3012</refentryinfo>
3013<refmeta>
3014 <refentrytitle><phrase>drm_vma_node_is_allowed</phrase></refentrytitle>
3015 <manvolnum>9</manvolnum>
3016 <refmiscinfo class="version">4.4.14</refmiscinfo>
3017</refmeta>
3018<refnamediv>
3019 <refname>drm_vma_node_is_allowed</refname>
3020 <refpurpose>
3021     Check whether an open-file is granted access
3022 </refpurpose>
3023</refnamediv>
3024<refsynopsisdiv>
3025 <title>Synopsis</title>
3026  <funcsynopsis><funcprototype>
3027   <funcdef>bool <function>drm_vma_node_is_allowed </function></funcdef>
3028   <paramdef>struct drm_vma_offset_node * <parameter>node</parameter></paramdef>
3029   <paramdef>struct file * <parameter>filp</parameter></paramdef>
3030  </funcprototype></funcsynopsis>
3031</refsynopsisdiv>
3032<refsect1>
3033 <title>Arguments</title>
3034 <variablelist>
3035  <varlistentry>
3036   <term><parameter>node</parameter></term>
3037   <listitem>
3038    <para>
3039     Node to check
3040    </para>
3041   </listitem>
3042  </varlistentry>
3043  <varlistentry>
3044   <term><parameter>filp</parameter></term>
3045   <listitem>
3046    <para>
3047     Open-file to check for
3048    </para>
3049   </listitem>
3050  </varlistentry>
3051 </variablelist>
3052</refsect1>
3053<refsect1>
3054<title>Description</title>
3055<para>
3056   Search the list in <parameter>node</parameter> whether <parameter>filp</parameter> is currently on the list of allowed
3057   open-files (see <function>drm_vma_node_allow</function>).
3058   </para><para>
3059
3060   This is locked against concurrent access internally.
3061</para>
3062</refsect1>
3063<refsect1>
3064<title>RETURNS</title>
3065<para>
3066   true iff <parameter>filp</parameter> is on the list
3067</para>
3068</refsect1>
3069</refentry>
3070
3071<!-- include/drm/drm_vma_manager.h -->
3072<refentry id="API-drm-vma-offset-exact-lookup-locked">
3073<refentryinfo>
3074 <title>LINUX</title>
3075 <productname>Kernel Hackers Manual</productname>
3076 <date>July 2017</date>
3077</refentryinfo>
3078<refmeta>
3079 <refentrytitle><phrase>drm_vma_offset_exact_lookup_locked</phrase></refentrytitle>
3080 <manvolnum>9</manvolnum>
3081 <refmiscinfo class="version">4.4.14</refmiscinfo>
3082</refmeta>
3083<refnamediv>
3084 <refname>drm_vma_offset_exact_lookup_locked</refname>
3085 <refpurpose>
3086  Look up node by exact address
3087 </refpurpose>
3088</refnamediv>
3089<refsynopsisdiv>
3090 <title>Synopsis</title>
3091  <funcsynopsis><funcprototype>
3092   <funcdef>struct drm_vma_offset_node * <function>drm_vma_offset_exact_lookup_locked </function></funcdef>
3093   <paramdef>struct drm_vma_offset_manager * <parameter>mgr</parameter></paramdef>
3094   <paramdef>unsigned long <parameter>start</parameter></paramdef>
3095   <paramdef>unsigned long <parameter>pages</parameter></paramdef>
3096  </funcprototype></funcsynopsis>
3097</refsynopsisdiv>
3098<refsect1>
3099 <title>Arguments</title>
3100 <variablelist>
3101  <varlistentry>
3102   <term><parameter>mgr</parameter></term>
3103   <listitem>
3104    <para>
3105     Manager object
3106    </para>
3107   </listitem>
3108  </varlistentry>
3109  <varlistentry>
3110   <term><parameter>start</parameter></term>
3111   <listitem>
3112    <para>
3113     Start address (page-based, not byte-based)
3114    </para>
3115   </listitem>
3116  </varlistentry>
3117  <varlistentry>
3118   <term><parameter>pages</parameter></term>
3119   <listitem>
3120    <para>
3121     Size of object (page-based)
3122    </para>
3123   </listitem>
3124  </varlistentry>
3125 </variablelist>
3126</refsect1>
3127<refsect1>
3128<title>Description</title>
3129<para>
3130   Same as <function>drm_vma_offset_lookup_locked</function> but does not allow any offset into the node.
3131   It only returns the exact object with the given start address.
3132</para>
3133</refsect1>
3134<refsect1>
3135<title>RETURNS</title>
3136<para>
3137   Node at exact start address <parameter>start</parameter>.
3138</para>
3139</refsect1>
3140</refentry>
3141
3142<refentry id="API-drm-vma-offset-lock-lookup">
3143<refentryinfo>
3144 <title>LINUX</title>
3145 <productname>Kernel Hackers Manual</productname>
3146 <date>July 2017</date>
3147</refentryinfo>
3148<refmeta>
3149 <refentrytitle><phrase>drm_vma_offset_lock_lookup</phrase></refentrytitle>
3150 <manvolnum>9</manvolnum>
3151 <refmiscinfo class="version">4.4.14</refmiscinfo>
3152</refmeta>
3153<refnamediv>
3154 <refname>drm_vma_offset_lock_lookup</refname>
3155 <refpurpose>
3156     Lock lookup for extended private use
3157 </refpurpose>
3158</refnamediv>
3159<refsynopsisdiv>
3160 <title>Synopsis</title>
3161  <funcsynopsis><funcprototype>
3162   <funcdef>void <function>drm_vma_offset_lock_lookup </function></funcdef>
3163   <paramdef>struct drm_vma_offset_manager * <parameter>mgr</parameter></paramdef>
3164  </funcprototype></funcsynopsis>
3165</refsynopsisdiv>
3166<refsect1>
3167 <title>Arguments</title>
3168 <variablelist>
3169  <varlistentry>
3170   <term><parameter>mgr</parameter></term>
3171   <listitem>
3172    <para>
3173     Manager object
3174    </para>
3175   </listitem>
3176  </varlistentry>
3177 </variablelist>
3178</refsect1>
3179<refsect1>
3180<title>Description</title>
3181<para>
3182   Lock VMA manager for extended lookups. Only locked VMA function calls
3183   are allowed while holding this lock. All other contexts are blocked from VMA
3184   until the lock is released via <function>drm_vma_offset_unlock_lookup</function>.
3185   </para><para>
3186
3187   Use this if you need to take a reference to the objects returned by
3188   <function>drm_vma_offset_lookup_locked</function> before releasing this lock again.
3189   </para><para>
3190
3191   This lock must not be used for anything else than extended lookups. You must
3192   not call any other VMA helpers while holding this lock.
3193</para>
3194</refsect1>
3195<refsect1>
3196<title>Note</title>
3197<para>
3198   You're in atomic-context while holding this lock!
3199</para>
3200</refsect1>
3201</refentry>
3202
3203<refentry id="API-drm-vma-offset-unlock-lookup">
3204<refentryinfo>
3205 <title>LINUX</title>
3206 <productname>Kernel Hackers Manual</productname>
3207 <date>July 2017</date>
3208</refentryinfo>
3209<refmeta>
3210 <refentrytitle><phrase>drm_vma_offset_unlock_lookup</phrase></refentrytitle>
3211 <manvolnum>9</manvolnum>
3212 <refmiscinfo class="version">4.4.14</refmiscinfo>
3213</refmeta>
3214<refnamediv>
3215 <refname>drm_vma_offset_unlock_lookup</refname>
3216 <refpurpose>
3217     Unlock lookup for extended private use
3218 </refpurpose>
3219</refnamediv>
3220<refsynopsisdiv>
3221 <title>Synopsis</title>
3222  <funcsynopsis><funcprototype>
3223   <funcdef>void <function>drm_vma_offset_unlock_lookup </function></funcdef>
3224   <paramdef>struct drm_vma_offset_manager * <parameter>mgr</parameter></paramdef>
3225  </funcprototype></funcsynopsis>
3226</refsynopsisdiv>
3227<refsect1>
3228 <title>Arguments</title>
3229 <variablelist>
3230  <varlistentry>
3231   <term><parameter>mgr</parameter></term>
3232   <listitem>
3233    <para>
3234     Manager object
3235    </para>
3236   </listitem>
3237  </varlistentry>
3238 </variablelist>
3239</refsect1>
3240<refsect1>
3241<title>Description</title>
3242<para>
3243   Release lookup-lock. See <function>drm_vma_offset_lock_lookup</function> for more information.
3244</para>
3245</refsect1>
3246</refentry>
3247
3248<refentry id="API-drm-vma-node-reset">
3249<refentryinfo>
3250 <title>LINUX</title>
3251 <productname>Kernel Hackers Manual</productname>
3252 <date>July 2017</date>
3253</refentryinfo>
3254<refmeta>
3255 <refentrytitle><phrase>drm_vma_node_reset</phrase></refentrytitle>
3256 <manvolnum>9</manvolnum>
3257 <refmiscinfo class="version">4.4.14</refmiscinfo>
3258</refmeta>
3259<refnamediv>
3260 <refname>drm_vma_node_reset</refname>
3261 <refpurpose>
3262     Initialize or reset node object
3263 </refpurpose>
3264</refnamediv>
3265<refsynopsisdiv>
3266 <title>Synopsis</title>
3267  <funcsynopsis><funcprototype>
3268   <funcdef>void <function>drm_vma_node_reset </function></funcdef>
3269   <paramdef>struct drm_vma_offset_node * <parameter>node</parameter></paramdef>
3270  </funcprototype></funcsynopsis>
3271</refsynopsisdiv>
3272<refsect1>
3273 <title>Arguments</title>
3274 <variablelist>
3275  <varlistentry>
3276   <term><parameter>node</parameter></term>
3277   <listitem>
3278    <para>
3279     Node to initialize or reset
3280    </para>
3281   </listitem>
3282  </varlistentry>
3283 </variablelist>
3284</refsect1>
3285<refsect1>
3286<title>Description</title>
3287<para>
3288   Reset a node to its initial state. This must be called before using it with
3289   any VMA offset manager.
3290   </para><para>
3291
3292   This must not be called on an already allocated node, or you will leak
3293   memory.
3294</para>
3295</refsect1>
3296</refentry>
3297
3298<refentry id="API-drm-vma-node-start">
3299<refentryinfo>
3300 <title>LINUX</title>
3301 <productname>Kernel Hackers Manual</productname>
3302 <date>July 2017</date>
3303</refentryinfo>
3304<refmeta>
3305 <refentrytitle><phrase>drm_vma_node_start</phrase></refentrytitle>
3306 <manvolnum>9</manvolnum>
3307 <refmiscinfo class="version">4.4.14</refmiscinfo>
3308</refmeta>
3309<refnamediv>
3310 <refname>drm_vma_node_start</refname>
3311 <refpurpose>
3312     Return start address for page-based addressing
3313 </refpurpose>
3314</refnamediv>
3315<refsynopsisdiv>
3316 <title>Synopsis</title>
3317  <funcsynopsis><funcprototype>
3318   <funcdef>unsigned long <function>drm_vma_node_start </function></funcdef>
3319   <paramdef>struct drm_vma_offset_node * <parameter>node</parameter></paramdef>
3320  </funcprototype></funcsynopsis>
3321</refsynopsisdiv>
3322<refsect1>
3323 <title>Arguments</title>
3324 <variablelist>
3325  <varlistentry>
3326   <term><parameter>node</parameter></term>
3327   <listitem>
3328    <para>
3329     Node to inspect
3330    </para>
3331   </listitem>
3332  </varlistentry>
3333 </variablelist>
3334</refsect1>
3335<refsect1>
3336<title>Description</title>
3337<para>
3338   Return the start address of the given node. This can be used as offset into
3339   the linear VM space that is provided by the VMA offset manager. Note that
3340   this can only be used for page-based addressing. If you need a proper offset
3341   for user-space mappings, you must apply <quote>&lt;&lt; PAGE_SHIFT</quote> or use the
3342   <function>drm_vma_node_offset_addr</function> helper instead.
3343</para>
3344</refsect1>
3345<refsect1>
3346<title>RETURNS</title>
3347<para>
3348   Start address of <parameter>node</parameter> for page-based addressing. 0 if the node does not
3349   have an offset allocated.
3350</para>
3351</refsect1>
3352</refentry>
3353
3354<refentry id="API-drm-vma-node-size">
3355<refentryinfo>
3356 <title>LINUX</title>
3357 <productname>Kernel Hackers Manual</productname>
3358 <date>July 2017</date>
3359</refentryinfo>
3360<refmeta>
3361 <refentrytitle><phrase>drm_vma_node_size</phrase></refentrytitle>
3362 <manvolnum>9</manvolnum>
3363 <refmiscinfo class="version">4.4.14</refmiscinfo>
3364</refmeta>
3365<refnamediv>
3366 <refname>drm_vma_node_size</refname>
3367 <refpurpose>
3368     Return size (page-based)
3369 </refpurpose>
3370</refnamediv>
3371<refsynopsisdiv>
3372 <title>Synopsis</title>
3373  <funcsynopsis><funcprototype>
3374   <funcdef>unsigned long <function>drm_vma_node_size </function></funcdef>
3375   <paramdef>struct drm_vma_offset_node * <parameter>node</parameter></paramdef>
3376  </funcprototype></funcsynopsis>
3377</refsynopsisdiv>
3378<refsect1>
3379 <title>Arguments</title>
3380 <variablelist>
3381  <varlistentry>
3382   <term><parameter>node</parameter></term>
3383   <listitem>
3384    <para>
3385     Node to inspect
3386    </para>
3387   </listitem>
3388  </varlistentry>
3389 </variablelist>
3390</refsect1>
3391<refsect1>
3392<title>Description</title>
3393<para>
3394   Return the size as number of pages for the given node. This is the same size
3395   that was passed to <function>drm_vma_offset_add</function>. If no offset is allocated for the
3396   node, this is 0.
3397</para>
3398</refsect1>
3399<refsect1>
3400<title>RETURNS</title>
3401<para>
3402   Size of <parameter>node</parameter> as number of pages. 0 if the node does not have an offset
3403   allocated.
3404</para>
3405</refsect1>
3406</refentry>
3407
3408<refentry id="API-drm-vma-node-has-offset">
3409<refentryinfo>
3410 <title>LINUX</title>
3411 <productname>Kernel Hackers Manual</productname>
3412 <date>July 2017</date>
3413</refentryinfo>
3414<refmeta>
3415 <refentrytitle><phrase>drm_vma_node_has_offset</phrase></refentrytitle>
3416 <manvolnum>9</manvolnum>
3417 <refmiscinfo class="version">4.4.14</refmiscinfo>
3418</refmeta>
3419<refnamediv>
3420 <refname>drm_vma_node_has_offset</refname>
3421 <refpurpose>
3422     Check whether node is added to offset manager
3423 </refpurpose>
3424</refnamediv>
3425<refsynopsisdiv>
3426 <title>Synopsis</title>
3427  <funcsynopsis><funcprototype>
3428   <funcdef>bool <function>drm_vma_node_has_offset </function></funcdef>
3429   <paramdef>struct drm_vma_offset_node * <parameter>node</parameter></paramdef>
3430  </funcprototype></funcsynopsis>
3431</refsynopsisdiv>
3432<refsect1>
3433 <title>Arguments</title>
3434 <variablelist>
3435  <varlistentry>
3436   <term><parameter>node</parameter></term>
3437   <listitem>
3438    <para>
3439     Node to be checked
3440    </para>
3441   </listitem>
3442  </varlistentry>
3443 </variablelist>
3444</refsect1>
3445<refsect1>
3446<title>RETURNS</title>
3447<para>
3448   true iff the node was previously allocated an offset and added to
3449   an vma offset manager.
3450</para>
3451</refsect1>
3452</refentry>
3453
3454<refentry id="API-drm-vma-node-offset-addr">
3455<refentryinfo>
3456 <title>LINUX</title>
3457 <productname>Kernel Hackers Manual</productname>
3458 <date>July 2017</date>
3459</refentryinfo>
3460<refmeta>
3461 <refentrytitle><phrase>drm_vma_node_offset_addr</phrase></refentrytitle>
3462 <manvolnum>9</manvolnum>
3463 <refmiscinfo class="version">4.4.14</refmiscinfo>
3464</refmeta>
3465<refnamediv>
3466 <refname>drm_vma_node_offset_addr</refname>
3467 <refpurpose>
3468     Return sanitized offset for user-space mmaps
3469 </refpurpose>
3470</refnamediv>
3471<refsynopsisdiv>
3472 <title>Synopsis</title>
3473  <funcsynopsis><funcprototype>
3474   <funcdef>__u64 <function>drm_vma_node_offset_addr </function></funcdef>
3475   <paramdef>struct drm_vma_offset_node * <parameter>node</parameter></paramdef>
3476  </funcprototype></funcsynopsis>
3477</refsynopsisdiv>
3478<refsect1>
3479 <title>Arguments</title>
3480 <variablelist>
3481  <varlistentry>
3482   <term><parameter>node</parameter></term>
3483   <listitem>
3484    <para>
3485     Linked offset node
3486    </para>
3487   </listitem>
3488  </varlistentry>
3489 </variablelist>
3490</refsect1>
3491<refsect1>
3492<title>Description</title>
3493<para>
3494   Same as <function>drm_vma_node_start</function> but returns the address as a valid offset that
3495   can be used for user-space mappings during <function>mmap</function>.
3496   This must not be called on unlinked nodes.
3497</para>
3498</refsect1>
3499<refsect1>
3500<title>RETURNS</title>
3501<para>
3502   Offset of <parameter>node</parameter> for byte-based addressing. 0 if the node does not have an
3503   object allocated.
3504</para>
3505</refsect1>
3506</refentry>
3507
3508<refentry id="API-drm-vma-node-unmap">
3509<refentryinfo>
3510 <title>LINUX</title>
3511 <productname>Kernel Hackers Manual</productname>
3512 <date>July 2017</date>
3513</refentryinfo>
3514<refmeta>
3515 <refentrytitle><phrase>drm_vma_node_unmap</phrase></refentrytitle>
3516 <manvolnum>9</manvolnum>
3517 <refmiscinfo class="version">4.4.14</refmiscinfo>
3518</refmeta>
3519<refnamediv>
3520 <refname>drm_vma_node_unmap</refname>
3521 <refpurpose>
3522     Unmap offset node
3523 </refpurpose>
3524</refnamediv>
3525<refsynopsisdiv>
3526 <title>Synopsis</title>
3527  <funcsynopsis><funcprototype>
3528   <funcdef>void <function>drm_vma_node_unmap </function></funcdef>
3529   <paramdef>struct drm_vma_offset_node * <parameter>node</parameter></paramdef>
3530   <paramdef>struct address_space * <parameter>file_mapping</parameter></paramdef>
3531  </funcprototype></funcsynopsis>
3532</refsynopsisdiv>
3533<refsect1>
3534 <title>Arguments</title>
3535 <variablelist>
3536  <varlistentry>
3537   <term><parameter>node</parameter></term>
3538   <listitem>
3539    <para>
3540     Offset node
3541    </para>
3542   </listitem>
3543  </varlistentry>
3544  <varlistentry>
3545   <term><parameter>file_mapping</parameter></term>
3546   <listitem>
3547    <para>
3548     Address space to unmap <parameter>node</parameter> from
3549    </para>
3550   </listitem>
3551  </varlistentry>
3552 </variablelist>
3553</refsect1>
3554<refsect1>
3555<title>Description</title>
3556<para>
3557   Unmap all userspace mappings for a given offset node. The mappings must be
3558   associated with the <parameter>file_mapping</parameter> address-space. If no offset exists
3559   nothing is done.
3560   </para><para>
3561
3562   This call is unlocked. The caller must guarantee that <function>drm_vma_offset_remove</function>
3563   is not called on this node concurrently.
3564</para>
3565</refsect1>
3566</refentry>
3567
3568<refentry id="API-drm-vma-node-verify-access">
3569<refentryinfo>
3570 <title>LINUX</title>
3571 <productname>Kernel Hackers Manual</productname>
3572 <date>July 2017</date>
3573</refentryinfo>
3574<refmeta>
3575 <refentrytitle><phrase>drm_vma_node_verify_access</phrase></refentrytitle>
3576 <manvolnum>9</manvolnum>
3577 <refmiscinfo class="version">4.4.14</refmiscinfo>
3578</refmeta>
3579<refnamediv>
3580 <refname>drm_vma_node_verify_access</refname>
3581 <refpurpose>
3582     Access verification helper for TTM
3583 </refpurpose>
3584</refnamediv>
3585<refsynopsisdiv>
3586 <title>Synopsis</title>
3587  <funcsynopsis><funcprototype>
3588   <funcdef>int <function>drm_vma_node_verify_access </function></funcdef>
3589   <paramdef>struct drm_vma_offset_node * <parameter>node</parameter></paramdef>
3590   <paramdef>struct file * <parameter>filp</parameter></paramdef>
3591  </funcprototype></funcsynopsis>
3592</refsynopsisdiv>
3593<refsect1>
3594 <title>Arguments</title>
3595 <variablelist>
3596  <varlistentry>
3597   <term><parameter>node</parameter></term>
3598   <listitem>
3599    <para>
3600     Offset node
3601    </para>
3602   </listitem>
3603  </varlistentry>
3604  <varlistentry>
3605   <term><parameter>filp</parameter></term>
3606   <listitem>
3607    <para>
3608     Open-file
3609    </para>
3610   </listitem>
3611  </varlistentry>
3612 </variablelist>
3613</refsect1>
3614<refsect1>
3615<title>Description</title>
3616<para>
3617   This checks whether <parameter>filp</parameter> is granted access to <parameter>node</parameter>. It is the same as
3618   <function>drm_vma_node_is_allowed</function> but suitable as drop-in helper for TTM
3619   <function>verify_access</function> callbacks.
3620</para>
3621</refsect1>
3622<refsect1>
3623<title>RETURNS</title>
3624<para>
3625   0 if access is granted, -EACCES otherwise.
3626</para>
3627</refsect1>
3628</refentry>
3629
3630    </sect2>
3631    <sect2 id="drm-prime-support">
3632      <title>PRIME Buffer Sharing</title>
3633      <para>
3634        PRIME is the cross device buffer sharing framework in drm, originally
3635        created for the OPTIMUS range of multi-gpu platforms. To userspace
3636        PRIME buffers are dma-buf based file descriptors.
3637      </para>
3638      <sect3>
3639        <title>Overview and Driver Interface</title>
3640        <para>
3641          Similar to GEM global names, PRIME file descriptors are
3642          also used to share buffer objects across processes. They offer
3643          additional security: as file descriptors must be explicitly sent over
3644          UNIX domain sockets to be shared between applications, they can't be
3645          guessed like the globally unique GEM names.
3646        </para>
3647        <para>
3648          Drivers that support the PRIME
3649          API must set the DRIVER_PRIME bit in the struct
3650          <structname>drm_driver</structname>
3651          <structfield>driver_features</structfield> field, and implement the
3652          <methodname>prime_handle_to_fd</methodname> and
3653          <methodname>prime_fd_to_handle</methodname> operations.
3654        </para>
3655        <para>
3656          <synopsis>int (*prime_handle_to_fd)(struct drm_device *dev,
3657                          struct drm_file *file_priv, uint32_t handle,
3658                          uint32_t flags, int *prime_fd);
3659int (*prime_fd_to_handle)(struct drm_device *dev,
3660                          struct drm_file *file_priv, int prime_fd,
3661                          uint32_t *handle);</synopsis>
3662            Those two operations convert a handle to a PRIME file descriptor and
3663            vice versa. Drivers must use the kernel dma-buf buffer sharing framework
3664            to manage the PRIME file descriptors. Similar to the mode setting
3665            API PRIME is agnostic to the underlying buffer object manager, as
3666            long as handles are 32bit unsigned integers.
3667          </para>
3668          <para>
3669            While non-GEM drivers must implement the operations themselves, GEM
3670            drivers must use the <function>drm_gem_prime_handle_to_fd</function>
3671            and <function>drm_gem_prime_fd_to_handle</function> helper functions.
3672            Those helpers rely on the driver
3673            <methodname>gem_prime_export</methodname> and
3674            <methodname>gem_prime_import</methodname> operations to create a dma-buf
3675            instance from a GEM object (dma-buf exporter role) and to create a GEM
3676            object from a dma-buf instance (dma-buf importer role).
3677          </para>
3678          <para>
3679            <synopsis>struct dma_buf * (*gem_prime_export)(struct drm_device *dev,
3680                             struct drm_gem_object *obj,
3681                             int flags);
3682struct drm_gem_object * (*gem_prime_import)(struct drm_device *dev,
3683                                            struct dma_buf *dma_buf);</synopsis>
3684            These two operations are mandatory for GEM drivers that support
3685            PRIME.
3686          </para>
3687        </sect3>
3688      <sect3>
3689        <title>PRIME Helper Functions</title>
3690<para>
3691   </para><para>
3692   Drivers can implement <parameter>gem_prime_export</parameter> and <parameter>gem_prime_import</parameter> in terms of
3693   simpler APIs by using the helper functions <parameter>drm_gem_prime_export</parameter> and
3694   <parameter>drm_gem_prime_import</parameter>.  These functions implement dma-buf support in terms of
3695   six lower-level driver callbacks:
3696   </para><para>
3697   Export callbacks:
3698   </para><para>
3699   - <parameter>gem_prime_pin</parameter> (optional): prepare a GEM object for exporting
3700   </para><para>
3701   - <parameter>gem_prime_get_sg_table</parameter>: provide a scatter/gather table of pinned pages
3702   </para><para>
3703   - <parameter>gem_prime_vmap</parameter>: vmap a buffer exported by your driver
3704   </para><para>
3705   - <parameter>gem_prime_vunmap</parameter>: vunmap a buffer exported by your driver
3706   </para><para>
3707   - <parameter>gem_prime_mmap</parameter> (optional): mmap a buffer exported by your driver
3708   </para><para>
3709   Import callback:
3710   </para><para>
3711   - <parameter>gem_prime_import_sg_table</parameter> (import): produce a GEM object from another
3712   driver's scatter/gather table
3713</para>
3714
3715      </sect3>
3716    </sect2>
3717    <sect2>
3718      <title>PRIME Function References</title>
3719<!-- drivers/gpu/drm/drm_prime.c -->
3720<refentry id="API-drm-gem-dmabuf-release">
3721<refentryinfo>
3722 <title>LINUX</title>
3723 <productname>Kernel Hackers Manual</productname>
3724 <date>July 2017</date>
3725</refentryinfo>
3726<refmeta>
3727 <refentrytitle><phrase>drm_gem_dmabuf_release</phrase></refentrytitle>
3728 <manvolnum>9</manvolnum>
3729 <refmiscinfo class="version">4.4.14</refmiscinfo>
3730</refmeta>
3731<refnamediv>
3732 <refname>drm_gem_dmabuf_release</refname>
3733 <refpurpose>
3734  dma_buf release implementation for GEM
3735 </refpurpose>
3736</refnamediv>
3737<refsynopsisdiv>
3738 <title>Synopsis</title>
3739  <funcsynopsis><funcprototype>
3740   <funcdef>void <function>drm_gem_dmabuf_release </function></funcdef>
3741   <paramdef>struct dma_buf * <parameter>dma_buf</parameter></paramdef>
3742  </funcprototype></funcsynopsis>
3743</refsynopsisdiv>
3744<refsect1>
3745 <title>Arguments</title>
3746 <variablelist>
3747  <varlistentry>
3748   <term><parameter>dma_buf</parameter></term>
3749   <listitem>
3750    <para>
3751     buffer to be released
3752    </para>
3753   </listitem>
3754  </varlistentry>
3755 </variablelist>
3756</refsect1>
3757<refsect1>
3758<title>Description</title>
3759<para>
3760   Generic release function for dma_bufs exported as PRIME buffers. GEM drivers
3761   must use this in their dma_buf ops structure as the release callback.
3762</para>
3763</refsect1>
3764</refentry>
3765
3766<refentry id="API-drm-gem-prime-export">
3767<refentryinfo>
3768 <title>LINUX</title>
3769 <productname>Kernel Hackers Manual</productname>
3770 <date>July 2017</date>
3771</refentryinfo>
3772<refmeta>
3773 <refentrytitle><phrase>drm_gem_prime_export</phrase></refentrytitle>
3774 <manvolnum>9</manvolnum>
3775 <refmiscinfo class="version">4.4.14</refmiscinfo>
3776</refmeta>
3777<refnamediv>
3778 <refname>drm_gem_prime_export</refname>
3779 <refpurpose>
3780     helper library implementation of the export callback
3781 </refpurpose>
3782</refnamediv>
3783<refsynopsisdiv>
3784 <title>Synopsis</title>
3785  <funcsynopsis><funcprototype>
3786   <funcdef>struct dma_buf * <function>drm_gem_prime_export </function></funcdef>
3787   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
3788   <paramdef>struct drm_gem_object * <parameter>obj</parameter></paramdef>
3789   <paramdef>int <parameter>flags</parameter></paramdef>
3790  </funcprototype></funcsynopsis>
3791</refsynopsisdiv>
3792<refsect1>
3793 <title>Arguments</title>
3794 <variablelist>
3795  <varlistentry>
3796   <term><parameter>dev</parameter></term>
3797   <listitem>
3798    <para>
3799     drm_device to export from
3800    </para>
3801   </listitem>
3802  </varlistentry>
3803  <varlistentry>
3804   <term><parameter>obj</parameter></term>
3805   <listitem>
3806    <para>
3807     GEM object to export
3808    </para>
3809   </listitem>
3810  </varlistentry>
3811  <varlistentry>
3812   <term><parameter>flags</parameter></term>
3813   <listitem>
3814    <para>
3815     flags like DRM_CLOEXEC
3816    </para>
3817   </listitem>
3818  </varlistentry>
3819 </variablelist>
3820</refsect1>
3821<refsect1>
3822<title>Description</title>
3823<para>
3824   This is the implementation of the gem_prime_export functions for GEM drivers
3825   using the PRIME helpers.
3826</para>
3827</refsect1>
3828</refentry>
3829
3830<refentry id="API-drm-gem-prime-handle-to-fd">
3831<refentryinfo>
3832 <title>LINUX</title>
3833 <productname>Kernel Hackers Manual</productname>
3834 <date>July 2017</date>
3835</refentryinfo>
3836<refmeta>
3837 <refentrytitle><phrase>drm_gem_prime_handle_to_fd</phrase></refentrytitle>
3838 <manvolnum>9</manvolnum>
3839 <refmiscinfo class="version">4.4.14</refmiscinfo>
3840</refmeta>
3841<refnamediv>
3842 <refname>drm_gem_prime_handle_to_fd</refname>
3843 <refpurpose>
3844     PRIME export function for GEM drivers
3845 </refpurpose>
3846</refnamediv>
3847<refsynopsisdiv>
3848 <title>Synopsis</title>
3849  <funcsynopsis><funcprototype>
3850   <funcdef>int <function>drm_gem_prime_handle_to_fd </function></funcdef>
3851   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
3852   <paramdef>struct drm_file * <parameter>file_priv</parameter></paramdef>
3853   <paramdef>uint32_t <parameter>handle</parameter></paramdef>
3854   <paramdef>uint32_t <parameter>flags</parameter></paramdef>
3855   <paramdef>int * <parameter>prime_fd</parameter></paramdef>
3856  </funcprototype></funcsynopsis>
3857</refsynopsisdiv>
3858<refsect1>
3859 <title>Arguments</title>
3860 <variablelist>
3861  <varlistentry>
3862   <term><parameter>dev</parameter></term>
3863   <listitem>
3864    <para>
3865     dev to export the buffer from
3866    </para>
3867   </listitem>
3868  </varlistentry>
3869  <varlistentry>
3870   <term><parameter>file_priv</parameter></term>
3871   <listitem>
3872    <para>
3873     drm file-private structure
3874    </para>
3875   </listitem>
3876  </varlistentry>
3877  <varlistentry>
3878   <term><parameter>handle</parameter></term>
3879   <listitem>
3880    <para>
3881     buffer handle to export
3882    </para>
3883   </listitem>
3884  </varlistentry>
3885  <varlistentry>
3886   <term><parameter>flags</parameter></term>
3887   <listitem>
3888    <para>
3889     flags like DRM_CLOEXEC
3890    </para>
3891   </listitem>
3892  </varlistentry>
3893  <varlistentry>
3894   <term><parameter>prime_fd</parameter></term>
3895   <listitem>
3896    <para>
3897     pointer to storage for the fd id of the create dma-buf
3898    </para>
3899   </listitem>
3900  </varlistentry>
3901 </variablelist>
3902</refsect1>
3903<refsect1>
3904<title>Description</title>
3905<para>
3906   This is the PRIME export function which must be used mandatorily by GEM
3907   drivers to ensure correct lifetime management of the underlying GEM object.
3908   The actual exporting from GEM object to a dma-buf is done through the
3909   gem_prime_export driver callback.
3910</para>
3911</refsect1>
3912</refentry>
3913
3914<refentry id="API-drm-gem-prime-import">
3915<refentryinfo>
3916 <title>LINUX</title>
3917 <productname>Kernel Hackers Manual</productname>
3918 <date>July 2017</date>
3919</refentryinfo>
3920<refmeta>
3921 <refentrytitle><phrase>drm_gem_prime_import</phrase></refentrytitle>
3922 <manvolnum>9</manvolnum>
3923 <refmiscinfo class="version">4.4.14</refmiscinfo>
3924</refmeta>
3925<refnamediv>
3926 <refname>drm_gem_prime_import</refname>
3927 <refpurpose>
3928     helper library implementation of the import callback
3929 </refpurpose>
3930</refnamediv>
3931<refsynopsisdiv>
3932 <title>Synopsis</title>
3933  <funcsynopsis><funcprototype>
3934   <funcdef>struct drm_gem_object * <function>drm_gem_prime_import </function></funcdef>
3935   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
3936   <paramdef>struct dma_buf * <parameter>dma_buf</parameter></paramdef>
3937  </funcprototype></funcsynopsis>
3938</refsynopsisdiv>
3939<refsect1>
3940 <title>Arguments</title>
3941 <variablelist>
3942  <varlistentry>
3943   <term><parameter>dev</parameter></term>
3944   <listitem>
3945    <para>
3946     drm_device to import into
3947    </para>
3948   </listitem>
3949  </varlistentry>
3950  <varlistentry>
3951   <term><parameter>dma_buf</parameter></term>
3952   <listitem>
3953    <para>
3954     dma-buf object to import
3955    </para>
3956   </listitem>
3957  </varlistentry>
3958 </variablelist>
3959</refsect1>
3960<refsect1>
3961<title>Description</title>
3962<para>
3963   This is the implementation of the gem_prime_import functions for GEM drivers
3964   using the PRIME helpers.
3965</para>
3966</refsect1>
3967</refentry>
3968
3969<refentry id="API-drm-gem-prime-fd-to-handle">
3970<refentryinfo>
3971 <title>LINUX</title>
3972 <productname>Kernel Hackers Manual</productname>
3973 <date>July 2017</date>
3974</refentryinfo>
3975<refmeta>
3976 <refentrytitle><phrase>drm_gem_prime_fd_to_handle</phrase></refentrytitle>
3977 <manvolnum>9</manvolnum>
3978 <refmiscinfo class="version">4.4.14</refmiscinfo>
3979</refmeta>
3980<refnamediv>
3981 <refname>drm_gem_prime_fd_to_handle</refname>
3982 <refpurpose>
3983     PRIME import function for GEM drivers
3984 </refpurpose>
3985</refnamediv>
3986<refsynopsisdiv>
3987 <title>Synopsis</title>
3988  <funcsynopsis><funcprototype>
3989   <funcdef>int <function>drm_gem_prime_fd_to_handle </function></funcdef>
3990   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
3991   <paramdef>struct drm_file * <parameter>file_priv</parameter></paramdef>
3992   <paramdef>int <parameter>prime_fd</parameter></paramdef>
3993   <paramdef>uint32_t * <parameter>handle</parameter></paramdef>
3994  </funcprototype></funcsynopsis>
3995</refsynopsisdiv>
3996<refsect1>
3997 <title>Arguments</title>
3998 <variablelist>
3999  <varlistentry>
4000   <term><parameter>dev</parameter></term>
4001   <listitem>
4002    <para>
4003     dev to export the buffer from
4004    </para>
4005   </listitem>
4006  </varlistentry>
4007  <varlistentry>
4008   <term><parameter>file_priv</parameter></term>
4009   <listitem>
4010    <para>
4011     drm file-private structure
4012    </para>
4013   </listitem>
4014  </varlistentry>
4015  <varlistentry>
4016   <term><parameter>prime_fd</parameter></term>
4017   <listitem>
4018    <para>
4019     fd id of the dma-buf which should be imported
4020    </para>
4021   </listitem>
4022  </varlistentry>
4023  <varlistentry>
4024   <term><parameter>handle</parameter></term>
4025   <listitem>
4026    <para>
4027     pointer to storage for the handle of the imported buffer object
4028    </para>
4029   </listitem>
4030  </varlistentry>
4031 </variablelist>
4032</refsect1>
4033<refsect1>
4034<title>Description</title>
4035<para>
4036   This is the PRIME import function which must be used mandatorily by GEM
4037   drivers to ensure correct lifetime management of the underlying GEM object.
4038   The actual importing of GEM object from the dma-buf is done through the
4039   gem_import_export driver callback.
4040</para>
4041</refsect1>
4042</refentry>
4043
4044<refentry id="API-drm-prime-pages-to-sg">
4045<refentryinfo>
4046 <title>LINUX</title>
4047 <productname>Kernel Hackers Manual</productname>
4048 <date>July 2017</date>
4049</refentryinfo>
4050<refmeta>
4051 <refentrytitle><phrase>drm_prime_pages_to_sg</phrase></refentrytitle>
4052 <manvolnum>9</manvolnum>
4053 <refmiscinfo class="version">4.4.14</refmiscinfo>
4054</refmeta>
4055<refnamediv>
4056 <refname>drm_prime_pages_to_sg</refname>
4057 <refpurpose>
4058     converts a page array into an sg list
4059 </refpurpose>
4060</refnamediv>
4061<refsynopsisdiv>
4062 <title>Synopsis</title>
4063  <funcsynopsis><funcprototype>
4064   <funcdef>struct sg_table * <function>drm_prime_pages_to_sg </function></funcdef>
4065   <paramdef>struct page ** <parameter>pages</parameter></paramdef>
4066   <paramdef>unsigned int <parameter>nr_pages</parameter></paramdef>
4067  </funcprototype></funcsynopsis>
4068</refsynopsisdiv>
4069<refsect1>
4070 <title>Arguments</title>
4071 <variablelist>
4072  <varlistentry>
4073   <term><parameter>pages</parameter></term>
4074   <listitem>
4075    <para>
4076     pointer to the array of page pointers to convert
4077    </para>
4078   </listitem>
4079  </varlistentry>
4080  <varlistentry>
4081   <term><parameter>nr_pages</parameter></term>
4082   <listitem>
4083    <para>
4084     length of the page vector
4085    </para>
4086   </listitem>
4087  </varlistentry>
4088 </variablelist>
4089</refsect1>
4090<refsect1>
4091<title>Description</title>
4092<para>
4093   This helper creates an sg table object from a set of pages
4094   the driver is responsible for mapping the pages into the
4095   importers address space for use with dma_buf itself.
4096</para>
4097</refsect1>
4098</refentry>
4099
4100<refentry id="API-drm-prime-sg-to-page-addr-arrays">
4101<refentryinfo>
4102 <title>LINUX</title>
4103 <productname>Kernel Hackers Manual</productname>
4104 <date>July 2017</date>
4105</refentryinfo>
4106<refmeta>
4107 <refentrytitle><phrase>drm_prime_sg_to_page_addr_arrays</phrase></refentrytitle>
4108 <manvolnum>9</manvolnum>
4109 <refmiscinfo class="version">4.4.14</refmiscinfo>
4110</refmeta>
4111<refnamediv>
4112 <refname>drm_prime_sg_to_page_addr_arrays</refname>
4113 <refpurpose>
4114     convert an sg table into a page array
4115 </refpurpose>
4116</refnamediv>
4117<refsynopsisdiv>
4118 <title>Synopsis</title>
4119  <funcsynopsis><funcprototype>
4120   <funcdef>int <function>drm_prime_sg_to_page_addr_arrays </function></funcdef>
4121   <paramdef>struct sg_table * <parameter>sgt</parameter></paramdef>
4122   <paramdef>struct page ** <parameter>pages</parameter></paramdef>
4123   <paramdef>dma_addr_t * <parameter>addrs</parameter></paramdef>
4124   <paramdef>int <parameter>max_pages</parameter></paramdef>
4125  </funcprototype></funcsynopsis>
4126</refsynopsisdiv>
4127<refsect1>
4128 <title>Arguments</title>
4129 <variablelist>
4130  <varlistentry>
4131   <term><parameter>sgt</parameter></term>
4132   <listitem>
4133    <para>
4134     scatter-gather table to convert
4135    </para>
4136   </listitem>
4137  </varlistentry>
4138  <varlistentry>
4139   <term><parameter>pages</parameter></term>
4140   <listitem>
4141    <para>
4142     array of page pointers to store the page array in
4143    </para>
4144   </listitem>
4145  </varlistentry>
4146  <varlistentry>
4147   <term><parameter>addrs</parameter></term>
4148   <listitem>
4149    <para>
4150     optional array to store the dma bus address of each page
4151    </para>
4152   </listitem>
4153  </varlistentry>
4154  <varlistentry>
4155   <term><parameter>max_pages</parameter></term>
4156   <listitem>
4157    <para>
4158     size of both the passed-in arrays
4159    </para>
4160   </listitem>
4161  </varlistentry>
4162 </variablelist>
4163</refsect1>
4164<refsect1>
4165<title>Description</title>
4166<para>
4167   Exports an sg table into an array of pages and addresses. This is currently
4168   required by the TTM driver in order to do correct fault handling.
4169</para>
4170</refsect1>
4171</refentry>
4172
4173<refentry id="API-drm-prime-gem-destroy">
4174<refentryinfo>
4175 <title>LINUX</title>
4176 <productname>Kernel Hackers Manual</productname>
4177 <date>July 2017</date>
4178</refentryinfo>
4179<refmeta>
4180 <refentrytitle><phrase>drm_prime_gem_destroy</phrase></refentrytitle>
4181 <manvolnum>9</manvolnum>
4182 <refmiscinfo class="version">4.4.14</refmiscinfo>
4183</refmeta>
4184<refnamediv>
4185 <refname>drm_prime_gem_destroy</refname>
4186 <refpurpose>
4187     helper to clean up a PRIME-imported GEM object
4188 </refpurpose>
4189</refnamediv>
4190<refsynopsisdiv>
4191 <title>Synopsis</title>
4192  <funcsynopsis><funcprototype>
4193   <funcdef>void <function>drm_prime_gem_destroy </function></funcdef>
4194   <paramdef>struct drm_gem_object * <parameter>obj</parameter></paramdef>
4195   <paramdef>struct sg_table * <parameter>sg</parameter></paramdef>
4196  </funcprototype></funcsynopsis>
4197</refsynopsisdiv>
4198<refsect1>
4199 <title>Arguments</title>
4200 <variablelist>
4201  <varlistentry>
4202   <term><parameter>obj</parameter></term>
4203   <listitem>
4204    <para>
4205     GEM object which was created from a dma-buf
4206    </para>
4207   </listitem>
4208  </varlistentry>
4209  <varlistentry>
4210   <term><parameter>sg</parameter></term>
4211   <listitem>
4212    <para>
4213     the sg-table which was pinned at import time
4214    </para>
4215   </listitem>
4216  </varlistentry>
4217 </variablelist>
4218</refsect1>
4219<refsect1>
4220<title>Description</title>
4221<para>
4222   This is the cleanup functions which GEM drivers need to call when they use
4223   <parameter>drm_gem_prime_import</parameter> to import dma-bufs.
4224</para>
4225</refsect1>
4226</refentry>
4227
4228    </sect2>
4229    <sect2>
4230      <title>DRM MM Range Allocator</title>
4231      <sect3>
4232        <title>Overview</title>
4233<para>
4234   </para><para>
4235   drm_mm provides a simple range allocator. The drivers are free to use the
4236   resource allocator from the linux core if it suits them, the upside of drm_mm
4237   is that it's in the DRM core. Which means that it's easier to extend for
4238   some of the crazier special purpose needs of gpus.
4239   </para><para>
4240   The main data struct is <structname>drm_mm</structname>, allocations are tracked in <structname>drm_mm_node</structname>.
4241   Drivers are free to embed either of them into their own suitable
4242   datastructures. drm_mm itself will not do any allocations of its own, so if
4243   drivers choose not to embed nodes they need to still allocate them
4244   themselves.
4245   </para><para>
4246   The range allocator also supports reservation of preallocated blocks. This is
4247   useful for taking over initial mode setting configurations from the firmware,
4248   where an object needs to be created which exactly matches the firmware's
4249   scanout target. As long as the range is still free it can be inserted anytime
4250   after the allocator is initialized, which helps with avoiding looped
4251   depencies in the driver load sequence.
4252   </para><para>
4253   drm_mm maintains a stack of most recently freed holes, which of all
4254   simplistic datastructures seems to be a fairly decent approach to clustering
4255   allocations and avoiding too much fragmentation. This means free space
4256   searches are O(num_holes). Given that all the fancy features drm_mm supports
4257   something better would be fairly complex and since gfx thrashing is a fairly
4258   steep cliff not a real concern. Removing a node again is O(1).
4259   </para><para>
4260   drm_mm supports a few features: Alignment and range restrictions can be
4261   supplied. Further more every <structname>drm_mm_node</structname> has a color value (which is just an
4262   opaqua unsigned long) which in conjunction with a driver callback can be used
4263   to implement sophisticated placement restrictions. The i915 DRM driver uses
4264   this to implement guard pages between incompatible caching domains in the
4265   graphics TT.
4266   </para><para>
4267   Two behaviors are supported for searching and allocating: bottom-up and top-down.
4268   The default is bottom-up. Top-down allocation can be used if the memory area
4269   has different restrictions, or just to reduce fragmentation.
4270   </para><para>
4271   Finally iteration helpers to walk all nodes and all holes are provided as are
4272   some basic allocator dumpers for debugging.
4273</para>
4274
4275      </sect3>
4276      <sect3>
4277        <title>LRU Scan/Eviction Support</title>
4278<para>
4279   </para><para>
4280   Very often GPUs need to have continuous allocations for a given object. When
4281   evicting objects to make space for a new one it is therefore not most
4282   efficient when we simply start to select all objects from the tail of an LRU
4283   until there's a suitable hole: Especially for big objects or nodes that
4284   otherwise have special allocation constraints there's a good chance we evict
4285   lots of (smaller) objects unecessarily.
4286   </para><para>
4287   The DRM range allocator supports this use-case through the scanning
4288   interfaces. First a scan operation needs to be initialized with
4289   <function>drm_mm_init_scan</function> or <function>drm_mm_init_scan_with_range</function>. The the driver adds
4290   objects to the roaster (probably by walking an LRU list, but this can be
4291   freely implemented) until a suitable hole is found or there's no further
4292   evitable object.
4293   </para><para>
4294   The the driver must walk through all objects again in exactly the reverse
4295   order to restore the allocator state. Note that while the allocator is used
4296   in the scan mode no other operation is allowed.
4297   </para><para>
4298   Finally the driver evicts all objects selected in the scan. Adding and
4299   removing an object is O(1), and since freeing a node is also O(1) the overall
4300   complexity is O(scanned_objects). So like the free stack which needs to be
4301   walked before a scan operation even begins this is linear in the number of
4302   objects. It doesn't seem to hurt badly.
4303</para>
4304
4305      </sect3>
4306      </sect2>
4307    <sect2>
4308      <title>DRM MM Range Allocator Function References</title>
4309<!-- drivers/gpu/drm/drm_mm.c -->
4310<refentry id="API-drm-mm-reserve-node">
4311<refentryinfo>
4312 <title>LINUX</title>
4313 <productname>Kernel Hackers Manual</productname>
4314 <date>July 2017</date>
4315</refentryinfo>
4316<refmeta>
4317 <refentrytitle><phrase>drm_mm_reserve_node</phrase></refentrytitle>
4318 <manvolnum>9</manvolnum>
4319 <refmiscinfo class="version">4.4.14</refmiscinfo>
4320</refmeta>
4321<refnamediv>
4322 <refname>drm_mm_reserve_node</refname>
4323 <refpurpose>
4324  insert an pre-initialized node
4325 </refpurpose>
4326</refnamediv>
4327<refsynopsisdiv>
4328 <title>Synopsis</title>
4329  <funcsynopsis><funcprototype>
4330   <funcdef>int <function>drm_mm_reserve_node </function></funcdef>
4331   <paramdef>struct drm_mm * <parameter>mm</parameter></paramdef>
4332   <paramdef>struct drm_mm_node * <parameter>node</parameter></paramdef>
4333  </funcprototype></funcsynopsis>
4334</refsynopsisdiv>
4335<refsect1>
4336 <title>Arguments</title>
4337 <variablelist>
4338  <varlistentry>
4339   <term><parameter>mm</parameter></term>
4340   <listitem>
4341    <para>
4342     drm_mm allocator to insert <parameter>node</parameter> into
4343    </para>
4344   </listitem>
4345  </varlistentry>
4346  <varlistentry>
4347   <term><parameter>node</parameter></term>
4348   <listitem>
4349    <para>
4350     drm_mm_node to insert
4351    </para>
4352   </listitem>
4353  </varlistentry>
4354 </variablelist>
4355</refsect1>
4356<refsect1>
4357<title>Description</title>
4358<para>
4359   This functions inserts an already set-up drm_mm_node into the allocator,
4360   meaning that start, size and color must be set by the caller. This is useful
4361   to initialize the allocator with preallocated objects which must be set-up
4362   before the range allocator can be set-up, e.g. when taking over a firmware
4363   framebuffer.
4364</para>
4365</refsect1>
4366<refsect1>
4367<title>Returns</title>
4368<para>
4369   0 on success, -ENOSPC if there's no hole where <parameter>node</parameter> is.
4370</para>
4371</refsect1>
4372</refentry>
4373
4374<refentry id="API-drm-mm-insert-node-generic">
4375<refentryinfo>
4376 <title>LINUX</title>
4377 <productname>Kernel Hackers Manual</productname>
4378 <date>July 2017</date>
4379</refentryinfo>
4380<refmeta>
4381 <refentrytitle><phrase>drm_mm_insert_node_generic</phrase></refentrytitle>
4382 <manvolnum>9</manvolnum>
4383 <refmiscinfo class="version">4.4.14</refmiscinfo>
4384</refmeta>
4385<refnamediv>
4386 <refname>drm_mm_insert_node_generic</refname>
4387 <refpurpose>
4388     search for space and insert <parameter>node</parameter>
4389 </refpurpose>
4390</refnamediv>
4391<refsynopsisdiv>
4392 <title>Synopsis</title>
4393  <funcsynopsis><funcprototype>
4394   <funcdef>int <function>drm_mm_insert_node_generic </function></funcdef>
4395   <paramdef>struct drm_mm * <parameter>mm</parameter></paramdef>
4396   <paramdef>struct drm_mm_node * <parameter>node</parameter></paramdef>
4397   <paramdef>u64 <parameter>size</parameter></paramdef>
4398   <paramdef>unsigned <parameter>alignment</parameter></paramdef>
4399   <paramdef>unsigned long <parameter>color</parameter></paramdef>
4400   <paramdef>enum drm_mm_search_flags <parameter>sflags</parameter></paramdef>
4401   <paramdef>enum drm_mm_allocator_flags <parameter>aflags</parameter></paramdef>
4402  </funcprototype></funcsynopsis>
4403</refsynopsisdiv>
4404<refsect1>
4405 <title>Arguments</title>
4406 <variablelist>
4407  <varlistentry>
4408   <term><parameter>mm</parameter></term>
4409   <listitem>
4410    <para>
4411     drm_mm to allocate from
4412    </para>
4413   </listitem>
4414  </varlistentry>
4415  <varlistentry>
4416   <term><parameter>node</parameter></term>
4417   <listitem>
4418    <para>
4419     preallocate node to insert
4420    </para>
4421   </listitem>
4422  </varlistentry>
4423  <varlistentry>
4424   <term><parameter>size</parameter></term>
4425   <listitem>
4426    <para>
4427     size of the allocation
4428    </para>
4429   </listitem>
4430  </varlistentry>
4431  <varlistentry>
4432   <term><parameter>alignment</parameter></term>
4433   <listitem>
4434    <para>
4435     alignment of the allocation
4436    </para>
4437   </listitem>
4438  </varlistentry>
4439  <varlistentry>
4440   <term><parameter>color</parameter></term>
4441   <listitem>
4442    <para>
4443     opaque tag value to use for this node
4444    </para>
4445   </listitem>
4446  </varlistentry>
4447  <varlistentry>
4448   <term><parameter>sflags</parameter></term>
4449   <listitem>
4450    <para>
4451     flags to fine-tune the allocation search
4452    </para>
4453   </listitem>
4454  </varlistentry>
4455  <varlistentry>
4456   <term><parameter>aflags</parameter></term>
4457   <listitem>
4458    <para>
4459     flags to fine-tune the allocation behavior
4460    </para>
4461   </listitem>
4462  </varlistentry>
4463 </variablelist>
4464</refsect1>
4465<refsect1>
4466<title>Description</title>
4467<para>
4468   The preallocated node must be cleared to 0.
4469</para>
4470</refsect1>
4471<refsect1>
4472<title>Returns</title>
4473<para>
4474   0 on success, -ENOSPC if there's no suitable hole.
4475</para>
4476</refsect1>
4477</refentry>
4478
4479<refentry id="API-drm-mm-insert-node-in-range-generic">
4480<refentryinfo>
4481 <title>LINUX</title>
4482 <productname>Kernel Hackers Manual</productname>
4483 <date>July 2017</date>
4484</refentryinfo>
4485<refmeta>
4486 <refentrytitle><phrase>drm_mm_insert_node_in_range_generic</phrase></refentrytitle>
4487 <manvolnum>9</manvolnum>
4488 <refmiscinfo class="version">4.4.14</refmiscinfo>
4489</refmeta>
4490<refnamediv>
4491 <refname>drm_mm_insert_node_in_range_generic</refname>
4492 <refpurpose>
4493     ranged search for space and insert <parameter>node</parameter>
4494 </refpurpose>
4495</refnamediv>
4496<refsynopsisdiv>
4497 <title>Synopsis</title>
4498  <funcsynopsis><funcprototype>
4499   <funcdef>int <function>drm_mm_insert_node_in_range_generic </function></funcdef>
4500   <paramdef>struct drm_mm * <parameter>mm</parameter></paramdef>
4501   <paramdef>struct drm_mm_node * <parameter>node</parameter></paramdef>
4502   <paramdef>u64 <parameter>size</parameter></paramdef>
4503   <paramdef>unsigned <parameter>alignment</parameter></paramdef>
4504   <paramdef>unsigned long <parameter>color</parameter></paramdef>
4505   <paramdef>u64 <parameter>start</parameter></paramdef>
4506   <paramdef>u64 <parameter>end</parameter></paramdef>
4507   <paramdef>enum drm_mm_search_flags <parameter>sflags</parameter></paramdef>
4508   <paramdef>enum drm_mm_allocator_flags <parameter>aflags</parameter></paramdef>
4509  </funcprototype></funcsynopsis>
4510</refsynopsisdiv>
4511<refsect1>
4512 <title>Arguments</title>
4513 <variablelist>
4514  <varlistentry>
4515   <term><parameter>mm</parameter></term>
4516   <listitem>
4517    <para>
4518     drm_mm to allocate from
4519    </para>
4520   </listitem>
4521  </varlistentry>
4522  <varlistentry>
4523   <term><parameter>node</parameter></term>
4524   <listitem>
4525    <para>
4526     preallocate node to insert
4527    </para>
4528   </listitem>
4529  </varlistentry>
4530  <varlistentry>
4531   <term><parameter>size</parameter></term>
4532   <listitem>
4533    <para>
4534     size of the allocation
4535    </para>
4536   </listitem>
4537  </varlistentry>
4538  <varlistentry>
4539   <term><parameter>alignment</parameter></term>
4540   <listitem>
4541    <para>
4542     alignment of the allocation
4543    </para>
4544   </listitem>
4545  </varlistentry>
4546  <varlistentry>
4547   <term><parameter>color</parameter></term>
4548   <listitem>
4549    <para>
4550     opaque tag value to use for this node
4551    </para>
4552   </listitem>
4553  </varlistentry>
4554  <varlistentry>
4555   <term><parameter>start</parameter></term>
4556   <listitem>
4557    <para>
4558     start of the allowed range for this node
4559    </para>
4560   </listitem>
4561  </varlistentry>
4562  <varlistentry>
4563   <term><parameter>end</parameter></term>
4564   <listitem>
4565    <para>
4566     end of the allowed range for this node
4567    </para>
4568   </listitem>
4569  </varlistentry>
4570  <varlistentry>
4571   <term><parameter>sflags</parameter></term>
4572   <listitem>
4573    <para>
4574     flags to fine-tune the allocation search
4575    </para>
4576   </listitem>
4577  </varlistentry>
4578  <varlistentry>
4579   <term><parameter>aflags</parameter></term>
4580   <listitem>
4581    <para>
4582     flags to fine-tune the allocation behavior
4583    </para>
4584   </listitem>
4585  </varlistentry>
4586 </variablelist>
4587</refsect1>
4588<refsect1>
4589<title>Description</title>
4590<para>
4591   The preallocated node must be cleared to 0.
4592</para>
4593</refsect1>
4594<refsect1>
4595<title>Returns</title>
4596<para>
4597   0 on success, -ENOSPC if there's no suitable hole.
4598</para>
4599</refsect1>
4600</refentry>
4601
4602<refentry id="API-drm-mm-remove-node">
4603<refentryinfo>
4604 <title>LINUX</title>
4605 <productname>Kernel Hackers Manual</productname>
4606 <date>July 2017</date>
4607</refentryinfo>
4608<refmeta>
4609 <refentrytitle><phrase>drm_mm_remove_node</phrase></refentrytitle>
4610 <manvolnum>9</manvolnum>
4611 <refmiscinfo class="version">4.4.14</refmiscinfo>
4612</refmeta>
4613<refnamediv>
4614 <refname>drm_mm_remove_node</refname>
4615 <refpurpose>
4616     Remove a memory node from the allocator.
4617 </refpurpose>
4618</refnamediv>
4619<refsynopsisdiv>
4620 <title>Synopsis</title>
4621  <funcsynopsis><funcprototype>
4622   <funcdef>void <function>drm_mm_remove_node </function></funcdef>
4623   <paramdef>struct drm_mm_node * <parameter>node</parameter></paramdef>
4624  </funcprototype></funcsynopsis>
4625</refsynopsisdiv>
4626<refsect1>
4627 <title>Arguments</title>
4628 <variablelist>
4629  <varlistentry>
4630   <term><parameter>node</parameter></term>
4631   <listitem>
4632    <para>
4633     drm_mm_node to remove
4634    </para>
4635   </listitem>
4636  </varlistentry>
4637 </variablelist>
4638</refsect1>
4639<refsect1>
4640<title>Description</title>
4641<para>
4642   This just removes a node from its drm_mm allocator. The node does not need to
4643   be cleared again before it can be re-inserted into this or any other drm_mm
4644   allocator. It is a bug to call this function on a un-allocated node.
4645</para>
4646</refsect1>
4647</refentry>
4648
4649<refentry id="API-drm-mm-replace-node">
4650<refentryinfo>
4651 <title>LINUX</title>
4652 <productname>Kernel Hackers Manual</productname>
4653 <date>July 2017</date>
4654</refentryinfo>
4655<refmeta>
4656 <refentrytitle><phrase>drm_mm_replace_node</phrase></refentrytitle>
4657 <manvolnum>9</manvolnum>
4658 <refmiscinfo class="version">4.4.14</refmiscinfo>
4659</refmeta>
4660<refnamediv>
4661 <refname>drm_mm_replace_node</refname>
4662 <refpurpose>
4663     move an allocation from <parameter>old</parameter> to <parameter>new</parameter>
4664 </refpurpose>
4665</refnamediv>
4666<refsynopsisdiv>
4667 <title>Synopsis</title>
4668  <funcsynopsis><funcprototype>
4669   <funcdef>void <function>drm_mm_replace_node </function></funcdef>
4670   <paramdef>struct drm_mm_node * <parameter>old</parameter></paramdef>
4671   <paramdef>struct drm_mm_node * <parameter>new</parameter></paramdef>
4672  </funcprototype></funcsynopsis>
4673</refsynopsisdiv>
4674<refsect1>
4675 <title>Arguments</title>
4676 <variablelist>
4677  <varlistentry>
4678   <term><parameter>old</parameter></term>
4679   <listitem>
4680    <para>
4681     drm_mm_node to remove from the allocator
4682    </para>
4683   </listitem>
4684  </varlistentry>
4685  <varlistentry>
4686   <term><parameter>new</parameter></term>
4687   <listitem>
4688    <para>
4689     drm_mm_node which should inherit <parameter>old</parameter>'s allocation
4690    </para>
4691   </listitem>
4692  </varlistentry>
4693 </variablelist>
4694</refsect1>
4695<refsect1>
4696<title>Description</title>
4697<para>
4698   This is useful for when drivers embed the drm_mm_node structure and hence
4699   can't move allocations by reassigning pointers. It's a combination of remove
4700   and insert with the guarantee that the allocation start will match.
4701</para>
4702</refsect1>
4703</refentry>
4704
4705<refentry id="API-drm-mm-init-scan">
4706<refentryinfo>
4707 <title>LINUX</title>
4708 <productname>Kernel Hackers Manual</productname>
4709 <date>July 2017</date>
4710</refentryinfo>
4711<refmeta>
4712 <refentrytitle><phrase>drm_mm_init_scan</phrase></refentrytitle>
4713 <manvolnum>9</manvolnum>
4714 <refmiscinfo class="version">4.4.14</refmiscinfo>
4715</refmeta>
4716<refnamediv>
4717 <refname>drm_mm_init_scan</refname>
4718 <refpurpose>
4719     initialize lru scanning
4720 </refpurpose>
4721</refnamediv>
4722<refsynopsisdiv>
4723 <title>Synopsis</title>
4724  <funcsynopsis><funcprototype>
4725   <funcdef>void <function>drm_mm_init_scan </function></funcdef>
4726   <paramdef>struct drm_mm * <parameter>mm</parameter></paramdef>
4727   <paramdef>u64 <parameter>size</parameter></paramdef>
4728   <paramdef>unsigned <parameter>alignment</parameter></paramdef>
4729   <paramdef>unsigned long <parameter>color</parameter></paramdef>
4730  </funcprototype></funcsynopsis>
4731</refsynopsisdiv>
4732<refsect1>
4733 <title>Arguments</title>
4734 <variablelist>
4735  <varlistentry>
4736   <term><parameter>mm</parameter></term>
4737   <listitem>
4738    <para>
4739     drm_mm to scan
4740    </para>
4741   </listitem>
4742  </varlistentry>
4743  <varlistentry>
4744   <term><parameter>size</parameter></term>
4745   <listitem>
4746    <para>
4747     size of the allocation
4748    </para>
4749   </listitem>
4750  </varlistentry>
4751  <varlistentry>
4752   <term><parameter>alignment</parameter></term>
4753   <listitem>
4754    <para>
4755     alignment of the allocation
4756    </para>
4757   </listitem>
4758  </varlistentry>
4759  <varlistentry>
4760   <term><parameter>color</parameter></term>
4761   <listitem>
4762    <para>
4763     opaque tag value to use for the allocation
4764    </para>
4765   </listitem>
4766  </varlistentry>
4767 </variablelist>
4768</refsect1>
4769<refsect1>
4770<title>Description</title>
4771<para>
4772   This simply sets up the scanning routines with the parameters for the desired
4773   hole. Note that there's no need to specify allocation flags, since they only
4774   change the place a node is allocated from within a suitable hole.
4775</para>
4776</refsect1>
4777<refsect1>
4778<title>Warning</title>
4779<para>
4780   As long as the scan list is non-empty, no other operations than
4781   adding/removing nodes to/from the scan list are allowed.
4782</para>
4783</refsect1>
4784</refentry>
4785
4786<refentry id="API-drm-mm-init-scan-with-range">
4787<refentryinfo>
4788 <title>LINUX</title>
4789 <productname>Kernel Hackers Manual</productname>
4790 <date>July 2017</date>
4791</refentryinfo>
4792<refmeta>
4793 <refentrytitle><phrase>drm_mm_init_scan_with_range</phrase></refentrytitle>
4794 <manvolnum>9</manvolnum>
4795 <refmiscinfo class="version">4.4.14</refmiscinfo>
4796</refmeta>
4797<refnamediv>
4798 <refname>drm_mm_init_scan_with_range</refname>
4799 <refpurpose>
4800     initialize range-restricted lru scanning
4801 </refpurpose>
4802</refnamediv>
4803<refsynopsisdiv>
4804 <title>Synopsis</title>
4805  <funcsynopsis><funcprototype>
4806   <funcdef>void <function>drm_mm_init_scan_with_range </function></funcdef>
4807   <paramdef>struct drm_mm * <parameter>mm</parameter></paramdef>
4808   <paramdef>u64 <parameter>size</parameter></paramdef>
4809   <paramdef>unsigned <parameter>alignment</parameter></paramdef>
4810   <paramdef>unsigned long <parameter>color</parameter></paramdef>
4811   <paramdef>u64 <parameter>start</parameter></paramdef>
4812   <paramdef>u64 <parameter>end</parameter></paramdef>
4813  </funcprototype></funcsynopsis>
4814</refsynopsisdiv>
4815<refsect1>
4816 <title>Arguments</title>
4817 <variablelist>
4818  <varlistentry>
4819   <term><parameter>mm</parameter></term>
4820   <listitem>
4821    <para>
4822     drm_mm to scan
4823    </para>
4824   </listitem>
4825  </varlistentry>
4826  <varlistentry>
4827   <term><parameter>size</parameter></term>
4828   <listitem>
4829    <para>
4830     size of the allocation
4831    </para>
4832   </listitem>
4833  </varlistentry>
4834  <varlistentry>
4835   <term><parameter>alignment</parameter></term>
4836   <listitem>
4837    <para>
4838     alignment of the allocation
4839    </para>
4840   </listitem>
4841  </varlistentry>
4842  <varlistentry>
4843   <term><parameter>color</parameter></term>
4844   <listitem>
4845    <para>
4846     opaque tag value to use for the allocation
4847    </para>
4848   </listitem>
4849  </varlistentry>
4850  <varlistentry>
4851   <term><parameter>start</parameter></term>
4852   <listitem>
4853    <para>
4854     start of the allowed range for the allocation
4855    </para>
4856   </listitem>
4857  </varlistentry>
4858  <varlistentry>
4859   <term><parameter>end</parameter></term>
4860   <listitem>
4861    <para>
4862     end of the allowed range for the allocation
4863    </para>
4864   </listitem>
4865  </varlistentry>
4866 </variablelist>
4867</refsect1>
4868<refsect1>
4869<title>Description</title>
4870<para>
4871   This simply sets up the scanning routines with the parameters for the desired
4872   hole. Note that there's no need to specify allocation flags, since they only
4873   change the place a node is allocated from within a suitable hole.
4874</para>
4875</refsect1>
4876<refsect1>
4877<title>Warning</title>
4878<para>
4879   As long as the scan list is non-empty, no other operations than
4880   adding/removing nodes to/from the scan list are allowed.
4881</para>
4882</refsect1>
4883</refentry>
4884
4885<refentry id="API-drm-mm-scan-add-block">
4886<refentryinfo>
4887 <title>LINUX</title>
4888 <productname>Kernel Hackers Manual</productname>
4889 <date>July 2017</date>
4890</refentryinfo>
4891<refmeta>
4892 <refentrytitle><phrase>drm_mm_scan_add_block</phrase></refentrytitle>
4893 <manvolnum>9</manvolnum>
4894 <refmiscinfo class="version">4.4.14</refmiscinfo>
4895</refmeta>
4896<refnamediv>
4897 <refname>drm_mm_scan_add_block</refname>
4898 <refpurpose>
4899     add a node to the scan list
4900 </refpurpose>
4901</refnamediv>
4902<refsynopsisdiv>
4903 <title>Synopsis</title>
4904  <funcsynopsis><funcprototype>
4905   <funcdef>bool <function>drm_mm_scan_add_block </function></funcdef>
4906   <paramdef>struct drm_mm_node * <parameter>node</parameter></paramdef>
4907  </funcprototype></funcsynopsis>
4908</refsynopsisdiv>
4909<refsect1>
4910 <title>Arguments</title>
4911 <variablelist>
4912  <varlistentry>
4913   <term><parameter>node</parameter></term>
4914   <listitem>
4915    <para>
4916     drm_mm_node to add
4917    </para>
4918   </listitem>
4919  </varlistentry>
4920 </variablelist>
4921</refsect1>
4922<refsect1>
4923<title>Description</title>
4924<para>
4925   Add a node to the scan list that might be freed to make space for the desired
4926   hole.
4927</para>
4928</refsect1>
4929<refsect1>
4930<title>Returns</title>
4931<para>
4932   True if a hole has been found, false otherwise.
4933</para>
4934</refsect1>
4935</refentry>
4936
4937<refentry id="API-drm-mm-scan-remove-block">
4938<refentryinfo>
4939 <title>LINUX</title>
4940 <productname>Kernel Hackers Manual</productname>
4941 <date>July 2017</date>
4942</refentryinfo>
4943<refmeta>
4944 <refentrytitle><phrase>drm_mm_scan_remove_block</phrase></refentrytitle>
4945 <manvolnum>9</manvolnum>
4946 <refmiscinfo class="version">4.4.14</refmiscinfo>
4947</refmeta>
4948<refnamediv>
4949 <refname>drm_mm_scan_remove_block</refname>
4950 <refpurpose>
4951     remove a node from the scan list
4952 </refpurpose>
4953</refnamediv>
4954<refsynopsisdiv>
4955 <title>Synopsis</title>
4956  <funcsynopsis><funcprototype>
4957   <funcdef>bool <function>drm_mm_scan_remove_block </function></funcdef>
4958   <paramdef>struct drm_mm_node * <parameter>node</parameter></paramdef>
4959  </funcprototype></funcsynopsis>
4960</refsynopsisdiv>
4961<refsect1>
4962 <title>Arguments</title>
4963 <variablelist>
4964  <varlistentry>
4965   <term><parameter>node</parameter></term>
4966   <listitem>
4967    <para>
4968     drm_mm_node to remove
4969    </para>
4970   </listitem>
4971  </varlistentry>
4972 </variablelist>
4973</refsect1>
4974<refsect1>
4975<title>Description</title>
4976<para>
4977   Nodes _must_ be removed in the exact same order from the scan list as they
4978   have been added, otherwise the internal state of the memory manager will be
4979   corrupted.
4980   </para><para>
4981
4982   When the scan list is empty, the selected memory nodes can be freed. An
4983   immediately following drm_mm_search_free with !DRM_MM_SEARCH_BEST will then
4984   return the just freed block (because its at the top of the free_stack list).
4985</para>
4986</refsect1>
4987<refsect1>
4988<title>Returns</title>
4989<para>
4990   True if this block should be evicted, false otherwise. Will always
4991   return false when no hole has been found.
4992</para>
4993</refsect1>
4994</refentry>
4995
4996<refentry id="API-drm-mm-clean">
4997<refentryinfo>
4998 <title>LINUX</title>
4999 <productname>Kernel Hackers Manual</productname>
5000 <date>July 2017</date>
5001</refentryinfo>
5002<refmeta>
5003 <refentrytitle><phrase>drm_mm_clean</phrase></refentrytitle>
5004 <manvolnum>9</manvolnum>
5005 <refmiscinfo class="version">4.4.14</refmiscinfo>
5006</refmeta>
5007<refnamediv>
5008 <refname>drm_mm_clean</refname>
5009 <refpurpose>
5010     checks whether an allocator is clean
5011 </refpurpose>
5012</refnamediv>
5013<refsynopsisdiv>
5014 <title>Synopsis</title>
5015  <funcsynopsis><funcprototype>
5016   <funcdef>bool <function>drm_mm_clean </function></funcdef>
5017   <paramdef>struct drm_mm * <parameter>mm</parameter></paramdef>
5018  </funcprototype></funcsynopsis>
5019</refsynopsisdiv>
5020<refsect1>
5021 <title>Arguments</title>
5022 <variablelist>
5023  <varlistentry>
5024   <term><parameter>mm</parameter></term>
5025   <listitem>
5026    <para>
5027     drm_mm allocator to check
5028    </para>
5029   </listitem>
5030  </varlistentry>
5031 </variablelist>
5032</refsect1>
5033<refsect1>
5034<title>Returns</title>
5035<para>
5036   True if the allocator is completely free, false if there's still a node
5037   allocated in it.
5038</para>
5039</refsect1>
5040</refentry>
5041
5042<refentry id="API-drm-mm-init">
5043<refentryinfo>
5044 <title>LINUX</title>
5045 <productname>Kernel Hackers Manual</productname>
5046 <date>July 2017</date>
5047</refentryinfo>
5048<refmeta>
5049 <refentrytitle><phrase>drm_mm_init</phrase></refentrytitle>
5050 <manvolnum>9</manvolnum>
5051 <refmiscinfo class="version">4.4.14</refmiscinfo>
5052</refmeta>
5053<refnamediv>
5054 <refname>drm_mm_init</refname>
5055 <refpurpose>
5056     initialize a drm-mm allocator
5057 </refpurpose>
5058</refnamediv>
5059<refsynopsisdiv>
5060 <title>Synopsis</title>
5061  <funcsynopsis><funcprototype>
5062   <funcdef>void <function>drm_mm_init </function></funcdef>
5063   <paramdef>struct drm_mm * <parameter>mm</parameter></paramdef>
5064   <paramdef>u64 <parameter>start</parameter></paramdef>
5065   <paramdef>u64 <parameter>size</parameter></paramdef>
5066  </funcprototype></funcsynopsis>
5067</refsynopsisdiv>
5068<refsect1>
5069 <title>Arguments</title>
5070 <variablelist>
5071  <varlistentry>
5072   <term><parameter>mm</parameter></term>
5073   <listitem>
5074    <para>
5075     the drm_mm structure to initialize
5076    </para>
5077   </listitem>
5078  </varlistentry>
5079  <varlistentry>
5080   <term><parameter>start</parameter></term>
5081   <listitem>
5082    <para>
5083     start of the range managed by <parameter>mm</parameter>
5084    </para>
5085   </listitem>
5086  </varlistentry>
5087  <varlistentry>
5088   <term><parameter>size</parameter></term>
5089   <listitem>
5090    <para>
5091     end of the range managed by <parameter>mm</parameter>
5092    </para>
5093   </listitem>
5094  </varlistentry>
5095 </variablelist>
5096</refsect1>
5097<refsect1>
5098<title>Description</title>
5099<para>
5100   Note that <parameter>mm</parameter> must be cleared to 0 before calling this function.
5101</para>
5102</refsect1>
5103</refentry>
5104
5105<refentry id="API-drm-mm-takedown">
5106<refentryinfo>
5107 <title>LINUX</title>
5108 <productname>Kernel Hackers Manual</productname>
5109 <date>July 2017</date>
5110</refentryinfo>
5111<refmeta>
5112 <refentrytitle><phrase>drm_mm_takedown</phrase></refentrytitle>
5113 <manvolnum>9</manvolnum>
5114 <refmiscinfo class="version">4.4.14</refmiscinfo>
5115</refmeta>
5116<refnamediv>
5117 <refname>drm_mm_takedown</refname>
5118 <refpurpose>
5119     clean up a drm_mm allocator
5120 </refpurpose>
5121</refnamediv>
5122<refsynopsisdiv>
5123 <title>Synopsis</title>
5124  <funcsynopsis><funcprototype>
5125   <funcdef>void <function>drm_mm_takedown </function></funcdef>
5126   <paramdef>struct drm_mm * <parameter>mm</parameter></paramdef>
5127  </funcprototype></funcsynopsis>
5128</refsynopsisdiv>
5129<refsect1>
5130 <title>Arguments</title>
5131 <variablelist>
5132  <varlistentry>
5133   <term><parameter>mm</parameter></term>
5134   <listitem>
5135    <para>
5136     drm_mm allocator to clean up
5137    </para>
5138   </listitem>
5139  </varlistentry>
5140 </variablelist>
5141</refsect1>
5142<refsect1>
5143<title>Description</title>
5144<para>
5145   Note that it is a bug to call this function on an allocator which is not
5146   clean.
5147</para>
5148</refsect1>
5149</refentry>
5150
5151<refentry id="API-drm-mm-debug-table">
5152<refentryinfo>
5153 <title>LINUX</title>
5154 <productname>Kernel Hackers Manual</productname>
5155 <date>July 2017</date>
5156</refentryinfo>
5157<refmeta>
5158 <refentrytitle><phrase>drm_mm_debug_table</phrase></refentrytitle>
5159 <manvolnum>9</manvolnum>
5160 <refmiscinfo class="version">4.4.14</refmiscinfo>
5161</refmeta>
5162<refnamediv>
5163 <refname>drm_mm_debug_table</refname>
5164 <refpurpose>
5165     dump allocator state to dmesg
5166 </refpurpose>
5167</refnamediv>
5168<refsynopsisdiv>
5169 <title>Synopsis</title>
5170  <funcsynopsis><funcprototype>
5171   <funcdef>void <function>drm_mm_debug_table </function></funcdef>
5172   <paramdef>struct drm_mm * <parameter>mm</parameter></paramdef>
5173   <paramdef>const char * <parameter>prefix</parameter></paramdef>
5174  </funcprototype></funcsynopsis>
5175</refsynopsisdiv>
5176<refsect1>
5177 <title>Arguments</title>
5178 <variablelist>
5179  <varlistentry>
5180   <term><parameter>mm</parameter></term>
5181   <listitem>
5182    <para>
5183     drm_mm allocator to dump
5184    </para>
5185   </listitem>
5186  </varlistentry>
5187  <varlistentry>
5188   <term><parameter>prefix</parameter></term>
5189   <listitem>
5190    <para>
5191     prefix to use for dumping to dmesg
5192    </para>
5193   </listitem>
5194  </varlistentry>
5195 </variablelist>
5196</refsect1>
5197</refentry>
5198
5199<refentry id="API-drm-mm-dump-table">
5200<refentryinfo>
5201 <title>LINUX</title>
5202 <productname>Kernel Hackers Manual</productname>
5203 <date>July 2017</date>
5204</refentryinfo>
5205<refmeta>
5206 <refentrytitle><phrase>drm_mm_dump_table</phrase></refentrytitle>
5207 <manvolnum>9</manvolnum>
5208 <refmiscinfo class="version">4.4.14</refmiscinfo>
5209</refmeta>
5210<refnamediv>
5211 <refname>drm_mm_dump_table</refname>
5212 <refpurpose>
5213     dump allocator state to a seq_file
5214 </refpurpose>
5215</refnamediv>
5216<refsynopsisdiv>
5217 <title>Synopsis</title>
5218  <funcsynopsis><funcprototype>
5219   <funcdef>int <function>drm_mm_dump_table </function></funcdef>
5220   <paramdef>struct seq_file * <parameter>m</parameter></paramdef>
5221   <paramdef>struct drm_mm * <parameter>mm</parameter></paramdef>
5222  </funcprototype></funcsynopsis>
5223</refsynopsisdiv>
5224<refsect1>
5225 <title>Arguments</title>
5226 <variablelist>
5227  <varlistentry>
5228   <term><parameter>m</parameter></term>
5229   <listitem>
5230    <para>
5231     seq_file to dump to
5232    </para>
5233   </listitem>
5234  </varlistentry>
5235  <varlistentry>
5236   <term><parameter>mm</parameter></term>
5237   <listitem>
5238    <para>
5239     drm_mm allocator to dump
5240    </para>
5241   </listitem>
5242  </varlistentry>
5243 </variablelist>
5244</refsect1>
5245</refentry>
5246
5247<!-- include/drm/drm_mm.h -->
5248<refentry id="API-drm-mm-node-allocated">
5249<refentryinfo>
5250 <title>LINUX</title>
5251 <productname>Kernel Hackers Manual</productname>
5252 <date>July 2017</date>
5253</refentryinfo>
5254<refmeta>
5255 <refentrytitle><phrase>drm_mm_node_allocated</phrase></refentrytitle>
5256 <manvolnum>9</manvolnum>
5257 <refmiscinfo class="version">4.4.14</refmiscinfo>
5258</refmeta>
5259<refnamediv>
5260 <refname>drm_mm_node_allocated</refname>
5261 <refpurpose>
5262  checks whether a node is allocated
5263 </refpurpose>
5264</refnamediv>
5265<refsynopsisdiv>
5266 <title>Synopsis</title>
5267  <funcsynopsis><funcprototype>
5268   <funcdef>bool <function>drm_mm_node_allocated </function></funcdef>
5269   <paramdef>struct drm_mm_node * <parameter>node</parameter></paramdef>
5270  </funcprototype></funcsynopsis>
5271</refsynopsisdiv>
5272<refsect1>
5273 <title>Arguments</title>
5274 <variablelist>
5275  <varlistentry>
5276   <term><parameter>node</parameter></term>
5277   <listitem>
5278    <para>
5279     drm_mm_node to check
5280    </para>
5281   </listitem>
5282  </varlistentry>
5283 </variablelist>
5284</refsect1>
5285<refsect1>
5286<title>Description</title>
5287<para>
5288   Drivers should use this helpers for proper encapusulation of drm_mm
5289   internals.
5290</para>
5291</refsect1>
5292<refsect1>
5293<title>Returns</title>
5294<para>
5295   True if the <parameter>node</parameter> is allocated.
5296</para>
5297</refsect1>
5298</refentry>
5299
5300<refentry id="API-drm-mm-initialized">
5301<refentryinfo>
5302 <title>LINUX</title>
5303 <productname>Kernel Hackers Manual</productname>
5304 <date>July 2017</date>
5305</refentryinfo>
5306<refmeta>
5307 <refentrytitle><phrase>drm_mm_initialized</phrase></refentrytitle>
5308 <manvolnum>9</manvolnum>
5309 <refmiscinfo class="version">4.4.14</refmiscinfo>
5310</refmeta>
5311<refnamediv>
5312 <refname>drm_mm_initialized</refname>
5313 <refpurpose>
5314     checks whether an allocator is initialized
5315 </refpurpose>
5316</refnamediv>
5317<refsynopsisdiv>
5318 <title>Synopsis</title>
5319  <funcsynopsis><funcprototype>
5320   <funcdef>bool <function>drm_mm_initialized </function></funcdef>
5321   <paramdef>struct drm_mm * <parameter>mm</parameter></paramdef>
5322  </funcprototype></funcsynopsis>
5323</refsynopsisdiv>
5324<refsect1>
5325 <title>Arguments</title>
5326 <variablelist>
5327  <varlistentry>
5328   <term><parameter>mm</parameter></term>
5329   <listitem>
5330    <para>
5331     drm_mm to check
5332    </para>
5333   </listitem>
5334  </varlistentry>
5335 </variablelist>
5336</refsect1>
5337<refsect1>
5338<title>Description</title>
5339<para>
5340   Drivers should use this helpers for proper encapusulation of drm_mm
5341   internals.
5342</para>
5343</refsect1>
5344<refsect1>
5345<title>Returns</title>
5346<para>
5347   True if the <parameter>mm</parameter> is initialized.
5348</para>
5349</refsect1>
5350</refentry>
5351
5352<refentry id="API-drm-mm-hole-node-start">
5353<refentryinfo>
5354 <title>LINUX</title>
5355 <productname>Kernel Hackers Manual</productname>
5356 <date>July 2017</date>
5357</refentryinfo>
5358<refmeta>
5359 <refentrytitle><phrase>drm_mm_hole_node_start</phrase></refentrytitle>
5360 <manvolnum>9</manvolnum>
5361 <refmiscinfo class="version">4.4.14</refmiscinfo>
5362</refmeta>
5363<refnamediv>
5364 <refname>drm_mm_hole_node_start</refname>
5365 <refpurpose>
5366     computes the start of the hole following <parameter>node</parameter>
5367 </refpurpose>
5368</refnamediv>
5369<refsynopsisdiv>
5370 <title>Synopsis</title>
5371  <funcsynopsis><funcprototype>
5372   <funcdef>u64 <function>drm_mm_hole_node_start </function></funcdef>
5373   <paramdef>struct drm_mm_node * <parameter>hole_node</parameter></paramdef>
5374  </funcprototype></funcsynopsis>
5375</refsynopsisdiv>
5376<refsect1>
5377 <title>Arguments</title>
5378 <variablelist>
5379  <varlistentry>
5380   <term><parameter>hole_node</parameter></term>
5381   <listitem>
5382    <para>
5383     drm_mm_node which implicitly tracks the following hole
5384    </para>
5385   </listitem>
5386  </varlistentry>
5387 </variablelist>
5388</refsect1>
5389<refsect1>
5390<title>Description</title>
5391<para>
5392   This is useful for driver-sepific debug dumpers. Otherwise drivers should not
5393   inspect holes themselves. Drivers must check first whether a hole indeed
5394   follows by looking at node-&gt;hole_follows.
5395</para>
5396</refsect1>
5397<refsect1>
5398<title>Returns</title>
5399<para>
5400   Start of the subsequent hole.
5401</para>
5402</refsect1>
5403</refentry>
5404
5405<refentry id="API-drm-mm-hole-node-end">
5406<refentryinfo>
5407 <title>LINUX</title>
5408 <productname>Kernel Hackers Manual</productname>
5409 <date>July 2017</date>
5410</refentryinfo>
5411<refmeta>
5412 <refentrytitle><phrase>drm_mm_hole_node_end</phrase></refentrytitle>
5413 <manvolnum>9</manvolnum>
5414 <refmiscinfo class="version">4.4.14</refmiscinfo>
5415</refmeta>
5416<refnamediv>
5417 <refname>drm_mm_hole_node_end</refname>
5418 <refpurpose>
5419     computes the end of the hole following <parameter>node</parameter>
5420 </refpurpose>
5421</refnamediv>
5422<refsynopsisdiv>
5423 <title>Synopsis</title>
5424  <funcsynopsis><funcprototype>
5425   <funcdef>u64 <function>drm_mm_hole_node_end </function></funcdef>
5426   <paramdef>struct drm_mm_node * <parameter>hole_node</parameter></paramdef>
5427  </funcprototype></funcsynopsis>
5428</refsynopsisdiv>
5429<refsect1>
5430 <title>Arguments</title>
5431 <variablelist>
5432  <varlistentry>
5433   <term><parameter>hole_node</parameter></term>
5434   <listitem>
5435    <para>
5436     drm_mm_node which implicitly tracks the following hole
5437    </para>
5438   </listitem>
5439  </varlistentry>
5440 </variablelist>
5441</refsect1>
5442<refsect1>
5443<title>Description</title>
5444<para>
5445   This is useful for driver-sepific debug dumpers. Otherwise drivers should not
5446   inspect holes themselves. Drivers must check first whether a hole indeed
5447   follows by looking at node-&gt;hole_follows.
5448</para>
5449</refsect1>
5450<refsect1>
5451<title>Returns</title>
5452<para>
5453   End of the subsequent hole.
5454</para>
5455</refsect1>
5456</refentry>
5457
5458<refentry id="API-drm-mm-for-each-node">
5459<refentryinfo>
5460 <title>LINUX</title>
5461 <productname>Kernel Hackers Manual</productname>
5462 <date>July 2017</date>
5463</refentryinfo>
5464<refmeta>
5465 <refentrytitle><phrase>drm_mm_for_each_node</phrase></refentrytitle>
5466 <manvolnum>9</manvolnum>
5467 <refmiscinfo class="version">4.4.14</refmiscinfo>
5468</refmeta>
5469<refnamediv>
5470 <refname>drm_mm_for_each_node</refname>
5471 <refpurpose>
5472     iterator to walk over all allocated nodes
5473 </refpurpose>
5474</refnamediv>
5475<refsynopsisdiv>
5476 <title>Synopsis</title>
5477  <funcsynopsis><funcprototype>
5478   <funcdef> <function>drm_mm_for_each_node </function></funcdef>
5479   <paramdef> <parameter>entry</parameter></paramdef>
5480   <paramdef> <parameter>mm</parameter></paramdef>
5481  </funcprototype></funcsynopsis>
5482</refsynopsisdiv>
5483<refsect1>
5484 <title>Arguments</title>
5485 <variablelist>
5486  <varlistentry>
5487   <term><parameter>entry</parameter></term>
5488   <listitem>
5489    <para>
5490     drm_mm_node structure to assign to in each iteration step
5491    </para>
5492   </listitem>
5493  </varlistentry>
5494  <varlistentry>
5495   <term><parameter>mm</parameter></term>
5496   <listitem>
5497    <para>
5498     drm_mm allocator to walk
5499    </para>
5500   </listitem>
5501  </varlistentry>
5502 </variablelist>
5503</refsect1>
5504<refsect1>
5505<title>Description</title>
5506<para>
5507   This iterator walks over all nodes in the range allocator. It is implemented
5508   with list_for_each, so not save against removal of elements.
5509</para>
5510</refsect1>
5511</refentry>
5512
5513<refentry id="API-drm-mm-for-each-hole">
5514<refentryinfo>
5515 <title>LINUX</title>
5516 <productname>Kernel Hackers Manual</productname>
5517 <date>July 2017</date>
5518</refentryinfo>
5519<refmeta>
5520 <refentrytitle><phrase>drm_mm_for_each_hole</phrase></refentrytitle>
5521 <manvolnum>9</manvolnum>
5522 <refmiscinfo class="version">4.4.14</refmiscinfo>
5523</refmeta>
5524<refnamediv>
5525 <refname>drm_mm_for_each_hole</refname>
5526 <refpurpose>
5527     iterator to walk over all holes
5528 </refpurpose>
5529</refnamediv>
5530<refsynopsisdiv>
5531 <title>Synopsis</title>
5532  <funcsynopsis><funcprototype>
5533   <funcdef> <function>drm_mm_for_each_hole </function></funcdef>
5534   <paramdef> <parameter>entry</parameter></paramdef>
5535   <paramdef> <parameter>mm</parameter></paramdef>
5536   <paramdef> <parameter>hole_start</parameter></paramdef>
5537   <paramdef> <parameter>hole_end</parameter></paramdef>
5538  </funcprototype></funcsynopsis>
5539</refsynopsisdiv>
5540<refsect1>
5541 <title>Arguments</title>
5542 <variablelist>
5543  <varlistentry>
5544   <term><parameter>entry</parameter></term>
5545   <listitem>
5546    <para>
5547     drm_mm_node used internally to track progress
5548    </para>
5549   </listitem>
5550  </varlistentry>
5551  <varlistentry>
5552   <term><parameter>mm</parameter></term>
5553   <listitem>
5554    <para>
5555     drm_mm allocator to walk
5556    </para>
5557   </listitem>
5558  </varlistentry>
5559  <varlistentry>
5560   <term><parameter>hole_start</parameter></term>
5561   <listitem>
5562    <para>
5563     ulong variable to assign the hole start to on each iteration
5564    </para>
5565   </listitem>
5566  </varlistentry>
5567  <varlistentry>
5568   <term><parameter>hole_end</parameter></term>
5569   <listitem>
5570    <para>
5571     ulong variable to assign the hole end to on each iteration
5572    </para>
5573   </listitem>
5574  </varlistentry>
5575 </variablelist>
5576</refsect1>
5577<refsect1>
5578<title>Description</title>
5579<para>
5580   This iterator walks over all holes in the range allocator. It is implemented
5581   with list_for_each, so not save against removal of elements. <parameter>entry</parameter> is used
5582   internally and will not reflect a real drm_mm_node for the very first hole.
5583   Hence users of this iterator may not access it.
5584</para>
5585</refsect1>
5586<refsect1>
5587<title>Implementation Note</title>
5588<para>
5589   We need to inline list_for_each_entry in order to be able to set hole_start
5590   and hole_end on each iteration while keeping the macro sane.
5591   </para><para>
5592
5593   The __drm_mm_for_each_hole version is similar, but with added support for
5594   going backwards.
5595</para>
5596</refsect1>
5597</refentry>
5598
5599<refentry id="API-drm-mm-insert-node">
5600<refentryinfo>
5601 <title>LINUX</title>
5602 <productname>Kernel Hackers Manual</productname>
5603 <date>July 2017</date>
5604</refentryinfo>
5605<refmeta>
5606 <refentrytitle><phrase>drm_mm_insert_node</phrase></refentrytitle>
5607 <manvolnum>9</manvolnum>
5608 <refmiscinfo class="version">4.4.14</refmiscinfo>
5609</refmeta>
5610<refnamediv>
5611 <refname>drm_mm_insert_node</refname>
5612 <refpurpose>
5613     search for space and insert <parameter>node</parameter>
5614 </refpurpose>
5615</refnamediv>
5616<refsynopsisdiv>
5617 <title>Synopsis</title>
5618  <funcsynopsis><funcprototype>
5619   <funcdef>int <function>drm_mm_insert_node </function></funcdef>
5620   <paramdef>struct drm_mm * <parameter>mm</parameter></paramdef>
5621   <paramdef>struct drm_mm_node * <parameter>node</parameter></paramdef>
5622   <paramdef>u64 <parameter>size</parameter></paramdef>
5623   <paramdef>unsigned <parameter>alignment</parameter></paramdef>
5624   <paramdef>enum drm_mm_search_flags <parameter>flags</parameter></paramdef>
5625  </funcprototype></funcsynopsis>
5626</refsynopsisdiv>
5627<refsect1>
5628 <title>Arguments</title>
5629 <variablelist>
5630  <varlistentry>
5631   <term><parameter>mm</parameter></term>
5632   <listitem>
5633    <para>
5634     drm_mm to allocate from
5635    </para>
5636   </listitem>
5637  </varlistentry>
5638  <varlistentry>
5639   <term><parameter>node</parameter></term>
5640   <listitem>
5641    <para>
5642     preallocate node to insert
5643    </para>
5644   </listitem>
5645  </varlistentry>
5646  <varlistentry>
5647   <term><parameter>size</parameter></term>
5648   <listitem>
5649    <para>
5650     size of the allocation
5651    </para>
5652   </listitem>
5653  </varlistentry>
5654  <varlistentry>
5655   <term><parameter>alignment</parameter></term>
5656   <listitem>
5657    <para>
5658     alignment of the allocation
5659    </para>
5660   </listitem>
5661  </varlistentry>
5662  <varlistentry>
5663   <term><parameter>flags</parameter></term>
5664   <listitem>
5665    <para>
5666     flags to fine-tune the allocation
5667    </para>
5668   </listitem>
5669  </varlistentry>
5670 </variablelist>
5671</refsect1>
5672<refsect1>
5673<title>Description</title>
5674<para>
5675   This is a simplified version of <function>drm_mm_insert_node_generic</function> with <parameter>color</parameter> set
5676   to 0.
5677   </para><para>
5678
5679   The preallocated node must be cleared to 0.
5680</para>
5681</refsect1>
5682<refsect1>
5683<title>Returns</title>
5684<para>
5685   0 on success, -ENOSPC if there's no suitable hole.
5686</para>
5687</refsect1>
5688</refentry>
5689
5690<refentry id="API-drm-mm-insert-node-in-range">
5691<refentryinfo>
5692 <title>LINUX</title>
5693 <productname>Kernel Hackers Manual</productname>
5694 <date>July 2017</date>
5695</refentryinfo>
5696<refmeta>
5697 <refentrytitle><phrase>drm_mm_insert_node_in_range</phrase></refentrytitle>
5698 <manvolnum>9</manvolnum>
5699 <refmiscinfo class="version">4.4.14</refmiscinfo>
5700</refmeta>
5701<refnamediv>
5702 <refname>drm_mm_insert_node_in_range</refname>
5703 <refpurpose>
5704     ranged search for space and insert <parameter>node</parameter>
5705 </refpurpose>
5706</refnamediv>
5707<refsynopsisdiv>
5708 <title>Synopsis</title>
5709  <funcsynopsis><funcprototype>
5710   <funcdef>int <function>drm_mm_insert_node_in_range </function></funcdef>
5711   <paramdef>struct drm_mm * <parameter>mm</parameter></paramdef>
5712   <paramdef>struct drm_mm_node * <parameter>node</parameter></paramdef>
5713   <paramdef>u64 <parameter>size</parameter></paramdef>
5714   <paramdef>unsigned <parameter>alignment</parameter></paramdef>
5715   <paramdef>u64 <parameter>start</parameter></paramdef>
5716   <paramdef>u64 <parameter>end</parameter></paramdef>
5717   <paramdef>enum drm_mm_search_flags <parameter>flags</parameter></paramdef>
5718  </funcprototype></funcsynopsis>
5719</refsynopsisdiv>
5720<refsect1>
5721 <title>Arguments</title>
5722 <variablelist>
5723  <varlistentry>
5724   <term><parameter>mm</parameter></term>
5725   <listitem>
5726    <para>
5727     drm_mm to allocate from
5728    </para>
5729   </listitem>
5730  </varlistentry>
5731  <varlistentry>
5732   <term><parameter>node</parameter></term>
5733   <listitem>
5734    <para>
5735     preallocate node to insert
5736    </para>
5737   </listitem>
5738  </varlistentry>
5739  <varlistentry>
5740   <term><parameter>size</parameter></term>
5741   <listitem>
5742    <para>
5743     size of the allocation
5744    </para>
5745   </listitem>
5746  </varlistentry>
5747  <varlistentry>
5748   <term><parameter>alignment</parameter></term>
5749   <listitem>
5750    <para>
5751     alignment of the allocation
5752    </para>
5753   </listitem>
5754  </varlistentry>
5755  <varlistentry>
5756   <term><parameter>start</parameter></term>
5757   <listitem>
5758    <para>
5759     start of the allowed range for this node
5760    </para>
5761   </listitem>
5762  </varlistentry>
5763  <varlistentry>
5764   <term><parameter>end</parameter></term>
5765   <listitem>
5766    <para>
5767     end of the allowed range for this node
5768    </para>
5769   </listitem>
5770  </varlistentry>
5771  <varlistentry>
5772   <term><parameter>flags</parameter></term>
5773   <listitem>
5774    <para>
5775     flags to fine-tune the allocation
5776    </para>
5777   </listitem>
5778  </varlistentry>
5779 </variablelist>
5780</refsect1>
5781<refsect1>
5782<title>Description</title>
5783<para>
5784   This is a simplified version of <function>drm_mm_insert_node_in_range_generic</function> with
5785   <parameter>color</parameter> set to 0.
5786   </para><para>
5787
5788   The preallocated node must be cleared to 0.
5789</para>
5790</refsect1>
5791<refsect1>
5792<title>Returns</title>
5793<para>
5794   0 on success, -ENOSPC if there's no suitable hole.
5795</para>
5796</refsect1>
5797</refentry>
5798
5799    </sect2>
5800    <sect2>
5801      <title>CMA Helper Functions Reference</title>
5802<para>
5803   </para><para>
5804   The Contiguous Memory Allocator reserves a pool of memory at early boot
5805   that is used to service requests for large blocks of contiguous memory.
5806   </para><para>
5807   The DRM GEM/CMA helpers use this allocator as a means to provide buffer
5808   objects that are physically contiguous in memory. This is useful for
5809   display drivers that are unable to map scattered buffers via an IOMMU.
5810</para>
5811
5812<!-- drivers/gpu/drm/drm_gem_cma_helper.c -->
5813<refentry id="API-drm-gem-cma-create">
5814<refentryinfo>
5815 <title>LINUX</title>
5816 <productname>Kernel Hackers Manual</productname>
5817 <date>July 2017</date>
5818</refentryinfo>
5819<refmeta>
5820 <refentrytitle><phrase>drm_gem_cma_create</phrase></refentrytitle>
5821 <manvolnum>9</manvolnum>
5822 <refmiscinfo class="version">4.4.14</refmiscinfo>
5823</refmeta>
5824<refnamediv>
5825 <refname>drm_gem_cma_create</refname>
5826 <refpurpose>
5827  allocate an object with the given size
5828 </refpurpose>
5829</refnamediv>
5830<refsynopsisdiv>
5831 <title>Synopsis</title>
5832  <funcsynopsis><funcprototype>
5833   <funcdef>struct drm_gem_cma_object * <function>drm_gem_cma_create </function></funcdef>
5834   <paramdef>struct drm_device * <parameter>drm</parameter></paramdef>
5835   <paramdef>size_t <parameter>size</parameter></paramdef>
5836  </funcprototype></funcsynopsis>
5837</refsynopsisdiv>
5838<refsect1>
5839 <title>Arguments</title>
5840 <variablelist>
5841  <varlistentry>
5842   <term><parameter>drm</parameter></term>
5843   <listitem>
5844    <para>
5845     DRM device
5846    </para>
5847   </listitem>
5848  </varlistentry>
5849  <varlistentry>
5850   <term><parameter>size</parameter></term>
5851   <listitem>
5852    <para>
5853     size of the object to allocate
5854    </para>
5855   </listitem>
5856  </varlistentry>
5857 </variablelist>
5858</refsect1>
5859<refsect1>
5860<title>Description</title>
5861<para>
5862   This function creates a CMA GEM object and allocates a contiguous chunk of
5863   memory as backing store. The backing memory has the writecombine attribute
5864   set.
5865</para>
5866</refsect1>
5867<refsect1>
5868<title>Returns</title>
5869<para>
5870   A struct drm_gem_cma_object * on success or an <function>ERR_PTR</function>-encoded negative
5871   error code on failure.
5872</para>
5873</refsect1>
5874</refentry>
5875
5876<refentry id="API-drm-gem-cma-free-object">
5877<refentryinfo>
5878 <title>LINUX</title>
5879 <productname>Kernel Hackers Manual</productname>
5880 <date>July 2017</date>
5881</refentryinfo>
5882<refmeta>
5883 <refentrytitle><phrase>drm_gem_cma_free_object</phrase></refentrytitle>
5884 <manvolnum>9</manvolnum>
5885 <refmiscinfo class="version">4.4.14</refmiscinfo>
5886</refmeta>
5887<refnamediv>
5888 <refname>drm_gem_cma_free_object</refname>
5889 <refpurpose>
5890     free resources associated with a CMA GEM object
5891 </refpurpose>
5892</refnamediv>
5893<refsynopsisdiv>
5894 <title>Synopsis</title>
5895  <funcsynopsis><funcprototype>
5896   <funcdef>void <function>drm_gem_cma_free_object </function></funcdef>
5897   <paramdef>struct drm_gem_object * <parameter>gem_obj</parameter></paramdef>
5898  </funcprototype></funcsynopsis>
5899</refsynopsisdiv>
5900<refsect1>
5901 <title>Arguments</title>
5902 <variablelist>
5903  <varlistentry>
5904   <term><parameter>gem_obj</parameter></term>
5905   <listitem>
5906    <para>
5907     GEM object to free
5908    </para>
5909   </listitem>
5910  </varlistentry>
5911 </variablelist>
5912</refsect1>
5913<refsect1>
5914<title>Description</title>
5915<para>
5916   This function frees the backing memory of the CMA GEM object, cleans up the
5917   GEM object state and frees the memory used to store the object itself.
5918   Drivers using the CMA helpers should set this as their DRM driver's
5919   -&gt;<function>gem_free_object</function> callback.
5920</para>
5921</refsect1>
5922</refentry>
5923
5924<refentry id="API-drm-gem-cma-dumb-create-internal">
5925<refentryinfo>
5926 <title>LINUX</title>
5927 <productname>Kernel Hackers Manual</productname>
5928 <date>July 2017</date>
5929</refentryinfo>
5930<refmeta>
5931 <refentrytitle><phrase>drm_gem_cma_dumb_create_internal</phrase></refentrytitle>
5932 <manvolnum>9</manvolnum>
5933 <refmiscinfo class="version">4.4.14</refmiscinfo>
5934</refmeta>
5935<refnamediv>
5936 <refname>drm_gem_cma_dumb_create_internal</refname>
5937 <refpurpose>
5938     create a dumb buffer object
5939 </refpurpose>
5940</refnamediv>
5941<refsynopsisdiv>
5942 <title>Synopsis</title>
5943  <funcsynopsis><funcprototype>
5944   <funcdef>int <function>drm_gem_cma_dumb_create_internal </function></funcdef>
5945   <paramdef>struct drm_file * <parameter>file_priv</parameter></paramdef>
5946   <paramdef>struct drm_device * <parameter>drm</parameter></paramdef>
5947   <paramdef>struct drm_mode_create_dumb * <parameter>args</parameter></paramdef>
5948  </funcprototype></funcsynopsis>
5949</refsynopsisdiv>
5950<refsect1>
5951 <title>Arguments</title>
5952 <variablelist>
5953  <varlistentry>
5954   <term><parameter>file_priv</parameter></term>
5955   <listitem>
5956    <para>
5957     DRM file-private structure to create the dumb buffer for
5958    </para>
5959   </listitem>
5960  </varlistentry>
5961  <varlistentry>
5962   <term><parameter>drm</parameter></term>
5963   <listitem>
5964    <para>
5965     DRM device
5966    </para>
5967   </listitem>
5968  </varlistentry>
5969  <varlistentry>
5970   <term><parameter>args</parameter></term>
5971   <listitem>
5972    <para>
5973     IOCTL data
5974    </para>
5975   </listitem>
5976  </varlistentry>
5977 </variablelist>
5978</refsect1>
5979<refsect1>
5980<title>Description</title>
5981<para>
5982   This aligns the pitch and size arguments to the minimum required. This is
5983   an internal helper that can be wrapped by a driver to account for hardware
5984   with more specific alignment requirements. It should not be used directly
5985   as the -&gt;<function>dumb_create</function> callback in a DRM driver.
5986</para>
5987</refsect1>
5988<refsect1>
5989<title>Returns</title>
5990<para>
5991   0 on success or a negative error code on failure.
5992</para>
5993</refsect1>
5994</refentry>
5995
5996<refentry id="API-drm-gem-cma-dumb-create">
5997<refentryinfo>
5998 <title>LINUX</title>
5999 <productname>Kernel Hackers Manual</productname>
6000 <date>July 2017</date>
6001</refentryinfo>
6002<refmeta>
6003 <refentrytitle><phrase>drm_gem_cma_dumb_create</phrase></refentrytitle>
6004 <manvolnum>9</manvolnum>
6005 <refmiscinfo class="version">4.4.14</refmiscinfo>
6006</refmeta>
6007<refnamediv>
6008 <refname>drm_gem_cma_dumb_create</refname>
6009 <refpurpose>
6010     create a dumb buffer object
6011 </refpurpose>
6012</refnamediv>
6013<refsynopsisdiv>
6014 <title>Synopsis</title>
6015  <funcsynopsis><funcprototype>
6016   <funcdef>int <function>drm_gem_cma_dumb_create </function></funcdef>
6017   <paramdef>struct drm_file * <parameter>file_priv</parameter></paramdef>
6018   <paramdef>struct drm_device * <parameter>drm</parameter></paramdef>
6019   <paramdef>struct drm_mode_create_dumb * <parameter>args</parameter></paramdef>
6020  </funcprototype></funcsynopsis>
6021</refsynopsisdiv>
6022<refsect1>
6023 <title>Arguments</title>
6024 <variablelist>
6025  <varlistentry>
6026   <term><parameter>file_priv</parameter></term>
6027   <listitem>
6028    <para>
6029     DRM file-private structure to create the dumb buffer for
6030    </para>
6031   </listitem>
6032  </varlistentry>
6033  <varlistentry>
6034   <term><parameter>drm</parameter></term>
6035   <listitem>
6036    <para>
6037     DRM device
6038    </para>
6039   </listitem>
6040  </varlistentry>
6041  <varlistentry>
6042   <term><parameter>args</parameter></term>
6043   <listitem>
6044    <para>
6045     IOCTL data
6046    </para>
6047   </listitem>
6048  </varlistentry>
6049 </variablelist>
6050</refsect1>
6051<refsect1>
6052<title>Description</title>
6053<para>
6054   This function computes the pitch of the dumb buffer and rounds it up to an
6055   integer number of bytes per pixel. Drivers for hardware that doesn't have
6056   any additional restrictions on the pitch can directly use this function as
6057   their -&gt;<function>dumb_create</function> callback.
6058   </para><para>
6059
6060   For hardware with additional restrictions, drivers can adjust the fields
6061   set up by userspace and pass the IOCTL data along to the
6062   <function>drm_gem_cma_dumb_create_internal</function> function.
6063</para>
6064</refsect1>
6065<refsect1>
6066<title>Returns</title>
6067<para>
6068   0 on success or a negative error code on failure.
6069</para>
6070</refsect1>
6071</refentry>
6072
6073<refentry id="API-drm-gem-cma-dumb-map-offset">
6074<refentryinfo>
6075 <title>LINUX</title>
6076 <productname>Kernel Hackers Manual</productname>
6077 <date>July 2017</date>
6078</refentryinfo>
6079<refmeta>
6080 <refentrytitle><phrase>drm_gem_cma_dumb_map_offset</phrase></refentrytitle>
6081 <manvolnum>9</manvolnum>
6082 <refmiscinfo class="version">4.4.14</refmiscinfo>
6083</refmeta>
6084<refnamediv>
6085 <refname>drm_gem_cma_dumb_map_offset</refname>
6086 <refpurpose>
6087     return the fake mmap offset for a CMA GEM object
6088 </refpurpose>
6089</refnamediv>
6090<refsynopsisdiv>
6091 <title>Synopsis</title>
6092  <funcsynopsis><funcprototype>
6093   <funcdef>int <function>drm_gem_cma_dumb_map_offset </function></funcdef>
6094   <paramdef>struct drm_file * <parameter>file_priv</parameter></paramdef>
6095   <paramdef>struct drm_device * <parameter>drm</parameter></paramdef>
6096   <paramdef>u32 <parameter>handle</parameter></paramdef>
6097   <paramdef>u64 * <parameter>offset</parameter></paramdef>
6098  </funcprototype></funcsynopsis>
6099</refsynopsisdiv>
6100<refsect1>
6101 <title>Arguments</title>
6102 <variablelist>
6103  <varlistentry>
6104   <term><parameter>file_priv</parameter></term>
6105   <listitem>
6106    <para>
6107     DRM file-private structure containing the GEM object
6108    </para>
6109   </listitem>
6110  </varlistentry>
6111  <varlistentry>
6112   <term><parameter>drm</parameter></term>
6113   <listitem>
6114    <para>
6115     DRM device
6116    </para>
6117   </listitem>
6118  </varlistentry>
6119  <varlistentry>
6120   <term><parameter>handle</parameter></term>
6121   <listitem>
6122    <para>
6123     GEM object handle
6124    </para>
6125   </listitem>
6126  </varlistentry>
6127  <varlistentry>
6128   <term><parameter>offset</parameter></term>
6129   <listitem>
6130    <para>
6131     return location for the fake mmap offset
6132    </para>
6133   </listitem>
6134  </varlistentry>
6135 </variablelist>
6136</refsect1>
6137<refsect1>
6138<title>Description</title>
6139<para>
6140   This function look up an object by its handle and returns the fake mmap
6141   offset associated with it. Drivers using the CMA helpers should set this
6142   as their DRM driver's -&gt;<function>dumb_map_offset</function> callback.
6143</para>
6144</refsect1>
6145<refsect1>
6146<title>Returns</title>
6147<para>
6148   0 on success or a negative error code on failure.
6149</para>
6150</refsect1>
6151</refentry>
6152
6153<refentry id="API-drm-gem-cma-mmap">
6154<refentryinfo>
6155 <title>LINUX</title>
6156 <productname>Kernel Hackers Manual</productname>
6157 <date>July 2017</date>
6158</refentryinfo>
6159<refmeta>
6160 <refentrytitle><phrase>drm_gem_cma_mmap</phrase></refentrytitle>
6161 <manvolnum>9</manvolnum>
6162 <refmiscinfo class="version">4.4.14</refmiscinfo>
6163</refmeta>
6164<refnamediv>
6165 <refname>drm_gem_cma_mmap</refname>
6166 <refpurpose>
6167     memory-map a CMA GEM object
6168 </refpurpose>
6169</refnamediv>
6170<refsynopsisdiv>
6171 <title>Synopsis</title>
6172  <funcsynopsis><funcprototype>
6173   <funcdef>int <function>drm_gem_cma_mmap </function></funcdef>
6174   <paramdef>struct file * <parameter>filp</parameter></paramdef>
6175   <paramdef>struct vm_area_struct * <parameter>vma</parameter></paramdef>
6176  </funcprototype></funcsynopsis>
6177</refsynopsisdiv>
6178<refsect1>
6179 <title>Arguments</title>
6180 <variablelist>
6181  <varlistentry>
6182   <term><parameter>filp</parameter></term>
6183   <listitem>
6184    <para>
6185     file object
6186    </para>
6187   </listitem>
6188  </varlistentry>
6189  <varlistentry>
6190   <term><parameter>vma</parameter></term>
6191   <listitem>
6192    <para>
6193     VMA for the area to be mapped
6194    </para>
6195   </listitem>
6196  </varlistentry>
6197 </variablelist>
6198</refsect1>
6199<refsect1>
6200<title>Description</title>
6201<para>
6202   This function implements an augmented version of the GEM DRM file mmap
6203</para>
6204</refsect1>
6205<refsect1>
6206<title>operation for CMA objects</title>
6207<para>
6208   In addition to the usual GEM VMA setup it
6209   immediately faults in the entire object instead of using on-demaind
6210   faulting. Drivers which employ the CMA helpers should use this function
6211   as their -&gt;<function>mmap</function> handler in the DRM device file's file_operations
6212   structure.
6213</para>
6214</refsect1>
6215<refsect1>
6216<title>Returns</title>
6217<para>
6218   0 on success or a negative error code on failure.
6219</para>
6220</refsect1>
6221</refentry>
6222
6223<refentry id="API-drm-gem-cma-describe">
6224<refentryinfo>
6225 <title>LINUX</title>
6226 <productname>Kernel Hackers Manual</productname>
6227 <date>July 2017</date>
6228</refentryinfo>
6229<refmeta>
6230 <refentrytitle><phrase>drm_gem_cma_describe</phrase></refentrytitle>
6231 <manvolnum>9</manvolnum>
6232 <refmiscinfo class="version">4.4.14</refmiscinfo>
6233</refmeta>
6234<refnamediv>
6235 <refname>drm_gem_cma_describe</refname>
6236 <refpurpose>
6237     describe a CMA GEM object for debugfs
6238 </refpurpose>
6239</refnamediv>
6240<refsynopsisdiv>
6241 <title>Synopsis</title>
6242  <funcsynopsis><funcprototype>
6243   <funcdef>void <function>drm_gem_cma_describe </function></funcdef>
6244   <paramdef>struct drm_gem_cma_object * <parameter>cma_obj</parameter></paramdef>
6245   <paramdef>struct seq_file * <parameter>m</parameter></paramdef>
6246  </funcprototype></funcsynopsis>
6247</refsynopsisdiv>
6248<refsect1>
6249 <title>Arguments</title>
6250 <variablelist>
6251  <varlistentry>
6252   <term><parameter>cma_obj</parameter></term>
6253   <listitem>
6254    <para>
6255     CMA GEM object
6256    </para>
6257   </listitem>
6258  </varlistentry>
6259  <varlistentry>
6260   <term><parameter>m</parameter></term>
6261   <listitem>
6262    <para>
6263     debugfs file handle
6264    </para>
6265   </listitem>
6266  </varlistentry>
6267 </variablelist>
6268</refsect1>
6269<refsect1>
6270<title>Description</title>
6271<para>
6272   This function can be used to dump a human-readable representation of the
6273   CMA GEM object into a synthetic file.
6274</para>
6275</refsect1>
6276</refentry>
6277
6278<refentry id="API-drm-gem-cma-prime-get-sg-table">
6279<refentryinfo>
6280 <title>LINUX</title>
6281 <productname>Kernel Hackers Manual</productname>
6282 <date>July 2017</date>
6283</refentryinfo>
6284<refmeta>
6285 <refentrytitle><phrase>drm_gem_cma_prime_get_sg_table</phrase></refentrytitle>
6286 <manvolnum>9</manvolnum>
6287 <refmiscinfo class="version">4.4.14</refmiscinfo>
6288</refmeta>
6289<refnamediv>
6290 <refname>drm_gem_cma_prime_get_sg_table</refname>
6291 <refpurpose>
6292     provide a scatter/gather table of pinned pages for a CMA GEM object
6293 </refpurpose>
6294</refnamediv>
6295<refsynopsisdiv>
6296 <title>Synopsis</title>
6297  <funcsynopsis><funcprototype>
6298   <funcdef>struct sg_table * <function>drm_gem_cma_prime_get_sg_table </function></funcdef>
6299   <paramdef>struct drm_gem_object * <parameter>obj</parameter></paramdef>
6300  </funcprototype></funcsynopsis>
6301</refsynopsisdiv>
6302<refsect1>
6303 <title>Arguments</title>
6304 <variablelist>
6305  <varlistentry>
6306   <term><parameter>obj</parameter></term>
6307   <listitem>
6308    <para>
6309     GEM object
6310    </para>
6311   </listitem>
6312  </varlistentry>
6313 </variablelist>
6314</refsect1>
6315<refsect1>
6316<title>Description</title>
6317<para>
6318   This function exports a scatter/gather table suitable for PRIME usage by
6319   calling the standard DMA mapping API. Drivers using the CMA helpers should
6320   set this as their DRM driver's -&gt;<function>gem_prime_get_sg_table</function> callback.
6321</para>
6322</refsect1>
6323<refsect1>
6324<title>Returns</title>
6325<para>
6326   A pointer to the scatter/gather table of pinned pages or NULL on failure.
6327</para>
6328</refsect1>
6329</refentry>
6330
6331<refentry id="API-drm-gem-cma-prime-import-sg-table">
6332<refentryinfo>
6333 <title>LINUX</title>
6334 <productname>Kernel Hackers Manual</productname>
6335 <date>July 2017</date>
6336</refentryinfo>
6337<refmeta>
6338 <refentrytitle><phrase>drm_gem_cma_prime_import_sg_table</phrase></refentrytitle>
6339 <manvolnum>9</manvolnum>
6340 <refmiscinfo class="version">4.4.14</refmiscinfo>
6341</refmeta>
6342<refnamediv>
6343 <refname>drm_gem_cma_prime_import_sg_table</refname>
6344 <refpurpose>
6345     produce a CMA GEM object from another driver's scatter/gather table of pinned pages
6346 </refpurpose>
6347</refnamediv>
6348<refsynopsisdiv>
6349 <title>Synopsis</title>
6350  <funcsynopsis><funcprototype>
6351   <funcdef>struct drm_gem_object * <function>drm_gem_cma_prime_import_sg_table </function></funcdef>
6352   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
6353   <paramdef>struct dma_buf_attachment * <parameter>attach</parameter></paramdef>
6354   <paramdef>struct sg_table * <parameter>sgt</parameter></paramdef>
6355  </funcprototype></funcsynopsis>
6356</refsynopsisdiv>
6357<refsect1>
6358 <title>Arguments</title>
6359 <variablelist>
6360  <varlistentry>
6361   <term><parameter>dev</parameter></term>
6362   <listitem>
6363    <para>
6364     device to import into
6365    </para>
6366   </listitem>
6367  </varlistentry>
6368  <varlistentry>
6369   <term><parameter>attach</parameter></term>
6370   <listitem>
6371    <para>
6372     DMA-BUF attachment
6373    </para>
6374   </listitem>
6375  </varlistentry>
6376  <varlistentry>
6377   <term><parameter>sgt</parameter></term>
6378   <listitem>
6379    <para>
6380     scatter/gather table of pinned pages
6381    </para>
6382   </listitem>
6383  </varlistentry>
6384 </variablelist>
6385</refsect1>
6386<refsect1>
6387<title>Description</title>
6388<para>
6389   This function imports a scatter/gather table exported via DMA-BUF by
6390   another driver. Imported buffers must be physically contiguous in memory
6391   (i.e. the scatter/gather table must contain a single entry). Drivers that
6392   use the CMA helpers should set this as their DRM driver's
6393   -&gt;<function>gem_prime_import_sg_table</function> callback.
6394</para>
6395</refsect1>
6396<refsect1>
6397<title>Returns</title>
6398<para>
6399   A pointer to a newly created GEM object or an ERR_PTR-encoded negative
6400   error code on failure.
6401</para>
6402</refsect1>
6403</refentry>
6404
6405<refentry id="API-drm-gem-cma-prime-mmap">
6406<refentryinfo>
6407 <title>LINUX</title>
6408 <productname>Kernel Hackers Manual</productname>
6409 <date>July 2017</date>
6410</refentryinfo>
6411<refmeta>
6412 <refentrytitle><phrase>drm_gem_cma_prime_mmap</phrase></refentrytitle>
6413 <manvolnum>9</manvolnum>
6414 <refmiscinfo class="version">4.4.14</refmiscinfo>
6415</refmeta>
6416<refnamediv>
6417 <refname>drm_gem_cma_prime_mmap</refname>
6418 <refpurpose>
6419     memory-map an exported CMA GEM object
6420 </refpurpose>
6421</refnamediv>
6422<refsynopsisdiv>
6423 <title>Synopsis</title>
6424  <funcsynopsis><funcprototype>
6425   <funcdef>int <function>drm_gem_cma_prime_mmap </function></funcdef>
6426   <paramdef>struct drm_gem_object * <parameter>obj</parameter></paramdef>
6427   <paramdef>struct vm_area_struct * <parameter>vma</parameter></paramdef>
6428  </funcprototype></funcsynopsis>
6429</refsynopsisdiv>
6430<refsect1>
6431 <title>Arguments</title>
6432 <variablelist>
6433  <varlistentry>
6434   <term><parameter>obj</parameter></term>
6435   <listitem>
6436    <para>
6437     GEM object
6438    </para>
6439   </listitem>
6440  </varlistentry>
6441  <varlistentry>
6442   <term><parameter>vma</parameter></term>
6443   <listitem>
6444    <para>
6445     VMA for the area to be mapped
6446    </para>
6447   </listitem>
6448  </varlistentry>
6449 </variablelist>
6450</refsect1>
6451<refsect1>
6452<title>Description</title>
6453<para>
6454   This function maps a buffer imported via DRM PRIME into a userspace
6455   process's address space. Drivers that use the CMA helpers should set this
6456   as their DRM driver's -&gt;<function>gem_prime_mmap</function> callback.
6457</para>
6458</refsect1>
6459<refsect1>
6460<title>Returns</title>
6461<para>
6462   0 on success or a negative error code on failure.
6463</para>
6464</refsect1>
6465</refentry>
6466
6467<refentry id="API-drm-gem-cma-prime-vmap">
6468<refentryinfo>
6469 <title>LINUX</title>
6470 <productname>Kernel Hackers Manual</productname>
6471 <date>July 2017</date>
6472</refentryinfo>
6473<refmeta>
6474 <refentrytitle><phrase>drm_gem_cma_prime_vmap</phrase></refentrytitle>
6475 <manvolnum>9</manvolnum>
6476 <refmiscinfo class="version">4.4.14</refmiscinfo>
6477</refmeta>
6478<refnamediv>
6479 <refname>drm_gem_cma_prime_vmap</refname>
6480 <refpurpose>
6481     map a CMA GEM object into the kernel's virtual address space
6482 </refpurpose>
6483</refnamediv>
6484<refsynopsisdiv>
6485 <title>Synopsis</title>
6486  <funcsynopsis><funcprototype>
6487   <funcdef>void * <function>drm_gem_cma_prime_vmap </function></funcdef>
6488   <paramdef>struct drm_gem_object * <parameter>obj</parameter></paramdef>
6489  </funcprototype></funcsynopsis>
6490</refsynopsisdiv>
6491<refsect1>
6492 <title>Arguments</title>
6493 <variablelist>
6494  <varlistentry>
6495   <term><parameter>obj</parameter></term>
6496   <listitem>
6497    <para>
6498     GEM object
6499    </para>
6500   </listitem>
6501  </varlistentry>
6502 </variablelist>
6503</refsect1>
6504<refsect1>
6505<title>Description</title>
6506<para>
6507   This function maps a buffer exported via DRM PRIME into the kernel's
6508   virtual address space. Since the CMA buffers are already mapped into the
6509   kernel virtual address space this simply returns the cached virtual
6510   address. Drivers using the CMA helpers should set this as their DRM
6511   driver's -&gt;<function>gem_prime_vmap</function> callback.
6512</para>
6513</refsect1>
6514<refsect1>
6515<title>Returns</title>
6516<para>
6517   The kernel virtual address of the CMA GEM object's backing store.
6518</para>
6519</refsect1>
6520</refentry>
6521
6522<refentry id="API-drm-gem-cma-prime-vunmap">
6523<refentryinfo>
6524 <title>LINUX</title>
6525 <productname>Kernel Hackers Manual</productname>
6526 <date>July 2017</date>
6527</refentryinfo>
6528<refmeta>
6529 <refentrytitle><phrase>drm_gem_cma_prime_vunmap</phrase></refentrytitle>
6530 <manvolnum>9</manvolnum>
6531 <refmiscinfo class="version">4.4.14</refmiscinfo>
6532</refmeta>
6533<refnamediv>
6534 <refname>drm_gem_cma_prime_vunmap</refname>
6535 <refpurpose>
6536     unmap a CMA GEM object from the kernel's virtual address space
6537 </refpurpose>
6538</refnamediv>
6539<refsynopsisdiv>
6540 <title>Synopsis</title>
6541  <funcsynopsis><funcprototype>
6542   <funcdef>void <function>drm_gem_cma_prime_vunmap </function></funcdef>
6543   <paramdef>struct drm_gem_object * <parameter>obj</parameter></paramdef>
6544   <paramdef>void * <parameter>vaddr</parameter></paramdef>
6545  </funcprototype></funcsynopsis>
6546</refsynopsisdiv>
6547<refsect1>
6548 <title>Arguments</title>
6549 <variablelist>
6550  <varlistentry>
6551   <term><parameter>obj</parameter></term>
6552   <listitem>
6553    <para>
6554     GEM object
6555    </para>
6556   </listitem>
6557  </varlistentry>
6558  <varlistentry>
6559   <term><parameter>vaddr</parameter></term>
6560   <listitem>
6561    <para>
6562     kernel virtual address where the CMA GEM object was mapped
6563    </para>
6564   </listitem>
6565  </varlistentry>
6566 </variablelist>
6567</refsect1>
6568<refsect1>
6569<title>Description</title>
6570<para>
6571   This function removes a buffer exported via DRM PRIME from the kernel's
6572   virtual address space. This is a no-op because CMA buffers cannot be
6573   unmapped from kernel space. Drivers using the CMA helpers should set this
6574   as their DRM driver's -&gt;<function>gem_prime_vunmap</function> callback.
6575</para>
6576</refsect1>
6577</refentry>
6578
6579<!-- include/drm/drm_gem_cma_helper.h -->
6580<refentry id="API-struct-drm-gem-cma-object">
6581<refentryinfo>
6582 <title>LINUX</title>
6583 <productname>Kernel Hackers Manual</productname>
6584 <date>July 2017</date>
6585</refentryinfo>
6586<refmeta>
6587 <refentrytitle><phrase>struct drm_gem_cma_object</phrase></refentrytitle>
6588 <manvolnum>9</manvolnum>
6589 <refmiscinfo class="version">4.4.14</refmiscinfo>
6590</refmeta>
6591<refnamediv>
6592 <refname>struct drm_gem_cma_object</refname>
6593 <refpurpose>
6594  GEM object backed by CMA memory allocations
6595 </refpurpose>
6596</refnamediv>
6597<refsynopsisdiv>
6598 <title>Synopsis</title>
6599  <programlisting>
6600struct drm_gem_cma_object {
6601  struct drm_gem_object base;
6602  dma_addr_t paddr;
6603  struct sg_table * sgt;
6604  void * vaddr;
6605};  </programlisting>
6606</refsynopsisdiv>
6607 <refsect1>
6608  <title>Members</title>
6609  <variablelist>
6610    <varlistentry>      <term>base</term>
6611      <listitem><para>
6612base GEM object
6613      </para></listitem>
6614    </varlistentry>
6615    <varlistentry>      <term>paddr</term>
6616      <listitem><para>
6617physical address of the backing memory
6618      </para></listitem>
6619    </varlistentry>
6620    <varlistentry>      <term>sgt</term>
6621      <listitem><para>
6622scatter/gather table for imported PRIME buffers
6623      </para></listitem>
6624    </varlistentry>
6625    <varlistentry>      <term>vaddr</term>
6626      <listitem><para>
6627kernel virtual address of the backing memory
6628      </para></listitem>
6629    </varlistentry>
6630  </variablelist>
6631 </refsect1>
6632</refentry>
6633
6634    </sect2>
6635  </sect1>
6636
6637  <!-- Internals: mode setting -->
6638
6639  <sect1 id="drm-mode-setting">
6640    <title>Mode Setting</title>
6641    <para>
6642      Drivers must initialize the mode setting core by calling
6643      <function>drm_mode_config_init</function> on the DRM device. The function
6644      initializes the <structname>drm_device</structname>
6645      <structfield>mode_config</structfield> field and never fails. Once done,
6646      mode configuration must be setup by initializing the following fields.
6647    </para>
6648    <itemizedlist>
6649      <listitem>
6650        <synopsis>int min_width, min_height;
6651int max_width, max_height;</synopsis>
6652        <para>
6653	  Minimum and maximum width and height of the frame buffers in pixel
6654	  units.
6655	</para>
6656      </listitem>
6657      <listitem>
6658        <synopsis>struct drm_mode_config_funcs *funcs;</synopsis>
6659	<para>Mode setting functions.</para>
6660      </listitem>
6661    </itemizedlist>
6662    <sect2>
6663      <title>Display Modes Function Reference</title>
6664<!-- include/drm/drm_modes.h -->
6665<refentry id="API-drm-mode-is-stereo">
6666<refentryinfo>
6667 <title>LINUX</title>
6668 <productname>Kernel Hackers Manual</productname>
6669 <date>July 2017</date>
6670</refentryinfo>
6671<refmeta>
6672 <refentrytitle><phrase>drm_mode_is_stereo</phrase></refentrytitle>
6673 <manvolnum>9</manvolnum>
6674 <refmiscinfo class="version">4.4.14</refmiscinfo>
6675</refmeta>
6676<refnamediv>
6677 <refname>drm_mode_is_stereo</refname>
6678 <refpurpose>
6679  check for stereo mode flags
6680 </refpurpose>
6681</refnamediv>
6682<refsynopsisdiv>
6683 <title>Synopsis</title>
6684  <funcsynopsis><funcprototype>
6685   <funcdef>bool <function>drm_mode_is_stereo </function></funcdef>
6686   <paramdef>const struct drm_display_mode * <parameter>mode</parameter></paramdef>
6687  </funcprototype></funcsynopsis>
6688</refsynopsisdiv>
6689<refsect1>
6690 <title>Arguments</title>
6691 <variablelist>
6692  <varlistentry>
6693   <term><parameter>mode</parameter></term>
6694   <listitem>
6695    <para>
6696     drm_display_mode to check
6697    </para>
6698   </listitem>
6699  </varlistentry>
6700 </variablelist>
6701</refsect1>
6702<refsect1>
6703<title>Returns</title>
6704<para>
6705   True if the mode is one of the stereo modes (like side-by-side), false if
6706   not.
6707</para>
6708</refsect1>
6709</refentry>
6710
6711<!-- drivers/gpu/drm/drm_modes.c -->
6712<refentry id="API-drm-mode-debug-printmodeline">
6713<refentryinfo>
6714 <title>LINUX</title>
6715 <productname>Kernel Hackers Manual</productname>
6716 <date>July 2017</date>
6717</refentryinfo>
6718<refmeta>
6719 <refentrytitle><phrase>drm_mode_debug_printmodeline</phrase></refentrytitle>
6720 <manvolnum>9</manvolnum>
6721 <refmiscinfo class="version">4.4.14</refmiscinfo>
6722</refmeta>
6723<refnamediv>
6724 <refname>drm_mode_debug_printmodeline</refname>
6725 <refpurpose>
6726  print a mode to dmesg
6727 </refpurpose>
6728</refnamediv>
6729<refsynopsisdiv>
6730 <title>Synopsis</title>
6731  <funcsynopsis><funcprototype>
6732   <funcdef>void <function>drm_mode_debug_printmodeline </function></funcdef>
6733   <paramdef>const struct drm_display_mode * <parameter>mode</parameter></paramdef>
6734  </funcprototype></funcsynopsis>
6735</refsynopsisdiv>
6736<refsect1>
6737 <title>Arguments</title>
6738 <variablelist>
6739  <varlistentry>
6740   <term><parameter>mode</parameter></term>
6741   <listitem>
6742    <para>
6743     mode to print
6744    </para>
6745   </listitem>
6746  </varlistentry>
6747 </variablelist>
6748</refsect1>
6749<refsect1>
6750<title>Description</title>
6751<para>
6752   Describe <parameter>mode</parameter> using DRM_DEBUG.
6753</para>
6754</refsect1>
6755</refentry>
6756
6757<refentry id="API-drm-mode-create">
6758<refentryinfo>
6759 <title>LINUX</title>
6760 <productname>Kernel Hackers Manual</productname>
6761 <date>July 2017</date>
6762</refentryinfo>
6763<refmeta>
6764 <refentrytitle><phrase>drm_mode_create</phrase></refentrytitle>
6765 <manvolnum>9</manvolnum>
6766 <refmiscinfo class="version">4.4.14</refmiscinfo>
6767</refmeta>
6768<refnamediv>
6769 <refname>drm_mode_create</refname>
6770 <refpurpose>
6771     create a new display mode
6772 </refpurpose>
6773</refnamediv>
6774<refsynopsisdiv>
6775 <title>Synopsis</title>
6776  <funcsynopsis><funcprototype>
6777   <funcdef>struct drm_display_mode * <function>drm_mode_create </function></funcdef>
6778   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
6779  </funcprototype></funcsynopsis>
6780</refsynopsisdiv>
6781<refsect1>
6782 <title>Arguments</title>
6783 <variablelist>
6784  <varlistentry>
6785   <term><parameter>dev</parameter></term>
6786   <listitem>
6787    <para>
6788     DRM device
6789    </para>
6790   </listitem>
6791  </varlistentry>
6792 </variablelist>
6793</refsect1>
6794<refsect1>
6795<title>Description</title>
6796<para>
6797   Create a new, cleared drm_display_mode with kzalloc, allocate an ID for it
6798   and return it.
6799</para>
6800</refsect1>
6801<refsect1>
6802<title>Returns</title>
6803<para>
6804   Pointer to new mode on success, NULL on error.
6805</para>
6806</refsect1>
6807</refentry>
6808
6809<refentry id="API-drm-mode-destroy">
6810<refentryinfo>
6811 <title>LINUX</title>
6812 <productname>Kernel Hackers Manual</productname>
6813 <date>July 2017</date>
6814</refentryinfo>
6815<refmeta>
6816 <refentrytitle><phrase>drm_mode_destroy</phrase></refentrytitle>
6817 <manvolnum>9</manvolnum>
6818 <refmiscinfo class="version">4.4.14</refmiscinfo>
6819</refmeta>
6820<refnamediv>
6821 <refname>drm_mode_destroy</refname>
6822 <refpurpose>
6823     remove a mode
6824 </refpurpose>
6825</refnamediv>
6826<refsynopsisdiv>
6827 <title>Synopsis</title>
6828  <funcsynopsis><funcprototype>
6829   <funcdef>void <function>drm_mode_destroy </function></funcdef>
6830   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
6831   <paramdef>struct drm_display_mode * <parameter>mode</parameter></paramdef>
6832  </funcprototype></funcsynopsis>
6833</refsynopsisdiv>
6834<refsect1>
6835 <title>Arguments</title>
6836 <variablelist>
6837  <varlistentry>
6838   <term><parameter>dev</parameter></term>
6839   <listitem>
6840    <para>
6841     DRM device
6842    </para>
6843   </listitem>
6844  </varlistentry>
6845  <varlistentry>
6846   <term><parameter>mode</parameter></term>
6847   <listitem>
6848    <para>
6849     mode to remove
6850    </para>
6851   </listitem>
6852  </varlistentry>
6853 </variablelist>
6854</refsect1>
6855<refsect1>
6856<title>Description</title>
6857<para>
6858   Release <parameter>mode</parameter>'s unique ID, then free it <parameter>mode</parameter> structure itself using kfree.
6859</para>
6860</refsect1>
6861</refentry>
6862
6863<refentry id="API-drm-mode-probed-add">
6864<refentryinfo>
6865 <title>LINUX</title>
6866 <productname>Kernel Hackers Manual</productname>
6867 <date>July 2017</date>
6868</refentryinfo>
6869<refmeta>
6870 <refentrytitle><phrase>drm_mode_probed_add</phrase></refentrytitle>
6871 <manvolnum>9</manvolnum>
6872 <refmiscinfo class="version">4.4.14</refmiscinfo>
6873</refmeta>
6874<refnamediv>
6875 <refname>drm_mode_probed_add</refname>
6876 <refpurpose>
6877     add a mode to a connector's probed_mode list
6878 </refpurpose>
6879</refnamediv>
6880<refsynopsisdiv>
6881 <title>Synopsis</title>
6882  <funcsynopsis><funcprototype>
6883   <funcdef>void <function>drm_mode_probed_add </function></funcdef>
6884   <paramdef>struct drm_connector * <parameter>connector</parameter></paramdef>
6885   <paramdef>struct drm_display_mode * <parameter>mode</parameter></paramdef>
6886  </funcprototype></funcsynopsis>
6887</refsynopsisdiv>
6888<refsect1>
6889 <title>Arguments</title>
6890 <variablelist>
6891  <varlistentry>
6892   <term><parameter>connector</parameter></term>
6893   <listitem>
6894    <para>
6895     connector the new mode
6896    </para>
6897   </listitem>
6898  </varlistentry>
6899  <varlistentry>
6900   <term><parameter>mode</parameter></term>
6901   <listitem>
6902    <para>
6903     mode data
6904    </para>
6905   </listitem>
6906  </varlistentry>
6907 </variablelist>
6908</refsect1>
6909<refsect1>
6910<title>Description</title>
6911<para>
6912   Add <parameter>mode</parameter> to <parameter>connector</parameter>'s probed_mode list for later use. This list should
6913   then in a second step get filtered and all the modes actually supported by
6914   the hardware moved to the <parameter>connector</parameter>'s modes list.
6915</para>
6916</refsect1>
6917</refentry>
6918
6919<refentry id="API-drm-cvt-mode">
6920<refentryinfo>
6921 <title>LINUX</title>
6922 <productname>Kernel Hackers Manual</productname>
6923 <date>July 2017</date>
6924</refentryinfo>
6925<refmeta>
6926 <refentrytitle><phrase>drm_cvt_mode</phrase></refentrytitle>
6927 <manvolnum>9</manvolnum>
6928 <refmiscinfo class="version">4.4.14</refmiscinfo>
6929</refmeta>
6930<refnamediv>
6931 <refname>drm_cvt_mode</refname>
6932 <refpurpose>
6933     create a modeline based on the CVT algorithm
6934 </refpurpose>
6935</refnamediv>
6936<refsynopsisdiv>
6937 <title>Synopsis</title>
6938  <funcsynopsis><funcprototype>
6939   <funcdef>struct drm_display_mode * <function>drm_cvt_mode </function></funcdef>
6940   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
6941   <paramdef>int <parameter>hdisplay</parameter></paramdef>
6942   <paramdef>int <parameter>vdisplay</parameter></paramdef>
6943   <paramdef>int <parameter>vrefresh</parameter></paramdef>
6944   <paramdef>bool <parameter>reduced</parameter></paramdef>
6945   <paramdef>bool <parameter>interlaced</parameter></paramdef>
6946   <paramdef>bool <parameter>margins</parameter></paramdef>
6947  </funcprototype></funcsynopsis>
6948</refsynopsisdiv>
6949<refsect1>
6950 <title>Arguments</title>
6951 <variablelist>
6952  <varlistentry>
6953   <term><parameter>dev</parameter></term>
6954   <listitem>
6955    <para>
6956     drm device
6957    </para>
6958   </listitem>
6959  </varlistentry>
6960  <varlistentry>
6961   <term><parameter>hdisplay</parameter></term>
6962   <listitem>
6963    <para>
6964     hdisplay size
6965    </para>
6966   </listitem>
6967  </varlistentry>
6968  <varlistentry>
6969   <term><parameter>vdisplay</parameter></term>
6970   <listitem>
6971    <para>
6972     vdisplay size
6973    </para>
6974   </listitem>
6975  </varlistentry>
6976  <varlistentry>
6977   <term><parameter>vrefresh</parameter></term>
6978   <listitem>
6979    <para>
6980     vrefresh rate
6981    </para>
6982   </listitem>
6983  </varlistentry>
6984  <varlistentry>
6985   <term><parameter>reduced</parameter></term>
6986   <listitem>
6987    <para>
6988     whether to use reduced blanking
6989    </para>
6990   </listitem>
6991  </varlistentry>
6992  <varlistentry>
6993   <term><parameter>interlaced</parameter></term>
6994   <listitem>
6995    <para>
6996     whether to compute an interlaced mode
6997    </para>
6998   </listitem>
6999  </varlistentry>
7000  <varlistentry>
7001   <term><parameter>margins</parameter></term>
7002   <listitem>
7003    <para>
7004     whether to add margins (borders)
7005    </para>
7006   </listitem>
7007  </varlistentry>
7008 </variablelist>
7009</refsect1>
7010<refsect1>
7011<title>Description</title>
7012<para>
7013   This function is called to generate the modeline based on CVT algorithm
7014   according to the hdisplay, vdisplay, vrefresh.
7015   It is based from the VESA(TM) Coordinated Video Timing Generator by
7016   Graham Loveridge April 9, 2003 available at
7017</para>
7018</refsect1>
7019<refsect1>
7020<title>http</title>
7021<para>
7022   //www.elo.utfsm.cl/~elo212/docs/CVTd6r1.xls 
7023   </para><para>
7024
7025   And it is copied from xf86CVTmode in xserver/hw/xfree86/modes/xf86cvt.c.
7026   What I have done is to translate it by using integer calculation.
7027</para>
7028</refsect1>
7029<refsect1>
7030<title>Returns</title>
7031<para>
7032   The modeline based on the CVT algorithm stored in a drm_display_mode object.
7033   The display mode object is allocated with <function>drm_mode_create</function>. Returns NULL
7034   when no mode could be allocated.
7035</para>
7036</refsect1>
7037</refentry>
7038
7039<refentry id="API-drm-gtf-mode-complex">
7040<refentryinfo>
7041 <title>LINUX</title>
7042 <productname>Kernel Hackers Manual</productname>
7043 <date>July 2017</date>
7044</refentryinfo>
7045<refmeta>
7046 <refentrytitle><phrase>drm_gtf_mode_complex</phrase></refentrytitle>
7047 <manvolnum>9</manvolnum>
7048 <refmiscinfo class="version">4.4.14</refmiscinfo>
7049</refmeta>
7050<refnamediv>
7051 <refname>drm_gtf_mode_complex</refname>
7052 <refpurpose>
7053     create the modeline based on the full GTF algorithm
7054 </refpurpose>
7055</refnamediv>
7056<refsynopsisdiv>
7057 <title>Synopsis</title>
7058  <funcsynopsis><funcprototype>
7059   <funcdef>struct drm_display_mode * <function>drm_gtf_mode_complex </function></funcdef>
7060   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
7061   <paramdef>int <parameter>hdisplay</parameter></paramdef>
7062   <paramdef>int <parameter>vdisplay</parameter></paramdef>
7063   <paramdef>int <parameter>vrefresh</parameter></paramdef>
7064   <paramdef>bool <parameter>interlaced</parameter></paramdef>
7065   <paramdef>int <parameter>margins</parameter></paramdef>
7066   <paramdef>int <parameter>GTF_M</parameter></paramdef>
7067   <paramdef>int <parameter>GTF_2C</parameter></paramdef>
7068   <paramdef>int <parameter>GTF_K</parameter></paramdef>
7069   <paramdef>int <parameter>GTF_2J</parameter></paramdef>
7070  </funcprototype></funcsynopsis>
7071</refsynopsisdiv>
7072<refsect1>
7073 <title>Arguments</title>
7074 <variablelist>
7075  <varlistentry>
7076   <term><parameter>dev</parameter></term>
7077   <listitem>
7078    <para>
7079     drm device
7080    </para>
7081   </listitem>
7082  </varlistentry>
7083  <varlistentry>
7084   <term><parameter>hdisplay</parameter></term>
7085   <listitem>
7086    <para>
7087     hdisplay size
7088    </para>
7089   </listitem>
7090  </varlistentry>
7091  <varlistentry>
7092   <term><parameter>vdisplay</parameter></term>
7093   <listitem>
7094    <para>
7095     vdisplay size
7096    </para>
7097   </listitem>
7098  </varlistentry>
7099  <varlistentry>
7100   <term><parameter>vrefresh</parameter></term>
7101   <listitem>
7102    <para>
7103     vrefresh rate.
7104    </para>
7105   </listitem>
7106  </varlistentry>
7107  <varlistentry>
7108   <term><parameter>interlaced</parameter></term>
7109   <listitem>
7110    <para>
7111     whether to compute an interlaced mode
7112    </para>
7113   </listitem>
7114  </varlistentry>
7115  <varlistentry>
7116   <term><parameter>margins</parameter></term>
7117   <listitem>
7118    <para>
7119     desired margin (borders) size
7120    </para>
7121   </listitem>
7122  </varlistentry>
7123  <varlistentry>
7124   <term><parameter>GTF_M</parameter></term>
7125   <listitem>
7126    <para>
7127     extended GTF formula parameters
7128    </para>
7129   </listitem>
7130  </varlistentry>
7131  <varlistentry>
7132   <term><parameter>GTF_2C</parameter></term>
7133   <listitem>
7134    <para>
7135     extended GTF formula parameters
7136    </para>
7137   </listitem>
7138  </varlistentry>
7139  <varlistentry>
7140   <term><parameter>GTF_K</parameter></term>
7141   <listitem>
7142    <para>
7143     extended GTF formula parameters
7144    </para>
7145   </listitem>
7146  </varlistentry>
7147  <varlistentry>
7148   <term><parameter>GTF_2J</parameter></term>
7149   <listitem>
7150    <para>
7151     extended GTF formula parameters
7152    </para>
7153   </listitem>
7154  </varlistentry>
7155 </variablelist>
7156</refsect1>
7157<refsect1>
7158<title>Description</title>
7159<para>
7160   GTF feature blocks specify C and J in multiples of 0.5, so we pass them
7161   in here multiplied by two.  For a C of 40, pass in 80.
7162</para>
7163</refsect1>
7164<refsect1>
7165<title>Returns</title>
7166<para>
7167   The modeline based on the full GTF algorithm stored in a drm_display_mode object.
7168   The display mode object is allocated with <function>drm_mode_create</function>. Returns NULL
7169   when no mode could be allocated.
7170</para>
7171</refsect1>
7172</refentry>
7173
7174<refentry id="API-drm-gtf-mode">
7175<refentryinfo>
7176 <title>LINUX</title>
7177 <productname>Kernel Hackers Manual</productname>
7178 <date>July 2017</date>
7179</refentryinfo>
7180<refmeta>
7181 <refentrytitle><phrase>drm_gtf_mode</phrase></refentrytitle>
7182 <manvolnum>9</manvolnum>
7183 <refmiscinfo class="version">4.4.14</refmiscinfo>
7184</refmeta>
7185<refnamediv>
7186 <refname>drm_gtf_mode</refname>
7187 <refpurpose>
7188     create the modeline based on the GTF algorithm
7189 </refpurpose>
7190</refnamediv>
7191<refsynopsisdiv>
7192 <title>Synopsis</title>
7193  <funcsynopsis><funcprototype>
7194   <funcdef>struct drm_display_mode * <function>drm_gtf_mode </function></funcdef>
7195   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
7196   <paramdef>int <parameter>hdisplay</parameter></paramdef>
7197   <paramdef>int <parameter>vdisplay</parameter></paramdef>
7198   <paramdef>int <parameter>vrefresh</parameter></paramdef>
7199   <paramdef>bool <parameter>interlaced</parameter></paramdef>
7200   <paramdef>int <parameter>margins</parameter></paramdef>
7201  </funcprototype></funcsynopsis>
7202</refsynopsisdiv>
7203<refsect1>
7204 <title>Arguments</title>
7205 <variablelist>
7206  <varlistentry>
7207   <term><parameter>dev</parameter></term>
7208   <listitem>
7209    <para>
7210     drm device
7211    </para>
7212   </listitem>
7213  </varlistentry>
7214  <varlistentry>
7215   <term><parameter>hdisplay</parameter></term>
7216   <listitem>
7217    <para>
7218     hdisplay size
7219    </para>
7220   </listitem>
7221  </varlistentry>
7222  <varlistentry>
7223   <term><parameter>vdisplay</parameter></term>
7224   <listitem>
7225    <para>
7226     vdisplay size
7227    </para>
7228   </listitem>
7229  </varlistentry>
7230  <varlistentry>
7231   <term><parameter>vrefresh</parameter></term>
7232   <listitem>
7233    <para>
7234     vrefresh rate.
7235    </para>
7236   </listitem>
7237  </varlistentry>
7238  <varlistentry>
7239   <term><parameter>interlaced</parameter></term>
7240   <listitem>
7241    <para>
7242     whether to compute an interlaced mode
7243    </para>
7244   </listitem>
7245  </varlistentry>
7246  <varlistentry>
7247   <term><parameter>margins</parameter></term>
7248   <listitem>
7249    <para>
7250     desired margin (borders) size
7251    </para>
7252   </listitem>
7253  </varlistentry>
7254 </variablelist>
7255</refsect1>
7256<refsect1>
7257<title>Description</title>
7258<para>
7259   return the modeline based on GTF algorithm
7260   </para><para>
7261
7262   This function is to create the modeline based on the GTF algorithm.
7263</para>
7264</refsect1>
7265<refsect1>
7266<title>Generalized Timing Formula is derived from</title>
7267<para>
7268   GTF Spreadsheet by Andy Morrish (1/5/97)
7269</para>
7270</refsect1>
7271<refsect1>
7272<title>available at http</title>
7273<para>
7274   //www.vesa.org
7275   </para><para>
7276
7277   And it is copied from the file of xserver/hw/xfree86/modes/xf86gtf.c.
7278   What I have done is to translate it by using integer calculation.
7279   I also refer to the function of fb_get_mode in the file of
7280   drivers/video/fbmon.c
7281</para>
7282</refsect1>
7283<refsect1>
7284<title>Standard GTF parameters</title>
7285<para>
7286   M = 600
7287   C = 40
7288   K = 128
7289   J = 20
7290</para>
7291</refsect1>
7292<refsect1>
7293<title>Returns</title>
7294<para>
7295   The modeline based on the GTF algorithm stored in a drm_display_mode object.
7296   The display mode object is allocated with <function>drm_mode_create</function>. Returns NULL
7297   when no mode could be allocated.
7298</para>
7299</refsect1>
7300</refentry>
7301
7302<refentry id="API-drm-display-mode-from-videomode">
7303<refentryinfo>
7304 <title>LINUX</title>
7305 <productname>Kernel Hackers Manual</productname>
7306 <date>July 2017</date>
7307</refentryinfo>
7308<refmeta>
7309 <refentrytitle><phrase>drm_display_mode_from_videomode</phrase></refentrytitle>
7310 <manvolnum>9</manvolnum>
7311 <refmiscinfo class="version">4.4.14</refmiscinfo>
7312</refmeta>
7313<refnamediv>
7314 <refname>drm_display_mode_from_videomode</refname>
7315 <refpurpose>
7316     fill in <parameter>dmode</parameter> using <parameter>vm</parameter>,
7317 </refpurpose>
7318</refnamediv>
7319<refsynopsisdiv>
7320 <title>Synopsis</title>
7321  <funcsynopsis><funcprototype>
7322   <funcdef>void <function>drm_display_mode_from_videomode </function></funcdef>
7323   <paramdef>const struct videomode * <parameter>vm</parameter></paramdef>
7324   <paramdef>struct drm_display_mode * <parameter>dmode</parameter></paramdef>
7325  </funcprototype></funcsynopsis>
7326</refsynopsisdiv>
7327<refsect1>
7328 <title>Arguments</title>
7329 <variablelist>
7330  <varlistentry>
7331   <term><parameter>vm</parameter></term>
7332   <listitem>
7333    <para>
7334     videomode structure to use as source
7335    </para>
7336   </listitem>
7337  </varlistentry>
7338  <varlistentry>
7339   <term><parameter>dmode</parameter></term>
7340   <listitem>
7341    <para>
7342     drm_display_mode structure to use as destination
7343    </para>
7344   </listitem>
7345  </varlistentry>
7346 </variablelist>
7347</refsect1>
7348<refsect1>
7349<title>Description</title>
7350<para>
7351   Fills out <parameter>dmode</parameter> using the display mode specified in <parameter>vm</parameter>.
7352</para>
7353</refsect1>
7354</refentry>
7355
7356<refentry id="API-drm-display-mode-to-videomode">
7357<refentryinfo>
7358 <title>LINUX</title>
7359 <productname>Kernel Hackers Manual</productname>
7360 <date>July 2017</date>
7361</refentryinfo>
7362<refmeta>
7363 <refentrytitle><phrase>drm_display_mode_to_videomode</phrase></refentrytitle>
7364 <manvolnum>9</manvolnum>
7365 <refmiscinfo class="version">4.4.14</refmiscinfo>
7366</refmeta>
7367<refnamediv>
7368 <refname>drm_display_mode_to_videomode</refname>
7369 <refpurpose>
7370     fill in <parameter>vm</parameter> using <parameter>dmode</parameter>,
7371 </refpurpose>
7372</refnamediv>
7373<refsynopsisdiv>
7374 <title>Synopsis</title>
7375  <funcsynopsis><funcprototype>
7376   <funcdef>void <function>drm_display_mode_to_videomode </function></funcdef>
7377   <paramdef>const struct drm_display_mode * <parameter>dmode</parameter></paramdef>
7378   <paramdef>struct videomode * <parameter>vm</parameter></paramdef>
7379  </funcprototype></funcsynopsis>
7380</refsynopsisdiv>
7381<refsect1>
7382 <title>Arguments</title>
7383 <variablelist>
7384  <varlistentry>
7385   <term><parameter>dmode</parameter></term>
7386   <listitem>
7387    <para>
7388     drm_display_mode structure to use as source
7389    </para>
7390   </listitem>
7391  </varlistentry>
7392  <varlistentry>
7393   <term><parameter>vm</parameter></term>
7394   <listitem>
7395    <para>
7396     videomode structure to use as destination
7397    </para>
7398   </listitem>
7399  </varlistentry>
7400 </variablelist>
7401</refsect1>
7402<refsect1>
7403<title>Description</title>
7404<para>
7405   Fills out <parameter>vm</parameter> using the display mode specified in <parameter>dmode</parameter>.
7406</para>
7407</refsect1>
7408</refentry>
7409
7410<refentry id="API-of-get-drm-display-mode">
7411<refentryinfo>
7412 <title>LINUX</title>
7413 <productname>Kernel Hackers Manual</productname>
7414 <date>July 2017</date>
7415</refentryinfo>
7416<refmeta>
7417 <refentrytitle><phrase>of_get_drm_display_mode</phrase></refentrytitle>
7418 <manvolnum>9</manvolnum>
7419 <refmiscinfo class="version">4.4.14</refmiscinfo>
7420</refmeta>
7421<refnamediv>
7422 <refname>of_get_drm_display_mode</refname>
7423 <refpurpose>
7424     get a drm_display_mode from devicetree
7425 </refpurpose>
7426</refnamediv>
7427<refsynopsisdiv>
7428 <title>Synopsis</title>
7429  <funcsynopsis><funcprototype>
7430   <funcdef>int <function>of_get_drm_display_mode </function></funcdef>
7431   <paramdef>struct device_node * <parameter>np</parameter></paramdef>
7432   <paramdef>struct drm_display_mode * <parameter>dmode</parameter></paramdef>
7433   <paramdef>int <parameter>index</parameter></paramdef>
7434  </funcprototype></funcsynopsis>
7435</refsynopsisdiv>
7436<refsect1>
7437 <title>Arguments</title>
7438 <variablelist>
7439  <varlistentry>
7440   <term><parameter>np</parameter></term>
7441   <listitem>
7442    <para>
7443     device_node with the timing specification
7444    </para>
7445   </listitem>
7446  </varlistentry>
7447  <varlistentry>
7448   <term><parameter>dmode</parameter></term>
7449   <listitem>
7450    <para>
7451     will be set to the return value
7452    </para>
7453   </listitem>
7454  </varlistentry>
7455  <varlistentry>
7456   <term><parameter>index</parameter></term>
7457   <listitem>
7458    <para>
7459     index into the list of display timings in devicetree
7460    </para>
7461   </listitem>
7462  </varlistentry>
7463 </variablelist>
7464</refsect1>
7465<refsect1>
7466<title>Description</title>
7467<para>
7468   This function is expensive and should only be used, if only one mode is to be
7469   read from DT. To get multiple modes start with of_get_display_timings and
7470   work with that instead.
7471</para>
7472</refsect1>
7473<refsect1>
7474<title>Returns</title>
7475<para>
7476   0 on success, a negative errno code when no of videomode node was found.
7477</para>
7478</refsect1>
7479</refentry>
7480
7481<refentry id="API-drm-mode-set-name">
7482<refentryinfo>
7483 <title>LINUX</title>
7484 <productname>Kernel Hackers Manual</productname>
7485 <date>July 2017</date>
7486</refentryinfo>
7487<refmeta>
7488 <refentrytitle><phrase>drm_mode_set_name</phrase></refentrytitle>
7489 <manvolnum>9</manvolnum>
7490 <refmiscinfo class="version">4.4.14</refmiscinfo>
7491</refmeta>
7492<refnamediv>
7493 <refname>drm_mode_set_name</refname>
7494 <refpurpose>
7495     set the name on a mode
7496 </refpurpose>
7497</refnamediv>
7498<refsynopsisdiv>
7499 <title>Synopsis</title>
7500  <funcsynopsis><funcprototype>
7501   <funcdef>void <function>drm_mode_set_name </function></funcdef>
7502   <paramdef>struct drm_display_mode * <parameter>mode</parameter></paramdef>
7503  </funcprototype></funcsynopsis>
7504</refsynopsisdiv>
7505<refsect1>
7506 <title>Arguments</title>
7507 <variablelist>
7508  <varlistentry>
7509   <term><parameter>mode</parameter></term>
7510   <listitem>
7511    <para>
7512     name will be set in this mode
7513    </para>
7514   </listitem>
7515  </varlistentry>
7516 </variablelist>
7517</refsect1>
7518<refsect1>
7519<title>Description</title>
7520<para>
7521   Set the name of <parameter>mode</parameter> to a standard format which is &lt;hdisplay&gt;x&lt;vdisplay&gt;
7522   with an optional 'i' suffix for interlaced modes.
7523</para>
7524</refsect1>
7525</refentry>
7526
7527<refentry id="API-drm-mode-vrefresh">
7528<refentryinfo>
7529 <title>LINUX</title>
7530 <productname>Kernel Hackers Manual</productname>
7531 <date>July 2017</date>
7532</refentryinfo>
7533<refmeta>
7534 <refentrytitle><phrase>drm_mode_vrefresh</phrase></refentrytitle>
7535 <manvolnum>9</manvolnum>
7536 <refmiscinfo class="version">4.4.14</refmiscinfo>
7537</refmeta>
7538<refnamediv>
7539 <refname>drm_mode_vrefresh</refname>
7540 <refpurpose>
7541     get the vrefresh of a mode
7542 </refpurpose>
7543</refnamediv>
7544<refsynopsisdiv>
7545 <title>Synopsis</title>
7546  <funcsynopsis><funcprototype>
7547   <funcdef>int <function>drm_mode_vrefresh </function></funcdef>
7548   <paramdef>const struct drm_display_mode * <parameter>mode</parameter></paramdef>
7549  </funcprototype></funcsynopsis>
7550</refsynopsisdiv>
7551<refsect1>
7552 <title>Arguments</title>
7553 <variablelist>
7554  <varlistentry>
7555   <term><parameter>mode</parameter></term>
7556   <listitem>
7557    <para>
7558     mode
7559    </para>
7560   </listitem>
7561  </varlistentry>
7562 </variablelist>
7563</refsect1>
7564<refsect1>
7565<title>Returns</title>
7566<para>
7567   <parameter>modes</parameter>'s vrefresh rate in Hz, rounded to the nearest integer. Calculates the
7568   value first if it is not yet set.
7569</para>
7570</refsect1>
7571</refentry>
7572
7573<refentry id="API-drm-mode-set-crtcinfo">
7574<refentryinfo>
7575 <title>LINUX</title>
7576 <productname>Kernel Hackers Manual</productname>
7577 <date>July 2017</date>
7578</refentryinfo>
7579<refmeta>
7580 <refentrytitle><phrase>drm_mode_set_crtcinfo</phrase></refentrytitle>
7581 <manvolnum>9</manvolnum>
7582 <refmiscinfo class="version">4.4.14</refmiscinfo>
7583</refmeta>
7584<refnamediv>
7585 <refname>drm_mode_set_crtcinfo</refname>
7586 <refpurpose>
7587     set CRTC modesetting timing parameters
7588 </refpurpose>
7589</refnamediv>
7590<refsynopsisdiv>
7591 <title>Synopsis</title>
7592  <funcsynopsis><funcprototype>
7593   <funcdef>void <function>drm_mode_set_crtcinfo </function></funcdef>
7594   <paramdef>struct drm_display_mode * <parameter>p</parameter></paramdef>
7595   <paramdef>int <parameter>adjust_flags</parameter></paramdef>
7596  </funcprototype></funcsynopsis>
7597</refsynopsisdiv>
7598<refsect1>
7599 <title>Arguments</title>
7600 <variablelist>
7601  <varlistentry>
7602   <term><parameter>p</parameter></term>
7603   <listitem>
7604    <para>
7605     mode
7606    </para>
7607   </listitem>
7608  </varlistentry>
7609  <varlistentry>
7610   <term><parameter>adjust_flags</parameter></term>
7611   <listitem>
7612    <para>
7613     a combination of adjustment flags
7614    </para>
7615   </listitem>
7616  </varlistentry>
7617 </variablelist>
7618</refsect1>
7619<refsect1>
7620<title>Description</title>
7621<para>
7622   Setup the CRTC modesetting timing parameters for <parameter>p</parameter>, adjusting if necessary.
7623   </para><para>
7624
7625   - The CRTC_INTERLACE_HALVE_V flag can be used to halve vertical timings of
7626   interlaced modes.
7627   - The CRTC_STEREO_DOUBLE flag can be used to compute the timings for
7628   buffers containing two eyes (only adjust the timings when needed, eg. for
7629   <quote>frame packing</quote> or <quote>side by side full</quote>).
7630   - The CRTC_NO_DBLSCAN and CRTC_NO_VSCAN flags request that adjustment *not*
7631   be performed for doublescan and vscan &gt; 1 modes respectively.
7632</para>
7633</refsect1>
7634</refentry>
7635
7636<refentry id="API-drm-mode-copy">
7637<refentryinfo>
7638 <title>LINUX</title>
7639 <productname>Kernel Hackers Manual</productname>
7640 <date>July 2017</date>
7641</refentryinfo>
7642<refmeta>
7643 <refentrytitle><phrase>drm_mode_copy</phrase></refentrytitle>
7644 <manvolnum>9</manvolnum>
7645 <refmiscinfo class="version">4.4.14</refmiscinfo>
7646</refmeta>
7647<refnamediv>
7648 <refname>drm_mode_copy</refname>
7649 <refpurpose>
7650     copy the mode
7651 </refpurpose>
7652</refnamediv>
7653<refsynopsisdiv>
7654 <title>Synopsis</title>
7655  <funcsynopsis><funcprototype>
7656   <funcdef>void <function>drm_mode_copy </function></funcdef>
7657   <paramdef>struct drm_display_mode * <parameter>dst</parameter></paramdef>
7658   <paramdef>const struct drm_display_mode * <parameter>src</parameter></paramdef>
7659  </funcprototype></funcsynopsis>
7660</refsynopsisdiv>
7661<refsect1>
7662 <title>Arguments</title>
7663 <variablelist>
7664  <varlistentry>
7665   <term><parameter>dst</parameter></term>
7666   <listitem>
7667    <para>
7668     mode to overwrite
7669    </para>
7670   </listitem>
7671  </varlistentry>
7672  <varlistentry>
7673   <term><parameter>src</parameter></term>
7674   <listitem>
7675    <para>
7676     mode to copy
7677    </para>
7678   </listitem>
7679  </varlistentry>
7680 </variablelist>
7681</refsect1>
7682<refsect1>
7683<title>Description</title>
7684<para>
7685   Copy an existing mode into another mode, preserving the object id and
7686   list head of the destination mode.
7687</para>
7688</refsect1>
7689</refentry>
7690
7691<refentry id="API-drm-mode-duplicate">
7692<refentryinfo>
7693 <title>LINUX</title>
7694 <productname>Kernel Hackers Manual</productname>
7695 <date>July 2017</date>
7696</refentryinfo>
7697<refmeta>
7698 <refentrytitle><phrase>drm_mode_duplicate</phrase></refentrytitle>
7699 <manvolnum>9</manvolnum>
7700 <refmiscinfo class="version">4.4.14</refmiscinfo>
7701</refmeta>
7702<refnamediv>
7703 <refname>drm_mode_duplicate</refname>
7704 <refpurpose>
7705     allocate and duplicate an existing mode
7706 </refpurpose>
7707</refnamediv>
7708<refsynopsisdiv>
7709 <title>Synopsis</title>
7710  <funcsynopsis><funcprototype>
7711   <funcdef>struct drm_display_mode * <function>drm_mode_duplicate </function></funcdef>
7712   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
7713   <paramdef>const struct drm_display_mode * <parameter>mode</parameter></paramdef>
7714  </funcprototype></funcsynopsis>
7715</refsynopsisdiv>
7716<refsect1>
7717 <title>Arguments</title>
7718 <variablelist>
7719  <varlistentry>
7720   <term><parameter>dev</parameter></term>
7721   <listitem>
7722    <para>
7723     drm_device to allocate the duplicated mode for
7724    </para>
7725   </listitem>
7726  </varlistentry>
7727  <varlistentry>
7728   <term><parameter>mode</parameter></term>
7729   <listitem>
7730    <para>
7731     mode to duplicate
7732    </para>
7733   </listitem>
7734  </varlistentry>
7735 </variablelist>
7736</refsect1>
7737<refsect1>
7738<title>Description</title>
7739<para>
7740   Just allocate a new mode, copy the existing mode into it, and return
7741   a pointer to it.  Used to create new instances of established modes.
7742</para>
7743</refsect1>
7744<refsect1>
7745<title>Returns</title>
7746<para>
7747   Pointer to duplicated mode on success, NULL on error.
7748</para>
7749</refsect1>
7750</refentry>
7751
7752<refentry id="API-drm-mode-equal">
7753<refentryinfo>
7754 <title>LINUX</title>
7755 <productname>Kernel Hackers Manual</productname>
7756 <date>July 2017</date>
7757</refentryinfo>
7758<refmeta>
7759 <refentrytitle><phrase>drm_mode_equal</phrase></refentrytitle>
7760 <manvolnum>9</manvolnum>
7761 <refmiscinfo class="version">4.4.14</refmiscinfo>
7762</refmeta>
7763<refnamediv>
7764 <refname>drm_mode_equal</refname>
7765 <refpurpose>
7766     test modes for equality
7767 </refpurpose>
7768</refnamediv>
7769<refsynopsisdiv>
7770 <title>Synopsis</title>
7771  <funcsynopsis><funcprototype>
7772   <funcdef>bool <function>drm_mode_equal </function></funcdef>
7773   <paramdef>const struct drm_display_mode * <parameter>mode1</parameter></paramdef>
7774   <paramdef>const struct drm_display_mode * <parameter>mode2</parameter></paramdef>
7775  </funcprototype></funcsynopsis>
7776</refsynopsisdiv>
7777<refsect1>
7778 <title>Arguments</title>
7779 <variablelist>
7780  <varlistentry>
7781   <term><parameter>mode1</parameter></term>
7782   <listitem>
7783    <para>
7784     first mode
7785    </para>
7786   </listitem>
7787  </varlistentry>
7788  <varlistentry>
7789   <term><parameter>mode2</parameter></term>
7790   <listitem>
7791    <para>
7792     second mode
7793    </para>
7794   </listitem>
7795  </varlistentry>
7796 </variablelist>
7797</refsect1>
7798<refsect1>
7799<title>Description</title>
7800<para>
7801   Check to see if <parameter>mode1</parameter> and <parameter>mode2</parameter> are equivalent.
7802</para>
7803</refsect1>
7804<refsect1>
7805<title>Returns</title>
7806<para>
7807   True if the modes are equal, false otherwise.
7808</para>
7809</refsect1>
7810</refentry>
7811
7812<refentry id="API-drm-mode-equal-no-clocks-no-stereo">
7813<refentryinfo>
7814 <title>LINUX</title>
7815 <productname>Kernel Hackers Manual</productname>
7816 <date>July 2017</date>
7817</refentryinfo>
7818<refmeta>
7819 <refentrytitle><phrase>drm_mode_equal_no_clocks_no_stereo</phrase></refentrytitle>
7820 <manvolnum>9</manvolnum>
7821 <refmiscinfo class="version">4.4.14</refmiscinfo>
7822</refmeta>
7823<refnamediv>
7824 <refname>drm_mode_equal_no_clocks_no_stereo</refname>
7825 <refpurpose>
7826     test modes for equality
7827 </refpurpose>
7828</refnamediv>
7829<refsynopsisdiv>
7830 <title>Synopsis</title>
7831  <funcsynopsis><funcprototype>
7832   <funcdef>bool <function>drm_mode_equal_no_clocks_no_stereo </function></funcdef>
7833   <paramdef>const struct drm_display_mode * <parameter>mode1</parameter></paramdef>
7834   <paramdef>const struct drm_display_mode * <parameter>mode2</parameter></paramdef>
7835  </funcprototype></funcsynopsis>
7836</refsynopsisdiv>
7837<refsect1>
7838 <title>Arguments</title>
7839 <variablelist>
7840  <varlistentry>
7841   <term><parameter>mode1</parameter></term>
7842   <listitem>
7843    <para>
7844     first mode
7845    </para>
7846   </listitem>
7847  </varlistentry>
7848  <varlistentry>
7849   <term><parameter>mode2</parameter></term>
7850   <listitem>
7851    <para>
7852     second mode
7853    </para>
7854   </listitem>
7855  </varlistentry>
7856 </variablelist>
7857</refsect1>
7858<refsect1>
7859<title>Description</title>
7860<para>
7861   Check to see if <parameter>mode1</parameter> and <parameter>mode2</parameter> are equivalent, but
7862   don't check the pixel clocks nor the stereo layout.
7863</para>
7864</refsect1>
7865<refsect1>
7866<title>Returns</title>
7867<para>
7868   True if the modes are equal, false otherwise.
7869</para>
7870</refsect1>
7871</refentry>
7872
7873<refentry id="API-drm-mode-validate-basic">
7874<refentryinfo>
7875 <title>LINUX</title>
7876 <productname>Kernel Hackers Manual</productname>
7877 <date>July 2017</date>
7878</refentryinfo>
7879<refmeta>
7880 <refentrytitle><phrase>drm_mode_validate_basic</phrase></refentrytitle>
7881 <manvolnum>9</manvolnum>
7882 <refmiscinfo class="version">4.4.14</refmiscinfo>
7883</refmeta>
7884<refnamediv>
7885 <refname>drm_mode_validate_basic</refname>
7886 <refpurpose>
7887     make sure the mode is somewhat sane
7888 </refpurpose>
7889</refnamediv>
7890<refsynopsisdiv>
7891 <title>Synopsis</title>
7892  <funcsynopsis><funcprototype>
7893   <funcdef>enum drm_mode_status <function>drm_mode_validate_basic </function></funcdef>
7894   <paramdef>const struct drm_display_mode * <parameter>mode</parameter></paramdef>
7895  </funcprototype></funcsynopsis>
7896</refsynopsisdiv>
7897<refsect1>
7898 <title>Arguments</title>
7899 <variablelist>
7900  <varlistentry>
7901   <term><parameter>mode</parameter></term>
7902   <listitem>
7903    <para>
7904     mode to check
7905    </para>
7906   </listitem>
7907  </varlistentry>
7908 </variablelist>
7909</refsect1>
7910<refsect1>
7911<title>Description</title>
7912<para>
7913   Check that the mode timings are at least somewhat reasonable.
7914   Any hardware specific limits are left up for each driver to check.
7915</para>
7916</refsect1>
7917<refsect1>
7918<title>Returns</title>
7919<para>
7920   The mode status
7921</para>
7922</refsect1>
7923</refentry>
7924
7925<refentry id="API-drm-mode-validate-size">
7926<refentryinfo>
7927 <title>LINUX</title>
7928 <productname>Kernel Hackers Manual</productname>
7929 <date>July 2017</date>
7930</refentryinfo>
7931<refmeta>
7932 <refentrytitle><phrase>drm_mode_validate_size</phrase></refentrytitle>
7933 <manvolnum>9</manvolnum>
7934 <refmiscinfo class="version">4.4.14</refmiscinfo>
7935</refmeta>
7936<refnamediv>
7937 <refname>drm_mode_validate_size</refname>
7938 <refpurpose>
7939     make sure modes adhere to size constraints
7940 </refpurpose>
7941</refnamediv>
7942<refsynopsisdiv>
7943 <title>Synopsis</title>
7944  <funcsynopsis><funcprototype>
7945   <funcdef>enum drm_mode_status <function>drm_mode_validate_size </function></funcdef>
7946   <paramdef>const struct drm_display_mode * <parameter>mode</parameter></paramdef>
7947   <paramdef>int <parameter>maxX</parameter></paramdef>
7948   <paramdef>int <parameter>maxY</parameter></paramdef>
7949  </funcprototype></funcsynopsis>
7950</refsynopsisdiv>
7951<refsect1>
7952 <title>Arguments</title>
7953 <variablelist>
7954  <varlistentry>
7955   <term><parameter>mode</parameter></term>
7956   <listitem>
7957    <para>
7958     mode to check
7959    </para>
7960   </listitem>
7961  </varlistentry>
7962  <varlistentry>
7963   <term><parameter>maxX</parameter></term>
7964   <listitem>
7965    <para>
7966     maximum width
7967    </para>
7968   </listitem>
7969  </varlistentry>
7970  <varlistentry>
7971   <term><parameter>maxY</parameter></term>
7972   <listitem>
7973    <para>
7974     maximum height
7975    </para>
7976   </listitem>
7977  </varlistentry>
7978 </variablelist>
7979</refsect1>
7980<refsect1>
7981<title>Description</title>
7982<para>
7983   This function is a helper which can be used to validate modes against size
7984   limitations of the DRM device/connector. If a mode is too big its status
7985   member is updated with the appropriate validation failure code. The list
7986   itself is not changed.
7987</para>
7988</refsect1>
7989<refsect1>
7990<title>Returns</title>
7991<para>
7992   The mode status
7993</para>
7994</refsect1>
7995</refentry>
7996
7997<refentry id="API-drm-mode-prune-invalid">
7998<refentryinfo>
7999 <title>LINUX</title>
8000 <productname>Kernel Hackers Manual</productname>
8001 <date>July 2017</date>
8002</refentryinfo>
8003<refmeta>
8004 <refentrytitle><phrase>drm_mode_prune_invalid</phrase></refentrytitle>
8005 <manvolnum>9</manvolnum>
8006 <refmiscinfo class="version">4.4.14</refmiscinfo>
8007</refmeta>
8008<refnamediv>
8009 <refname>drm_mode_prune_invalid</refname>
8010 <refpurpose>
8011     remove invalid modes from mode list
8012 </refpurpose>
8013</refnamediv>
8014<refsynopsisdiv>
8015 <title>Synopsis</title>
8016  <funcsynopsis><funcprototype>
8017   <funcdef>void <function>drm_mode_prune_invalid </function></funcdef>
8018   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
8019   <paramdef>struct list_head * <parameter>mode_list</parameter></paramdef>
8020   <paramdef>bool <parameter>verbose</parameter></paramdef>
8021  </funcprototype></funcsynopsis>
8022</refsynopsisdiv>
8023<refsect1>
8024 <title>Arguments</title>
8025 <variablelist>
8026  <varlistentry>
8027   <term><parameter>dev</parameter></term>
8028   <listitem>
8029    <para>
8030     DRM device
8031    </para>
8032   </listitem>
8033  </varlistentry>
8034  <varlistentry>
8035   <term><parameter>mode_list</parameter></term>
8036   <listitem>
8037    <para>
8038     list of modes to check
8039    </para>
8040   </listitem>
8041  </varlistentry>
8042  <varlistentry>
8043   <term><parameter>verbose</parameter></term>
8044   <listitem>
8045    <para>
8046     be verbose about it
8047    </para>
8048   </listitem>
8049  </varlistentry>
8050 </variablelist>
8051</refsect1>
8052<refsect1>
8053<title>Description</title>
8054<para>
8055   This helper function can be used to prune a display mode list after
8056   validation has been completed. All modes who's status is not MODE_OK will be
8057   removed from the list, and if <parameter>verbose</parameter> the status code and mode name is also
8058   printed to dmesg.
8059</para>
8060</refsect1>
8061</refentry>
8062
8063<refentry id="API-drm-mode-sort">
8064<refentryinfo>
8065 <title>LINUX</title>
8066 <productname>Kernel Hackers Manual</productname>
8067 <date>July 2017</date>
8068</refentryinfo>
8069<refmeta>
8070 <refentrytitle><phrase>drm_mode_sort</phrase></refentrytitle>
8071 <manvolnum>9</manvolnum>
8072 <refmiscinfo class="version">4.4.14</refmiscinfo>
8073</refmeta>
8074<refnamediv>
8075 <refname>drm_mode_sort</refname>
8076 <refpurpose>
8077     sort mode list
8078 </refpurpose>
8079</refnamediv>
8080<refsynopsisdiv>
8081 <title>Synopsis</title>
8082  <funcsynopsis><funcprototype>
8083   <funcdef>void <function>drm_mode_sort </function></funcdef>
8084   <paramdef>struct list_head * <parameter>mode_list</parameter></paramdef>
8085  </funcprototype></funcsynopsis>
8086</refsynopsisdiv>
8087<refsect1>
8088 <title>Arguments</title>
8089 <variablelist>
8090  <varlistentry>
8091   <term><parameter>mode_list</parameter></term>
8092   <listitem>
8093    <para>
8094     list of drm_display_mode structures to sort
8095    </para>
8096   </listitem>
8097  </varlistentry>
8098 </variablelist>
8099</refsect1>
8100<refsect1>
8101<title>Description</title>
8102<para>
8103   Sort <parameter>mode_list</parameter> by favorability, moving good modes to the head of the list.
8104</para>
8105</refsect1>
8106</refentry>
8107
8108<refentry id="API-drm-mode-connector-list-update">
8109<refentryinfo>
8110 <title>LINUX</title>
8111 <productname>Kernel Hackers Manual</productname>
8112 <date>July 2017</date>
8113</refentryinfo>
8114<refmeta>
8115 <refentrytitle><phrase>drm_mode_connector_list_update</phrase></refentrytitle>
8116 <manvolnum>9</manvolnum>
8117 <refmiscinfo class="version">4.4.14</refmiscinfo>
8118</refmeta>
8119<refnamediv>
8120 <refname>drm_mode_connector_list_update</refname>
8121 <refpurpose>
8122     update the mode list for the connector
8123 </refpurpose>
8124</refnamediv>
8125<refsynopsisdiv>
8126 <title>Synopsis</title>
8127  <funcsynopsis><funcprototype>
8128   <funcdef>void <function>drm_mode_connector_list_update </function></funcdef>
8129   <paramdef>struct drm_connector * <parameter>connector</parameter></paramdef>
8130   <paramdef>bool <parameter>merge_type_bits</parameter></paramdef>
8131  </funcprototype></funcsynopsis>
8132</refsynopsisdiv>
8133<refsect1>
8134 <title>Arguments</title>
8135 <variablelist>
8136  <varlistentry>
8137   <term><parameter>connector</parameter></term>
8138   <listitem>
8139    <para>
8140     the connector to update
8141    </para>
8142   </listitem>
8143  </varlistentry>
8144  <varlistentry>
8145   <term><parameter>merge_type_bits</parameter></term>
8146   <listitem>
8147    <para>
8148     whether to merge or overwrite type bits
8149    </para>
8150   </listitem>
8151  </varlistentry>
8152 </variablelist>
8153</refsect1>
8154<refsect1>
8155<title>Description</title>
8156<para>
8157   This moves the modes from the <parameter>connector</parameter> probed_modes list
8158   to the actual mode list. It compares the probed mode against the current
8159   list and only adds different/new modes.
8160   </para><para>
8161
8162   This is just a helper functions doesn't validate any modes itself and also
8163   doesn't prune any invalid modes. Callers need to do that themselves.
8164</para>
8165</refsect1>
8166</refentry>
8167
8168<refentry id="API-drm-mode-parse-command-line-for-connector">
8169<refentryinfo>
8170 <title>LINUX</title>
8171 <productname>Kernel Hackers Manual</productname>
8172 <date>July 2017</date>
8173</refentryinfo>
8174<refmeta>
8175 <refentrytitle><phrase>drm_mode_parse_command_line_for_connector</phrase></refentrytitle>
8176 <manvolnum>9</manvolnum>
8177 <refmiscinfo class="version">4.4.14</refmiscinfo>
8178</refmeta>
8179<refnamediv>
8180 <refname>drm_mode_parse_command_line_for_connector</refname>
8181 <refpurpose>
8182     parse command line modeline for connector
8183 </refpurpose>
8184</refnamediv>
8185<refsynopsisdiv>
8186 <title>Synopsis</title>
8187  <funcsynopsis><funcprototype>
8188   <funcdef>bool <function>drm_mode_parse_command_line_for_connector </function></funcdef>
8189   <paramdef>const char * <parameter>mode_option</parameter></paramdef>
8190   <paramdef>struct drm_connector * <parameter>connector</parameter></paramdef>
8191   <paramdef>struct drm_cmdline_mode * <parameter>mode</parameter></paramdef>
8192  </funcprototype></funcsynopsis>
8193</refsynopsisdiv>
8194<refsect1>
8195 <title>Arguments</title>
8196 <variablelist>
8197  <varlistentry>
8198   <term><parameter>mode_option</parameter></term>
8199   <listitem>
8200    <para>
8201     optional per connector mode option
8202    </para>
8203   </listitem>
8204  </varlistentry>
8205  <varlistentry>
8206   <term><parameter>connector</parameter></term>
8207   <listitem>
8208    <para>
8209     connector to parse modeline for
8210    </para>
8211   </listitem>
8212  </varlistentry>
8213  <varlistentry>
8214   <term><parameter>mode</parameter></term>
8215   <listitem>
8216    <para>
8217     preallocated drm_cmdline_mode structure to fill out
8218    </para>
8219   </listitem>
8220  </varlistentry>
8221 </variablelist>
8222</refsect1>
8223<refsect1>
8224<title>Description</title>
8225<para>
8226   This parses <parameter>mode_option</parameter> command line modeline for modes and options to
8227   configure the connector. If <parameter>mode_option</parameter> is NULL the default command line
8228   modeline in fb_mode_option will be parsed instead.
8229   </para><para>
8230
8231   This uses the same parameters as the fb modedb.c, except for an extra
8232   force-enable, force-enable-digital and force-disable bit at the end:
8233   </para><para>
8234
8235   &lt;xres&gt;x&lt;yres&gt;[M][R][-&lt;bpp&gt;][@&lt;refresh&gt;][i][m][eDd]
8236   </para><para>
8237
8238   The intermediate drm_cmdline_mode structure is required to store additional
8239   options from the command line modline like the force-enable/disable flag.
8240</para>
8241</refsect1>
8242<refsect1>
8243<title>Returns</title>
8244<para>
8245   True if a valid modeline has been parsed, false otherwise.
8246</para>
8247</refsect1>
8248</refentry>
8249
8250<refentry id="API-drm-mode-create-from-cmdline-mode">
8251<refentryinfo>
8252 <title>LINUX</title>
8253 <productname>Kernel Hackers Manual</productname>
8254 <date>July 2017</date>
8255</refentryinfo>
8256<refmeta>
8257 <refentrytitle><phrase>drm_mode_create_from_cmdline_mode</phrase></refentrytitle>
8258 <manvolnum>9</manvolnum>
8259 <refmiscinfo class="version">4.4.14</refmiscinfo>
8260</refmeta>
8261<refnamediv>
8262 <refname>drm_mode_create_from_cmdline_mode</refname>
8263 <refpurpose>
8264     convert a command line modeline into a DRM display mode
8265 </refpurpose>
8266</refnamediv>
8267<refsynopsisdiv>
8268 <title>Synopsis</title>
8269  <funcsynopsis><funcprototype>
8270   <funcdef>struct drm_display_mode * <function>drm_mode_create_from_cmdline_mode </function></funcdef>
8271   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
8272   <paramdef>struct drm_cmdline_mode * <parameter>cmd</parameter></paramdef>
8273  </funcprototype></funcsynopsis>
8274</refsynopsisdiv>
8275<refsect1>
8276 <title>Arguments</title>
8277 <variablelist>
8278  <varlistentry>
8279   <term><parameter>dev</parameter></term>
8280   <listitem>
8281    <para>
8282     DRM device to create the new mode for
8283    </para>
8284   </listitem>
8285  </varlistentry>
8286  <varlistentry>
8287   <term><parameter>cmd</parameter></term>
8288   <listitem>
8289    <para>
8290     input command line modeline
8291    </para>
8292   </listitem>
8293  </varlistentry>
8294 </variablelist>
8295</refsect1>
8296<refsect1>
8297<title>Returns</title>
8298<para>
8299   Pointer to converted mode on success, NULL on error.
8300</para>
8301</refsect1>
8302</refentry>
8303
8304    </sect2>
8305    <sect2>
8306      <title>Atomic Mode Setting Function Reference</title>
8307<!-- drivers/gpu/drm/drm_atomic.c -->
8308<refentry id="API-drm-atomic-state-default-release">
8309<refentryinfo>
8310 <title>LINUX</title>
8311 <productname>Kernel Hackers Manual</productname>
8312 <date>July 2017</date>
8313</refentryinfo>
8314<refmeta>
8315 <refentrytitle><phrase>drm_atomic_state_default_release</phrase></refentrytitle>
8316 <manvolnum>9</manvolnum>
8317 <refmiscinfo class="version">4.4.14</refmiscinfo>
8318</refmeta>
8319<refnamediv>
8320 <refname>drm_atomic_state_default_release</refname>
8321 <refpurpose>
8322  release memory initialized by drm_atomic_state_init
8323 </refpurpose>
8324</refnamediv>
8325<refsynopsisdiv>
8326 <title>Synopsis</title>
8327  <funcsynopsis><funcprototype>
8328   <funcdef>void <function>drm_atomic_state_default_release </function></funcdef>
8329   <paramdef>struct drm_atomic_state * <parameter>state</parameter></paramdef>
8330  </funcprototype></funcsynopsis>
8331</refsynopsisdiv>
8332<refsect1>
8333 <title>Arguments</title>
8334 <variablelist>
8335  <varlistentry>
8336   <term><parameter>state</parameter></term>
8337   <listitem>
8338    <para>
8339     atomic state
8340    </para>
8341   </listitem>
8342  </varlistentry>
8343 </variablelist>
8344</refsect1>
8345<refsect1>
8346<title>Description</title>
8347<para>
8348   Free all the memory allocated by drm_atomic_state_init.
8349   This is useful for drivers that subclass the atomic state.
8350</para>
8351</refsect1>
8352</refentry>
8353
8354<refentry id="API-drm-atomic-state-init">
8355<refentryinfo>
8356 <title>LINUX</title>
8357 <productname>Kernel Hackers Manual</productname>
8358 <date>July 2017</date>
8359</refentryinfo>
8360<refmeta>
8361 <refentrytitle><phrase>drm_atomic_state_init</phrase></refentrytitle>
8362 <manvolnum>9</manvolnum>
8363 <refmiscinfo class="version">4.4.14</refmiscinfo>
8364</refmeta>
8365<refnamediv>
8366 <refname>drm_atomic_state_init</refname>
8367 <refpurpose>
8368     init new atomic state
8369 </refpurpose>
8370</refnamediv>
8371<refsynopsisdiv>
8372 <title>Synopsis</title>
8373  <funcsynopsis><funcprototype>
8374   <funcdef>int <function>drm_atomic_state_init </function></funcdef>
8375   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
8376   <paramdef>struct drm_atomic_state * <parameter>state</parameter></paramdef>
8377  </funcprototype></funcsynopsis>
8378</refsynopsisdiv>
8379<refsect1>
8380 <title>Arguments</title>
8381 <variablelist>
8382  <varlistentry>
8383   <term><parameter>dev</parameter></term>
8384   <listitem>
8385    <para>
8386     DRM device
8387    </para>
8388   </listitem>
8389  </varlistentry>
8390  <varlistentry>
8391   <term><parameter>state</parameter></term>
8392   <listitem>
8393    <para>
8394     atomic state
8395    </para>
8396   </listitem>
8397  </varlistentry>
8398 </variablelist>
8399</refsect1>
8400<refsect1>
8401<title>Description</title>
8402<para>
8403   Default implementation for filling in a new atomic state.
8404   This is useful for drivers that subclass the atomic state.
8405</para>
8406</refsect1>
8407</refentry>
8408
8409<refentry id="API-drm-atomic-state-alloc">
8410<refentryinfo>
8411 <title>LINUX</title>
8412 <productname>Kernel Hackers Manual</productname>
8413 <date>July 2017</date>
8414</refentryinfo>
8415<refmeta>
8416 <refentrytitle><phrase>drm_atomic_state_alloc</phrase></refentrytitle>
8417 <manvolnum>9</manvolnum>
8418 <refmiscinfo class="version">4.4.14</refmiscinfo>
8419</refmeta>
8420<refnamediv>
8421 <refname>drm_atomic_state_alloc</refname>
8422 <refpurpose>
8423     allocate atomic state
8424 </refpurpose>
8425</refnamediv>
8426<refsynopsisdiv>
8427 <title>Synopsis</title>
8428  <funcsynopsis><funcprototype>
8429   <funcdef>struct drm_atomic_state * <function>drm_atomic_state_alloc </function></funcdef>
8430   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
8431  </funcprototype></funcsynopsis>
8432</refsynopsisdiv>
8433<refsect1>
8434 <title>Arguments</title>
8435 <variablelist>
8436  <varlistentry>
8437   <term><parameter>dev</parameter></term>
8438   <listitem>
8439    <para>
8440     DRM device
8441    </para>
8442   </listitem>
8443  </varlistentry>
8444 </variablelist>
8445</refsect1>
8446<refsect1>
8447<title>Description</title>
8448<para>
8449   This allocates an empty atomic state to track updates.
8450</para>
8451</refsect1>
8452</refentry>
8453
8454<refentry id="API-drm-atomic-state-default-clear">
8455<refentryinfo>
8456 <title>LINUX</title>
8457 <productname>Kernel Hackers Manual</productname>
8458 <date>July 2017</date>
8459</refentryinfo>
8460<refmeta>
8461 <refentrytitle><phrase>drm_atomic_state_default_clear</phrase></refentrytitle>
8462 <manvolnum>9</manvolnum>
8463 <refmiscinfo class="version">4.4.14</refmiscinfo>
8464</refmeta>
8465<refnamediv>
8466 <refname>drm_atomic_state_default_clear</refname>
8467 <refpurpose>
8468     clear base atomic state
8469 </refpurpose>
8470</refnamediv>
8471<refsynopsisdiv>
8472 <title>Synopsis</title>
8473  <funcsynopsis><funcprototype>
8474   <funcdef>void <function>drm_atomic_state_default_clear </function></funcdef>
8475   <paramdef>struct drm_atomic_state * <parameter>state</parameter></paramdef>
8476  </funcprototype></funcsynopsis>
8477</refsynopsisdiv>
8478<refsect1>
8479 <title>Arguments</title>
8480 <variablelist>
8481  <varlistentry>
8482   <term><parameter>state</parameter></term>
8483   <listitem>
8484    <para>
8485     atomic state
8486    </para>
8487   </listitem>
8488  </varlistentry>
8489 </variablelist>
8490</refsect1>
8491<refsect1>
8492<title>Description</title>
8493<para>
8494   Default implementation for clearing atomic state.
8495   This is useful for drivers that subclass the atomic state.
8496</para>
8497</refsect1>
8498</refentry>
8499
8500<refentry id="API-drm-atomic-state-clear">
8501<refentryinfo>
8502 <title>LINUX</title>
8503 <productname>Kernel Hackers Manual</productname>
8504 <date>July 2017</date>
8505</refentryinfo>
8506<refmeta>
8507 <refentrytitle><phrase>drm_atomic_state_clear</phrase></refentrytitle>
8508 <manvolnum>9</manvolnum>
8509 <refmiscinfo class="version">4.4.14</refmiscinfo>
8510</refmeta>
8511<refnamediv>
8512 <refname>drm_atomic_state_clear</refname>
8513 <refpurpose>
8514     clear state object
8515 </refpurpose>
8516</refnamediv>
8517<refsynopsisdiv>
8518 <title>Synopsis</title>
8519  <funcsynopsis><funcprototype>
8520   <funcdef>void <function>drm_atomic_state_clear </function></funcdef>
8521   <paramdef>struct drm_atomic_state * <parameter>state</parameter></paramdef>
8522  </funcprototype></funcsynopsis>
8523</refsynopsisdiv>
8524<refsect1>
8525 <title>Arguments</title>
8526 <variablelist>
8527  <varlistentry>
8528   <term><parameter>state</parameter></term>
8529   <listitem>
8530    <para>
8531     atomic state
8532    </para>
8533   </listitem>
8534  </varlistentry>
8535 </variablelist>
8536</refsect1>
8537<refsect1>
8538<title>Description</title>
8539<para>
8540   When the w/w mutex algorithm detects a deadlock we need to back off and drop
8541   all locks. So someone else could sneak in and change the current modeset
8542   configuration. Which means that all the state assembled in <parameter>state</parameter> is no
8543   longer an atomic update to the current state, but to some arbitrary earlier
8544   state. Which could break assumptions the driver's -&gt;atomic_check likely
8545   relies on.
8546   </para><para>
8547
8548   Hence we must clear all cached state and completely start over, using this
8549   function.
8550</para>
8551</refsect1>
8552</refentry>
8553
8554<refentry id="API-drm-atomic-state-free">
8555<refentryinfo>
8556 <title>LINUX</title>
8557 <productname>Kernel Hackers Manual</productname>
8558 <date>July 2017</date>
8559</refentryinfo>
8560<refmeta>
8561 <refentrytitle><phrase>drm_atomic_state_free</phrase></refentrytitle>
8562 <manvolnum>9</manvolnum>
8563 <refmiscinfo class="version">4.4.14</refmiscinfo>
8564</refmeta>
8565<refnamediv>
8566 <refname>drm_atomic_state_free</refname>
8567 <refpurpose>
8568     free all memory for an atomic state
8569 </refpurpose>
8570</refnamediv>
8571<refsynopsisdiv>
8572 <title>Synopsis</title>
8573  <funcsynopsis><funcprototype>
8574   <funcdef>void <function>drm_atomic_state_free </function></funcdef>
8575   <paramdef>struct drm_atomic_state * <parameter>state</parameter></paramdef>
8576  </funcprototype></funcsynopsis>
8577</refsynopsisdiv>
8578<refsect1>
8579 <title>Arguments</title>
8580 <variablelist>
8581  <varlistentry>
8582   <term><parameter>state</parameter></term>
8583   <listitem>
8584    <para>
8585     atomic state to deallocate
8586    </para>
8587   </listitem>
8588  </varlistentry>
8589 </variablelist>
8590</refsect1>
8591<refsect1>
8592<title>Description</title>
8593<para>
8594   This frees all memory associated with an atomic state, including all the
8595   per-object state for planes, crtcs and connectors.
8596</para>
8597</refsect1>
8598</refentry>
8599
8600<refentry id="API-drm-atomic-get-crtc-state">
8601<refentryinfo>
8602 <title>LINUX</title>
8603 <productname>Kernel Hackers Manual</productname>
8604 <date>July 2017</date>
8605</refentryinfo>
8606<refmeta>
8607 <refentrytitle><phrase>drm_atomic_get_crtc_state</phrase></refentrytitle>
8608 <manvolnum>9</manvolnum>
8609 <refmiscinfo class="version">4.4.14</refmiscinfo>
8610</refmeta>
8611<refnamediv>
8612 <refname>drm_atomic_get_crtc_state</refname>
8613 <refpurpose>
8614     get crtc state
8615 </refpurpose>
8616</refnamediv>
8617<refsynopsisdiv>
8618 <title>Synopsis</title>
8619  <funcsynopsis><funcprototype>
8620   <funcdef>struct drm_crtc_state * <function>drm_atomic_get_crtc_state </function></funcdef>
8621   <paramdef>struct drm_atomic_state * <parameter>state</parameter></paramdef>
8622   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
8623  </funcprototype></funcsynopsis>
8624</refsynopsisdiv>
8625<refsect1>
8626 <title>Arguments</title>
8627 <variablelist>
8628  <varlistentry>
8629   <term><parameter>state</parameter></term>
8630   <listitem>
8631    <para>
8632     global atomic state object
8633    </para>
8634   </listitem>
8635  </varlistentry>
8636  <varlistentry>
8637   <term><parameter>crtc</parameter></term>
8638   <listitem>
8639    <para>
8640     crtc to get state object for
8641    </para>
8642   </listitem>
8643  </varlistentry>
8644 </variablelist>
8645</refsect1>
8646<refsect1>
8647<title>Description</title>
8648<para>
8649   This function returns the crtc state for the given crtc, allocating it if
8650   needed. It will also grab the relevant crtc lock to make sure that the state
8651   is consistent.
8652</para>
8653</refsect1>
8654<refsect1>
8655<title>Returns</title>
8656<para>
8657   </para><para>
8658
8659   Either the allocated state or the error code encoded into the pointer. When
8660   the error is EDEADLK then the w/w mutex code has detected a deadlock and the
8661   entire atomic sequence must be restarted. All other errors are fatal.
8662</para>
8663</refsect1>
8664</refentry>
8665
8666<refentry id="API-drm-atomic-set-mode-for-crtc">
8667<refentryinfo>
8668 <title>LINUX</title>
8669 <productname>Kernel Hackers Manual</productname>
8670 <date>July 2017</date>
8671</refentryinfo>
8672<refmeta>
8673 <refentrytitle><phrase>drm_atomic_set_mode_for_crtc</phrase></refentrytitle>
8674 <manvolnum>9</manvolnum>
8675 <refmiscinfo class="version">4.4.14</refmiscinfo>
8676</refmeta>
8677<refnamediv>
8678 <refname>drm_atomic_set_mode_for_crtc</refname>
8679 <refpurpose>
8680     set mode for CRTC
8681 </refpurpose>
8682</refnamediv>
8683<refsynopsisdiv>
8684 <title>Synopsis</title>
8685  <funcsynopsis><funcprototype>
8686   <funcdef>int <function>drm_atomic_set_mode_for_crtc </function></funcdef>
8687   <paramdef>struct drm_crtc_state * <parameter>state</parameter></paramdef>
8688   <paramdef>struct drm_display_mode * <parameter>mode</parameter></paramdef>
8689  </funcprototype></funcsynopsis>
8690</refsynopsisdiv>
8691<refsect1>
8692 <title>Arguments</title>
8693 <variablelist>
8694  <varlistentry>
8695   <term><parameter>state</parameter></term>
8696   <listitem>
8697    <para>
8698     the CRTC whose incoming state to update
8699    </para>
8700   </listitem>
8701  </varlistentry>
8702  <varlistentry>
8703   <term><parameter>mode</parameter></term>
8704   <listitem>
8705    <para>
8706     kernel-internal mode to use for the CRTC, or NULL to disable
8707    </para>
8708   </listitem>
8709  </varlistentry>
8710 </variablelist>
8711</refsect1>
8712<refsect1>
8713<title>Description</title>
8714<para>
8715   Set a mode (originating from the kernel) on the desired CRTC state. Does
8716   not change any other state properties, including enable, active, or
8717   mode_changed.
8718</para>
8719</refsect1>
8720<refsect1>
8721<title>RETURNS</title>
8722<para>
8723   Zero on success, error code on failure. Cannot return -EDEADLK.
8724</para>
8725</refsect1>
8726</refentry>
8727
8728<refentry id="API-drm-atomic-set-mode-prop-for-crtc">
8729<refentryinfo>
8730 <title>LINUX</title>
8731 <productname>Kernel Hackers Manual</productname>
8732 <date>July 2017</date>
8733</refentryinfo>
8734<refmeta>
8735 <refentrytitle><phrase>drm_atomic_set_mode_prop_for_crtc</phrase></refentrytitle>
8736 <manvolnum>9</manvolnum>
8737 <refmiscinfo class="version">4.4.14</refmiscinfo>
8738</refmeta>
8739<refnamediv>
8740 <refname>drm_atomic_set_mode_prop_for_crtc</refname>
8741 <refpurpose>
8742     set mode for CRTC
8743 </refpurpose>
8744</refnamediv>
8745<refsynopsisdiv>
8746 <title>Synopsis</title>
8747  <funcsynopsis><funcprototype>
8748   <funcdef>int <function>drm_atomic_set_mode_prop_for_crtc </function></funcdef>
8749   <paramdef>struct drm_crtc_state * <parameter>state</parameter></paramdef>
8750   <paramdef>struct drm_property_blob * <parameter>blob</parameter></paramdef>
8751  </funcprototype></funcsynopsis>
8752</refsynopsisdiv>
8753<refsect1>
8754 <title>Arguments</title>
8755 <variablelist>
8756  <varlistentry>
8757   <term><parameter>state</parameter></term>
8758   <listitem>
8759    <para>
8760     the CRTC whose incoming state to update
8761    </para>
8762   </listitem>
8763  </varlistentry>
8764  <varlistentry>
8765   <term><parameter>blob</parameter></term>
8766   <listitem>
8767    <para>
8768     pointer to blob property to use for mode
8769    </para>
8770   </listitem>
8771  </varlistentry>
8772 </variablelist>
8773</refsect1>
8774<refsect1>
8775<title>Description</title>
8776<para>
8777   Set a mode (originating from a blob property) on the desired CRTC state.
8778   This function will take a reference on the blob property for the CRTC state,
8779   and release the reference held on the state's existing mode property, if any
8780   was set.
8781</para>
8782</refsect1>
8783<refsect1>
8784<title>RETURNS</title>
8785<para>
8786   Zero on success, error code on failure. Cannot return -EDEADLK.
8787</para>
8788</refsect1>
8789</refentry>
8790
8791<refentry id="API-drm-atomic-crtc-set-property">
8792<refentryinfo>
8793 <title>LINUX</title>
8794 <productname>Kernel Hackers Manual</productname>
8795 <date>July 2017</date>
8796</refentryinfo>
8797<refmeta>
8798 <refentrytitle><phrase>drm_atomic_crtc_set_property</phrase></refentrytitle>
8799 <manvolnum>9</manvolnum>
8800 <refmiscinfo class="version">4.4.14</refmiscinfo>
8801</refmeta>
8802<refnamediv>
8803 <refname>drm_atomic_crtc_set_property</refname>
8804 <refpurpose>
8805     set property on CRTC
8806 </refpurpose>
8807</refnamediv>
8808<refsynopsisdiv>
8809 <title>Synopsis</title>
8810  <funcsynopsis><funcprototype>
8811   <funcdef>int <function>drm_atomic_crtc_set_property </function></funcdef>
8812   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
8813   <paramdef>struct drm_crtc_state * <parameter>state</parameter></paramdef>
8814   <paramdef>struct drm_property * <parameter>property</parameter></paramdef>
8815   <paramdef>uint64_t <parameter>val</parameter></paramdef>
8816  </funcprototype></funcsynopsis>
8817</refsynopsisdiv>
8818<refsect1>
8819 <title>Arguments</title>
8820 <variablelist>
8821  <varlistentry>
8822   <term><parameter>crtc</parameter></term>
8823   <listitem>
8824    <para>
8825     the drm CRTC to set a property on
8826    </para>
8827   </listitem>
8828  </varlistentry>
8829  <varlistentry>
8830   <term><parameter>state</parameter></term>
8831   <listitem>
8832    <para>
8833     the state object to update with the new property value
8834    </para>
8835   </listitem>
8836  </varlistentry>
8837  <varlistentry>
8838   <term><parameter>property</parameter></term>
8839   <listitem>
8840    <para>
8841     the property to set
8842    </para>
8843   </listitem>
8844  </varlistentry>
8845  <varlistentry>
8846   <term><parameter>val</parameter></term>
8847   <listitem>
8848    <para>
8849     the new property value
8850    </para>
8851   </listitem>
8852  </varlistentry>
8853 </variablelist>
8854</refsect1>
8855<refsect1>
8856<title>Description</title>
8857<para>
8858   Use this instead of calling crtc-&gt;atomic_set_property directly.
8859   This function handles generic/core properties and calls out to
8860   driver's -&gt;<function>atomic_set_property</function> for driver properties.  To ensure
8861   consistent behavior you must call this function rather than the
8862   driver hook directly.
8863</para>
8864</refsect1>
8865<refsect1>
8866<title>RETURNS</title>
8867<para>
8868   Zero on success, error code on failure
8869</para>
8870</refsect1>
8871</refentry>
8872
8873<refentry id="API-drm-atomic-get-plane-state">
8874<refentryinfo>
8875 <title>LINUX</title>
8876 <productname>Kernel Hackers Manual</productname>
8877 <date>July 2017</date>
8878</refentryinfo>
8879<refmeta>
8880 <refentrytitle><phrase>drm_atomic_get_plane_state</phrase></refentrytitle>
8881 <manvolnum>9</manvolnum>
8882 <refmiscinfo class="version">4.4.14</refmiscinfo>
8883</refmeta>
8884<refnamediv>
8885 <refname>drm_atomic_get_plane_state</refname>
8886 <refpurpose>
8887     get plane state
8888 </refpurpose>
8889</refnamediv>
8890<refsynopsisdiv>
8891 <title>Synopsis</title>
8892  <funcsynopsis><funcprototype>
8893   <funcdef>struct drm_plane_state * <function>drm_atomic_get_plane_state </function></funcdef>
8894   <paramdef>struct drm_atomic_state * <parameter>state</parameter></paramdef>
8895   <paramdef>struct drm_plane * <parameter>plane</parameter></paramdef>
8896  </funcprototype></funcsynopsis>
8897</refsynopsisdiv>
8898<refsect1>
8899 <title>Arguments</title>
8900 <variablelist>
8901  <varlistentry>
8902   <term><parameter>state</parameter></term>
8903   <listitem>
8904    <para>
8905     global atomic state object
8906    </para>
8907   </listitem>
8908  </varlistentry>
8909  <varlistentry>
8910   <term><parameter>plane</parameter></term>
8911   <listitem>
8912    <para>
8913     plane to get state object for
8914    </para>
8915   </listitem>
8916  </varlistentry>
8917 </variablelist>
8918</refsect1>
8919<refsect1>
8920<title>Description</title>
8921<para>
8922   This function returns the plane state for the given plane, allocating it if
8923   needed. It will also grab the relevant plane lock to make sure that the state
8924   is consistent.
8925</para>
8926</refsect1>
8927<refsect1>
8928<title>Returns</title>
8929<para>
8930   </para><para>
8931
8932   Either the allocated state or the error code encoded into the pointer. When
8933   the error is EDEADLK then the w/w mutex code has detected a deadlock and the
8934   entire atomic sequence must be restarted. All other errors are fatal.
8935</para>
8936</refsect1>
8937</refentry>
8938
8939<refentry id="API-drm-atomic-plane-set-property">
8940<refentryinfo>
8941 <title>LINUX</title>
8942 <productname>Kernel Hackers Manual</productname>
8943 <date>July 2017</date>
8944</refentryinfo>
8945<refmeta>
8946 <refentrytitle><phrase>drm_atomic_plane_set_property</phrase></refentrytitle>
8947 <manvolnum>9</manvolnum>
8948 <refmiscinfo class="version">4.4.14</refmiscinfo>
8949</refmeta>
8950<refnamediv>
8951 <refname>drm_atomic_plane_set_property</refname>
8952 <refpurpose>
8953     set property on plane
8954 </refpurpose>
8955</refnamediv>
8956<refsynopsisdiv>
8957 <title>Synopsis</title>
8958  <funcsynopsis><funcprototype>
8959   <funcdef>int <function>drm_atomic_plane_set_property </function></funcdef>
8960   <paramdef>struct drm_plane * <parameter>plane</parameter></paramdef>
8961   <paramdef>struct drm_plane_state * <parameter>state</parameter></paramdef>
8962   <paramdef>struct drm_property * <parameter>property</parameter></paramdef>
8963   <paramdef>uint64_t <parameter>val</parameter></paramdef>
8964  </funcprototype></funcsynopsis>
8965</refsynopsisdiv>
8966<refsect1>
8967 <title>Arguments</title>
8968 <variablelist>
8969  <varlistentry>
8970   <term><parameter>plane</parameter></term>
8971   <listitem>
8972    <para>
8973     the drm plane to set a property on
8974    </para>
8975   </listitem>
8976  </varlistentry>
8977  <varlistentry>
8978   <term><parameter>state</parameter></term>
8979   <listitem>
8980    <para>
8981     the state object to update with the new property value
8982    </para>
8983   </listitem>
8984  </varlistentry>
8985  <varlistentry>
8986   <term><parameter>property</parameter></term>
8987   <listitem>
8988    <para>
8989     the property to set
8990    </para>
8991   </listitem>
8992  </varlistentry>
8993  <varlistentry>
8994   <term><parameter>val</parameter></term>
8995   <listitem>
8996    <para>
8997     the new property value
8998    </para>
8999   </listitem>
9000  </varlistentry>
9001 </variablelist>
9002</refsect1>
9003<refsect1>
9004<title>Description</title>
9005<para>
9006   Use this instead of calling plane-&gt;atomic_set_property directly.
9007   This function handles generic/core properties and calls out to
9008   driver's -&gt;<function>atomic_set_property</function> for driver properties.  To ensure
9009   consistent behavior you must call this function rather than the
9010   driver hook directly.
9011</para>
9012</refsect1>
9013<refsect1>
9014<title>RETURNS</title>
9015<para>
9016   Zero on success, error code on failure
9017</para>
9018</refsect1>
9019</refentry>
9020
9021<refentry id="API-drm-atomic-get-connector-state">
9022<refentryinfo>
9023 <title>LINUX</title>
9024 <productname>Kernel Hackers Manual</productname>
9025 <date>July 2017</date>
9026</refentryinfo>
9027<refmeta>
9028 <refentrytitle><phrase>drm_atomic_get_connector_state</phrase></refentrytitle>
9029 <manvolnum>9</manvolnum>
9030 <refmiscinfo class="version">4.4.14</refmiscinfo>
9031</refmeta>
9032<refnamediv>
9033 <refname>drm_atomic_get_connector_state</refname>
9034 <refpurpose>
9035     get connector state
9036 </refpurpose>
9037</refnamediv>
9038<refsynopsisdiv>
9039 <title>Synopsis</title>
9040  <funcsynopsis><funcprototype>
9041   <funcdef>struct drm_connector_state * <function>drm_atomic_get_connector_state </function></funcdef>
9042   <paramdef>struct drm_atomic_state * <parameter>state</parameter></paramdef>
9043   <paramdef>struct drm_connector * <parameter>connector</parameter></paramdef>
9044  </funcprototype></funcsynopsis>
9045</refsynopsisdiv>
9046<refsect1>
9047 <title>Arguments</title>
9048 <variablelist>
9049  <varlistentry>
9050   <term><parameter>state</parameter></term>
9051   <listitem>
9052    <para>
9053     global atomic state object
9054    </para>
9055   </listitem>
9056  </varlistentry>
9057  <varlistentry>
9058   <term><parameter>connector</parameter></term>
9059   <listitem>
9060    <para>
9061     connector to get state object for
9062    </para>
9063   </listitem>
9064  </varlistentry>
9065 </variablelist>
9066</refsect1>
9067<refsect1>
9068<title>Description</title>
9069<para>
9070   This function returns the connector state for the given connector,
9071   allocating it if needed. It will also grab the relevant connector lock to
9072   make sure that the state is consistent.
9073</para>
9074</refsect1>
9075<refsect1>
9076<title>Returns</title>
9077<para>
9078   </para><para>
9079
9080   Either the allocated state or the error code encoded into the pointer. When
9081   the error is EDEADLK then the w/w mutex code has detected a deadlock and the
9082   entire atomic sequence must be restarted. All other errors are fatal.
9083</para>
9084</refsect1>
9085</refentry>
9086
9087<refentry id="API-drm-atomic-connector-set-property">
9088<refentryinfo>
9089 <title>LINUX</title>
9090 <productname>Kernel Hackers Manual</productname>
9091 <date>July 2017</date>
9092</refentryinfo>
9093<refmeta>
9094 <refentrytitle><phrase>drm_atomic_connector_set_property</phrase></refentrytitle>
9095 <manvolnum>9</manvolnum>
9096 <refmiscinfo class="version">4.4.14</refmiscinfo>
9097</refmeta>
9098<refnamediv>
9099 <refname>drm_atomic_connector_set_property</refname>
9100 <refpurpose>
9101     set property on connector.
9102 </refpurpose>
9103</refnamediv>
9104<refsynopsisdiv>
9105 <title>Synopsis</title>
9106  <funcsynopsis><funcprototype>
9107   <funcdef>int <function>drm_atomic_connector_set_property </function></funcdef>
9108   <paramdef>struct drm_connector * <parameter>connector</parameter></paramdef>
9109   <paramdef>struct drm_connector_state * <parameter>state</parameter></paramdef>
9110   <paramdef>struct drm_property * <parameter>property</parameter></paramdef>
9111   <paramdef>uint64_t <parameter>val</parameter></paramdef>
9112  </funcprototype></funcsynopsis>
9113</refsynopsisdiv>
9114<refsect1>
9115 <title>Arguments</title>
9116 <variablelist>
9117  <varlistentry>
9118   <term><parameter>connector</parameter></term>
9119   <listitem>
9120    <para>
9121     the drm connector to set a property on
9122    </para>
9123   </listitem>
9124  </varlistentry>
9125  <varlistentry>
9126   <term><parameter>state</parameter></term>
9127   <listitem>
9128    <para>
9129     the state object to update with the new property value
9130    </para>
9131   </listitem>
9132  </varlistentry>
9133  <varlistentry>
9134   <term><parameter>property</parameter></term>
9135   <listitem>
9136    <para>
9137     the property to set
9138    </para>
9139   </listitem>
9140  </varlistentry>
9141  <varlistentry>
9142   <term><parameter>val</parameter></term>
9143   <listitem>
9144    <para>
9145     the new property value
9146    </para>
9147   </listitem>
9148  </varlistentry>
9149 </variablelist>
9150</refsect1>
9151<refsect1>
9152<title>Description</title>
9153<para>
9154   Use this instead of calling connector-&gt;atomic_set_property directly.
9155   This function handles generic/core properties and calls out to
9156   driver's -&gt;<function>atomic_set_property</function> for driver properties.  To ensure
9157   consistent behavior you must call this function rather than the
9158   driver hook directly.
9159</para>
9160</refsect1>
9161<refsect1>
9162<title>RETURNS</title>
9163<para>
9164   Zero on success, error code on failure
9165</para>
9166</refsect1>
9167</refentry>
9168
9169<refentry id="API-drm-atomic-set-crtc-for-plane">
9170<refentryinfo>
9171 <title>LINUX</title>
9172 <productname>Kernel Hackers Manual</productname>
9173 <date>July 2017</date>
9174</refentryinfo>
9175<refmeta>
9176 <refentrytitle><phrase>drm_atomic_set_crtc_for_plane</phrase></refentrytitle>
9177 <manvolnum>9</manvolnum>
9178 <refmiscinfo class="version">4.4.14</refmiscinfo>
9179</refmeta>
9180<refnamediv>
9181 <refname>drm_atomic_set_crtc_for_plane</refname>
9182 <refpurpose>
9183     set crtc for plane
9184 </refpurpose>
9185</refnamediv>
9186<refsynopsisdiv>
9187 <title>Synopsis</title>
9188  <funcsynopsis><funcprototype>
9189   <funcdef>int <function>drm_atomic_set_crtc_for_plane </function></funcdef>
9190   <paramdef>struct drm_plane_state * <parameter>plane_state</parameter></paramdef>
9191   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
9192  </funcprototype></funcsynopsis>
9193</refsynopsisdiv>
9194<refsect1>
9195 <title>Arguments</title>
9196 <variablelist>
9197  <varlistentry>
9198   <term><parameter>plane_state</parameter></term>
9199   <listitem>
9200    <para>
9201     the plane whose incoming state to update
9202    </para>
9203   </listitem>
9204  </varlistentry>
9205  <varlistentry>
9206   <term><parameter>crtc</parameter></term>
9207   <listitem>
9208    <para>
9209     crtc to use for the plane
9210    </para>
9211   </listitem>
9212  </varlistentry>
9213 </variablelist>
9214</refsect1>
9215<refsect1>
9216<title>Description</title>
9217<para>
9218   Changing the assigned crtc for a plane requires us to grab the lock and state
9219   for the new crtc, as needed. This function takes care of all these details
9220   besides updating the pointer in the state object itself.
9221</para>
9222</refsect1>
9223<refsect1>
9224<title>Returns</title>
9225<para>
9226   0 on success or can fail with -EDEADLK or -ENOMEM. When the error is EDEADLK
9227   then the w/w mutex code has detected a deadlock and the entire atomic
9228   sequence must be restarted. All other errors are fatal.
9229</para>
9230</refsect1>
9231</refentry>
9232
9233<refentry id="API-drm-atomic-set-fb-for-plane">
9234<refentryinfo>
9235 <title>LINUX</title>
9236 <productname>Kernel Hackers Manual</productname>
9237 <date>July 2017</date>
9238</refentryinfo>
9239<refmeta>
9240 <refentrytitle><phrase>drm_atomic_set_fb_for_plane</phrase></refentrytitle>
9241 <manvolnum>9</manvolnum>
9242 <refmiscinfo class="version">4.4.14</refmiscinfo>
9243</refmeta>
9244<refnamediv>
9245 <refname>drm_atomic_set_fb_for_plane</refname>
9246 <refpurpose>
9247     set framebuffer for plane
9248 </refpurpose>
9249</refnamediv>
9250<refsynopsisdiv>
9251 <title>Synopsis</title>
9252  <funcsynopsis><funcprototype>
9253   <funcdef>void <function>drm_atomic_set_fb_for_plane </function></funcdef>
9254   <paramdef>struct drm_plane_state * <parameter>plane_state</parameter></paramdef>
9255   <paramdef>struct drm_framebuffer * <parameter>fb</parameter></paramdef>
9256  </funcprototype></funcsynopsis>
9257</refsynopsisdiv>
9258<refsect1>
9259 <title>Arguments</title>
9260 <variablelist>
9261  <varlistentry>
9262   <term><parameter>plane_state</parameter></term>
9263   <listitem>
9264    <para>
9265     atomic state object for the plane
9266    </para>
9267   </listitem>
9268  </varlistentry>
9269  <varlistentry>
9270   <term><parameter>fb</parameter></term>
9271   <listitem>
9272    <para>
9273     fb to use for the plane
9274    </para>
9275   </listitem>
9276  </varlistentry>
9277 </variablelist>
9278</refsect1>
9279<refsect1>
9280<title>Description</title>
9281<para>
9282   Changing the assigned framebuffer for a plane requires us to grab a reference
9283   to the new fb and drop the reference to the old fb, if there is one. This
9284   function takes care of all these details besides updating the pointer in the
9285   state object itself.
9286</para>
9287</refsect1>
9288</refentry>
9289
9290<refentry id="API-drm-atomic-set-crtc-for-connector">
9291<refentryinfo>
9292 <title>LINUX</title>
9293 <productname>Kernel Hackers Manual</productname>
9294 <date>July 2017</date>
9295</refentryinfo>
9296<refmeta>
9297 <refentrytitle><phrase>drm_atomic_set_crtc_for_connector</phrase></refentrytitle>
9298 <manvolnum>9</manvolnum>
9299 <refmiscinfo class="version">4.4.14</refmiscinfo>
9300</refmeta>
9301<refnamediv>
9302 <refname>drm_atomic_set_crtc_for_connector</refname>
9303 <refpurpose>
9304     set crtc for connector
9305 </refpurpose>
9306</refnamediv>
9307<refsynopsisdiv>
9308 <title>Synopsis</title>
9309  <funcsynopsis><funcprototype>
9310   <funcdef>int <function>drm_atomic_set_crtc_for_connector </function></funcdef>
9311   <paramdef>struct drm_connector_state * <parameter>conn_state</parameter></paramdef>
9312   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
9313  </funcprototype></funcsynopsis>
9314</refsynopsisdiv>
9315<refsect1>
9316 <title>Arguments</title>
9317 <variablelist>
9318  <varlistentry>
9319   <term><parameter>conn_state</parameter></term>
9320   <listitem>
9321    <para>
9322     atomic state object for the connector
9323    </para>
9324   </listitem>
9325  </varlistentry>
9326  <varlistentry>
9327   <term><parameter>crtc</parameter></term>
9328   <listitem>
9329    <para>
9330     crtc to use for the connector
9331    </para>
9332   </listitem>
9333  </varlistentry>
9334 </variablelist>
9335</refsect1>
9336<refsect1>
9337<title>Description</title>
9338<para>
9339   Changing the assigned crtc for a connector requires us to grab the lock and
9340   state for the new crtc, as needed. This function takes care of all these
9341   details besides updating the pointer in the state object itself.
9342</para>
9343</refsect1>
9344<refsect1>
9345<title>Returns</title>
9346<para>
9347   0 on success or can fail with -EDEADLK or -ENOMEM. When the error is EDEADLK
9348   then the w/w mutex code has detected a deadlock and the entire atomic
9349   sequence must be restarted. All other errors are fatal.
9350</para>
9351</refsect1>
9352</refentry>
9353
9354<refentry id="API-drm-atomic-add-affected-connectors">
9355<refentryinfo>
9356 <title>LINUX</title>
9357 <productname>Kernel Hackers Manual</productname>
9358 <date>July 2017</date>
9359</refentryinfo>
9360<refmeta>
9361 <refentrytitle><phrase>drm_atomic_add_affected_connectors</phrase></refentrytitle>
9362 <manvolnum>9</manvolnum>
9363 <refmiscinfo class="version">4.4.14</refmiscinfo>
9364</refmeta>
9365<refnamediv>
9366 <refname>drm_atomic_add_affected_connectors</refname>
9367 <refpurpose>
9368     add connectors for crtc
9369 </refpurpose>
9370</refnamediv>
9371<refsynopsisdiv>
9372 <title>Synopsis</title>
9373  <funcsynopsis><funcprototype>
9374   <funcdef>int <function>drm_atomic_add_affected_connectors </function></funcdef>
9375   <paramdef>struct drm_atomic_state * <parameter>state</parameter></paramdef>
9376   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
9377  </funcprototype></funcsynopsis>
9378</refsynopsisdiv>
9379<refsect1>
9380 <title>Arguments</title>
9381 <variablelist>
9382  <varlistentry>
9383   <term><parameter>state</parameter></term>
9384   <listitem>
9385    <para>
9386     atomic state
9387    </para>
9388   </listitem>
9389  </varlistentry>
9390  <varlistentry>
9391   <term><parameter>crtc</parameter></term>
9392   <listitem>
9393    <para>
9394     DRM crtc
9395    </para>
9396   </listitem>
9397  </varlistentry>
9398 </variablelist>
9399</refsect1>
9400<refsect1>
9401<title>Description</title>
9402<para>
9403   This function walks the current configuration and adds all connectors
9404   currently using <parameter>crtc</parameter> to the atomic configuration <parameter>state</parameter>. Note that this
9405   function must acquire the connection mutex. This can potentially cause
9406   unneeded seralization if the update is just for the planes on one crtc. Hence
9407   drivers and helpers should only call this when really needed (e.g. when a
9408   full modeset needs to happen due to some change).
9409</para>
9410</refsect1>
9411<refsect1>
9412<title>Returns</title>
9413<para>
9414   0 on success or can fail with -EDEADLK or -ENOMEM. When the error is EDEADLK
9415   then the w/w mutex code has detected a deadlock and the entire atomic
9416   sequence must be restarted. All other errors are fatal.
9417</para>
9418</refsect1>
9419</refentry>
9420
9421<refentry id="API-drm-atomic-add-affected-planes">
9422<refentryinfo>
9423 <title>LINUX</title>
9424 <productname>Kernel Hackers Manual</productname>
9425 <date>July 2017</date>
9426</refentryinfo>
9427<refmeta>
9428 <refentrytitle><phrase>drm_atomic_add_affected_planes</phrase></refentrytitle>
9429 <manvolnum>9</manvolnum>
9430 <refmiscinfo class="version">4.4.14</refmiscinfo>
9431</refmeta>
9432<refnamediv>
9433 <refname>drm_atomic_add_affected_planes</refname>
9434 <refpurpose>
9435     add planes for crtc
9436 </refpurpose>
9437</refnamediv>
9438<refsynopsisdiv>
9439 <title>Synopsis</title>
9440  <funcsynopsis><funcprototype>
9441   <funcdef>int <function>drm_atomic_add_affected_planes </function></funcdef>
9442   <paramdef>struct drm_atomic_state * <parameter>state</parameter></paramdef>
9443   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
9444  </funcprototype></funcsynopsis>
9445</refsynopsisdiv>
9446<refsect1>
9447 <title>Arguments</title>
9448 <variablelist>
9449  <varlistentry>
9450   <term><parameter>state</parameter></term>
9451   <listitem>
9452    <para>
9453     atomic state
9454    </para>
9455   </listitem>
9456  </varlistentry>
9457  <varlistentry>
9458   <term><parameter>crtc</parameter></term>
9459   <listitem>
9460    <para>
9461     DRM crtc
9462    </para>
9463   </listitem>
9464  </varlistentry>
9465 </variablelist>
9466</refsect1>
9467<refsect1>
9468<title>Description</title>
9469<para>
9470   This function walks the current configuration and adds all planes
9471   currently used by <parameter>crtc</parameter> to the atomic configuration <parameter>state</parameter>. This is useful
9472   when an atomic commit also needs to check all currently enabled plane on
9473   <parameter>crtc</parameter>, e.g. when changing the mode. It's also useful when re-enabling a CRTC
9474   to avoid special code to force-enable all planes.
9475   </para><para>
9476
9477   Since acquiring a plane state will always also acquire the w/w mutex of the
9478   current CRTC for that plane (if there is any) adding all the plane states for
9479   a CRTC will not reduce parallism of atomic updates.
9480</para>
9481</refsect1>
9482<refsect1>
9483<title>Returns</title>
9484<para>
9485   0 on success or can fail with -EDEADLK or -ENOMEM. When the error is EDEADLK
9486   then the w/w mutex code has detected a deadlock and the entire atomic
9487   sequence must be restarted. All other errors are fatal.
9488</para>
9489</refsect1>
9490</refentry>
9491
9492<refentry id="API-drm-atomic-connectors-for-crtc">
9493<refentryinfo>
9494 <title>LINUX</title>
9495 <productname>Kernel Hackers Manual</productname>
9496 <date>July 2017</date>
9497</refentryinfo>
9498<refmeta>
9499 <refentrytitle><phrase>drm_atomic_connectors_for_crtc</phrase></refentrytitle>
9500 <manvolnum>9</manvolnum>
9501 <refmiscinfo class="version">4.4.14</refmiscinfo>
9502</refmeta>
9503<refnamediv>
9504 <refname>drm_atomic_connectors_for_crtc</refname>
9505 <refpurpose>
9506     count number of connected outputs
9507 </refpurpose>
9508</refnamediv>
9509<refsynopsisdiv>
9510 <title>Synopsis</title>
9511  <funcsynopsis><funcprototype>
9512   <funcdef>int <function>drm_atomic_connectors_for_crtc </function></funcdef>
9513   <paramdef>struct drm_atomic_state * <parameter>state</parameter></paramdef>
9514   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
9515  </funcprototype></funcsynopsis>
9516</refsynopsisdiv>
9517<refsect1>
9518 <title>Arguments</title>
9519 <variablelist>
9520  <varlistentry>
9521   <term><parameter>state</parameter></term>
9522   <listitem>
9523    <para>
9524     atomic state
9525    </para>
9526   </listitem>
9527  </varlistentry>
9528  <varlistentry>
9529   <term><parameter>crtc</parameter></term>
9530   <listitem>
9531    <para>
9532     DRM crtc
9533    </para>
9534   </listitem>
9535  </varlistentry>
9536 </variablelist>
9537</refsect1>
9538<refsect1>
9539<title>Description</title>
9540<para>
9541   This function counts all connectors which will be connected to <parameter>crtc</parameter>
9542   according to <parameter>state</parameter>. Useful to recompute the enable state for <parameter>crtc</parameter>.
9543</para>
9544</refsect1>
9545</refentry>
9546
9547<refentry id="API-drm-atomic-legacy-backoff">
9548<refentryinfo>
9549 <title>LINUX</title>
9550 <productname>Kernel Hackers Manual</productname>
9551 <date>July 2017</date>
9552</refentryinfo>
9553<refmeta>
9554 <refentrytitle><phrase>drm_atomic_legacy_backoff</phrase></refentrytitle>
9555 <manvolnum>9</manvolnum>
9556 <refmiscinfo class="version">4.4.14</refmiscinfo>
9557</refmeta>
9558<refnamediv>
9559 <refname>drm_atomic_legacy_backoff</refname>
9560 <refpurpose>
9561     locking backoff for legacy ioctls
9562 </refpurpose>
9563</refnamediv>
9564<refsynopsisdiv>
9565 <title>Synopsis</title>
9566  <funcsynopsis><funcprototype>
9567   <funcdef>void <function>drm_atomic_legacy_backoff </function></funcdef>
9568   <paramdef>struct drm_atomic_state * <parameter>state</parameter></paramdef>
9569  </funcprototype></funcsynopsis>
9570</refsynopsisdiv>
9571<refsect1>
9572 <title>Arguments</title>
9573 <variablelist>
9574  <varlistentry>
9575   <term><parameter>state</parameter></term>
9576   <listitem>
9577    <para>
9578     atomic state
9579    </para>
9580   </listitem>
9581  </varlistentry>
9582 </variablelist>
9583</refsect1>
9584<refsect1>
9585<title>Description</title>
9586<para>
9587   This function should be used by legacy entry points which don't understand
9588   -EDEADLK semantics. For simplicity this one will grab all modeset locks after
9589   the slowpath completed.
9590</para>
9591</refsect1>
9592</refentry>
9593
9594<refentry id="API-drm-atomic-check-only">
9595<refentryinfo>
9596 <title>LINUX</title>
9597 <productname>Kernel Hackers Manual</productname>
9598 <date>July 2017</date>
9599</refentryinfo>
9600<refmeta>
9601 <refentrytitle><phrase>drm_atomic_check_only</phrase></refentrytitle>
9602 <manvolnum>9</manvolnum>
9603 <refmiscinfo class="version">4.4.14</refmiscinfo>
9604</refmeta>
9605<refnamediv>
9606 <refname>drm_atomic_check_only</refname>
9607 <refpurpose>
9608     check whether a given config would work
9609 </refpurpose>
9610</refnamediv>
9611<refsynopsisdiv>
9612 <title>Synopsis</title>
9613  <funcsynopsis><funcprototype>
9614   <funcdef>int <function>drm_atomic_check_only </function></funcdef>
9615   <paramdef>struct drm_atomic_state * <parameter>state</parameter></paramdef>
9616  </funcprototype></funcsynopsis>
9617</refsynopsisdiv>
9618<refsect1>
9619 <title>Arguments</title>
9620 <variablelist>
9621  <varlistentry>
9622   <term><parameter>state</parameter></term>
9623   <listitem>
9624    <para>
9625     atomic configuration to check
9626    </para>
9627   </listitem>
9628  </varlistentry>
9629 </variablelist>
9630</refsect1>
9631<refsect1>
9632<title>Description</title>
9633<para>
9634   Note that this function can return -EDEADLK if the driver needed to acquire
9635   more locks but encountered a deadlock. The caller must then do the usual w/w
9636   backoff dance and restart. All other errors are fatal.
9637</para>
9638</refsect1>
9639<refsect1>
9640<title>Returns</title>
9641<para>
9642   0 on success, negative error code on failure.
9643</para>
9644</refsect1>
9645</refentry>
9646
9647<refentry id="API-drm-atomic-commit">
9648<refentryinfo>
9649 <title>LINUX</title>
9650 <productname>Kernel Hackers Manual</productname>
9651 <date>July 2017</date>
9652</refentryinfo>
9653<refmeta>
9654 <refentrytitle><phrase>drm_atomic_commit</phrase></refentrytitle>
9655 <manvolnum>9</manvolnum>
9656 <refmiscinfo class="version">4.4.14</refmiscinfo>
9657</refmeta>
9658<refnamediv>
9659 <refname>drm_atomic_commit</refname>
9660 <refpurpose>
9661     commit configuration atomically
9662 </refpurpose>
9663</refnamediv>
9664<refsynopsisdiv>
9665 <title>Synopsis</title>
9666  <funcsynopsis><funcprototype>
9667   <funcdef>int <function>drm_atomic_commit </function></funcdef>
9668   <paramdef>struct drm_atomic_state * <parameter>state</parameter></paramdef>
9669  </funcprototype></funcsynopsis>
9670</refsynopsisdiv>
9671<refsect1>
9672 <title>Arguments</title>
9673 <variablelist>
9674  <varlistentry>
9675   <term><parameter>state</parameter></term>
9676   <listitem>
9677    <para>
9678     atomic configuration to check
9679    </para>
9680   </listitem>
9681  </varlistentry>
9682 </variablelist>
9683</refsect1>
9684<refsect1>
9685<title>Description</title>
9686<para>
9687   Note that this function can return -EDEADLK if the driver needed to acquire
9688   more locks but encountered a deadlock. The caller must then do the usual w/w
9689   backoff dance and restart. All other errors are fatal.
9690   </para><para>
9691
9692   Also note that on successful execution ownership of <parameter>state</parameter> is transferred
9693   from the caller of this function to the function itself. The caller must not
9694   free or in any other way access <parameter>state</parameter>. If the function fails then the caller
9695   must clean up <parameter>state</parameter> itself.
9696</para>
9697</refsect1>
9698<refsect1>
9699<title>Returns</title>
9700<para>
9701   0 on success, negative error code on failure.
9702</para>
9703</refsect1>
9704</refentry>
9705
9706<refentry id="API-drm-atomic-async-commit">
9707<refentryinfo>
9708 <title>LINUX</title>
9709 <productname>Kernel Hackers Manual</productname>
9710 <date>July 2017</date>
9711</refentryinfo>
9712<refmeta>
9713 <refentrytitle><phrase>drm_atomic_async_commit</phrase></refentrytitle>
9714 <manvolnum>9</manvolnum>
9715 <refmiscinfo class="version">4.4.14</refmiscinfo>
9716</refmeta>
9717<refnamediv>
9718 <refname>drm_atomic_async_commit</refname>
9719 <refpurpose>
9720     atomic<structname>async</structname> configuration commit
9721 </refpurpose>
9722</refnamediv>
9723<refsynopsisdiv>
9724 <title>Synopsis</title>
9725  <funcsynopsis><funcprototype>
9726   <funcdef>int <function>drm_atomic_async_commit </function></funcdef>
9727   <paramdef>struct drm_atomic_state * <parameter>state</parameter></paramdef>
9728  </funcprototype></funcsynopsis>
9729</refsynopsisdiv>
9730<refsect1>
9731 <title>Arguments</title>
9732 <variablelist>
9733  <varlistentry>
9734   <term><parameter>state</parameter></term>
9735   <listitem>
9736    <para>
9737     atomic configuration to check
9738    </para>
9739   </listitem>
9740  </varlistentry>
9741 </variablelist>
9742</refsect1>
9743<refsect1>
9744<title>Description</title>
9745<para>
9746   Note that this function can return -EDEADLK if the driver needed to acquire
9747   more locks but encountered a deadlock. The caller must then do the usual w/w
9748   backoff dance and restart. All other errors are fatal.
9749   </para><para>
9750
9751   Also note that on successful execution ownership of <parameter>state</parameter> is transferred
9752   from the caller of this function to the function itself. The caller must not
9753   free or in any other way access <parameter>state</parameter>. If the function fails then the caller
9754   must clean up <parameter>state</parameter> itself.
9755</para>
9756</refsect1>
9757<refsect1>
9758<title>Returns</title>
9759<para>
9760   0 on success, negative error code on failure.
9761</para>
9762</refsect1>
9763</refentry>
9764
9765<refentry id="API-drm-atomic-clean-old-fb">
9766<refentryinfo>
9767 <title>LINUX</title>
9768 <productname>Kernel Hackers Manual</productname>
9769 <date>July 2017</date>
9770</refentryinfo>
9771<refmeta>
9772 <refentrytitle><phrase>drm_atomic_clean_old_fb</phrase></refentrytitle>
9773 <manvolnum>9</manvolnum>
9774 <refmiscinfo class="version">4.4.14</refmiscinfo>
9775</refmeta>
9776<refnamediv>
9777 <refname>drm_atomic_clean_old_fb</refname>
9778 <refpurpose>
9779     - Unset old_fb pointers and set plane-&gt;fb pointers.
9780 </refpurpose>
9781</refnamediv>
9782<refsynopsisdiv>
9783 <title>Synopsis</title>
9784  <funcsynopsis><funcprototype>
9785   <funcdef>void <function>drm_atomic_clean_old_fb </function></funcdef>
9786   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
9787   <paramdef>unsigned <parameter>plane_mask</parameter></paramdef>
9788   <paramdef>int <parameter>ret</parameter></paramdef>
9789  </funcprototype></funcsynopsis>
9790</refsynopsisdiv>
9791<refsect1>
9792 <title>Arguments</title>
9793 <variablelist>
9794  <varlistentry>
9795   <term><parameter>dev</parameter></term>
9796   <listitem>
9797    <para>
9798     drm device to check.
9799    </para>
9800   </listitem>
9801  </varlistentry>
9802  <varlistentry>
9803   <term><parameter>plane_mask</parameter></term>
9804   <listitem>
9805    <para>
9806     plane mask for planes that were updated.
9807    </para>
9808   </listitem>
9809  </varlistentry>
9810  <varlistentry>
9811   <term><parameter>ret</parameter></term>
9812   <listitem>
9813    <para>
9814     return value, can be -EDEADLK for a retry.
9815    </para>
9816   </listitem>
9817  </varlistentry>
9818 </variablelist>
9819</refsect1>
9820<refsect1>
9821<title>Description</title>
9822<para>
9823   Before doing an update plane-&gt;old_fb is set to plane-&gt;fb,
9824   but before dropping the locks old_fb needs to be set to NULL
9825   and plane-&gt;fb updated. This is a common operation for each
9826   atomic update, so this call is split off as a helper.
9827</para>
9828</refsect1>
9829</refentry>
9830
9831    </sect2>
9832    <sect2>
9833      <title>Frame Buffer Creation</title>
9834      <synopsis>struct drm_framebuffer *(*fb_create)(struct drm_device *dev,
9835				     struct drm_file *file_priv,
9836				     struct drm_mode_fb_cmd2 *mode_cmd);</synopsis>
9837      <para>
9838        Frame buffers are abstract memory objects that provide a source of
9839        pixels to scanout to a CRTC. Applications explicitly request the
9840        creation of frame buffers through the DRM_IOCTL_MODE_ADDFB(2) ioctls and
9841        receive an opaque handle that can be passed to the KMS CRTC control,
9842        plane configuration and page flip functions.
9843      </para>
9844      <para>
9845        Frame buffers rely on the underneath memory manager for low-level memory
9846        operations. When creating a frame buffer applications pass a memory
9847        handle (or a list of memory handles for multi-planar formats) through
9848	the <parameter>drm_mode_fb_cmd2</parameter> argument. For drivers using
9849	GEM as their userspace buffer management interface this would be a GEM
9850	handle.  Drivers are however free to use their own backing storage object
9851	handles, e.g. vmwgfx directly exposes special TTM handles to userspace
9852	and so expects TTM handles in the create ioctl and not GEM handles.
9853      </para>
9854      <para>
9855        Drivers must first validate the requested frame buffer parameters passed
9856        through the mode_cmd argument. In particular this is where invalid
9857        sizes, pixel formats or pitches can be caught.
9858      </para>
9859      <para>
9860        If the parameters are deemed valid, drivers then create, initialize and
9861        return an instance of struct <structname>drm_framebuffer</structname>.
9862        If desired the instance can be embedded in a larger driver-specific
9863	structure. Drivers must fill its <structfield>width</structfield>,
9864	<structfield>height</structfield>, <structfield>pitches</structfield>,
9865        <structfield>offsets</structfield>, <structfield>depth</structfield>,
9866        <structfield>bits_per_pixel</structfield> and
9867        <structfield>pixel_format</structfield> fields from the values passed
9868        through the <parameter>drm_mode_fb_cmd2</parameter> argument. They
9869        should call the <function>drm_helper_mode_fill_fb_struct</function>
9870        helper function to do so.
9871      </para>
9872
9873      <para>
9874	The initialization of the new framebuffer instance is finalized with a
9875	call to <function>drm_framebuffer_init</function> which takes a pointer
9876	to DRM frame buffer operations (struct
9877	<structname>drm_framebuffer_funcs</structname>). Note that this function
9878	publishes the framebuffer and so from this point on it can be accessed
9879	concurrently from other threads. Hence it must be the last step in the
9880	driver's framebuffer initialization sequence. Frame buffer operations
9881	are
9882        <itemizedlist>
9883          <listitem>
9884            <synopsis>int (*create_handle)(struct drm_framebuffer *fb,
9885		     struct drm_file *file_priv, unsigned int *handle);</synopsis>
9886            <para>
9887              Create a handle to the frame buffer underlying memory object. If
9888              the frame buffer uses a multi-plane format, the handle will
9889              reference the memory object associated with the first plane.
9890            </para>
9891            <para>
9892              Drivers call <function>drm_gem_handle_create</function> to create
9893              the handle.
9894            </para>
9895          </listitem>
9896          <listitem>
9897            <synopsis>void (*destroy)(struct drm_framebuffer *framebuffer);</synopsis>
9898            <para>
9899              Destroy the frame buffer object and frees all associated
9900              resources. Drivers must call
9901              <function>drm_framebuffer_cleanup</function> to free resources
9902              allocated by the DRM core for the frame buffer object, and must
9903              make sure to unreference all memory objects associated with the
9904              frame buffer. Handles created by the
9905              <methodname>create_handle</methodname> operation are released by
9906              the DRM core.
9907            </para>
9908          </listitem>
9909          <listitem>
9910            <synopsis>int (*dirty)(struct drm_framebuffer *framebuffer,
9911	     struct drm_file *file_priv, unsigned flags, unsigned color,
9912	     struct drm_clip_rect *clips, unsigned num_clips);</synopsis>
9913            <para>
9914              This optional operation notifies the driver that a region of the
9915              frame buffer has changed in response to a DRM_IOCTL_MODE_DIRTYFB
9916              ioctl call.
9917            </para>
9918          </listitem>
9919        </itemizedlist>
9920      </para>
9921      <para>
9922	The lifetime of a drm framebuffer is controlled with a reference count,
9923	drivers can grab additional references with
9924	<function>drm_framebuffer_reference</function>and drop them
9925	again with <function>drm_framebuffer_unreference</function>. For
9926	driver-private framebuffers for which the last reference is never
9927	dropped (e.g. for the fbdev framebuffer when the struct
9928	<structname>drm_framebuffer</structname> is embedded into the fbdev
9929	helper struct) drivers can manually clean up a framebuffer at module
9930	unload time with
9931	<function>drm_framebuffer_unregister_private</function>.
9932      </para>
9933    </sect2>
9934    <sect2>
9935      <title>Dumb Buffer Objects</title>
9936      <para>
9937	The KMS API doesn't standardize backing storage object creation and
9938	leaves it to driver-specific ioctls. Furthermore actually creating a
9939	buffer object even for GEM-based drivers is done through a
9940	driver-specific ioctl - GEM only has a common userspace interface for
9941	sharing and destroying objects. While not an issue for full-fledged
9942	graphics stacks that include device-specific userspace components (in
9943	libdrm for instance), this limit makes DRM-based early boot graphics
9944	unnecessarily complex.
9945      </para>
9946      <para>
9947        Dumb objects partly alleviate the problem by providing a standard
9948        API to create dumb buffers suitable for scanout, which can then be used
9949        to create KMS frame buffers.
9950      </para>
9951      <para>
9952        To support dumb objects drivers must implement the
9953        <methodname>dumb_create</methodname>,
9954        <methodname>dumb_destroy</methodname> and
9955        <methodname>dumb_map_offset</methodname> operations.
9956      </para>
9957      <itemizedlist>
9958        <listitem>
9959          <synopsis>int (*dumb_create)(struct drm_file *file_priv, struct drm_device *dev,
9960                   struct drm_mode_create_dumb *args);</synopsis>
9961          <para>
9962            The <methodname>dumb_create</methodname> operation creates a driver
9963	    object (GEM or TTM handle) suitable for scanout based on the
9964	    width, height and depth from the struct
9965	    <structname>drm_mode_create_dumb</structname> argument. It fills the
9966	    argument's <structfield>handle</structfield>,
9967	    <structfield>pitch</structfield> and <structfield>size</structfield>
9968	    fields with a handle for the newly created object and its line
9969            pitch and size in bytes.
9970          </para>
9971        </listitem>
9972        <listitem>
9973          <synopsis>int (*dumb_destroy)(struct drm_file *file_priv, struct drm_device *dev,
9974                    uint32_t handle);</synopsis>
9975          <para>
9976            The <methodname>dumb_destroy</methodname> operation destroys a dumb
9977            object created by <methodname>dumb_create</methodname>.
9978          </para>
9979        </listitem>
9980        <listitem>
9981          <synopsis>int (*dumb_map_offset)(struct drm_file *file_priv, struct drm_device *dev,
9982                       uint32_t handle, uint64_t *offset);</synopsis>
9983          <para>
9984            The <methodname>dumb_map_offset</methodname> operation associates an
9985            mmap fake offset with the object given by the handle and returns
9986            it. Drivers must use the
9987            <function>drm_gem_create_mmap_offset</function> function to
9988            associate the fake offset as described in
9989            <xref linkend="drm-gem-objects-mapping"/>.
9990          </para>
9991        </listitem>
9992      </itemizedlist>
9993      <para>
9994        Note that dumb objects may not be used for gpu acceleration, as has been
9995	attempted on some ARM embedded platforms. Such drivers really must have
9996	a hardware-specific ioctl to allocate suitable buffer objects.
9997      </para>
9998    </sect2>
9999    <sect2>
10000      <title>Output Polling</title>
10001      <synopsis>void (*output_poll_changed)(struct drm_device *dev);</synopsis>
10002      <para>
10003        This operation notifies the driver that the status of one or more
10004        connectors has changed. Drivers that use the fb helper can just call the
10005        <function>drm_fb_helper_hotplug_event</function> function to handle this
10006        operation.
10007      </para>
10008    </sect2>
10009    <sect2>
10010      <title>Locking</title>
10011      <para>
10012        Beside some lookup structures with their own locking (which is hidden
10013	behind the interface functions) most of the modeset state is protected
10014	by the <code>dev-&lt;mode_config.lock</code> mutex and additionally
10015	per-crtc locks to allow cursor updates, pageflips and similar operations
10016	to occur concurrently with background tasks like output detection.
10017	Operations which cross domains like a full modeset always grab all
10018	locks. Drivers there need to protect resources shared between crtcs with
10019	additional locking. They also need to be careful to always grab the
10020	relevant crtc locks if a modset functions touches crtc state, e.g. for
10021	load detection (which does only grab the <code>mode_config.lock</code>
10022	to allow concurrent screen updates on live crtcs).
10023      </para>
10024    </sect2>
10025  </sect1>
10026
10027  <!-- Internals: kms initialization and cleanup -->
10028
10029  <sect1 id="drm-kms-init">
10030    <title>KMS Initialization and Cleanup</title>
10031    <para>
10032      A KMS device is abstracted and exposed as a set of planes, CRTCs, encoders
10033      and connectors. KMS drivers must thus create and initialize all those
10034      objects at load time after initializing mode setting.
10035    </para>
10036    <sect2>
10037      <title>CRTCs (struct <structname>drm_crtc</structname>)</title>
10038      <para>
10039        A CRTC is an abstraction representing a part of the chip that contains a
10040	pointer to a scanout buffer. Therefore, the number of CRTCs available
10041	determines how many independent scanout buffers can be active at any
10042	given time. The CRTC structure contains several fields to support this:
10043	a pointer to some video memory (abstracted as a frame buffer object), a
10044	display mode, and an (x, y) offset into the video memory to support
10045	panning or configurations where one piece of video memory spans multiple
10046	CRTCs.
10047      </para>
10048      <sect3>
10049        <title>CRTC Initialization</title>
10050        <para>
10051          A KMS device must create and register at least one struct
10052          <structname>drm_crtc</structname> instance. The instance is allocated
10053          and zeroed by the driver, possibly as part of a larger structure, and
10054          registered with a call to <function>drm_crtc_init</function> with a
10055          pointer to CRTC functions.
10056        </para>
10057      </sect3>
10058      <sect3 id="drm-kms-crtcops">
10059        <title>CRTC Operations</title>
10060        <sect4>
10061          <title>Set Configuration</title>
10062          <synopsis>int (*set_config)(struct drm_mode_set *set);</synopsis>
10063          <para>
10064            Apply a new CRTC configuration to the device. The configuration
10065            specifies a CRTC, a frame buffer to scan out from, a (x,y) position in
10066            the frame buffer, a display mode and an array of connectors to drive
10067            with the CRTC if possible.
10068          </para>
10069          <para>
10070            If the frame buffer specified in the configuration is NULL, the driver
10071            must detach all encoders connected to the CRTC and all connectors
10072            attached to those encoders and disable them.
10073          </para>
10074          <para>
10075            This operation is called with the mode config lock held.
10076          </para>
10077          <note><para>
10078	    Note that the drm core has no notion of restoring the mode setting
10079	    state after resume, since all resume handling is in the full
10080	    responsibility of the driver. The common mode setting helper library
10081	    though provides a helper which can be used for this:
10082	    <function>drm_helper_resume_force_mode</function>.
10083          </para></note>
10084        </sect4>
10085        <sect4>
10086          <title>Page Flipping</title>
10087          <synopsis>int (*page_flip)(struct drm_crtc *crtc, struct drm_framebuffer *fb,
10088                   struct drm_pending_vblank_event *event);</synopsis>
10089          <para>
10090            Schedule a page flip to the given frame buffer for the CRTC. This
10091            operation is called with the mode config mutex held.
10092          </para>
10093          <para>
10094            Page flipping is a synchronization mechanism that replaces the frame
10095            buffer being scanned out by the CRTC with a new frame buffer during
10096            vertical blanking, avoiding tearing. When an application requests a page
10097            flip the DRM core verifies that the new frame buffer is large enough to
10098            be scanned out by  the CRTC in the currently configured mode and then
10099            calls the CRTC <methodname>page_flip</methodname> operation with a
10100            pointer to the new frame buffer.
10101          </para>
10102          <para>
10103            The <methodname>page_flip</methodname> operation schedules a page flip.
10104            Once any pending rendering targeting the new frame buffer has
10105            completed, the CRTC will be reprogrammed to display that frame buffer
10106            after the next vertical refresh. The operation must return immediately
10107            without waiting for rendering or page flip to complete and must block
10108            any new rendering to the frame buffer until the page flip completes.
10109          </para>
10110          <para>
10111            If a page flip can be successfully scheduled the driver must set the
10112            <code>drm_crtc-&gt;fb</code> field to the new framebuffer pointed to
10113            by <code>fb</code>. This is important so that the reference counting
10114            on framebuffers stays balanced.
10115          </para>
10116          <para>
10117            If a page flip is already pending, the
10118            <methodname>page_flip</methodname> operation must return
10119            -<errorname>EBUSY</errorname>.
10120          </para>
10121          <para>
10122            To synchronize page flip to vertical blanking the driver will likely
10123            need to enable vertical blanking interrupts. It should call
10124            <function>drm_vblank_get</function> for that purpose, and call
10125            <function>drm_vblank_put</function> after the page flip completes.
10126          </para>
10127          <para>
10128            If the application has requested to be notified when page flip completes
10129            the <methodname>page_flip</methodname> operation will be called with a
10130            non-NULL <parameter>event</parameter> argument pointing to a
10131            <structname>drm_pending_vblank_event</structname> instance. Upon page
10132            flip completion the driver must call <methodname>drm_send_vblank_event</methodname>
10133            to fill in the event and send to wake up any waiting processes.
10134            This can be performed with
10135            <programlisting><![CDATA[
10136            spin_lock_irqsave(&dev->event_lock, flags);
10137            ...
10138            drm_send_vblank_event(dev, pipe, event);
10139            spin_unlock_irqrestore(&dev->event_lock, flags);
10140            ]]></programlisting>
10141          </para>
10142          <note><para>
10143            FIXME: Could drivers that don't need to wait for rendering to complete
10144            just add the event to <literal>dev-&gt;vblank_event_list</literal> and
10145            let the DRM core handle everything, as for "normal" vertical blanking
10146            events?
10147          </para></note>
10148          <para>
10149            While waiting for the page flip to complete, the
10150            <literal>event-&gt;base.link</literal> list head can be used freely by
10151            the driver to store the pending event in a driver-specific list.
10152          </para>
10153          <para>
10154            If the file handle is closed before the event is signaled, drivers must
10155            take care to destroy the event in their
10156            <methodname>preclose</methodname> operation (and, if needed, call
10157            <function>drm_vblank_put</function>).
10158          </para>
10159        </sect4>
10160        <sect4>
10161          <title>Miscellaneous</title>
10162          <itemizedlist>
10163            <listitem>
10164              <synopsis>void (*set_property)(struct drm_crtc *crtc,
10165                     struct drm_property *property, uint64_t value);</synopsis>
10166              <para>
10167                Set the value of the given CRTC property to
10168                <parameter>value</parameter>. See <xref linkend="drm-kms-properties"/>
10169                for more information about properties.
10170              </para>
10171            </listitem>
10172            <listitem>
10173              <synopsis>void (*gamma_set)(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b,
10174                        uint32_t start, uint32_t size);</synopsis>
10175              <para>
10176                Apply a gamma table to the device. The operation is optional.
10177              </para>
10178            </listitem>
10179            <listitem>
10180              <synopsis>void (*destroy)(struct drm_crtc *crtc);</synopsis>
10181              <para>
10182                Destroy the CRTC when not needed anymore. See
10183                <xref linkend="drm-kms-init"/>.
10184              </para>
10185            </listitem>
10186          </itemizedlist>
10187        </sect4>
10188      </sect3>
10189    </sect2>
10190    <sect2>
10191      <title>Planes (struct <structname>drm_plane</structname>)</title>
10192      <para>
10193        A plane represents an image source that can be blended with or overlayed
10194	on top of a CRTC during the scanout process. Planes are associated with
10195	a frame buffer to crop a portion of the image memory (source) and
10196	optionally scale it to a destination size. The result is then blended
10197	with or overlayed on top of a CRTC.
10198      </para>
10199      <para>
10200      The DRM core recognizes three types of planes:
10201      <itemizedlist>
10202        <listitem>
10203        DRM_PLANE_TYPE_PRIMARY represents a "main" plane for a CRTC.  Primary
10204        planes are the planes operated upon by CRTC modesetting and flipping
10205        operations described in <xref linkend="drm-kms-crtcops"/>.
10206        </listitem>
10207        <listitem>
10208        DRM_PLANE_TYPE_CURSOR represents a "cursor" plane for a CRTC.  Cursor
10209        planes are the planes operated upon by the DRM_IOCTL_MODE_CURSOR and
10210        DRM_IOCTL_MODE_CURSOR2 ioctls.
10211        </listitem>
10212        <listitem>
10213        DRM_PLANE_TYPE_OVERLAY represents all non-primary, non-cursor planes.
10214        Some drivers refer to these types of planes as "sprites" internally.
10215        </listitem>
10216      </itemizedlist>
10217      For compatibility with legacy userspace, only overlay planes are made
10218      available to userspace by default.  Userspace clients may set the
10219      DRM_CLIENT_CAP_UNIVERSAL_PLANES client capability bit to indicate that
10220      they wish to receive a universal plane list containing all plane types.
10221      </para>
10222      <sect3>
10223        <title>Plane Initialization</title>
10224        <para>
10225          To create a plane, a KMS drivers allocates and
10226          zeroes an instances of struct <structname>drm_plane</structname>
10227          (possibly as part of a larger structure) and registers it with a call
10228          to <function>drm_universal_plane_init</function>. The function takes a bitmask
10229          of the CRTCs that can be associated with the plane, a pointer to the
10230          plane functions, a list of format supported formats, and the type of
10231          plane (primary, cursor, or overlay) being initialized.
10232        </para>
10233        <para>
10234          Cursor and overlay planes are optional.  All drivers should provide
10235          one primary plane per CRTC (although this requirement may change in
10236          the future); drivers that do not wish to provide special handling for
10237          primary planes may make use of the helper functions described in
10238          <xref linkend="drm-kms-planehelpers"/> to create and register a
10239          primary plane with standard capabilities.
10240        </para>
10241      </sect3>
10242      <sect3>
10243        <title>Plane Operations</title>
10244        <itemizedlist>
10245          <listitem>
10246            <synopsis>int (*update_plane)(struct drm_plane *plane, struct drm_crtc *crtc,
10247                        struct drm_framebuffer *fb, int crtc_x, int crtc_y,
10248                        unsigned int crtc_w, unsigned int crtc_h,
10249                        uint32_t src_x, uint32_t src_y,
10250                        uint32_t src_w, uint32_t src_h);</synopsis>
10251            <para>
10252              Enable and configure the plane to use the given CRTC and frame buffer.
10253            </para>
10254            <para>
10255              The source rectangle in frame buffer memory coordinates is given by
10256              the <parameter>src_x</parameter>, <parameter>src_y</parameter>,
10257              <parameter>src_w</parameter> and <parameter>src_h</parameter>
10258              parameters (as 16.16 fixed point values). Devices that don't support
10259              subpixel plane coordinates can ignore the fractional part.
10260            </para>
10261            <para>
10262              The destination rectangle in CRTC coordinates is given by the
10263              <parameter>crtc_x</parameter>, <parameter>crtc_y</parameter>,
10264              <parameter>crtc_w</parameter> and <parameter>crtc_h</parameter>
10265              parameters (as integer values). Devices scale the source rectangle to
10266              the destination rectangle. If scaling is not supported, and the source
10267              rectangle size doesn't match the destination rectangle size, the
10268              driver must return a -<errorname>EINVAL</errorname> error.
10269            </para>
10270          </listitem>
10271          <listitem>
10272            <synopsis>int (*disable_plane)(struct drm_plane *plane);</synopsis>
10273            <para>
10274              Disable the plane. The DRM core calls this method in response to a
10275              DRM_IOCTL_MODE_SETPLANE ioctl call with the frame buffer ID set to 0.
10276              Disabled planes must not be processed by the CRTC.
10277            </para>
10278          </listitem>
10279          <listitem>
10280            <synopsis>void (*destroy)(struct drm_plane *plane);</synopsis>
10281            <para>
10282              Destroy the plane when not needed anymore. See
10283              <xref linkend="drm-kms-init"/>.
10284            </para>
10285          </listitem>
10286        </itemizedlist>
10287      </sect3>
10288    </sect2>
10289    <sect2>
10290      <title>Encoders (struct <structname>drm_encoder</structname>)</title>
10291      <para>
10292        An encoder takes pixel data from a CRTC and converts it to a format
10293	suitable for any attached connectors. On some devices, it may be
10294	possible to have a CRTC send data to more than one encoder. In that
10295	case, both encoders would receive data from the same scanout buffer,
10296	resulting in a "cloned" display configuration across the connectors
10297	attached to each encoder.
10298      </para>
10299      <sect3>
10300        <title>Encoder Initialization</title>
10301        <para>
10302          As for CRTCs, a KMS driver must create, initialize and register at
10303          least one struct <structname>drm_encoder</structname> instance. The
10304          instance is allocated and zeroed by the driver, possibly as part of a
10305          larger structure.
10306        </para>
10307        <para>
10308          Drivers must initialize the struct <structname>drm_encoder</structname>
10309          <structfield>possible_crtcs</structfield> and
10310          <structfield>possible_clones</structfield> fields before registering the
10311          encoder. Both fields are bitmasks of respectively the CRTCs that the
10312          encoder can be connected to, and sibling encoders candidate for cloning.
10313        </para>
10314        <para>
10315          After being initialized, the encoder must be registered with a call to
10316          <function>drm_encoder_init</function>. The function takes a pointer to
10317          the encoder functions and an encoder type. Supported types are
10318          <itemizedlist>
10319            <listitem>
10320              DRM_MODE_ENCODER_DAC for VGA and analog on DVI-I/DVI-A
10321              </listitem>
10322            <listitem>
10323              DRM_MODE_ENCODER_TMDS for DVI, HDMI and (embedded) DisplayPort
10324            </listitem>
10325            <listitem>
10326              DRM_MODE_ENCODER_LVDS for display panels
10327            </listitem>
10328            <listitem>
10329              DRM_MODE_ENCODER_TVDAC for TV output (Composite, S-Video, Component,
10330              SCART)
10331            </listitem>
10332            <listitem>
10333              DRM_MODE_ENCODER_VIRTUAL for virtual machine displays
10334            </listitem>
10335          </itemizedlist>
10336        </para>
10337        <para>
10338          Encoders must be attached to a CRTC to be used. DRM drivers leave
10339          encoders unattached at initialization time. Applications (or the fbdev
10340          compatibility layer when implemented) are responsible for attaching the
10341          encoders they want to use to a CRTC.
10342        </para>
10343      </sect3>
10344      <sect3>
10345        <title>Encoder Operations</title>
10346        <itemizedlist>
10347          <listitem>
10348            <synopsis>void (*destroy)(struct drm_encoder *encoder);</synopsis>
10349            <para>
10350              Called to destroy the encoder when not needed anymore. See
10351              <xref linkend="drm-kms-init"/>.
10352            </para>
10353          </listitem>
10354          <listitem>
10355            <synopsis>void (*set_property)(struct drm_plane *plane,
10356                     struct drm_property *property, uint64_t value);</synopsis>
10357            <para>
10358              Set the value of the given plane property to
10359              <parameter>value</parameter>. See <xref linkend="drm-kms-properties"/>
10360              for more information about properties.
10361            </para>
10362          </listitem>
10363        </itemizedlist>
10364      </sect3>
10365    </sect2>
10366    <sect2>
10367      <title>Connectors (struct <structname>drm_connector</structname>)</title>
10368      <para>
10369        A connector is the final destination for pixel data on a device, and
10370	usually connects directly to an external display device like a monitor
10371	or laptop panel. A connector can only be attached to one encoder at a
10372	time. The connector is also the structure where information about the
10373	attached display is kept, so it contains fields for display data, EDID
10374	data, DPMS &amp; connection status, and information about modes
10375	supported on the attached displays.
10376      </para>
10377      <sect3>
10378        <title>Connector Initialization</title>
10379        <para>
10380          Finally a KMS driver must create, initialize, register and attach at
10381          least one struct <structname>drm_connector</structname> instance. The
10382          instance is created as other KMS objects and initialized by setting the
10383          following fields.
10384        </para>
10385        <variablelist>
10386          <varlistentry>
10387            <term><structfield>interlace_allowed</structfield></term>
10388            <listitem><para>
10389              Whether the connector can handle interlaced modes.
10390            </para></listitem>
10391          </varlistentry>
10392          <varlistentry>
10393            <term><structfield>doublescan_allowed</structfield></term>
10394            <listitem><para>
10395              Whether the connector can handle doublescan.
10396            </para></listitem>
10397          </varlistentry>
10398          <varlistentry>
10399            <term><structfield>display_info
10400            </structfield></term>
10401            <listitem><para>
10402              Display information is filled from EDID information when a display
10403              is detected. For non hot-pluggable displays such as flat panels in
10404              embedded systems, the driver should initialize the
10405              <structfield>display_info</structfield>.<structfield>width_mm</structfield>
10406              and
10407              <structfield>display_info</structfield>.<structfield>height_mm</structfield>
10408              fields with the physical size of the display.
10409            </para></listitem>
10410          </varlistentry>
10411          <varlistentry>
10412            <term id="drm-kms-connector-polled"><structfield>polled</structfield></term>
10413            <listitem><para>
10414              Connector polling mode, a combination of
10415              <variablelist>
10416                <varlistentry>
10417                  <term>DRM_CONNECTOR_POLL_HPD</term>
10418                  <listitem><para>
10419                    The connector generates hotplug events and doesn't need to be
10420                    periodically polled. The CONNECT and DISCONNECT flags must not
10421                    be set together with the HPD flag.
10422                  </para></listitem>
10423                </varlistentry>
10424                <varlistentry>
10425                  <term>DRM_CONNECTOR_POLL_CONNECT</term>
10426                  <listitem><para>
10427                    Periodically poll the connector for connection.
10428                  </para></listitem>
10429                </varlistentry>
10430                <varlistentry>
10431                  <term>DRM_CONNECTOR_POLL_DISCONNECT</term>
10432                  <listitem><para>
10433                    Periodically poll the connector for disconnection.
10434                  </para></listitem>
10435                </varlistentry>
10436              </variablelist>
10437              Set to 0 for connectors that don't support connection status
10438              discovery.
10439            </para></listitem>
10440          </varlistentry>
10441        </variablelist>
10442        <para>
10443          The connector is then registered with a call to
10444          <function>drm_connector_init</function> with a pointer to the connector
10445          functions and a connector type, and exposed through sysfs with a call to
10446          <function>drm_connector_register</function>.
10447        </para>
10448        <para>
10449          Supported connector types are
10450          <itemizedlist>
10451            <listitem>DRM_MODE_CONNECTOR_VGA</listitem>
10452            <listitem>DRM_MODE_CONNECTOR_DVII</listitem>
10453            <listitem>DRM_MODE_CONNECTOR_DVID</listitem>
10454            <listitem>DRM_MODE_CONNECTOR_DVIA</listitem>
10455            <listitem>DRM_MODE_CONNECTOR_Composite</listitem>
10456            <listitem>DRM_MODE_CONNECTOR_SVIDEO</listitem>
10457            <listitem>DRM_MODE_CONNECTOR_LVDS</listitem>
10458            <listitem>DRM_MODE_CONNECTOR_Component</listitem>
10459            <listitem>DRM_MODE_CONNECTOR_9PinDIN</listitem>
10460            <listitem>DRM_MODE_CONNECTOR_DisplayPort</listitem>
10461            <listitem>DRM_MODE_CONNECTOR_HDMIA</listitem>
10462            <listitem>DRM_MODE_CONNECTOR_HDMIB</listitem>
10463            <listitem>DRM_MODE_CONNECTOR_TV</listitem>
10464            <listitem>DRM_MODE_CONNECTOR_eDP</listitem>
10465            <listitem>DRM_MODE_CONNECTOR_VIRTUAL</listitem>
10466          </itemizedlist>
10467        </para>
10468        <para>
10469          Connectors must be attached to an encoder to be used. For devices that
10470          map connectors to encoders 1:1, the connector should be attached at
10471          initialization time with a call to
10472          <function>drm_mode_connector_attach_encoder</function>. The driver must
10473          also set the <structname>drm_connector</structname>
10474          <structfield>encoder</structfield> field to point to the attached
10475          encoder.
10476        </para>
10477        <para>
10478          Finally, drivers must initialize the connectors state change detection
10479          with a call to <function>drm_kms_helper_poll_init</function>. If at
10480          least one connector is pollable but can't generate hotplug interrupts
10481          (indicated by the DRM_CONNECTOR_POLL_CONNECT and
10482          DRM_CONNECTOR_POLL_DISCONNECT connector flags), a delayed work will
10483          automatically be queued to periodically poll for changes. Connectors
10484          that can generate hotplug interrupts must be marked with the
10485          DRM_CONNECTOR_POLL_HPD flag instead, and their interrupt handler must
10486          call <function>drm_helper_hpd_irq_event</function>. The function will
10487          queue a delayed work to check the state of all connectors, but no
10488          periodic polling will be done.
10489        </para>
10490      </sect3>
10491      <sect3>
10492        <title>Connector Operations</title>
10493        <note><para>
10494          Unless otherwise state, all operations are mandatory.
10495        </para></note>
10496        <sect4>
10497          <title>DPMS</title>
10498          <synopsis>void (*dpms)(struct drm_connector *connector, int mode);</synopsis>
10499          <para>
10500            The DPMS operation sets the power state of a connector. The mode
10501            argument is one of
10502            <itemizedlist>
10503              <listitem><para>DRM_MODE_DPMS_ON</para></listitem>
10504              <listitem><para>DRM_MODE_DPMS_STANDBY</para></listitem>
10505              <listitem><para>DRM_MODE_DPMS_SUSPEND</para></listitem>
10506              <listitem><para>DRM_MODE_DPMS_OFF</para></listitem>
10507            </itemizedlist>
10508          </para>
10509          <para>
10510            In all but DPMS_ON mode the encoder to which the connector is attached
10511            should put the display in low-power mode by driving its signals
10512            appropriately. If more than one connector is attached to the encoder
10513            care should be taken not to change the power state of other displays as
10514            a side effect. Low-power mode should be propagated to the encoders and
10515            CRTCs when all related connectors are put in low-power mode.
10516          </para>
10517        </sect4>
10518        <sect4>
10519          <title>Modes</title>
10520          <synopsis>int (*fill_modes)(struct drm_connector *connector, uint32_t max_width,
10521                      uint32_t max_height);</synopsis>
10522          <para>
10523            Fill the mode list with all supported modes for the connector. If the
10524            <parameter>max_width</parameter> and <parameter>max_height</parameter>
10525            arguments are non-zero, the implementation must ignore all modes wider
10526            than <parameter>max_width</parameter> or higher than
10527            <parameter>max_height</parameter>.
10528          </para>
10529          <para>
10530            The connector must also fill in this operation its
10531            <structfield>display_info</structfield>
10532            <structfield>width_mm</structfield> and
10533            <structfield>height_mm</structfield> fields with the connected display
10534            physical size in millimeters. The fields should be set to 0 if the value
10535            isn't known or is not applicable (for instance for projector devices).
10536          </para>
10537        </sect4>
10538        <sect4>
10539          <title>Connection Status</title>
10540          <para>
10541            The connection status is updated through polling or hotplug events when
10542            supported (see <xref linkend="drm-kms-connector-polled"/>). The status
10543            value is reported to userspace through ioctls and must not be used
10544            inside the driver, as it only gets initialized by a call to
10545            <function>drm_mode_getconnector</function> from userspace.
10546          </para>
10547          <synopsis>enum drm_connector_status (*detect)(struct drm_connector *connector,
10548                                        bool force);</synopsis>
10549          <para>
10550            Check to see if anything is attached to the connector. The
10551            <parameter>force</parameter> parameter is set to false whilst polling or
10552            to true when checking the connector due to user request.
10553            <parameter>force</parameter> can be used by the driver to avoid
10554            expensive, destructive operations during automated probing.
10555          </para>
10556          <para>
10557            Return connector_status_connected if something is connected to the
10558            connector, connector_status_disconnected if nothing is connected and
10559            connector_status_unknown if the connection state isn't known.
10560          </para>
10561          <para>
10562            Drivers should only return connector_status_connected if the connection
10563            status has really been probed as connected. Connectors that can't detect
10564            the connection status, or failed connection status probes, should return
10565            connector_status_unknown.
10566          </para>
10567        </sect4>
10568        <sect4>
10569          <title>Miscellaneous</title>
10570          <itemizedlist>
10571            <listitem>
10572              <synopsis>void (*set_property)(struct drm_connector *connector,
10573                     struct drm_property *property, uint64_t value);</synopsis>
10574              <para>
10575                Set the value of the given connector property to
10576                <parameter>value</parameter>. See <xref linkend="drm-kms-properties"/>
10577                for more information about properties.
10578              </para>
10579            </listitem>
10580            <listitem>
10581              <synopsis>void (*destroy)(struct drm_connector *connector);</synopsis>
10582              <para>
10583                Destroy the connector when not needed anymore. See
10584                <xref linkend="drm-kms-init"/>.
10585              </para>
10586            </listitem>
10587          </itemizedlist>
10588        </sect4>
10589      </sect3>
10590    </sect2>
10591    <sect2>
10592      <title>Cleanup</title>
10593      <para>
10594        The DRM core manages its objects' lifetime. When an object is not needed
10595	anymore the core calls its destroy function, which must clean up and
10596	free every resource allocated for the object. Every
10597	<function>drm_*_init</function> call must be matched with a
10598	corresponding <function>drm_*_cleanup</function> call to cleanup CRTCs
10599	(<function>drm_crtc_cleanup</function>), planes
10600	(<function>drm_plane_cleanup</function>), encoders
10601	(<function>drm_encoder_cleanup</function>) and connectors
10602	(<function>drm_connector_cleanup</function>). Furthermore, connectors
10603	that have been added to sysfs must be removed by a call to
10604	<function>drm_connector_unregister</function> before calling
10605	<function>drm_connector_cleanup</function>.
10606      </para>
10607      <para>
10608        Connectors state change detection must be cleanup up with a call to
10609	<function>drm_kms_helper_poll_fini</function>.
10610      </para>
10611    </sect2>
10612    <sect2>
10613      <title>Output discovery and initialization example</title>
10614      <programlisting><![CDATA[
10615void intel_crt_init(struct drm_device *dev)
10616{
10617	struct drm_connector *connector;
10618	struct intel_output *intel_output;
10619
10620	intel_output = kzalloc(sizeof(struct intel_output), GFP_KERNEL);
10621	if (!intel_output)
10622		return;
10623
10624	connector = &intel_output->base;
10625	drm_connector_init(dev, &intel_output->base,
10626			   &intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA);
10627
10628	drm_encoder_init(dev, &intel_output->enc, &intel_crt_enc_funcs,
10629			 DRM_MODE_ENCODER_DAC);
10630
10631	drm_mode_connector_attach_encoder(&intel_output->base,
10632					  &intel_output->enc);
10633
10634	/* Set up the DDC bus. */
10635	intel_output->ddc_bus = intel_i2c_create(dev, GPIOA, "CRTDDC_A");
10636	if (!intel_output->ddc_bus) {
10637		dev_printk(KERN_ERR, &dev->pdev->dev, "DDC bus registration "
10638			   "failed.\n");
10639		return;
10640	}
10641
10642	intel_output->type = INTEL_OUTPUT_ANALOG;
10643	connector->interlace_allowed = 0;
10644	connector->doublescan_allowed = 0;
10645
10646	drm_encoder_helper_add(&intel_output->enc, &intel_crt_helper_funcs);
10647	drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs);
10648
10649	drm_connector_register(connector);
10650}]]></programlisting>
10651      <para>
10652        In the example above (taken from the i915 driver), a CRTC, connector and
10653        encoder combination is created. A device-specific i2c bus is also
10654        created for fetching EDID data and performing monitor detection. Once
10655        the process is complete, the new connector is registered with sysfs to
10656        make its properties available to applications.
10657      </para>
10658    </sect2>
10659    <sect2>
10660      <title>KMS API Functions</title>
10661<!-- drivers/gpu/drm/drm_crtc.c -->
10662<refentry id="API-drm-get-connector-status-name">
10663<refentryinfo>
10664 <title>LINUX</title>
10665 <productname>Kernel Hackers Manual</productname>
10666 <date>July 2017</date>
10667</refentryinfo>
10668<refmeta>
10669 <refentrytitle><phrase>drm_get_connector_status_name</phrase></refentrytitle>
10670 <manvolnum>9</manvolnum>
10671 <refmiscinfo class="version">4.4.14</refmiscinfo>
10672</refmeta>
10673<refnamediv>
10674 <refname>drm_get_connector_status_name</refname>
10675 <refpurpose>
10676  return a string for connector status
10677 </refpurpose>
10678</refnamediv>
10679<refsynopsisdiv>
10680 <title>Synopsis</title>
10681  <funcsynopsis><funcprototype>
10682   <funcdef>const char * <function>drm_get_connector_status_name </function></funcdef>
10683   <paramdef>enum drm_connector_status <parameter>status</parameter></paramdef>
10684  </funcprototype></funcsynopsis>
10685</refsynopsisdiv>
10686<refsect1>
10687 <title>Arguments</title>
10688 <variablelist>
10689  <varlistentry>
10690   <term><parameter>status</parameter></term>
10691   <listitem>
10692    <para>
10693     connector status to compute name of
10694    </para>
10695   </listitem>
10696  </varlistentry>
10697 </variablelist>
10698</refsect1>
10699<refsect1>
10700<title>Description</title>
10701<para>
10702   In contrast to the other drm_get_*_name functions this one here returns a
10703   const pointer and hence is threadsafe.
10704</para>
10705</refsect1>
10706</refentry>
10707
10708<refentry id="API-drm-get-subpixel-order-name">
10709<refentryinfo>
10710 <title>LINUX</title>
10711 <productname>Kernel Hackers Manual</productname>
10712 <date>July 2017</date>
10713</refentryinfo>
10714<refmeta>
10715 <refentrytitle><phrase>drm_get_subpixel_order_name</phrase></refentrytitle>
10716 <manvolnum>9</manvolnum>
10717 <refmiscinfo class="version">4.4.14</refmiscinfo>
10718</refmeta>
10719<refnamediv>
10720 <refname>drm_get_subpixel_order_name</refname>
10721 <refpurpose>
10722     return a string for a given subpixel enum
10723 </refpurpose>
10724</refnamediv>
10725<refsynopsisdiv>
10726 <title>Synopsis</title>
10727  <funcsynopsis><funcprototype>
10728   <funcdef>const char * <function>drm_get_subpixel_order_name </function></funcdef>
10729   <paramdef>enum subpixel_order <parameter>order</parameter></paramdef>
10730  </funcprototype></funcsynopsis>
10731</refsynopsisdiv>
10732<refsect1>
10733 <title>Arguments</title>
10734 <variablelist>
10735  <varlistentry>
10736   <term><parameter>order</parameter></term>
10737   <listitem>
10738    <para>
10739     enum of subpixel_order
10740    </para>
10741   </listitem>
10742  </varlistentry>
10743 </variablelist>
10744</refsect1>
10745<refsect1>
10746<title>Description</title>
10747<para>
10748   Note you could abuse this and return something out of bounds, but that
10749   would be a caller error.  No unscrubbed user data should make it here.
10750</para>
10751</refsect1>
10752</refentry>
10753
10754<refentry id="API-drm-get-format-name">
10755<refentryinfo>
10756 <title>LINUX</title>
10757 <productname>Kernel Hackers Manual</productname>
10758 <date>July 2017</date>
10759</refentryinfo>
10760<refmeta>
10761 <refentrytitle><phrase>drm_get_format_name</phrase></refentrytitle>
10762 <manvolnum>9</manvolnum>
10763 <refmiscinfo class="version">4.4.14</refmiscinfo>
10764</refmeta>
10765<refnamediv>
10766 <refname>drm_get_format_name</refname>
10767 <refpurpose>
10768     return a string for drm fourcc format
10769 </refpurpose>
10770</refnamediv>
10771<refsynopsisdiv>
10772 <title>Synopsis</title>
10773  <funcsynopsis><funcprototype>
10774   <funcdef>const char * <function>drm_get_format_name </function></funcdef>
10775   <paramdef>uint32_t <parameter>format</parameter></paramdef>
10776  </funcprototype></funcsynopsis>
10777</refsynopsisdiv>
10778<refsect1>
10779 <title>Arguments</title>
10780 <variablelist>
10781  <varlistentry>
10782   <term><parameter>format</parameter></term>
10783   <listitem>
10784    <para>
10785     format to compute name of
10786    </para>
10787   </listitem>
10788  </varlistentry>
10789 </variablelist>
10790</refsect1>
10791<refsect1>
10792<title>Description</title>
10793<para>
10794   Note that the buffer used by this function is globally shared and owned by
10795   the function itself.
10796</para>
10797</refsect1>
10798<refsect1>
10799<title>FIXME</title>
10800<para>
10801   This isn't really multithreading safe.
10802</para>
10803</refsect1>
10804</refentry>
10805
10806<refentry id="API-drm-mode-object-find">
10807<refentryinfo>
10808 <title>LINUX</title>
10809 <productname>Kernel Hackers Manual</productname>
10810 <date>July 2017</date>
10811</refentryinfo>
10812<refmeta>
10813 <refentrytitle><phrase>drm_mode_object_find</phrase></refentrytitle>
10814 <manvolnum>9</manvolnum>
10815 <refmiscinfo class="version">4.4.14</refmiscinfo>
10816</refmeta>
10817<refnamediv>
10818 <refname>drm_mode_object_find</refname>
10819 <refpurpose>
10820     look up a drm object with static lifetime
10821 </refpurpose>
10822</refnamediv>
10823<refsynopsisdiv>
10824 <title>Synopsis</title>
10825  <funcsynopsis><funcprototype>
10826   <funcdef>struct drm_mode_object * <function>drm_mode_object_find </function></funcdef>
10827   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
10828   <paramdef>uint32_t <parameter>id</parameter></paramdef>
10829   <paramdef>uint32_t <parameter>type</parameter></paramdef>
10830  </funcprototype></funcsynopsis>
10831</refsynopsisdiv>
10832<refsect1>
10833 <title>Arguments</title>
10834 <variablelist>
10835  <varlistentry>
10836   <term><parameter>dev</parameter></term>
10837   <listitem>
10838    <para>
10839     drm device
10840    </para>
10841   </listitem>
10842  </varlistentry>
10843  <varlistentry>
10844   <term><parameter>id</parameter></term>
10845   <listitem>
10846    <para>
10847     id of the mode object
10848    </para>
10849   </listitem>
10850  </varlistentry>
10851  <varlistentry>
10852   <term><parameter>type</parameter></term>
10853   <listitem>
10854    <para>
10855     type of the mode object
10856    </para>
10857   </listitem>
10858  </varlistentry>
10859 </variablelist>
10860</refsect1>
10861<refsect1>
10862<title>Description</title>
10863<para>
10864   Note that framebuffers cannot be looked up with this functions - since those
10865   are reference counted, they need special treatment.  Even with
10866   DRM_MODE_OBJECT_ANY (although that will simply return NULL
10867   rather than <function>WARN_ON</function>).
10868</para>
10869</refsect1>
10870</refentry>
10871
10872<refentry id="API-drm-framebuffer-init">
10873<refentryinfo>
10874 <title>LINUX</title>
10875 <productname>Kernel Hackers Manual</productname>
10876 <date>July 2017</date>
10877</refentryinfo>
10878<refmeta>
10879 <refentrytitle><phrase>drm_framebuffer_init</phrase></refentrytitle>
10880 <manvolnum>9</manvolnum>
10881 <refmiscinfo class="version">4.4.14</refmiscinfo>
10882</refmeta>
10883<refnamediv>
10884 <refname>drm_framebuffer_init</refname>
10885 <refpurpose>
10886     initialize a framebuffer
10887 </refpurpose>
10888</refnamediv>
10889<refsynopsisdiv>
10890 <title>Synopsis</title>
10891  <funcsynopsis><funcprototype>
10892   <funcdef>int <function>drm_framebuffer_init </function></funcdef>
10893   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
10894   <paramdef>struct drm_framebuffer * <parameter>fb</parameter></paramdef>
10895   <paramdef>const struct drm_framebuffer_funcs * <parameter>funcs</parameter></paramdef>
10896  </funcprototype></funcsynopsis>
10897</refsynopsisdiv>
10898<refsect1>
10899 <title>Arguments</title>
10900 <variablelist>
10901  <varlistentry>
10902   <term><parameter>dev</parameter></term>
10903   <listitem>
10904    <para>
10905     DRM device
10906    </para>
10907   </listitem>
10908  </varlistentry>
10909  <varlistentry>
10910   <term><parameter>fb</parameter></term>
10911   <listitem>
10912    <para>
10913     framebuffer to be initialized
10914    </para>
10915   </listitem>
10916  </varlistentry>
10917  <varlistentry>
10918   <term><parameter>funcs</parameter></term>
10919   <listitem>
10920    <para>
10921     ... with these functions
10922    </para>
10923   </listitem>
10924  </varlistentry>
10925 </variablelist>
10926</refsect1>
10927<refsect1>
10928<title>Description</title>
10929<para>
10930   Allocates an ID for the framebuffer's parent mode object, sets its mode
10931   functions &amp; device file and adds it to the master fd list.
10932</para>
10933</refsect1>
10934<refsect1>
10935<title>IMPORTANT</title>
10936<para>
10937   This functions publishes the fb and makes it available for concurrent access
10938   by other users. Which means by this point the fb _must_ be fully set up -
10939   since all the fb attributes are invariant over its lifetime, no further
10940   locking but only correct reference counting is required.
10941</para>
10942</refsect1>
10943<refsect1>
10944<title>Returns</title>
10945<para>
10946   Zero on success, error code on failure.
10947</para>
10948</refsect1>
10949</refentry>
10950
10951<refentry id="API-drm-framebuffer-lookup">
10952<refentryinfo>
10953 <title>LINUX</title>
10954 <productname>Kernel Hackers Manual</productname>
10955 <date>July 2017</date>
10956</refentryinfo>
10957<refmeta>
10958 <refentrytitle><phrase>drm_framebuffer_lookup</phrase></refentrytitle>
10959 <manvolnum>9</manvolnum>
10960 <refmiscinfo class="version">4.4.14</refmiscinfo>
10961</refmeta>
10962<refnamediv>
10963 <refname>drm_framebuffer_lookup</refname>
10964 <refpurpose>
10965     look up a drm framebuffer and grab a reference
10966 </refpurpose>
10967</refnamediv>
10968<refsynopsisdiv>
10969 <title>Synopsis</title>
10970  <funcsynopsis><funcprototype>
10971   <funcdef>struct drm_framebuffer * <function>drm_framebuffer_lookup </function></funcdef>
10972   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
10973   <paramdef>uint32_t <parameter>id</parameter></paramdef>
10974  </funcprototype></funcsynopsis>
10975</refsynopsisdiv>
10976<refsect1>
10977 <title>Arguments</title>
10978 <variablelist>
10979  <varlistentry>
10980   <term><parameter>dev</parameter></term>
10981   <listitem>
10982    <para>
10983     drm device
10984    </para>
10985   </listitem>
10986  </varlistentry>
10987  <varlistentry>
10988   <term><parameter>id</parameter></term>
10989   <listitem>
10990    <para>
10991     id of the fb object
10992    </para>
10993   </listitem>
10994  </varlistentry>
10995 </variablelist>
10996</refsect1>
10997<refsect1>
10998<title>Description</title>
10999<para>
11000   If successful, this grabs an additional reference to the framebuffer -
11001   callers need to make sure to eventually unreference the returned framebuffer
11002   again, using <parameter>drm_framebuffer_unreference</parameter>.
11003</para>
11004</refsect1>
11005</refentry>
11006
11007<refentry id="API-drm-framebuffer-unreference">
11008<refentryinfo>
11009 <title>LINUX</title>
11010 <productname>Kernel Hackers Manual</productname>
11011 <date>July 2017</date>
11012</refentryinfo>
11013<refmeta>
11014 <refentrytitle><phrase>drm_framebuffer_unreference</phrase></refentrytitle>
11015 <manvolnum>9</manvolnum>
11016 <refmiscinfo class="version">4.4.14</refmiscinfo>
11017</refmeta>
11018<refnamediv>
11019 <refname>drm_framebuffer_unreference</refname>
11020 <refpurpose>
11021     unref a framebuffer
11022 </refpurpose>
11023</refnamediv>
11024<refsynopsisdiv>
11025 <title>Synopsis</title>
11026  <funcsynopsis><funcprototype>
11027   <funcdef>void <function>drm_framebuffer_unreference </function></funcdef>
11028   <paramdef>struct drm_framebuffer * <parameter>fb</parameter></paramdef>
11029  </funcprototype></funcsynopsis>
11030</refsynopsisdiv>
11031<refsect1>
11032 <title>Arguments</title>
11033 <variablelist>
11034  <varlistentry>
11035   <term><parameter>fb</parameter></term>
11036   <listitem>
11037    <para>
11038     framebuffer to unref
11039    </para>
11040   </listitem>
11041  </varlistentry>
11042 </variablelist>
11043</refsect1>
11044<refsect1>
11045<title>Description</title>
11046<para>
11047   This functions decrements the fb's refcount and frees it if it drops to zero.
11048</para>
11049</refsect1>
11050</refentry>
11051
11052<refentry id="API-drm-framebuffer-reference">
11053<refentryinfo>
11054 <title>LINUX</title>
11055 <productname>Kernel Hackers Manual</productname>
11056 <date>July 2017</date>
11057</refentryinfo>
11058<refmeta>
11059 <refentrytitle><phrase>drm_framebuffer_reference</phrase></refentrytitle>
11060 <manvolnum>9</manvolnum>
11061 <refmiscinfo class="version">4.4.14</refmiscinfo>
11062</refmeta>
11063<refnamediv>
11064 <refname>drm_framebuffer_reference</refname>
11065 <refpurpose>
11066     incr the fb refcnt
11067 </refpurpose>
11068</refnamediv>
11069<refsynopsisdiv>
11070 <title>Synopsis</title>
11071  <funcsynopsis><funcprototype>
11072   <funcdef>void <function>drm_framebuffer_reference </function></funcdef>
11073   <paramdef>struct drm_framebuffer * <parameter>fb</parameter></paramdef>
11074  </funcprototype></funcsynopsis>
11075</refsynopsisdiv>
11076<refsect1>
11077 <title>Arguments</title>
11078 <variablelist>
11079  <varlistentry>
11080   <term><parameter>fb</parameter></term>
11081   <listitem>
11082    <para>
11083     framebuffer
11084    </para>
11085   </listitem>
11086  </varlistentry>
11087 </variablelist>
11088</refsect1>
11089<refsect1>
11090<title>Description</title>
11091<para>
11092   This functions increments the fb's refcount.
11093</para>
11094</refsect1>
11095</refentry>
11096
11097<refentry id="API-drm-framebuffer-unregister-private">
11098<refentryinfo>
11099 <title>LINUX</title>
11100 <productname>Kernel Hackers Manual</productname>
11101 <date>July 2017</date>
11102</refentryinfo>
11103<refmeta>
11104 <refentrytitle><phrase>drm_framebuffer_unregister_private</phrase></refentrytitle>
11105 <manvolnum>9</manvolnum>
11106 <refmiscinfo class="version">4.4.14</refmiscinfo>
11107</refmeta>
11108<refnamediv>
11109 <refname>drm_framebuffer_unregister_private</refname>
11110 <refpurpose>
11111     unregister a private fb from the lookup idr
11112 </refpurpose>
11113</refnamediv>
11114<refsynopsisdiv>
11115 <title>Synopsis</title>
11116  <funcsynopsis><funcprototype>
11117   <funcdef>void <function>drm_framebuffer_unregister_private </function></funcdef>
11118   <paramdef>struct drm_framebuffer * <parameter>fb</parameter></paramdef>
11119  </funcprototype></funcsynopsis>
11120</refsynopsisdiv>
11121<refsect1>
11122 <title>Arguments</title>
11123 <variablelist>
11124  <varlistentry>
11125   <term><parameter>fb</parameter></term>
11126   <listitem>
11127    <para>
11128     fb to unregister
11129    </para>
11130   </listitem>
11131  </varlistentry>
11132 </variablelist>
11133</refsect1>
11134<refsect1>
11135<title>Description</title>
11136<para>
11137   Drivers need to call this when cleaning up driver-private framebuffers, e.g.
11138   those used for fbdev. Note that the caller must hold a reference of it's own,
11139   i.e. the object may not be destroyed through this call (since it'll lead to a
11140   locking inversion).
11141</para>
11142</refsect1>
11143</refentry>
11144
11145<refentry id="API-drm-framebuffer-cleanup">
11146<refentryinfo>
11147 <title>LINUX</title>
11148 <productname>Kernel Hackers Manual</productname>
11149 <date>July 2017</date>
11150</refentryinfo>
11151<refmeta>
11152 <refentrytitle><phrase>drm_framebuffer_cleanup</phrase></refentrytitle>
11153 <manvolnum>9</manvolnum>
11154 <refmiscinfo class="version">4.4.14</refmiscinfo>
11155</refmeta>
11156<refnamediv>
11157 <refname>drm_framebuffer_cleanup</refname>
11158 <refpurpose>
11159     remove a framebuffer object
11160 </refpurpose>
11161</refnamediv>
11162<refsynopsisdiv>
11163 <title>Synopsis</title>
11164  <funcsynopsis><funcprototype>
11165   <funcdef>void <function>drm_framebuffer_cleanup </function></funcdef>
11166   <paramdef>struct drm_framebuffer * <parameter>fb</parameter></paramdef>
11167  </funcprototype></funcsynopsis>
11168</refsynopsisdiv>
11169<refsect1>
11170 <title>Arguments</title>
11171 <variablelist>
11172  <varlistentry>
11173   <term><parameter>fb</parameter></term>
11174   <listitem>
11175    <para>
11176     framebuffer to remove
11177    </para>
11178   </listitem>
11179  </varlistentry>
11180 </variablelist>
11181</refsect1>
11182<refsect1>
11183<title>Description</title>
11184<para>
11185   Cleanup framebuffer. This function is intended to be used from the drivers
11186   -&gt;destroy callback. It can also be used to clean up driver private
11187   framebuffers embedded into a larger structure.
11188   </para><para>
11189
11190   Note that this function does not remove the fb from active usuage - if it is
11191   still used anywhere, hilarity can ensue since userspace could call getfb on
11192   the id and get back -EINVAL. Obviously no concern at driver unload time.
11193   </para><para>
11194
11195   Also, the framebuffer will not be removed from the lookup idr - for
11196   user-created framebuffers this will happen in in the rmfb ioctl. For
11197   driver-private objects (e.g. for fbdev) drivers need to explicitly call
11198   drm_framebuffer_unregister_private.
11199</para>
11200</refsect1>
11201</refentry>
11202
11203<refentry id="API-drm-framebuffer-remove">
11204<refentryinfo>
11205 <title>LINUX</title>
11206 <productname>Kernel Hackers Manual</productname>
11207 <date>July 2017</date>
11208</refentryinfo>
11209<refmeta>
11210 <refentrytitle><phrase>drm_framebuffer_remove</phrase></refentrytitle>
11211 <manvolnum>9</manvolnum>
11212 <refmiscinfo class="version">4.4.14</refmiscinfo>
11213</refmeta>
11214<refnamediv>
11215 <refname>drm_framebuffer_remove</refname>
11216 <refpurpose>
11217     remove and unreference a framebuffer object
11218 </refpurpose>
11219</refnamediv>
11220<refsynopsisdiv>
11221 <title>Synopsis</title>
11222  <funcsynopsis><funcprototype>
11223   <funcdef>void <function>drm_framebuffer_remove </function></funcdef>
11224   <paramdef>struct drm_framebuffer * <parameter>fb</parameter></paramdef>
11225  </funcprototype></funcsynopsis>
11226</refsynopsisdiv>
11227<refsect1>
11228 <title>Arguments</title>
11229 <variablelist>
11230  <varlistentry>
11231   <term><parameter>fb</parameter></term>
11232   <listitem>
11233    <para>
11234     framebuffer to remove
11235    </para>
11236   </listitem>
11237  </varlistentry>
11238 </variablelist>
11239</refsect1>
11240<refsect1>
11241<title>Description</title>
11242<para>
11243   Scans all the CRTCs and planes in <parameter>dev</parameter>'s mode_config.  If they're
11244   using <parameter>fb</parameter>, removes it, setting it to NULL. Then drops the reference to the
11245   passed-in framebuffer. Might take the modeset locks.
11246   </para><para>
11247
11248   Note that this function optimizes the cleanup away if the caller holds the
11249   last reference to the framebuffer. It is also guaranteed to not take the
11250   modeset locks in this case.
11251</para>
11252</refsect1>
11253</refentry>
11254
11255<refentry id="API-drm-crtc-init-with-planes">
11256<refentryinfo>
11257 <title>LINUX</title>
11258 <productname>Kernel Hackers Manual</productname>
11259 <date>July 2017</date>
11260</refentryinfo>
11261<refmeta>
11262 <refentrytitle><phrase>drm_crtc_init_with_planes</phrase></refentrytitle>
11263 <manvolnum>9</manvolnum>
11264 <refmiscinfo class="version">4.4.14</refmiscinfo>
11265</refmeta>
11266<refnamediv>
11267 <refname>drm_crtc_init_with_planes</refname>
11268 <refpurpose>
11269     Initialise a new CRTC object with specified primary and cursor planes.
11270 </refpurpose>
11271</refnamediv>
11272<refsynopsisdiv>
11273 <title>Synopsis</title>
11274  <funcsynopsis><funcprototype>
11275   <funcdef>int <function>drm_crtc_init_with_planes </function></funcdef>
11276   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
11277   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
11278   <paramdef>struct drm_plane * <parameter>primary</parameter></paramdef>
11279   <paramdef>struct drm_plane * <parameter>cursor</parameter></paramdef>
11280   <paramdef>const struct drm_crtc_funcs * <parameter>funcs</parameter></paramdef>
11281  </funcprototype></funcsynopsis>
11282</refsynopsisdiv>
11283<refsect1>
11284 <title>Arguments</title>
11285 <variablelist>
11286  <varlistentry>
11287   <term><parameter>dev</parameter></term>
11288   <listitem>
11289    <para>
11290     DRM device
11291    </para>
11292   </listitem>
11293  </varlistentry>
11294  <varlistentry>
11295   <term><parameter>crtc</parameter></term>
11296   <listitem>
11297    <para>
11298     CRTC object to init
11299    </para>
11300   </listitem>
11301  </varlistentry>
11302  <varlistentry>
11303   <term><parameter>primary</parameter></term>
11304   <listitem>
11305    <para>
11306     Primary plane for CRTC
11307    </para>
11308   </listitem>
11309  </varlistentry>
11310  <varlistentry>
11311   <term><parameter>cursor</parameter></term>
11312   <listitem>
11313    <para>
11314     Cursor plane for CRTC
11315    </para>
11316   </listitem>
11317  </varlistentry>
11318  <varlistentry>
11319   <term><parameter>funcs</parameter></term>
11320   <listitem>
11321    <para>
11322     callbacks for the new CRTC
11323    </para>
11324   </listitem>
11325  </varlistentry>
11326 </variablelist>
11327</refsect1>
11328<refsect1>
11329<title>Description</title>
11330<para>
11331   Inits a new object created as base part of a driver crtc object.
11332</para>
11333</refsect1>
11334<refsect1>
11335<title>Returns</title>
11336<para>
11337   Zero on success, error code on failure.
11338</para>
11339</refsect1>
11340</refentry>
11341
11342<refentry id="API-drm-crtc-cleanup">
11343<refentryinfo>
11344 <title>LINUX</title>
11345 <productname>Kernel Hackers Manual</productname>
11346 <date>July 2017</date>
11347</refentryinfo>
11348<refmeta>
11349 <refentrytitle><phrase>drm_crtc_cleanup</phrase></refentrytitle>
11350 <manvolnum>9</manvolnum>
11351 <refmiscinfo class="version">4.4.14</refmiscinfo>
11352</refmeta>
11353<refnamediv>
11354 <refname>drm_crtc_cleanup</refname>
11355 <refpurpose>
11356     Clean up the core crtc usage
11357 </refpurpose>
11358</refnamediv>
11359<refsynopsisdiv>
11360 <title>Synopsis</title>
11361  <funcsynopsis><funcprototype>
11362   <funcdef>void <function>drm_crtc_cleanup </function></funcdef>
11363   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
11364  </funcprototype></funcsynopsis>
11365</refsynopsisdiv>
11366<refsect1>
11367 <title>Arguments</title>
11368 <variablelist>
11369  <varlistentry>
11370   <term><parameter>crtc</parameter></term>
11371   <listitem>
11372    <para>
11373     CRTC to cleanup
11374    </para>
11375   </listitem>
11376  </varlistentry>
11377 </variablelist>
11378</refsect1>
11379<refsect1>
11380<title>Description</title>
11381<para>
11382   This function cleans up <parameter>crtc</parameter> and removes it from the DRM mode setting
11383   core. Note that the function does *not* free the crtc structure itself,
11384   this is the responsibility of the caller.
11385</para>
11386</refsect1>
11387</refentry>
11388
11389<refentry id="API-drm-crtc-index">
11390<refentryinfo>
11391 <title>LINUX</title>
11392 <productname>Kernel Hackers Manual</productname>
11393 <date>July 2017</date>
11394</refentryinfo>
11395<refmeta>
11396 <refentrytitle><phrase>drm_crtc_index</phrase></refentrytitle>
11397 <manvolnum>9</manvolnum>
11398 <refmiscinfo class="version">4.4.14</refmiscinfo>
11399</refmeta>
11400<refnamediv>
11401 <refname>drm_crtc_index</refname>
11402 <refpurpose>
11403     find the index of a registered CRTC
11404 </refpurpose>
11405</refnamediv>
11406<refsynopsisdiv>
11407 <title>Synopsis</title>
11408  <funcsynopsis><funcprototype>
11409   <funcdef>unsigned int <function>drm_crtc_index </function></funcdef>
11410   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
11411  </funcprototype></funcsynopsis>
11412</refsynopsisdiv>
11413<refsect1>
11414 <title>Arguments</title>
11415 <variablelist>
11416  <varlistentry>
11417   <term><parameter>crtc</parameter></term>
11418   <listitem>
11419    <para>
11420     CRTC to find index for
11421    </para>
11422   </listitem>
11423  </varlistentry>
11424 </variablelist>
11425</refsect1>
11426<refsect1>
11427<title>Description</title>
11428<para>
11429   Given a registered CRTC, return the index of that CRTC within a DRM
11430   device's list of CRTCs.
11431</para>
11432</refsect1>
11433</refentry>
11434
11435<refentry id="API-drm-display-info-set-bus-formats">
11436<refentryinfo>
11437 <title>LINUX</title>
11438 <productname>Kernel Hackers Manual</productname>
11439 <date>July 2017</date>
11440</refentryinfo>
11441<refmeta>
11442 <refentrytitle><phrase>drm_display_info_set_bus_formats</phrase></refentrytitle>
11443 <manvolnum>9</manvolnum>
11444 <refmiscinfo class="version">4.4.14</refmiscinfo>
11445</refmeta>
11446<refnamediv>
11447 <refname>drm_display_info_set_bus_formats</refname>
11448 <refpurpose>
11449     set the supported bus formats
11450 </refpurpose>
11451</refnamediv>
11452<refsynopsisdiv>
11453 <title>Synopsis</title>
11454  <funcsynopsis><funcprototype>
11455   <funcdef>int <function>drm_display_info_set_bus_formats </function></funcdef>
11456   <paramdef>struct drm_display_info * <parameter>info</parameter></paramdef>
11457   <paramdef>const u32 * <parameter>formats</parameter></paramdef>
11458   <paramdef>unsigned int <parameter>num_formats</parameter></paramdef>
11459  </funcprototype></funcsynopsis>
11460</refsynopsisdiv>
11461<refsect1>
11462 <title>Arguments</title>
11463 <variablelist>
11464  <varlistentry>
11465   <term><parameter>info</parameter></term>
11466   <listitem>
11467    <para>
11468     display info to store bus formats in
11469    </para>
11470   </listitem>
11471  </varlistentry>
11472  <varlistentry>
11473   <term><parameter>formats</parameter></term>
11474   <listitem>
11475    <para>
11476     array containing the supported bus formats
11477    </para>
11478   </listitem>
11479  </varlistentry>
11480  <varlistentry>
11481   <term><parameter>num_formats</parameter></term>
11482   <listitem>
11483    <para>
11484     the number of entries in the fmts array
11485    </para>
11486   </listitem>
11487  </varlistentry>
11488 </variablelist>
11489</refsect1>
11490<refsect1>
11491<title>Description</title>
11492<para>
11493   Store the supported bus formats in display info structure.
11494   See MEDIA_BUS_FMT_* definitions in include/uapi/linux/media-bus-format.h for
11495   a full list of available formats.
11496</para>
11497</refsect1>
11498</refentry>
11499
11500<refentry id="API-drm-connector-init">
11501<refentryinfo>
11502 <title>LINUX</title>
11503 <productname>Kernel Hackers Manual</productname>
11504 <date>July 2017</date>
11505</refentryinfo>
11506<refmeta>
11507 <refentrytitle><phrase>drm_connector_init</phrase></refentrytitle>
11508 <manvolnum>9</manvolnum>
11509 <refmiscinfo class="version">4.4.14</refmiscinfo>
11510</refmeta>
11511<refnamediv>
11512 <refname>drm_connector_init</refname>
11513 <refpurpose>
11514     Init a preallocated connector
11515 </refpurpose>
11516</refnamediv>
11517<refsynopsisdiv>
11518 <title>Synopsis</title>
11519  <funcsynopsis><funcprototype>
11520   <funcdef>int <function>drm_connector_init </function></funcdef>
11521   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
11522   <paramdef>struct drm_connector * <parameter>connector</parameter></paramdef>
11523   <paramdef>const struct drm_connector_funcs * <parameter>funcs</parameter></paramdef>
11524   <paramdef>int <parameter>connector_type</parameter></paramdef>
11525  </funcprototype></funcsynopsis>
11526</refsynopsisdiv>
11527<refsect1>
11528 <title>Arguments</title>
11529 <variablelist>
11530  <varlistentry>
11531   <term><parameter>dev</parameter></term>
11532   <listitem>
11533    <para>
11534     DRM device
11535    </para>
11536   </listitem>
11537  </varlistentry>
11538  <varlistentry>
11539   <term><parameter>connector</parameter></term>
11540   <listitem>
11541    <para>
11542     the connector to init
11543    </para>
11544   </listitem>
11545  </varlistentry>
11546  <varlistentry>
11547   <term><parameter>funcs</parameter></term>
11548   <listitem>
11549    <para>
11550     callbacks for this connector
11551    </para>
11552   </listitem>
11553  </varlistentry>
11554  <varlistentry>
11555   <term><parameter>connector_type</parameter></term>
11556   <listitem>
11557    <para>
11558     user visible type of the connector
11559    </para>
11560   </listitem>
11561  </varlistentry>
11562 </variablelist>
11563</refsect1>
11564<refsect1>
11565<title>Description</title>
11566<para>
11567   Initialises a preallocated connector. Connectors should be
11568   subclassed as part of driver connector objects.
11569</para>
11570</refsect1>
11571<refsect1>
11572<title>Returns</title>
11573<para>
11574   Zero on success, error code on failure.
11575</para>
11576</refsect1>
11577</refentry>
11578
11579<refentry id="API-drm-connector-cleanup">
11580<refentryinfo>
11581 <title>LINUX</title>
11582 <productname>Kernel Hackers Manual</productname>
11583 <date>July 2017</date>
11584</refentryinfo>
11585<refmeta>
11586 <refentrytitle><phrase>drm_connector_cleanup</phrase></refentrytitle>
11587 <manvolnum>9</manvolnum>
11588 <refmiscinfo class="version">4.4.14</refmiscinfo>
11589</refmeta>
11590<refnamediv>
11591 <refname>drm_connector_cleanup</refname>
11592 <refpurpose>
11593     cleans up an initialised connector
11594 </refpurpose>
11595</refnamediv>
11596<refsynopsisdiv>
11597 <title>Synopsis</title>
11598  <funcsynopsis><funcprototype>
11599   <funcdef>void <function>drm_connector_cleanup </function></funcdef>
11600   <paramdef>struct drm_connector * <parameter>connector</parameter></paramdef>
11601  </funcprototype></funcsynopsis>
11602</refsynopsisdiv>
11603<refsect1>
11604 <title>Arguments</title>
11605 <variablelist>
11606  <varlistentry>
11607   <term><parameter>connector</parameter></term>
11608   <listitem>
11609    <para>
11610     connector to cleanup
11611    </para>
11612   </listitem>
11613  </varlistentry>
11614 </variablelist>
11615</refsect1>
11616<refsect1>
11617<title>Description</title>
11618<para>
11619   Cleans up the connector but doesn't free the object.
11620</para>
11621</refsect1>
11622</refentry>
11623
11624<refentry id="API-drm-connector-index">
11625<refentryinfo>
11626 <title>LINUX</title>
11627 <productname>Kernel Hackers Manual</productname>
11628 <date>July 2017</date>
11629</refentryinfo>
11630<refmeta>
11631 <refentrytitle><phrase>drm_connector_index</phrase></refentrytitle>
11632 <manvolnum>9</manvolnum>
11633 <refmiscinfo class="version">4.4.14</refmiscinfo>
11634</refmeta>
11635<refnamediv>
11636 <refname>drm_connector_index</refname>
11637 <refpurpose>
11638     find the index of a registered connector
11639 </refpurpose>
11640</refnamediv>
11641<refsynopsisdiv>
11642 <title>Synopsis</title>
11643  <funcsynopsis><funcprototype>
11644   <funcdef>unsigned int <function>drm_connector_index </function></funcdef>
11645   <paramdef>struct drm_connector * <parameter>connector</parameter></paramdef>
11646  </funcprototype></funcsynopsis>
11647</refsynopsisdiv>
11648<refsect1>
11649 <title>Arguments</title>
11650 <variablelist>
11651  <varlistentry>
11652   <term><parameter>connector</parameter></term>
11653   <listitem>
11654    <para>
11655     connector to find index for
11656    </para>
11657   </listitem>
11658  </varlistentry>
11659 </variablelist>
11660</refsect1>
11661<refsect1>
11662<title>Description</title>
11663<para>
11664   Given a registered connector, return the index of that connector within a DRM
11665   device's list of connectors.
11666</para>
11667</refsect1>
11668</refentry>
11669
11670<refentry id="API-drm-connector-register">
11671<refentryinfo>
11672 <title>LINUX</title>
11673 <productname>Kernel Hackers Manual</productname>
11674 <date>July 2017</date>
11675</refentryinfo>
11676<refmeta>
11677 <refentrytitle><phrase>drm_connector_register</phrase></refentrytitle>
11678 <manvolnum>9</manvolnum>
11679 <refmiscinfo class="version">4.4.14</refmiscinfo>
11680</refmeta>
11681<refnamediv>
11682 <refname>drm_connector_register</refname>
11683 <refpurpose>
11684     register a connector
11685 </refpurpose>
11686</refnamediv>
11687<refsynopsisdiv>
11688 <title>Synopsis</title>
11689  <funcsynopsis><funcprototype>
11690   <funcdef>int <function>drm_connector_register </function></funcdef>
11691   <paramdef>struct drm_connector * <parameter>connector</parameter></paramdef>
11692  </funcprototype></funcsynopsis>
11693</refsynopsisdiv>
11694<refsect1>
11695 <title>Arguments</title>
11696 <variablelist>
11697  <varlistentry>
11698   <term><parameter>connector</parameter></term>
11699   <listitem>
11700    <para>
11701     the connector to register
11702    </para>
11703   </listitem>
11704  </varlistentry>
11705 </variablelist>
11706</refsect1>
11707<refsect1>
11708<title>Description</title>
11709<para>
11710   Register userspace interfaces for a connector
11711</para>
11712</refsect1>
11713<refsect1>
11714<title>Returns</title>
11715<para>
11716   Zero on success, error code on failure.
11717</para>
11718</refsect1>
11719</refentry>
11720
11721<refentry id="API-drm-connector-unregister">
11722<refentryinfo>
11723 <title>LINUX</title>
11724 <productname>Kernel Hackers Manual</productname>
11725 <date>July 2017</date>
11726</refentryinfo>
11727<refmeta>
11728 <refentrytitle><phrase>drm_connector_unregister</phrase></refentrytitle>
11729 <manvolnum>9</manvolnum>
11730 <refmiscinfo class="version">4.4.14</refmiscinfo>
11731</refmeta>
11732<refnamediv>
11733 <refname>drm_connector_unregister</refname>
11734 <refpurpose>
11735     unregister a connector
11736 </refpurpose>
11737</refnamediv>
11738<refsynopsisdiv>
11739 <title>Synopsis</title>
11740  <funcsynopsis><funcprototype>
11741   <funcdef>void <function>drm_connector_unregister </function></funcdef>
11742   <paramdef>struct drm_connector * <parameter>connector</parameter></paramdef>
11743  </funcprototype></funcsynopsis>
11744</refsynopsisdiv>
11745<refsect1>
11746 <title>Arguments</title>
11747 <variablelist>
11748  <varlistentry>
11749   <term><parameter>connector</parameter></term>
11750   <listitem>
11751    <para>
11752     the connector to unregister
11753    </para>
11754   </listitem>
11755  </varlistentry>
11756 </variablelist>
11757</refsect1>
11758<refsect1>
11759<title>Description</title>
11760<para>
11761   Unregister userspace interfaces for a connector
11762</para>
11763</refsect1>
11764</refentry>
11765
11766<refentry id="API-drm-connector-unplug-all">
11767<refentryinfo>
11768 <title>LINUX</title>
11769 <productname>Kernel Hackers Manual</productname>
11770 <date>July 2017</date>
11771</refentryinfo>
11772<refmeta>
11773 <refentrytitle><phrase>drm_connector_unplug_all</phrase></refentrytitle>
11774 <manvolnum>9</manvolnum>
11775 <refmiscinfo class="version">4.4.14</refmiscinfo>
11776</refmeta>
11777<refnamediv>
11778 <refname>drm_connector_unplug_all</refname>
11779 <refpurpose>
11780     unregister connector userspace interfaces
11781 </refpurpose>
11782</refnamediv>
11783<refsynopsisdiv>
11784 <title>Synopsis</title>
11785  <funcsynopsis><funcprototype>
11786   <funcdef>void <function>drm_connector_unplug_all </function></funcdef>
11787   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
11788  </funcprototype></funcsynopsis>
11789</refsynopsisdiv>
11790<refsect1>
11791 <title>Arguments</title>
11792 <variablelist>
11793  <varlistentry>
11794   <term><parameter>dev</parameter></term>
11795   <listitem>
11796    <para>
11797     drm device
11798    </para>
11799   </listitem>
11800  </varlistentry>
11801 </variablelist>
11802</refsect1>
11803<refsect1>
11804<title>Description</title>
11805<para>
11806   This function unregisters all connector userspace interfaces in sysfs. Should
11807   be call when the device is disconnected, e.g. from an usb driver's
11808   -&gt;disconnect callback.
11809</para>
11810</refsect1>
11811</refentry>
11812
11813<refentry id="API-drm-encoder-init">
11814<refentryinfo>
11815 <title>LINUX</title>
11816 <productname>Kernel Hackers Manual</productname>
11817 <date>July 2017</date>
11818</refentryinfo>
11819<refmeta>
11820 <refentrytitle><phrase>drm_encoder_init</phrase></refentrytitle>
11821 <manvolnum>9</manvolnum>
11822 <refmiscinfo class="version">4.4.14</refmiscinfo>
11823</refmeta>
11824<refnamediv>
11825 <refname>drm_encoder_init</refname>
11826 <refpurpose>
11827     Init a preallocated encoder
11828 </refpurpose>
11829</refnamediv>
11830<refsynopsisdiv>
11831 <title>Synopsis</title>
11832  <funcsynopsis><funcprototype>
11833   <funcdef>int <function>drm_encoder_init </function></funcdef>
11834   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
11835   <paramdef>struct drm_encoder * <parameter>encoder</parameter></paramdef>
11836   <paramdef>const struct drm_encoder_funcs * <parameter>funcs</parameter></paramdef>
11837   <paramdef>int <parameter>encoder_type</parameter></paramdef>
11838  </funcprototype></funcsynopsis>
11839</refsynopsisdiv>
11840<refsect1>
11841 <title>Arguments</title>
11842 <variablelist>
11843  <varlistentry>
11844   <term><parameter>dev</parameter></term>
11845   <listitem>
11846    <para>
11847     drm device
11848    </para>
11849   </listitem>
11850  </varlistentry>
11851  <varlistentry>
11852   <term><parameter>encoder</parameter></term>
11853   <listitem>
11854    <para>
11855     the encoder to init
11856    </para>
11857   </listitem>
11858  </varlistentry>
11859  <varlistentry>
11860   <term><parameter>funcs</parameter></term>
11861   <listitem>
11862    <para>
11863     callbacks for this encoder
11864    </para>
11865   </listitem>
11866  </varlistentry>
11867  <varlistentry>
11868   <term><parameter>encoder_type</parameter></term>
11869   <listitem>
11870    <para>
11871     user visible type of the encoder
11872    </para>
11873   </listitem>
11874  </varlistentry>
11875 </variablelist>
11876</refsect1>
11877<refsect1>
11878<title>Description</title>
11879<para>
11880   Initialises a preallocated encoder. Encoder should be
11881   subclassed as part of driver encoder objects.
11882</para>
11883</refsect1>
11884<refsect1>
11885<title>Returns</title>
11886<para>
11887   Zero on success, error code on failure.
11888</para>
11889</refsect1>
11890</refentry>
11891
11892<refentry id="API-drm-encoder-cleanup">
11893<refentryinfo>
11894 <title>LINUX</title>
11895 <productname>Kernel Hackers Manual</productname>
11896 <date>July 2017</date>
11897</refentryinfo>
11898<refmeta>
11899 <refentrytitle><phrase>drm_encoder_cleanup</phrase></refentrytitle>
11900 <manvolnum>9</manvolnum>
11901 <refmiscinfo class="version">4.4.14</refmiscinfo>
11902</refmeta>
11903<refnamediv>
11904 <refname>drm_encoder_cleanup</refname>
11905 <refpurpose>
11906     cleans up an initialised encoder
11907 </refpurpose>
11908</refnamediv>
11909<refsynopsisdiv>
11910 <title>Synopsis</title>
11911  <funcsynopsis><funcprototype>
11912   <funcdef>void <function>drm_encoder_cleanup </function></funcdef>
11913   <paramdef>struct drm_encoder * <parameter>encoder</parameter></paramdef>
11914  </funcprototype></funcsynopsis>
11915</refsynopsisdiv>
11916<refsect1>
11917 <title>Arguments</title>
11918 <variablelist>
11919  <varlistentry>
11920   <term><parameter>encoder</parameter></term>
11921   <listitem>
11922    <para>
11923     encoder to cleanup
11924    </para>
11925   </listitem>
11926  </varlistentry>
11927 </variablelist>
11928</refsect1>
11929<refsect1>
11930<title>Description</title>
11931<para>
11932   Cleans up the encoder but doesn't free the object.
11933</para>
11934</refsect1>
11935</refentry>
11936
11937<refentry id="API-drm-universal-plane-init">
11938<refentryinfo>
11939 <title>LINUX</title>
11940 <productname>Kernel Hackers Manual</productname>
11941 <date>July 2017</date>
11942</refentryinfo>
11943<refmeta>
11944 <refentrytitle><phrase>drm_universal_plane_init</phrase></refentrytitle>
11945 <manvolnum>9</manvolnum>
11946 <refmiscinfo class="version">4.4.14</refmiscinfo>
11947</refmeta>
11948<refnamediv>
11949 <refname>drm_universal_plane_init</refname>
11950 <refpurpose>
11951     Initialize a new universal plane object
11952 </refpurpose>
11953</refnamediv>
11954<refsynopsisdiv>
11955 <title>Synopsis</title>
11956  <funcsynopsis><funcprototype>
11957   <funcdef>int <function>drm_universal_plane_init </function></funcdef>
11958   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
11959   <paramdef>struct drm_plane * <parameter>plane</parameter></paramdef>
11960   <paramdef>unsigned long <parameter>possible_crtcs</parameter></paramdef>
11961   <paramdef>const struct drm_plane_funcs * <parameter>funcs</parameter></paramdef>
11962   <paramdef>const uint32_t * <parameter>formats</parameter></paramdef>
11963   <paramdef>unsigned int <parameter>format_count</parameter></paramdef>
11964   <paramdef>enum drm_plane_type <parameter>type</parameter></paramdef>
11965  </funcprototype></funcsynopsis>
11966</refsynopsisdiv>
11967<refsect1>
11968 <title>Arguments</title>
11969 <variablelist>
11970  <varlistentry>
11971   <term><parameter>dev</parameter></term>
11972   <listitem>
11973    <para>
11974     DRM device
11975    </para>
11976   </listitem>
11977  </varlistentry>
11978  <varlistentry>
11979   <term><parameter>plane</parameter></term>
11980   <listitem>
11981    <para>
11982     plane object to init
11983    </para>
11984   </listitem>
11985  </varlistentry>
11986  <varlistentry>
11987   <term><parameter>possible_crtcs</parameter></term>
11988   <listitem>
11989    <para>
11990     bitmask of possible CRTCs
11991    </para>
11992   </listitem>
11993  </varlistentry>
11994  <varlistentry>
11995   <term><parameter>funcs</parameter></term>
11996   <listitem>
11997    <para>
11998     callbacks for the new plane
11999    </para>
12000   </listitem>
12001  </varlistentry>
12002  <varlistentry>
12003   <term><parameter>formats</parameter></term>
12004   <listitem>
12005    <para>
12006     array of supported formats (<constant>DRM_FORMAT_</constant>*)
12007    </para>
12008   </listitem>
12009  </varlistentry>
12010  <varlistentry>
12011   <term><parameter>format_count</parameter></term>
12012   <listitem>
12013    <para>
12014     number of elements in <parameter>formats</parameter>
12015    </para>
12016   </listitem>
12017  </varlistentry>
12018  <varlistentry>
12019   <term><parameter>type</parameter></term>
12020   <listitem>
12021    <para>
12022     type of plane (overlay, primary, cursor)
12023    </para>
12024   </listitem>
12025  </varlistentry>
12026 </variablelist>
12027</refsect1>
12028<refsect1>
12029<title>Description</title>
12030<para>
12031   Initializes a plane object of type <parameter>type</parameter>.
12032</para>
12033</refsect1>
12034<refsect1>
12035<title>Returns</title>
12036<para>
12037   Zero on success, error code on failure.
12038</para>
12039</refsect1>
12040</refentry>
12041
12042<refentry id="API-drm-plane-init">
12043<refentryinfo>
12044 <title>LINUX</title>
12045 <productname>Kernel Hackers Manual</productname>
12046 <date>July 2017</date>
12047</refentryinfo>
12048<refmeta>
12049 <refentrytitle><phrase>drm_plane_init</phrase></refentrytitle>
12050 <manvolnum>9</manvolnum>
12051 <refmiscinfo class="version">4.4.14</refmiscinfo>
12052</refmeta>
12053<refnamediv>
12054 <refname>drm_plane_init</refname>
12055 <refpurpose>
12056     Initialize a legacy plane
12057 </refpurpose>
12058</refnamediv>
12059<refsynopsisdiv>
12060 <title>Synopsis</title>
12061  <funcsynopsis><funcprototype>
12062   <funcdef>int <function>drm_plane_init </function></funcdef>
12063   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
12064   <paramdef>struct drm_plane * <parameter>plane</parameter></paramdef>
12065   <paramdef>unsigned long <parameter>possible_crtcs</parameter></paramdef>
12066   <paramdef>const struct drm_plane_funcs * <parameter>funcs</parameter></paramdef>
12067   <paramdef>const uint32_t * <parameter>formats</parameter></paramdef>
12068   <paramdef>unsigned int <parameter>format_count</parameter></paramdef>
12069   <paramdef>bool <parameter>is_primary</parameter></paramdef>
12070  </funcprototype></funcsynopsis>
12071</refsynopsisdiv>
12072<refsect1>
12073 <title>Arguments</title>
12074 <variablelist>
12075  <varlistentry>
12076   <term><parameter>dev</parameter></term>
12077   <listitem>
12078    <para>
12079     DRM device
12080    </para>
12081   </listitem>
12082  </varlistentry>
12083  <varlistentry>
12084   <term><parameter>plane</parameter></term>
12085   <listitem>
12086    <para>
12087     plane object to init
12088    </para>
12089   </listitem>
12090  </varlistentry>
12091  <varlistentry>
12092   <term><parameter>possible_crtcs</parameter></term>
12093   <listitem>
12094    <para>
12095     bitmask of possible CRTCs
12096    </para>
12097   </listitem>
12098  </varlistentry>
12099  <varlistentry>
12100   <term><parameter>funcs</parameter></term>
12101   <listitem>
12102    <para>
12103     callbacks for the new plane
12104    </para>
12105   </listitem>
12106  </varlistentry>
12107  <varlistentry>
12108   <term><parameter>formats</parameter></term>
12109   <listitem>
12110    <para>
12111     array of supported formats (<constant>DRM_FORMAT_</constant>*)
12112    </para>
12113   </listitem>
12114  </varlistentry>
12115  <varlistentry>
12116   <term><parameter>format_count</parameter></term>
12117   <listitem>
12118    <para>
12119     number of elements in <parameter>formats</parameter>
12120    </para>
12121   </listitem>
12122  </varlistentry>
12123  <varlistentry>
12124   <term><parameter>is_primary</parameter></term>
12125   <listitem>
12126    <para>
12127     plane type (primary vs overlay)
12128    </para>
12129   </listitem>
12130  </varlistentry>
12131 </variablelist>
12132</refsect1>
12133<refsect1>
12134<title>Description</title>
12135<para>
12136   Legacy API to initialize a DRM plane.
12137   </para><para>
12138
12139   New drivers should call <function>drm_universal_plane_init</function> instead.
12140</para>
12141</refsect1>
12142<refsect1>
12143<title>Returns</title>
12144<para>
12145   Zero on success, error code on failure.
12146</para>
12147</refsect1>
12148</refentry>
12149
12150<refentry id="API-drm-plane-cleanup">
12151<refentryinfo>
12152 <title>LINUX</title>
12153 <productname>Kernel Hackers Manual</productname>
12154 <date>July 2017</date>
12155</refentryinfo>
12156<refmeta>
12157 <refentrytitle><phrase>drm_plane_cleanup</phrase></refentrytitle>
12158 <manvolnum>9</manvolnum>
12159 <refmiscinfo class="version">4.4.14</refmiscinfo>
12160</refmeta>
12161<refnamediv>
12162 <refname>drm_plane_cleanup</refname>
12163 <refpurpose>
12164     Clean up the core plane usage
12165 </refpurpose>
12166</refnamediv>
12167<refsynopsisdiv>
12168 <title>Synopsis</title>
12169  <funcsynopsis><funcprototype>
12170   <funcdef>void <function>drm_plane_cleanup </function></funcdef>
12171   <paramdef>struct drm_plane * <parameter>plane</parameter></paramdef>
12172  </funcprototype></funcsynopsis>
12173</refsynopsisdiv>
12174<refsect1>
12175 <title>Arguments</title>
12176 <variablelist>
12177  <varlistentry>
12178   <term><parameter>plane</parameter></term>
12179   <listitem>
12180    <para>
12181     plane to cleanup
12182    </para>
12183   </listitem>
12184  </varlistentry>
12185 </variablelist>
12186</refsect1>
12187<refsect1>
12188<title>Description</title>
12189<para>
12190   This function cleans up <parameter>plane</parameter> and removes it from the DRM mode setting
12191   core. Note that the function does *not* free the plane structure itself,
12192   this is the responsibility of the caller.
12193</para>
12194</refsect1>
12195</refentry>
12196
12197<refentry id="API-drm-plane-index">
12198<refentryinfo>
12199 <title>LINUX</title>
12200 <productname>Kernel Hackers Manual</productname>
12201 <date>July 2017</date>
12202</refentryinfo>
12203<refmeta>
12204 <refentrytitle><phrase>drm_plane_index</phrase></refentrytitle>
12205 <manvolnum>9</manvolnum>
12206 <refmiscinfo class="version">4.4.14</refmiscinfo>
12207</refmeta>
12208<refnamediv>
12209 <refname>drm_plane_index</refname>
12210 <refpurpose>
12211     find the index of a registered plane
12212 </refpurpose>
12213</refnamediv>
12214<refsynopsisdiv>
12215 <title>Synopsis</title>
12216  <funcsynopsis><funcprototype>
12217   <funcdef>unsigned int <function>drm_plane_index </function></funcdef>
12218   <paramdef>struct drm_plane * <parameter>plane</parameter></paramdef>
12219  </funcprototype></funcsynopsis>
12220</refsynopsisdiv>
12221<refsect1>
12222 <title>Arguments</title>
12223 <variablelist>
12224  <varlistentry>
12225   <term><parameter>plane</parameter></term>
12226   <listitem>
12227    <para>
12228     plane to find index for
12229    </para>
12230   </listitem>
12231  </varlistentry>
12232 </variablelist>
12233</refsect1>
12234<refsect1>
12235<title>Description</title>
12236<para>
12237   Given a registered plane, return the index of that CRTC within a DRM
12238   device's list of planes.
12239</para>
12240</refsect1>
12241</refentry>
12242
12243<refentry id="API-drm-plane-from-index">
12244<refentryinfo>
12245 <title>LINUX</title>
12246 <productname>Kernel Hackers Manual</productname>
12247 <date>July 2017</date>
12248</refentryinfo>
12249<refmeta>
12250 <refentrytitle><phrase>drm_plane_from_index</phrase></refentrytitle>
12251 <manvolnum>9</manvolnum>
12252 <refmiscinfo class="version">4.4.14</refmiscinfo>
12253</refmeta>
12254<refnamediv>
12255 <refname>drm_plane_from_index</refname>
12256 <refpurpose>
12257     find the registered plane at an index
12258 </refpurpose>
12259</refnamediv>
12260<refsynopsisdiv>
12261 <title>Synopsis</title>
12262  <funcsynopsis><funcprototype>
12263   <funcdef>struct drm_plane * <function>drm_plane_from_index </function></funcdef>
12264   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
12265   <paramdef>int <parameter>idx</parameter></paramdef>
12266  </funcprototype></funcsynopsis>
12267</refsynopsisdiv>
12268<refsect1>
12269 <title>Arguments</title>
12270 <variablelist>
12271  <varlistentry>
12272   <term><parameter>dev</parameter></term>
12273   <listitem>
12274    <para>
12275     DRM device
12276    </para>
12277   </listitem>
12278  </varlistentry>
12279  <varlistentry>
12280   <term><parameter>idx</parameter></term>
12281   <listitem>
12282    <para>
12283     index of registered plane to find for
12284    </para>
12285   </listitem>
12286  </varlistentry>
12287 </variablelist>
12288</refsect1>
12289<refsect1>
12290<title>Description</title>
12291<para>
12292   Given a plane index, return the registered plane from DRM device's
12293   list of planes with matching index.
12294</para>
12295</refsect1>
12296</refentry>
12297
12298<refentry id="API-drm-plane-force-disable">
12299<refentryinfo>
12300 <title>LINUX</title>
12301 <productname>Kernel Hackers Manual</productname>
12302 <date>July 2017</date>
12303</refentryinfo>
12304<refmeta>
12305 <refentrytitle><phrase>drm_plane_force_disable</phrase></refentrytitle>
12306 <manvolnum>9</manvolnum>
12307 <refmiscinfo class="version">4.4.14</refmiscinfo>
12308</refmeta>
12309<refnamediv>
12310 <refname>drm_plane_force_disable</refname>
12311 <refpurpose>
12312     Forcibly disable a plane
12313 </refpurpose>
12314</refnamediv>
12315<refsynopsisdiv>
12316 <title>Synopsis</title>
12317  <funcsynopsis><funcprototype>
12318   <funcdef>void <function>drm_plane_force_disable </function></funcdef>
12319   <paramdef>struct drm_plane * <parameter>plane</parameter></paramdef>
12320  </funcprototype></funcsynopsis>
12321</refsynopsisdiv>
12322<refsect1>
12323 <title>Arguments</title>
12324 <variablelist>
12325  <varlistentry>
12326   <term><parameter>plane</parameter></term>
12327   <listitem>
12328    <para>
12329     plane to disable
12330    </para>
12331   </listitem>
12332  </varlistentry>
12333 </variablelist>
12334</refsect1>
12335<refsect1>
12336<title>Description</title>
12337<para>
12338   Forces the plane to be disabled.
12339   </para><para>
12340
12341   Used when the plane's current framebuffer is destroyed,
12342   and when restoring fbdev mode.
12343</para>
12344</refsect1>
12345</refentry>
12346
12347<refentry id="API-drm-mode-create-dvi-i-properties">
12348<refentryinfo>
12349 <title>LINUX</title>
12350 <productname>Kernel Hackers Manual</productname>
12351 <date>July 2017</date>
12352</refentryinfo>
12353<refmeta>
12354 <refentrytitle><phrase>drm_mode_create_dvi_i_properties</phrase></refentrytitle>
12355 <manvolnum>9</manvolnum>
12356 <refmiscinfo class="version">4.4.14</refmiscinfo>
12357</refmeta>
12358<refnamediv>
12359 <refname>drm_mode_create_dvi_i_properties</refname>
12360 <refpurpose>
12361     create DVI-I specific connector properties
12362 </refpurpose>
12363</refnamediv>
12364<refsynopsisdiv>
12365 <title>Synopsis</title>
12366  <funcsynopsis><funcprototype>
12367   <funcdef>int <function>drm_mode_create_dvi_i_properties </function></funcdef>
12368   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
12369  </funcprototype></funcsynopsis>
12370</refsynopsisdiv>
12371<refsect1>
12372 <title>Arguments</title>
12373 <variablelist>
12374  <varlistentry>
12375   <term><parameter>dev</parameter></term>
12376   <listitem>
12377    <para>
12378     DRM device
12379    </para>
12380   </listitem>
12381  </varlistentry>
12382 </variablelist>
12383</refsect1>
12384<refsect1>
12385<title>Description</title>
12386<para>
12387   Called by a driver the first time a DVI-I connector is made.
12388</para>
12389</refsect1>
12390</refentry>
12391
12392<refentry id="API-drm-mode-create-tv-properties">
12393<refentryinfo>
12394 <title>LINUX</title>
12395 <productname>Kernel Hackers Manual</productname>
12396 <date>July 2017</date>
12397</refentryinfo>
12398<refmeta>
12399 <refentrytitle><phrase>drm_mode_create_tv_properties</phrase></refentrytitle>
12400 <manvolnum>9</manvolnum>
12401 <refmiscinfo class="version">4.4.14</refmiscinfo>
12402</refmeta>
12403<refnamediv>
12404 <refname>drm_mode_create_tv_properties</refname>
12405 <refpurpose>
12406     create TV specific connector properties
12407 </refpurpose>
12408</refnamediv>
12409<refsynopsisdiv>
12410 <title>Synopsis</title>
12411  <funcsynopsis><funcprototype>
12412   <funcdef>int <function>drm_mode_create_tv_properties </function></funcdef>
12413   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
12414   <paramdef>unsigned int <parameter>num_modes</parameter></paramdef>
12415   <paramdef>const char *const <parameter>modes[]</parameter></paramdef>
12416  </funcprototype></funcsynopsis>
12417</refsynopsisdiv>
12418<refsect1>
12419 <title>Arguments</title>
12420 <variablelist>
12421  <varlistentry>
12422   <term><parameter>dev</parameter></term>
12423   <listitem>
12424    <para>
12425     DRM device
12426    </para>
12427   </listitem>
12428  </varlistentry>
12429  <varlistentry>
12430   <term><parameter>num_modes</parameter></term>
12431   <listitem>
12432    <para>
12433     number of different TV formats (modes) supported
12434    </para>
12435   </listitem>
12436  </varlistentry>
12437  <varlistentry>
12438   <term><parameter>modes[]</parameter></term>
12439   <listitem>
12440    <para>
12441     array of pointers to strings containing name of each format
12442    </para>
12443   </listitem>
12444  </varlistentry>
12445 </variablelist>
12446</refsect1>
12447<refsect1>
12448<title>Description</title>
12449<para>
12450   Called by a driver's TV initialization routine, this function creates
12451   the TV specific connector properties for a given device.  Caller is
12452   responsible for allocating a list of format names and passing them to
12453   this routine.
12454</para>
12455</refsect1>
12456</refentry>
12457
12458<refentry id="API-drm-mode-create-scaling-mode-property">
12459<refentryinfo>
12460 <title>LINUX</title>
12461 <productname>Kernel Hackers Manual</productname>
12462 <date>July 2017</date>
12463</refentryinfo>
12464<refmeta>
12465 <refentrytitle><phrase>drm_mode_create_scaling_mode_property</phrase></refentrytitle>
12466 <manvolnum>9</manvolnum>
12467 <refmiscinfo class="version">4.4.14</refmiscinfo>
12468</refmeta>
12469<refnamediv>
12470 <refname>drm_mode_create_scaling_mode_property</refname>
12471 <refpurpose>
12472     create scaling mode property
12473 </refpurpose>
12474</refnamediv>
12475<refsynopsisdiv>
12476 <title>Synopsis</title>
12477  <funcsynopsis><funcprototype>
12478   <funcdef>int <function>drm_mode_create_scaling_mode_property </function></funcdef>
12479   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
12480  </funcprototype></funcsynopsis>
12481</refsynopsisdiv>
12482<refsect1>
12483 <title>Arguments</title>
12484 <variablelist>
12485  <varlistentry>
12486   <term><parameter>dev</parameter></term>
12487   <listitem>
12488    <para>
12489     DRM device
12490    </para>
12491   </listitem>
12492  </varlistentry>
12493 </variablelist>
12494</refsect1>
12495<refsect1>
12496<title>Description</title>
12497<para>
12498   Called by a driver the first time it's needed, must be attached to desired
12499   connectors.
12500</para>
12501</refsect1>
12502</refentry>
12503
12504<refentry id="API-drm-mode-create-aspect-ratio-property">
12505<refentryinfo>
12506 <title>LINUX</title>
12507 <productname>Kernel Hackers Manual</productname>
12508 <date>July 2017</date>
12509</refentryinfo>
12510<refmeta>
12511 <refentrytitle><phrase>drm_mode_create_aspect_ratio_property</phrase></refentrytitle>
12512 <manvolnum>9</manvolnum>
12513 <refmiscinfo class="version">4.4.14</refmiscinfo>
12514</refmeta>
12515<refnamediv>
12516 <refname>drm_mode_create_aspect_ratio_property</refname>
12517 <refpurpose>
12518     create aspect ratio property
12519 </refpurpose>
12520</refnamediv>
12521<refsynopsisdiv>
12522 <title>Synopsis</title>
12523  <funcsynopsis><funcprototype>
12524   <funcdef>int <function>drm_mode_create_aspect_ratio_property </function></funcdef>
12525   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
12526  </funcprototype></funcsynopsis>
12527</refsynopsisdiv>
12528<refsect1>
12529 <title>Arguments</title>
12530 <variablelist>
12531  <varlistentry>
12532   <term><parameter>dev</parameter></term>
12533   <listitem>
12534    <para>
12535     DRM device
12536    </para>
12537   </listitem>
12538  </varlistentry>
12539 </variablelist>
12540</refsect1>
12541<refsect1>
12542<title>Description</title>
12543<para>
12544   Called by a driver the first time it's needed, must be attached to desired
12545   connectors.
12546</para>
12547</refsect1>
12548<refsect1>
12549<title>Returns</title>
12550<para>
12551   Zero on success, negative errno on failure.
12552</para>
12553</refsect1>
12554</refentry>
12555
12556<refentry id="API-drm-mode-create-dirty-info-property">
12557<refentryinfo>
12558 <title>LINUX</title>
12559 <productname>Kernel Hackers Manual</productname>
12560 <date>July 2017</date>
12561</refentryinfo>
12562<refmeta>
12563 <refentrytitle><phrase>drm_mode_create_dirty_info_property</phrase></refentrytitle>
12564 <manvolnum>9</manvolnum>
12565 <refmiscinfo class="version">4.4.14</refmiscinfo>
12566</refmeta>
12567<refnamediv>
12568 <refname>drm_mode_create_dirty_info_property</refname>
12569 <refpurpose>
12570     create dirty property
12571 </refpurpose>
12572</refnamediv>
12573<refsynopsisdiv>
12574 <title>Synopsis</title>
12575  <funcsynopsis><funcprototype>
12576   <funcdef>int <function>drm_mode_create_dirty_info_property </function></funcdef>
12577   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
12578  </funcprototype></funcsynopsis>
12579</refsynopsisdiv>
12580<refsect1>
12581 <title>Arguments</title>
12582 <variablelist>
12583  <varlistentry>
12584   <term><parameter>dev</parameter></term>
12585   <listitem>
12586    <para>
12587     DRM device
12588    </para>
12589   </listitem>
12590  </varlistentry>
12591 </variablelist>
12592</refsect1>
12593<refsect1>
12594<title>Description</title>
12595<para>
12596   Called by a driver the first time it's needed, must be attached to desired
12597   connectors.
12598</para>
12599</refsect1>
12600</refentry>
12601
12602<refentry id="API-drm-mode-create-suggested-offset-properties">
12603<refentryinfo>
12604 <title>LINUX</title>
12605 <productname>Kernel Hackers Manual</productname>
12606 <date>July 2017</date>
12607</refentryinfo>
12608<refmeta>
12609 <refentrytitle><phrase>drm_mode_create_suggested_offset_properties</phrase></refentrytitle>
12610 <manvolnum>9</manvolnum>
12611 <refmiscinfo class="version">4.4.14</refmiscinfo>
12612</refmeta>
12613<refnamediv>
12614 <refname>drm_mode_create_suggested_offset_properties</refname>
12615 <refpurpose>
12616     create suggests offset properties
12617 </refpurpose>
12618</refnamediv>
12619<refsynopsisdiv>
12620 <title>Synopsis</title>
12621  <funcsynopsis><funcprototype>
12622   <funcdef>int <function>drm_mode_create_suggested_offset_properties </function></funcdef>
12623   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
12624  </funcprototype></funcsynopsis>
12625</refsynopsisdiv>
12626<refsect1>
12627 <title>Arguments</title>
12628 <variablelist>
12629  <varlistentry>
12630   <term><parameter>dev</parameter></term>
12631   <listitem>
12632    <para>
12633     DRM device
12634    </para>
12635   </listitem>
12636  </varlistentry>
12637 </variablelist>
12638</refsect1>
12639<refsect1>
12640<title>Description</title>
12641<para>
12642   Create the the suggested x/y offset property for connectors.
12643</para>
12644</refsect1>
12645</refentry>
12646
12647<refentry id="API-drm-mode-set-config-internal">
12648<refentryinfo>
12649 <title>LINUX</title>
12650 <productname>Kernel Hackers Manual</productname>
12651 <date>July 2017</date>
12652</refentryinfo>
12653<refmeta>
12654 <refentrytitle><phrase>drm_mode_set_config_internal</phrase></refentrytitle>
12655 <manvolnum>9</manvolnum>
12656 <refmiscinfo class="version">4.4.14</refmiscinfo>
12657</refmeta>
12658<refnamediv>
12659 <refname>drm_mode_set_config_internal</refname>
12660 <refpurpose>
12661     helper to call -&gt;set_config
12662 </refpurpose>
12663</refnamediv>
12664<refsynopsisdiv>
12665 <title>Synopsis</title>
12666  <funcsynopsis><funcprototype>
12667   <funcdef>int <function>drm_mode_set_config_internal </function></funcdef>
12668   <paramdef>struct drm_mode_set * <parameter>set</parameter></paramdef>
12669  </funcprototype></funcsynopsis>
12670</refsynopsisdiv>
12671<refsect1>
12672 <title>Arguments</title>
12673 <variablelist>
12674  <varlistentry>
12675   <term><parameter>set</parameter></term>
12676   <listitem>
12677    <para>
12678     modeset config to set
12679    </para>
12680   </listitem>
12681  </varlistentry>
12682 </variablelist>
12683</refsect1>
12684<refsect1>
12685<title>Description</title>
12686<para>
12687   This is a little helper to wrap internal calls to the -&gt;set_config driver
12688   interface. The only thing it adds is correct refcounting dance.
12689</para>
12690</refsect1>
12691<refsect1>
12692<title>Returns</title>
12693<para>
12694   Zero on success, negative errno on failure.
12695</para>
12696</refsect1>
12697</refentry>
12698
12699<refentry id="API-drm-crtc-get-hv-timing">
12700<refentryinfo>
12701 <title>LINUX</title>
12702 <productname>Kernel Hackers Manual</productname>
12703 <date>July 2017</date>
12704</refentryinfo>
12705<refmeta>
12706 <refentrytitle><phrase>drm_crtc_get_hv_timing</phrase></refentrytitle>
12707 <manvolnum>9</manvolnum>
12708 <refmiscinfo class="version">4.4.14</refmiscinfo>
12709</refmeta>
12710<refnamediv>
12711 <refname>drm_crtc_get_hv_timing</refname>
12712 <refpurpose>
12713     Fetches hdisplay/vdisplay for given mode
12714 </refpurpose>
12715</refnamediv>
12716<refsynopsisdiv>
12717 <title>Synopsis</title>
12718  <funcsynopsis><funcprototype>
12719   <funcdef>void <function>drm_crtc_get_hv_timing </function></funcdef>
12720   <paramdef>const struct drm_display_mode * <parameter>mode</parameter></paramdef>
12721   <paramdef>int * <parameter>hdisplay</parameter></paramdef>
12722   <paramdef>int * <parameter>vdisplay</parameter></paramdef>
12723  </funcprototype></funcsynopsis>
12724</refsynopsisdiv>
12725<refsect1>
12726 <title>Arguments</title>
12727 <variablelist>
12728  <varlistentry>
12729   <term><parameter>mode</parameter></term>
12730   <listitem>
12731    <para>
12732     mode to query
12733    </para>
12734   </listitem>
12735  </varlistentry>
12736  <varlistentry>
12737   <term><parameter>hdisplay</parameter></term>
12738   <listitem>
12739    <para>
12740     hdisplay value to fill in
12741    </para>
12742   </listitem>
12743  </varlistentry>
12744  <varlistentry>
12745   <term><parameter>vdisplay</parameter></term>
12746   <listitem>
12747    <para>
12748     vdisplay value to fill in
12749    </para>
12750   </listitem>
12751  </varlistentry>
12752 </variablelist>
12753</refsect1>
12754<refsect1>
12755<title>Description</title>
12756<para>
12757   The vdisplay value will be doubled if the specified mode is a stereo mode of
12758   the appropriate layout.
12759</para>
12760</refsect1>
12761</refentry>
12762
12763<refentry id="API-drm-crtc-check-viewport">
12764<refentryinfo>
12765 <title>LINUX</title>
12766 <productname>Kernel Hackers Manual</productname>
12767 <date>July 2017</date>
12768</refentryinfo>
12769<refmeta>
12770 <refentrytitle><phrase>drm_crtc_check_viewport</phrase></refentrytitle>
12771 <manvolnum>9</manvolnum>
12772 <refmiscinfo class="version">4.4.14</refmiscinfo>
12773</refmeta>
12774<refnamediv>
12775 <refname>drm_crtc_check_viewport</refname>
12776 <refpurpose>
12777     Checks that a framebuffer is big enough for the CRTC viewport
12778 </refpurpose>
12779</refnamediv>
12780<refsynopsisdiv>
12781 <title>Synopsis</title>
12782  <funcsynopsis><funcprototype>
12783   <funcdef>int <function>drm_crtc_check_viewport </function></funcdef>
12784   <paramdef>const struct drm_crtc * <parameter>crtc</parameter></paramdef>
12785   <paramdef>int <parameter>x</parameter></paramdef>
12786   <paramdef>int <parameter>y</parameter></paramdef>
12787   <paramdef>const struct drm_display_mode * <parameter>mode</parameter></paramdef>
12788   <paramdef>const struct drm_framebuffer * <parameter>fb</parameter></paramdef>
12789  </funcprototype></funcsynopsis>
12790</refsynopsisdiv>
12791<refsect1>
12792 <title>Arguments</title>
12793 <variablelist>
12794  <varlistentry>
12795   <term><parameter>crtc</parameter></term>
12796   <listitem>
12797    <para>
12798     CRTC that framebuffer will be displayed on
12799    </para>
12800   </listitem>
12801  </varlistentry>
12802  <varlistentry>
12803   <term><parameter>x</parameter></term>
12804   <listitem>
12805    <para>
12806     x panning
12807    </para>
12808   </listitem>
12809  </varlistentry>
12810  <varlistentry>
12811   <term><parameter>y</parameter></term>
12812   <listitem>
12813    <para>
12814     y panning
12815    </para>
12816   </listitem>
12817  </varlistentry>
12818  <varlistentry>
12819   <term><parameter>mode</parameter></term>
12820   <listitem>
12821    <para>
12822     mode that framebuffer will be displayed under
12823    </para>
12824   </listitem>
12825  </varlistentry>
12826  <varlistentry>
12827   <term><parameter>fb</parameter></term>
12828   <listitem>
12829    <para>
12830     framebuffer to check size of
12831    </para>
12832   </listitem>
12833  </varlistentry>
12834 </variablelist>
12835</refsect1>
12836</refentry>
12837
12838<refentry id="API-drm-mode-legacy-fb-format">
12839<refentryinfo>
12840 <title>LINUX</title>
12841 <productname>Kernel Hackers Manual</productname>
12842 <date>July 2017</date>
12843</refentryinfo>
12844<refmeta>
12845 <refentrytitle><phrase>drm_mode_legacy_fb_format</phrase></refentrytitle>
12846 <manvolnum>9</manvolnum>
12847 <refmiscinfo class="version">4.4.14</refmiscinfo>
12848</refmeta>
12849<refnamediv>
12850 <refname>drm_mode_legacy_fb_format</refname>
12851 <refpurpose>
12852     compute drm fourcc code from legacy description
12853 </refpurpose>
12854</refnamediv>
12855<refsynopsisdiv>
12856 <title>Synopsis</title>
12857  <funcsynopsis><funcprototype>
12858   <funcdef>uint32_t <function>drm_mode_legacy_fb_format </function></funcdef>
12859   <paramdef>uint32_t <parameter>bpp</parameter></paramdef>
12860   <paramdef>uint32_t <parameter>depth</parameter></paramdef>
12861  </funcprototype></funcsynopsis>
12862</refsynopsisdiv>
12863<refsect1>
12864 <title>Arguments</title>
12865 <variablelist>
12866  <varlistentry>
12867   <term><parameter>bpp</parameter></term>
12868   <listitem>
12869    <para>
12870     bits per pixels
12871    </para>
12872   </listitem>
12873  </varlistentry>
12874  <varlistentry>
12875   <term><parameter>depth</parameter></term>
12876   <listitem>
12877    <para>
12878     bit depth per pixel
12879    </para>
12880   </listitem>
12881  </varlistentry>
12882 </variablelist>
12883</refsect1>
12884<refsect1>
12885<title>Description</title>
12886<para>
12887   Computes a drm fourcc pixel format code for the given <parameter>bpp</parameter>/<parameter>depth</parameter> values.
12888   Useful in fbdev emulation code, since that deals in those values.
12889</para>
12890</refsect1>
12891</refentry>
12892
12893<refentry id="API-drm-property-create">
12894<refentryinfo>
12895 <title>LINUX</title>
12896 <productname>Kernel Hackers Manual</productname>
12897 <date>July 2017</date>
12898</refentryinfo>
12899<refmeta>
12900 <refentrytitle><phrase>drm_property_create</phrase></refentrytitle>
12901 <manvolnum>9</manvolnum>
12902 <refmiscinfo class="version">4.4.14</refmiscinfo>
12903</refmeta>
12904<refnamediv>
12905 <refname>drm_property_create</refname>
12906 <refpurpose>
12907     create a new property type
12908 </refpurpose>
12909</refnamediv>
12910<refsynopsisdiv>
12911 <title>Synopsis</title>
12912  <funcsynopsis><funcprototype>
12913   <funcdef>struct drm_property * <function>drm_property_create </function></funcdef>
12914   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
12915   <paramdef>int <parameter>flags</parameter></paramdef>
12916   <paramdef>const char * <parameter>name</parameter></paramdef>
12917   <paramdef>int <parameter>num_values</parameter></paramdef>
12918  </funcprototype></funcsynopsis>
12919</refsynopsisdiv>
12920<refsect1>
12921 <title>Arguments</title>
12922 <variablelist>
12923  <varlistentry>
12924   <term><parameter>dev</parameter></term>
12925   <listitem>
12926    <para>
12927     drm device
12928    </para>
12929   </listitem>
12930  </varlistentry>
12931  <varlistentry>
12932   <term><parameter>flags</parameter></term>
12933   <listitem>
12934    <para>
12935     flags specifying the property type
12936    </para>
12937   </listitem>
12938  </varlistentry>
12939  <varlistentry>
12940   <term><parameter>name</parameter></term>
12941   <listitem>
12942    <para>
12943     name of the property
12944    </para>
12945   </listitem>
12946  </varlistentry>
12947  <varlistentry>
12948   <term><parameter>num_values</parameter></term>
12949   <listitem>
12950    <para>
12951     number of pre-defined values
12952    </para>
12953   </listitem>
12954  </varlistentry>
12955 </variablelist>
12956</refsect1>
12957<refsect1>
12958<title>Description</title>
12959<para>
12960   This creates a new generic drm property which can then be attached to a drm
12961   object with drm_object_attach_property. The returned property object must be
12962   freed with drm_property_destroy.
12963   </para><para>
12964
12965   Note that the DRM core keeps a per-device list of properties and that, if
12966   <function>drm_mode_config_cleanup</function> is called, it will destroy all properties created
12967   by the driver.
12968</para>
12969</refsect1>
12970<refsect1>
12971<title>Returns</title>
12972<para>
12973   A pointer to the newly created property on success, NULL on failure.
12974</para>
12975</refsect1>
12976</refentry>
12977
12978<refentry id="API-drm-property-create-enum">
12979<refentryinfo>
12980 <title>LINUX</title>
12981 <productname>Kernel Hackers Manual</productname>
12982 <date>July 2017</date>
12983</refentryinfo>
12984<refmeta>
12985 <refentrytitle><phrase>drm_property_create_enum</phrase></refentrytitle>
12986 <manvolnum>9</manvolnum>
12987 <refmiscinfo class="version">4.4.14</refmiscinfo>
12988</refmeta>
12989<refnamediv>
12990 <refname>drm_property_create_enum</refname>
12991 <refpurpose>
12992     create a new enumeration property type
12993 </refpurpose>
12994</refnamediv>
12995<refsynopsisdiv>
12996 <title>Synopsis</title>
12997  <funcsynopsis><funcprototype>
12998   <funcdef>struct drm_property * <function>drm_property_create_enum </function></funcdef>
12999   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
13000   <paramdef>int <parameter>flags</parameter></paramdef>
13001   <paramdef>const char * <parameter>name</parameter></paramdef>
13002   <paramdef>const struct drm_prop_enum_list * <parameter>props</parameter></paramdef>
13003   <paramdef>int <parameter>num_values</parameter></paramdef>
13004  </funcprototype></funcsynopsis>
13005</refsynopsisdiv>
13006<refsect1>
13007 <title>Arguments</title>
13008 <variablelist>
13009  <varlistentry>
13010   <term><parameter>dev</parameter></term>
13011   <listitem>
13012    <para>
13013     drm device
13014    </para>
13015   </listitem>
13016  </varlistentry>
13017  <varlistentry>
13018   <term><parameter>flags</parameter></term>
13019   <listitem>
13020    <para>
13021     flags specifying the property type
13022    </para>
13023   </listitem>
13024  </varlistentry>
13025  <varlistentry>
13026   <term><parameter>name</parameter></term>
13027   <listitem>
13028    <para>
13029     name of the property
13030    </para>
13031   </listitem>
13032  </varlistentry>
13033  <varlistentry>
13034   <term><parameter>props</parameter></term>
13035   <listitem>
13036    <para>
13037     enumeration lists with property values
13038    </para>
13039   </listitem>
13040  </varlistentry>
13041  <varlistentry>
13042   <term><parameter>num_values</parameter></term>
13043   <listitem>
13044    <para>
13045     number of pre-defined values
13046    </para>
13047   </listitem>
13048  </varlistentry>
13049 </variablelist>
13050</refsect1>
13051<refsect1>
13052<title>Description</title>
13053<para>
13054   This creates a new generic drm property which can then be attached to a drm
13055   object with drm_object_attach_property. The returned property object must be
13056   freed with drm_property_destroy.
13057   </para><para>
13058
13059   Userspace is only allowed to set one of the predefined values for enumeration
13060   properties.
13061</para>
13062</refsect1>
13063<refsect1>
13064<title>Returns</title>
13065<para>
13066   A pointer to the newly created property on success, NULL on failure.
13067</para>
13068</refsect1>
13069</refentry>
13070
13071<refentry id="API-drm-property-create-bitmask">
13072<refentryinfo>
13073 <title>LINUX</title>
13074 <productname>Kernel Hackers Manual</productname>
13075 <date>July 2017</date>
13076</refentryinfo>
13077<refmeta>
13078 <refentrytitle><phrase>drm_property_create_bitmask</phrase></refentrytitle>
13079 <manvolnum>9</manvolnum>
13080 <refmiscinfo class="version">4.4.14</refmiscinfo>
13081</refmeta>
13082<refnamediv>
13083 <refname>drm_property_create_bitmask</refname>
13084 <refpurpose>
13085     create a new bitmask property type
13086 </refpurpose>
13087</refnamediv>
13088<refsynopsisdiv>
13089 <title>Synopsis</title>
13090  <funcsynopsis><funcprototype>
13091   <funcdef>struct drm_property * <function>drm_property_create_bitmask </function></funcdef>
13092   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
13093   <paramdef>int <parameter>flags</parameter></paramdef>
13094   <paramdef>const char * <parameter>name</parameter></paramdef>
13095   <paramdef>const struct drm_prop_enum_list * <parameter>props</parameter></paramdef>
13096   <paramdef>int <parameter>num_props</parameter></paramdef>
13097   <paramdef>uint64_t <parameter>supported_bits</parameter></paramdef>
13098  </funcprototype></funcsynopsis>
13099</refsynopsisdiv>
13100<refsect1>
13101 <title>Arguments</title>
13102 <variablelist>
13103  <varlistentry>
13104   <term><parameter>dev</parameter></term>
13105   <listitem>
13106    <para>
13107     drm device
13108    </para>
13109   </listitem>
13110  </varlistentry>
13111  <varlistentry>
13112   <term><parameter>flags</parameter></term>
13113   <listitem>
13114    <para>
13115     flags specifying the property type
13116    </para>
13117   </listitem>
13118  </varlistentry>
13119  <varlistentry>
13120   <term><parameter>name</parameter></term>
13121   <listitem>
13122    <para>
13123     name of the property
13124    </para>
13125   </listitem>
13126  </varlistentry>
13127  <varlistentry>
13128   <term><parameter>props</parameter></term>
13129   <listitem>
13130    <para>
13131     enumeration lists with property bitflags
13132    </para>
13133   </listitem>
13134  </varlistentry>
13135  <varlistentry>
13136   <term><parameter>num_props</parameter></term>
13137   <listitem>
13138    <para>
13139     size of the <parameter>props</parameter> array
13140    </para>
13141   </listitem>
13142  </varlistentry>
13143  <varlistentry>
13144   <term><parameter>supported_bits</parameter></term>
13145   <listitem>
13146    <para>
13147     bitmask of all supported enumeration values
13148    </para>
13149   </listitem>
13150  </varlistentry>
13151 </variablelist>
13152</refsect1>
13153<refsect1>
13154<title>Description</title>
13155<para>
13156   This creates a new bitmask drm property which can then be attached to a drm
13157   object with drm_object_attach_property. The returned property object must be
13158   freed with drm_property_destroy.
13159   </para><para>
13160
13161   Compared to plain enumeration properties userspace is allowed to set any
13162   or'ed together combination of the predefined property bitflag values
13163</para>
13164</refsect1>
13165<refsect1>
13166<title>Returns</title>
13167<para>
13168   A pointer to the newly created property on success, NULL on failure.
13169</para>
13170</refsect1>
13171</refentry>
13172
13173<refentry id="API-drm-property-create-range">
13174<refentryinfo>
13175 <title>LINUX</title>
13176 <productname>Kernel Hackers Manual</productname>
13177 <date>July 2017</date>
13178</refentryinfo>
13179<refmeta>
13180 <refentrytitle><phrase>drm_property_create_range</phrase></refentrytitle>
13181 <manvolnum>9</manvolnum>
13182 <refmiscinfo class="version">4.4.14</refmiscinfo>
13183</refmeta>
13184<refnamediv>
13185 <refname>drm_property_create_range</refname>
13186 <refpurpose>
13187     create a new unsigned ranged property type
13188 </refpurpose>
13189</refnamediv>
13190<refsynopsisdiv>
13191 <title>Synopsis</title>
13192  <funcsynopsis><funcprototype>
13193   <funcdef>struct drm_property * <function>drm_property_create_range </function></funcdef>
13194   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
13195   <paramdef>int <parameter>flags</parameter></paramdef>
13196   <paramdef>const char * <parameter>name</parameter></paramdef>
13197   <paramdef>uint64_t <parameter>min</parameter></paramdef>
13198   <paramdef>uint64_t <parameter>max</parameter></paramdef>
13199  </funcprototype></funcsynopsis>
13200</refsynopsisdiv>
13201<refsect1>
13202 <title>Arguments</title>
13203 <variablelist>
13204  <varlistentry>
13205   <term><parameter>dev</parameter></term>
13206   <listitem>
13207    <para>
13208     drm device
13209    </para>
13210   </listitem>
13211  </varlistentry>
13212  <varlistentry>
13213   <term><parameter>flags</parameter></term>
13214   <listitem>
13215    <para>
13216     flags specifying the property type
13217    </para>
13218   </listitem>
13219  </varlistentry>
13220  <varlistentry>
13221   <term><parameter>name</parameter></term>
13222   <listitem>
13223    <para>
13224     name of the property
13225    </para>
13226   </listitem>
13227  </varlistentry>
13228  <varlistentry>
13229   <term><parameter>min</parameter></term>
13230   <listitem>
13231    <para>
13232     minimum value of the property
13233    </para>
13234   </listitem>
13235  </varlistentry>
13236  <varlistentry>
13237   <term><parameter>max</parameter></term>
13238   <listitem>
13239    <para>
13240     maximum value of the property
13241    </para>
13242   </listitem>
13243  </varlistentry>
13244 </variablelist>
13245</refsect1>
13246<refsect1>
13247<title>Description</title>
13248<para>
13249   This creates a new generic drm property which can then be attached to a drm
13250   object with drm_object_attach_property. The returned property object must be
13251   freed with drm_property_destroy.
13252   </para><para>
13253
13254   Userspace is allowed to set any unsigned integer value in the (min, max)
13255   range inclusive.
13256</para>
13257</refsect1>
13258<refsect1>
13259<title>Returns</title>
13260<para>
13261   A pointer to the newly created property on success, NULL on failure.
13262</para>
13263</refsect1>
13264</refentry>
13265
13266<refentry id="API-drm-property-create-signed-range">
13267<refentryinfo>
13268 <title>LINUX</title>
13269 <productname>Kernel Hackers Manual</productname>
13270 <date>July 2017</date>
13271</refentryinfo>
13272<refmeta>
13273 <refentrytitle><phrase>drm_property_create_signed_range</phrase></refentrytitle>
13274 <manvolnum>9</manvolnum>
13275 <refmiscinfo class="version">4.4.14</refmiscinfo>
13276</refmeta>
13277<refnamediv>
13278 <refname>drm_property_create_signed_range</refname>
13279 <refpurpose>
13280     create a new signed ranged property type
13281 </refpurpose>
13282</refnamediv>
13283<refsynopsisdiv>
13284 <title>Synopsis</title>
13285  <funcsynopsis><funcprototype>
13286   <funcdef>struct drm_property * <function>drm_property_create_signed_range </function></funcdef>
13287   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
13288   <paramdef>int <parameter>flags</parameter></paramdef>
13289   <paramdef>const char * <parameter>name</parameter></paramdef>
13290   <paramdef>int64_t <parameter>min</parameter></paramdef>
13291   <paramdef>int64_t <parameter>max</parameter></paramdef>
13292  </funcprototype></funcsynopsis>
13293</refsynopsisdiv>
13294<refsect1>
13295 <title>Arguments</title>
13296 <variablelist>
13297  <varlistentry>
13298   <term><parameter>dev</parameter></term>
13299   <listitem>
13300    <para>
13301     drm device
13302    </para>
13303   </listitem>
13304  </varlistentry>
13305  <varlistentry>
13306   <term><parameter>flags</parameter></term>
13307   <listitem>
13308    <para>
13309     flags specifying the property type
13310    </para>
13311   </listitem>
13312  </varlistentry>
13313  <varlistentry>
13314   <term><parameter>name</parameter></term>
13315   <listitem>
13316    <para>
13317     name of the property
13318    </para>
13319   </listitem>
13320  </varlistentry>
13321  <varlistentry>
13322   <term><parameter>min</parameter></term>
13323   <listitem>
13324    <para>
13325     minimum value of the property
13326    </para>
13327   </listitem>
13328  </varlistentry>
13329  <varlistentry>
13330   <term><parameter>max</parameter></term>
13331   <listitem>
13332    <para>
13333     maximum value of the property
13334    </para>
13335   </listitem>
13336  </varlistentry>
13337 </variablelist>
13338</refsect1>
13339<refsect1>
13340<title>Description</title>
13341<para>
13342   This creates a new generic drm property which can then be attached to a drm
13343   object with drm_object_attach_property. The returned property object must be
13344   freed with drm_property_destroy.
13345   </para><para>
13346
13347   Userspace is allowed to set any signed integer value in the (min, max)
13348   range inclusive.
13349</para>
13350</refsect1>
13351<refsect1>
13352<title>Returns</title>
13353<para>
13354   A pointer to the newly created property on success, NULL on failure.
13355</para>
13356</refsect1>
13357</refentry>
13358
13359<refentry id="API-drm-property-create-object">
13360<refentryinfo>
13361 <title>LINUX</title>
13362 <productname>Kernel Hackers Manual</productname>
13363 <date>July 2017</date>
13364</refentryinfo>
13365<refmeta>
13366 <refentrytitle><phrase>drm_property_create_object</phrase></refentrytitle>
13367 <manvolnum>9</manvolnum>
13368 <refmiscinfo class="version">4.4.14</refmiscinfo>
13369</refmeta>
13370<refnamediv>
13371 <refname>drm_property_create_object</refname>
13372 <refpurpose>
13373     create a new object property type
13374 </refpurpose>
13375</refnamediv>
13376<refsynopsisdiv>
13377 <title>Synopsis</title>
13378  <funcsynopsis><funcprototype>
13379   <funcdef>struct drm_property * <function>drm_property_create_object </function></funcdef>
13380   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
13381   <paramdef>int <parameter>flags</parameter></paramdef>
13382   <paramdef>const char * <parameter>name</parameter></paramdef>
13383   <paramdef>uint32_t <parameter>type</parameter></paramdef>
13384  </funcprototype></funcsynopsis>
13385</refsynopsisdiv>
13386<refsect1>
13387 <title>Arguments</title>
13388 <variablelist>
13389  <varlistentry>
13390   <term><parameter>dev</parameter></term>
13391   <listitem>
13392    <para>
13393     drm device
13394    </para>
13395   </listitem>
13396  </varlistentry>
13397  <varlistentry>
13398   <term><parameter>flags</parameter></term>
13399   <listitem>
13400    <para>
13401     flags specifying the property type
13402    </para>
13403   </listitem>
13404  </varlistentry>
13405  <varlistentry>
13406   <term><parameter>name</parameter></term>
13407   <listitem>
13408    <para>
13409     name of the property
13410    </para>
13411   </listitem>
13412  </varlistentry>
13413  <varlistentry>
13414   <term><parameter>type</parameter></term>
13415   <listitem>
13416    <para>
13417     object type from DRM_MODE_OBJECT_* defines
13418    </para>
13419   </listitem>
13420  </varlistentry>
13421 </variablelist>
13422</refsect1>
13423<refsect1>
13424<title>Description</title>
13425<para>
13426   This creates a new generic drm property which can then be attached to a drm
13427   object with drm_object_attach_property. The returned property object must be
13428   freed with drm_property_destroy.
13429   </para><para>
13430
13431   Userspace is only allowed to set this to any property value of the given
13432   <parameter>type</parameter>. Only useful for atomic properties, which is enforced.
13433</para>
13434</refsect1>
13435<refsect1>
13436<title>Returns</title>
13437<para>
13438   A pointer to the newly created property on success, NULL on failure.
13439</para>
13440</refsect1>
13441</refentry>
13442
13443<refentry id="API-drm-property-create-bool">
13444<refentryinfo>
13445 <title>LINUX</title>
13446 <productname>Kernel Hackers Manual</productname>
13447 <date>July 2017</date>
13448</refentryinfo>
13449<refmeta>
13450 <refentrytitle><phrase>drm_property_create_bool</phrase></refentrytitle>
13451 <manvolnum>9</manvolnum>
13452 <refmiscinfo class="version">4.4.14</refmiscinfo>
13453</refmeta>
13454<refnamediv>
13455 <refname>drm_property_create_bool</refname>
13456 <refpurpose>
13457     create a new boolean property type
13458 </refpurpose>
13459</refnamediv>
13460<refsynopsisdiv>
13461 <title>Synopsis</title>
13462  <funcsynopsis><funcprototype>
13463   <funcdef>struct drm_property * <function>drm_property_create_bool </function></funcdef>
13464   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
13465   <paramdef>int <parameter>flags</parameter></paramdef>
13466   <paramdef>const char * <parameter>name</parameter></paramdef>
13467  </funcprototype></funcsynopsis>
13468</refsynopsisdiv>
13469<refsect1>
13470 <title>Arguments</title>
13471 <variablelist>
13472  <varlistentry>
13473   <term><parameter>dev</parameter></term>
13474   <listitem>
13475    <para>
13476     drm device
13477    </para>
13478   </listitem>
13479  </varlistentry>
13480  <varlistentry>
13481   <term><parameter>flags</parameter></term>
13482   <listitem>
13483    <para>
13484     flags specifying the property type
13485    </para>
13486   </listitem>
13487  </varlistentry>
13488  <varlistentry>
13489   <term><parameter>name</parameter></term>
13490   <listitem>
13491    <para>
13492     name of the property
13493    </para>
13494   </listitem>
13495  </varlistentry>
13496 </variablelist>
13497</refsect1>
13498<refsect1>
13499<title>Description</title>
13500<para>
13501   This creates a new generic drm property which can then be attached to a drm
13502   object with drm_object_attach_property. The returned property object must be
13503   freed with drm_property_destroy.
13504   </para><para>
13505
13506   This is implemented as a ranged property with only {0, 1} as valid values.
13507</para>
13508</refsect1>
13509<refsect1>
13510<title>Returns</title>
13511<para>
13512   A pointer to the newly created property on success, NULL on failure.
13513</para>
13514</refsect1>
13515</refentry>
13516
13517<refentry id="API-drm-property-add-enum">
13518<refentryinfo>
13519 <title>LINUX</title>
13520 <productname>Kernel Hackers Manual</productname>
13521 <date>July 2017</date>
13522</refentryinfo>
13523<refmeta>
13524 <refentrytitle><phrase>drm_property_add_enum</phrase></refentrytitle>
13525 <manvolnum>9</manvolnum>
13526 <refmiscinfo class="version">4.4.14</refmiscinfo>
13527</refmeta>
13528<refnamediv>
13529 <refname>drm_property_add_enum</refname>
13530 <refpurpose>
13531     add a possible value to an enumeration property
13532 </refpurpose>
13533</refnamediv>
13534<refsynopsisdiv>
13535 <title>Synopsis</title>
13536  <funcsynopsis><funcprototype>
13537   <funcdef>int <function>drm_property_add_enum </function></funcdef>
13538   <paramdef>struct drm_property * <parameter>property</parameter></paramdef>
13539   <paramdef>int <parameter>index</parameter></paramdef>
13540   <paramdef>uint64_t <parameter>value</parameter></paramdef>
13541   <paramdef>const char * <parameter>name</parameter></paramdef>
13542  </funcprototype></funcsynopsis>
13543</refsynopsisdiv>
13544<refsect1>
13545 <title>Arguments</title>
13546 <variablelist>
13547  <varlistentry>
13548   <term><parameter>property</parameter></term>
13549   <listitem>
13550    <para>
13551     enumeration property to change
13552    </para>
13553   </listitem>
13554  </varlistentry>
13555  <varlistentry>
13556   <term><parameter>index</parameter></term>
13557   <listitem>
13558    <para>
13559     index of the new enumeration
13560    </para>
13561   </listitem>
13562  </varlistentry>
13563  <varlistentry>
13564   <term><parameter>value</parameter></term>
13565   <listitem>
13566    <para>
13567     value of the new enumeration
13568    </para>
13569   </listitem>
13570  </varlistentry>
13571  <varlistentry>
13572   <term><parameter>name</parameter></term>
13573   <listitem>
13574    <para>
13575     symbolic name of the new enumeration
13576    </para>
13577   </listitem>
13578  </varlistentry>
13579 </variablelist>
13580</refsect1>
13581<refsect1>
13582<title>Description</title>
13583<para>
13584   This functions adds enumerations to a property.
13585   </para><para>
13586
13587   It's use is deprecated, drivers should use one of the more specific helpers
13588   to directly create the property with all enumerations already attached.
13589</para>
13590</refsect1>
13591<refsect1>
13592<title>Returns</title>
13593<para>
13594   Zero on success, error code on failure.
13595</para>
13596</refsect1>
13597</refentry>
13598
13599<refentry id="API-drm-property-destroy">
13600<refentryinfo>
13601 <title>LINUX</title>
13602 <productname>Kernel Hackers Manual</productname>
13603 <date>July 2017</date>
13604</refentryinfo>
13605<refmeta>
13606 <refentrytitle><phrase>drm_property_destroy</phrase></refentrytitle>
13607 <manvolnum>9</manvolnum>
13608 <refmiscinfo class="version">4.4.14</refmiscinfo>
13609</refmeta>
13610<refnamediv>
13611 <refname>drm_property_destroy</refname>
13612 <refpurpose>
13613     destroy a drm property
13614 </refpurpose>
13615</refnamediv>
13616<refsynopsisdiv>
13617 <title>Synopsis</title>
13618  <funcsynopsis><funcprototype>
13619   <funcdef>void <function>drm_property_destroy </function></funcdef>
13620   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
13621   <paramdef>struct drm_property * <parameter>property</parameter></paramdef>
13622  </funcprototype></funcsynopsis>
13623</refsynopsisdiv>
13624<refsect1>
13625 <title>Arguments</title>
13626 <variablelist>
13627  <varlistentry>
13628   <term><parameter>dev</parameter></term>
13629   <listitem>
13630    <para>
13631     drm device
13632    </para>
13633   </listitem>
13634  </varlistentry>
13635  <varlistentry>
13636   <term><parameter>property</parameter></term>
13637   <listitem>
13638    <para>
13639     property to destry
13640    </para>
13641   </listitem>
13642  </varlistentry>
13643 </variablelist>
13644</refsect1>
13645<refsect1>
13646<title>Description</title>
13647<para>
13648   This function frees a property including any attached resources like
13649   enumeration values.
13650</para>
13651</refsect1>
13652</refentry>
13653
13654<refentry id="API-drm-object-attach-property">
13655<refentryinfo>
13656 <title>LINUX</title>
13657 <productname>Kernel Hackers Manual</productname>
13658 <date>July 2017</date>
13659</refentryinfo>
13660<refmeta>
13661 <refentrytitle><phrase>drm_object_attach_property</phrase></refentrytitle>
13662 <manvolnum>9</manvolnum>
13663 <refmiscinfo class="version">4.4.14</refmiscinfo>
13664</refmeta>
13665<refnamediv>
13666 <refname>drm_object_attach_property</refname>
13667 <refpurpose>
13668     attach a property to a modeset object
13669 </refpurpose>
13670</refnamediv>
13671<refsynopsisdiv>
13672 <title>Synopsis</title>
13673  <funcsynopsis><funcprototype>
13674   <funcdef>void <function>drm_object_attach_property </function></funcdef>
13675   <paramdef>struct drm_mode_object * <parameter>obj</parameter></paramdef>
13676   <paramdef>struct drm_property * <parameter>property</parameter></paramdef>
13677   <paramdef>uint64_t <parameter>init_val</parameter></paramdef>
13678  </funcprototype></funcsynopsis>
13679</refsynopsisdiv>
13680<refsect1>
13681 <title>Arguments</title>
13682 <variablelist>
13683  <varlistentry>
13684   <term><parameter>obj</parameter></term>
13685   <listitem>
13686    <para>
13687     drm modeset object
13688    </para>
13689   </listitem>
13690  </varlistentry>
13691  <varlistentry>
13692   <term><parameter>property</parameter></term>
13693   <listitem>
13694    <para>
13695     property to attach
13696    </para>
13697   </listitem>
13698  </varlistentry>
13699  <varlistentry>
13700   <term><parameter>init_val</parameter></term>
13701   <listitem>
13702    <para>
13703     initial value of the property
13704    </para>
13705   </listitem>
13706  </varlistentry>
13707 </variablelist>
13708</refsect1>
13709<refsect1>
13710<title>Description</title>
13711<para>
13712   This attaches the given property to the modeset object with the given initial
13713   value. Currently this function cannot fail since the properties are stored in
13714   a statically sized array.
13715</para>
13716</refsect1>
13717</refentry>
13718
13719<refentry id="API-drm-object-property-set-value">
13720<refentryinfo>
13721 <title>LINUX</title>
13722 <productname>Kernel Hackers Manual</productname>
13723 <date>July 2017</date>
13724</refentryinfo>
13725<refmeta>
13726 <refentrytitle><phrase>drm_object_property_set_value</phrase></refentrytitle>
13727 <manvolnum>9</manvolnum>
13728 <refmiscinfo class="version">4.4.14</refmiscinfo>
13729</refmeta>
13730<refnamediv>
13731 <refname>drm_object_property_set_value</refname>
13732 <refpurpose>
13733     set the value of a property
13734 </refpurpose>
13735</refnamediv>
13736<refsynopsisdiv>
13737 <title>Synopsis</title>
13738  <funcsynopsis><funcprototype>
13739   <funcdef>int <function>drm_object_property_set_value </function></funcdef>
13740   <paramdef>struct drm_mode_object * <parameter>obj</parameter></paramdef>
13741   <paramdef>struct drm_property * <parameter>property</parameter></paramdef>
13742   <paramdef>uint64_t <parameter>val</parameter></paramdef>
13743  </funcprototype></funcsynopsis>
13744</refsynopsisdiv>
13745<refsect1>
13746 <title>Arguments</title>
13747 <variablelist>
13748  <varlistentry>
13749   <term><parameter>obj</parameter></term>
13750   <listitem>
13751    <para>
13752     drm mode object to set property value for
13753    </para>
13754   </listitem>
13755  </varlistentry>
13756  <varlistentry>
13757   <term><parameter>property</parameter></term>
13758   <listitem>
13759    <para>
13760     property to set
13761    </para>
13762   </listitem>
13763  </varlistentry>
13764  <varlistentry>
13765   <term><parameter>val</parameter></term>
13766   <listitem>
13767    <para>
13768     value the property should be set to
13769    </para>
13770   </listitem>
13771  </varlistentry>
13772 </variablelist>
13773</refsect1>
13774<refsect1>
13775<title>Description</title>
13776<para>
13777   This functions sets a given property on a given object. This function only
13778   changes the software state of the property, it does not call into the
13779   driver's -&gt;set_property callback.
13780</para>
13781</refsect1>
13782<refsect1>
13783<title>Returns</title>
13784<para>
13785   Zero on success, error code on failure.
13786</para>
13787</refsect1>
13788</refentry>
13789
13790<refentry id="API-drm-object-property-get-value">
13791<refentryinfo>
13792 <title>LINUX</title>
13793 <productname>Kernel Hackers Manual</productname>
13794 <date>July 2017</date>
13795</refentryinfo>
13796<refmeta>
13797 <refentrytitle><phrase>drm_object_property_get_value</phrase></refentrytitle>
13798 <manvolnum>9</manvolnum>
13799 <refmiscinfo class="version">4.4.14</refmiscinfo>
13800</refmeta>
13801<refnamediv>
13802 <refname>drm_object_property_get_value</refname>
13803 <refpurpose>
13804     retrieve the value of a property
13805 </refpurpose>
13806</refnamediv>
13807<refsynopsisdiv>
13808 <title>Synopsis</title>
13809  <funcsynopsis><funcprototype>
13810   <funcdef>int <function>drm_object_property_get_value </function></funcdef>
13811   <paramdef>struct drm_mode_object * <parameter>obj</parameter></paramdef>
13812   <paramdef>struct drm_property * <parameter>property</parameter></paramdef>
13813   <paramdef>uint64_t * <parameter>val</parameter></paramdef>
13814  </funcprototype></funcsynopsis>
13815</refsynopsisdiv>
13816<refsect1>
13817 <title>Arguments</title>
13818 <variablelist>
13819  <varlistentry>
13820   <term><parameter>obj</parameter></term>
13821   <listitem>
13822    <para>
13823     drm mode object to get property value from
13824    </para>
13825   </listitem>
13826  </varlistentry>
13827  <varlistentry>
13828   <term><parameter>property</parameter></term>
13829   <listitem>
13830    <para>
13831     property to retrieve
13832    </para>
13833   </listitem>
13834  </varlistentry>
13835  <varlistentry>
13836   <term><parameter>val</parameter></term>
13837   <listitem>
13838    <para>
13839     storage for the property value
13840    </para>
13841   </listitem>
13842  </varlistentry>
13843 </variablelist>
13844</refsect1>
13845<refsect1>
13846<title>Description</title>
13847<para>
13848   This function retrieves the softare state of the given property for the given
13849   property. Since there is no driver callback to retrieve the current property
13850   value this might be out of sync with the hardware, depending upon the driver
13851   and property.
13852</para>
13853</refsect1>
13854<refsect1>
13855<title>Returns</title>
13856<para>
13857   Zero on success, error code on failure.
13858</para>
13859</refsect1>
13860</refentry>
13861
13862<refentry id="API-drm-property-create-blob">
13863<refentryinfo>
13864 <title>LINUX</title>
13865 <productname>Kernel Hackers Manual</productname>
13866 <date>July 2017</date>
13867</refentryinfo>
13868<refmeta>
13869 <refentrytitle><phrase>drm_property_create_blob</phrase></refentrytitle>
13870 <manvolnum>9</manvolnum>
13871 <refmiscinfo class="version">4.4.14</refmiscinfo>
13872</refmeta>
13873<refnamediv>
13874 <refname>drm_property_create_blob</refname>
13875 <refpurpose>
13876     Create new blob property
13877 </refpurpose>
13878</refnamediv>
13879<refsynopsisdiv>
13880 <title>Synopsis</title>
13881  <funcsynopsis><funcprototype>
13882   <funcdef>struct drm_property_blob * <function>drm_property_create_blob </function></funcdef>
13883   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
13884   <paramdef>size_t <parameter>length</parameter></paramdef>
13885   <paramdef>const void * <parameter>data</parameter></paramdef>
13886  </funcprototype></funcsynopsis>
13887</refsynopsisdiv>
13888<refsect1>
13889 <title>Arguments</title>
13890 <variablelist>
13891  <varlistentry>
13892   <term><parameter>dev</parameter></term>
13893   <listitem>
13894    <para>
13895     DRM device to create property for
13896    </para>
13897   </listitem>
13898  </varlistentry>
13899  <varlistentry>
13900   <term><parameter>length</parameter></term>
13901   <listitem>
13902    <para>
13903     Length to allocate for blob data
13904    </para>
13905   </listitem>
13906  </varlistentry>
13907  <varlistentry>
13908   <term><parameter>data</parameter></term>
13909   <listitem>
13910    <para>
13911     If specified, copies data into blob
13912    </para>
13913   </listitem>
13914  </varlistentry>
13915 </variablelist>
13916</refsect1>
13917<refsect1>
13918<title>Description</title>
13919<para>
13920   </para><para>
13921
13922   Creates a new blob property for a specified DRM device, optionally
13923   copying data.
13924</para>
13925</refsect1>
13926<refsect1>
13927<title>Returns</title>
13928<para>
13929   New blob property with a single reference on success, or an ERR_PTR
13930   value on failure.
13931</para>
13932</refsect1>
13933</refentry>
13934
13935<refentry id="API-drm-property-unreference-blob">
13936<refentryinfo>
13937 <title>LINUX</title>
13938 <productname>Kernel Hackers Manual</productname>
13939 <date>July 2017</date>
13940</refentryinfo>
13941<refmeta>
13942 <refentrytitle><phrase>drm_property_unreference_blob</phrase></refentrytitle>
13943 <manvolnum>9</manvolnum>
13944 <refmiscinfo class="version">4.4.14</refmiscinfo>
13945</refmeta>
13946<refnamediv>
13947 <refname>drm_property_unreference_blob</refname>
13948 <refpurpose>
13949     Unreference a blob property
13950 </refpurpose>
13951</refnamediv>
13952<refsynopsisdiv>
13953 <title>Synopsis</title>
13954  <funcsynopsis><funcprototype>
13955   <funcdef>void <function>drm_property_unreference_blob </function></funcdef>
13956   <paramdef>struct drm_property_blob * <parameter>blob</parameter></paramdef>
13957  </funcprototype></funcsynopsis>
13958</refsynopsisdiv>
13959<refsect1>
13960 <title>Arguments</title>
13961 <variablelist>
13962  <varlistentry>
13963   <term><parameter>blob</parameter></term>
13964   <listitem>
13965    <para>
13966     Pointer to blob property
13967    </para>
13968   </listitem>
13969  </varlistentry>
13970 </variablelist>
13971</refsect1>
13972<refsect1>
13973<title>Description</title>
13974<para>
13975   </para><para>
13976
13977   Drop a reference on a blob property. May free the object.
13978</para>
13979</refsect1>
13980</refentry>
13981
13982<refentry id="API-drm-property-reference-blob">
13983<refentryinfo>
13984 <title>LINUX</title>
13985 <productname>Kernel Hackers Manual</productname>
13986 <date>July 2017</date>
13987</refentryinfo>
13988<refmeta>
13989 <refentrytitle><phrase>drm_property_reference_blob</phrase></refentrytitle>
13990 <manvolnum>9</manvolnum>
13991 <refmiscinfo class="version">4.4.14</refmiscinfo>
13992</refmeta>
13993<refnamediv>
13994 <refname>drm_property_reference_blob</refname>
13995 <refpurpose>
13996     Take a reference on an existing property
13997 </refpurpose>
13998</refnamediv>
13999<refsynopsisdiv>
14000 <title>Synopsis</title>
14001  <funcsynopsis><funcprototype>
14002   <funcdef>struct drm_property_blob * <function>drm_property_reference_blob </function></funcdef>
14003   <paramdef>struct drm_property_blob * <parameter>blob</parameter></paramdef>
14004  </funcprototype></funcsynopsis>
14005</refsynopsisdiv>
14006<refsect1>
14007 <title>Arguments</title>
14008 <variablelist>
14009  <varlistentry>
14010   <term><parameter>blob</parameter></term>
14011   <listitem>
14012    <para>
14013     Pointer to blob property
14014    </para>
14015   </listitem>
14016  </varlistentry>
14017 </variablelist>
14018</refsect1>
14019<refsect1>
14020<title>Description</title>
14021<para>
14022   </para><para>
14023
14024   Take a new reference on an existing blob property.
14025</para>
14026</refsect1>
14027</refentry>
14028
14029<refentry id="API-drm-property-lookup-blob">
14030<refentryinfo>
14031 <title>LINUX</title>
14032 <productname>Kernel Hackers Manual</productname>
14033 <date>July 2017</date>
14034</refentryinfo>
14035<refmeta>
14036 <refentrytitle><phrase>drm_property_lookup_blob</phrase></refentrytitle>
14037 <manvolnum>9</manvolnum>
14038 <refmiscinfo class="version">4.4.14</refmiscinfo>
14039</refmeta>
14040<refnamediv>
14041 <refname>drm_property_lookup_blob</refname>
14042 <refpurpose>
14043     look up a blob property and take a reference
14044 </refpurpose>
14045</refnamediv>
14046<refsynopsisdiv>
14047 <title>Synopsis</title>
14048  <funcsynopsis><funcprototype>
14049   <funcdef>struct drm_property_blob * <function>drm_property_lookup_blob </function></funcdef>
14050   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
14051   <paramdef>uint32_t <parameter>id</parameter></paramdef>
14052  </funcprototype></funcsynopsis>
14053</refsynopsisdiv>
14054<refsect1>
14055 <title>Arguments</title>
14056 <variablelist>
14057  <varlistentry>
14058   <term><parameter>dev</parameter></term>
14059   <listitem>
14060    <para>
14061     drm device
14062    </para>
14063   </listitem>
14064  </varlistentry>
14065  <varlistentry>
14066   <term><parameter>id</parameter></term>
14067   <listitem>
14068    <para>
14069     id of the blob property
14070    </para>
14071   </listitem>
14072  </varlistentry>
14073 </variablelist>
14074</refsect1>
14075<refsect1>
14076<title>Description</title>
14077<para>
14078   If successful, this takes an additional reference to the blob property.
14079   callers need to make sure to eventually unreference the returned property
14080   again, using <parameter>drm_property_unreference_blob</parameter>.
14081</para>
14082</refsect1>
14083</refentry>
14084
14085<refentry id="API-drm-mode-connector-set-path-property">
14086<refentryinfo>
14087 <title>LINUX</title>
14088 <productname>Kernel Hackers Manual</productname>
14089 <date>July 2017</date>
14090</refentryinfo>
14091<refmeta>
14092 <refentrytitle><phrase>drm_mode_connector_set_path_property</phrase></refentrytitle>
14093 <manvolnum>9</manvolnum>
14094 <refmiscinfo class="version">4.4.14</refmiscinfo>
14095</refmeta>
14096<refnamediv>
14097 <refname>drm_mode_connector_set_path_property</refname>
14098 <refpurpose>
14099     set tile property on connector
14100 </refpurpose>
14101</refnamediv>
14102<refsynopsisdiv>
14103 <title>Synopsis</title>
14104  <funcsynopsis><funcprototype>
14105   <funcdef>int <function>drm_mode_connector_set_path_property </function></funcdef>
14106   <paramdef>struct drm_connector * <parameter>connector</parameter></paramdef>
14107   <paramdef>const char * <parameter>path</parameter></paramdef>
14108  </funcprototype></funcsynopsis>
14109</refsynopsisdiv>
14110<refsect1>
14111 <title>Arguments</title>
14112 <variablelist>
14113  <varlistentry>
14114   <term><parameter>connector</parameter></term>
14115   <listitem>
14116    <para>
14117     connector to set property on.
14118    </para>
14119   </listitem>
14120  </varlistentry>
14121  <varlistentry>
14122   <term><parameter>path</parameter></term>
14123   <listitem>
14124    <para>
14125     path to use for property; must not be NULL.
14126    </para>
14127   </listitem>
14128  </varlistentry>
14129 </variablelist>
14130</refsect1>
14131<refsect1>
14132<title>Description</title>
14133<para>
14134   This creates a property to expose to userspace to specify a
14135   connector path. This is mainly used for DisplayPort MST where
14136   connectors have a topology and we want to allow userspace to give
14137   them more meaningful names.
14138</para>
14139</refsect1>
14140<refsect1>
14141<title>Returns</title>
14142<para>
14143   Zero on success, negative errno on failure.
14144</para>
14145</refsect1>
14146</refentry>
14147
14148<refentry id="API-drm-mode-connector-set-tile-property">
14149<refentryinfo>
14150 <title>LINUX</title>
14151 <productname>Kernel Hackers Manual</productname>
14152 <date>July 2017</date>
14153</refentryinfo>
14154<refmeta>
14155 <refentrytitle><phrase>drm_mode_connector_set_tile_property</phrase></refentrytitle>
14156 <manvolnum>9</manvolnum>
14157 <refmiscinfo class="version">4.4.14</refmiscinfo>
14158</refmeta>
14159<refnamediv>
14160 <refname>drm_mode_connector_set_tile_property</refname>
14161 <refpurpose>
14162     set tile property on connector
14163 </refpurpose>
14164</refnamediv>
14165<refsynopsisdiv>
14166 <title>Synopsis</title>
14167  <funcsynopsis><funcprototype>
14168   <funcdef>int <function>drm_mode_connector_set_tile_property </function></funcdef>
14169   <paramdef>struct drm_connector * <parameter>connector</parameter></paramdef>
14170  </funcprototype></funcsynopsis>
14171</refsynopsisdiv>
14172<refsect1>
14173 <title>Arguments</title>
14174 <variablelist>
14175  <varlistentry>
14176   <term><parameter>connector</parameter></term>
14177   <listitem>
14178    <para>
14179     connector to set property on.
14180    </para>
14181   </listitem>
14182  </varlistentry>
14183 </variablelist>
14184</refsect1>
14185<refsect1>
14186<title>Description</title>
14187<para>
14188   This looks up the tile information for a connector, and creates a
14189   property for userspace to parse if it exists. The property is of
14190   the form of 8 integers using ':' as a separator.
14191</para>
14192</refsect1>
14193<refsect1>
14194<title>Returns</title>
14195<para>
14196   Zero on success, errno on failure.
14197</para>
14198</refsect1>
14199</refentry>
14200
14201<refentry id="API-drm-mode-connector-update-edid-property">
14202<refentryinfo>
14203 <title>LINUX</title>
14204 <productname>Kernel Hackers Manual</productname>
14205 <date>July 2017</date>
14206</refentryinfo>
14207<refmeta>
14208 <refentrytitle><phrase>drm_mode_connector_update_edid_property</phrase></refentrytitle>
14209 <manvolnum>9</manvolnum>
14210 <refmiscinfo class="version">4.4.14</refmiscinfo>
14211</refmeta>
14212<refnamediv>
14213 <refname>drm_mode_connector_update_edid_property</refname>
14214 <refpurpose>
14215     update the edid property of a connector
14216 </refpurpose>
14217</refnamediv>
14218<refsynopsisdiv>
14219 <title>Synopsis</title>
14220  <funcsynopsis><funcprototype>
14221   <funcdef>int <function>drm_mode_connector_update_edid_property </function></funcdef>
14222   <paramdef>struct drm_connector * <parameter>connector</parameter></paramdef>
14223   <paramdef>const struct edid * <parameter>edid</parameter></paramdef>
14224  </funcprototype></funcsynopsis>
14225</refsynopsisdiv>
14226<refsect1>
14227 <title>Arguments</title>
14228 <variablelist>
14229  <varlistentry>
14230   <term><parameter>connector</parameter></term>
14231   <listitem>
14232    <para>
14233     drm connector
14234    </para>
14235   </listitem>
14236  </varlistentry>
14237  <varlistentry>
14238   <term><parameter>edid</parameter></term>
14239   <listitem>
14240    <para>
14241     new value of the edid property
14242    </para>
14243   </listitem>
14244  </varlistentry>
14245 </variablelist>
14246</refsect1>
14247<refsect1>
14248<title>Description</title>
14249<para>
14250   This function creates a new blob modeset object and assigns its id to the
14251   connector's edid property.
14252</para>
14253</refsect1>
14254<refsect1>
14255<title>Returns</title>
14256<para>
14257   Zero on success, negative errno on failure.
14258</para>
14259</refsect1>
14260</refentry>
14261
14262<refentry id="API-drm-mode-plane-set-obj-prop">
14263<refentryinfo>
14264 <title>LINUX</title>
14265 <productname>Kernel Hackers Manual</productname>
14266 <date>July 2017</date>
14267</refentryinfo>
14268<refmeta>
14269 <refentrytitle><phrase>drm_mode_plane_set_obj_prop</phrase></refentrytitle>
14270 <manvolnum>9</manvolnum>
14271 <refmiscinfo class="version">4.4.14</refmiscinfo>
14272</refmeta>
14273<refnamediv>
14274 <refname>drm_mode_plane_set_obj_prop</refname>
14275 <refpurpose>
14276     set the value of a property
14277 </refpurpose>
14278</refnamediv>
14279<refsynopsisdiv>
14280 <title>Synopsis</title>
14281  <funcsynopsis><funcprototype>
14282   <funcdef>int <function>drm_mode_plane_set_obj_prop </function></funcdef>
14283   <paramdef>struct drm_plane * <parameter>plane</parameter></paramdef>
14284   <paramdef>struct drm_property * <parameter>property</parameter></paramdef>
14285   <paramdef>uint64_t <parameter>value</parameter></paramdef>
14286  </funcprototype></funcsynopsis>
14287</refsynopsisdiv>
14288<refsect1>
14289 <title>Arguments</title>
14290 <variablelist>
14291  <varlistentry>
14292   <term><parameter>plane</parameter></term>
14293   <listitem>
14294    <para>
14295     drm plane object to set property value for
14296    </para>
14297   </listitem>
14298  </varlistentry>
14299  <varlistentry>
14300   <term><parameter>property</parameter></term>
14301   <listitem>
14302    <para>
14303     property to set
14304    </para>
14305   </listitem>
14306  </varlistentry>
14307  <varlistentry>
14308   <term><parameter>value</parameter></term>
14309   <listitem>
14310    <para>
14311     value the property should be set to
14312    </para>
14313   </listitem>
14314  </varlistentry>
14315 </variablelist>
14316</refsect1>
14317<refsect1>
14318<title>Description</title>
14319<para>
14320   This functions sets a given property on a given plane object. This function
14321   calls the driver's -&gt;set_property callback and changes the software state of
14322   the property if the callback succeeds.
14323</para>
14324</refsect1>
14325<refsect1>
14326<title>Returns</title>
14327<para>
14328   Zero on success, error code on failure.
14329</para>
14330</refsect1>
14331</refentry>
14332
14333<refentry id="API-drm-mode-connector-attach-encoder">
14334<refentryinfo>
14335 <title>LINUX</title>
14336 <productname>Kernel Hackers Manual</productname>
14337 <date>July 2017</date>
14338</refentryinfo>
14339<refmeta>
14340 <refentrytitle><phrase>drm_mode_connector_attach_encoder</phrase></refentrytitle>
14341 <manvolnum>9</manvolnum>
14342 <refmiscinfo class="version">4.4.14</refmiscinfo>
14343</refmeta>
14344<refnamediv>
14345 <refname>drm_mode_connector_attach_encoder</refname>
14346 <refpurpose>
14347     attach a connector to an encoder
14348 </refpurpose>
14349</refnamediv>
14350<refsynopsisdiv>
14351 <title>Synopsis</title>
14352  <funcsynopsis><funcprototype>
14353   <funcdef>int <function>drm_mode_connector_attach_encoder </function></funcdef>
14354   <paramdef>struct drm_connector * <parameter>connector</parameter></paramdef>
14355   <paramdef>struct drm_encoder * <parameter>encoder</parameter></paramdef>
14356  </funcprototype></funcsynopsis>
14357</refsynopsisdiv>
14358<refsect1>
14359 <title>Arguments</title>
14360 <variablelist>
14361  <varlistentry>
14362   <term><parameter>connector</parameter></term>
14363   <listitem>
14364    <para>
14365     connector to attach
14366    </para>
14367   </listitem>
14368  </varlistentry>
14369  <varlistentry>
14370   <term><parameter>encoder</parameter></term>
14371   <listitem>
14372    <para>
14373     encoder to attach <parameter>connector</parameter> to
14374    </para>
14375   </listitem>
14376  </varlistentry>
14377 </variablelist>
14378</refsect1>
14379<refsect1>
14380<title>Description</title>
14381<para>
14382   This function links up a connector to an encoder. Note that the routing
14383   restrictions between encoders and crtcs are exposed to userspace through the
14384   possible_clones and possible_crtcs bitmasks.
14385</para>
14386</refsect1>
14387<refsect1>
14388<title>Returns</title>
14389<para>
14390   Zero on success, negative errno on failure.
14391</para>
14392</refsect1>
14393</refentry>
14394
14395<refentry id="API-drm-mode-crtc-set-gamma-size">
14396<refentryinfo>
14397 <title>LINUX</title>
14398 <productname>Kernel Hackers Manual</productname>
14399 <date>July 2017</date>
14400</refentryinfo>
14401<refmeta>
14402 <refentrytitle><phrase>drm_mode_crtc_set_gamma_size</phrase></refentrytitle>
14403 <manvolnum>9</manvolnum>
14404 <refmiscinfo class="version">4.4.14</refmiscinfo>
14405</refmeta>
14406<refnamediv>
14407 <refname>drm_mode_crtc_set_gamma_size</refname>
14408 <refpurpose>
14409     set the gamma table size
14410 </refpurpose>
14411</refnamediv>
14412<refsynopsisdiv>
14413 <title>Synopsis</title>
14414  <funcsynopsis><funcprototype>
14415   <funcdef>int <function>drm_mode_crtc_set_gamma_size </function></funcdef>
14416   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
14417   <paramdef>int <parameter>gamma_size</parameter></paramdef>
14418  </funcprototype></funcsynopsis>
14419</refsynopsisdiv>
14420<refsect1>
14421 <title>Arguments</title>
14422 <variablelist>
14423  <varlistentry>
14424   <term><parameter>crtc</parameter></term>
14425   <listitem>
14426    <para>
14427     CRTC to set the gamma table size for
14428    </para>
14429   </listitem>
14430  </varlistentry>
14431  <varlistentry>
14432   <term><parameter>gamma_size</parameter></term>
14433   <listitem>
14434    <para>
14435     size of the gamma table
14436    </para>
14437   </listitem>
14438  </varlistentry>
14439 </variablelist>
14440</refsect1>
14441<refsect1>
14442<title>Description</title>
14443<para>
14444   Drivers which support gamma tables should set this to the supported gamma
14445   table size when initializing the CRTC. Currently the drm core only supports a
14446   fixed gamma table size.
14447</para>
14448</refsect1>
14449<refsect1>
14450<title>Returns</title>
14451<para>
14452   Zero on success, negative errno on failure.
14453</para>
14454</refsect1>
14455</refentry>
14456
14457<refentry id="API-drm-mode-config-reset">
14458<refentryinfo>
14459 <title>LINUX</title>
14460 <productname>Kernel Hackers Manual</productname>
14461 <date>July 2017</date>
14462</refentryinfo>
14463<refmeta>
14464 <refentrytitle><phrase>drm_mode_config_reset</phrase></refentrytitle>
14465 <manvolnum>9</manvolnum>
14466 <refmiscinfo class="version">4.4.14</refmiscinfo>
14467</refmeta>
14468<refnamediv>
14469 <refname>drm_mode_config_reset</refname>
14470 <refpurpose>
14471     call -&gt;reset callbacks
14472 </refpurpose>
14473</refnamediv>
14474<refsynopsisdiv>
14475 <title>Synopsis</title>
14476  <funcsynopsis><funcprototype>
14477   <funcdef>void <function>drm_mode_config_reset </function></funcdef>
14478   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
14479  </funcprototype></funcsynopsis>
14480</refsynopsisdiv>
14481<refsect1>
14482 <title>Arguments</title>
14483 <variablelist>
14484  <varlistentry>
14485   <term><parameter>dev</parameter></term>
14486   <listitem>
14487    <para>
14488     drm device
14489    </para>
14490   </listitem>
14491  </varlistentry>
14492 </variablelist>
14493</refsect1>
14494<refsect1>
14495<title>Description</title>
14496<para>
14497   This functions calls all the crtc's, encoder's and connector's -&gt;reset
14498   callback. Drivers can use this in e.g. their driver load or resume code to
14499   reset hardware and software state.
14500</para>
14501</refsect1>
14502</refentry>
14503
14504<refentry id="API-drm-fb-get-bpp-depth">
14505<refentryinfo>
14506 <title>LINUX</title>
14507 <productname>Kernel Hackers Manual</productname>
14508 <date>July 2017</date>
14509</refentryinfo>
14510<refmeta>
14511 <refentrytitle><phrase>drm_fb_get_bpp_depth</phrase></refentrytitle>
14512 <manvolnum>9</manvolnum>
14513 <refmiscinfo class="version">4.4.14</refmiscinfo>
14514</refmeta>
14515<refnamediv>
14516 <refname>drm_fb_get_bpp_depth</refname>
14517 <refpurpose>
14518     get the bpp/depth values for format
14519 </refpurpose>
14520</refnamediv>
14521<refsynopsisdiv>
14522 <title>Synopsis</title>
14523  <funcsynopsis><funcprototype>
14524   <funcdef>void <function>drm_fb_get_bpp_depth </function></funcdef>
14525   <paramdef>uint32_t <parameter>format</parameter></paramdef>
14526   <paramdef>unsigned int * <parameter>depth</parameter></paramdef>
14527   <paramdef>int * <parameter>bpp</parameter></paramdef>
14528  </funcprototype></funcsynopsis>
14529</refsynopsisdiv>
14530<refsect1>
14531 <title>Arguments</title>
14532 <variablelist>
14533  <varlistentry>
14534   <term><parameter>format</parameter></term>
14535   <listitem>
14536    <para>
14537     pixel format (DRM_FORMAT_*)
14538    </para>
14539   </listitem>
14540  </varlistentry>
14541  <varlistentry>
14542   <term><parameter>depth</parameter></term>
14543   <listitem>
14544    <para>
14545     storage for the depth value
14546    </para>
14547   </listitem>
14548  </varlistentry>
14549  <varlistentry>
14550   <term><parameter>bpp</parameter></term>
14551   <listitem>
14552    <para>
14553     storage for the bpp value
14554    </para>
14555   </listitem>
14556  </varlistentry>
14557 </variablelist>
14558</refsect1>
14559<refsect1>
14560<title>Description</title>
14561<para>
14562   This only supports RGB formats here for compat with code that doesn't use
14563   pixel formats directly yet.
14564</para>
14565</refsect1>
14566</refentry>
14567
14568<refentry id="API-drm-format-num-planes">
14569<refentryinfo>
14570 <title>LINUX</title>
14571 <productname>Kernel Hackers Manual</productname>
14572 <date>July 2017</date>
14573</refentryinfo>
14574<refmeta>
14575 <refentrytitle><phrase>drm_format_num_planes</phrase></refentrytitle>
14576 <manvolnum>9</manvolnum>
14577 <refmiscinfo class="version">4.4.14</refmiscinfo>
14578</refmeta>
14579<refnamediv>
14580 <refname>drm_format_num_planes</refname>
14581 <refpurpose>
14582     get the number of planes for format
14583 </refpurpose>
14584</refnamediv>
14585<refsynopsisdiv>
14586 <title>Synopsis</title>
14587  <funcsynopsis><funcprototype>
14588   <funcdef>int <function>drm_format_num_planes </function></funcdef>
14589   <paramdef>uint32_t <parameter>format</parameter></paramdef>
14590  </funcprototype></funcsynopsis>
14591</refsynopsisdiv>
14592<refsect1>
14593 <title>Arguments</title>
14594 <variablelist>
14595  <varlistentry>
14596   <term><parameter>format</parameter></term>
14597   <listitem>
14598    <para>
14599     pixel format (DRM_FORMAT_*)
14600    </para>
14601   </listitem>
14602  </varlistentry>
14603 </variablelist>
14604</refsect1>
14605<refsect1>
14606<title>Returns</title>
14607<para>
14608   The number of planes used by the specified pixel format.
14609</para>
14610</refsect1>
14611</refentry>
14612
14613<refentry id="API-drm-format-plane-cpp">
14614<refentryinfo>
14615 <title>LINUX</title>
14616 <productname>Kernel Hackers Manual</productname>
14617 <date>July 2017</date>
14618</refentryinfo>
14619<refmeta>
14620 <refentrytitle><phrase>drm_format_plane_cpp</phrase></refentrytitle>
14621 <manvolnum>9</manvolnum>
14622 <refmiscinfo class="version">4.4.14</refmiscinfo>
14623</refmeta>
14624<refnamediv>
14625 <refname>drm_format_plane_cpp</refname>
14626 <refpurpose>
14627     determine the bytes per pixel value
14628 </refpurpose>
14629</refnamediv>
14630<refsynopsisdiv>
14631 <title>Synopsis</title>
14632  <funcsynopsis><funcprototype>
14633   <funcdef>int <function>drm_format_plane_cpp </function></funcdef>
14634   <paramdef>uint32_t <parameter>format</parameter></paramdef>
14635   <paramdef>int <parameter>plane</parameter></paramdef>
14636  </funcprototype></funcsynopsis>
14637</refsynopsisdiv>
14638<refsect1>
14639 <title>Arguments</title>
14640 <variablelist>
14641  <varlistentry>
14642   <term><parameter>format</parameter></term>
14643   <listitem>
14644    <para>
14645     pixel format (DRM_FORMAT_*)
14646    </para>
14647   </listitem>
14648  </varlistentry>
14649  <varlistentry>
14650   <term><parameter>plane</parameter></term>
14651   <listitem>
14652    <para>
14653     plane index
14654    </para>
14655   </listitem>
14656  </varlistentry>
14657 </variablelist>
14658</refsect1>
14659<refsect1>
14660<title>Returns</title>
14661<para>
14662   The bytes per pixel value for the specified plane.
14663</para>
14664</refsect1>
14665</refentry>
14666
14667<refentry id="API-drm-format-horz-chroma-subsampling">
14668<refentryinfo>
14669 <title>LINUX</title>
14670 <productname>Kernel Hackers Manual</productname>
14671 <date>July 2017</date>
14672</refentryinfo>
14673<refmeta>
14674 <refentrytitle><phrase>drm_format_horz_chroma_subsampling</phrase></refentrytitle>
14675 <manvolnum>9</manvolnum>
14676 <refmiscinfo class="version">4.4.14</refmiscinfo>
14677</refmeta>
14678<refnamediv>
14679 <refname>drm_format_horz_chroma_subsampling</refname>
14680 <refpurpose>
14681     get the horizontal chroma subsampling factor
14682 </refpurpose>
14683</refnamediv>
14684<refsynopsisdiv>
14685 <title>Synopsis</title>
14686  <funcsynopsis><funcprototype>
14687   <funcdef>int <function>drm_format_horz_chroma_subsampling </function></funcdef>
14688   <paramdef>uint32_t <parameter>format</parameter></paramdef>
14689  </funcprototype></funcsynopsis>
14690</refsynopsisdiv>
14691<refsect1>
14692 <title>Arguments</title>
14693 <variablelist>
14694  <varlistentry>
14695   <term><parameter>format</parameter></term>
14696   <listitem>
14697    <para>
14698     pixel format (DRM_FORMAT_*)
14699    </para>
14700   </listitem>
14701  </varlistentry>
14702 </variablelist>
14703</refsect1>
14704<refsect1>
14705<title>Returns</title>
14706<para>
14707   The horizontal chroma subsampling factor for the
14708   specified pixel format.
14709</para>
14710</refsect1>
14711</refentry>
14712
14713<refentry id="API-drm-format-vert-chroma-subsampling">
14714<refentryinfo>
14715 <title>LINUX</title>
14716 <productname>Kernel Hackers Manual</productname>
14717 <date>July 2017</date>
14718</refentryinfo>
14719<refmeta>
14720 <refentrytitle><phrase>drm_format_vert_chroma_subsampling</phrase></refentrytitle>
14721 <manvolnum>9</manvolnum>
14722 <refmiscinfo class="version">4.4.14</refmiscinfo>
14723</refmeta>
14724<refnamediv>
14725 <refname>drm_format_vert_chroma_subsampling</refname>
14726 <refpurpose>
14727     get the vertical chroma subsampling factor
14728 </refpurpose>
14729</refnamediv>
14730<refsynopsisdiv>
14731 <title>Synopsis</title>
14732  <funcsynopsis><funcprototype>
14733   <funcdef>int <function>drm_format_vert_chroma_subsampling </function></funcdef>
14734   <paramdef>uint32_t <parameter>format</parameter></paramdef>
14735  </funcprototype></funcsynopsis>
14736</refsynopsisdiv>
14737<refsect1>
14738 <title>Arguments</title>
14739 <variablelist>
14740  <varlistentry>
14741   <term><parameter>format</parameter></term>
14742   <listitem>
14743    <para>
14744     pixel format (DRM_FORMAT_*)
14745    </para>
14746   </listitem>
14747  </varlistentry>
14748 </variablelist>
14749</refsect1>
14750<refsect1>
14751<title>Returns</title>
14752<para>
14753   The vertical chroma subsampling factor for the
14754   specified pixel format.
14755</para>
14756</refsect1>
14757</refentry>
14758
14759<refentry id="API-drm-rotation-simplify">
14760<refentryinfo>
14761 <title>LINUX</title>
14762 <productname>Kernel Hackers Manual</productname>
14763 <date>July 2017</date>
14764</refentryinfo>
14765<refmeta>
14766 <refentrytitle><phrase>drm_rotation_simplify</phrase></refentrytitle>
14767 <manvolnum>9</manvolnum>
14768 <refmiscinfo class="version">4.4.14</refmiscinfo>
14769</refmeta>
14770<refnamediv>
14771 <refname>drm_rotation_simplify</refname>
14772 <refpurpose>
14773     Try to simplify the rotation
14774 </refpurpose>
14775</refnamediv>
14776<refsynopsisdiv>
14777 <title>Synopsis</title>
14778  <funcsynopsis><funcprototype>
14779   <funcdef>unsigned int <function>drm_rotation_simplify </function></funcdef>
14780   <paramdef>unsigned int <parameter>rotation</parameter></paramdef>
14781   <paramdef>unsigned int <parameter>supported_rotations</parameter></paramdef>
14782  </funcprototype></funcsynopsis>
14783</refsynopsisdiv>
14784<refsect1>
14785 <title>Arguments</title>
14786 <variablelist>
14787  <varlistentry>
14788   <term><parameter>rotation</parameter></term>
14789   <listitem>
14790    <para>
14791     Rotation to be simplified
14792    </para>
14793   </listitem>
14794  </varlistentry>
14795  <varlistentry>
14796   <term><parameter>supported_rotations</parameter></term>
14797   <listitem>
14798    <para>
14799     Supported rotations
14800    </para>
14801   </listitem>
14802  </varlistentry>
14803 </variablelist>
14804</refsect1>
14805<refsect1>
14806<title>Description</title>
14807<para>
14808   Attempt to simplify the rotation to a form that is supported.
14809   Eg. if the hardware supports everything except DRM_REFLECT_X
14810</para>
14811</refsect1>
14812<refsect1>
14813<title>one could call this function like this</title>
14814<para>
14815   </para><para>
14816
14817   drm_rotation_simplify(rotation, BIT(DRM_ROTATE_0) |
14818   BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_180) |
14819   BIT(DRM_ROTATE_270) | BIT(DRM_REFLECT_Y));
14820   </para><para>
14821
14822   to eliminate the DRM_ROTATE_X flag. Depending on what kind of
14823   transforms the hardware supports, this function may not
14824   be able to produce a supported transform, so the caller should
14825   check the result afterwards.
14826</para>
14827</refsect1>
14828</refentry>
14829
14830<refentry id="API-drm-mode-config-init">
14831<refentryinfo>
14832 <title>LINUX</title>
14833 <productname>Kernel Hackers Manual</productname>
14834 <date>July 2017</date>
14835</refentryinfo>
14836<refmeta>
14837 <refentrytitle><phrase>drm_mode_config_init</phrase></refentrytitle>
14838 <manvolnum>9</manvolnum>
14839 <refmiscinfo class="version">4.4.14</refmiscinfo>
14840</refmeta>
14841<refnamediv>
14842 <refname>drm_mode_config_init</refname>
14843 <refpurpose>
14844     initialize DRM mode_configuration structure
14845 </refpurpose>
14846</refnamediv>
14847<refsynopsisdiv>
14848 <title>Synopsis</title>
14849  <funcsynopsis><funcprototype>
14850   <funcdef>void <function>drm_mode_config_init </function></funcdef>
14851   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
14852  </funcprototype></funcsynopsis>
14853</refsynopsisdiv>
14854<refsect1>
14855 <title>Arguments</title>
14856 <variablelist>
14857  <varlistentry>
14858   <term><parameter>dev</parameter></term>
14859   <listitem>
14860    <para>
14861     DRM device
14862    </para>
14863   </listitem>
14864  </varlistentry>
14865 </variablelist>
14866</refsect1>
14867<refsect1>
14868<title>Description</title>
14869<para>
14870   Initialize <parameter>dev</parameter>'s mode_config structure, used for tracking the graphics
14871   configuration of <parameter>dev</parameter>.
14872   </para><para>
14873
14874   Since this initializes the modeset locks, no locking is possible. Which is no
14875   problem, since this should happen single threaded at init time. It is the
14876   driver's problem to ensure this guarantee.
14877</para>
14878</refsect1>
14879</refentry>
14880
14881<refentry id="API-drm-mode-config-cleanup">
14882<refentryinfo>
14883 <title>LINUX</title>
14884 <productname>Kernel Hackers Manual</productname>
14885 <date>July 2017</date>
14886</refentryinfo>
14887<refmeta>
14888 <refentrytitle><phrase>drm_mode_config_cleanup</phrase></refentrytitle>
14889 <manvolnum>9</manvolnum>
14890 <refmiscinfo class="version">4.4.14</refmiscinfo>
14891</refmeta>
14892<refnamediv>
14893 <refname>drm_mode_config_cleanup</refname>
14894 <refpurpose>
14895     free up DRM mode_config info
14896 </refpurpose>
14897</refnamediv>
14898<refsynopsisdiv>
14899 <title>Synopsis</title>
14900  <funcsynopsis><funcprototype>
14901   <funcdef>void <function>drm_mode_config_cleanup </function></funcdef>
14902   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
14903  </funcprototype></funcsynopsis>
14904</refsynopsisdiv>
14905<refsect1>
14906 <title>Arguments</title>
14907 <variablelist>
14908  <varlistentry>
14909   <term><parameter>dev</parameter></term>
14910   <listitem>
14911    <para>
14912     DRM device
14913    </para>
14914   </listitem>
14915  </varlistentry>
14916 </variablelist>
14917</refsect1>
14918<refsect1>
14919<title>Description</title>
14920<para>
14921   Free up all the connectors and CRTCs associated with this DRM device, then
14922   free up the framebuffers and associated buffer objects.
14923   </para><para>
14924
14925   Note that since this /should/ happen single-threaded at driver/device
14926   teardown time, no locking is required. It's the driver's job to ensure that
14927   this guarantee actually holds true.
14928</para>
14929</refsect1>
14930<refsect1>
14931<title>FIXME</title>
14932<para>
14933   cleanup any dangling user buffer objects too
14934</para>
14935</refsect1>
14936</refentry>
14937
14938<refentry id="API-drm-mode-get-tile-group">
14939<refentryinfo>
14940 <title>LINUX</title>
14941 <productname>Kernel Hackers Manual</productname>
14942 <date>July 2017</date>
14943</refentryinfo>
14944<refmeta>
14945 <refentrytitle><phrase>drm_mode_get_tile_group</phrase></refentrytitle>
14946 <manvolnum>9</manvolnum>
14947 <refmiscinfo class="version">4.4.14</refmiscinfo>
14948</refmeta>
14949<refnamediv>
14950 <refname>drm_mode_get_tile_group</refname>
14951 <refpurpose>
14952     get a reference to an existing tile group
14953 </refpurpose>
14954</refnamediv>
14955<refsynopsisdiv>
14956 <title>Synopsis</title>
14957  <funcsynopsis><funcprototype>
14958   <funcdef>struct drm_tile_group * <function>drm_mode_get_tile_group </function></funcdef>
14959   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
14960   <paramdef>char <parameter>topology[8]</parameter></paramdef>
14961  </funcprototype></funcsynopsis>
14962</refsynopsisdiv>
14963<refsect1>
14964 <title>Arguments</title>
14965 <variablelist>
14966  <varlistentry>
14967   <term><parameter>dev</parameter></term>
14968   <listitem>
14969    <para>
14970     DRM device
14971    </para>
14972   </listitem>
14973  </varlistentry>
14974  <varlistentry>
14975   <term><parameter>topology[8]</parameter></term>
14976   <listitem>
14977    <para>
14978     8-bytes unique per monitor.
14979    </para>
14980   </listitem>
14981  </varlistentry>
14982 </variablelist>
14983</refsect1>
14984<refsect1>
14985<title>Description</title>
14986<para>
14987   Use the unique bytes to get a reference to an existing tile group.
14988</para>
14989</refsect1>
14990<refsect1>
14991<title>RETURNS</title>
14992<para>
14993   tile group or NULL if not found.
14994</para>
14995</refsect1>
14996</refentry>
14997
14998<refentry id="API-drm-mode-create-tile-group">
14999<refentryinfo>
15000 <title>LINUX</title>
15001 <productname>Kernel Hackers Manual</productname>
15002 <date>July 2017</date>
15003</refentryinfo>
15004<refmeta>
15005 <refentrytitle><phrase>drm_mode_create_tile_group</phrase></refentrytitle>
15006 <manvolnum>9</manvolnum>
15007 <refmiscinfo class="version">4.4.14</refmiscinfo>
15008</refmeta>
15009<refnamediv>
15010 <refname>drm_mode_create_tile_group</refname>
15011 <refpurpose>
15012     create a tile group from a displayid description
15013 </refpurpose>
15014</refnamediv>
15015<refsynopsisdiv>
15016 <title>Synopsis</title>
15017  <funcsynopsis><funcprototype>
15018   <funcdef>struct drm_tile_group * <function>drm_mode_create_tile_group </function></funcdef>
15019   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
15020   <paramdef>char <parameter>topology[8]</parameter></paramdef>
15021  </funcprototype></funcsynopsis>
15022</refsynopsisdiv>
15023<refsect1>
15024 <title>Arguments</title>
15025 <variablelist>
15026  <varlistentry>
15027   <term><parameter>dev</parameter></term>
15028   <listitem>
15029    <para>
15030     DRM device
15031    </para>
15032   </listitem>
15033  </varlistentry>
15034  <varlistentry>
15035   <term><parameter>topology[8]</parameter></term>
15036   <listitem>
15037    <para>
15038     8-bytes unique per monitor.
15039    </para>
15040   </listitem>
15041  </varlistentry>
15042 </variablelist>
15043</refsect1>
15044<refsect1>
15045<title>Description</title>
15046<para>
15047   Create a tile group for the unique monitor, and get a unique
15048   identifier for the tile group.
15049</para>
15050</refsect1>
15051<refsect1>
15052<title>RETURNS</title>
15053<para>
15054   new tile group or error.
15055</para>
15056</refsect1>
15057</refentry>
15058
15059    </sect2>
15060    <sect2>
15061      <title>KMS Data Structures</title>
15062<!-- include/drm/drm_crtc.h -->
15063<refentry id="API-struct-drm-crtc-state">
15064<refentryinfo>
15065 <title>LINUX</title>
15066 <productname>Kernel Hackers Manual</productname>
15067 <date>July 2017</date>
15068</refentryinfo>
15069<refmeta>
15070 <refentrytitle><phrase>struct drm_crtc_state</phrase></refentrytitle>
15071 <manvolnum>9</manvolnum>
15072 <refmiscinfo class="version">4.4.14</refmiscinfo>
15073</refmeta>
15074<refnamediv>
15075 <refname>struct drm_crtc_state</refname>
15076 <refpurpose>
15077  mutable CRTC state
15078 </refpurpose>
15079</refnamediv>
15080<refsynopsisdiv>
15081 <title>Synopsis</title>
15082  <programlisting>
15083struct drm_crtc_state {
15084  struct drm_crtc * crtc;
15085  bool enable;
15086  bool active;
15087  bool planes_changed:1;
15088  bool mode_changed:1;
15089  bool active_changed:1;
15090  bool connectors_changed:1;
15091  u32 plane_mask;
15092  u32 last_vblank_count;
15093  struct drm_display_mode adjusted_mode;
15094  struct drm_display_mode mode;
15095  struct drm_pending_vblank_event * event;
15096  struct drm_atomic_state * state;
15097};  </programlisting>
15098</refsynopsisdiv>
15099 <refsect1>
15100  <title>Members</title>
15101  <variablelist>
15102    <varlistentry>      <term>crtc</term>
15103      <listitem><para>
15104backpointer to the CRTC
15105      </para></listitem>
15106    </varlistentry>
15107    <varlistentry>      <term>enable</term>
15108      <listitem><para>
15109whether the CRTC should be enabled, gates all other state
15110      </para></listitem>
15111    </varlistentry>
15112    <varlistentry>      <term>active</term>
15113      <listitem><para>
15114whether the CRTC is actively displaying (used for DPMS)
15115      </para></listitem>
15116    </varlistentry>
15117    <varlistentry>      <term>planes_changed</term>
15118      <listitem><para>
15119planes on this crtc are updated
15120      </para></listitem>
15121    </varlistentry>
15122    <varlistentry>      <term>mode_changed</term>
15123      <listitem><para>
15124crtc_state-&gt;mode or crtc_state-&gt;enable has been changed
15125      </para></listitem>
15126    </varlistentry>
15127    <varlistentry>      <term>active_changed</term>
15128      <listitem><para>
15129crtc_state-&gt;active has been toggled.
15130      </para></listitem>
15131    </varlistentry>
15132    <varlistentry>      <term>connectors_changed</term>
15133      <listitem><para>
15134connectors to this crtc have been updated
15135      </para></listitem>
15136    </varlistentry>
15137    <varlistentry>      <term>plane_mask</term>
15138      <listitem><para>
15139bitmask of (1 &lt;&lt; drm_plane_index(plane)) of attached planes
15140      </para></listitem>
15141    </varlistentry>
15142    <varlistentry>      <term>last_vblank_count</term>
15143      <listitem><para>
15144for helpers and drivers to capture the vblank of the
15145update to ensure framebuffer cleanup isn't done too early
15146      </para></listitem>
15147    </varlistentry>
15148    <varlistentry>      <term>adjusted_mode</term>
15149      <listitem><para>
15150for use by helpers and drivers to compute adjusted mode timings
15151      </para></listitem>
15152    </varlistentry>
15153    <varlistentry>      <term>mode</term>
15154      <listitem><para>
15155current mode timings
15156      </para></listitem>
15157    </varlistentry>
15158    <varlistentry>      <term>event</term>
15159      <listitem><para>
15160optional pointer to a DRM event to signal upon completion of the
15161state update
15162      </para></listitem>
15163    </varlistentry>
15164    <varlistentry>      <term>state</term>
15165      <listitem><para>
15166backpointer to global drm_atomic_state
15167      </para></listitem>
15168    </varlistentry>
15169  </variablelist>
15170 </refsect1>
15171<refsect1>
15172<title>Description</title>
15173<para>
15174   Note that the distinction between <parameter>enable</parameter> and <parameter>active</parameter> is rather subtile:
15175   Flipping <parameter>active</parameter> while <parameter>enable</parameter> is set without changing anything else may
15176   never return in a failure from the -&gt;atomic_check callback. Userspace assumes
15177   that a DPMS On will always succeed. In other words: <parameter>enable</parameter> controls resource
15178   assignment, <parameter>active</parameter> controls the actual hardware state.
15179</para>
15180</refsect1>
15181</refentry>
15182
15183<refentry id="API-struct-drm-crtc-funcs">
15184<refentryinfo>
15185 <title>LINUX</title>
15186 <productname>Kernel Hackers Manual</productname>
15187 <date>July 2017</date>
15188</refentryinfo>
15189<refmeta>
15190 <refentrytitle><phrase>struct drm_crtc_funcs</phrase></refentrytitle>
15191 <manvolnum>9</manvolnum>
15192 <refmiscinfo class="version">4.4.14</refmiscinfo>
15193</refmeta>
15194<refnamediv>
15195 <refname>struct drm_crtc_funcs</refname>
15196 <refpurpose>
15197     control CRTCs for a given device
15198 </refpurpose>
15199</refnamediv>
15200<refsynopsisdiv>
15201 <title>Synopsis</title>
15202  <programlisting>
15203struct drm_crtc_funcs {
15204  void (* save) (struct drm_crtc *crtc);
15205  void (* restore) (struct drm_crtc *crtc);
15206  void (* reset) (struct drm_crtc *crtc);
15207  int (* cursor_set) (struct drm_crtc *crtc, struct drm_file *file_priv,uint32_t handle, uint32_t width, uint32_t height);
15208  int (* cursor_set2) (struct drm_crtc *crtc, struct drm_file *file_priv,uint32_t handle, uint32_t width, uint32_t height,int32_t hot_x, int32_t hot_y);
15209  int (* cursor_move) (struct drm_crtc *crtc, int x, int y);
15210  void (* gamma_set) (struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b,uint32_t start, uint32_t size);
15211  void (* destroy) (struct drm_crtc *crtc);
15212  int (* set_config) (struct drm_mode_set *set);
15213  int (* page_flip) (struct drm_crtc *crtc,struct drm_framebuffer *fb,struct drm_pending_vblank_event *event,uint32_t flags);
15214  int (* set_property) (struct drm_crtc *crtc,struct drm_property *property, uint64_t val);
15215  struct drm_crtc_state *(* atomic_duplicate_state) (struct drm_crtc *crtc);
15216  void (* atomic_destroy_state) (struct drm_crtc *crtc,struct drm_crtc_state *state);
15217  int (* atomic_set_property) (struct drm_crtc *crtc,struct drm_crtc_state *state,struct drm_property *property,uint64_t val);
15218  int (* atomic_get_property) (struct drm_crtc *crtc,const struct drm_crtc_state *state,struct drm_property *property,uint64_t *val);
15219};  </programlisting>
15220</refsynopsisdiv>
15221 <refsect1>
15222  <title>Members</title>
15223  <variablelist>
15224    <varlistentry>      <term>save</term>
15225      <listitem><para>
15226   save CRTC state
15227      </para></listitem>
15228    </varlistentry>
15229    <varlistentry>      <term>restore</term>
15230      <listitem><para>
15231   restore CRTC state
15232      </para></listitem>
15233    </varlistentry>
15234    <varlistentry>      <term>reset</term>
15235      <listitem><para>
15236   reset CRTC after state has been invalidated (e.g. resume)
15237      </para></listitem>
15238    </varlistentry>
15239    <varlistentry>      <term>cursor_set</term>
15240      <listitem><para>
15241   setup the cursor
15242      </para></listitem>
15243    </varlistentry>
15244    <varlistentry>      <term>cursor_set2</term>
15245      <listitem><para>
15246   setup the cursor with hotspot, superseeds <parameter>cursor_set</parameter> if set
15247      </para></listitem>
15248    </varlistentry>
15249    <varlistentry>      <term>cursor_move</term>
15250      <listitem><para>
15251   move the cursor
15252      </para></listitem>
15253    </varlistentry>
15254    <varlistentry>      <term>gamma_set</term>
15255      <listitem><para>
15256   specify color ramp for CRTC
15257      </para></listitem>
15258    </varlistentry>
15259    <varlistentry>      <term>destroy</term>
15260      <listitem><para>
15261   deinit and free object
15262      </para></listitem>
15263    </varlistentry>
15264    <varlistentry>      <term>set_config</term>
15265      <listitem><para>
15266   apply a new CRTC configuration
15267      </para></listitem>
15268    </varlistentry>
15269    <varlistentry>      <term>page_flip</term>
15270      <listitem><para>
15271   initiate a page flip
15272      </para></listitem>
15273    </varlistentry>
15274    <varlistentry>      <term>set_property</term>
15275      <listitem><para>
15276   called when a property is changed
15277      </para></listitem>
15278    </varlistentry>
15279    <varlistentry>      <term>atomic_duplicate_state</term>
15280      <listitem><para>
15281   duplicate the atomic state for this CRTC
15282      </para></listitem>
15283    </varlistentry>
15284    <varlistentry>      <term>atomic_destroy_state</term>
15285      <listitem><para>
15286   destroy an atomic state for this CRTC
15287      </para></listitem>
15288    </varlistentry>
15289    <varlistentry>      <term>atomic_set_property</term>
15290      <listitem><para>
15291   set a property on an atomic state for this CRTC
15292   (do not call directly, use <function>drm_atomic_crtc_set_property</function>)
15293      </para></listitem>
15294    </varlistentry>
15295    <varlistentry>      <term>atomic_get_property</term>
15296      <listitem><para>
15297   get a property on an atomic state for this CRTC
15298   (do not call directly, use <function>drm_atomic_crtc_get_property</function>)
15299      </para></listitem>
15300    </varlistentry>
15301  </variablelist>
15302 </refsect1>
15303<refsect1>
15304<title>Description</title>
15305<para>
15306   The drm_crtc_funcs structure is the central CRTC management structure
15307   in the DRM.  Each CRTC controls one or more connectors (note that the name
15308   CRTC is simply historical, a CRTC may control LVDS, VGA, DVI, TV out, etc.
15309   connectors, not just CRTs).
15310   </para><para>
15311
15312   Each driver is responsible for filling out this structure at startup time,
15313   in addition to providing other modesetting features, like i2c and DDC
15314   bus accessors.
15315</para>
15316</refsect1>
15317</refentry>
15318
15319<refentry id="API-struct-drm-crtc">
15320<refentryinfo>
15321 <title>LINUX</title>
15322 <productname>Kernel Hackers Manual</productname>
15323 <date>July 2017</date>
15324</refentryinfo>
15325<refmeta>
15326 <refentrytitle><phrase>struct drm_crtc</phrase></refentrytitle>
15327 <manvolnum>9</manvolnum>
15328 <refmiscinfo class="version">4.4.14</refmiscinfo>
15329</refmeta>
15330<refnamediv>
15331 <refname>struct drm_crtc</refname>
15332 <refpurpose>
15333     central CRTC control structure
15334 </refpurpose>
15335</refnamediv>
15336<refsynopsisdiv>
15337 <title>Synopsis</title>
15338  <programlisting>
15339struct drm_crtc {
15340  struct drm_device * dev;
15341  struct device_node * port;
15342  struct list_head head;
15343  struct drm_modeset_lock mutex;
15344  struct drm_mode_object base;
15345  struct drm_plane * primary;
15346  struct drm_plane * cursor;
15347  int cursor_x;
15348  int cursor_y;
15349  bool enabled;
15350  struct drm_display_mode mode;
15351  struct drm_display_mode hwmode;
15352  int x;
15353  int y;
15354  const struct drm_crtc_funcs * funcs;
15355  uint32_t gamma_size;
15356  uint16_t * gamma_store;
15357  const void * helper_private;
15358  struct drm_object_properties properties;
15359  struct drm_crtc_state * state;
15360  struct drm_modeset_acquire_ctx * acquire_ctx;
15361};  </programlisting>
15362</refsynopsisdiv>
15363 <refsect1>
15364  <title>Members</title>
15365  <variablelist>
15366    <varlistentry>      <term>dev</term>
15367      <listitem><para>
15368   parent DRM device
15369      </para></listitem>
15370    </varlistentry>
15371    <varlistentry>      <term>port</term>
15372      <listitem><para>
15373   OF node used by <function>drm_of_find_possible_crtcs</function>
15374      </para></listitem>
15375    </varlistentry>
15376    <varlistentry>      <term>head</term>
15377      <listitem><para>
15378   list management
15379      </para></listitem>
15380    </varlistentry>
15381    <varlistentry>      <term>mutex</term>
15382      <listitem><para>
15383   per-CRTC locking
15384      </para></listitem>
15385    </varlistentry>
15386    <varlistentry>      <term>base</term>
15387      <listitem><para>
15388   base KMS object for ID tracking etc.
15389      </para></listitem>
15390    </varlistentry>
15391    <varlistentry>      <term>primary</term>
15392      <listitem><para>
15393   primary plane for this CRTC
15394      </para></listitem>
15395    </varlistentry>
15396    <varlistentry>      <term>cursor</term>
15397      <listitem><para>
15398   cursor plane for this CRTC
15399      </para></listitem>
15400    </varlistentry>
15401    <varlistentry>      <term>cursor_x</term>
15402      <listitem><para>
15403   current x position of the cursor, used for universal cursor planes
15404      </para></listitem>
15405    </varlistentry>
15406    <varlistentry>      <term>cursor_y</term>
15407      <listitem><para>
15408   current y position of the cursor, used for universal cursor planes
15409      </para></listitem>
15410    </varlistentry>
15411    <varlistentry>      <term>enabled</term>
15412      <listitem><para>
15413   is this CRTC enabled?
15414      </para></listitem>
15415    </varlistentry>
15416    <varlistentry>      <term>mode</term>
15417      <listitem><para>
15418   current mode timings
15419      </para></listitem>
15420    </varlistentry>
15421    <varlistentry>      <term>hwmode</term>
15422      <listitem><para>
15423   mode timings as programmed to hw regs
15424      </para></listitem>
15425    </varlistentry>
15426    <varlistentry>      <term>x</term>
15427      <listitem><para>
15428   x position on screen
15429      </para></listitem>
15430    </varlistentry>
15431    <varlistentry>      <term>y</term>
15432      <listitem><para>
15433   y position on screen
15434      </para></listitem>
15435    </varlistentry>
15436    <varlistentry>      <term>funcs</term>
15437      <listitem><para>
15438   CRTC control functions
15439      </para></listitem>
15440    </varlistentry>
15441    <varlistentry>      <term>gamma_size</term>
15442      <listitem><para>
15443   size of gamma ramp
15444      </para></listitem>
15445    </varlistentry>
15446    <varlistentry>      <term>gamma_store</term>
15447      <listitem><para>
15448   gamma ramp values
15449      </para></listitem>
15450    </varlistentry>
15451    <varlistentry>      <term>helper_private</term>
15452      <listitem><para>
15453   mid-layer private data
15454      </para></listitem>
15455    </varlistentry>
15456    <varlistentry>      <term>properties</term>
15457      <listitem><para>
15458   property tracking for this CRTC
15459      </para></listitem>
15460    </varlistentry>
15461    <varlistentry>      <term>state</term>
15462      <listitem><para>
15463   current atomic state for this CRTC
15464      </para></listitem>
15465    </varlistentry>
15466    <varlistentry>      <term>acquire_ctx</term>
15467      <listitem><para>
15468   per-CRTC implicit acquire context used by atomic drivers for
15469   legacy ioctls
15470      </para></listitem>
15471    </varlistentry>
15472  </variablelist>
15473 </refsect1>
15474<refsect1>
15475<title>Description</title>
15476<para>
15477   Each CRTC may have one or more connectors associated with it.  This structure
15478   allows the CRTC to be controlled.
15479</para>
15480</refsect1>
15481</refentry>
15482
15483<refentry id="API-struct-drm-connector-state">
15484<refentryinfo>
15485 <title>LINUX</title>
15486 <productname>Kernel Hackers Manual</productname>
15487 <date>July 2017</date>
15488</refentryinfo>
15489<refmeta>
15490 <refentrytitle><phrase>struct drm_connector_state</phrase></refentrytitle>
15491 <manvolnum>9</manvolnum>
15492 <refmiscinfo class="version">4.4.14</refmiscinfo>
15493</refmeta>
15494<refnamediv>
15495 <refname>struct drm_connector_state</refname>
15496 <refpurpose>
15497     mutable connector state
15498 </refpurpose>
15499</refnamediv>
15500<refsynopsisdiv>
15501 <title>Synopsis</title>
15502  <programlisting>
15503struct drm_connector_state {
15504  struct drm_connector * connector;
15505  struct drm_crtc * crtc;
15506  struct drm_encoder * best_encoder;
15507  struct drm_atomic_state * state;
15508};  </programlisting>
15509</refsynopsisdiv>
15510 <refsect1>
15511  <title>Members</title>
15512  <variablelist>
15513    <varlistentry>      <term>connector</term>
15514      <listitem><para>
15515   backpointer to the connector
15516      </para></listitem>
15517    </varlistentry>
15518    <varlistentry>      <term>crtc</term>
15519      <listitem><para>
15520   CRTC to connect connector to, NULL if disabled
15521      </para></listitem>
15522    </varlistentry>
15523    <varlistentry>      <term>best_encoder</term>
15524      <listitem><para>
15525   can be used by helpers and drivers to select the encoder
15526      </para></listitem>
15527    </varlistentry>
15528    <varlistentry>      <term>state</term>
15529      <listitem><para>
15530   backpointer to global drm_atomic_state
15531      </para></listitem>
15532    </varlistentry>
15533  </variablelist>
15534 </refsect1>
15535</refentry>
15536
15537<refentry id="API-struct-drm-connector-funcs">
15538<refentryinfo>
15539 <title>LINUX</title>
15540 <productname>Kernel Hackers Manual</productname>
15541 <date>July 2017</date>
15542</refentryinfo>
15543<refmeta>
15544 <refentrytitle><phrase>struct drm_connector_funcs</phrase></refentrytitle>
15545 <manvolnum>9</manvolnum>
15546 <refmiscinfo class="version">4.4.14</refmiscinfo>
15547</refmeta>
15548<refnamediv>
15549 <refname>struct drm_connector_funcs</refname>
15550 <refpurpose>
15551     control connectors on a given device
15552 </refpurpose>
15553</refnamediv>
15554<refsynopsisdiv>
15555 <title>Synopsis</title>
15556  <programlisting>
15557struct drm_connector_funcs {
15558  int (* dpms) (struct drm_connector *connector, int mode);
15559  void (* save) (struct drm_connector *connector);
15560  void (* restore) (struct drm_connector *connector);
15561  void (* reset) (struct drm_connector *connector);
15562  enum drm_connector_status (* detect) (struct drm_connector *connector,bool force);
15563  int (* fill_modes) (struct drm_connector *connector, uint32_t max_width, uint32_t max_height);
15564  int (* set_property) (struct drm_connector *connector, struct drm_property *property,uint64_t val);
15565  void (* destroy) (struct drm_connector *connector);
15566  void (* force) (struct drm_connector *connector);
15567  struct drm_connector_state *(* atomic_duplicate_state) (struct drm_connector *connector);
15568  void (* atomic_destroy_state) (struct drm_connector *connector,struct drm_connector_state *state);
15569  int (* atomic_set_property) (struct drm_connector *connector,struct drm_connector_state *state,struct drm_property *property,uint64_t val);
15570  int (* atomic_get_property) (struct drm_connector *connector,const struct drm_connector_state *state,struct drm_property *property,uint64_t *val);
15571};  </programlisting>
15572</refsynopsisdiv>
15573 <refsect1>
15574  <title>Members</title>
15575  <variablelist>
15576    <varlistentry>      <term>dpms</term>
15577      <listitem><para>
15578   set power state
15579      </para></listitem>
15580    </varlistentry>
15581    <varlistentry>      <term>save</term>
15582      <listitem><para>
15583   save connector state
15584      </para></listitem>
15585    </varlistentry>
15586    <varlistentry>      <term>restore</term>
15587      <listitem><para>
15588   restore connector state
15589      </para></listitem>
15590    </varlistentry>
15591    <varlistentry>      <term>reset</term>
15592      <listitem><para>
15593   reset connector after state has been invalidated (e.g. resume)
15594      </para></listitem>
15595    </varlistentry>
15596    <varlistentry>      <term>detect</term>
15597      <listitem><para>
15598   is this connector active?
15599      </para></listitem>
15600    </varlistentry>
15601    <varlistentry>      <term>fill_modes</term>
15602      <listitem><para>
15603   fill mode list for this connector
15604      </para></listitem>
15605    </varlistentry>
15606    <varlistentry>      <term>set_property</term>
15607      <listitem><para>
15608   property for this connector may need an update
15609      </para></listitem>
15610    </varlistentry>
15611    <varlistentry>      <term>destroy</term>
15612      <listitem><para>
15613   make object go away
15614      </para></listitem>
15615    </varlistentry>
15616    <varlistentry>      <term>force</term>
15617      <listitem><para>
15618   notify the driver that the connector is forced on
15619      </para></listitem>
15620    </varlistentry>
15621    <varlistentry>      <term>atomic_duplicate_state</term>
15622      <listitem><para>
15623   duplicate the atomic state for this connector
15624      </para></listitem>
15625    </varlistentry>
15626    <varlistentry>      <term>atomic_destroy_state</term>
15627      <listitem><para>
15628   destroy an atomic state for this connector
15629      </para></listitem>
15630    </varlistentry>
15631    <varlistentry>      <term>atomic_set_property</term>
15632      <listitem><para>
15633   set a property on an atomic state for this connector
15634   (do not call directly, use <function>drm_atomic_connector_set_property</function>)
15635      </para></listitem>
15636    </varlistentry>
15637    <varlistentry>      <term>atomic_get_property</term>
15638      <listitem><para>
15639   get a property on an atomic state for this connector
15640   (do not call directly, use <function>drm_atomic_connector_get_property</function>)
15641      </para></listitem>
15642    </varlistentry>
15643  </variablelist>
15644 </refsect1>
15645<refsect1>
15646<title>Description</title>
15647<para>
15648   Each CRTC may have one or more connectors attached to it.  The functions
15649   below allow the core DRM code to control connectors, enumerate available modes,
15650   etc.
15651</para>
15652</refsect1>
15653</refentry>
15654
15655<refentry id="API-struct-drm-encoder-funcs">
15656<refentryinfo>
15657 <title>LINUX</title>
15658 <productname>Kernel Hackers Manual</productname>
15659 <date>July 2017</date>
15660</refentryinfo>
15661<refmeta>
15662 <refentrytitle><phrase>struct drm_encoder_funcs</phrase></refentrytitle>
15663 <manvolnum>9</manvolnum>
15664 <refmiscinfo class="version">4.4.14</refmiscinfo>
15665</refmeta>
15666<refnamediv>
15667 <refname>struct drm_encoder_funcs</refname>
15668 <refpurpose>
15669     encoder controls
15670 </refpurpose>
15671</refnamediv>
15672<refsynopsisdiv>
15673 <title>Synopsis</title>
15674  <programlisting>
15675struct drm_encoder_funcs {
15676  void (* reset) (struct drm_encoder *encoder);
15677  void (* destroy) (struct drm_encoder *encoder);
15678};  </programlisting>
15679</refsynopsisdiv>
15680 <refsect1>
15681  <title>Members</title>
15682  <variablelist>
15683    <varlistentry>      <term>reset</term>
15684      <listitem><para>
15685   reset state (e.g. at init or resume time)
15686      </para></listitem>
15687    </varlistentry>
15688    <varlistentry>      <term>destroy</term>
15689      <listitem><para>
15690   cleanup and free associated data
15691      </para></listitem>
15692    </varlistentry>
15693  </variablelist>
15694 </refsect1>
15695<refsect1>
15696<title>Description</title>
15697<para>
15698   Encoders sit between CRTCs and connectors.
15699</para>
15700</refsect1>
15701</refentry>
15702
15703<refentry id="API-struct-drm-encoder">
15704<refentryinfo>
15705 <title>LINUX</title>
15706 <productname>Kernel Hackers Manual</productname>
15707 <date>July 2017</date>
15708</refentryinfo>
15709<refmeta>
15710 <refentrytitle><phrase>struct drm_encoder</phrase></refentrytitle>
15711 <manvolnum>9</manvolnum>
15712 <refmiscinfo class="version">4.4.14</refmiscinfo>
15713</refmeta>
15714<refnamediv>
15715 <refname>struct drm_encoder</refname>
15716 <refpurpose>
15717     central DRM encoder structure
15718 </refpurpose>
15719</refnamediv>
15720<refsynopsisdiv>
15721 <title>Synopsis</title>
15722  <programlisting>
15723struct drm_encoder {
15724  struct drm_device * dev;
15725  struct list_head head;
15726  struct drm_mode_object base;
15727  char * name;
15728  int encoder_type;
15729  uint32_t possible_crtcs;
15730  uint32_t possible_clones;
15731  struct drm_crtc * crtc;
15732  struct drm_bridge * bridge;
15733  const struct drm_encoder_funcs * funcs;
15734  const void * helper_private;
15735};  </programlisting>
15736</refsynopsisdiv>
15737 <refsect1>
15738  <title>Members</title>
15739  <variablelist>
15740    <varlistentry>      <term>dev</term>
15741      <listitem><para>
15742   parent DRM device
15743      </para></listitem>
15744    </varlistentry>
15745    <varlistentry>      <term>head</term>
15746      <listitem><para>
15747   list management
15748      </para></listitem>
15749    </varlistentry>
15750    <varlistentry>      <term>base</term>
15751      <listitem><para>
15752   base KMS object
15753      </para></listitem>
15754    </varlistentry>
15755    <varlistentry>      <term>name</term>
15756      <listitem><para>
15757   encoder name
15758      </para></listitem>
15759    </varlistentry>
15760    <varlistentry>      <term>encoder_type</term>
15761      <listitem><para>
15762   one of the <constant>DRM_MODE_ENCODER_</constant>&lt;foo&gt; types in drm_mode.h
15763      </para></listitem>
15764    </varlistentry>
15765    <varlistentry>      <term>possible_crtcs</term>
15766      <listitem><para>
15767   bitmask of potential CRTC bindings
15768      </para></listitem>
15769    </varlistentry>
15770    <varlistentry>      <term>possible_clones</term>
15771      <listitem><para>
15772   bitmask of potential sibling encoders for cloning
15773      </para></listitem>
15774    </varlistentry>
15775    <varlistentry>      <term>crtc</term>
15776      <listitem><para>
15777   currently bound CRTC
15778      </para></listitem>
15779    </varlistentry>
15780    <varlistentry>      <term>bridge</term>
15781      <listitem><para>
15782   bridge associated to the encoder
15783      </para></listitem>
15784    </varlistentry>
15785    <varlistentry>      <term>funcs</term>
15786      <listitem><para>
15787   control functions
15788      </para></listitem>
15789    </varlistentry>
15790    <varlistentry>      <term>helper_private</term>
15791      <listitem><para>
15792   mid-layer private data
15793      </para></listitem>
15794    </varlistentry>
15795  </variablelist>
15796 </refsect1>
15797<refsect1>
15798<title>Description</title>
15799<para>
15800   CRTCs drive pixels to encoders, which convert them into signals
15801   appropriate for a given connector or set of connectors.
15802</para>
15803</refsect1>
15804</refentry>
15805
15806<refentry id="API-struct-drm-connector">
15807<refentryinfo>
15808 <title>LINUX</title>
15809 <productname>Kernel Hackers Manual</productname>
15810 <date>July 2017</date>
15811</refentryinfo>
15812<refmeta>
15813 <refentrytitle><phrase>struct drm_connector</phrase></refentrytitle>
15814 <manvolnum>9</manvolnum>
15815 <refmiscinfo class="version">4.4.14</refmiscinfo>
15816</refmeta>
15817<refnamediv>
15818 <refname>struct drm_connector</refname>
15819 <refpurpose>
15820     central DRM connector control structure
15821 </refpurpose>
15822</refnamediv>
15823<refsynopsisdiv>
15824 <title>Synopsis</title>
15825  <programlisting>
15826struct drm_connector {
15827  struct drm_device * dev;
15828  struct device * kdev;
15829  struct device_attribute * attr;
15830  struct list_head head;
15831  struct drm_mode_object base;
15832  char * name;
15833  int connector_type;
15834  int connector_type_id;
15835  bool interlace_allowed;
15836  bool doublescan_allowed;
15837  bool stereo_allowed;
15838  struct list_head modes;
15839  enum drm_connector_status status;
15840  struct list_head probed_modes;
15841  struct drm_display_info display_info;
15842  const struct drm_connector_funcs * funcs;
15843  struct drm_property_blob * edid_blob_ptr;
15844  struct drm_object_properties properties;
15845  struct drm_property_blob * path_blob_ptr;
15846  uint8_t polled;
15847  int dpms;
15848  const void * helper_private;
15849  struct drm_cmdline_mode cmdline_mode;
15850  enum drm_connector_force force;
15851  bool override_edid;
15852  uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER];
15853  struct drm_encoder * encoder;
15854  uint8_t eld[MAX_ELD_BYTES];
15855  bool dvi_dual;
15856  int max_tmds_clock;
15857  bool latency_present[2];
15858  int video_latency[2];
15859  int audio_latency[2];
15860  int null_edid_counter;
15861  unsigned bad_edid_counter;
15862  bool edid_corrupt;
15863  struct dentry * debugfs_entry;
15864  struct drm_connector_state * state;
15865  bool has_tile;
15866  struct drm_tile_group * tile_group;
15867  bool tile_is_single_monitor;
15868  uint8_t num_h_tile;
15869  uint8_t num_v_tile;
15870  uint8_t tile_h_loc;
15871  uint8_t tile_v_loc;
15872  uint16_t tile_h_size;
15873  uint16_t tile_v_size;
15874};  </programlisting>
15875</refsynopsisdiv>
15876 <refsect1>
15877  <title>Members</title>
15878  <variablelist>
15879    <varlistentry>      <term>dev</term>
15880      <listitem><para>
15881   parent DRM device
15882      </para></listitem>
15883    </varlistentry>
15884    <varlistentry>      <term>kdev</term>
15885      <listitem><para>
15886   kernel device for sysfs attributes
15887      </para></listitem>
15888    </varlistentry>
15889    <varlistentry>      <term>attr</term>
15890      <listitem><para>
15891   sysfs attributes
15892      </para></listitem>
15893    </varlistentry>
15894    <varlistentry>      <term>head</term>
15895      <listitem><para>
15896   list management
15897      </para></listitem>
15898    </varlistentry>
15899    <varlistentry>      <term>base</term>
15900      <listitem><para>
15901   base KMS object
15902      </para></listitem>
15903    </varlistentry>
15904    <varlistentry>      <term>name</term>
15905      <listitem><para>
15906   connector name
15907      </para></listitem>
15908    </varlistentry>
15909    <varlistentry>      <term>connector_type</term>
15910      <listitem><para>
15911   one of the <constant>DRM_MODE_CONNECTOR_</constant>&lt;foo&gt; types from drm_mode.h
15912      </para></listitem>
15913    </varlistentry>
15914    <varlistentry>      <term>connector_type_id</term>
15915      <listitem><para>
15916   index into connector type enum
15917      </para></listitem>
15918    </varlistentry>
15919    <varlistentry>      <term>interlace_allowed</term>
15920      <listitem><para>
15921   can this connector handle interlaced modes?
15922      </para></listitem>
15923    </varlistentry>
15924    <varlistentry>      <term>doublescan_allowed</term>
15925      <listitem><para>
15926   can this connector handle doublescan?
15927      </para></listitem>
15928    </varlistentry>
15929    <varlistentry>      <term>stereo_allowed</term>
15930      <listitem><para>
15931   can this connector handle stereo modes?
15932      </para></listitem>
15933    </varlistentry>
15934    <varlistentry>      <term>modes</term>
15935      <listitem><para>
15936   modes available on this connector (from <function>fill_modes</function> + user)
15937      </para></listitem>
15938    </varlistentry>
15939    <varlistentry>      <term>status</term>
15940      <listitem><para>
15941   one of the drm_connector_status enums (connected, not, or unknown)
15942      </para></listitem>
15943    </varlistentry>
15944    <varlistentry>      <term>probed_modes</term>
15945      <listitem><para>
15946   list of modes derived directly from the display
15947      </para></listitem>
15948    </varlistentry>
15949    <varlistentry>      <term>display_info</term>
15950      <listitem><para>
15951   information about attached display (e.g. from EDID)
15952      </para></listitem>
15953    </varlistentry>
15954    <varlistentry>      <term>funcs</term>
15955      <listitem><para>
15956   connector control functions
15957      </para></listitem>
15958    </varlistentry>
15959    <varlistentry>      <term>edid_blob_ptr</term>
15960      <listitem><para>
15961   DRM property containing EDID if present
15962      </para></listitem>
15963    </varlistentry>
15964    <varlistentry>      <term>properties</term>
15965      <listitem><para>
15966   property tracking for this connector
15967      </para></listitem>
15968    </varlistentry>
15969    <varlistentry>      <term>path_blob_ptr</term>
15970      <listitem><para>
15971   DRM blob property data for the DP MST path property
15972      </para></listitem>
15973    </varlistentry>
15974    <varlistentry>      <term>polled</term>
15975      <listitem><para>
15976   a <constant>DRM_CONNECTOR_POLL_</constant>&lt;foo&gt; value for core driven polling
15977      </para></listitem>
15978    </varlistentry>
15979    <varlistentry>      <term>dpms</term>
15980      <listitem><para>
15981   current dpms state
15982      </para></listitem>
15983    </varlistentry>
15984    <varlistentry>      <term>helper_private</term>
15985      <listitem><para>
15986   mid-layer private data
15987      </para></listitem>
15988    </varlistentry>
15989    <varlistentry>      <term>cmdline_mode</term>
15990      <listitem><para>
15991   mode line parsed from the kernel cmdline for this connector
15992      </para></listitem>
15993    </varlistentry>
15994    <varlistentry>      <term>force</term>
15995      <listitem><para>
15996   a <constant>DRM_FORCE_</constant>&lt;foo&gt; state for forced mode sets
15997      </para></listitem>
15998    </varlistentry>
15999    <varlistentry>      <term>override_edid</term>
16000      <listitem><para>
16001   has the EDID been overwritten through debugfs for testing?
16002      </para></listitem>
16003    </varlistentry>
16004    <varlistentry>      <term>encoder_ids[DRM_CONNECTOR_MAX_ENCODER]</term>
16005      <listitem><para>
16006   valid encoders for this connector
16007      </para></listitem>
16008    </varlistentry>
16009    <varlistentry>      <term>encoder</term>
16010      <listitem><para>
16011   encoder driving this connector, if any
16012      </para></listitem>
16013    </varlistentry>
16014    <varlistentry>      <term>eld[MAX_ELD_BYTES]</term>
16015      <listitem><para>
16016   EDID-like data, if present
16017      </para></listitem>
16018    </varlistentry>
16019    <varlistentry>      <term>dvi_dual</term>
16020      <listitem><para>
16021   dual link DVI, if found
16022      </para></listitem>
16023    </varlistentry>
16024    <varlistentry>      <term>max_tmds_clock</term>
16025      <listitem><para>
16026   max clock rate, if found
16027      </para></listitem>
16028    </varlistentry>
16029    <varlistentry>      <term>latency_present[2]</term>
16030      <listitem><para>
16031   AV delay info from ELD, if found
16032      </para></listitem>
16033    </varlistentry>
16034    <varlistentry>      <term>video_latency[2]</term>
16035      <listitem><para>
16036   video latency info from ELD, if found
16037      </para></listitem>
16038    </varlistentry>
16039    <varlistentry>      <term>audio_latency[2]</term>
16040      <listitem><para>
16041   audio latency info from ELD, if found
16042      </para></listitem>
16043    </varlistentry>
16044    <varlistentry>      <term>null_edid_counter</term>
16045      <listitem><para>
16046   track sinks that give us all zeros for the EDID
16047      </para></listitem>
16048    </varlistentry>
16049    <varlistentry>      <term>bad_edid_counter</term>
16050      <listitem><para>
16051   track sinks that give us an EDID with invalid checksum
16052      </para></listitem>
16053    </varlistentry>
16054    <varlistentry>      <term>edid_corrupt</term>
16055      <listitem><para>
16056   indicates whether the last read EDID was corrupt
16057      </para></listitem>
16058    </varlistentry>
16059    <varlistentry>      <term>debugfs_entry</term>
16060      <listitem><para>
16061   debugfs directory for this connector
16062      </para></listitem>
16063    </varlistentry>
16064    <varlistentry>      <term>state</term>
16065      <listitem><para>
16066   current atomic state for this connector
16067      </para></listitem>
16068    </varlistentry>
16069    <varlistentry>      <term>has_tile</term>
16070      <listitem><para>
16071   is this connector connected to a tiled monitor
16072      </para></listitem>
16073    </varlistentry>
16074    <varlistentry>      <term>tile_group</term>
16075      <listitem><para>
16076   tile group for the connected monitor
16077      </para></listitem>
16078    </varlistentry>
16079    <varlistentry>      <term>tile_is_single_monitor</term>
16080      <listitem><para>
16081   whether the tile is one monitor housing
16082      </para></listitem>
16083    </varlistentry>
16084    <varlistentry>      <term>num_h_tile</term>
16085      <listitem><para>
16086   number of horizontal tiles in the tile group
16087      </para></listitem>
16088    </varlistentry>
16089    <varlistentry>      <term>num_v_tile</term>
16090      <listitem><para>
16091   number of vertical tiles in the tile group
16092      </para></listitem>
16093    </varlistentry>
16094    <varlistentry>      <term>tile_h_loc</term>
16095      <listitem><para>
16096   horizontal location of this tile
16097      </para></listitem>
16098    </varlistentry>
16099    <varlistentry>      <term>tile_v_loc</term>
16100      <listitem><para>
16101   vertical location of this tile
16102      </para></listitem>
16103    </varlistentry>
16104    <varlistentry>      <term>tile_h_size</term>
16105      <listitem><para>
16106   horizontal size of this tile.
16107      </para></listitem>
16108    </varlistentry>
16109    <varlistentry>      <term>tile_v_size</term>
16110      <listitem><para>
16111   vertical size of this tile.
16112      </para></listitem>
16113    </varlistentry>
16114  </variablelist>
16115 </refsect1>
16116<refsect1>
16117<title>Description</title>
16118<para>
16119   Each connector may be connected to one or more CRTCs, or may be clonable by
16120   another connector if they can share a CRTC.  Each connector also has a specific
16121   position in the broader display (referred to as a 'screen' though it could
16122   span multiple monitors).
16123</para>
16124</refsect1>
16125</refentry>
16126
16127<refentry id="API-struct-drm-plane-state">
16128<refentryinfo>
16129 <title>LINUX</title>
16130 <productname>Kernel Hackers Manual</productname>
16131 <date>July 2017</date>
16132</refentryinfo>
16133<refmeta>
16134 <refentrytitle><phrase>struct drm_plane_state</phrase></refentrytitle>
16135 <manvolnum>9</manvolnum>
16136 <refmiscinfo class="version">4.4.14</refmiscinfo>
16137</refmeta>
16138<refnamediv>
16139 <refname>struct drm_plane_state</refname>
16140 <refpurpose>
16141     mutable plane state
16142 </refpurpose>
16143</refnamediv>
16144<refsynopsisdiv>
16145 <title>Synopsis</title>
16146  <programlisting>
16147struct drm_plane_state {
16148  struct drm_plane * plane;
16149  struct drm_crtc * crtc;
16150  struct drm_framebuffer * fb;
16151  struct fence * fence;
16152  int32_t crtc_x;
16153  int32_t crtc_y;
16154  uint32_t crtc_w;
16155  uint32_t crtc_h;
16156  uint32_t src_x;
16157  uint32_t src_y;
16158  uint32_t src_h;
16159  uint32_t src_w;
16160  struct drm_atomic_state * state;
16161};  </programlisting>
16162</refsynopsisdiv>
16163 <refsect1>
16164  <title>Members</title>
16165  <variablelist>
16166    <varlistentry>      <term>plane</term>
16167      <listitem><para>
16168   backpointer to the plane
16169      </para></listitem>
16170    </varlistentry>
16171    <varlistentry>      <term>crtc</term>
16172      <listitem><para>
16173   currently bound CRTC, NULL if disabled
16174      </para></listitem>
16175    </varlistentry>
16176    <varlistentry>      <term>fb</term>
16177      <listitem><para>
16178   currently bound framebuffer
16179      </para></listitem>
16180    </varlistentry>
16181    <varlistentry>      <term>fence</term>
16182      <listitem><para>
16183   optional fence to wait for before scanning out <parameter>fb</parameter>
16184      </para></listitem>
16185    </varlistentry>
16186    <varlistentry>      <term>crtc_x</term>
16187      <listitem><para>
16188   left position of visible portion of plane on crtc
16189      </para></listitem>
16190    </varlistentry>
16191    <varlistentry>      <term>crtc_y</term>
16192      <listitem><para>
16193   upper position of visible portion of plane on crtc
16194      </para></listitem>
16195    </varlistentry>
16196    <varlistentry>      <term>crtc_w</term>
16197      <listitem><para>
16198   width of visible portion of plane on crtc
16199      </para></listitem>
16200    </varlistentry>
16201    <varlistentry>      <term>crtc_h</term>
16202      <listitem><para>
16203   height of visible portion of plane on crtc
16204      </para></listitem>
16205    </varlistentry>
16206    <varlistentry>      <term>src_x</term>
16207      <listitem><para>
16208   left position of visible portion of plane within
16209   plane (in 16.16)
16210      </para></listitem>
16211    </varlistentry>
16212    <varlistentry>      <term>src_y</term>
16213      <listitem><para>
16214   upper position of visible portion of plane within
16215   plane (in 16.16)
16216      </para></listitem>
16217    </varlistentry>
16218    <varlistentry>      <term>src_h</term>
16219      <listitem><para>
16220   height of visible portion of plane (in 16.16)
16221      </para></listitem>
16222    </varlistentry>
16223    <varlistentry>      <term>src_w</term>
16224      <listitem><para>
16225   width of visible portion of plane (in 16.16)
16226      </para></listitem>
16227    </varlistentry>
16228    <varlistentry>      <term>state</term>
16229      <listitem><para>
16230   backpointer to global drm_atomic_state
16231      </para></listitem>
16232    </varlistentry>
16233  </variablelist>
16234 </refsect1>
16235</refentry>
16236
16237<refentry id="API-struct-drm-plane-funcs">
16238<refentryinfo>
16239 <title>LINUX</title>
16240 <productname>Kernel Hackers Manual</productname>
16241 <date>July 2017</date>
16242</refentryinfo>
16243<refmeta>
16244 <refentrytitle><phrase>struct drm_plane_funcs</phrase></refentrytitle>
16245 <manvolnum>9</manvolnum>
16246 <refmiscinfo class="version">4.4.14</refmiscinfo>
16247</refmeta>
16248<refnamediv>
16249 <refname>struct drm_plane_funcs</refname>
16250 <refpurpose>
16251     driver plane control functions
16252 </refpurpose>
16253</refnamediv>
16254<refsynopsisdiv>
16255 <title>Synopsis</title>
16256  <programlisting>
16257struct drm_plane_funcs {
16258  int (* update_plane) (struct drm_plane *plane,struct drm_crtc *crtc, struct drm_framebuffer *fb,int crtc_x, int crtc_y,unsigned int crtc_w, unsigned int crtc_h,uint32_t src_x, uint32_t src_y,uint32_t src_w, uint32_t src_h);
16259  int (* disable_plane) (struct drm_plane *plane);
16260  void (* destroy) (struct drm_plane *plane);
16261  void (* reset) (struct drm_plane *plane);
16262  int (* set_property) (struct drm_plane *plane,struct drm_property *property, uint64_t val);
16263  struct drm_plane_state *(* atomic_duplicate_state) (struct drm_plane *plane);
16264  void (* atomic_destroy_state) (struct drm_plane *plane,struct drm_plane_state *state);
16265  int (* atomic_set_property) (struct drm_plane *plane,struct drm_plane_state *state,struct drm_property *property,uint64_t val);
16266  int (* atomic_get_property) (struct drm_plane *plane,const struct drm_plane_state *state,struct drm_property *property,uint64_t *val);
16267};  </programlisting>
16268</refsynopsisdiv>
16269 <refsect1>
16270  <title>Members</title>
16271  <variablelist>
16272    <varlistentry>      <term>update_plane</term>
16273      <listitem><para>
16274   update the plane configuration
16275      </para></listitem>
16276    </varlistentry>
16277    <varlistentry>      <term>disable_plane</term>
16278      <listitem><para>
16279   shut down the plane
16280      </para></listitem>
16281    </varlistentry>
16282    <varlistentry>      <term>destroy</term>
16283      <listitem><para>
16284   clean up plane resources
16285      </para></listitem>
16286    </varlistentry>
16287    <varlistentry>      <term>reset</term>
16288      <listitem><para>
16289   reset plane after state has been invalidated (e.g. resume)
16290      </para></listitem>
16291    </varlistentry>
16292    <varlistentry>      <term>set_property</term>
16293      <listitem><para>
16294   called when a property is changed
16295      </para></listitem>
16296    </varlistentry>
16297    <varlistentry>      <term>atomic_duplicate_state</term>
16298      <listitem><para>
16299   duplicate the atomic state for this plane
16300      </para></listitem>
16301    </varlistentry>
16302    <varlistentry>      <term>atomic_destroy_state</term>
16303      <listitem><para>
16304   destroy an atomic state for this plane
16305      </para></listitem>
16306    </varlistentry>
16307    <varlistentry>      <term>atomic_set_property</term>
16308      <listitem><para>
16309   set a property on an atomic state for this plane
16310   (do not call directly, use <function>drm_atomic_plane_set_property</function>)
16311      </para></listitem>
16312    </varlistentry>
16313    <varlistentry>      <term>atomic_get_property</term>
16314      <listitem><para>
16315   get a property on an atomic state for this plane
16316   (do not call directly, use <function>drm_atomic_plane_get_property</function>)
16317      </para></listitem>
16318    </varlistentry>
16319  </variablelist>
16320 </refsect1>
16321</refentry>
16322
16323<refentry id="API-struct-drm-plane">
16324<refentryinfo>
16325 <title>LINUX</title>
16326 <productname>Kernel Hackers Manual</productname>
16327 <date>July 2017</date>
16328</refentryinfo>
16329<refmeta>
16330 <refentrytitle><phrase>struct drm_plane</phrase></refentrytitle>
16331 <manvolnum>9</manvolnum>
16332 <refmiscinfo class="version">4.4.14</refmiscinfo>
16333</refmeta>
16334<refnamediv>
16335 <refname>struct drm_plane</refname>
16336 <refpurpose>
16337     central DRM plane control structure
16338 </refpurpose>
16339</refnamediv>
16340<refsynopsisdiv>
16341 <title>Synopsis</title>
16342  <programlisting>
16343struct drm_plane {
16344  struct drm_device * dev;
16345  struct list_head head;
16346  struct drm_mode_object base;
16347  uint32_t possible_crtcs;
16348  uint32_t * format_types;
16349  unsigned int format_count;
16350  bool format_default;
16351  struct drm_crtc * crtc;
16352  struct drm_framebuffer * fb;
16353  struct drm_framebuffer * old_fb;
16354  const struct drm_plane_funcs * funcs;
16355  struct drm_object_properties properties;
16356  enum drm_plane_type type;
16357  struct drm_plane_state * state;
16358};  </programlisting>
16359</refsynopsisdiv>
16360 <refsect1>
16361  <title>Members</title>
16362  <variablelist>
16363    <varlistentry>      <term>dev</term>
16364      <listitem><para>
16365   DRM device this plane belongs to
16366      </para></listitem>
16367    </varlistentry>
16368    <varlistentry>      <term>head</term>
16369      <listitem><para>
16370   for list management
16371      </para></listitem>
16372    </varlistentry>
16373    <varlistentry>      <term>base</term>
16374      <listitem><para>
16375   base mode object
16376      </para></listitem>
16377    </varlistentry>
16378    <varlistentry>      <term>possible_crtcs</term>
16379      <listitem><para>
16380   pipes this plane can be bound to
16381      </para></listitem>
16382    </varlistentry>
16383    <varlistentry>      <term>format_types</term>
16384      <listitem><para>
16385   array of formats supported by this plane
16386      </para></listitem>
16387    </varlistentry>
16388    <varlistentry>      <term>format_count</term>
16389      <listitem><para>
16390   number of formats supported
16391      </para></listitem>
16392    </varlistentry>
16393    <varlistentry>      <term>format_default</term>
16394      <listitem><para>
16395   driver hasn't supplied supported formats for the plane
16396      </para></listitem>
16397    </varlistentry>
16398    <varlistentry>      <term>crtc</term>
16399      <listitem><para>
16400   currently bound CRTC
16401      </para></listitem>
16402    </varlistentry>
16403    <varlistentry>      <term>fb</term>
16404      <listitem><para>
16405   currently bound fb
16406      </para></listitem>
16407    </varlistentry>
16408    <varlistentry>      <term>old_fb</term>
16409      <listitem><para>
16410   Temporary tracking of the old fb while a modeset is ongoing. Used by
16411   <function>drm_mode_set_config_internal</function> to implement correct refcounting.
16412      </para></listitem>
16413    </varlistentry>
16414    <varlistentry>      <term>funcs</term>
16415      <listitem><para>
16416   helper functions
16417      </para></listitem>
16418    </varlistentry>
16419    <varlistentry>      <term>properties</term>
16420      <listitem><para>
16421   property tracking for this plane
16422      </para></listitem>
16423    </varlistentry>
16424    <varlistentry>      <term>type</term>
16425      <listitem><para>
16426   type of plane (overlay, primary, cursor)
16427      </para></listitem>
16428    </varlistentry>
16429    <varlistentry>      <term>state</term>
16430      <listitem><para>
16431   current atomic state for this plane
16432      </para></listitem>
16433    </varlistentry>
16434  </variablelist>
16435 </refsect1>
16436</refentry>
16437
16438<refentry id="API-struct-drm-bridge-funcs">
16439<refentryinfo>
16440 <title>LINUX</title>
16441 <productname>Kernel Hackers Manual</productname>
16442 <date>July 2017</date>
16443</refentryinfo>
16444<refmeta>
16445 <refentrytitle><phrase>struct drm_bridge_funcs</phrase></refentrytitle>
16446 <manvolnum>9</manvolnum>
16447 <refmiscinfo class="version">4.4.14</refmiscinfo>
16448</refmeta>
16449<refnamediv>
16450 <refname>struct drm_bridge_funcs</refname>
16451 <refpurpose>
16452     drm_bridge control functions
16453 </refpurpose>
16454</refnamediv>
16455<refsynopsisdiv>
16456 <title>Synopsis</title>
16457  <programlisting>
16458struct drm_bridge_funcs {
16459  int (* attach) (struct drm_bridge *bridge);
16460  bool (* mode_fixup) (struct drm_bridge *bridge,const struct drm_display_mode *mode,struct drm_display_mode *adjusted_mode);
16461  void (* disable) (struct drm_bridge *bridge);
16462  void (* post_disable) (struct drm_bridge *bridge);
16463  void (* mode_set) (struct drm_bridge *bridge,struct drm_display_mode *mode,struct drm_display_mode *adjusted_mode);
16464  void (* pre_enable) (struct drm_bridge *bridge);
16465  void (* enable) (struct drm_bridge *bridge);
16466};  </programlisting>
16467</refsynopsisdiv>
16468 <refsect1>
16469  <title>Members</title>
16470  <variablelist>
16471    <varlistentry>      <term>attach</term>
16472      <listitem><para>
16473   Called during drm_bridge_attach
16474      </para></listitem>
16475    </varlistentry>
16476    <varlistentry>      <term>mode_fixup</term>
16477      <listitem><para>
16478   Try to fixup (or reject entirely) proposed mode for this bridge
16479      </para></listitem>
16480    </varlistentry>
16481    <varlistentry>      <term>disable</term>
16482      <listitem><para>
16483   Called right before encoder prepare, disables the bridge
16484      </para></listitem>
16485    </varlistentry>
16486    <varlistentry>      <term>post_disable</term>
16487      <listitem><para>
16488   Called right after encoder prepare, for lockstepped disable
16489      </para></listitem>
16490    </varlistentry>
16491    <varlistentry>      <term>mode_set</term>
16492      <listitem><para>
16493   Set this mode to the bridge
16494      </para></listitem>
16495    </varlistentry>
16496    <varlistentry>      <term>pre_enable</term>
16497      <listitem><para>
16498   Called right before encoder commit, for lockstepped commit
16499      </para></listitem>
16500    </varlistentry>
16501    <varlistentry>      <term>enable</term>
16502      <listitem><para>
16503   Called right after encoder commit, enables the bridge
16504      </para></listitem>
16505    </varlistentry>
16506  </variablelist>
16507 </refsect1>
16508</refentry>
16509
16510<refentry id="API-struct-drm-bridge">
16511<refentryinfo>
16512 <title>LINUX</title>
16513 <productname>Kernel Hackers Manual</productname>
16514 <date>July 2017</date>
16515</refentryinfo>
16516<refmeta>
16517 <refentrytitle><phrase>struct drm_bridge</phrase></refentrytitle>
16518 <manvolnum>9</manvolnum>
16519 <refmiscinfo class="version">4.4.14</refmiscinfo>
16520</refmeta>
16521<refnamediv>
16522 <refname>struct drm_bridge</refname>
16523 <refpurpose>
16524     central DRM bridge control structure
16525 </refpurpose>
16526</refnamediv>
16527<refsynopsisdiv>
16528 <title>Synopsis</title>
16529  <programlisting>
16530struct drm_bridge {
16531  struct drm_device * dev;
16532  struct drm_encoder * encoder;
16533  struct drm_bridge * next;
16534#ifdef CONFIG_OF
16535  struct device_node * of_node;
16536#endif
16537  struct list_head list;
16538  const struct drm_bridge_funcs * funcs;
16539  void * driver_private;
16540};  </programlisting>
16541</refsynopsisdiv>
16542 <refsect1>
16543  <title>Members</title>
16544  <variablelist>
16545    <varlistentry>      <term>dev</term>
16546      <listitem><para>
16547   DRM device this bridge belongs to
16548      </para></listitem>
16549    </varlistentry>
16550    <varlistentry>      <term>encoder</term>
16551      <listitem><para>
16552   encoder to which this bridge is connected
16553      </para></listitem>
16554    </varlistentry>
16555    <varlistentry>      <term>next</term>
16556      <listitem><para>
16557   the next bridge in the encoder chain
16558      </para></listitem>
16559    </varlistentry>
16560    <varlistentry>      <term>of_node</term>
16561      <listitem><para>
16562   device node pointer to the bridge
16563      </para></listitem>
16564    </varlistentry>
16565    <varlistentry>      <term>list</term>
16566      <listitem><para>
16567   to keep track of all added bridges
16568      </para></listitem>
16569    </varlistentry>
16570    <varlistentry>      <term>funcs</term>
16571      <listitem><para>
16572   control functions
16573      </para></listitem>
16574    </varlistentry>
16575    <varlistentry>      <term>driver_private</term>
16576      <listitem><para>
16577   pointer to the bridge driver's internal context
16578      </para></listitem>
16579    </varlistentry>
16580  </variablelist>
16581 </refsect1>
16582</refentry>
16583
16584<refentry id="API-struct-drm-atomic-state">
16585<refentryinfo>
16586 <title>LINUX</title>
16587 <productname>Kernel Hackers Manual</productname>
16588 <date>July 2017</date>
16589</refentryinfo>
16590<refmeta>
16591 <refentrytitle><phrase>struct drm_atomic_state</phrase></refentrytitle>
16592 <manvolnum>9</manvolnum>
16593 <refmiscinfo class="version">4.4.14</refmiscinfo>
16594</refmeta>
16595<refnamediv>
16596 <refname>struct drm_atomic_state</refname>
16597 <refpurpose>
16598     the global state object for atomic updates
16599 </refpurpose>
16600</refnamediv>
16601<refsynopsisdiv>
16602 <title>Synopsis</title>
16603  <programlisting>
16604struct drm_atomic_state {
16605  struct drm_device * dev;
16606  bool allow_modeset:1;
16607  bool legacy_cursor_update:1;
16608  struct drm_plane ** planes;
16609  struct drm_plane_state ** plane_states;
16610  struct drm_crtc ** crtcs;
16611  struct drm_crtc_state ** crtc_states;
16612  int num_connector;
16613  struct drm_connector ** connectors;
16614  struct drm_connector_state ** connector_states;
16615  struct drm_modeset_acquire_ctx * acquire_ctx;
16616};  </programlisting>
16617</refsynopsisdiv>
16618 <refsect1>
16619  <title>Members</title>
16620  <variablelist>
16621    <varlistentry>      <term>dev</term>
16622      <listitem><para>
16623   parent DRM device
16624      </para></listitem>
16625    </varlistentry>
16626    <varlistentry>      <term>allow_modeset</term>
16627      <listitem><para>
16628   allow full modeset
16629      </para></listitem>
16630    </varlistentry>
16631    <varlistentry>      <term>legacy_cursor_update</term>
16632      <listitem><para>
16633   hint to enforce legacy cursor ioctl semantics
16634      </para></listitem>
16635    </varlistentry>
16636    <varlistentry>      <term>planes</term>
16637      <listitem><para>
16638   pointer to array of plane pointers
16639      </para></listitem>
16640    </varlistentry>
16641    <varlistentry>      <term>plane_states</term>
16642      <listitem><para>
16643   pointer to array of plane states pointers
16644      </para></listitem>
16645    </varlistentry>
16646    <varlistentry>      <term>crtcs</term>
16647      <listitem><para>
16648   pointer to array of CRTC pointers
16649      </para></listitem>
16650    </varlistentry>
16651    <varlistentry>      <term>crtc_states</term>
16652      <listitem><para>
16653   pointer to array of CRTC states pointers
16654      </para></listitem>
16655    </varlistentry>
16656    <varlistentry>      <term>num_connector</term>
16657      <listitem><para>
16658   size of the <parameter>connectors</parameter> and <parameter>connector_states</parameter> arrays
16659      </para></listitem>
16660    </varlistentry>
16661    <varlistentry>      <term>connectors</term>
16662      <listitem><para>
16663   pointer to array of connector pointers
16664      </para></listitem>
16665    </varlistentry>
16666    <varlistentry>      <term>connector_states</term>
16667      <listitem><para>
16668   pointer to array of connector states pointers
16669      </para></listitem>
16670    </varlistentry>
16671    <varlistentry>      <term>acquire_ctx</term>
16672      <listitem><para>
16673   acquire context for this atomic modeset state update
16674      </para></listitem>
16675    </varlistentry>
16676  </variablelist>
16677 </refsect1>
16678</refentry>
16679
16680<refentry id="API-struct-drm-mode-set">
16681<refentryinfo>
16682 <title>LINUX</title>
16683 <productname>Kernel Hackers Manual</productname>
16684 <date>July 2017</date>
16685</refentryinfo>
16686<refmeta>
16687 <refentrytitle><phrase>struct drm_mode_set</phrase></refentrytitle>
16688 <manvolnum>9</manvolnum>
16689 <refmiscinfo class="version">4.4.14</refmiscinfo>
16690</refmeta>
16691<refnamediv>
16692 <refname>struct drm_mode_set</refname>
16693 <refpurpose>
16694     new values for a CRTC config change
16695 </refpurpose>
16696</refnamediv>
16697<refsynopsisdiv>
16698 <title>Synopsis</title>
16699  <programlisting>
16700struct drm_mode_set {
16701  struct drm_framebuffer * fb;
16702  struct drm_crtc * crtc;
16703  struct drm_display_mode * mode;
16704  uint32_t x;
16705  uint32_t y;
16706  struct drm_connector ** connectors;
16707  size_t num_connectors;
16708};  </programlisting>
16709</refsynopsisdiv>
16710 <refsect1>
16711  <title>Members</title>
16712  <variablelist>
16713    <varlistentry>      <term>fb</term>
16714      <listitem><para>
16715   framebuffer to use for new config
16716      </para></listitem>
16717    </varlistentry>
16718    <varlistentry>      <term>crtc</term>
16719      <listitem><para>
16720   CRTC whose configuration we're about to change
16721      </para></listitem>
16722    </varlistentry>
16723    <varlistentry>      <term>mode</term>
16724      <listitem><para>
16725   mode timings to use
16726      </para></listitem>
16727    </varlistentry>
16728    <varlistentry>      <term>x</term>
16729      <listitem><para>
16730   position of this CRTC relative to <parameter>fb</parameter>
16731      </para></listitem>
16732    </varlistentry>
16733    <varlistentry>      <term>y</term>
16734      <listitem><para>
16735   position of this CRTC relative to <parameter>fb</parameter>
16736      </para></listitem>
16737    </varlistentry>
16738    <varlistentry>      <term>connectors</term>
16739      <listitem><para>
16740   array of connectors to drive with this CRTC if possible
16741      </para></listitem>
16742    </varlistentry>
16743    <varlistentry>      <term>num_connectors</term>
16744      <listitem><para>
16745   size of <parameter>connectors</parameter> array
16746      </para></listitem>
16747    </varlistentry>
16748  </variablelist>
16749 </refsect1>
16750<refsect1>
16751<title>Description</title>
16752<para>
16753   Represents a single crtc the connectors that it drives with what mode
16754   and from which framebuffer it scans out from.
16755   </para><para>
16756
16757   This is used to set modes.
16758</para>
16759</refsect1>
16760</refentry>
16761
16762<refentry id="API-struct-drm-mode-config-funcs">
16763<refentryinfo>
16764 <title>LINUX</title>
16765 <productname>Kernel Hackers Manual</productname>
16766 <date>July 2017</date>
16767</refentryinfo>
16768<refmeta>
16769 <refentrytitle><phrase>struct drm_mode_config_funcs</phrase></refentrytitle>
16770 <manvolnum>9</manvolnum>
16771 <refmiscinfo class="version">4.4.14</refmiscinfo>
16772</refmeta>
16773<refnamediv>
16774 <refname>struct drm_mode_config_funcs</refname>
16775 <refpurpose>
16776     basic driver provided mode setting functions
16777 </refpurpose>
16778</refnamediv>
16779<refsynopsisdiv>
16780 <title>Synopsis</title>
16781  <programlisting>
16782struct drm_mode_config_funcs {
16783  struct drm_framebuffer *(* fb_create) (struct drm_device *dev,struct drm_file *file_priv,struct drm_mode_fb_cmd2 *mode_cmd);
16784  void (* output_poll_changed) (struct drm_device *dev);
16785  int (* atomic_check) (struct drm_device *dev,struct drm_atomic_state *a);
16786  int (* atomic_commit) (struct drm_device *dev,struct drm_atomic_state *a,bool async);
16787  struct drm_atomic_state *(* atomic_state_alloc) (struct drm_device *dev);
16788  void (* atomic_state_clear) (struct drm_atomic_state *state);
16789  void (* atomic_state_free) (struct drm_atomic_state *state);
16790};  </programlisting>
16791</refsynopsisdiv>
16792 <refsect1>
16793  <title>Members</title>
16794  <variablelist>
16795    <varlistentry>      <term>fb_create</term>
16796      <listitem><para>
16797   create a new framebuffer object
16798      </para></listitem>
16799    </varlistentry>
16800    <varlistentry>      <term>output_poll_changed</term>
16801      <listitem><para>
16802   function to handle output configuration changes
16803      </para></listitem>
16804    </varlistentry>
16805    <varlistentry>      <term>atomic_check</term>
16806      <listitem><para>
16807   check whether a given atomic state update is possible
16808      </para></listitem>
16809    </varlistentry>
16810    <varlistentry>      <term>atomic_commit</term>
16811      <listitem><para>
16812   commit an atomic state update previously verified with
16813   <function>atomic_check</function>
16814      </para></listitem>
16815    </varlistentry>
16816    <varlistentry>      <term>atomic_state_alloc</term>
16817      <listitem><para>
16818   allocate a new atomic state
16819      </para></listitem>
16820    </varlistentry>
16821    <varlistentry>      <term>atomic_state_clear</term>
16822      <listitem><para>
16823   clear the atomic state
16824      </para></listitem>
16825    </varlistentry>
16826    <varlistentry>      <term>atomic_state_free</term>
16827      <listitem><para>
16828   free the atomic state
16829      </para></listitem>
16830    </varlistentry>
16831  </variablelist>
16832 </refsect1>
16833<refsect1>
16834<title>Description</title>
16835<para>
16836   Some global (i.e. not per-CRTC, connector, etc) mode setting functions that
16837   involve drivers.
16838</para>
16839</refsect1>
16840</refentry>
16841
16842<refentry id="API-struct-drm-mode-config">
16843<refentryinfo>
16844 <title>LINUX</title>
16845 <productname>Kernel Hackers Manual</productname>
16846 <date>July 2017</date>
16847</refentryinfo>
16848<refmeta>
16849 <refentrytitle><phrase>struct drm_mode_config</phrase></refentrytitle>
16850 <manvolnum>9</manvolnum>
16851 <refmiscinfo class="version">4.4.14</refmiscinfo>
16852</refmeta>
16853<refnamediv>
16854 <refname>struct drm_mode_config</refname>
16855 <refpurpose>
16856     Mode configuration control structure
16857 </refpurpose>
16858</refnamediv>
16859<refsynopsisdiv>
16860 <title>Synopsis</title>
16861  <programlisting>
16862struct drm_mode_config {
16863  struct mutex mutex;
16864  struct drm_modeset_lock connection_mutex;
16865  struct drm_modeset_acquire_ctx * acquire_ctx;
16866  struct mutex idr_mutex;
16867  struct idr crtc_idr;
16868  struct mutex fb_lock;
16869  int num_fb;
16870  struct list_head fb_list;
16871  int num_connector;
16872  struct list_head connector_list;
16873  int num_encoder;
16874  struct list_head encoder_list;
16875  int num_overlay_plane;
16876  int num_total_plane;
16877  struct list_head plane_list;
16878  int num_crtc;
16879  struct list_head crtc_list;
16880  struct list_head property_list;
16881  int min_width;
16882  int min_height;
16883  int max_width;
16884  int max_height;
16885  const struct drm_mode_config_funcs * funcs;
16886  resource_size_t fb_base;
16887  bool poll_enabled;
16888  bool poll_running;
16889  struct delayed_work output_poll_work;
16890  struct mutex blob_lock;
16891  struct list_head property_blob_list;
16892  uint32_t preferred_depth;
16893  uint32_t prefer_shadow;
16894  bool async_page_flip;
16895  uint32_t cursor_width;
16896  uint32_t cursor_height;
16897};  </programlisting>
16898</refsynopsisdiv>
16899 <refsect1>
16900  <title>Members</title>
16901  <variablelist>
16902    <varlistentry>      <term>mutex</term>
16903      <listitem><para>
16904   mutex protecting KMS related lists and structures
16905      </para></listitem>
16906    </varlistentry>
16907    <varlistentry>      <term>connection_mutex</term>
16908      <listitem><para>
16909   ww mutex protecting connector state and routing
16910      </para></listitem>
16911    </varlistentry>
16912    <varlistentry>      <term>acquire_ctx</term>
16913      <listitem><para>
16914   global implicit acquire context used by atomic drivers for
16915   legacy ioctls
16916      </para></listitem>
16917    </varlistentry>
16918    <varlistentry>      <term>idr_mutex</term>
16919      <listitem><para>
16920   mutex for KMS ID allocation and management
16921      </para></listitem>
16922    </varlistentry>
16923    <varlistentry>      <term>crtc_idr</term>
16924      <listitem><para>
16925   main KMS ID tracking object
16926      </para></listitem>
16927    </varlistentry>
16928    <varlistentry>      <term>fb_lock</term>
16929      <listitem><para>
16930   mutex to protect fb state and lists
16931      </para></listitem>
16932    </varlistentry>
16933    <varlistentry>      <term>num_fb</term>
16934      <listitem><para>
16935   number of fbs available
16936      </para></listitem>
16937    </varlistentry>
16938    <varlistentry>      <term>fb_list</term>
16939      <listitem><para>
16940   list of framebuffers available
16941      </para></listitem>
16942    </varlistentry>
16943    <varlistentry>      <term>num_connector</term>
16944      <listitem><para>
16945   number of connectors on this device
16946      </para></listitem>
16947    </varlistentry>
16948    <varlistentry>      <term>connector_list</term>
16949      <listitem><para>
16950   list of connector objects
16951      </para></listitem>
16952    </varlistentry>
16953    <varlistentry>      <term>num_encoder</term>
16954      <listitem><para>
16955   number of encoders on this device
16956      </para></listitem>
16957    </varlistentry>
16958    <varlistentry>      <term>encoder_list</term>
16959      <listitem><para>
16960   list of encoder objects
16961      </para></listitem>
16962    </varlistentry>
16963    <varlistentry>      <term>num_overlay_plane</term>
16964      <listitem><para>
16965   number of overlay planes on this device
16966      </para></listitem>
16967    </varlistentry>
16968    <varlistentry>      <term>num_total_plane</term>
16969      <listitem><para>
16970   number of universal (i.e. with primary/curso) planes on this device
16971      </para></listitem>
16972    </varlistentry>
16973    <varlistentry>      <term>plane_list</term>
16974      <listitem><para>
16975   list of plane objects
16976      </para></listitem>
16977    </varlistentry>
16978    <varlistentry>      <term>num_crtc</term>
16979      <listitem><para>
16980   number of CRTCs on this device
16981      </para></listitem>
16982    </varlistentry>
16983    <varlistentry>      <term>crtc_list</term>
16984      <listitem><para>
16985   list of CRTC objects
16986      </para></listitem>
16987    </varlistentry>
16988    <varlistentry>      <term>property_list</term>
16989      <listitem><para>
16990   list of property objects
16991      </para></listitem>
16992    </varlistentry>
16993    <varlistentry>      <term>min_width</term>
16994      <listitem><para>
16995   minimum pixel width on this device
16996      </para></listitem>
16997    </varlistentry>
16998    <varlistentry>      <term>min_height</term>
16999      <listitem><para>
17000   minimum pixel height on this device
17001      </para></listitem>
17002    </varlistentry>
17003    <varlistentry>      <term>max_width</term>
17004      <listitem><para>
17005   maximum pixel width on this device
17006      </para></listitem>
17007    </varlistentry>
17008    <varlistentry>      <term>max_height</term>
17009      <listitem><para>
17010   maximum pixel height on this device
17011      </para></listitem>
17012    </varlistentry>
17013    <varlistentry>      <term>funcs</term>
17014      <listitem><para>
17015   core driver provided mode setting functions
17016      </para></listitem>
17017    </varlistentry>
17018    <varlistentry>      <term>fb_base</term>
17019      <listitem><para>
17020   base address of the framebuffer
17021      </para></listitem>
17022    </varlistentry>
17023    <varlistentry>      <term>poll_enabled</term>
17024      <listitem><para>
17025   track polling support for this device
17026      </para></listitem>
17027    </varlistentry>
17028    <varlistentry>      <term>poll_running</term>
17029      <listitem><para>
17030   track polling status for this device
17031      </para></listitem>
17032    </varlistentry>
17033    <varlistentry>      <term>output_poll_work</term>
17034      <listitem><para>
17035   delayed work for polling in process context
17036      </para></listitem>
17037    </varlistentry>
17038    <varlistentry>      <term>blob_lock</term>
17039      <listitem><para>
17040   mutex for blob property allocation and management
17041      </para></listitem>
17042    </varlistentry>
17043    <varlistentry>      <term>property_blob_list</term>
17044      <listitem><para>
17045   list of all the blob property objects
17046      </para></listitem>
17047    </varlistentry>
17048    <varlistentry>      <term>preferred_depth</term>
17049      <listitem><para>
17050   preferred RBG pixel depth, used by fb helpers
17051      </para></listitem>
17052    </varlistentry>
17053    <varlistentry>      <term>prefer_shadow</term>
17054      <listitem><para>
17055   hint to userspace to prefer shadow-fb rendering
17056      </para></listitem>
17057    </varlistentry>
17058    <varlistentry>      <term>async_page_flip</term>
17059      <listitem><para>
17060   does this device support async flips on the primary plane?
17061      </para></listitem>
17062    </varlistentry>
17063    <varlistentry>      <term>cursor_width</term>
17064      <listitem><para>
17065   hint to userspace for max cursor width
17066      </para></listitem>
17067    </varlistentry>
17068    <varlistentry>      <term>cursor_height</term>
17069      <listitem><para>
17070   hint to userspace for max cursor height
17071      </para></listitem>
17072    </varlistentry>
17073  </variablelist>
17074 </refsect1>
17075<refsect1>
17076<title>_property</title>
17077<para>
17078   core property tracking
17079</para>
17080</refsect1>
17081<refsect1>
17082<title>Description</title>
17083<para>
17084   Core mode resource tracking structure.  All CRTC, encoders, and connectors
17085   enumerated by the driver are added here, as are global properties.  Some
17086   global restrictions are also here, e.g. dimension restrictions.
17087</para>
17088</refsect1>
17089</refentry>
17090
17091<refentry id="API-drm-for-each-plane-mask">
17092<refentryinfo>
17093 <title>LINUX</title>
17094 <productname>Kernel Hackers Manual</productname>
17095 <date>July 2017</date>
17096</refentryinfo>
17097<refmeta>
17098 <refentrytitle><phrase>drm_for_each_plane_mask</phrase></refentrytitle>
17099 <manvolnum>9</manvolnum>
17100 <refmiscinfo class="version">4.4.14</refmiscinfo>
17101</refmeta>
17102<refnamediv>
17103 <refname>drm_for_each_plane_mask</refname>
17104 <refpurpose>
17105     iterate over planes specified by bitmask
17106 </refpurpose>
17107</refnamediv>
17108<refsynopsisdiv>
17109 <title>Synopsis</title>
17110  <funcsynopsis><funcprototype>
17111   <funcdef> <function>drm_for_each_plane_mask </function></funcdef>
17112   <paramdef> <parameter>plane</parameter></paramdef>
17113   <paramdef> <parameter>dev</parameter></paramdef>
17114   <paramdef> <parameter>plane_mask</parameter></paramdef>
17115  </funcprototype></funcsynopsis>
17116</refsynopsisdiv>
17117<refsect1>
17118 <title>Arguments</title>
17119 <variablelist>
17120  <varlistentry>
17121   <term><parameter>plane</parameter></term>
17122   <listitem>
17123    <para>
17124     the loop cursor
17125    </para>
17126   </listitem>
17127  </varlistentry>
17128  <varlistentry>
17129   <term><parameter>dev</parameter></term>
17130   <listitem>
17131    <para>
17132     the DRM device
17133    </para>
17134   </listitem>
17135  </varlistentry>
17136  <varlistentry>
17137   <term><parameter>plane_mask</parameter></term>
17138   <listitem>
17139    <para>
17140     bitmask of plane indices
17141    </para>
17142   </listitem>
17143  </varlistentry>
17144 </variablelist>
17145</refsect1>
17146<refsect1>
17147<title>Description</title>
17148<para>
17149   Iterate over all planes specified by bitmask.
17150</para>
17151</refsect1>
17152</refentry>
17153
17154<refentry id="API-drm-crtc-mask">
17155<refentryinfo>
17156 <title>LINUX</title>
17157 <productname>Kernel Hackers Manual</productname>
17158 <date>July 2017</date>
17159</refentryinfo>
17160<refmeta>
17161 <refentrytitle><phrase>drm_crtc_mask</phrase></refentrytitle>
17162 <manvolnum>9</manvolnum>
17163 <refmiscinfo class="version">4.4.14</refmiscinfo>
17164</refmeta>
17165<refnamediv>
17166 <refname>drm_crtc_mask</refname>
17167 <refpurpose>
17168     find the mask of a registered CRTC
17169 </refpurpose>
17170</refnamediv>
17171<refsynopsisdiv>
17172 <title>Synopsis</title>
17173  <funcsynopsis><funcprototype>
17174   <funcdef>uint32_t <function>drm_crtc_mask </function></funcdef>
17175   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
17176  </funcprototype></funcsynopsis>
17177</refsynopsisdiv>
17178<refsect1>
17179 <title>Arguments</title>
17180 <variablelist>
17181  <varlistentry>
17182   <term><parameter>crtc</parameter></term>
17183   <listitem>
17184    <para>
17185     CRTC to find mask for
17186    </para>
17187   </listitem>
17188  </varlistentry>
17189 </variablelist>
17190</refsect1>
17191<refsect1>
17192<title>Description</title>
17193<para>
17194   Given a registered CRTC, return the mask bit of that CRTC for an
17195   encoder's possible_crtcs field.
17196</para>
17197</refsect1>
17198</refentry>
17199
17200<refentry id="API-drm-encoder-crtc-ok">
17201<refentryinfo>
17202 <title>LINUX</title>
17203 <productname>Kernel Hackers Manual</productname>
17204 <date>July 2017</date>
17205</refentryinfo>
17206<refmeta>
17207 <refentrytitle><phrase>drm_encoder_crtc_ok</phrase></refentrytitle>
17208 <manvolnum>9</manvolnum>
17209 <refmiscinfo class="version">4.4.14</refmiscinfo>
17210</refmeta>
17211<refnamediv>
17212 <refname>drm_encoder_crtc_ok</refname>
17213 <refpurpose>
17214     can a given crtc drive a given encoder?
17215 </refpurpose>
17216</refnamediv>
17217<refsynopsisdiv>
17218 <title>Synopsis</title>
17219  <funcsynopsis><funcprototype>
17220   <funcdef>bool <function>drm_encoder_crtc_ok </function></funcdef>
17221   <paramdef>struct drm_encoder * <parameter>encoder</parameter></paramdef>
17222   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
17223  </funcprototype></funcsynopsis>
17224</refsynopsisdiv>
17225<refsect1>
17226 <title>Arguments</title>
17227 <variablelist>
17228  <varlistentry>
17229   <term><parameter>encoder</parameter></term>
17230   <listitem>
17231    <para>
17232     encoder to test
17233    </para>
17234   </listitem>
17235  </varlistentry>
17236  <varlistentry>
17237   <term><parameter>crtc</parameter></term>
17238   <listitem>
17239    <para>
17240     crtc to test
17241    </para>
17242   </listitem>
17243  </varlistentry>
17244 </variablelist>
17245</refsect1>
17246<refsect1>
17247<title>Description</title>
17248<para>
17249   Return false if <parameter>encoder</parameter> can't be driven by <parameter>crtc</parameter>, true otherwise.
17250</para>
17251</refsect1>
17252</refentry>
17253
17254    </sect2>
17255    <sect2>
17256      <title>KMS Locking</title>
17257<para>
17258   </para><para>
17259   As KMS moves toward more fine grained locking, and atomic ioctl where
17260   userspace can indirectly control locking order, it becomes necessary
17261   to use ww_mutex and acquire-contexts to avoid deadlocks.  But because
17262   the locking is more distributed around the driver code, we want a bit
17263   of extra utility/tracking out of our acquire-ctx.  This is provided
17264   by drm_modeset_lock / drm_modeset_acquire_ctx.
17265   </para><para>
17266   For basic principles of ww_mutex, see: Documentation/locking/ww-mutex-design.txt
17267   </para><para>
17268   The basic usage pattern is to:
17269   </para><para>
17270   drm_modeset_acquire_init(<structname>ctx</structname>)
17271   retry:
17272   foreach (lock in random_ordered_set_of_locks) {
17273   ret = drm_modeset_lock(lock, <structname>ctx</structname>)
17274   if (ret == -EDEADLK) {
17275   drm_modeset_backoff(<structname>ctx</structname>);
17276   goto retry;
17277   }
17278   }
17279   </para><para>
17280   ... do stuff ...
17281   </para><para>
17282   drm_modeset_drop_locks(<structname>ctx</structname>);
17283   drm_modeset_acquire_fini(<structname>ctx</structname>);
17284</para>
17285
17286<!-- include/drm/drm_modeset_lock.h -->
17287<refentry id="API-struct-drm-modeset-acquire-ctx">
17288<refentryinfo>
17289 <title>LINUX</title>
17290 <productname>Kernel Hackers Manual</productname>
17291 <date>July 2017</date>
17292</refentryinfo>
17293<refmeta>
17294 <refentrytitle><phrase>struct drm_modeset_acquire_ctx</phrase></refentrytitle>
17295 <manvolnum>9</manvolnum>
17296 <refmiscinfo class="version">4.4.14</refmiscinfo>
17297</refmeta>
17298<refnamediv>
17299 <refname>struct drm_modeset_acquire_ctx</refname>
17300 <refpurpose>
17301  locking context (see ww_acquire_ctx)
17302 </refpurpose>
17303</refnamediv>
17304<refsynopsisdiv>
17305 <title>Synopsis</title>
17306  <programlisting>
17307struct drm_modeset_acquire_ctx {
17308  struct ww_acquire_ctx ww_ctx;
17309  struct drm_modeset_lock * contended;
17310  struct list_head locked;
17311  bool trylock_only;
17312};  </programlisting>
17313</refsynopsisdiv>
17314 <refsect1>
17315  <title>Members</title>
17316  <variablelist>
17317    <varlistentry>      <term>ww_ctx</term>
17318      <listitem><para>
17319base acquire ctx
17320      </para></listitem>
17321    </varlistentry>
17322    <varlistentry>      <term>contended</term>
17323      <listitem><para>
17324used internally for -EDEADLK handling
17325      </para></listitem>
17326    </varlistentry>
17327    <varlistentry>      <term>locked</term>
17328      <listitem><para>
17329list of held locks
17330      </para></listitem>
17331    </varlistentry>
17332    <varlistentry>      <term>trylock_only</term>
17333      <listitem><para>
17334trylock mode used in atomic contexts/panic notifiers
17335      </para></listitem>
17336    </varlistentry>
17337  </variablelist>
17338 </refsect1>
17339<refsect1>
17340<title>Description</title>
17341<para>
17342   Each thread competing for a set of locks must use one acquire
17343   ctx.  And if any lock fxn returns -EDEADLK, it must backoff and
17344   retry.
17345</para>
17346</refsect1>
17347</refentry>
17348
17349<refentry id="API-struct-drm-modeset-lock">
17350<refentryinfo>
17351 <title>LINUX</title>
17352 <productname>Kernel Hackers Manual</productname>
17353 <date>July 2017</date>
17354</refentryinfo>
17355<refmeta>
17356 <refentrytitle><phrase>struct drm_modeset_lock</phrase></refentrytitle>
17357 <manvolnum>9</manvolnum>
17358 <refmiscinfo class="version">4.4.14</refmiscinfo>
17359</refmeta>
17360<refnamediv>
17361 <refname>struct drm_modeset_lock</refname>
17362 <refpurpose>
17363     used for locking modeset resources.
17364 </refpurpose>
17365</refnamediv>
17366<refsynopsisdiv>
17367 <title>Synopsis</title>
17368  <programlisting>
17369struct drm_modeset_lock {
17370  struct ww_mutex mutex;
17371  struct list_head head;
17372};  </programlisting>
17373</refsynopsisdiv>
17374 <refsect1>
17375  <title>Members</title>
17376  <variablelist>
17377    <varlistentry>      <term>mutex</term>
17378      <listitem><para>
17379   resource locking
17380      </para></listitem>
17381    </varlistentry>
17382    <varlistentry>      <term>head</term>
17383      <listitem><para>
17384   used to hold it's place on state-&gt;locked list when
17385   part of an atomic update
17386      </para></listitem>
17387    </varlistentry>
17388  </variablelist>
17389 </refsect1>
17390<refsect1>
17391<title>Description</title>
17392<para>
17393   Used for locking CRTCs and other modeset resources.
17394</para>
17395</refsect1>
17396</refentry>
17397
17398<refentry id="API-drm-modeset-lock-init">
17399<refentryinfo>
17400 <title>LINUX</title>
17401 <productname>Kernel Hackers Manual</productname>
17402 <date>July 2017</date>
17403</refentryinfo>
17404<refmeta>
17405 <refentrytitle><phrase>drm_modeset_lock_init</phrase></refentrytitle>
17406 <manvolnum>9</manvolnum>
17407 <refmiscinfo class="version">4.4.14</refmiscinfo>
17408</refmeta>
17409<refnamediv>
17410 <refname>drm_modeset_lock_init</refname>
17411 <refpurpose>
17412     initialize lock
17413 </refpurpose>
17414</refnamediv>
17415<refsynopsisdiv>
17416 <title>Synopsis</title>
17417  <funcsynopsis><funcprototype>
17418   <funcdef>void <function>drm_modeset_lock_init </function></funcdef>
17419   <paramdef>struct drm_modeset_lock * <parameter>lock</parameter></paramdef>
17420  </funcprototype></funcsynopsis>
17421</refsynopsisdiv>
17422<refsect1>
17423 <title>Arguments</title>
17424 <variablelist>
17425  <varlistentry>
17426   <term><parameter>lock</parameter></term>
17427   <listitem>
17428    <para>
17429     lock to init
17430    </para>
17431   </listitem>
17432  </varlistentry>
17433 </variablelist>
17434</refsect1>
17435</refentry>
17436
17437<refentry id="API-drm-modeset-lock-fini">
17438<refentryinfo>
17439 <title>LINUX</title>
17440 <productname>Kernel Hackers Manual</productname>
17441 <date>July 2017</date>
17442</refentryinfo>
17443<refmeta>
17444 <refentrytitle><phrase>drm_modeset_lock_fini</phrase></refentrytitle>
17445 <manvolnum>9</manvolnum>
17446 <refmiscinfo class="version">4.4.14</refmiscinfo>
17447</refmeta>
17448<refnamediv>
17449 <refname>drm_modeset_lock_fini</refname>
17450 <refpurpose>
17451     cleanup lock
17452 </refpurpose>
17453</refnamediv>
17454<refsynopsisdiv>
17455 <title>Synopsis</title>
17456  <funcsynopsis><funcprototype>
17457   <funcdef>void <function>drm_modeset_lock_fini </function></funcdef>
17458   <paramdef>struct drm_modeset_lock * <parameter>lock</parameter></paramdef>
17459  </funcprototype></funcsynopsis>
17460</refsynopsisdiv>
17461<refsect1>
17462 <title>Arguments</title>
17463 <variablelist>
17464  <varlistentry>
17465   <term><parameter>lock</parameter></term>
17466   <listitem>
17467    <para>
17468     lock to cleanup
17469    </para>
17470   </listitem>
17471  </varlistentry>
17472 </variablelist>
17473</refsect1>
17474</refentry>
17475
17476<refentry id="API-drm-modeset-is-locked">
17477<refentryinfo>
17478 <title>LINUX</title>
17479 <productname>Kernel Hackers Manual</productname>
17480 <date>July 2017</date>
17481</refentryinfo>
17482<refmeta>
17483 <refentrytitle><phrase>drm_modeset_is_locked</phrase></refentrytitle>
17484 <manvolnum>9</manvolnum>
17485 <refmiscinfo class="version">4.4.14</refmiscinfo>
17486</refmeta>
17487<refnamediv>
17488 <refname>drm_modeset_is_locked</refname>
17489 <refpurpose>
17490     equivalent to <function>mutex_is_locked</function>
17491 </refpurpose>
17492</refnamediv>
17493<refsynopsisdiv>
17494 <title>Synopsis</title>
17495  <funcsynopsis><funcprototype>
17496   <funcdef>bool <function>drm_modeset_is_locked </function></funcdef>
17497   <paramdef>struct drm_modeset_lock * <parameter>lock</parameter></paramdef>
17498  </funcprototype></funcsynopsis>
17499</refsynopsisdiv>
17500<refsect1>
17501 <title>Arguments</title>
17502 <variablelist>
17503  <varlistentry>
17504   <term><parameter>lock</parameter></term>
17505   <listitem>
17506    <para>
17507     lock to check
17508    </para>
17509   </listitem>
17510  </varlistentry>
17511 </variablelist>
17512</refsect1>
17513</refentry>
17514
17515<!-- drivers/gpu/drm/drm_modeset_lock.c -->
17516<refentry id="API-drm-modeset-lock-all">
17517<refentryinfo>
17518 <title>LINUX</title>
17519 <productname>Kernel Hackers Manual</productname>
17520 <date>July 2017</date>
17521</refentryinfo>
17522<refmeta>
17523 <refentrytitle><phrase>drm_modeset_lock_all</phrase></refentrytitle>
17524 <manvolnum>9</manvolnum>
17525 <refmiscinfo class="version">4.4.14</refmiscinfo>
17526</refmeta>
17527<refnamediv>
17528 <refname>drm_modeset_lock_all</refname>
17529 <refpurpose>
17530  take all modeset locks
17531 </refpurpose>
17532</refnamediv>
17533<refsynopsisdiv>
17534 <title>Synopsis</title>
17535  <funcsynopsis><funcprototype>
17536   <funcdef>void <function>drm_modeset_lock_all </function></funcdef>
17537   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
17538  </funcprototype></funcsynopsis>
17539</refsynopsisdiv>
17540<refsect1>
17541 <title>Arguments</title>
17542 <variablelist>
17543  <varlistentry>
17544   <term><parameter>dev</parameter></term>
17545   <listitem>
17546    <para>
17547     drm device
17548    </para>
17549   </listitem>
17550  </varlistentry>
17551 </variablelist>
17552</refsect1>
17553<refsect1>
17554<title>Description</title>
17555<para>
17556   This function takes all modeset locks, suitable where a more fine-grained
17557   scheme isn't (yet) implemented. Locks must be dropped with
17558   drm_modeset_unlock_all.
17559</para>
17560</refsect1>
17561</refentry>
17562
17563<refentry id="API-drm-modeset-unlock-all">
17564<refentryinfo>
17565 <title>LINUX</title>
17566 <productname>Kernel Hackers Manual</productname>
17567 <date>July 2017</date>
17568</refentryinfo>
17569<refmeta>
17570 <refentrytitle><phrase>drm_modeset_unlock_all</phrase></refentrytitle>
17571 <manvolnum>9</manvolnum>
17572 <refmiscinfo class="version">4.4.14</refmiscinfo>
17573</refmeta>
17574<refnamediv>
17575 <refname>drm_modeset_unlock_all</refname>
17576 <refpurpose>
17577     drop all modeset locks
17578 </refpurpose>
17579</refnamediv>
17580<refsynopsisdiv>
17581 <title>Synopsis</title>
17582  <funcsynopsis><funcprototype>
17583   <funcdef>void <function>drm_modeset_unlock_all </function></funcdef>
17584   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
17585  </funcprototype></funcsynopsis>
17586</refsynopsisdiv>
17587<refsect1>
17588 <title>Arguments</title>
17589 <variablelist>
17590  <varlistentry>
17591   <term><parameter>dev</parameter></term>
17592   <listitem>
17593    <para>
17594     device
17595    </para>
17596   </listitem>
17597  </varlistentry>
17598 </variablelist>
17599</refsect1>
17600<refsect1>
17601<title>Description</title>
17602<para>
17603   This function drop all modeset locks taken by drm_modeset_lock_all.
17604</para>
17605</refsect1>
17606</refentry>
17607
17608<refentry id="API-drm-modeset-lock-crtc">
17609<refentryinfo>
17610 <title>LINUX</title>
17611 <productname>Kernel Hackers Manual</productname>
17612 <date>July 2017</date>
17613</refentryinfo>
17614<refmeta>
17615 <refentrytitle><phrase>drm_modeset_lock_crtc</phrase></refentrytitle>
17616 <manvolnum>9</manvolnum>
17617 <refmiscinfo class="version">4.4.14</refmiscinfo>
17618</refmeta>
17619<refnamediv>
17620 <refname>drm_modeset_lock_crtc</refname>
17621 <refpurpose>
17622     lock crtc with hidden acquire ctx for a plane update
17623 </refpurpose>
17624</refnamediv>
17625<refsynopsisdiv>
17626 <title>Synopsis</title>
17627  <funcsynopsis><funcprototype>
17628   <funcdef>void <function>drm_modeset_lock_crtc </function></funcdef>
17629   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
17630   <paramdef>struct drm_plane * <parameter>plane</parameter></paramdef>
17631  </funcprototype></funcsynopsis>
17632</refsynopsisdiv>
17633<refsect1>
17634 <title>Arguments</title>
17635 <variablelist>
17636  <varlistentry>
17637   <term><parameter>crtc</parameter></term>
17638   <listitem>
17639    <para>
17640     DRM CRTC
17641    </para>
17642   </listitem>
17643  </varlistentry>
17644  <varlistentry>
17645   <term><parameter>plane</parameter></term>
17646   <listitem>
17647    <para>
17648     DRM plane to be updated on <parameter>crtc</parameter>
17649    </para>
17650   </listitem>
17651  </varlistentry>
17652 </variablelist>
17653</refsect1>
17654<refsect1>
17655<title>Description</title>
17656<para>
17657   This function locks the given crtc and plane (which should be either the
17658   primary or cursor plane) using a hidden acquire context. This is necessary so
17659   that drivers internally using the atomic interfaces can grab further locks
17660   with the lock acquire context.
17661   </para><para>
17662
17663   Note that <parameter>plane</parameter> can be NULL, e.g. when the cursor support hasn't yet been
17664   converted to universal planes yet.
17665</para>
17666</refsect1>
17667</refentry>
17668
17669<refentry id="API-drm-modeset-legacy-acquire-ctx">
17670<refentryinfo>
17671 <title>LINUX</title>
17672 <productname>Kernel Hackers Manual</productname>
17673 <date>July 2017</date>
17674</refentryinfo>
17675<refmeta>
17676 <refentrytitle><phrase>drm_modeset_legacy_acquire_ctx</phrase></refentrytitle>
17677 <manvolnum>9</manvolnum>
17678 <refmiscinfo class="version">4.4.14</refmiscinfo>
17679</refmeta>
17680<refnamediv>
17681 <refname>drm_modeset_legacy_acquire_ctx</refname>
17682 <refpurpose>
17683     find acquire ctx for legacy ioctls
17684 </refpurpose>
17685</refnamediv>
17686<refsynopsisdiv>
17687 <title>Synopsis</title>
17688  <funcsynopsis><funcprototype>
17689   <funcdef>struct drm_modeset_acquire_ctx * <function>drm_modeset_legacy_acquire_ctx </function></funcdef>
17690   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
17691  </funcprototype></funcsynopsis>
17692</refsynopsisdiv>
17693<refsect1>
17694 <title>Arguments</title>
17695 <variablelist>
17696  <varlistentry>
17697   <term><parameter>crtc</parameter></term>
17698   <listitem>
17699    <para>
17700     drm crtc
17701    </para>
17702   </listitem>
17703  </varlistentry>
17704 </variablelist>
17705</refsect1>
17706<refsect1>
17707<title>Description</title>
17708<para>
17709   Legacy ioctl operations like cursor updates or page flips only have per-crtc
17710   locking, and store the acquire ctx in the corresponding crtc. All other
17711   legacy operations take all locks and use a global acquire context. This
17712   function grabs the right one.
17713</para>
17714</refsect1>
17715</refentry>
17716
17717<refentry id="API-drm-modeset-unlock-crtc">
17718<refentryinfo>
17719 <title>LINUX</title>
17720 <productname>Kernel Hackers Manual</productname>
17721 <date>July 2017</date>
17722</refentryinfo>
17723<refmeta>
17724 <refentrytitle><phrase>drm_modeset_unlock_crtc</phrase></refentrytitle>
17725 <manvolnum>9</manvolnum>
17726 <refmiscinfo class="version">4.4.14</refmiscinfo>
17727</refmeta>
17728<refnamediv>
17729 <refname>drm_modeset_unlock_crtc</refname>
17730 <refpurpose>
17731     drop crtc lock
17732 </refpurpose>
17733</refnamediv>
17734<refsynopsisdiv>
17735 <title>Synopsis</title>
17736  <funcsynopsis><funcprototype>
17737   <funcdef>void <function>drm_modeset_unlock_crtc </function></funcdef>
17738   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
17739  </funcprototype></funcsynopsis>
17740</refsynopsisdiv>
17741<refsect1>
17742 <title>Arguments</title>
17743 <variablelist>
17744  <varlistentry>
17745   <term><parameter>crtc</parameter></term>
17746   <listitem>
17747    <para>
17748     drm crtc
17749    </para>
17750   </listitem>
17751  </varlistentry>
17752 </variablelist>
17753</refsect1>
17754<refsect1>
17755<title>Description</title>
17756<para>
17757   This drops the crtc lock acquire with <function>drm_modeset_lock_crtc</function> and all other
17758   locks acquired through the hidden context.
17759</para>
17760</refsect1>
17761</refentry>
17762
17763<refentry id="API-drm-warn-on-modeset-not-all-locked">
17764<refentryinfo>
17765 <title>LINUX</title>
17766 <productname>Kernel Hackers Manual</productname>
17767 <date>July 2017</date>
17768</refentryinfo>
17769<refmeta>
17770 <refentrytitle><phrase>drm_warn_on_modeset_not_all_locked</phrase></refentrytitle>
17771 <manvolnum>9</manvolnum>
17772 <refmiscinfo class="version">4.4.14</refmiscinfo>
17773</refmeta>
17774<refnamediv>
17775 <refname>drm_warn_on_modeset_not_all_locked</refname>
17776 <refpurpose>
17777     check that all modeset locks are locked
17778 </refpurpose>
17779</refnamediv>
17780<refsynopsisdiv>
17781 <title>Synopsis</title>
17782  <funcsynopsis><funcprototype>
17783   <funcdef>void <function>drm_warn_on_modeset_not_all_locked </function></funcdef>
17784   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
17785  </funcprototype></funcsynopsis>
17786</refsynopsisdiv>
17787<refsect1>
17788 <title>Arguments</title>
17789 <variablelist>
17790  <varlistentry>
17791   <term><parameter>dev</parameter></term>
17792   <listitem>
17793    <para>
17794     device
17795    </para>
17796   </listitem>
17797  </varlistentry>
17798 </variablelist>
17799</refsect1>
17800<refsect1>
17801<title>Description</title>
17802<para>
17803   Useful as a debug assert.
17804</para>
17805</refsect1>
17806</refentry>
17807
17808<refentry id="API-drm-modeset-acquire-init">
17809<refentryinfo>
17810 <title>LINUX</title>
17811 <productname>Kernel Hackers Manual</productname>
17812 <date>July 2017</date>
17813</refentryinfo>
17814<refmeta>
17815 <refentrytitle><phrase>drm_modeset_acquire_init</phrase></refentrytitle>
17816 <manvolnum>9</manvolnum>
17817 <refmiscinfo class="version">4.4.14</refmiscinfo>
17818</refmeta>
17819<refnamediv>
17820 <refname>drm_modeset_acquire_init</refname>
17821 <refpurpose>
17822     initialize acquire context
17823 </refpurpose>
17824</refnamediv>
17825<refsynopsisdiv>
17826 <title>Synopsis</title>
17827  <funcsynopsis><funcprototype>
17828   <funcdef>void <function>drm_modeset_acquire_init </function></funcdef>
17829   <paramdef>struct drm_modeset_acquire_ctx * <parameter>ctx</parameter></paramdef>
17830   <paramdef>uint32_t <parameter>flags</parameter></paramdef>
17831  </funcprototype></funcsynopsis>
17832</refsynopsisdiv>
17833<refsect1>
17834 <title>Arguments</title>
17835 <variablelist>
17836  <varlistentry>
17837   <term><parameter>ctx</parameter></term>
17838   <listitem>
17839    <para>
17840     the acquire context
17841    </para>
17842   </listitem>
17843  </varlistentry>
17844  <varlistentry>
17845   <term><parameter>flags</parameter></term>
17846   <listitem>
17847    <para>
17848     for future
17849    </para>
17850   </listitem>
17851  </varlistentry>
17852 </variablelist>
17853</refsect1>
17854</refentry>
17855
17856<refentry id="API-drm-modeset-acquire-fini">
17857<refentryinfo>
17858 <title>LINUX</title>
17859 <productname>Kernel Hackers Manual</productname>
17860 <date>July 2017</date>
17861</refentryinfo>
17862<refmeta>
17863 <refentrytitle><phrase>drm_modeset_acquire_fini</phrase></refentrytitle>
17864 <manvolnum>9</manvolnum>
17865 <refmiscinfo class="version">4.4.14</refmiscinfo>
17866</refmeta>
17867<refnamediv>
17868 <refname>drm_modeset_acquire_fini</refname>
17869 <refpurpose>
17870     cleanup acquire context
17871 </refpurpose>
17872</refnamediv>
17873<refsynopsisdiv>
17874 <title>Synopsis</title>
17875  <funcsynopsis><funcprototype>
17876   <funcdef>void <function>drm_modeset_acquire_fini </function></funcdef>
17877   <paramdef>struct drm_modeset_acquire_ctx * <parameter>ctx</parameter></paramdef>
17878  </funcprototype></funcsynopsis>
17879</refsynopsisdiv>
17880<refsect1>
17881 <title>Arguments</title>
17882 <variablelist>
17883  <varlistentry>
17884   <term><parameter>ctx</parameter></term>
17885   <listitem>
17886    <para>
17887     the acquire context
17888    </para>
17889   </listitem>
17890  </varlistentry>
17891 </variablelist>
17892</refsect1>
17893</refentry>
17894
17895<refentry id="API-drm-modeset-drop-locks">
17896<refentryinfo>
17897 <title>LINUX</title>
17898 <productname>Kernel Hackers Manual</productname>
17899 <date>July 2017</date>
17900</refentryinfo>
17901<refmeta>
17902 <refentrytitle><phrase>drm_modeset_drop_locks</phrase></refentrytitle>
17903 <manvolnum>9</manvolnum>
17904 <refmiscinfo class="version">4.4.14</refmiscinfo>
17905</refmeta>
17906<refnamediv>
17907 <refname>drm_modeset_drop_locks</refname>
17908 <refpurpose>
17909     drop all locks
17910 </refpurpose>
17911</refnamediv>
17912<refsynopsisdiv>
17913 <title>Synopsis</title>
17914  <funcsynopsis><funcprototype>
17915   <funcdef>void <function>drm_modeset_drop_locks </function></funcdef>
17916   <paramdef>struct drm_modeset_acquire_ctx * <parameter>ctx</parameter></paramdef>
17917  </funcprototype></funcsynopsis>
17918</refsynopsisdiv>
17919<refsect1>
17920 <title>Arguments</title>
17921 <variablelist>
17922  <varlistentry>
17923   <term><parameter>ctx</parameter></term>
17924   <listitem>
17925    <para>
17926     the acquire context
17927    </para>
17928   </listitem>
17929  </varlistentry>
17930 </variablelist>
17931</refsect1>
17932<refsect1>
17933<title>Description</title>
17934<para>
17935   Drop all locks currently held against this acquire context.
17936</para>
17937</refsect1>
17938</refentry>
17939
17940<refentry id="API-drm-modeset-backoff">
17941<refentryinfo>
17942 <title>LINUX</title>
17943 <productname>Kernel Hackers Manual</productname>
17944 <date>July 2017</date>
17945</refentryinfo>
17946<refmeta>
17947 <refentrytitle><phrase>drm_modeset_backoff</phrase></refentrytitle>
17948 <manvolnum>9</manvolnum>
17949 <refmiscinfo class="version">4.4.14</refmiscinfo>
17950</refmeta>
17951<refnamediv>
17952 <refname>drm_modeset_backoff</refname>
17953 <refpurpose>
17954     deadlock avoidance backoff
17955 </refpurpose>
17956</refnamediv>
17957<refsynopsisdiv>
17958 <title>Synopsis</title>
17959  <funcsynopsis><funcprototype>
17960   <funcdef>void <function>drm_modeset_backoff </function></funcdef>
17961   <paramdef>struct drm_modeset_acquire_ctx * <parameter>ctx</parameter></paramdef>
17962  </funcprototype></funcsynopsis>
17963</refsynopsisdiv>
17964<refsect1>
17965 <title>Arguments</title>
17966 <variablelist>
17967  <varlistentry>
17968   <term><parameter>ctx</parameter></term>
17969   <listitem>
17970    <para>
17971     the acquire context
17972    </para>
17973   </listitem>
17974  </varlistentry>
17975 </variablelist>
17976</refsect1>
17977<refsect1>
17978<title>Description</title>
17979<para>
17980   If deadlock is detected (ie. <function>drm_modeset_lock</function> returns -EDEADLK),
17981   you must call this function to drop all currently held locks and
17982   block until the contended lock becomes available.
17983</para>
17984</refsect1>
17985</refentry>
17986
17987<refentry id="API-drm-modeset-backoff-interruptible">
17988<refentryinfo>
17989 <title>LINUX</title>
17990 <productname>Kernel Hackers Manual</productname>
17991 <date>July 2017</date>
17992</refentryinfo>
17993<refmeta>
17994 <refentrytitle><phrase>drm_modeset_backoff_interruptible</phrase></refentrytitle>
17995 <manvolnum>9</manvolnum>
17996 <refmiscinfo class="version">4.4.14</refmiscinfo>
17997</refmeta>
17998<refnamediv>
17999 <refname>drm_modeset_backoff_interruptible</refname>
18000 <refpurpose>
18001     deadlock avoidance backoff
18002 </refpurpose>
18003</refnamediv>
18004<refsynopsisdiv>
18005 <title>Synopsis</title>
18006  <funcsynopsis><funcprototype>
18007   <funcdef>int <function>drm_modeset_backoff_interruptible </function></funcdef>
18008   <paramdef>struct drm_modeset_acquire_ctx * <parameter>ctx</parameter></paramdef>
18009  </funcprototype></funcsynopsis>
18010</refsynopsisdiv>
18011<refsect1>
18012 <title>Arguments</title>
18013 <variablelist>
18014  <varlistentry>
18015   <term><parameter>ctx</parameter></term>
18016   <listitem>
18017    <para>
18018     the acquire context
18019    </para>
18020   </listitem>
18021  </varlistentry>
18022 </variablelist>
18023</refsect1>
18024<refsect1>
18025<title>Description</title>
18026<para>
18027   Interruptible version of <function>drm_modeset_backoff</function>
18028</para>
18029</refsect1>
18030</refentry>
18031
18032<refentry id="API-drm-modeset-lock">
18033<refentryinfo>
18034 <title>LINUX</title>
18035 <productname>Kernel Hackers Manual</productname>
18036 <date>July 2017</date>
18037</refentryinfo>
18038<refmeta>
18039 <refentrytitle><phrase>drm_modeset_lock</phrase></refentrytitle>
18040 <manvolnum>9</manvolnum>
18041 <refmiscinfo class="version">4.4.14</refmiscinfo>
18042</refmeta>
18043<refnamediv>
18044 <refname>drm_modeset_lock</refname>
18045 <refpurpose>
18046     take modeset lock
18047 </refpurpose>
18048</refnamediv>
18049<refsynopsisdiv>
18050 <title>Synopsis</title>
18051  <funcsynopsis><funcprototype>
18052   <funcdef>int <function>drm_modeset_lock </function></funcdef>
18053   <paramdef>struct drm_modeset_lock * <parameter>lock</parameter></paramdef>
18054   <paramdef>struct drm_modeset_acquire_ctx * <parameter>ctx</parameter></paramdef>
18055  </funcprototype></funcsynopsis>
18056</refsynopsisdiv>
18057<refsect1>
18058 <title>Arguments</title>
18059 <variablelist>
18060  <varlistentry>
18061   <term><parameter>lock</parameter></term>
18062   <listitem>
18063    <para>
18064     lock to take
18065    </para>
18066   </listitem>
18067  </varlistentry>
18068  <varlistentry>
18069   <term><parameter>ctx</parameter></term>
18070   <listitem>
18071    <para>
18072     acquire ctx
18073    </para>
18074   </listitem>
18075  </varlistentry>
18076 </variablelist>
18077</refsect1>
18078<refsect1>
18079<title>Description</title>
18080<para>
18081   If ctx is not NULL, then its ww acquire context is used and the
18082   lock will be tracked by the context and can be released by calling
18083   <function>drm_modeset_drop_locks</function>.  If -EDEADLK is returned, this means a
18084   deadlock scenario has been detected and it is an error to attempt
18085   to take any more locks without first calling <function>drm_modeset_backoff</function>.
18086</para>
18087</refsect1>
18088</refentry>
18089
18090<refentry id="API-drm-modeset-lock-interruptible">
18091<refentryinfo>
18092 <title>LINUX</title>
18093 <productname>Kernel Hackers Manual</productname>
18094 <date>July 2017</date>
18095</refentryinfo>
18096<refmeta>
18097 <refentrytitle><phrase>drm_modeset_lock_interruptible</phrase></refentrytitle>
18098 <manvolnum>9</manvolnum>
18099 <refmiscinfo class="version">4.4.14</refmiscinfo>
18100</refmeta>
18101<refnamediv>
18102 <refname>drm_modeset_lock_interruptible</refname>
18103 <refpurpose>
18104     take modeset lock
18105 </refpurpose>
18106</refnamediv>
18107<refsynopsisdiv>
18108 <title>Synopsis</title>
18109  <funcsynopsis><funcprototype>
18110   <funcdef>int <function>drm_modeset_lock_interruptible </function></funcdef>
18111   <paramdef>struct drm_modeset_lock * <parameter>lock</parameter></paramdef>
18112   <paramdef>struct drm_modeset_acquire_ctx * <parameter>ctx</parameter></paramdef>
18113  </funcprototype></funcsynopsis>
18114</refsynopsisdiv>
18115<refsect1>
18116 <title>Arguments</title>
18117 <variablelist>
18118  <varlistentry>
18119   <term><parameter>lock</parameter></term>
18120   <listitem>
18121    <para>
18122     lock to take
18123    </para>
18124   </listitem>
18125  </varlistentry>
18126  <varlistentry>
18127   <term><parameter>ctx</parameter></term>
18128   <listitem>
18129    <para>
18130     acquire ctx
18131    </para>
18132   </listitem>
18133  </varlistentry>
18134 </variablelist>
18135</refsect1>
18136<refsect1>
18137<title>Description</title>
18138<para>
18139   Interruptible version of <function>drm_modeset_lock</function>
18140</para>
18141</refsect1>
18142</refentry>
18143
18144<refentry id="API-drm-modeset-unlock">
18145<refentryinfo>
18146 <title>LINUX</title>
18147 <productname>Kernel Hackers Manual</productname>
18148 <date>July 2017</date>
18149</refentryinfo>
18150<refmeta>
18151 <refentrytitle><phrase>drm_modeset_unlock</phrase></refentrytitle>
18152 <manvolnum>9</manvolnum>
18153 <refmiscinfo class="version">4.4.14</refmiscinfo>
18154</refmeta>
18155<refnamediv>
18156 <refname>drm_modeset_unlock</refname>
18157 <refpurpose>
18158     drop modeset lock
18159 </refpurpose>
18160</refnamediv>
18161<refsynopsisdiv>
18162 <title>Synopsis</title>
18163  <funcsynopsis><funcprototype>
18164   <funcdef>void <function>drm_modeset_unlock </function></funcdef>
18165   <paramdef>struct drm_modeset_lock * <parameter>lock</parameter></paramdef>
18166  </funcprototype></funcsynopsis>
18167</refsynopsisdiv>
18168<refsect1>
18169 <title>Arguments</title>
18170 <variablelist>
18171  <varlistentry>
18172   <term><parameter>lock</parameter></term>
18173   <listitem>
18174    <para>
18175     lock to release
18176    </para>
18177   </listitem>
18178  </varlistentry>
18179 </variablelist>
18180</refsect1>
18181</refentry>
18182
18183    </sect2>
18184  </sect1>
18185
18186  <!-- Internals: kms helper functions -->
18187
18188  <sect1>
18189    <title>Mode Setting Helper Functions</title>
18190    <para>
18191      The plane, CRTC, encoder and connector functions provided by the drivers
18192      implement the DRM API. They're called by the DRM core and ioctl handlers
18193      to handle device state changes and configuration request. As implementing
18194      those functions often requires logic not specific to drivers, mid-layer
18195      helper functions are available to avoid duplicating boilerplate code.
18196    </para>
18197    <para>
18198      The DRM core contains one mid-layer implementation. The mid-layer provides
18199      implementations of several plane, CRTC, encoder and connector functions
18200      (called from the top of the mid-layer) that pre-process requests and call
18201      lower-level functions provided by the driver (at the bottom of the
18202      mid-layer). For instance, the
18203      <function>drm_crtc_helper_set_config</function> function can be used to
18204      fill the struct <structname>drm_crtc_funcs</structname>
18205      <structfield>set_config</structfield> field. When called, it will split
18206      the <methodname>set_config</methodname> operation in smaller, simpler
18207      operations and call the driver to handle them.
18208    </para>
18209    <para>
18210      To use the mid-layer, drivers call <function>drm_crtc_helper_add</function>,
18211      <function>drm_encoder_helper_add</function> and
18212      <function>drm_connector_helper_add</function> functions to install their
18213      mid-layer bottom operations handlers, and fill the
18214      <structname>drm_crtc_funcs</structname>,
18215      <structname>drm_encoder_funcs</structname> and
18216      <structname>drm_connector_funcs</structname> structures with pointers to
18217      the mid-layer top API functions. Installing the mid-layer bottom operation
18218      handlers is best done right after registering the corresponding KMS object.
18219    </para>
18220    <para>
18221      The mid-layer is not split between CRTC, encoder and connector operations.
18222      To use it, a driver must provide bottom functions for all of the three KMS
18223      entities.
18224    </para>
18225    <sect2>
18226      <title>Helper Functions</title>
18227      <itemizedlist>
18228        <listitem>
18229          <synopsis>int drm_crtc_helper_set_config(struct drm_mode_set *set);</synopsis>
18230          <para>
18231            The <function>drm_crtc_helper_set_config</function> helper function
18232            is a CRTC <methodname>set_config</methodname> implementation. It
18233            first tries to locate the best encoder for each connector by calling
18234            the connector <methodname>best_encoder</methodname> helper
18235            operation.
18236          </para>
18237          <para>
18238            After locating the appropriate encoders, the helper function will
18239            call the <methodname>mode_fixup</methodname> encoder and CRTC helper
18240            operations to adjust the requested mode, or reject it completely in
18241            which case an error will be returned to the application. If the new
18242            configuration after mode adjustment is identical to the current
18243            configuration the helper function will return without performing any
18244            other operation.
18245          </para>
18246          <para>
18247            If the adjusted mode is identical to the current mode but changes to
18248            the frame buffer need to be applied, the
18249            <function>drm_crtc_helper_set_config</function> function will call
18250            the CRTC <methodname>mode_set_base</methodname> helper operation. If
18251            the adjusted mode differs from the current mode, or if the
18252            <methodname>mode_set_base</methodname> helper operation is not
18253            provided, the helper function performs a full mode set sequence by
18254            calling the <methodname>prepare</methodname>,
18255            <methodname>mode_set</methodname> and
18256            <methodname>commit</methodname> CRTC and encoder helper operations,
18257            in that order.
18258          </para>
18259        </listitem>
18260        <listitem>
18261          <synopsis>void drm_helper_connector_dpms(struct drm_connector *connector, int mode);</synopsis>
18262          <para>
18263            The <function>drm_helper_connector_dpms</function> helper function
18264            is a connector <methodname>dpms</methodname> implementation that
18265            tracks power state of connectors. To use the function, drivers must
18266            provide <methodname>dpms</methodname> helper operations for CRTCs
18267            and encoders to apply the DPMS state to the device.
18268          </para>
18269          <para>
18270            The mid-layer doesn't track the power state of CRTCs and encoders.
18271            The <methodname>dpms</methodname> helper operations can thus be
18272            called with a mode identical to the currently active mode.
18273          </para>
18274        </listitem>
18275        <listitem>
18276          <synopsis>int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
18277                                            uint32_t maxX, uint32_t maxY);</synopsis>
18278          <para>
18279            The <function>drm_helper_probe_single_connector_modes</function> helper
18280            function is a connector <methodname>fill_modes</methodname>
18281            implementation that updates the connection status for the connector
18282            and then retrieves a list of modes by calling the connector
18283            <methodname>get_modes</methodname> helper operation.
18284          </para>
18285         <para>
18286            If the helper operation returns no mode, and if the connector status
18287            is connector_status_connected, standard VESA DMT modes up to
18288            1024x768 are automatically added to the modes list by a call to
18289            <function>drm_add_modes_noedid</function>.
18290          </para>
18291          <para>
18292            The function then filters out modes larger than
18293            <parameter>max_width</parameter> and <parameter>max_height</parameter>
18294            if specified. It finally calls the optional connector
18295            <methodname>mode_valid</methodname> helper operation for each mode in
18296            the probed list to check whether the mode is valid for the connector.
18297          </para>
18298        </listitem>
18299      </itemizedlist>
18300    </sect2>
18301    <sect2>
18302      <title>CRTC Helper Operations</title>
18303      <itemizedlist>
18304        <listitem id="drm-helper-crtc-mode-fixup">
18305          <synopsis>bool (*mode_fixup)(struct drm_crtc *crtc,
18306                       const struct drm_display_mode *mode,
18307                       struct drm_display_mode *adjusted_mode);</synopsis>
18308          <para>
18309            Let CRTCs adjust the requested mode or reject it completely. This
18310            operation returns true if the mode is accepted (possibly after being
18311            adjusted) or false if it is rejected.
18312          </para>
18313          <para>
18314            The <methodname>mode_fixup</methodname> operation should reject the
18315            mode if it can't reasonably use it. The definition of "reasonable"
18316            is currently fuzzy in this context. One possible behaviour would be
18317            to set the adjusted mode to the panel timings when a fixed-mode
18318            panel is used with hardware capable of scaling. Another behaviour
18319            would be to accept any input mode and adjust it to the closest mode
18320            supported by the hardware (FIXME: This needs to be clarified).
18321          </para>
18322        </listitem>
18323        <listitem>
18324          <synopsis>int (*mode_set_base)(struct drm_crtc *crtc, int x, int y,
18325                     struct drm_framebuffer *old_fb)</synopsis>
18326          <para>
18327            Move the CRTC on the current frame buffer (stored in
18328            <literal>crtc-&gt;fb</literal>) to position (x,y). Any of the frame
18329            buffer, x position or y position may have been modified.
18330          </para>
18331          <para>
18332            This helper operation is optional. If not provided, the
18333            <function>drm_crtc_helper_set_config</function> function will fall
18334            back to the <methodname>mode_set</methodname> helper operation.
18335          </para>
18336          <note><para>
18337            FIXME: Why are x and y passed as arguments, as they can be accessed
18338            through <literal>crtc-&gt;x</literal> and
18339            <literal>crtc-&gt;y</literal>?
18340          </para></note>
18341        </listitem>
18342        <listitem>
18343          <synopsis>void (*prepare)(struct drm_crtc *crtc);</synopsis>
18344          <para>
18345            Prepare the CRTC for mode setting. This operation is called after
18346            validating the requested mode. Drivers use it to perform
18347            device-specific operations required before setting the new mode.
18348          </para>
18349        </listitem>
18350        <listitem>
18351          <synopsis>int (*mode_set)(struct drm_crtc *crtc, struct drm_display_mode *mode,
18352                struct drm_display_mode *adjusted_mode, int x, int y,
18353                struct drm_framebuffer *old_fb);</synopsis>
18354          <para>
18355            Set a new mode, position and frame buffer. Depending on the device
18356            requirements, the mode can be stored internally by the driver and
18357            applied in the <methodname>commit</methodname> operation, or
18358            programmed to the hardware immediately.
18359          </para>
18360          <para>
18361            The <methodname>mode_set</methodname> operation returns 0 on success
18362	    or a negative error code if an error occurs.
18363          </para>
18364        </listitem>
18365        <listitem>
18366          <synopsis>void (*commit)(struct drm_crtc *crtc);</synopsis>
18367          <para>
18368            Commit a mode. This operation is called after setting the new mode.
18369            Upon return the device must use the new mode and be fully
18370            operational.
18371          </para>
18372        </listitem>
18373      </itemizedlist>
18374    </sect2>
18375    <sect2>
18376      <title>Encoder Helper Operations</title>
18377      <itemizedlist>
18378        <listitem>
18379          <synopsis>bool (*mode_fixup)(struct drm_encoder *encoder,
18380                       const struct drm_display_mode *mode,
18381                       struct drm_display_mode *adjusted_mode);</synopsis>
18382          <para>
18383            Let encoders adjust the requested mode or reject it completely. This
18384            operation returns true if the mode is accepted (possibly after being
18385            adjusted) or false if it is rejected. See the
18386            <link linkend="drm-helper-crtc-mode-fixup">mode_fixup CRTC helper
18387            operation</link> for an explanation of the allowed adjustments.
18388          </para>
18389        </listitem>
18390        <listitem>
18391          <synopsis>void (*prepare)(struct drm_encoder *encoder);</synopsis>
18392          <para>
18393            Prepare the encoder for mode setting. This operation is called after
18394            validating the requested mode. Drivers use it to perform
18395            device-specific operations required before setting the new mode.
18396          </para>
18397        </listitem>
18398        <listitem>
18399          <synopsis>void (*mode_set)(struct drm_encoder *encoder,
18400                 struct drm_display_mode *mode,
18401                 struct drm_display_mode *adjusted_mode);</synopsis>
18402          <para>
18403            Set a new mode. Depending on the device requirements, the mode can
18404            be stored internally by the driver and applied in the
18405            <methodname>commit</methodname> operation, or programmed to the
18406            hardware immediately.
18407          </para>
18408        </listitem>
18409        <listitem>
18410          <synopsis>void (*commit)(struct drm_encoder *encoder);</synopsis>
18411          <para>
18412            Commit a mode. This operation is called after setting the new mode.
18413            Upon return the device must use the new mode and be fully
18414            operational.
18415          </para>
18416        </listitem>
18417      </itemizedlist>
18418    </sect2>
18419    <sect2>
18420      <title>Connector Helper Operations</title>
18421      <itemizedlist>
18422        <listitem>
18423          <synopsis>struct drm_encoder *(*best_encoder)(struct drm_connector *connector);</synopsis>
18424          <para>
18425            Return a pointer to the best encoder for the connecter. Device that
18426            map connectors to encoders 1:1 simply return the pointer to the
18427            associated encoder. This operation is mandatory.
18428          </para>
18429        </listitem>
18430        <listitem>
18431          <synopsis>int (*get_modes)(struct drm_connector *connector);</synopsis>
18432          <para>
18433            Fill the connector's <structfield>probed_modes</structfield> list
18434            by parsing EDID data with <function>drm_add_edid_modes</function>,
18435            adding standard VESA DMT modes with <function>drm_add_modes_noedid</function>,
18436            or calling <function>drm_mode_probed_add</function> directly for every
18437            supported mode and return the number of modes it has detected. This
18438            operation is mandatory.
18439          </para>
18440          <para>
18441            Note that the caller function will automatically add standard VESA
18442            DMT modes up to 1024x768 if the <methodname>get_modes</methodname>
18443            helper operation returns no mode and if the connector status is
18444            connector_status_connected. There is no need to call
18445            <function>drm_add_edid_modes</function> manually in that case.
18446          </para>
18447          <para>
18448            When adding modes manually the driver creates each mode with a call to
18449            <function>drm_mode_create</function> and must fill the following fields.
18450            <itemizedlist>
18451              <listitem>
18452                <synopsis>__u32 type;</synopsis>
18453                <para>
18454                  Mode type bitmask, a combination of
18455                  <variablelist>
18456                    <varlistentry>
18457                      <term>DRM_MODE_TYPE_BUILTIN</term>
18458                      <listitem><para>not used?</para></listitem>
18459                    </varlistentry>
18460                    <varlistentry>
18461                      <term>DRM_MODE_TYPE_CLOCK_C</term>
18462                      <listitem><para>not used?</para></listitem>
18463                    </varlistentry>
18464                    <varlistentry>
18465                      <term>DRM_MODE_TYPE_CRTC_C</term>
18466                      <listitem><para>not used?</para></listitem>
18467                    </varlistentry>
18468                    <varlistentry>
18469                      <term>
18470        DRM_MODE_TYPE_PREFERRED - The preferred mode for the connector
18471                      </term>
18472                      <listitem>
18473                        <para>not used?</para>
18474                      </listitem>
18475                    </varlistentry>
18476                    <varlistentry>
18477                      <term>DRM_MODE_TYPE_DEFAULT</term>
18478                      <listitem><para>not used?</para></listitem>
18479                    </varlistentry>
18480                    <varlistentry>
18481                      <term>DRM_MODE_TYPE_USERDEF</term>
18482                      <listitem><para>not used?</para></listitem>
18483                    </varlistentry>
18484                    <varlistentry>
18485                      <term>DRM_MODE_TYPE_DRIVER</term>
18486                      <listitem>
18487                        <para>
18488                          The mode has been created by the driver (as opposed to
18489                          to user-created modes).
18490                        </para>
18491                      </listitem>
18492                    </varlistentry>
18493                  </variablelist>
18494                  Drivers must set the DRM_MODE_TYPE_DRIVER bit for all modes they
18495                  create, and set the DRM_MODE_TYPE_PREFERRED bit for the preferred
18496                  mode.
18497                </para>
18498              </listitem>
18499              <listitem>
18500                <synopsis>__u32 clock;</synopsis>
18501                <para>Pixel clock frequency in kHz unit</para>
18502              </listitem>
18503              <listitem>
18504                <synopsis>__u16 hdisplay, hsync_start, hsync_end, htotal;
18505    __u16 vdisplay, vsync_start, vsync_end, vtotal;</synopsis>
18506                <para>Horizontal and vertical timing information</para>
18507                <screen><![CDATA[
18508             Active                 Front           Sync           Back
18509             Region                 Porch                          Porch
18510    <-----------------------><----------------><-------------><-------------->
18511
18512      //////////////////////|
18513     ////////////////////// |
18514    //////////////////////  |..................               ................
18515                                               _______________
18516
18517    <----- [hv]display ----->
18518    <------------- [hv]sync_start ------------>
18519    <--------------------- [hv]sync_end --------------------->
18520    <-------------------------------- [hv]total ----------------------------->
18521]]></screen>
18522              </listitem>
18523              <listitem>
18524                <synopsis>__u16 hskew;
18525    __u16 vscan;</synopsis>
18526                <para>Unknown</para>
18527              </listitem>
18528              <listitem>
18529                <synopsis>__u32 flags;</synopsis>
18530                <para>
18531                  Mode flags, a combination of
18532                  <variablelist>
18533                    <varlistentry>
18534                      <term>DRM_MODE_FLAG_PHSYNC</term>
18535                      <listitem><para>
18536                        Horizontal sync is active high
18537                      </para></listitem>
18538                    </varlistentry>
18539                    <varlistentry>
18540                      <term>DRM_MODE_FLAG_NHSYNC</term>
18541                      <listitem><para>
18542                        Horizontal sync is active low
18543                      </para></listitem>
18544                    </varlistentry>
18545                    <varlistentry>
18546                      <term>DRM_MODE_FLAG_PVSYNC</term>
18547                      <listitem><para>
18548                        Vertical sync is active high
18549                      </para></listitem>
18550                    </varlistentry>
18551                    <varlistentry>
18552                      <term>DRM_MODE_FLAG_NVSYNC</term>
18553                      <listitem><para>
18554                        Vertical sync is active low
18555                      </para></listitem>
18556                    </varlistentry>
18557                    <varlistentry>
18558                      <term>DRM_MODE_FLAG_INTERLACE</term>
18559                      <listitem><para>
18560                        Mode is interlaced
18561                      </para></listitem>
18562                    </varlistentry>
18563                    <varlistentry>
18564                      <term>DRM_MODE_FLAG_DBLSCAN</term>
18565                      <listitem><para>
18566                        Mode uses doublescan
18567                      </para></listitem>
18568                    </varlistentry>
18569                    <varlistentry>
18570                      <term>DRM_MODE_FLAG_CSYNC</term>
18571                      <listitem><para>
18572                        Mode uses composite sync
18573                      </para></listitem>
18574                    </varlistentry>
18575                    <varlistentry>
18576                      <term>DRM_MODE_FLAG_PCSYNC</term>
18577                      <listitem><para>
18578                        Composite sync is active high
18579                      </para></listitem>
18580                    </varlistentry>
18581                    <varlistentry>
18582                      <term>DRM_MODE_FLAG_NCSYNC</term>
18583                      <listitem><para>
18584                        Composite sync is active low
18585                      </para></listitem>
18586                    </varlistentry>
18587                    <varlistentry>
18588                      <term>DRM_MODE_FLAG_HSKEW</term>
18589                      <listitem><para>
18590                        hskew provided (not used?)
18591                      </para></listitem>
18592                    </varlistentry>
18593                    <varlistentry>
18594                      <term>DRM_MODE_FLAG_BCAST</term>
18595                      <listitem><para>
18596                        not used?
18597                      </para></listitem>
18598                    </varlistentry>
18599                    <varlistentry>
18600                      <term>DRM_MODE_FLAG_PIXMUX</term>
18601                      <listitem><para>
18602                        not used?
18603                      </para></listitem>
18604                    </varlistentry>
18605                    <varlistentry>
18606                      <term>DRM_MODE_FLAG_DBLCLK</term>
18607                      <listitem><para>
18608                        not used?
18609                      </para></listitem>
18610                    </varlistentry>
18611                    <varlistentry>
18612                      <term>DRM_MODE_FLAG_CLKDIV2</term>
18613                      <listitem><para>
18614                        ?
18615                      </para></listitem>
18616                    </varlistentry>
18617                  </variablelist>
18618                </para>
18619                <para>
18620                  Note that modes marked with the INTERLACE or DBLSCAN flags will be
18621                  filtered out by
18622                  <function>drm_helper_probe_single_connector_modes</function> if
18623                  the connector's <structfield>interlace_allowed</structfield> or
18624                  <structfield>doublescan_allowed</structfield> field is set to 0.
18625                </para>
18626              </listitem>
18627              <listitem>
18628                <synopsis>char name[DRM_DISPLAY_MODE_LEN];</synopsis>
18629                <para>
18630                  Mode name. The driver must call
18631                  <function>drm_mode_set_name</function> to fill the mode name from
18632                  <structfield>hdisplay</structfield>,
18633                  <structfield>vdisplay</structfield> and interlace flag after
18634                  filling the corresponding fields.
18635                </para>
18636              </listitem>
18637            </itemizedlist>
18638          </para>
18639          <para>
18640            The <structfield>vrefresh</structfield> value is computed by
18641            <function>drm_helper_probe_single_connector_modes</function>.
18642          </para>
18643          <para>
18644            When parsing EDID data, <function>drm_add_edid_modes</function> fills the
18645            connector <structfield>display_info</structfield>
18646            <structfield>width_mm</structfield> and
18647            <structfield>height_mm</structfield> fields. When creating modes
18648            manually the <methodname>get_modes</methodname> helper operation must
18649            set the <structfield>display_info</structfield>
18650            <structfield>width_mm</structfield> and
18651            <structfield>height_mm</structfield> fields if they haven't been set
18652            already (for instance at initialization time when a fixed-size panel is
18653            attached to the connector). The mode <structfield>width_mm</structfield>
18654            and <structfield>height_mm</structfield> fields are only used internally
18655            during EDID parsing and should not be set when creating modes manually.
18656          </para>
18657        </listitem>
18658        <listitem>
18659          <synopsis>int (*mode_valid)(struct drm_connector *connector,
18660		  struct drm_display_mode *mode);</synopsis>
18661          <para>
18662            Verify whether a mode is valid for the connector. Return MODE_OK for
18663            supported modes and one of the enum drm_mode_status values (MODE_*)
18664            for unsupported modes. This operation is optional.
18665          </para>
18666          <para>
18667            As the mode rejection reason is currently not used beside for
18668            immediately removing the unsupported mode, an implementation can
18669            return MODE_BAD regardless of the exact reason why the mode is not
18670            valid.
18671          </para>
18672          <note><para>
18673            Note that the <methodname>mode_valid</methodname> helper operation is
18674            only called for modes detected by the device, and
18675            <emphasis>not</emphasis> for modes set by the user through the CRTC
18676            <methodname>set_config</methodname> operation.
18677          </para></note>
18678        </listitem>
18679      </itemizedlist>
18680    </sect2>
18681    <sect2>
18682      <title>Atomic Modeset Helper Functions Reference</title>
18683      <sect3>
18684	<title>Overview</title>
18685<para>
18686   </para><para>
18687   This helper library provides implementations of check and commit functions on
18688   top of the CRTC modeset helper callbacks and the plane helper callbacks. It
18689   also provides convenience implementations for the atomic state handling
18690   callbacks for drivers which don't need to subclass the drm core structures to
18691   add their own additional internal state.
18692   </para><para>
18693   This library also provides default implementations for the check callback in
18694   <function>drm_atomic_helper_check</function> and for the commit callback with
18695   <function>drm_atomic_helper_commit</function>. But the individual stages and callbacks are
18696   exposed to allow drivers to mix and match and e.g. use the plane helpers only
18697   together with a driver private modeset implementation.
18698   </para><para>
18699   This library also provides implementations for all the legacy driver
18700   interfaces on top of the atomic interface. See <function>drm_atomic_helper_set_config</function>,
18701   <function>drm_atomic_helper_disable_plane</function>, <function>drm_atomic_helper_disable_plane</function> and the
18702   various functions to implement set_property callbacks. New drivers must not
18703   implement these functions themselves but must use the provided helpers.
18704</para>
18705
18706      </sect3>
18707      <sect3>
18708	<title>Implementing Asynchronous Atomic Commit</title>
18709<para>
18710   </para><para>
18711   For now the atomic helpers don't support async commit directly. If there is
18712   real need it could be added though, using the dma-buf fence infrastructure
18713   for generic synchronization with outstanding rendering.
18714   </para><para>
18715   For now drivers have to implement async commit themselves, with the following
18716   sequence being the recommended one:
18717   </para><para>
18718   1. Run <function>drm_atomic_helper_prepare_planes</function> first. This is the only function
18719   which commit needs to call which can fail, so we want to run it first and
18720   synchronously.
18721   </para><para>
18722   2. Synchronize with any outstanding asynchronous commit worker threads which
18723   might be affected the new state update. This can be done by either cancelling
18724   or flushing the work items, depending upon whether the driver can deal with
18725   cancelled updates. Note that it is important to ensure that the framebuffer
18726   cleanup is still done when cancelling.
18727   </para><para>
18728   For sufficient parallelism it is recommended to have a work item per crtc
18729   (for updates which don't touch global state) and a global one. Then we only
18730   need to synchronize with the crtc work items for changed crtcs and the global
18731   work item, which allows nice concurrent updates on disjoint sets of crtcs.
18732   </para><para>
18733   3. The software state is updated synchronously with
18734   <function>drm_atomic_helper_swap_state</function>. Doing this under the protection of all modeset
18735   locks means concurrent callers never see inconsistent state. And doing this
18736   while it's guaranteed that no relevant async worker runs means that async
18737   workers do not need grab any locks. Actually they must not grab locks, for
18738   otherwise the work flushing will deadlock.
18739   </para><para>
18740   4. Schedule a work item to do all subsequent steps, using the split-out
18741   commit helpers: a) pre-plane commit b) plane commit c) post-plane commit and
18742   then cleaning up the framebuffers after the old framebuffer is no longer
18743   being displayed.
18744</para>
18745
18746      </sect3>
18747      <sect3>
18748	<title>Atomic State Reset and Initialization</title>
18749<para>
18750   </para><para>
18751   Both the drm core and the atomic helpers assume that there is always the full
18752   and correct atomic software state for all connectors, CRTCs and planes
18753   available. Which is a bit a problem on driver load and also after system
18754   suspend. One way to solve this is to have a hardware state read-out
18755   infrastructure which reconstructs the full software state (e.g. the i915
18756   driver).
18757   </para><para>
18758   The simpler solution is to just reset the software state to everything off,
18759   which is easiest to do by calling <function>drm_mode_config_reset</function>. To facilitate this
18760   the atomic helpers provide default reset implementations for all hooks.
18761</para>
18762
18763      </sect3>
18764<!-- include/drm/drm_atomic_helper.h -->
18765<refentry id="API-drm-atomic-crtc-for-each-plane">
18766<refentryinfo>
18767 <title>LINUX</title>
18768 <productname>Kernel Hackers Manual</productname>
18769 <date>July 2017</date>
18770</refentryinfo>
18771<refmeta>
18772 <refentrytitle><phrase>drm_atomic_crtc_for_each_plane</phrase></refentrytitle>
18773 <manvolnum>9</manvolnum>
18774 <refmiscinfo class="version">4.4.14</refmiscinfo>
18775</refmeta>
18776<refnamediv>
18777 <refname>drm_atomic_crtc_for_each_plane</refname>
18778 <refpurpose>
18779  iterate over planes currently attached to CRTC
18780 </refpurpose>
18781</refnamediv>
18782<refsynopsisdiv>
18783 <title>Synopsis</title>
18784  <funcsynopsis><funcprototype>
18785   <funcdef> <function>drm_atomic_crtc_for_each_plane </function></funcdef>
18786   <paramdef> <parameter>plane</parameter></paramdef>
18787   <paramdef> <parameter>crtc</parameter></paramdef>
18788  </funcprototype></funcsynopsis>
18789</refsynopsisdiv>
18790<refsect1>
18791 <title>Arguments</title>
18792 <variablelist>
18793  <varlistentry>
18794   <term><parameter>plane</parameter></term>
18795   <listitem>
18796    <para>
18797     the loop cursor
18798    </para>
18799   </listitem>
18800  </varlistentry>
18801  <varlistentry>
18802   <term><parameter>crtc</parameter></term>
18803   <listitem>
18804    <para>
18805     the crtc whose planes are iterated
18806    </para>
18807   </listitem>
18808  </varlistentry>
18809 </variablelist>
18810</refsect1>
18811<refsect1>
18812<title>Description</title>
18813<para>
18814   This iterates over the current state, useful (for example) when applying
18815   atomic state after it has been checked and swapped.  To iterate over the
18816   planes which *will* be attached (for -&gt;<function>atomic_check</function>) see
18817   <function>drm_crtc_for_each_pending_plane</function>
18818</para>
18819</refsect1>
18820</refentry>
18821
18822<refentry id="API-drm-atomic-crtc-state-for-each-plane">
18823<refentryinfo>
18824 <title>LINUX</title>
18825 <productname>Kernel Hackers Manual</productname>
18826 <date>July 2017</date>
18827</refentryinfo>
18828<refmeta>
18829 <refentrytitle><phrase>drm_atomic_crtc_state_for_each_plane</phrase></refentrytitle>
18830 <manvolnum>9</manvolnum>
18831 <refmiscinfo class="version">4.4.14</refmiscinfo>
18832</refmeta>
18833<refnamediv>
18834 <refname>drm_atomic_crtc_state_for_each_plane</refname>
18835 <refpurpose>
18836     iterate over attached planes in new state
18837 </refpurpose>
18838</refnamediv>
18839<refsynopsisdiv>
18840 <title>Synopsis</title>
18841  <funcsynopsis><funcprototype>
18842   <funcdef> <function>drm_atomic_crtc_state_for_each_plane </function></funcdef>
18843   <paramdef> <parameter>plane</parameter></paramdef>
18844   <paramdef> <parameter>crtc_state</parameter></paramdef>
18845  </funcprototype></funcsynopsis>
18846</refsynopsisdiv>
18847<refsect1>
18848 <title>Arguments</title>
18849 <variablelist>
18850  <varlistentry>
18851   <term><parameter>plane</parameter></term>
18852   <listitem>
18853    <para>
18854     the loop cursor
18855    </para>
18856   </listitem>
18857  </varlistentry>
18858  <varlistentry>
18859   <term><parameter>crtc_state</parameter></term>
18860   <listitem>
18861    <para>
18862     the incoming crtc-state
18863    </para>
18864   </listitem>
18865  </varlistentry>
18866 </variablelist>
18867</refsect1>
18868<refsect1>
18869<title>Description</title>
18870<para>
18871   Similar to <function>drm_crtc_for_each_plane</function>, but iterates the planes that will be
18872   attached if the specified state is applied.  Useful during (for example)
18873   -&gt;<function>atomic_check</function> operations, to validate the incoming state
18874</para>
18875</refsect1>
18876</refentry>
18877
18878<!-- drivers/gpu/drm/drm_atomic_helper.c -->
18879<refentry id="API-drm-atomic-helper-check-modeset">
18880<refentryinfo>
18881 <title>LINUX</title>
18882 <productname>Kernel Hackers Manual</productname>
18883 <date>July 2017</date>
18884</refentryinfo>
18885<refmeta>
18886 <refentrytitle><phrase>drm_atomic_helper_check_modeset</phrase></refentrytitle>
18887 <manvolnum>9</manvolnum>
18888 <refmiscinfo class="version">4.4.14</refmiscinfo>
18889</refmeta>
18890<refnamediv>
18891 <refname>drm_atomic_helper_check_modeset</refname>
18892 <refpurpose>
18893  validate state object for modeset changes
18894 </refpurpose>
18895</refnamediv>
18896<refsynopsisdiv>
18897 <title>Synopsis</title>
18898  <funcsynopsis><funcprototype>
18899   <funcdef>int <function>drm_atomic_helper_check_modeset </function></funcdef>
18900   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
18901   <paramdef>struct drm_atomic_state * <parameter>state</parameter></paramdef>
18902  </funcprototype></funcsynopsis>
18903</refsynopsisdiv>
18904<refsect1>
18905 <title>Arguments</title>
18906 <variablelist>
18907  <varlistentry>
18908   <term><parameter>dev</parameter></term>
18909   <listitem>
18910    <para>
18911     DRM device
18912    </para>
18913   </listitem>
18914  </varlistentry>
18915  <varlistentry>
18916   <term><parameter>state</parameter></term>
18917   <listitem>
18918    <para>
18919     the driver state object
18920    </para>
18921   </listitem>
18922  </varlistentry>
18923 </variablelist>
18924</refsect1>
18925<refsect1>
18926<title>Description</title>
18927<para>
18928   Check the state object to see if the requested state is physically possible.
18929   This does all the crtc and connector related computations for an atomic
18930   update and adds any additional connectors needed for full modesets and calls
18931   down into -&gt;mode_fixup functions of the driver backend.
18932   </para><para>
18933
18934   crtc_state-&gt;mode_changed is set when the input mode is changed.
18935   crtc_state-&gt;connectors_changed is set when a connector is added or
18936   removed from the crtc.
18937   crtc_state-&gt;active_changed is set when crtc_state-&gt;active changes,
18938   which is used for dpms.
18939</para>
18940</refsect1>
18941<refsect1>
18942<title>IMPORTANT</title>
18943<para>
18944   </para><para>
18945
18946   Drivers which update -&gt;mode_changed (e.g. in their -&gt;atomic_check hooks if a
18947   plane update can't be done without a full modeset) _must_ call this function
18948   afterwards after that change. It is permitted to call this function multiple
18949   times for the same update, e.g. when the -&gt;atomic_check functions depend upon
18950   the adjusted dotclock for fifo space allocation and watermark computation.
18951   </para><para>
18952
18953   RETURNS
18954   Zero for success or -errno
18955</para>
18956</refsect1>
18957</refentry>
18958
18959<refentry id="API-drm-atomic-helper-check-planes">
18960<refentryinfo>
18961 <title>LINUX</title>
18962 <productname>Kernel Hackers Manual</productname>
18963 <date>July 2017</date>
18964</refentryinfo>
18965<refmeta>
18966 <refentrytitle><phrase>drm_atomic_helper_check_planes</phrase></refentrytitle>
18967 <manvolnum>9</manvolnum>
18968 <refmiscinfo class="version">4.4.14</refmiscinfo>
18969</refmeta>
18970<refnamediv>
18971 <refname>drm_atomic_helper_check_planes</refname>
18972 <refpurpose>
18973     validate state object for planes changes
18974 </refpurpose>
18975</refnamediv>
18976<refsynopsisdiv>
18977 <title>Synopsis</title>
18978  <funcsynopsis><funcprototype>
18979   <funcdef>int <function>drm_atomic_helper_check_planes </function></funcdef>
18980   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
18981   <paramdef>struct drm_atomic_state * <parameter>state</parameter></paramdef>
18982  </funcprototype></funcsynopsis>
18983</refsynopsisdiv>
18984<refsect1>
18985 <title>Arguments</title>
18986 <variablelist>
18987  <varlistentry>
18988   <term><parameter>dev</parameter></term>
18989   <listitem>
18990    <para>
18991     DRM device
18992    </para>
18993   </listitem>
18994  </varlistentry>
18995  <varlistentry>
18996   <term><parameter>state</parameter></term>
18997   <listitem>
18998    <para>
18999     the driver state object
19000    </para>
19001   </listitem>
19002  </varlistentry>
19003 </variablelist>
19004</refsect1>
19005<refsect1>
19006<title>Description</title>
19007<para>
19008   Check the state object to see if the requested state is physically possible.
19009   This does all the plane update related checks using by calling into the
19010   -&gt;atomic_check hooks provided by the driver.
19011   </para><para>
19012
19013   It also sets crtc_state-&gt;planes_changed to indicate that a crtc has
19014   updated planes.
19015   </para><para>
19016
19017   RETURNS
19018   Zero for success or -errno
19019</para>
19020</refsect1>
19021</refentry>
19022
19023<refentry id="API-drm-atomic-helper-check">
19024<refentryinfo>
19025 <title>LINUX</title>
19026 <productname>Kernel Hackers Manual</productname>
19027 <date>July 2017</date>
19028</refentryinfo>
19029<refmeta>
19030 <refentrytitle><phrase>drm_atomic_helper_check</phrase></refentrytitle>
19031 <manvolnum>9</manvolnum>
19032 <refmiscinfo class="version">4.4.14</refmiscinfo>
19033</refmeta>
19034<refnamediv>
19035 <refname>drm_atomic_helper_check</refname>
19036 <refpurpose>
19037     validate state object
19038 </refpurpose>
19039</refnamediv>
19040<refsynopsisdiv>
19041 <title>Synopsis</title>
19042  <funcsynopsis><funcprototype>
19043   <funcdef>int <function>drm_atomic_helper_check </function></funcdef>
19044   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
19045   <paramdef>struct drm_atomic_state * <parameter>state</parameter></paramdef>
19046  </funcprototype></funcsynopsis>
19047</refsynopsisdiv>
19048<refsect1>
19049 <title>Arguments</title>
19050 <variablelist>
19051  <varlistentry>
19052   <term><parameter>dev</parameter></term>
19053   <listitem>
19054    <para>
19055     DRM device
19056    </para>
19057   </listitem>
19058  </varlistentry>
19059  <varlistentry>
19060   <term><parameter>state</parameter></term>
19061   <listitem>
19062    <para>
19063     the driver state object
19064    </para>
19065   </listitem>
19066  </varlistentry>
19067 </variablelist>
19068</refsect1>
19069<refsect1>
19070<title>Description</title>
19071<para>
19072   Check the state object to see if the requested state is physically possible.
19073   Only crtcs and planes have check callbacks, so for any additional (global)
19074   checking that a driver needs it can simply wrap that around this function.
19075   Drivers without such needs can directly use this as their -&gt;<function>atomic_check</function>
19076   callback.
19077   </para><para>
19078
19079   This just wraps the two parts of the state checking for planes and modeset
19080</para>
19081</refsect1>
19082<refsect1>
19083<title>state in the default order</title>
19084<para>
19085   First it calls <function>drm_atomic_helper_check_modeset</function>
19086   and then <function>drm_atomic_helper_check_planes</function>. The assumption is that the
19087   -&gt;atomic_check functions depend upon an updated adjusted_mode.clock to
19088   e.g. properly compute watermarks.
19089   </para><para>
19090
19091   RETURNS
19092   Zero for success or -errno
19093</para>
19094</refsect1>
19095</refentry>
19096
19097<refentry id="API-drm-atomic-helper-update-legacy-modeset-state">
19098<refentryinfo>
19099 <title>LINUX</title>
19100 <productname>Kernel Hackers Manual</productname>
19101 <date>July 2017</date>
19102</refentryinfo>
19103<refmeta>
19104 <refentrytitle><phrase>drm_atomic_helper_update_legacy_modeset_state</phrase></refentrytitle>
19105 <manvolnum>9</manvolnum>
19106 <refmiscinfo class="version">4.4.14</refmiscinfo>
19107</refmeta>
19108<refnamediv>
19109 <refname>drm_atomic_helper_update_legacy_modeset_state</refname>
19110 <refpurpose>
19111     update legacy modeset state
19112 </refpurpose>
19113</refnamediv>
19114<refsynopsisdiv>
19115 <title>Synopsis</title>
19116  <funcsynopsis><funcprototype>
19117   <funcdef>void <function>drm_atomic_helper_update_legacy_modeset_state </function></funcdef>
19118   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
19119   <paramdef>struct drm_atomic_state * <parameter>old_state</parameter></paramdef>
19120  </funcprototype></funcsynopsis>
19121</refsynopsisdiv>
19122<refsect1>
19123 <title>Arguments</title>
19124 <variablelist>
19125  <varlistentry>
19126   <term><parameter>dev</parameter></term>
19127   <listitem>
19128    <para>
19129     DRM device
19130    </para>
19131   </listitem>
19132  </varlistentry>
19133  <varlistentry>
19134   <term><parameter>old_state</parameter></term>
19135   <listitem>
19136    <para>
19137     atomic state object with old state structures
19138    </para>
19139   </listitem>
19140  </varlistentry>
19141 </variablelist>
19142</refsect1>
19143<refsect1>
19144<title>Description</title>
19145<para>
19146   This function updates all the various legacy modeset state pointers in
19147   connectors, encoders and crtcs. It also updates the timestamping constants
19148   used for precise vblank timestamps by calling
19149   <function>drm_calc_timestamping_constants</function>.
19150   </para><para>
19151
19152   Drivers can use this for building their own atomic commit if they don't have
19153   a pure helper-based modeset implementation.
19154</para>
19155</refsect1>
19156</refentry>
19157
19158<refentry id="API-drm-atomic-helper-commit-modeset-disables">
19159<refentryinfo>
19160 <title>LINUX</title>
19161 <productname>Kernel Hackers Manual</productname>
19162 <date>July 2017</date>
19163</refentryinfo>
19164<refmeta>
19165 <refentrytitle><phrase>drm_atomic_helper_commit_modeset_disables</phrase></refentrytitle>
19166 <manvolnum>9</manvolnum>
19167 <refmiscinfo class="version">4.4.14</refmiscinfo>
19168</refmeta>
19169<refnamediv>
19170 <refname>drm_atomic_helper_commit_modeset_disables</refname>
19171 <refpurpose>
19172     modeset commit to disable outputs
19173 </refpurpose>
19174</refnamediv>
19175<refsynopsisdiv>
19176 <title>Synopsis</title>
19177  <funcsynopsis><funcprototype>
19178   <funcdef>void <function>drm_atomic_helper_commit_modeset_disables </function></funcdef>
19179   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
19180   <paramdef>struct drm_atomic_state * <parameter>old_state</parameter></paramdef>
19181  </funcprototype></funcsynopsis>
19182</refsynopsisdiv>
19183<refsect1>
19184 <title>Arguments</title>
19185 <variablelist>
19186  <varlistentry>
19187   <term><parameter>dev</parameter></term>
19188   <listitem>
19189    <para>
19190     DRM device
19191    </para>
19192   </listitem>
19193  </varlistentry>
19194  <varlistentry>
19195   <term><parameter>old_state</parameter></term>
19196   <listitem>
19197    <para>
19198     atomic state object with old state structures
19199    </para>
19200   </listitem>
19201  </varlistentry>
19202 </variablelist>
19203</refsect1>
19204<refsect1>
19205<title>Description</title>
19206<para>
19207   This function shuts down all the outputs that need to be shut down and
19208   prepares them (if required) with the new mode.
19209   </para><para>
19210
19211   For compatibility with legacy crtc helpers this should be called before
19212   <function>drm_atomic_helper_commit_planes</function>, which is what the default commit function
19213   does. But drivers with different needs can group the modeset commits together
19214   and do the plane commits at the end. This is useful for drivers doing runtime
19215   PM since planes updates then only happen when the CRTC is actually enabled.
19216</para>
19217</refsect1>
19218</refentry>
19219
19220<refentry id="API-drm-atomic-helper-commit-modeset-enables">
19221<refentryinfo>
19222 <title>LINUX</title>
19223 <productname>Kernel Hackers Manual</productname>
19224 <date>July 2017</date>
19225</refentryinfo>
19226<refmeta>
19227 <refentrytitle><phrase>drm_atomic_helper_commit_modeset_enables</phrase></refentrytitle>
19228 <manvolnum>9</manvolnum>
19229 <refmiscinfo class="version">4.4.14</refmiscinfo>
19230</refmeta>
19231<refnamediv>
19232 <refname>drm_atomic_helper_commit_modeset_enables</refname>
19233 <refpurpose>
19234     modeset commit to enable outputs
19235 </refpurpose>
19236</refnamediv>
19237<refsynopsisdiv>
19238 <title>Synopsis</title>
19239  <funcsynopsis><funcprototype>
19240   <funcdef>void <function>drm_atomic_helper_commit_modeset_enables </function></funcdef>
19241   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
19242   <paramdef>struct drm_atomic_state * <parameter>old_state</parameter></paramdef>
19243  </funcprototype></funcsynopsis>
19244</refsynopsisdiv>
19245<refsect1>
19246 <title>Arguments</title>
19247 <variablelist>
19248  <varlistentry>
19249   <term><parameter>dev</parameter></term>
19250   <listitem>
19251    <para>
19252     DRM device
19253    </para>
19254   </listitem>
19255  </varlistentry>
19256  <varlistentry>
19257   <term><parameter>old_state</parameter></term>
19258   <listitem>
19259    <para>
19260     atomic state object with old state structures
19261    </para>
19262   </listitem>
19263  </varlistentry>
19264 </variablelist>
19265</refsect1>
19266<refsect1>
19267<title>Description</title>
19268<para>
19269   This function enables all the outputs with the new configuration which had to
19270   be turned off for the update.
19271   </para><para>
19272
19273   For compatibility with legacy crtc helpers this should be called after
19274   <function>drm_atomic_helper_commit_planes</function>, which is what the default commit function
19275   does. But drivers with different needs can group the modeset commits together
19276   and do the plane commits at the end. This is useful for drivers doing runtime
19277   PM since planes updates then only happen when the CRTC is actually enabled.
19278</para>
19279</refsect1>
19280</refentry>
19281
19282<refentry id="API-drm-atomic-helper-wait-for-vblanks">
19283<refentryinfo>
19284 <title>LINUX</title>
19285 <productname>Kernel Hackers Manual</productname>
19286 <date>July 2017</date>
19287</refentryinfo>
19288<refmeta>
19289 <refentrytitle><phrase>drm_atomic_helper_wait_for_vblanks</phrase></refentrytitle>
19290 <manvolnum>9</manvolnum>
19291 <refmiscinfo class="version">4.4.14</refmiscinfo>
19292</refmeta>
19293<refnamediv>
19294 <refname>drm_atomic_helper_wait_for_vblanks</refname>
19295 <refpurpose>
19296     wait for vblank on crtcs
19297 </refpurpose>
19298</refnamediv>
19299<refsynopsisdiv>
19300 <title>Synopsis</title>
19301  <funcsynopsis><funcprototype>
19302   <funcdef>void <function>drm_atomic_helper_wait_for_vblanks </function></funcdef>
19303   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
19304   <paramdef>struct drm_atomic_state * <parameter>old_state</parameter></paramdef>
19305  </funcprototype></funcsynopsis>
19306</refsynopsisdiv>
19307<refsect1>
19308 <title>Arguments</title>
19309 <variablelist>
19310  <varlistentry>
19311   <term><parameter>dev</parameter></term>
19312   <listitem>
19313    <para>
19314     DRM device
19315    </para>
19316   </listitem>
19317  </varlistentry>
19318  <varlistentry>
19319   <term><parameter>old_state</parameter></term>
19320   <listitem>
19321    <para>
19322     atomic state object with old state structures
19323    </para>
19324   </listitem>
19325  </varlistentry>
19326 </variablelist>
19327</refsect1>
19328<refsect1>
19329<title>Description</title>
19330<para>
19331   Helper to, after atomic commit, wait for vblanks on all effected
19332   crtcs (ie. before cleaning up old framebuffers using
19333   <function>drm_atomic_helper_cleanup_planes</function>). It will only wait on crtcs where the
19334   framebuffers have actually changed to optimize for the legacy cursor and
19335   plane update use-case.
19336</para>
19337</refsect1>
19338</refentry>
19339
19340<refentry id="API-drm-atomic-helper-commit">
19341<refentryinfo>
19342 <title>LINUX</title>
19343 <productname>Kernel Hackers Manual</productname>
19344 <date>July 2017</date>
19345</refentryinfo>
19346<refmeta>
19347 <refentrytitle><phrase>drm_atomic_helper_commit</phrase></refentrytitle>
19348 <manvolnum>9</manvolnum>
19349 <refmiscinfo class="version">4.4.14</refmiscinfo>
19350</refmeta>
19351<refnamediv>
19352 <refname>drm_atomic_helper_commit</refname>
19353 <refpurpose>
19354     commit validated state object
19355 </refpurpose>
19356</refnamediv>
19357<refsynopsisdiv>
19358 <title>Synopsis</title>
19359  <funcsynopsis><funcprototype>
19360   <funcdef>int <function>drm_atomic_helper_commit </function></funcdef>
19361   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
19362   <paramdef>struct drm_atomic_state * <parameter>state</parameter></paramdef>
19363   <paramdef>bool <parameter>async</parameter></paramdef>
19364  </funcprototype></funcsynopsis>
19365</refsynopsisdiv>
19366<refsect1>
19367 <title>Arguments</title>
19368 <variablelist>
19369  <varlistentry>
19370   <term><parameter>dev</parameter></term>
19371   <listitem>
19372    <para>
19373     DRM device
19374    </para>
19375   </listitem>
19376  </varlistentry>
19377  <varlistentry>
19378   <term><parameter>state</parameter></term>
19379   <listitem>
19380    <para>
19381     the driver state object
19382    </para>
19383   </listitem>
19384  </varlistentry>
19385  <varlistentry>
19386   <term><parameter>async</parameter></term>
19387   <listitem>
19388    <para>
19389     asynchronous commit
19390    </para>
19391   </listitem>
19392  </varlistentry>
19393 </variablelist>
19394</refsect1>
19395<refsect1>
19396<title>Description</title>
19397<para>
19398   This function commits a with <function>drm_atomic_helper_check</function> pre-validated state
19399   object. This can still fail when e.g. the framebuffer reservation fails. For
19400   now this doesn't implement asynchronous commits.
19401   </para><para>
19402
19403   Note that right now this function does not support async commits, and hence
19404   driver writers must implement their own version for now. Also note that the
19405   default ordering of how the various stages are called is to match the legacy
19406   modeset helper library closest. One peculiarity of that is that it doesn't
19407   mesh well with runtime PM at all.
19408   </para><para>
19409
19410   For drivers supporting runtime PM the recommended sequence is
19411   </para><para>
19412
19413   drm_atomic_helper_commit_modeset_disables(dev, state);
19414   </para><para>
19415
19416   drm_atomic_helper_commit_modeset_enables(dev, state);
19417   </para><para>
19418
19419   drm_atomic_helper_commit_planes(dev, state, true);
19420   </para><para>
19421
19422   See the kerneldoc entries for these three functions for more details.
19423   </para><para>
19424
19425   RETURNS
19426   Zero for success or -errno.
19427</para>
19428</refsect1>
19429</refentry>
19430
19431<refentry id="API-drm-atomic-helper-prepare-planes">
19432<refentryinfo>
19433 <title>LINUX</title>
19434 <productname>Kernel Hackers Manual</productname>
19435 <date>July 2017</date>
19436</refentryinfo>
19437<refmeta>
19438 <refentrytitle><phrase>drm_atomic_helper_prepare_planes</phrase></refentrytitle>
19439 <manvolnum>9</manvolnum>
19440 <refmiscinfo class="version">4.4.14</refmiscinfo>
19441</refmeta>
19442<refnamediv>
19443 <refname>drm_atomic_helper_prepare_planes</refname>
19444 <refpurpose>
19445     prepare plane resources before commit
19446 </refpurpose>
19447</refnamediv>
19448<refsynopsisdiv>
19449 <title>Synopsis</title>
19450  <funcsynopsis><funcprototype>
19451   <funcdef>int <function>drm_atomic_helper_prepare_planes </function></funcdef>
19452   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
19453   <paramdef>struct drm_atomic_state * <parameter>state</parameter></paramdef>
19454  </funcprototype></funcsynopsis>
19455</refsynopsisdiv>
19456<refsect1>
19457 <title>Arguments</title>
19458 <variablelist>
19459  <varlistentry>
19460   <term><parameter>dev</parameter></term>
19461   <listitem>
19462    <para>
19463     DRM device
19464    </para>
19465   </listitem>
19466  </varlistentry>
19467  <varlistentry>
19468   <term><parameter>state</parameter></term>
19469   <listitem>
19470    <para>
19471     atomic state object with new state structures
19472    </para>
19473   </listitem>
19474  </varlistentry>
19475 </variablelist>
19476</refsect1>
19477<refsect1>
19478<title>Description</title>
19479<para>
19480   This function prepares plane state, specifically framebuffers, for the new
19481   configuration. If any failure is encountered this function will call
19482   -&gt;cleanup_fb on any already successfully prepared framebuffer.
19483</para>
19484</refsect1>
19485<refsect1>
19486<title>Returns</title>
19487<para>
19488   0 on success, negative error code on failure.
19489</para>
19490</refsect1>
19491</refentry>
19492
19493<refentry id="API-drm-atomic-helper-commit-planes">
19494<refentryinfo>
19495 <title>LINUX</title>
19496 <productname>Kernel Hackers Manual</productname>
19497 <date>July 2017</date>
19498</refentryinfo>
19499<refmeta>
19500 <refentrytitle><phrase>drm_atomic_helper_commit_planes</phrase></refentrytitle>
19501 <manvolnum>9</manvolnum>
19502 <refmiscinfo class="version">4.4.14</refmiscinfo>
19503</refmeta>
19504<refnamediv>
19505 <refname>drm_atomic_helper_commit_planes</refname>
19506 <refpurpose>
19507     commit plane state
19508 </refpurpose>
19509</refnamediv>
19510<refsynopsisdiv>
19511 <title>Synopsis</title>
19512  <funcsynopsis><funcprototype>
19513   <funcdef>void <function>drm_atomic_helper_commit_planes </function></funcdef>
19514   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
19515   <paramdef>struct drm_atomic_state * <parameter>old_state</parameter></paramdef>
19516   <paramdef>bool <parameter>active_only</parameter></paramdef>
19517  </funcprototype></funcsynopsis>
19518</refsynopsisdiv>
19519<refsect1>
19520 <title>Arguments</title>
19521 <variablelist>
19522  <varlistentry>
19523   <term><parameter>dev</parameter></term>
19524   <listitem>
19525    <para>
19526     DRM device
19527    </para>
19528   </listitem>
19529  </varlistentry>
19530  <varlistentry>
19531   <term><parameter>old_state</parameter></term>
19532   <listitem>
19533    <para>
19534     atomic state object with old state structures
19535    </para>
19536   </listitem>
19537  </varlistentry>
19538  <varlistentry>
19539   <term><parameter>active_only</parameter></term>
19540   <listitem>
19541    <para>
19542     Only commit on active CRTC if set
19543    </para>
19544   </listitem>
19545  </varlistentry>
19546 </variablelist>
19547</refsect1>
19548<refsect1>
19549<title>Description</title>
19550<para>
19551   This function commits the new plane state using the plane and atomic helper
19552   functions for planes and crtcs. It assumes that the atomic state has already
19553   been pushed into the relevant object state pointers, since this step can no
19554   longer fail.
19555   </para><para>
19556
19557   It still requires the global state object <parameter>old_state</parameter> to know which planes and
19558   crtcs need to be updated though.
19559   </para><para>
19560
19561   Note that this function does all plane updates across all CRTCs in one step.
19562   If the hardware can't support this approach look at
19563   <function>drm_atomic_helper_commit_planes_on_crtc</function> instead.
19564   </para><para>
19565
19566   Plane parameters can be updated by applications while the associated CRTC is
19567   disabled. The DRM/KMS core will store the parameters in the plane state,
19568   which will be available to the driver when the CRTC is turned on. As a result
19569   most drivers don't need to be immediately notified of plane updates for a
19570   disabled CRTC.
19571   </para><para>
19572
19573   Unless otherwise needed, drivers are advised to set the <parameter>active_only</parameter>
19574   parameters to true in order not to receive plane update notifications related
19575   to a disabled CRTC. This avoids the need to manually ignore plane updates in
19576   driver code when the driver and/or hardware can't or just don't need to deal
19577   with updates on disabled CRTCs, for example when supporting runtime PM.
19578   </para><para>
19579
19580   The <function>drm_atomic_helper_commit</function> default implementation only sets <parameter>active_only</parameter>
19581   to false to most closely match the behaviour of the legacy helpers. This should
19582   not be copied blindly by drivers.
19583</para>
19584</refsect1>
19585</refentry>
19586
19587<refentry id="API-drm-atomic-helper-commit-planes-on-crtc">
19588<refentryinfo>
19589 <title>LINUX</title>
19590 <productname>Kernel Hackers Manual</productname>
19591 <date>July 2017</date>
19592</refentryinfo>
19593<refmeta>
19594 <refentrytitle><phrase>drm_atomic_helper_commit_planes_on_crtc</phrase></refentrytitle>
19595 <manvolnum>9</manvolnum>
19596 <refmiscinfo class="version">4.4.14</refmiscinfo>
19597</refmeta>
19598<refnamediv>
19599 <refname>drm_atomic_helper_commit_planes_on_crtc</refname>
19600 <refpurpose>
19601     commit plane state for a crtc
19602 </refpurpose>
19603</refnamediv>
19604<refsynopsisdiv>
19605 <title>Synopsis</title>
19606  <funcsynopsis><funcprototype>
19607   <funcdef>void <function>drm_atomic_helper_commit_planes_on_crtc </function></funcdef>
19608   <paramdef>struct drm_crtc_state * <parameter>old_crtc_state</parameter></paramdef>
19609  </funcprototype></funcsynopsis>
19610</refsynopsisdiv>
19611<refsect1>
19612 <title>Arguments</title>
19613 <variablelist>
19614  <varlistentry>
19615   <term><parameter>old_crtc_state</parameter></term>
19616   <listitem>
19617    <para>
19618     atomic state object with the old crtc state
19619    </para>
19620   </listitem>
19621  </varlistentry>
19622 </variablelist>
19623</refsect1>
19624<refsect1>
19625<title>Description</title>
19626<para>
19627   This function commits the new plane state using the plane and atomic helper
19628   functions for planes on the specific crtc. It assumes that the atomic state
19629   has already been pushed into the relevant object state pointers, since this
19630   step can no longer fail.
19631   </para><para>
19632
19633   This function is useful when plane updates should be done crtc-by-crtc
19634   instead of one global step like <function>drm_atomic_helper_commit_planes</function> does.
19635   </para><para>
19636
19637   This function can only be savely used when planes are not allowed to move
19638   between different CRTCs because this function doesn't handle inter-CRTC
19639   depencies. Callers need to ensure that either no such depencies exist,
19640   resolve them through ordering of commit calls or through some other means.
19641</para>
19642</refsect1>
19643</refentry>
19644
19645<refentry id="API-drm-atomic-helper-cleanup-planes">
19646<refentryinfo>
19647 <title>LINUX</title>
19648 <productname>Kernel Hackers Manual</productname>
19649 <date>July 2017</date>
19650</refentryinfo>
19651<refmeta>
19652 <refentrytitle><phrase>drm_atomic_helper_cleanup_planes</phrase></refentrytitle>
19653 <manvolnum>9</manvolnum>
19654 <refmiscinfo class="version">4.4.14</refmiscinfo>
19655</refmeta>
19656<refnamediv>
19657 <refname>drm_atomic_helper_cleanup_planes</refname>
19658 <refpurpose>
19659     cleanup plane resources after commit
19660 </refpurpose>
19661</refnamediv>
19662<refsynopsisdiv>
19663 <title>Synopsis</title>
19664  <funcsynopsis><funcprototype>
19665   <funcdef>void <function>drm_atomic_helper_cleanup_planes </function></funcdef>
19666   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
19667   <paramdef>struct drm_atomic_state * <parameter>old_state</parameter></paramdef>
19668  </funcprototype></funcsynopsis>
19669</refsynopsisdiv>
19670<refsect1>
19671 <title>Arguments</title>
19672 <variablelist>
19673  <varlistentry>
19674   <term><parameter>dev</parameter></term>
19675   <listitem>
19676    <para>
19677     DRM device
19678    </para>
19679   </listitem>
19680  </varlistentry>
19681  <varlistentry>
19682   <term><parameter>old_state</parameter></term>
19683   <listitem>
19684    <para>
19685     atomic state object with old state structures
19686    </para>
19687   </listitem>
19688  </varlistentry>
19689 </variablelist>
19690</refsect1>
19691<refsect1>
19692<title>Description</title>
19693<para>
19694   This function cleans up plane state, specifically framebuffers, from the old
19695   configuration. Hence the old configuration must be perserved in <parameter>old_state</parameter> to
19696   be able to call this function.
19697   </para><para>
19698
19699   This function must also be called on the new state when the atomic update
19700   fails at any point after calling <function>drm_atomic_helper_prepare_planes</function>.
19701</para>
19702</refsect1>
19703</refentry>
19704
19705<refentry id="API-drm-atomic-helper-swap-state">
19706<refentryinfo>
19707 <title>LINUX</title>
19708 <productname>Kernel Hackers Manual</productname>
19709 <date>July 2017</date>
19710</refentryinfo>
19711<refmeta>
19712 <refentrytitle><phrase>drm_atomic_helper_swap_state</phrase></refentrytitle>
19713 <manvolnum>9</manvolnum>
19714 <refmiscinfo class="version">4.4.14</refmiscinfo>
19715</refmeta>
19716<refnamediv>
19717 <refname>drm_atomic_helper_swap_state</refname>
19718 <refpurpose>
19719     store atomic state into current sw state
19720 </refpurpose>
19721</refnamediv>
19722<refsynopsisdiv>
19723 <title>Synopsis</title>
19724  <funcsynopsis><funcprototype>
19725   <funcdef>void <function>drm_atomic_helper_swap_state </function></funcdef>
19726   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
19727   <paramdef>struct drm_atomic_state * <parameter>state</parameter></paramdef>
19728  </funcprototype></funcsynopsis>
19729</refsynopsisdiv>
19730<refsect1>
19731 <title>Arguments</title>
19732 <variablelist>
19733  <varlistentry>
19734   <term><parameter>dev</parameter></term>
19735   <listitem>
19736    <para>
19737     DRM device
19738    </para>
19739   </listitem>
19740  </varlistentry>
19741  <varlistentry>
19742   <term><parameter>state</parameter></term>
19743   <listitem>
19744    <para>
19745     atomic state
19746    </para>
19747   </listitem>
19748  </varlistentry>
19749 </variablelist>
19750</refsect1>
19751<refsect1>
19752<title>Description</title>
19753<para>
19754   This function stores the atomic state into the current state pointers in all
19755   driver objects. It should be called after all failing steps have been done
19756   and succeeded, but before the actual hardware state is committed.
19757   </para><para>
19758
19759   For cleanup and error recovery the current state for all changed objects will
19760   be swaped into <parameter>state</parameter>.
19761   </para><para>
19762
19763   With that sequence it fits perfectly into the plane prepare/cleanup sequence:
19764   </para><para>
19765
19766   1. Call <function>drm_atomic_helper_prepare_planes</function> with the staged atomic state.
19767   </para><para>
19768
19769   2. Do any other steps that might fail.
19770   </para><para>
19771
19772   3. Put the staged state into the current state pointers with this function.
19773   </para><para>
19774
19775   4. Actually commit the hardware state.
19776   </para><para>
19777
19778   5. Call <function>drm_atomic_helper_cleanup_planes</function> with <parameter>state</parameter>, which since step 3
19779   contains the old state. Also do any other cleanup required with that state.
19780</para>
19781</refsect1>
19782</refentry>
19783
19784<refentry id="API-drm-atomic-helper-update-plane">
19785<refentryinfo>
19786 <title>LINUX</title>
19787 <productname>Kernel Hackers Manual</productname>
19788 <date>July 2017</date>
19789</refentryinfo>
19790<refmeta>
19791 <refentrytitle><phrase>drm_atomic_helper_update_plane</phrase></refentrytitle>
19792 <manvolnum>9</manvolnum>
19793 <refmiscinfo class="version">4.4.14</refmiscinfo>
19794</refmeta>
19795<refnamediv>
19796 <refname>drm_atomic_helper_update_plane</refname>
19797 <refpurpose>
19798     Helper for primary plane update using atomic
19799 </refpurpose>
19800</refnamediv>
19801<refsynopsisdiv>
19802 <title>Synopsis</title>
19803  <funcsynopsis><funcprototype>
19804   <funcdef>int <function>drm_atomic_helper_update_plane </function></funcdef>
19805   <paramdef>struct drm_plane * <parameter>plane</parameter></paramdef>
19806   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
19807   <paramdef>struct drm_framebuffer * <parameter>fb</parameter></paramdef>
19808   <paramdef>int <parameter>crtc_x</parameter></paramdef>
19809   <paramdef>int <parameter>crtc_y</parameter></paramdef>
19810   <paramdef>unsigned int <parameter>crtc_w</parameter></paramdef>
19811   <paramdef>unsigned int <parameter>crtc_h</parameter></paramdef>
19812   <paramdef>uint32_t <parameter>src_x</parameter></paramdef>
19813   <paramdef>uint32_t <parameter>src_y</parameter></paramdef>
19814   <paramdef>uint32_t <parameter>src_w</parameter></paramdef>
19815   <paramdef>uint32_t <parameter>src_h</parameter></paramdef>
19816  </funcprototype></funcsynopsis>
19817</refsynopsisdiv>
19818<refsect1>
19819 <title>Arguments</title>
19820 <variablelist>
19821  <varlistentry>
19822   <term><parameter>plane</parameter></term>
19823   <listitem>
19824    <para>
19825     plane object to update
19826    </para>
19827   </listitem>
19828  </varlistentry>
19829  <varlistentry>
19830   <term><parameter>crtc</parameter></term>
19831   <listitem>
19832    <para>
19833     owning CRTC of owning plane
19834    </para>
19835   </listitem>
19836  </varlistentry>
19837  <varlistentry>
19838   <term><parameter>fb</parameter></term>
19839   <listitem>
19840    <para>
19841     framebuffer to flip onto plane
19842    </para>
19843   </listitem>
19844  </varlistentry>
19845  <varlistentry>
19846   <term><parameter>crtc_x</parameter></term>
19847   <listitem>
19848    <para>
19849     x offset of primary plane on crtc
19850    </para>
19851   </listitem>
19852  </varlistentry>
19853  <varlistentry>
19854   <term><parameter>crtc_y</parameter></term>
19855   <listitem>
19856    <para>
19857     y offset of primary plane on crtc
19858    </para>
19859   </listitem>
19860  </varlistentry>
19861  <varlistentry>
19862   <term><parameter>crtc_w</parameter></term>
19863   <listitem>
19864    <para>
19865     width of primary plane rectangle on crtc
19866    </para>
19867   </listitem>
19868  </varlistentry>
19869  <varlistentry>
19870   <term><parameter>crtc_h</parameter></term>
19871   <listitem>
19872    <para>
19873     height of primary plane rectangle on crtc
19874    </para>
19875   </listitem>
19876  </varlistentry>
19877  <varlistentry>
19878   <term><parameter>src_x</parameter></term>
19879   <listitem>
19880    <para>
19881     x offset of <parameter>fb</parameter> for panning
19882    </para>
19883   </listitem>
19884  </varlistentry>
19885  <varlistentry>
19886   <term><parameter>src_y</parameter></term>
19887   <listitem>
19888    <para>
19889     y offset of <parameter>fb</parameter> for panning
19890    </para>
19891   </listitem>
19892  </varlistentry>
19893  <varlistentry>
19894   <term><parameter>src_w</parameter></term>
19895   <listitem>
19896    <para>
19897     width of source rectangle in <parameter>fb</parameter>
19898    </para>
19899   </listitem>
19900  </varlistentry>
19901  <varlistentry>
19902   <term><parameter>src_h</parameter></term>
19903   <listitem>
19904    <para>
19905     height of source rectangle in <parameter>fb</parameter>
19906    </para>
19907   </listitem>
19908  </varlistentry>
19909 </variablelist>
19910</refsect1>
19911<refsect1>
19912<title>Description</title>
19913<para>
19914   Provides a default plane update handler using the atomic driver interface.
19915</para>
19916</refsect1>
19917<refsect1>
19918<title>RETURNS</title>
19919<para>
19920   Zero on success, error code on failure
19921</para>
19922</refsect1>
19923</refentry>
19924
19925<refentry id="API-drm-atomic-helper-disable-plane">
19926<refentryinfo>
19927 <title>LINUX</title>
19928 <productname>Kernel Hackers Manual</productname>
19929 <date>July 2017</date>
19930</refentryinfo>
19931<refmeta>
19932 <refentrytitle><phrase>drm_atomic_helper_disable_plane</phrase></refentrytitle>
19933 <manvolnum>9</manvolnum>
19934 <refmiscinfo class="version">4.4.14</refmiscinfo>
19935</refmeta>
19936<refnamediv>
19937 <refname>drm_atomic_helper_disable_plane</refname>
19938 <refpurpose>
19939     Helper for primary plane disable using * atomic
19940 </refpurpose>
19941</refnamediv>
19942<refsynopsisdiv>
19943 <title>Synopsis</title>
19944  <funcsynopsis><funcprototype>
19945   <funcdef>int <function>drm_atomic_helper_disable_plane </function></funcdef>
19946   <paramdef>struct drm_plane * <parameter>plane</parameter></paramdef>
19947  </funcprototype></funcsynopsis>
19948</refsynopsisdiv>
19949<refsect1>
19950 <title>Arguments</title>
19951 <variablelist>
19952  <varlistentry>
19953   <term><parameter>plane</parameter></term>
19954   <listitem>
19955    <para>
19956     plane to disable
19957    </para>
19958   </listitem>
19959  </varlistentry>
19960 </variablelist>
19961</refsect1>
19962<refsect1>
19963<title>Description</title>
19964<para>
19965   Provides a default plane disable handler using the atomic driver interface.
19966</para>
19967</refsect1>
19968<refsect1>
19969<title>RETURNS</title>
19970<para>
19971   Zero on success, error code on failure
19972</para>
19973</refsect1>
19974</refentry>
19975
19976<refentry id="API-drm-atomic-helper-set-config">
19977<refentryinfo>
19978 <title>LINUX</title>
19979 <productname>Kernel Hackers Manual</productname>
19980 <date>July 2017</date>
19981</refentryinfo>
19982<refmeta>
19983 <refentrytitle><phrase>drm_atomic_helper_set_config</phrase></refentrytitle>
19984 <manvolnum>9</manvolnum>
19985 <refmiscinfo class="version">4.4.14</refmiscinfo>
19986</refmeta>
19987<refnamediv>
19988 <refname>drm_atomic_helper_set_config</refname>
19989 <refpurpose>
19990     set a new config from userspace
19991 </refpurpose>
19992</refnamediv>
19993<refsynopsisdiv>
19994 <title>Synopsis</title>
19995  <funcsynopsis><funcprototype>
19996   <funcdef>int <function>drm_atomic_helper_set_config </function></funcdef>
19997   <paramdef>struct drm_mode_set * <parameter>set</parameter></paramdef>
19998  </funcprototype></funcsynopsis>
19999</refsynopsisdiv>
20000<refsect1>
20001 <title>Arguments</title>
20002 <variablelist>
20003  <varlistentry>
20004   <term><parameter>set</parameter></term>
20005   <listitem>
20006    <para>
20007     mode set configuration
20008    </para>
20009   </listitem>
20010  </varlistentry>
20011 </variablelist>
20012</refsect1>
20013<refsect1>
20014<title>Description</title>
20015<para>
20016   Provides a default crtc set_config handler using the atomic driver interface.
20017</para>
20018</refsect1>
20019<refsect1>
20020<title>Returns</title>
20021<para>
20022   Returns 0 on success, negative errno numbers on failure.
20023</para>
20024</refsect1>
20025</refentry>
20026
20027<refentry id="API-drm-atomic-helper-crtc-set-property">
20028<refentryinfo>
20029 <title>LINUX</title>
20030 <productname>Kernel Hackers Manual</productname>
20031 <date>July 2017</date>
20032</refentryinfo>
20033<refmeta>
20034 <refentrytitle><phrase>drm_atomic_helper_crtc_set_property</phrase></refentrytitle>
20035 <manvolnum>9</manvolnum>
20036 <refmiscinfo class="version">4.4.14</refmiscinfo>
20037</refmeta>
20038<refnamediv>
20039 <refname>drm_atomic_helper_crtc_set_property</refname>
20040 <refpurpose>
20041     helper for crtc properties
20042 </refpurpose>
20043</refnamediv>
20044<refsynopsisdiv>
20045 <title>Synopsis</title>
20046  <funcsynopsis><funcprototype>
20047   <funcdef>int <function>drm_atomic_helper_crtc_set_property </function></funcdef>
20048   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
20049   <paramdef>struct drm_property * <parameter>property</parameter></paramdef>
20050   <paramdef>uint64_t <parameter>val</parameter></paramdef>
20051  </funcprototype></funcsynopsis>
20052</refsynopsisdiv>
20053<refsect1>
20054 <title>Arguments</title>
20055 <variablelist>
20056  <varlistentry>
20057   <term><parameter>crtc</parameter></term>
20058   <listitem>
20059    <para>
20060     DRM crtc
20061    </para>
20062   </listitem>
20063  </varlistentry>
20064  <varlistentry>
20065   <term><parameter>property</parameter></term>
20066   <listitem>
20067    <para>
20068     DRM property
20069    </para>
20070   </listitem>
20071  </varlistentry>
20072  <varlistentry>
20073   <term><parameter>val</parameter></term>
20074   <listitem>
20075    <para>
20076     value of property
20077    </para>
20078   </listitem>
20079  </varlistentry>
20080 </variablelist>
20081</refsect1>
20082<refsect1>
20083<title>Description</title>
20084<para>
20085   Provides a default crtc set_property handler using the atomic driver
20086   interface.
20087</para>
20088</refsect1>
20089<refsect1>
20090<title>RETURNS</title>
20091<para>
20092   Zero on success, error code on failure
20093</para>
20094</refsect1>
20095</refentry>
20096
20097<refentry id="API-drm-atomic-helper-plane-set-property">
20098<refentryinfo>
20099 <title>LINUX</title>
20100 <productname>Kernel Hackers Manual</productname>
20101 <date>July 2017</date>
20102</refentryinfo>
20103<refmeta>
20104 <refentrytitle><phrase>drm_atomic_helper_plane_set_property</phrase></refentrytitle>
20105 <manvolnum>9</manvolnum>
20106 <refmiscinfo class="version">4.4.14</refmiscinfo>
20107</refmeta>
20108<refnamediv>
20109 <refname>drm_atomic_helper_plane_set_property</refname>
20110 <refpurpose>
20111     helper for plane properties
20112 </refpurpose>
20113</refnamediv>
20114<refsynopsisdiv>
20115 <title>Synopsis</title>
20116  <funcsynopsis><funcprototype>
20117   <funcdef>int <function>drm_atomic_helper_plane_set_property </function></funcdef>
20118   <paramdef>struct drm_plane * <parameter>plane</parameter></paramdef>
20119   <paramdef>struct drm_property * <parameter>property</parameter></paramdef>
20120   <paramdef>uint64_t <parameter>val</parameter></paramdef>
20121  </funcprototype></funcsynopsis>
20122</refsynopsisdiv>
20123<refsect1>
20124 <title>Arguments</title>
20125 <variablelist>
20126  <varlistentry>
20127   <term><parameter>plane</parameter></term>
20128   <listitem>
20129    <para>
20130     DRM plane
20131    </para>
20132   </listitem>
20133  </varlistentry>
20134  <varlistentry>
20135   <term><parameter>property</parameter></term>
20136   <listitem>
20137    <para>
20138     DRM property
20139    </para>
20140   </listitem>
20141  </varlistentry>
20142  <varlistentry>
20143   <term><parameter>val</parameter></term>
20144   <listitem>
20145    <para>
20146     value of property
20147    </para>
20148   </listitem>
20149  </varlistentry>
20150 </variablelist>
20151</refsect1>
20152<refsect1>
20153<title>Description</title>
20154<para>
20155   Provides a default plane set_property handler using the atomic driver
20156   interface.
20157</para>
20158</refsect1>
20159<refsect1>
20160<title>RETURNS</title>
20161<para>
20162   Zero on success, error code on failure
20163</para>
20164</refsect1>
20165</refentry>
20166
20167<refentry id="API-drm-atomic-helper-connector-set-property">
20168<refentryinfo>
20169 <title>LINUX</title>
20170 <productname>Kernel Hackers Manual</productname>
20171 <date>July 2017</date>
20172</refentryinfo>
20173<refmeta>
20174 <refentrytitle><phrase>drm_atomic_helper_connector_set_property</phrase></refentrytitle>
20175 <manvolnum>9</manvolnum>
20176 <refmiscinfo class="version">4.4.14</refmiscinfo>
20177</refmeta>
20178<refnamediv>
20179 <refname>drm_atomic_helper_connector_set_property</refname>
20180 <refpurpose>
20181     helper for connector properties
20182 </refpurpose>
20183</refnamediv>
20184<refsynopsisdiv>
20185 <title>Synopsis</title>
20186  <funcsynopsis><funcprototype>
20187   <funcdef>int <function>drm_atomic_helper_connector_set_property </function></funcdef>
20188   <paramdef>struct drm_connector * <parameter>connector</parameter></paramdef>
20189   <paramdef>struct drm_property * <parameter>property</parameter></paramdef>
20190   <paramdef>uint64_t <parameter>val</parameter></paramdef>
20191  </funcprototype></funcsynopsis>
20192</refsynopsisdiv>
20193<refsect1>
20194 <title>Arguments</title>
20195 <variablelist>
20196  <varlistentry>
20197   <term><parameter>connector</parameter></term>
20198   <listitem>
20199    <para>
20200     DRM connector
20201    </para>
20202   </listitem>
20203  </varlistentry>
20204  <varlistentry>
20205   <term><parameter>property</parameter></term>
20206   <listitem>
20207    <para>
20208     DRM property
20209    </para>
20210   </listitem>
20211  </varlistentry>
20212  <varlistentry>
20213   <term><parameter>val</parameter></term>
20214   <listitem>
20215    <para>
20216     value of property
20217    </para>
20218   </listitem>
20219  </varlistentry>
20220 </variablelist>
20221</refsect1>
20222<refsect1>
20223<title>Description</title>
20224<para>
20225   Provides a default connector set_property handler using the atomic driver
20226   interface.
20227</para>
20228</refsect1>
20229<refsect1>
20230<title>RETURNS</title>
20231<para>
20232   Zero on success, error code on failure
20233</para>
20234</refsect1>
20235</refentry>
20236
20237<refentry id="API-drm-atomic-helper-page-flip">
20238<refentryinfo>
20239 <title>LINUX</title>
20240 <productname>Kernel Hackers Manual</productname>
20241 <date>July 2017</date>
20242</refentryinfo>
20243<refmeta>
20244 <refentrytitle><phrase>drm_atomic_helper_page_flip</phrase></refentrytitle>
20245 <manvolnum>9</manvolnum>
20246 <refmiscinfo class="version">4.4.14</refmiscinfo>
20247</refmeta>
20248<refnamediv>
20249 <refname>drm_atomic_helper_page_flip</refname>
20250 <refpurpose>
20251     execute a legacy page flip
20252 </refpurpose>
20253</refnamediv>
20254<refsynopsisdiv>
20255 <title>Synopsis</title>
20256  <funcsynopsis><funcprototype>
20257   <funcdef>int <function>drm_atomic_helper_page_flip </function></funcdef>
20258   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
20259   <paramdef>struct drm_framebuffer * <parameter>fb</parameter></paramdef>
20260   <paramdef>struct drm_pending_vblank_event * <parameter>event</parameter></paramdef>
20261   <paramdef>uint32_t <parameter>flags</parameter></paramdef>
20262  </funcprototype></funcsynopsis>
20263</refsynopsisdiv>
20264<refsect1>
20265 <title>Arguments</title>
20266 <variablelist>
20267  <varlistentry>
20268   <term><parameter>crtc</parameter></term>
20269   <listitem>
20270    <para>
20271     DRM crtc
20272    </para>
20273   </listitem>
20274  </varlistentry>
20275  <varlistentry>
20276   <term><parameter>fb</parameter></term>
20277   <listitem>
20278    <para>
20279     DRM framebuffer
20280    </para>
20281   </listitem>
20282  </varlistentry>
20283  <varlistentry>
20284   <term><parameter>event</parameter></term>
20285   <listitem>
20286    <para>
20287     optional DRM event to signal upon completion
20288    </para>
20289   </listitem>
20290  </varlistentry>
20291  <varlistentry>
20292   <term><parameter>flags</parameter></term>
20293   <listitem>
20294    <para>
20295     flip flags for non-vblank sync'ed updates
20296    </para>
20297   </listitem>
20298  </varlistentry>
20299 </variablelist>
20300</refsect1>
20301<refsect1>
20302<title>Description</title>
20303<para>
20304   Provides a default page flip implementation using the atomic driver interface.
20305   </para><para>
20306
20307   Note that for now so called async page flips (i.e. updates which are not
20308   synchronized to vblank) are not supported, since the atomic interfaces have
20309   no provisions for this yet.
20310</para>
20311</refsect1>
20312<refsect1>
20313<title>Returns</title>
20314<para>
20315   Returns 0 on success, negative errno numbers on failure.
20316</para>
20317</refsect1>
20318</refentry>
20319
20320<refentry id="API-drm-atomic-helper-connector-dpms">
20321<refentryinfo>
20322 <title>LINUX</title>
20323 <productname>Kernel Hackers Manual</productname>
20324 <date>July 2017</date>
20325</refentryinfo>
20326<refmeta>
20327 <refentrytitle><phrase>drm_atomic_helper_connector_dpms</phrase></refentrytitle>
20328 <manvolnum>9</manvolnum>
20329 <refmiscinfo class="version">4.4.14</refmiscinfo>
20330</refmeta>
20331<refnamediv>
20332 <refname>drm_atomic_helper_connector_dpms</refname>
20333 <refpurpose>
20334     connector dpms helper implementation
20335 </refpurpose>
20336</refnamediv>
20337<refsynopsisdiv>
20338 <title>Synopsis</title>
20339  <funcsynopsis><funcprototype>
20340   <funcdef>int <function>drm_atomic_helper_connector_dpms </function></funcdef>
20341   <paramdef>struct drm_connector * <parameter>connector</parameter></paramdef>
20342   <paramdef>int <parameter>mode</parameter></paramdef>
20343  </funcprototype></funcsynopsis>
20344</refsynopsisdiv>
20345<refsect1>
20346 <title>Arguments</title>
20347 <variablelist>
20348  <varlistentry>
20349   <term><parameter>connector</parameter></term>
20350   <listitem>
20351    <para>
20352     affected connector
20353    </para>
20354   </listitem>
20355  </varlistentry>
20356  <varlistentry>
20357   <term><parameter>mode</parameter></term>
20358   <listitem>
20359    <para>
20360     DPMS mode
20361    </para>
20362   </listitem>
20363  </varlistentry>
20364 </variablelist>
20365</refsect1>
20366<refsect1>
20367<title>Description</title>
20368<para>
20369   This is the main helper function provided by the atomic helper framework for
20370   implementing the legacy DPMS connector interface. It computes the new desired
20371   -&gt;active state for the corresponding CRTC (if the connector is enabled) and
20372   updates it.
20373</para>
20374</refsect1>
20375<refsect1>
20376<title>Returns</title>
20377<para>
20378   Returns 0 on success, negative errno numbers on failure.
20379</para>
20380</refsect1>
20381</refentry>
20382
20383<refentry id="API-drm-atomic-helper-crtc-reset">
20384<refentryinfo>
20385 <title>LINUX</title>
20386 <productname>Kernel Hackers Manual</productname>
20387 <date>July 2017</date>
20388</refentryinfo>
20389<refmeta>
20390 <refentrytitle><phrase>drm_atomic_helper_crtc_reset</phrase></refentrytitle>
20391 <manvolnum>9</manvolnum>
20392 <refmiscinfo class="version">4.4.14</refmiscinfo>
20393</refmeta>
20394<refnamediv>
20395 <refname>drm_atomic_helper_crtc_reset</refname>
20396 <refpurpose>
20397     default -&gt;reset hook for CRTCs
20398 </refpurpose>
20399</refnamediv>
20400<refsynopsisdiv>
20401 <title>Synopsis</title>
20402  <funcsynopsis><funcprototype>
20403   <funcdef>void <function>drm_atomic_helper_crtc_reset </function></funcdef>
20404   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
20405  </funcprototype></funcsynopsis>
20406</refsynopsisdiv>
20407<refsect1>
20408 <title>Arguments</title>
20409 <variablelist>
20410  <varlistentry>
20411   <term><parameter>crtc</parameter></term>
20412   <listitem>
20413    <para>
20414     drm CRTC
20415    </para>
20416   </listitem>
20417  </varlistentry>
20418 </variablelist>
20419</refsect1>
20420<refsect1>
20421<title>Description</title>
20422<para>
20423   Resets the atomic state for <parameter>crtc</parameter> by freeing the state pointer (which might
20424   be NULL, e.g. at driver load time) and allocating a new empty state object.
20425</para>
20426</refsect1>
20427</refentry>
20428
20429<refentry id="API---drm-atomic-helper-crtc-duplicate-state">
20430<refentryinfo>
20431 <title>LINUX</title>
20432 <productname>Kernel Hackers Manual</productname>
20433 <date>July 2017</date>
20434</refentryinfo>
20435<refmeta>
20436 <refentrytitle><phrase>__drm_atomic_helper_crtc_duplicate_state</phrase></refentrytitle>
20437 <manvolnum>9</manvolnum>
20438 <refmiscinfo class="version">4.4.14</refmiscinfo>
20439</refmeta>
20440<refnamediv>
20441 <refname>__drm_atomic_helper_crtc_duplicate_state</refname>
20442 <refpurpose>
20443     copy atomic CRTC state
20444 </refpurpose>
20445</refnamediv>
20446<refsynopsisdiv>
20447 <title>Synopsis</title>
20448  <funcsynopsis><funcprototype>
20449   <funcdef>void <function>__drm_atomic_helper_crtc_duplicate_state </function></funcdef>
20450   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
20451   <paramdef>struct drm_crtc_state * <parameter>state</parameter></paramdef>
20452  </funcprototype></funcsynopsis>
20453</refsynopsisdiv>
20454<refsect1>
20455 <title>Arguments</title>
20456 <variablelist>
20457  <varlistentry>
20458   <term><parameter>crtc</parameter></term>
20459   <listitem>
20460    <para>
20461     CRTC object
20462    </para>
20463   </listitem>
20464  </varlistentry>
20465  <varlistentry>
20466   <term><parameter>state</parameter></term>
20467   <listitem>
20468    <para>
20469     atomic CRTC state
20470    </para>
20471   </listitem>
20472  </varlistentry>
20473 </variablelist>
20474</refsect1>
20475<refsect1>
20476<title>Description</title>
20477<para>
20478   Copies atomic state from a CRTC's current state and resets inferred values.
20479   This is useful for drivers that subclass the CRTC state.
20480</para>
20481</refsect1>
20482</refentry>
20483
20484<refentry id="API-drm-atomic-helper-crtc-duplicate-state">
20485<refentryinfo>
20486 <title>LINUX</title>
20487 <productname>Kernel Hackers Manual</productname>
20488 <date>July 2017</date>
20489</refentryinfo>
20490<refmeta>
20491 <refentrytitle><phrase>drm_atomic_helper_crtc_duplicate_state</phrase></refentrytitle>
20492 <manvolnum>9</manvolnum>
20493 <refmiscinfo class="version">4.4.14</refmiscinfo>
20494</refmeta>
20495<refnamediv>
20496 <refname>drm_atomic_helper_crtc_duplicate_state</refname>
20497 <refpurpose>
20498     default state duplicate hook
20499 </refpurpose>
20500</refnamediv>
20501<refsynopsisdiv>
20502 <title>Synopsis</title>
20503  <funcsynopsis><funcprototype>
20504   <funcdef>struct drm_crtc_state * <function>drm_atomic_helper_crtc_duplicate_state </function></funcdef>
20505   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
20506  </funcprototype></funcsynopsis>
20507</refsynopsisdiv>
20508<refsect1>
20509 <title>Arguments</title>
20510 <variablelist>
20511  <varlistentry>
20512   <term><parameter>crtc</parameter></term>
20513   <listitem>
20514    <para>
20515     drm CRTC
20516    </para>
20517   </listitem>
20518  </varlistentry>
20519 </variablelist>
20520</refsect1>
20521<refsect1>
20522<title>Description</title>
20523<para>
20524   Default CRTC state duplicate hook for drivers which don't have their own
20525   subclassed CRTC state structure.
20526</para>
20527</refsect1>
20528</refentry>
20529
20530<refentry id="API---drm-atomic-helper-crtc-destroy-state">
20531<refentryinfo>
20532 <title>LINUX</title>
20533 <productname>Kernel Hackers Manual</productname>
20534 <date>July 2017</date>
20535</refentryinfo>
20536<refmeta>
20537 <refentrytitle><phrase>__drm_atomic_helper_crtc_destroy_state</phrase></refentrytitle>
20538 <manvolnum>9</manvolnum>
20539 <refmiscinfo class="version">4.4.14</refmiscinfo>
20540</refmeta>
20541<refnamediv>
20542 <refname>__drm_atomic_helper_crtc_destroy_state</refname>
20543 <refpurpose>
20544     release CRTC state
20545 </refpurpose>
20546</refnamediv>
20547<refsynopsisdiv>
20548 <title>Synopsis</title>
20549  <funcsynopsis><funcprototype>
20550   <funcdef>void <function>__drm_atomic_helper_crtc_destroy_state </function></funcdef>
20551   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
20552   <paramdef>struct drm_crtc_state * <parameter>state</parameter></paramdef>
20553  </funcprototype></funcsynopsis>
20554</refsynopsisdiv>
20555<refsect1>
20556 <title>Arguments</title>
20557 <variablelist>
20558  <varlistentry>
20559   <term><parameter>crtc</parameter></term>
20560   <listitem>
20561    <para>
20562     CRTC object
20563    </para>
20564   </listitem>
20565  </varlistentry>
20566  <varlistentry>
20567   <term><parameter>state</parameter></term>
20568   <listitem>
20569    <para>
20570     CRTC state object to release
20571    </para>
20572   </listitem>
20573  </varlistentry>
20574 </variablelist>
20575</refsect1>
20576<refsect1>
20577<title>Description</title>
20578<para>
20579   Releases all resources stored in the CRTC state without actually freeing
20580   the memory of the CRTC state. This is useful for drivers that subclass the
20581   CRTC state.
20582</para>
20583</refsect1>
20584</refentry>
20585
20586<refentry id="API-drm-atomic-helper-crtc-destroy-state">
20587<refentryinfo>
20588 <title>LINUX</title>
20589 <productname>Kernel Hackers Manual</productname>
20590 <date>July 2017</date>
20591</refentryinfo>
20592<refmeta>
20593 <refentrytitle><phrase>drm_atomic_helper_crtc_destroy_state</phrase></refentrytitle>
20594 <manvolnum>9</manvolnum>
20595 <refmiscinfo class="version">4.4.14</refmiscinfo>
20596</refmeta>
20597<refnamediv>
20598 <refname>drm_atomic_helper_crtc_destroy_state</refname>
20599 <refpurpose>
20600     default state destroy hook
20601 </refpurpose>
20602</refnamediv>
20603<refsynopsisdiv>
20604 <title>Synopsis</title>
20605  <funcsynopsis><funcprototype>
20606   <funcdef>void <function>drm_atomic_helper_crtc_destroy_state </function></funcdef>
20607   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
20608   <paramdef>struct drm_crtc_state * <parameter>state</parameter></paramdef>
20609  </funcprototype></funcsynopsis>
20610</refsynopsisdiv>
20611<refsect1>
20612 <title>Arguments</title>
20613 <variablelist>
20614  <varlistentry>
20615   <term><parameter>crtc</parameter></term>
20616   <listitem>
20617    <para>
20618     drm CRTC
20619    </para>
20620   </listitem>
20621  </varlistentry>
20622  <varlistentry>
20623   <term><parameter>state</parameter></term>
20624   <listitem>
20625    <para>
20626     CRTC state object to release
20627    </para>
20628   </listitem>
20629  </varlistentry>
20630 </variablelist>
20631</refsect1>
20632<refsect1>
20633<title>Description</title>
20634<para>
20635   Default CRTC state destroy hook for drivers which don't have their own
20636   subclassed CRTC state structure.
20637</para>
20638</refsect1>
20639</refentry>
20640
20641<refentry id="API-drm-atomic-helper-plane-reset">
20642<refentryinfo>
20643 <title>LINUX</title>
20644 <productname>Kernel Hackers Manual</productname>
20645 <date>July 2017</date>
20646</refentryinfo>
20647<refmeta>
20648 <refentrytitle><phrase>drm_atomic_helper_plane_reset</phrase></refentrytitle>
20649 <manvolnum>9</manvolnum>
20650 <refmiscinfo class="version">4.4.14</refmiscinfo>
20651</refmeta>
20652<refnamediv>
20653 <refname>drm_atomic_helper_plane_reset</refname>
20654 <refpurpose>
20655     default -&gt;reset hook for planes
20656 </refpurpose>
20657</refnamediv>
20658<refsynopsisdiv>
20659 <title>Synopsis</title>
20660  <funcsynopsis><funcprototype>
20661   <funcdef>void <function>drm_atomic_helper_plane_reset </function></funcdef>
20662   <paramdef>struct drm_plane * <parameter>plane</parameter></paramdef>
20663  </funcprototype></funcsynopsis>
20664</refsynopsisdiv>
20665<refsect1>
20666 <title>Arguments</title>
20667 <variablelist>
20668  <varlistentry>
20669   <term><parameter>plane</parameter></term>
20670   <listitem>
20671    <para>
20672     drm plane
20673    </para>
20674   </listitem>
20675  </varlistentry>
20676 </variablelist>
20677</refsect1>
20678<refsect1>
20679<title>Description</title>
20680<para>
20681   Resets the atomic state for <parameter>plane</parameter> by freeing the state pointer (which might
20682   be NULL, e.g. at driver load time) and allocating a new empty state object.
20683</para>
20684</refsect1>
20685</refentry>
20686
20687<refentry id="API---drm-atomic-helper-plane-duplicate-state">
20688<refentryinfo>
20689 <title>LINUX</title>
20690 <productname>Kernel Hackers Manual</productname>
20691 <date>July 2017</date>
20692</refentryinfo>
20693<refmeta>
20694 <refentrytitle><phrase>__drm_atomic_helper_plane_duplicate_state</phrase></refentrytitle>
20695 <manvolnum>9</manvolnum>
20696 <refmiscinfo class="version">4.4.14</refmiscinfo>
20697</refmeta>
20698<refnamediv>
20699 <refname>__drm_atomic_helper_plane_duplicate_state</refname>
20700 <refpurpose>
20701     copy atomic plane state
20702 </refpurpose>
20703</refnamediv>
20704<refsynopsisdiv>
20705 <title>Synopsis</title>
20706  <funcsynopsis><funcprototype>
20707   <funcdef>void <function>__drm_atomic_helper_plane_duplicate_state </function></funcdef>
20708   <paramdef>struct drm_plane * <parameter>plane</parameter></paramdef>
20709   <paramdef>struct drm_plane_state * <parameter>state</parameter></paramdef>
20710  </funcprototype></funcsynopsis>
20711</refsynopsisdiv>
20712<refsect1>
20713 <title>Arguments</title>
20714 <variablelist>
20715  <varlistentry>
20716   <term><parameter>plane</parameter></term>
20717   <listitem>
20718    <para>
20719     plane object
20720    </para>
20721   </listitem>
20722  </varlistentry>
20723  <varlistentry>
20724   <term><parameter>state</parameter></term>
20725   <listitem>
20726    <para>
20727     atomic plane state
20728    </para>
20729   </listitem>
20730  </varlistentry>
20731 </variablelist>
20732</refsect1>
20733<refsect1>
20734<title>Description</title>
20735<para>
20736   Copies atomic state from a plane's current state. This is useful for
20737   drivers that subclass the plane state.
20738</para>
20739</refsect1>
20740</refentry>
20741
20742<refentry id="API-drm-atomic-helper-plane-duplicate-state">
20743<refentryinfo>
20744 <title>LINUX</title>
20745 <productname>Kernel Hackers Manual</productname>
20746 <date>July 2017</date>
20747</refentryinfo>
20748<refmeta>
20749 <refentrytitle><phrase>drm_atomic_helper_plane_duplicate_state</phrase></refentrytitle>
20750 <manvolnum>9</manvolnum>
20751 <refmiscinfo class="version">4.4.14</refmiscinfo>
20752</refmeta>
20753<refnamediv>
20754 <refname>drm_atomic_helper_plane_duplicate_state</refname>
20755 <refpurpose>
20756     default state duplicate hook
20757 </refpurpose>
20758</refnamediv>
20759<refsynopsisdiv>
20760 <title>Synopsis</title>
20761  <funcsynopsis><funcprototype>
20762   <funcdef>struct drm_plane_state * <function>drm_atomic_helper_plane_duplicate_state </function></funcdef>
20763   <paramdef>struct drm_plane * <parameter>plane</parameter></paramdef>
20764  </funcprototype></funcsynopsis>
20765</refsynopsisdiv>
20766<refsect1>
20767 <title>Arguments</title>
20768 <variablelist>
20769  <varlistentry>
20770   <term><parameter>plane</parameter></term>
20771   <listitem>
20772    <para>
20773     drm plane
20774    </para>
20775   </listitem>
20776  </varlistentry>
20777 </variablelist>
20778</refsect1>
20779<refsect1>
20780<title>Description</title>
20781<para>
20782   Default plane state duplicate hook for drivers which don't have their own
20783   subclassed plane state structure.
20784</para>
20785</refsect1>
20786</refentry>
20787
20788<refentry id="API---drm-atomic-helper-plane-destroy-state">
20789<refentryinfo>
20790 <title>LINUX</title>
20791 <productname>Kernel Hackers Manual</productname>
20792 <date>July 2017</date>
20793</refentryinfo>
20794<refmeta>
20795 <refentrytitle><phrase>__drm_atomic_helper_plane_destroy_state</phrase></refentrytitle>
20796 <manvolnum>9</manvolnum>
20797 <refmiscinfo class="version">4.4.14</refmiscinfo>
20798</refmeta>
20799<refnamediv>
20800 <refname>__drm_atomic_helper_plane_destroy_state</refname>
20801 <refpurpose>
20802     release plane state
20803 </refpurpose>
20804</refnamediv>
20805<refsynopsisdiv>
20806 <title>Synopsis</title>
20807  <funcsynopsis><funcprototype>
20808   <funcdef>void <function>__drm_atomic_helper_plane_destroy_state </function></funcdef>
20809   <paramdef>struct drm_plane * <parameter>plane</parameter></paramdef>
20810   <paramdef>struct drm_plane_state * <parameter>state</parameter></paramdef>
20811  </funcprototype></funcsynopsis>
20812</refsynopsisdiv>
20813<refsect1>
20814 <title>Arguments</title>
20815 <variablelist>
20816  <varlistentry>
20817   <term><parameter>plane</parameter></term>
20818   <listitem>
20819    <para>
20820     plane object
20821    </para>
20822   </listitem>
20823  </varlistentry>
20824  <varlistentry>
20825   <term><parameter>state</parameter></term>
20826   <listitem>
20827    <para>
20828     plane state object to release
20829    </para>
20830   </listitem>
20831  </varlistentry>
20832 </variablelist>
20833</refsect1>
20834<refsect1>
20835<title>Description</title>
20836<para>
20837   Releases all resources stored in the plane state without actually freeing
20838   the memory of the plane state. This is useful for drivers that subclass the
20839   plane state.
20840</para>
20841</refsect1>
20842</refentry>
20843
20844<refentry id="API-drm-atomic-helper-plane-destroy-state">
20845<refentryinfo>
20846 <title>LINUX</title>
20847 <productname>Kernel Hackers Manual</productname>
20848 <date>July 2017</date>
20849</refentryinfo>
20850<refmeta>
20851 <refentrytitle><phrase>drm_atomic_helper_plane_destroy_state</phrase></refentrytitle>
20852 <manvolnum>9</manvolnum>
20853 <refmiscinfo class="version">4.4.14</refmiscinfo>
20854</refmeta>
20855<refnamediv>
20856 <refname>drm_atomic_helper_plane_destroy_state</refname>
20857 <refpurpose>
20858     default state destroy hook
20859 </refpurpose>
20860</refnamediv>
20861<refsynopsisdiv>
20862 <title>Synopsis</title>
20863  <funcsynopsis><funcprototype>
20864   <funcdef>void <function>drm_atomic_helper_plane_destroy_state </function></funcdef>
20865   <paramdef>struct drm_plane * <parameter>plane</parameter></paramdef>
20866   <paramdef>struct drm_plane_state * <parameter>state</parameter></paramdef>
20867  </funcprototype></funcsynopsis>
20868</refsynopsisdiv>
20869<refsect1>
20870 <title>Arguments</title>
20871 <variablelist>
20872  <varlistentry>
20873   <term><parameter>plane</parameter></term>
20874   <listitem>
20875    <para>
20876     drm plane
20877    </para>
20878   </listitem>
20879  </varlistentry>
20880  <varlistentry>
20881   <term><parameter>state</parameter></term>
20882   <listitem>
20883    <para>
20884     plane state object to release
20885    </para>
20886   </listitem>
20887  </varlistentry>
20888 </variablelist>
20889</refsect1>
20890<refsect1>
20891<title>Description</title>
20892<para>
20893   Default plane state destroy hook for drivers which don't have their own
20894   subclassed plane state structure.
20895</para>
20896</refsect1>
20897</refentry>
20898
20899<refentry id="API-drm-atomic-helper-connector-reset">
20900<refentryinfo>
20901 <title>LINUX</title>
20902 <productname>Kernel Hackers Manual</productname>
20903 <date>July 2017</date>
20904</refentryinfo>
20905<refmeta>
20906 <refentrytitle><phrase>drm_atomic_helper_connector_reset</phrase></refentrytitle>
20907 <manvolnum>9</manvolnum>
20908 <refmiscinfo class="version">4.4.14</refmiscinfo>
20909</refmeta>
20910<refnamediv>
20911 <refname>drm_atomic_helper_connector_reset</refname>
20912 <refpurpose>
20913     default -&gt;reset hook for connectors
20914 </refpurpose>
20915</refnamediv>
20916<refsynopsisdiv>
20917 <title>Synopsis</title>
20918  <funcsynopsis><funcprototype>
20919   <funcdef>void <function>drm_atomic_helper_connector_reset </function></funcdef>
20920   <paramdef>struct drm_connector * <parameter>connector</parameter></paramdef>
20921  </funcprototype></funcsynopsis>
20922</refsynopsisdiv>
20923<refsect1>
20924 <title>Arguments</title>
20925 <variablelist>
20926  <varlistentry>
20927   <term><parameter>connector</parameter></term>
20928   <listitem>
20929    <para>
20930     drm connector
20931    </para>
20932   </listitem>
20933  </varlistentry>
20934 </variablelist>
20935</refsect1>
20936<refsect1>
20937<title>Description</title>
20938<para>
20939   Resets the atomic state for <parameter>connector</parameter> by freeing the state pointer (which
20940   might be NULL, e.g. at driver load time) and allocating a new empty state
20941   object.
20942</para>
20943</refsect1>
20944</refentry>
20945
20946<refentry id="API---drm-atomic-helper-connector-duplicate-state">
20947<refentryinfo>
20948 <title>LINUX</title>
20949 <productname>Kernel Hackers Manual</productname>
20950 <date>July 2017</date>
20951</refentryinfo>
20952<refmeta>
20953 <refentrytitle><phrase>__drm_atomic_helper_connector_duplicate_state</phrase></refentrytitle>
20954 <manvolnum>9</manvolnum>
20955 <refmiscinfo class="version">4.4.14</refmiscinfo>
20956</refmeta>
20957<refnamediv>
20958 <refname>__drm_atomic_helper_connector_duplicate_state</refname>
20959 <refpurpose>
20960     copy atomic connector state
20961 </refpurpose>
20962</refnamediv>
20963<refsynopsisdiv>
20964 <title>Synopsis</title>
20965  <funcsynopsis><funcprototype>
20966   <funcdef>void <function>__drm_atomic_helper_connector_duplicate_state </function></funcdef>
20967   <paramdef>struct drm_connector * <parameter>connector</parameter></paramdef>
20968   <paramdef>struct drm_connector_state * <parameter>state</parameter></paramdef>
20969  </funcprototype></funcsynopsis>
20970</refsynopsisdiv>
20971<refsect1>
20972 <title>Arguments</title>
20973 <variablelist>
20974  <varlistentry>
20975   <term><parameter>connector</parameter></term>
20976   <listitem>
20977    <para>
20978     connector object
20979    </para>
20980   </listitem>
20981  </varlistentry>
20982  <varlistentry>
20983   <term><parameter>state</parameter></term>
20984   <listitem>
20985    <para>
20986     atomic connector state
20987    </para>
20988   </listitem>
20989  </varlistentry>
20990 </variablelist>
20991</refsect1>
20992<refsect1>
20993<title>Description</title>
20994<para>
20995   Copies atomic state from a connector's current state. This is useful for
20996   drivers that subclass the connector state.
20997</para>
20998</refsect1>
20999</refentry>
21000
21001<refentry id="API-drm-atomic-helper-connector-duplicate-state">
21002<refentryinfo>
21003 <title>LINUX</title>
21004 <productname>Kernel Hackers Manual</productname>
21005 <date>July 2017</date>
21006</refentryinfo>
21007<refmeta>
21008 <refentrytitle><phrase>drm_atomic_helper_connector_duplicate_state</phrase></refentrytitle>
21009 <manvolnum>9</manvolnum>
21010 <refmiscinfo class="version">4.4.14</refmiscinfo>
21011</refmeta>
21012<refnamediv>
21013 <refname>drm_atomic_helper_connector_duplicate_state</refname>
21014 <refpurpose>
21015     default state duplicate hook
21016 </refpurpose>
21017</refnamediv>
21018<refsynopsisdiv>
21019 <title>Synopsis</title>
21020  <funcsynopsis><funcprototype>
21021   <funcdef>struct drm_connector_state * <function>drm_atomic_helper_connector_duplicate_state </function></funcdef>
21022   <paramdef>struct drm_connector * <parameter>connector</parameter></paramdef>
21023  </funcprototype></funcsynopsis>
21024</refsynopsisdiv>
21025<refsect1>
21026 <title>Arguments</title>
21027 <variablelist>
21028  <varlistentry>
21029   <term><parameter>connector</parameter></term>
21030   <listitem>
21031    <para>
21032     drm connector
21033    </para>
21034   </listitem>
21035  </varlistentry>
21036 </variablelist>
21037</refsect1>
21038<refsect1>
21039<title>Description</title>
21040<para>
21041   Default connector state duplicate hook for drivers which don't have their own
21042   subclassed connector state structure.
21043</para>
21044</refsect1>
21045</refentry>
21046
21047<refentry id="API-drm-atomic-helper-duplicate-state">
21048<refentryinfo>
21049 <title>LINUX</title>
21050 <productname>Kernel Hackers Manual</productname>
21051 <date>July 2017</date>
21052</refentryinfo>
21053<refmeta>
21054 <refentrytitle><phrase>drm_atomic_helper_duplicate_state</phrase></refentrytitle>
21055 <manvolnum>9</manvolnum>
21056 <refmiscinfo class="version">4.4.14</refmiscinfo>
21057</refmeta>
21058<refnamediv>
21059 <refname>drm_atomic_helper_duplicate_state</refname>
21060 <refpurpose>
21061     duplicate an atomic state object
21062 </refpurpose>
21063</refnamediv>
21064<refsynopsisdiv>
21065 <title>Synopsis</title>
21066  <funcsynopsis><funcprototype>
21067   <funcdef>struct drm_atomic_state * <function>drm_atomic_helper_duplicate_state </function></funcdef>
21068   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
21069   <paramdef>struct drm_modeset_acquire_ctx * <parameter>ctx</parameter></paramdef>
21070  </funcprototype></funcsynopsis>
21071</refsynopsisdiv>
21072<refsect1>
21073 <title>Arguments</title>
21074 <variablelist>
21075  <varlistentry>
21076   <term><parameter>dev</parameter></term>
21077   <listitem>
21078    <para>
21079     DRM device
21080    </para>
21081   </listitem>
21082  </varlistentry>
21083  <varlistentry>
21084   <term><parameter>ctx</parameter></term>
21085   <listitem>
21086    <para>
21087     lock acquisition context
21088    </para>
21089   </listitem>
21090  </varlistentry>
21091 </variablelist>
21092</refsect1>
21093<refsect1>
21094<title>Description</title>
21095<para>
21096   Makes a copy of the current atomic state by looping over all objects and
21097   duplicating their respective states.
21098   </para><para>
21099
21100   Note that this treats atomic state as persistent between save and restore.
21101   Drivers must make sure that this is possible and won't result in confusion
21102   or erroneous behaviour.
21103   </para><para>
21104
21105   Note that if callers haven't already acquired all modeset locks this might
21106   return -EDEADLK, which must be handled by calling <function>drm_modeset_backoff</function>.
21107</para>
21108</refsect1>
21109<refsect1>
21110<title>Returns</title>
21111<para>
21112   A pointer to the copy of the atomic state object on success or an
21113   <function>ERR_PTR</function>-encoded error code on failure.
21114</para>
21115</refsect1>
21116</refentry>
21117
21118<refentry id="API---drm-atomic-helper-connector-destroy-state">
21119<refentryinfo>
21120 <title>LINUX</title>
21121 <productname>Kernel Hackers Manual</productname>
21122 <date>July 2017</date>
21123</refentryinfo>
21124<refmeta>
21125 <refentrytitle><phrase>__drm_atomic_helper_connector_destroy_state</phrase></refentrytitle>
21126 <manvolnum>9</manvolnum>
21127 <refmiscinfo class="version">4.4.14</refmiscinfo>
21128</refmeta>
21129<refnamediv>
21130 <refname>__drm_atomic_helper_connector_destroy_state</refname>
21131 <refpurpose>
21132     release connector state
21133 </refpurpose>
21134</refnamediv>
21135<refsynopsisdiv>
21136 <title>Synopsis</title>
21137  <funcsynopsis><funcprototype>
21138   <funcdef>void <function>__drm_atomic_helper_connector_destroy_state </function></funcdef>
21139   <paramdef>struct drm_connector * <parameter>connector</parameter></paramdef>
21140   <paramdef>struct drm_connector_state * <parameter>state</parameter></paramdef>
21141  </funcprototype></funcsynopsis>
21142</refsynopsisdiv>
21143<refsect1>
21144 <title>Arguments</title>
21145 <variablelist>
21146  <varlistentry>
21147   <term><parameter>connector</parameter></term>
21148   <listitem>
21149    <para>
21150     connector object
21151    </para>
21152   </listitem>
21153  </varlistentry>
21154  <varlistentry>
21155   <term><parameter>state</parameter></term>
21156   <listitem>
21157    <para>
21158     connector state object to release
21159    </para>
21160   </listitem>
21161  </varlistentry>
21162 </variablelist>
21163</refsect1>
21164<refsect1>
21165<title>Description</title>
21166<para>
21167   Releases all resources stored in the connector state without actually
21168   freeing the memory of the connector state. This is useful for drivers that
21169   subclass the connector state.
21170</para>
21171</refsect1>
21172</refentry>
21173
21174<refentry id="API-drm-atomic-helper-connector-destroy-state">
21175<refentryinfo>
21176 <title>LINUX</title>
21177 <productname>Kernel Hackers Manual</productname>
21178 <date>July 2017</date>
21179</refentryinfo>
21180<refmeta>
21181 <refentrytitle><phrase>drm_atomic_helper_connector_destroy_state</phrase></refentrytitle>
21182 <manvolnum>9</manvolnum>
21183 <refmiscinfo class="version">4.4.14</refmiscinfo>
21184</refmeta>
21185<refnamediv>
21186 <refname>drm_atomic_helper_connector_destroy_state</refname>
21187 <refpurpose>
21188     default state destroy hook
21189 </refpurpose>
21190</refnamediv>
21191<refsynopsisdiv>
21192 <title>Synopsis</title>
21193  <funcsynopsis><funcprototype>
21194   <funcdef>void <function>drm_atomic_helper_connector_destroy_state </function></funcdef>
21195   <paramdef>struct drm_connector * <parameter>connector</parameter></paramdef>
21196   <paramdef>struct drm_connector_state * <parameter>state</parameter></paramdef>
21197  </funcprototype></funcsynopsis>
21198</refsynopsisdiv>
21199<refsect1>
21200 <title>Arguments</title>
21201 <variablelist>
21202  <varlistentry>
21203   <term><parameter>connector</parameter></term>
21204   <listitem>
21205    <para>
21206     drm connector
21207    </para>
21208   </listitem>
21209  </varlistentry>
21210  <varlistentry>
21211   <term><parameter>state</parameter></term>
21212   <listitem>
21213    <para>
21214     connector state object to release
21215    </para>
21216   </listitem>
21217  </varlistentry>
21218 </variablelist>
21219</refsect1>
21220<refsect1>
21221<title>Description</title>
21222<para>
21223   Default connector state destroy hook for drivers which don't have their own
21224   subclassed connector state structure.
21225</para>
21226</refsect1>
21227</refentry>
21228
21229    </sect2>
21230    <sect2>
21231      <title>Modeset Helper Functions Reference</title>
21232<!-- include/drm/drm_crtc_helper.h -->
21233<refentry id="API-struct-drm-crtc-helper-funcs">
21234<refentryinfo>
21235 <title>LINUX</title>
21236 <productname>Kernel Hackers Manual</productname>
21237 <date>July 2017</date>
21238</refentryinfo>
21239<refmeta>
21240 <refentrytitle><phrase>struct drm_crtc_helper_funcs</phrase></refentrytitle>
21241 <manvolnum>9</manvolnum>
21242 <refmiscinfo class="version">4.4.14</refmiscinfo>
21243</refmeta>
21244<refnamediv>
21245 <refname>struct drm_crtc_helper_funcs</refname>
21246 <refpurpose>
21247  helper operations for CRTCs
21248 </refpurpose>
21249</refnamediv>
21250<refsynopsisdiv>
21251 <title>Synopsis</title>
21252  <programlisting>
21253struct drm_crtc_helper_funcs {
21254  void (* dpms) (struct drm_crtc *crtc, int mode);
21255  void (* prepare) (struct drm_crtc *crtc);
21256  void (* commit) (struct drm_crtc *crtc);
21257  bool (* mode_fixup) (struct drm_crtc *crtc,const struct drm_display_mode *mode,struct drm_display_mode *adjusted_mode);
21258  int (* mode_set) (struct drm_crtc *crtc, struct drm_display_mode *mode,struct drm_display_mode *adjusted_mode, int x, int y,struct drm_framebuffer *old_fb);
21259  void (* mode_set_nofb) (struct drm_crtc *crtc);
21260  int (* mode_set_base) (struct drm_crtc *crtc, int x, int y,struct drm_framebuffer *old_fb);
21261  int (* mode_set_base_atomic) (struct drm_crtc *crtc,struct drm_framebuffer *fb, int x, int y,enum mode_set_atomic);
21262  void (* load_lut) (struct drm_crtc *crtc);
21263  void (* disable) (struct drm_crtc *crtc);
21264  void (* enable) (struct drm_crtc *crtc);
21265  int (* atomic_check) (struct drm_crtc *crtc,struct drm_crtc_state *state);
21266  void (* atomic_begin) (struct drm_crtc *crtc,struct drm_crtc_state *old_crtc_state);
21267  void (* atomic_flush) (struct drm_crtc *crtc,struct drm_crtc_state *old_crtc_state);
21268};  </programlisting>
21269</refsynopsisdiv>
21270 <refsect1>
21271  <title>Members</title>
21272  <variablelist>
21273    <varlistentry>      <term>dpms</term>
21274      <listitem><para>
21275set power state
21276      </para></listitem>
21277    </varlistentry>
21278    <varlistentry>      <term>prepare</term>
21279      <listitem><para>
21280prepare the CRTC, called before <parameter>mode_set</parameter>
21281      </para></listitem>
21282    </varlistentry>
21283    <varlistentry>      <term>commit</term>
21284      <listitem><para>
21285commit changes to CRTC, called after <parameter>mode_set</parameter>
21286      </para></listitem>
21287    </varlistentry>
21288    <varlistentry>      <term>mode_fixup</term>
21289      <listitem><para>
21290try to fixup proposed mode for this CRTC
21291      </para></listitem>
21292    </varlistentry>
21293    <varlistentry>      <term>mode_set</term>
21294      <listitem><para>
21295set this mode
21296      </para></listitem>
21297    </varlistentry>
21298    <varlistentry>      <term>mode_set_nofb</term>
21299      <listitem><para>
21300set mode only (no scanout buffer attached)
21301      </para></listitem>
21302    </varlistentry>
21303    <varlistentry>      <term>mode_set_base</term>
21304      <listitem><para>
21305update the scanout buffer
21306      </para></listitem>
21307    </varlistentry>
21308    <varlistentry>      <term>mode_set_base_atomic</term>
21309      <listitem><para>
21310non-blocking mode set (used for kgdb support)
21311      </para></listitem>
21312    </varlistentry>
21313    <varlistentry>      <term>load_lut</term>
21314      <listitem><para>
21315load color palette
21316      </para></listitem>
21317    </varlistentry>
21318    <varlistentry>      <term>disable</term>
21319      <listitem><para>
21320disable CRTC when no longer in use
21321      </para></listitem>
21322    </varlistentry>
21323    <varlistentry>      <term>enable</term>
21324      <listitem><para>
21325enable CRTC
21326      </para></listitem>
21327    </varlistentry>
21328    <varlistentry>      <term>atomic_check</term>
21329      <listitem><para>
21330check for validity of an atomic state
21331      </para></listitem>
21332    </varlistentry>
21333    <varlistentry>      <term>atomic_begin</term>
21334      <listitem><para>
21335begin atomic update
21336      </para></listitem>
21337    </varlistentry>
21338    <varlistentry>      <term>atomic_flush</term>
21339      <listitem><para>
21340flush atomic update
21341      </para></listitem>
21342    </varlistentry>
21343  </variablelist>
21344 </refsect1>
21345<refsect1>
21346<title>Description</title>
21347<para>
21348   The helper operations are called by the mid-layer CRTC helper.
21349   </para><para>
21350
21351   Note that with atomic helpers <parameter>dpms</parameter>, <parameter>prepare</parameter> and <parameter>commit</parameter> hooks are
21352   deprecated. Used <parameter>enable</parameter> and <parameter>disable</parameter> instead exclusively.
21353   </para><para>
21354
21355   With legacy crtc helpers there's a big semantic difference between <parameter>disable</parameter>
21356</para>
21357</refsect1>
21358<refsect1>
21359<title>and the other hooks</title>
21360<para>
21361   <parameter>disable</parameter> also needs to release any resources acquired in
21362   <parameter>mode_set</parameter> (like shared PLLs).
21363</para>
21364</refsect1>
21365</refentry>
21366
21367<refentry id="API-struct-drm-encoder-helper-funcs">
21368<refentryinfo>
21369 <title>LINUX</title>
21370 <productname>Kernel Hackers Manual</productname>
21371 <date>July 2017</date>
21372</refentryinfo>
21373<refmeta>
21374 <refentrytitle><phrase>struct drm_encoder_helper_funcs</phrase></refentrytitle>
21375 <manvolnum>9</manvolnum>
21376 <refmiscinfo class="version">4.4.14</refmiscinfo>
21377</refmeta>
21378<refnamediv>
21379 <refname>struct drm_encoder_helper_funcs</refname>
21380 <refpurpose>
21381     helper operations for encoders
21382 </refpurpose>
21383</refnamediv>
21384<refsynopsisdiv>
21385 <title>Synopsis</title>
21386  <programlisting>
21387struct drm_encoder_helper_funcs {
21388  void (* dpms) (struct drm_encoder *encoder, int mode);
21389  void (* save) (struct drm_encoder *encoder);
21390  void (* restore) (struct drm_encoder *encoder);
21391  bool (* mode_fixup) (struct drm_encoder *encoder,const struct drm_display_mode *mode,struct drm_display_mode *adjusted_mode);
21392  void (* prepare) (struct drm_encoder *encoder);
21393  void (* commit) (struct drm_encoder *encoder);
21394  void (* mode_set) (struct drm_encoder *encoder,struct drm_display_mode *mode,struct drm_display_mode *adjusted_mode);
21395  struct drm_crtc *(* get_crtc) (struct drm_encoder *encoder);
21396  enum drm_connector_status (* detect) (struct drm_encoder *encoder,struct drm_connector *connector);
21397  void (* disable) (struct drm_encoder *encoder);
21398  void (* enable) (struct drm_encoder *encoder);
21399  int (* atomic_check) (struct drm_encoder *encoder,struct drm_crtc_state *crtc_state,struct drm_connector_state *conn_state);
21400};  </programlisting>
21401</refsynopsisdiv>
21402 <refsect1>
21403  <title>Members</title>
21404  <variablelist>
21405    <varlistentry>      <term>dpms</term>
21406      <listitem><para>
21407   set power state
21408      </para></listitem>
21409    </varlistentry>
21410    <varlistentry>      <term>save</term>
21411      <listitem><para>
21412   save connector state
21413      </para></listitem>
21414    </varlistentry>
21415    <varlistentry>      <term>restore</term>
21416      <listitem><para>
21417   restore connector state
21418      </para></listitem>
21419    </varlistentry>
21420    <varlistentry>      <term>mode_fixup</term>
21421      <listitem><para>
21422   try to fixup proposed mode for this connector
21423      </para></listitem>
21424    </varlistentry>
21425    <varlistentry>      <term>prepare</term>
21426      <listitem><para>
21427   part of the disable sequence, called before the CRTC modeset
21428      </para></listitem>
21429    </varlistentry>
21430    <varlistentry>      <term>commit</term>
21431      <listitem><para>
21432   called after the CRTC modeset
21433      </para></listitem>
21434    </varlistentry>
21435    <varlistentry>      <term>mode_set</term>
21436      <listitem><para>
21437   set this mode, optional for atomic helpers
21438      </para></listitem>
21439    </varlistentry>
21440    <varlistentry>      <term>get_crtc</term>
21441      <listitem><para>
21442   return CRTC that the encoder is currently attached to
21443      </para></listitem>
21444    </varlistentry>
21445    <varlistentry>      <term>detect</term>
21446      <listitem><para>
21447   connection status detection
21448      </para></listitem>
21449    </varlistentry>
21450    <varlistentry>      <term>disable</term>
21451      <listitem><para>
21452   disable encoder when not in use (overrides DPMS off)
21453      </para></listitem>
21454    </varlistentry>
21455    <varlistentry>      <term>enable</term>
21456      <listitem><para>
21457   enable encoder
21458      </para></listitem>
21459    </varlistentry>
21460    <varlistentry>      <term>atomic_check</term>
21461      <listitem><para>
21462   check for validity of an atomic update
21463      </para></listitem>
21464    </varlistentry>
21465  </variablelist>
21466 </refsect1>
21467<refsect1>
21468<title>Description</title>
21469<para>
21470   The helper operations are called by the mid-layer CRTC helper.
21471   </para><para>
21472
21473   Note that with atomic helpers <parameter>dpms</parameter>, <parameter>prepare</parameter> and <parameter>commit</parameter> hooks are
21474   deprecated. Used <parameter>enable</parameter> and <parameter>disable</parameter> instead exclusively.
21475   </para><para>
21476
21477   With legacy crtc helpers there's a big semantic difference between <parameter>disable</parameter>
21478</para>
21479</refsect1>
21480<refsect1>
21481<title>and the other hooks</title>
21482<para>
21483   <parameter>disable</parameter> also needs to release any resources acquired in
21484   <parameter>mode_set</parameter> (like shared PLLs).
21485</para>
21486</refsect1>
21487</refentry>
21488
21489<refentry id="API-struct-drm-connector-helper-funcs">
21490<refentryinfo>
21491 <title>LINUX</title>
21492 <productname>Kernel Hackers Manual</productname>
21493 <date>July 2017</date>
21494</refentryinfo>
21495<refmeta>
21496 <refentrytitle><phrase>struct drm_connector_helper_funcs</phrase></refentrytitle>
21497 <manvolnum>9</manvolnum>
21498 <refmiscinfo class="version">4.4.14</refmiscinfo>
21499</refmeta>
21500<refnamediv>
21501 <refname>struct drm_connector_helper_funcs</refname>
21502 <refpurpose>
21503     helper operations for connectors
21504 </refpurpose>
21505</refnamediv>
21506<refsynopsisdiv>
21507 <title>Synopsis</title>
21508  <programlisting>
21509struct drm_connector_helper_funcs {
21510  int (* get_modes) (struct drm_connector *connector);
21511  enum drm_mode_status (* mode_valid) (struct drm_connector *connector,struct drm_display_mode *mode);
21512  struct drm_encoder *(* best_encoder) (struct drm_connector *connector);
21513  struct drm_encoder *(* atomic_best_encoder) (struct drm_connector *connector,struct drm_connector_state *connector_state);
21514};  </programlisting>
21515</refsynopsisdiv>
21516 <refsect1>
21517  <title>Members</title>
21518  <variablelist>
21519    <varlistentry>      <term>get_modes</term>
21520      <listitem><para>
21521   get mode list for this connector
21522      </para></listitem>
21523    </varlistentry>
21524    <varlistentry>      <term>mode_valid</term>
21525      <listitem><para>
21526   is this mode valid on the given connector? (optional)
21527      </para></listitem>
21528    </varlistentry>
21529    <varlistentry>      <term>best_encoder</term>
21530      <listitem><para>
21531   return the preferred encoder for this connector
21532      </para></listitem>
21533    </varlistentry>
21534    <varlistentry>      <term>atomic_best_encoder</term>
21535      <listitem><para>
21536   atomic version of <parameter>best_encoder</parameter>
21537      </para></listitem>
21538    </varlistentry>
21539  </variablelist>
21540 </refsect1>
21541<refsect1>
21542<title>Description</title>
21543<para>
21544   The helper operations are called by the mid-layer CRTC helper.
21545</para>
21546</refsect1>
21547</refentry>
21548
21549<!-- drivers/gpu/drm/drm_crtc_helper.c -->
21550<refentry id="API-drm-helper-move-panel-connectors-to-head">
21551<refentryinfo>
21552 <title>LINUX</title>
21553 <productname>Kernel Hackers Manual</productname>
21554 <date>July 2017</date>
21555</refentryinfo>
21556<refmeta>
21557 <refentrytitle><phrase>drm_helper_move_panel_connectors_to_head</phrase></refentrytitle>
21558 <manvolnum>9</manvolnum>
21559 <refmiscinfo class="version">4.4.14</refmiscinfo>
21560</refmeta>
21561<refnamediv>
21562 <refname>drm_helper_move_panel_connectors_to_head</refname>
21563 <refpurpose>
21564  move panels to the front in the connector list
21565 </refpurpose>
21566</refnamediv>
21567<refsynopsisdiv>
21568 <title>Synopsis</title>
21569  <funcsynopsis><funcprototype>
21570   <funcdef>void <function>drm_helper_move_panel_connectors_to_head </function></funcdef>
21571   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
21572  </funcprototype></funcsynopsis>
21573</refsynopsisdiv>
21574<refsect1>
21575 <title>Arguments</title>
21576 <variablelist>
21577  <varlistentry>
21578   <term><parameter>dev</parameter></term>
21579   <listitem>
21580    <para>
21581     drm device to operate on
21582    </para>
21583   </listitem>
21584  </varlistentry>
21585 </variablelist>
21586</refsect1>
21587<refsect1>
21588<title>Description</title>
21589<para>
21590   Some userspace presumes that the first connected connector is the main
21591   display, where it's supposed to display e.g. the login screen. For
21592   laptops, this should be the main panel. Use this function to sort all
21593   (eDP/LVDS) panels to the front of the connector list, instead of
21594   painstakingly trying to initialize them in the right order.
21595</para>
21596</refsect1>
21597</refentry>
21598
21599<refentry id="API-drm-helper-encoder-in-use">
21600<refentryinfo>
21601 <title>LINUX</title>
21602 <productname>Kernel Hackers Manual</productname>
21603 <date>July 2017</date>
21604</refentryinfo>
21605<refmeta>
21606 <refentrytitle><phrase>drm_helper_encoder_in_use</phrase></refentrytitle>
21607 <manvolnum>9</manvolnum>
21608 <refmiscinfo class="version">4.4.14</refmiscinfo>
21609</refmeta>
21610<refnamediv>
21611 <refname>drm_helper_encoder_in_use</refname>
21612 <refpurpose>
21613     check if a given encoder is in use
21614 </refpurpose>
21615</refnamediv>
21616<refsynopsisdiv>
21617 <title>Synopsis</title>
21618  <funcsynopsis><funcprototype>
21619   <funcdef>bool <function>drm_helper_encoder_in_use </function></funcdef>
21620   <paramdef>struct drm_encoder * <parameter>encoder</parameter></paramdef>
21621  </funcprototype></funcsynopsis>
21622</refsynopsisdiv>
21623<refsect1>
21624 <title>Arguments</title>
21625 <variablelist>
21626  <varlistentry>
21627   <term><parameter>encoder</parameter></term>
21628   <listitem>
21629    <para>
21630     encoder to check
21631    </para>
21632   </listitem>
21633  </varlistentry>
21634 </variablelist>
21635</refsect1>
21636<refsect1>
21637<title>Description</title>
21638<para>
21639   Checks whether <parameter>encoder</parameter> is with the current mode setting output configuration
21640   in use by any connector. This doesn't mean that it is actually enabled since
21641   the DPMS state is tracked separately.
21642</para>
21643</refsect1>
21644<refsect1>
21645<title>Returns</title>
21646<para>
21647   True if <parameter>encoder</parameter> is used, false otherwise.
21648</para>
21649</refsect1>
21650</refentry>
21651
21652<refentry id="API-drm-helper-crtc-in-use">
21653<refentryinfo>
21654 <title>LINUX</title>
21655 <productname>Kernel Hackers Manual</productname>
21656 <date>July 2017</date>
21657</refentryinfo>
21658<refmeta>
21659 <refentrytitle><phrase>drm_helper_crtc_in_use</phrase></refentrytitle>
21660 <manvolnum>9</manvolnum>
21661 <refmiscinfo class="version">4.4.14</refmiscinfo>
21662</refmeta>
21663<refnamediv>
21664 <refname>drm_helper_crtc_in_use</refname>
21665 <refpurpose>
21666     check if a given CRTC is in a mode_config
21667 </refpurpose>
21668</refnamediv>
21669<refsynopsisdiv>
21670 <title>Synopsis</title>
21671  <funcsynopsis><funcprototype>
21672   <funcdef>bool <function>drm_helper_crtc_in_use </function></funcdef>
21673   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
21674  </funcprototype></funcsynopsis>
21675</refsynopsisdiv>
21676<refsect1>
21677 <title>Arguments</title>
21678 <variablelist>
21679  <varlistentry>
21680   <term><parameter>crtc</parameter></term>
21681   <listitem>
21682    <para>
21683     CRTC to check
21684    </para>
21685   </listitem>
21686  </varlistentry>
21687 </variablelist>
21688</refsect1>
21689<refsect1>
21690<title>Description</title>
21691<para>
21692   Checks whether <parameter>crtc</parameter> is with the current mode setting output configuration
21693   in use by any connector. This doesn't mean that it is actually enabled since
21694   the DPMS state is tracked separately.
21695</para>
21696</refsect1>
21697<refsect1>
21698<title>Returns</title>
21699<para>
21700   True if <parameter>crtc</parameter> is used, false otherwise.
21701</para>
21702</refsect1>
21703</refentry>
21704
21705<refentry id="API-drm-helper-disable-unused-functions">
21706<refentryinfo>
21707 <title>LINUX</title>
21708 <productname>Kernel Hackers Manual</productname>
21709 <date>July 2017</date>
21710</refentryinfo>
21711<refmeta>
21712 <refentrytitle><phrase>drm_helper_disable_unused_functions</phrase></refentrytitle>
21713 <manvolnum>9</manvolnum>
21714 <refmiscinfo class="version">4.4.14</refmiscinfo>
21715</refmeta>
21716<refnamediv>
21717 <refname>drm_helper_disable_unused_functions</refname>
21718 <refpurpose>
21719     disable unused objects
21720 </refpurpose>
21721</refnamediv>
21722<refsynopsisdiv>
21723 <title>Synopsis</title>
21724  <funcsynopsis><funcprototype>
21725   <funcdef>void <function>drm_helper_disable_unused_functions </function></funcdef>
21726   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
21727  </funcprototype></funcsynopsis>
21728</refsynopsisdiv>
21729<refsect1>
21730 <title>Arguments</title>
21731 <variablelist>
21732  <varlistentry>
21733   <term><parameter>dev</parameter></term>
21734   <listitem>
21735    <para>
21736     DRM device
21737    </para>
21738   </listitem>
21739  </varlistentry>
21740 </variablelist>
21741</refsect1>
21742<refsect1>
21743<title>Description</title>
21744<para>
21745   This function walks through the entire mode setting configuration of <parameter>dev</parameter>. It
21746   will remove any crtc links of unused encoders and encoder links of
21747   disconnected connectors. Then it will disable all unused encoders and crtcs
21748   either by calling their disable callback if available or by calling their
21749   dpms callback with DRM_MODE_DPMS_OFF.
21750</para>
21751</refsect1>
21752</refentry>
21753
21754<refentry id="API-drm-crtc-helper-set-mode">
21755<refentryinfo>
21756 <title>LINUX</title>
21757 <productname>Kernel Hackers Manual</productname>
21758 <date>July 2017</date>
21759</refentryinfo>
21760<refmeta>
21761 <refentrytitle><phrase>drm_crtc_helper_set_mode</phrase></refentrytitle>
21762 <manvolnum>9</manvolnum>
21763 <refmiscinfo class="version">4.4.14</refmiscinfo>
21764</refmeta>
21765<refnamediv>
21766 <refname>drm_crtc_helper_set_mode</refname>
21767 <refpurpose>
21768     internal helper to set a mode
21769 </refpurpose>
21770</refnamediv>
21771<refsynopsisdiv>
21772 <title>Synopsis</title>
21773  <funcsynopsis><funcprototype>
21774   <funcdef>bool <function>drm_crtc_helper_set_mode </function></funcdef>
21775   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
21776   <paramdef>struct drm_display_mode * <parameter>mode</parameter></paramdef>
21777   <paramdef>int <parameter>x</parameter></paramdef>
21778   <paramdef>int <parameter>y</parameter></paramdef>
21779   <paramdef>struct drm_framebuffer * <parameter>old_fb</parameter></paramdef>
21780  </funcprototype></funcsynopsis>
21781</refsynopsisdiv>
21782<refsect1>
21783 <title>Arguments</title>
21784 <variablelist>
21785  <varlistentry>
21786   <term><parameter>crtc</parameter></term>
21787   <listitem>
21788    <para>
21789     CRTC to program
21790    </para>
21791   </listitem>
21792  </varlistentry>
21793  <varlistentry>
21794   <term><parameter>mode</parameter></term>
21795   <listitem>
21796    <para>
21797     mode to use
21798    </para>
21799   </listitem>
21800  </varlistentry>
21801  <varlistentry>
21802   <term><parameter>x</parameter></term>
21803   <listitem>
21804    <para>
21805     horizontal offset into the surface
21806    </para>
21807   </listitem>
21808  </varlistentry>
21809  <varlistentry>
21810   <term><parameter>y</parameter></term>
21811   <listitem>
21812    <para>
21813     vertical offset into the surface
21814    </para>
21815   </listitem>
21816  </varlistentry>
21817  <varlistentry>
21818   <term><parameter>old_fb</parameter></term>
21819   <listitem>
21820    <para>
21821     old framebuffer, for cleanup
21822    </para>
21823   </listitem>
21824  </varlistentry>
21825 </variablelist>
21826</refsect1>
21827<refsect1>
21828<title>Description</title>
21829<para>
21830   Try to set <parameter>mode</parameter> on <parameter>crtc</parameter>.  Give <parameter>crtc</parameter> and its associated connectors a chance
21831   to fixup or reject the mode prior to trying to set it. This is an internal
21832   helper that drivers could e.g. use to update properties that require the
21833   entire output pipe to be disabled and re-enabled in a new configuration. For
21834   example for changing whether audio is enabled on a hdmi link or for changing
21835   panel fitter or dither attributes. It is also called by the
21836   <function>drm_crtc_helper_set_config</function> helper function to drive the mode setting
21837   sequence.
21838</para>
21839</refsect1>
21840<refsect1>
21841<title>Returns</title>
21842<para>
21843   True if the mode was set successfully, false otherwise.
21844</para>
21845</refsect1>
21846</refentry>
21847
21848<refentry id="API-drm-crtc-helper-set-config">
21849<refentryinfo>
21850 <title>LINUX</title>
21851 <productname>Kernel Hackers Manual</productname>
21852 <date>July 2017</date>
21853</refentryinfo>
21854<refmeta>
21855 <refentrytitle><phrase>drm_crtc_helper_set_config</phrase></refentrytitle>
21856 <manvolnum>9</manvolnum>
21857 <refmiscinfo class="version">4.4.14</refmiscinfo>
21858</refmeta>
21859<refnamediv>
21860 <refname>drm_crtc_helper_set_config</refname>
21861 <refpurpose>
21862     set a new config from userspace
21863 </refpurpose>
21864</refnamediv>
21865<refsynopsisdiv>
21866 <title>Synopsis</title>
21867  <funcsynopsis><funcprototype>
21868   <funcdef>int <function>drm_crtc_helper_set_config </function></funcdef>
21869   <paramdef>struct drm_mode_set * <parameter>set</parameter></paramdef>
21870  </funcprototype></funcsynopsis>
21871</refsynopsisdiv>
21872<refsect1>
21873 <title>Arguments</title>
21874 <variablelist>
21875  <varlistentry>
21876   <term><parameter>set</parameter></term>
21877   <listitem>
21878    <para>
21879     mode set configuration
21880    </para>
21881   </listitem>
21882  </varlistentry>
21883 </variablelist>
21884</refsect1>
21885<refsect1>
21886<title>Description</title>
21887<para>
21888   Setup a new configuration, provided by the upper layers (either an ioctl call
21889   from userspace or internally e.g. from the fbdev support code) in <parameter>set</parameter>, and
21890   enable it. This is the main helper functions for drivers that implement
21891   kernel mode setting with the crtc helper functions and the assorted
21892   -&gt;<function>prepare</function>, -&gt;<function>modeset</function> and -&gt;<function>commit</function> helper callbacks.
21893</para>
21894</refsect1>
21895<refsect1>
21896<title>Returns</title>
21897<para>
21898   Returns 0 on success, negative errno numbers on failure.
21899</para>
21900</refsect1>
21901</refentry>
21902
21903<refentry id="API-drm-helper-connector-dpms">
21904<refentryinfo>
21905 <title>LINUX</title>
21906 <productname>Kernel Hackers Manual</productname>
21907 <date>July 2017</date>
21908</refentryinfo>
21909<refmeta>
21910 <refentrytitle><phrase>drm_helper_connector_dpms</phrase></refentrytitle>
21911 <manvolnum>9</manvolnum>
21912 <refmiscinfo class="version">4.4.14</refmiscinfo>
21913</refmeta>
21914<refnamediv>
21915 <refname>drm_helper_connector_dpms</refname>
21916 <refpurpose>
21917     connector dpms helper implementation
21918 </refpurpose>
21919</refnamediv>
21920<refsynopsisdiv>
21921 <title>Synopsis</title>
21922  <funcsynopsis><funcprototype>
21923   <funcdef>int <function>drm_helper_connector_dpms </function></funcdef>
21924   <paramdef>struct drm_connector * <parameter>connector</parameter></paramdef>
21925   <paramdef>int <parameter>mode</parameter></paramdef>
21926  </funcprototype></funcsynopsis>
21927</refsynopsisdiv>
21928<refsect1>
21929 <title>Arguments</title>
21930 <variablelist>
21931  <varlistentry>
21932   <term><parameter>connector</parameter></term>
21933   <listitem>
21934    <para>
21935     affected connector
21936    </para>
21937   </listitem>
21938  </varlistentry>
21939  <varlistentry>
21940   <term><parameter>mode</parameter></term>
21941   <listitem>
21942    <para>
21943     DPMS mode
21944    </para>
21945   </listitem>
21946  </varlistentry>
21947 </variablelist>
21948</refsect1>
21949<refsect1>
21950<title>Description</title>
21951<para>
21952   This is the main helper function provided by the crtc helper framework for
21953   implementing the DPMS connector attribute. It computes the new desired DPMS
21954   state for all encoders and crtcs in the output mesh and calls the -&gt;<function>dpms</function>
21955   callback provided by the driver appropriately.
21956</para>
21957</refsect1>
21958<refsect1>
21959<title>Returns</title>
21960<para>
21961   Always returns 0.
21962</para>
21963</refsect1>
21964</refentry>
21965
21966<refentry id="API-drm-helper-mode-fill-fb-struct">
21967<refentryinfo>
21968 <title>LINUX</title>
21969 <productname>Kernel Hackers Manual</productname>
21970 <date>July 2017</date>
21971</refentryinfo>
21972<refmeta>
21973 <refentrytitle><phrase>drm_helper_mode_fill_fb_struct</phrase></refentrytitle>
21974 <manvolnum>9</manvolnum>
21975 <refmiscinfo class="version">4.4.14</refmiscinfo>
21976</refmeta>
21977<refnamediv>
21978 <refname>drm_helper_mode_fill_fb_struct</refname>
21979 <refpurpose>
21980     fill out framebuffer metadata
21981 </refpurpose>
21982</refnamediv>
21983<refsynopsisdiv>
21984 <title>Synopsis</title>
21985  <funcsynopsis><funcprototype>
21986   <funcdef>void <function>drm_helper_mode_fill_fb_struct </function></funcdef>
21987   <paramdef>struct drm_framebuffer * <parameter>fb</parameter></paramdef>
21988   <paramdef>struct drm_mode_fb_cmd2 * <parameter>mode_cmd</parameter></paramdef>
21989  </funcprototype></funcsynopsis>
21990</refsynopsisdiv>
21991<refsect1>
21992 <title>Arguments</title>
21993 <variablelist>
21994  <varlistentry>
21995   <term><parameter>fb</parameter></term>
21996   <listitem>
21997    <para>
21998     drm_framebuffer object to fill out
21999    </para>
22000   </listitem>
22001  </varlistentry>
22002  <varlistentry>
22003   <term><parameter>mode_cmd</parameter></term>
22004   <listitem>
22005    <para>
22006     metadata from the userspace fb creation request
22007    </para>
22008   </listitem>
22009  </varlistentry>
22010 </variablelist>
22011</refsect1>
22012<refsect1>
22013<title>Description</title>
22014<para>
22015   This helper can be used in a drivers fb_create callback to pre-fill the fb's
22016   metadata fields.
22017</para>
22018</refsect1>
22019</refentry>
22020
22021<refentry id="API-drm-helper-resume-force-mode">
22022<refentryinfo>
22023 <title>LINUX</title>
22024 <productname>Kernel Hackers Manual</productname>
22025 <date>July 2017</date>
22026</refentryinfo>
22027<refmeta>
22028 <refentrytitle><phrase>drm_helper_resume_force_mode</phrase></refentrytitle>
22029 <manvolnum>9</manvolnum>
22030 <refmiscinfo class="version">4.4.14</refmiscinfo>
22031</refmeta>
22032<refnamediv>
22033 <refname>drm_helper_resume_force_mode</refname>
22034 <refpurpose>
22035     force-restore mode setting configuration
22036 </refpurpose>
22037</refnamediv>
22038<refsynopsisdiv>
22039 <title>Synopsis</title>
22040  <funcsynopsis><funcprototype>
22041   <funcdef>void <function>drm_helper_resume_force_mode </function></funcdef>
22042   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
22043  </funcprototype></funcsynopsis>
22044</refsynopsisdiv>
22045<refsect1>
22046 <title>Arguments</title>
22047 <variablelist>
22048  <varlistentry>
22049   <term><parameter>dev</parameter></term>
22050   <listitem>
22051    <para>
22052     drm_device which should be restored
22053    </para>
22054   </listitem>
22055  </varlistentry>
22056 </variablelist>
22057</refsect1>
22058<refsect1>
22059<title>Description</title>
22060<para>
22061   Drivers which use the mode setting helpers can use this function to
22062   force-restore the mode setting configuration e.g. on resume or when something
22063   else might have trampled over the hw state (like some overzealous old BIOSen
22064   tended to do).
22065   </para><para>
22066
22067   This helper doesn't provide a error return value since restoring the old
22068   config should never fail due to resource allocation issues since the driver
22069   has successfully set the restored configuration already. Hence this should
22070   boil down to the equivalent of a few dpms on calls, which also don't provide
22071   an error code.
22072   </para><para>
22073
22074   Drivers where simply restoring an old configuration again might fail (e.g.
22075   due to slight differences in allocating shared resources when the
22076   configuration is restored in a different order than when userspace set it up)
22077   need to use their own restore logic.
22078</para>
22079</refsect1>
22080</refentry>
22081
22082<refentry id="API-drm-helper-crtc-mode-set">
22083<refentryinfo>
22084 <title>LINUX</title>
22085 <productname>Kernel Hackers Manual</productname>
22086 <date>July 2017</date>
22087</refentryinfo>
22088<refmeta>
22089 <refentrytitle><phrase>drm_helper_crtc_mode_set</phrase></refentrytitle>
22090 <manvolnum>9</manvolnum>
22091 <refmiscinfo class="version">4.4.14</refmiscinfo>
22092</refmeta>
22093<refnamediv>
22094 <refname>drm_helper_crtc_mode_set</refname>
22095 <refpurpose>
22096     mode_set implementation for atomic plane helpers
22097 </refpurpose>
22098</refnamediv>
22099<refsynopsisdiv>
22100 <title>Synopsis</title>
22101  <funcsynopsis><funcprototype>
22102   <funcdef>int <function>drm_helper_crtc_mode_set </function></funcdef>
22103   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
22104   <paramdef>struct drm_display_mode * <parameter>mode</parameter></paramdef>
22105   <paramdef>struct drm_display_mode * <parameter>adjusted_mode</parameter></paramdef>
22106   <paramdef>int <parameter>x</parameter></paramdef>
22107   <paramdef>int <parameter>y</parameter></paramdef>
22108   <paramdef>struct drm_framebuffer * <parameter>old_fb</parameter></paramdef>
22109  </funcprototype></funcsynopsis>
22110</refsynopsisdiv>
22111<refsect1>
22112 <title>Arguments</title>
22113 <variablelist>
22114  <varlistentry>
22115   <term><parameter>crtc</parameter></term>
22116   <listitem>
22117    <para>
22118     DRM CRTC
22119    </para>
22120   </listitem>
22121  </varlistentry>
22122  <varlistentry>
22123   <term><parameter>mode</parameter></term>
22124   <listitem>
22125    <para>
22126     DRM display mode which userspace requested
22127    </para>
22128   </listitem>
22129  </varlistentry>
22130  <varlistentry>
22131   <term><parameter>adjusted_mode</parameter></term>
22132   <listitem>
22133    <para>
22134     DRM display mode adjusted by -&gt;mode_fixup callbacks
22135    </para>
22136   </listitem>
22137  </varlistentry>
22138  <varlistentry>
22139   <term><parameter>x</parameter></term>
22140   <listitem>
22141    <para>
22142     x offset of the CRTC scanout area on the underlying framebuffer
22143    </para>
22144   </listitem>
22145  </varlistentry>
22146  <varlistentry>
22147   <term><parameter>y</parameter></term>
22148   <listitem>
22149    <para>
22150     y offset of the CRTC scanout area on the underlying framebuffer
22151    </para>
22152   </listitem>
22153  </varlistentry>
22154  <varlistentry>
22155   <term><parameter>old_fb</parameter></term>
22156   <listitem>
22157    <para>
22158     previous framebuffer
22159    </para>
22160   </listitem>
22161  </varlistentry>
22162 </variablelist>
22163</refsect1>
22164<refsect1>
22165<title>Description</title>
22166<para>
22167   This function implements a callback useable as the -&gt;mode_set callback
22168   required by the crtc helpers. Besides the atomic plane helper functions for
22169   the primary plane the driver must also provide the -&gt;mode_set_nofb callback
22170   to set up the crtc.
22171   </para><para>
22172
22173   This is a transitional helper useful for converting drivers to the atomic
22174   interfaces.
22175</para>
22176</refsect1>
22177</refentry>
22178
22179<refentry id="API-drm-helper-crtc-mode-set-base">
22180<refentryinfo>
22181 <title>LINUX</title>
22182 <productname>Kernel Hackers Manual</productname>
22183 <date>July 2017</date>
22184</refentryinfo>
22185<refmeta>
22186 <refentrytitle><phrase>drm_helper_crtc_mode_set_base</phrase></refentrytitle>
22187 <manvolnum>9</manvolnum>
22188 <refmiscinfo class="version">4.4.14</refmiscinfo>
22189</refmeta>
22190<refnamediv>
22191 <refname>drm_helper_crtc_mode_set_base</refname>
22192 <refpurpose>
22193     mode_set_base implementation for atomic plane helpers
22194 </refpurpose>
22195</refnamediv>
22196<refsynopsisdiv>
22197 <title>Synopsis</title>
22198  <funcsynopsis><funcprototype>
22199   <funcdef>int <function>drm_helper_crtc_mode_set_base </function></funcdef>
22200   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
22201   <paramdef>int <parameter>x</parameter></paramdef>
22202   <paramdef>int <parameter>y</parameter></paramdef>
22203   <paramdef>struct drm_framebuffer * <parameter>old_fb</parameter></paramdef>
22204  </funcprototype></funcsynopsis>
22205</refsynopsisdiv>
22206<refsect1>
22207 <title>Arguments</title>
22208 <variablelist>
22209  <varlistentry>
22210   <term><parameter>crtc</parameter></term>
22211   <listitem>
22212    <para>
22213     DRM CRTC
22214    </para>
22215   </listitem>
22216  </varlistentry>
22217  <varlistentry>
22218   <term><parameter>x</parameter></term>
22219   <listitem>
22220    <para>
22221     x offset of the CRTC scanout area on the underlying framebuffer
22222    </para>
22223   </listitem>
22224  </varlistentry>
22225  <varlistentry>
22226   <term><parameter>y</parameter></term>
22227   <listitem>
22228    <para>
22229     y offset of the CRTC scanout area on the underlying framebuffer
22230    </para>
22231   </listitem>
22232  </varlistentry>
22233  <varlistentry>
22234   <term><parameter>old_fb</parameter></term>
22235   <listitem>
22236    <para>
22237     previous framebuffer
22238    </para>
22239   </listitem>
22240  </varlistentry>
22241 </variablelist>
22242</refsect1>
22243<refsect1>
22244<title>Description</title>
22245<para>
22246   This function implements a callback useable as the -&gt;mode_set_base used
22247   required by the crtc helpers. The driver must provide the atomic plane helper
22248   functions for the primary plane.
22249   </para><para>
22250
22251   This is a transitional helper useful for converting drivers to the atomic
22252   interfaces.
22253</para>
22254</refsect1>
22255</refentry>
22256
22257<para>
22258   </para><para>
22259   The CRTC modeset helper library provides a default set_config implementation
22260   in <function>drm_crtc_helper_set_config</function>. Plus a few other convenience functions using
22261   the same callbacks which drivers can use to e.g. restore the modeset
22262   configuration on resume with <function>drm_helper_resume_force_mode</function>.
22263   </para><para>
22264   The driver callbacks are mostly compatible with the atomic modeset helpers,
22265   except for the handling of the primary plane: Atomic helpers require that the
22266   primary plane is implemented as a real standalone plane and not directly tied
22267   to the CRTC state. For easier transition this library provides functions to
22268   implement the old semantics required by the CRTC helpers using the new plane
22269   and atomic helper callbacks.
22270   </para><para>
22271   Drivers are strongly urged to convert to the atomic helpers (by way of first
22272   converting to the plane helpers). New drivers must not use these functions
22273   but need to implement the atomic interface instead, potentially using the
22274   atomic helpers for that.
22275</para>
22276
22277    </sect2>
22278    <sect2>
22279      <title>Output Probing Helper Functions Reference</title>
22280<para>
22281   </para><para>
22282   This library provides some helper code for output probing. It provides an
22283   implementation of the core connector-&gt;fill_modes interface with
22284   drm_helper_probe_single_connector_modes.
22285   </para><para>
22286   It also provides support for polling connectors with a work item and for
22287   generic hotplug interrupt handling where the driver doesn't or cannot keep
22288   track of a per-connector hpd interrupt.
22289   </para><para>
22290   This helper library can be used independently of the modeset helper library.
22291   Drivers can also overwrite different parts e.g. use their own hotplug
22292   handling code to avoid probing unrelated outputs.
22293</para>
22294
22295<!-- drivers/gpu/drm/drm_probe_helper.c -->
22296<refentry id="API-drm-kms-helper-poll-enable-locked">
22297<refentryinfo>
22298 <title>LINUX</title>
22299 <productname>Kernel Hackers Manual</productname>
22300 <date>July 2017</date>
22301</refentryinfo>
22302<refmeta>
22303 <refentrytitle><phrase>drm_kms_helper_poll_enable_locked</phrase></refentrytitle>
22304 <manvolnum>9</manvolnum>
22305 <refmiscinfo class="version">4.4.14</refmiscinfo>
22306</refmeta>
22307<refnamediv>
22308 <refname>drm_kms_helper_poll_enable_locked</refname>
22309 <refpurpose>
22310  re-enable output polling.
22311 </refpurpose>
22312</refnamediv>
22313<refsynopsisdiv>
22314 <title>Synopsis</title>
22315  <funcsynopsis><funcprototype>
22316   <funcdef>void <function>drm_kms_helper_poll_enable_locked </function></funcdef>
22317   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
22318  </funcprototype></funcsynopsis>
22319</refsynopsisdiv>
22320<refsect1>
22321 <title>Arguments</title>
22322 <variablelist>
22323  <varlistentry>
22324   <term><parameter>dev</parameter></term>
22325   <listitem>
22326    <para>
22327     drm_device
22328    </para>
22329   </listitem>
22330  </varlistentry>
22331 </variablelist>
22332</refsect1>
22333<refsect1>
22334<title>Description</title>
22335<para>
22336   This function re-enables the output polling work without
22337   locking the mode_config mutex.
22338   </para><para>
22339
22340   This is like <function>drm_kms_helper_poll_enable</function> however it is to be
22341   called from a context where the mode_config mutex is locked
22342   already.
22343</para>
22344</refsect1>
22345</refentry>
22346
22347<refentry id="API-drm-helper-probe-single-connector-modes">
22348<refentryinfo>
22349 <title>LINUX</title>
22350 <productname>Kernel Hackers Manual</productname>
22351 <date>July 2017</date>
22352</refentryinfo>
22353<refmeta>
22354 <refentrytitle><phrase>drm_helper_probe_single_connector_modes</phrase></refentrytitle>
22355 <manvolnum>9</manvolnum>
22356 <refmiscinfo class="version">4.4.14</refmiscinfo>
22357</refmeta>
22358<refnamediv>
22359 <refname>drm_helper_probe_single_connector_modes</refname>
22360 <refpurpose>
22361     get complete set of display modes
22362 </refpurpose>
22363</refnamediv>
22364<refsynopsisdiv>
22365 <title>Synopsis</title>
22366  <funcsynopsis><funcprototype>
22367   <funcdef>int <function>drm_helper_probe_single_connector_modes </function></funcdef>
22368   <paramdef>struct drm_connector * <parameter>connector</parameter></paramdef>
22369   <paramdef>uint32_t <parameter>maxX</parameter></paramdef>
22370   <paramdef>uint32_t <parameter>maxY</parameter></paramdef>
22371  </funcprototype></funcsynopsis>
22372</refsynopsisdiv>
22373<refsect1>
22374 <title>Arguments</title>
22375 <variablelist>
22376  <varlistentry>
22377   <term><parameter>connector</parameter></term>
22378   <listitem>
22379    <para>
22380     connector to probe
22381    </para>
22382   </listitem>
22383  </varlistentry>
22384  <varlistentry>
22385   <term><parameter>maxX</parameter></term>
22386   <listitem>
22387    <para>
22388     max width for modes
22389    </para>
22390   </listitem>
22391  </varlistentry>
22392  <varlistentry>
22393   <term><parameter>maxY</parameter></term>
22394   <listitem>
22395    <para>
22396     max height for modes
22397    </para>
22398   </listitem>
22399  </varlistentry>
22400 </variablelist>
22401</refsect1>
22402<refsect1>
22403<title>Description</title>
22404<para>
22405   Based on the helper callbacks implemented by <parameter>connector</parameter> try to detect all
22406   valid modes.  Modes will first be added to the connector's probed_modes list,
22407   then culled (based on validity and the <parameter>maxX</parameter>, <parameter>maxY</parameter> parameters) and put into
22408   the normal modes list.
22409   </para><para>
22410
22411   Intended to be use as a generic implementation of the -&gt;<function>fill_modes</function>
22412   <parameter>connector</parameter> vfunc for drivers that use the crtc helpers for output mode
22413   filtering and detection.
22414</para>
22415</refsect1>
22416<refsect1>
22417<title>Returns</title>
22418<para>
22419   The number of modes found on <parameter>connector</parameter>.
22420</para>
22421</refsect1>
22422</refentry>
22423
22424<refentry id="API-drm-helper-probe-single-connector-modes-nomerge">
22425<refentryinfo>
22426 <title>LINUX</title>
22427 <productname>Kernel Hackers Manual</productname>
22428 <date>July 2017</date>
22429</refentryinfo>
22430<refmeta>
22431 <refentrytitle><phrase>drm_helper_probe_single_connector_modes_nomerge</phrase></refentrytitle>
22432 <manvolnum>9</manvolnum>
22433 <refmiscinfo class="version">4.4.14</refmiscinfo>
22434</refmeta>
22435<refnamediv>
22436 <refname>drm_helper_probe_single_connector_modes_nomerge</refname>
22437 <refpurpose>
22438     get complete set of display modes
22439 </refpurpose>
22440</refnamediv>
22441<refsynopsisdiv>
22442 <title>Synopsis</title>
22443  <funcsynopsis><funcprototype>
22444   <funcdef>int <function>drm_helper_probe_single_connector_modes_nomerge </function></funcdef>
22445   <paramdef>struct drm_connector * <parameter>connector</parameter></paramdef>
22446   <paramdef>uint32_t <parameter>maxX</parameter></paramdef>
22447   <paramdef>uint32_t <parameter>maxY</parameter></paramdef>
22448  </funcprototype></funcsynopsis>
22449</refsynopsisdiv>
22450<refsect1>
22451 <title>Arguments</title>
22452 <variablelist>
22453  <varlistentry>
22454   <term><parameter>connector</parameter></term>
22455   <listitem>
22456    <para>
22457     connector to probe
22458    </para>
22459   </listitem>
22460  </varlistentry>
22461  <varlistentry>
22462   <term><parameter>maxX</parameter></term>
22463   <listitem>
22464    <para>
22465     max width for modes
22466    </para>
22467   </listitem>
22468  </varlistentry>
22469  <varlistentry>
22470   <term><parameter>maxY</parameter></term>
22471   <listitem>
22472    <para>
22473     max height for modes
22474    </para>
22475   </listitem>
22476  </varlistentry>
22477 </variablelist>
22478</refsect1>
22479<refsect1>
22480<title>Description</title>
22481<para>
22482   This operates like drm_hehlper_probe_single_connector_modes except it
22483   replaces the mode bits instead of merging them for preferred modes.
22484</para>
22485</refsect1>
22486</refentry>
22487
22488<refentry id="API-drm-kms-helper-hotplug-event">
22489<refentryinfo>
22490 <title>LINUX</title>
22491 <productname>Kernel Hackers Manual</productname>
22492 <date>July 2017</date>
22493</refentryinfo>
22494<refmeta>
22495 <refentrytitle><phrase>drm_kms_helper_hotplug_event</phrase></refentrytitle>
22496 <manvolnum>9</manvolnum>
22497 <refmiscinfo class="version">4.4.14</refmiscinfo>
22498</refmeta>
22499<refnamediv>
22500 <refname>drm_kms_helper_hotplug_event</refname>
22501 <refpurpose>
22502     fire off KMS hotplug events
22503 </refpurpose>
22504</refnamediv>
22505<refsynopsisdiv>
22506 <title>Synopsis</title>
22507  <funcsynopsis><funcprototype>
22508   <funcdef>void <function>drm_kms_helper_hotplug_event </function></funcdef>
22509   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
22510  </funcprototype></funcsynopsis>
22511</refsynopsisdiv>
22512<refsect1>
22513 <title>Arguments</title>
22514 <variablelist>
22515  <varlistentry>
22516   <term><parameter>dev</parameter></term>
22517   <listitem>
22518    <para>
22519     drm_device whose connector state changed
22520    </para>
22521   </listitem>
22522  </varlistentry>
22523 </variablelist>
22524</refsect1>
22525<refsect1>
22526<title>Description</title>
22527<para>
22528   This function fires off the uevent for userspace and also calls the
22529   output_poll_changed function, which is most commonly used to inform the fbdev
22530   emulation code and allow it to update the fbcon output configuration.
22531   </para><para>
22532
22533   Drivers should call this from their hotplug handling code when a change is
22534   detected. Note that this function does not do any output detection of its
22535   own, like <function>drm_helper_hpd_irq_event</function> does - this is assumed to be done by the
22536   driver already.
22537   </para><para>
22538
22539   This function must be called from process context with no mode
22540   setting locks held.
22541</para>
22542</refsect1>
22543</refentry>
22544
22545<refentry id="API-drm-kms-helper-poll-disable">
22546<refentryinfo>
22547 <title>LINUX</title>
22548 <productname>Kernel Hackers Manual</productname>
22549 <date>July 2017</date>
22550</refentryinfo>
22551<refmeta>
22552 <refentrytitle><phrase>drm_kms_helper_poll_disable</phrase></refentrytitle>
22553 <manvolnum>9</manvolnum>
22554 <refmiscinfo class="version">4.4.14</refmiscinfo>
22555</refmeta>
22556<refnamediv>
22557 <refname>drm_kms_helper_poll_disable</refname>
22558 <refpurpose>
22559     disable output polling
22560 </refpurpose>
22561</refnamediv>
22562<refsynopsisdiv>
22563 <title>Synopsis</title>
22564  <funcsynopsis><funcprototype>
22565   <funcdef>void <function>drm_kms_helper_poll_disable </function></funcdef>
22566   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
22567  </funcprototype></funcsynopsis>
22568</refsynopsisdiv>
22569<refsect1>
22570 <title>Arguments</title>
22571 <variablelist>
22572  <varlistentry>
22573   <term><parameter>dev</parameter></term>
22574   <listitem>
22575    <para>
22576     drm_device
22577    </para>
22578   </listitem>
22579  </varlistentry>
22580 </variablelist>
22581</refsect1>
22582<refsect1>
22583<title>Description</title>
22584<para>
22585   This function disables the output polling work.
22586   </para><para>
22587
22588   Drivers can call this helper from their device suspend implementation. It is
22589   not an error to call this even when output polling isn't enabled or arlready
22590   disabled.
22591</para>
22592</refsect1>
22593</refentry>
22594
22595<refentry id="API-drm-kms-helper-poll-enable">
22596<refentryinfo>
22597 <title>LINUX</title>
22598 <productname>Kernel Hackers Manual</productname>
22599 <date>July 2017</date>
22600</refentryinfo>
22601<refmeta>
22602 <refentrytitle><phrase>drm_kms_helper_poll_enable</phrase></refentrytitle>
22603 <manvolnum>9</manvolnum>
22604 <refmiscinfo class="version">4.4.14</refmiscinfo>
22605</refmeta>
22606<refnamediv>
22607 <refname>drm_kms_helper_poll_enable</refname>
22608 <refpurpose>
22609     re-enable output polling.
22610 </refpurpose>
22611</refnamediv>
22612<refsynopsisdiv>
22613 <title>Synopsis</title>
22614  <funcsynopsis><funcprototype>
22615   <funcdef>void <function>drm_kms_helper_poll_enable </function></funcdef>
22616   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
22617  </funcprototype></funcsynopsis>
22618</refsynopsisdiv>
22619<refsect1>
22620 <title>Arguments</title>
22621 <variablelist>
22622  <varlistentry>
22623   <term><parameter>dev</parameter></term>
22624   <listitem>
22625    <para>
22626     drm_device
22627    </para>
22628   </listitem>
22629  </varlistentry>
22630 </variablelist>
22631</refsect1>
22632<refsect1>
22633<title>Description</title>
22634<para>
22635   This function re-enables the output polling work.
22636   </para><para>
22637
22638   Drivers can call this helper from their device resume implementation. It is
22639   an error to call this when the output polling support has not yet been set
22640   up.
22641</para>
22642</refsect1>
22643</refentry>
22644
22645<refentry id="API-drm-kms-helper-poll-init">
22646<refentryinfo>
22647 <title>LINUX</title>
22648 <productname>Kernel Hackers Manual</productname>
22649 <date>July 2017</date>
22650</refentryinfo>
22651<refmeta>
22652 <refentrytitle><phrase>drm_kms_helper_poll_init</phrase></refentrytitle>
22653 <manvolnum>9</manvolnum>
22654 <refmiscinfo class="version">4.4.14</refmiscinfo>
22655</refmeta>
22656<refnamediv>
22657 <refname>drm_kms_helper_poll_init</refname>
22658 <refpurpose>
22659     initialize and enable output polling
22660 </refpurpose>
22661</refnamediv>
22662<refsynopsisdiv>
22663 <title>Synopsis</title>
22664  <funcsynopsis><funcprototype>
22665   <funcdef>void <function>drm_kms_helper_poll_init </function></funcdef>
22666   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
22667  </funcprototype></funcsynopsis>
22668</refsynopsisdiv>
22669<refsect1>
22670 <title>Arguments</title>
22671 <variablelist>
22672  <varlistentry>
22673   <term><parameter>dev</parameter></term>
22674   <listitem>
22675    <para>
22676     drm_device
22677    </para>
22678   </listitem>
22679  </varlistentry>
22680 </variablelist>
22681</refsect1>
22682<refsect1>
22683<title>Description</title>
22684<para>
22685   This function intializes and then also enables output polling support for
22686   <parameter>dev</parameter>. Drivers which do not have reliable hotplug support in hardware can use
22687   this helper infrastructure to regularly poll such connectors for changes in
22688   their connection state.
22689   </para><para>
22690
22691   Drivers can control which connectors are polled by setting the
22692   DRM_CONNECTOR_POLL_CONNECT and DRM_CONNECTOR_POLL_DISCONNECT flags. On
22693   connectors where probing live outputs can result in visual distortion drivers
22694   should not set the DRM_CONNECTOR_POLL_DISCONNECT flag to avoid this.
22695   Connectors which have no flag or only DRM_CONNECTOR_POLL_HPD set are
22696   completely ignored by the polling logic.
22697   </para><para>
22698
22699   Note that a connector can be both polled and probed from the hotplug handler,
22700   in case the hotplug interrupt is known to be unreliable.
22701</para>
22702</refsect1>
22703</refentry>
22704
22705<refentry id="API-drm-kms-helper-poll-fini">
22706<refentryinfo>
22707 <title>LINUX</title>
22708 <productname>Kernel Hackers Manual</productname>
22709 <date>July 2017</date>
22710</refentryinfo>
22711<refmeta>
22712 <refentrytitle><phrase>drm_kms_helper_poll_fini</phrase></refentrytitle>
22713 <manvolnum>9</manvolnum>
22714 <refmiscinfo class="version">4.4.14</refmiscinfo>
22715</refmeta>
22716<refnamediv>
22717 <refname>drm_kms_helper_poll_fini</refname>
22718 <refpurpose>
22719     disable output polling and clean it up
22720 </refpurpose>
22721</refnamediv>
22722<refsynopsisdiv>
22723 <title>Synopsis</title>
22724  <funcsynopsis><funcprototype>
22725   <funcdef>void <function>drm_kms_helper_poll_fini </function></funcdef>
22726   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
22727  </funcprototype></funcsynopsis>
22728</refsynopsisdiv>
22729<refsect1>
22730 <title>Arguments</title>
22731 <variablelist>
22732  <varlistentry>
22733   <term><parameter>dev</parameter></term>
22734   <listitem>
22735    <para>
22736     drm_device
22737    </para>
22738   </listitem>
22739  </varlistentry>
22740 </variablelist>
22741</refsect1>
22742</refentry>
22743
22744<refentry id="API-drm-helper-hpd-irq-event">
22745<refentryinfo>
22746 <title>LINUX</title>
22747 <productname>Kernel Hackers Manual</productname>
22748 <date>July 2017</date>
22749</refentryinfo>
22750<refmeta>
22751 <refentrytitle><phrase>drm_helper_hpd_irq_event</phrase></refentrytitle>
22752 <manvolnum>9</manvolnum>
22753 <refmiscinfo class="version">4.4.14</refmiscinfo>
22754</refmeta>
22755<refnamediv>
22756 <refname>drm_helper_hpd_irq_event</refname>
22757 <refpurpose>
22758     hotplug processing
22759 </refpurpose>
22760</refnamediv>
22761<refsynopsisdiv>
22762 <title>Synopsis</title>
22763  <funcsynopsis><funcprototype>
22764   <funcdef>bool <function>drm_helper_hpd_irq_event </function></funcdef>
22765   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
22766  </funcprototype></funcsynopsis>
22767</refsynopsisdiv>
22768<refsect1>
22769 <title>Arguments</title>
22770 <variablelist>
22771  <varlistentry>
22772   <term><parameter>dev</parameter></term>
22773   <listitem>
22774    <para>
22775     drm_device
22776    </para>
22777   </listitem>
22778  </varlistentry>
22779 </variablelist>
22780</refsect1>
22781<refsect1>
22782<title>Description</title>
22783<para>
22784   Drivers can use this helper function to run a detect cycle on all connectors
22785   which have the DRM_CONNECTOR_POLL_HPD flag set in their <structname>polled</structname> member. All
22786   other connectors are ignored, which is useful to avoid reprobing fixed
22787   panels.
22788   </para><para>
22789
22790   This helper function is useful for drivers which can't or don't track hotplug
22791   interrupts for each connector.
22792   </para><para>
22793
22794   Drivers which support hotplug interrupts for each connector individually and
22795   which have a more fine-grained detect logic should bypass this code and
22796   directly call <function>drm_kms_helper_hotplug_event</function> in case the connector state
22797   changed.
22798   </para><para>
22799
22800   This function must be called from process context with no mode
22801   setting locks held.
22802   </para><para>
22803
22804   Note that a connector can be both polled and probed from the hotplug handler,
22805   in case the hotplug interrupt is known to be unreliable.
22806</para>
22807</refsect1>
22808</refentry>
22809
22810    </sect2>
22811    <sect2>
22812      <title>fbdev Helper Functions Reference</title>
22813<para>
22814   </para><para>
22815   The fb helper functions are useful to provide an fbdev on top of a drm kernel
22816   mode setting driver. They can be used mostly independently from the crtc
22817   helper functions used by many drivers to implement the kernel mode setting
22818   interfaces.
22819   </para><para>
22820   Initialization is done as a four-step process with <function>drm_fb_helper_prepare</function>,
22821   <function>drm_fb_helper_init</function>, <function>drm_fb_helper_single_add_all_connectors</function> and
22822   <function>drm_fb_helper_initial_config</function>. Drivers with fancier requirements than the
22823   default behaviour can override the third step with their own code.
22824   Teardown is done with <function>drm_fb_helper_fini</function>.
22825   </para><para>
22826   At runtime drivers should restore the fbdev console by calling
22827   <function>drm_fb_helper_restore_fbdev_mode_unlocked</function> from their -&gt;lastclose callback.
22828   They should also notify the fb helper code from updates to the output
22829   configuration by calling <function>drm_fb_helper_hotplug_event</function>. For easier
22830   integration with the output polling code in drm_crtc_helper.c the modeset
22831   code provides a -&gt;output_poll_changed callback.
22832   </para><para>
22833   All other functions exported by the fb helper library can be used to
22834   implement the fbdev driver interface by the driver.
22835   </para><para>
22836   It is possible, though perhaps somewhat tricky, to implement race-free
22837   hotplug detection using the fbdev helpers. The <function>drm_fb_helper_prepare</function>
22838   helper must be called first to initialize the minimum required to make
22839   hotplug detection work. Drivers also need to make sure to properly set up
22840   the dev-&gt;mode_config.funcs member. After calling <function>drm_kms_helper_poll_init</function>
22841   it is safe to enable interrupts and start processing hotplug events. At the
22842   same time, drivers should initialize all modeset objects such as CRTCs,
22843   encoders and connectors. To finish up the fbdev helper initialization, the
22844   <function>drm_fb_helper_init</function> function is called. To probe for all attached displays
22845   and set up an initial configuration using the detected hardware, drivers
22846   should call <function>drm_fb_helper_single_add_all_connectors</function> followed by
22847   <function>drm_fb_helper_initial_config</function>.
22848</para>
22849
22850<!-- drivers/gpu/drm/drm_fb_helper.c -->
22851<refentry id="API-drm-fb-helper-single-add-all-connectors">
22852<refentryinfo>
22853 <title>LINUX</title>
22854 <productname>Kernel Hackers Manual</productname>
22855 <date>July 2017</date>
22856</refentryinfo>
22857<refmeta>
22858 <refentrytitle><phrase>drm_fb_helper_single_add_all_connectors</phrase></refentrytitle>
22859 <manvolnum>9</manvolnum>
22860 <refmiscinfo class="version">4.4.14</refmiscinfo>
22861</refmeta>
22862<refnamediv>
22863 <refname>drm_fb_helper_single_add_all_connectors</refname>
22864 <refpurpose>
22865  add all connectors to fbdev emulation helper
22866 </refpurpose>
22867</refnamediv>
22868<refsynopsisdiv>
22869 <title>Synopsis</title>
22870  <funcsynopsis><funcprototype>
22871   <funcdef>int <function>drm_fb_helper_single_add_all_connectors </function></funcdef>
22872   <paramdef>struct drm_fb_helper * <parameter>fb_helper</parameter></paramdef>
22873  </funcprototype></funcsynopsis>
22874</refsynopsisdiv>
22875<refsect1>
22876 <title>Arguments</title>
22877 <variablelist>
22878  <varlistentry>
22879   <term><parameter>fb_helper</parameter></term>
22880   <listitem>
22881    <para>
22882     fbdev initialized with drm_fb_helper_init
22883    </para>
22884   </listitem>
22885  </varlistentry>
22886 </variablelist>
22887</refsect1>
22888<refsect1>
22889<title>Description</title>
22890<para>
22891   This functions adds all the available connectors for use with the given
22892   fb_helper. This is a separate step to allow drivers to freely assign
22893   connectors to the fbdev, e.g. if some are reserved for special purposes or
22894   not adequate to be used for the fbcon.
22895   </para><para>
22896
22897   This function is protected against concurrent connector hotadds/removals
22898   using <function>drm_fb_helper_add_one_connector</function> and
22899   <function>drm_fb_helper_remove_one_connector</function>.
22900</para>
22901</refsect1>
22902</refentry>
22903
22904<refentry id="API-drm-fb-helper-debug-enter">
22905<refentryinfo>
22906 <title>LINUX</title>
22907 <productname>Kernel Hackers Manual</productname>
22908 <date>July 2017</date>
22909</refentryinfo>
22910<refmeta>
22911 <refentrytitle><phrase>drm_fb_helper_debug_enter</phrase></refentrytitle>
22912 <manvolnum>9</manvolnum>
22913 <refmiscinfo class="version">4.4.14</refmiscinfo>
22914</refmeta>
22915<refnamediv>
22916 <refname>drm_fb_helper_debug_enter</refname>
22917 <refpurpose>
22918     implementation for -&gt;fb_debug_enter
22919 </refpurpose>
22920</refnamediv>
22921<refsynopsisdiv>
22922 <title>Synopsis</title>
22923  <funcsynopsis><funcprototype>
22924   <funcdef>int <function>drm_fb_helper_debug_enter </function></funcdef>
22925   <paramdef>struct fb_info * <parameter>info</parameter></paramdef>
22926  </funcprototype></funcsynopsis>
22927</refsynopsisdiv>
22928<refsect1>
22929 <title>Arguments</title>
22930 <variablelist>
22931  <varlistentry>
22932   <term><parameter>info</parameter></term>
22933   <listitem>
22934    <para>
22935     fbdev registered by the helper
22936    </para>
22937   </listitem>
22938  </varlistentry>
22939 </variablelist>
22940</refsect1>
22941</refentry>
22942
22943<refentry id="API-drm-fb-helper-debug-leave">
22944<refentryinfo>
22945 <title>LINUX</title>
22946 <productname>Kernel Hackers Manual</productname>
22947 <date>July 2017</date>
22948</refentryinfo>
22949<refmeta>
22950 <refentrytitle><phrase>drm_fb_helper_debug_leave</phrase></refentrytitle>
22951 <manvolnum>9</manvolnum>
22952 <refmiscinfo class="version">4.4.14</refmiscinfo>
22953</refmeta>
22954<refnamediv>
22955 <refname>drm_fb_helper_debug_leave</refname>
22956 <refpurpose>
22957     implementation for -&gt;fb_debug_leave
22958 </refpurpose>
22959</refnamediv>
22960<refsynopsisdiv>
22961 <title>Synopsis</title>
22962  <funcsynopsis><funcprototype>
22963   <funcdef>int <function>drm_fb_helper_debug_leave </function></funcdef>
22964   <paramdef>struct fb_info * <parameter>info</parameter></paramdef>
22965  </funcprototype></funcsynopsis>
22966</refsynopsisdiv>
22967<refsect1>
22968 <title>Arguments</title>
22969 <variablelist>
22970  <varlistentry>
22971   <term><parameter>info</parameter></term>
22972   <listitem>
22973    <para>
22974     fbdev registered by the helper
22975    </para>
22976   </listitem>
22977  </varlistentry>
22978 </variablelist>
22979</refsect1>
22980</refentry>
22981
22982<refentry id="API-drm-fb-helper-restore-fbdev-mode-unlocked">
22983<refentryinfo>
22984 <title>LINUX</title>
22985 <productname>Kernel Hackers Manual</productname>
22986 <date>July 2017</date>
22987</refentryinfo>
22988<refmeta>
22989 <refentrytitle><phrase>drm_fb_helper_restore_fbdev_mode_unlocked</phrase></refentrytitle>
22990 <manvolnum>9</manvolnum>
22991 <refmiscinfo class="version">4.4.14</refmiscinfo>
22992</refmeta>
22993<refnamediv>
22994 <refname>drm_fb_helper_restore_fbdev_mode_unlocked</refname>
22995 <refpurpose>
22996     restore fbdev configuration
22997 </refpurpose>
22998</refnamediv>
22999<refsynopsisdiv>
23000 <title>Synopsis</title>
23001  <funcsynopsis><funcprototype>
23002   <funcdef>int <function>drm_fb_helper_restore_fbdev_mode_unlocked </function></funcdef>
23003   <paramdef>struct drm_fb_helper * <parameter>fb_helper</parameter></paramdef>
23004  </funcprototype></funcsynopsis>
23005</refsynopsisdiv>
23006<refsect1>
23007 <title>Arguments</title>
23008 <variablelist>
23009  <varlistentry>
23010   <term><parameter>fb_helper</parameter></term>
23011   <listitem>
23012    <para>
23013     fbcon to restore
23014    </para>
23015   </listitem>
23016  </varlistentry>
23017 </variablelist>
23018</refsect1>
23019<refsect1>
23020<title>Description</title>
23021<para>
23022   This should be called from driver's drm -&gt;lastclose callback
23023   when implementing an fbcon on top of kms using this helper. This ensures that
23024   the user isn't greeted with a black screen when e.g. X dies.
23025</para>
23026</refsect1>
23027<refsect1>
23028<title>RETURNS</title>
23029<para>
23030   Zero if everything went ok, negative error code otherwise.
23031</para>
23032</refsect1>
23033</refentry>
23034
23035<refentry id="API-drm-fb-helper-blank">
23036<refentryinfo>
23037 <title>LINUX</title>
23038 <productname>Kernel Hackers Manual</productname>
23039 <date>July 2017</date>
23040</refentryinfo>
23041<refmeta>
23042 <refentrytitle><phrase>drm_fb_helper_blank</phrase></refentrytitle>
23043 <manvolnum>9</manvolnum>
23044 <refmiscinfo class="version">4.4.14</refmiscinfo>
23045</refmeta>
23046<refnamediv>
23047 <refname>drm_fb_helper_blank</refname>
23048 <refpurpose>
23049     implementation for -&gt;fb_blank
23050 </refpurpose>
23051</refnamediv>
23052<refsynopsisdiv>
23053 <title>Synopsis</title>
23054  <funcsynopsis><funcprototype>
23055   <funcdef>int <function>drm_fb_helper_blank </function></funcdef>
23056   <paramdef>int <parameter>blank</parameter></paramdef>
23057   <paramdef>struct fb_info * <parameter>info</parameter></paramdef>
23058  </funcprototype></funcsynopsis>
23059</refsynopsisdiv>
23060<refsect1>
23061 <title>Arguments</title>
23062 <variablelist>
23063  <varlistentry>
23064   <term><parameter>blank</parameter></term>
23065   <listitem>
23066    <para>
23067     desired blanking state
23068    </para>
23069   </listitem>
23070  </varlistentry>
23071  <varlistentry>
23072   <term><parameter>info</parameter></term>
23073   <listitem>
23074    <para>
23075     fbdev registered by the helper
23076    </para>
23077   </listitem>
23078  </varlistentry>
23079 </variablelist>
23080</refsect1>
23081</refentry>
23082
23083<refentry id="API-drm-fb-helper-prepare">
23084<refentryinfo>
23085 <title>LINUX</title>
23086 <productname>Kernel Hackers Manual</productname>
23087 <date>July 2017</date>
23088</refentryinfo>
23089<refmeta>
23090 <refentrytitle><phrase>drm_fb_helper_prepare</phrase></refentrytitle>
23091 <manvolnum>9</manvolnum>
23092 <refmiscinfo class="version">4.4.14</refmiscinfo>
23093</refmeta>
23094<refnamediv>
23095 <refname>drm_fb_helper_prepare</refname>
23096 <refpurpose>
23097     setup a drm_fb_helper structure
23098 </refpurpose>
23099</refnamediv>
23100<refsynopsisdiv>
23101 <title>Synopsis</title>
23102  <funcsynopsis><funcprototype>
23103   <funcdef>void <function>drm_fb_helper_prepare </function></funcdef>
23104   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
23105   <paramdef>struct drm_fb_helper * <parameter>helper</parameter></paramdef>
23106   <paramdef>const struct drm_fb_helper_funcs * <parameter>funcs</parameter></paramdef>
23107  </funcprototype></funcsynopsis>
23108</refsynopsisdiv>
23109<refsect1>
23110 <title>Arguments</title>
23111 <variablelist>
23112  <varlistentry>
23113   <term><parameter>dev</parameter></term>
23114   <listitem>
23115    <para>
23116     DRM device
23117    </para>
23118   </listitem>
23119  </varlistentry>
23120  <varlistentry>
23121   <term><parameter>helper</parameter></term>
23122   <listitem>
23123    <para>
23124     driver-allocated fbdev helper structure to set up
23125    </para>
23126   </listitem>
23127  </varlistentry>
23128  <varlistentry>
23129   <term><parameter>funcs</parameter></term>
23130   <listitem>
23131    <para>
23132     pointer to structure of functions associate with this helper
23133    </para>
23134   </listitem>
23135  </varlistentry>
23136 </variablelist>
23137</refsect1>
23138<refsect1>
23139<title>Description</title>
23140<para>
23141   Sets up the bare minimum to make the framebuffer helper usable. This is
23142   useful to implement race-free initialization of the polling helpers.
23143</para>
23144</refsect1>
23145</refentry>
23146
23147<refentry id="API-drm-fb-helper-init">
23148<refentryinfo>
23149 <title>LINUX</title>
23150 <productname>Kernel Hackers Manual</productname>
23151 <date>July 2017</date>
23152</refentryinfo>
23153<refmeta>
23154 <refentrytitle><phrase>drm_fb_helper_init</phrase></refentrytitle>
23155 <manvolnum>9</manvolnum>
23156 <refmiscinfo class="version">4.4.14</refmiscinfo>
23157</refmeta>
23158<refnamediv>
23159 <refname>drm_fb_helper_init</refname>
23160 <refpurpose>
23161     initialize a drm_fb_helper structure
23162 </refpurpose>
23163</refnamediv>
23164<refsynopsisdiv>
23165 <title>Synopsis</title>
23166  <funcsynopsis><funcprototype>
23167   <funcdef>int <function>drm_fb_helper_init </function></funcdef>
23168   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
23169   <paramdef>struct drm_fb_helper * <parameter>fb_helper</parameter></paramdef>
23170   <paramdef>int <parameter>crtc_count</parameter></paramdef>
23171   <paramdef>int <parameter>max_conn_count</parameter></paramdef>
23172  </funcprototype></funcsynopsis>
23173</refsynopsisdiv>
23174<refsect1>
23175 <title>Arguments</title>
23176 <variablelist>
23177  <varlistentry>
23178   <term><parameter>dev</parameter></term>
23179   <listitem>
23180    <para>
23181     drm device
23182    </para>
23183   </listitem>
23184  </varlistentry>
23185  <varlistentry>
23186   <term><parameter>fb_helper</parameter></term>
23187   <listitem>
23188    <para>
23189     driver-allocated fbdev helper structure to initialize
23190    </para>
23191   </listitem>
23192  </varlistentry>
23193  <varlistentry>
23194   <term><parameter>crtc_count</parameter></term>
23195   <listitem>
23196    <para>
23197     maximum number of crtcs to support in this fbdev emulation
23198    </para>
23199   </listitem>
23200  </varlistentry>
23201  <varlistentry>
23202   <term><parameter>max_conn_count</parameter></term>
23203   <listitem>
23204    <para>
23205     max connector count
23206    </para>
23207   </listitem>
23208  </varlistentry>
23209 </variablelist>
23210</refsect1>
23211<refsect1>
23212<title>Description</title>
23213<para>
23214   This allocates the structures for the fbdev helper with the given limits.
23215   Note that this won't yet touch the hardware (through the driver interfaces)
23216   nor register the fbdev. This is only done in <function>drm_fb_helper_initial_config</function>
23217   to allow driver writes more control over the exact init sequence.
23218   </para><para>
23219
23220   Drivers must call <function>drm_fb_helper_prepare</function> before calling this function.
23221</para>
23222</refsect1>
23223<refsect1>
23224<title>RETURNS</title>
23225<para>
23226   Zero if everything went ok, nonzero otherwise.
23227</para>
23228</refsect1>
23229</refentry>
23230
23231<refentry id="API-drm-fb-helper-alloc-fbi">
23232<refentryinfo>
23233 <title>LINUX</title>
23234 <productname>Kernel Hackers Manual</productname>
23235 <date>July 2017</date>
23236</refentryinfo>
23237<refmeta>
23238 <refentrytitle><phrase>drm_fb_helper_alloc_fbi</phrase></refentrytitle>
23239 <manvolnum>9</manvolnum>
23240 <refmiscinfo class="version">4.4.14</refmiscinfo>
23241</refmeta>
23242<refnamediv>
23243 <refname>drm_fb_helper_alloc_fbi</refname>
23244 <refpurpose>
23245     allocate fb_info and some of its members
23246 </refpurpose>
23247</refnamediv>
23248<refsynopsisdiv>
23249 <title>Synopsis</title>
23250  <funcsynopsis><funcprototype>
23251   <funcdef>struct fb_info * <function>drm_fb_helper_alloc_fbi </function></funcdef>
23252   <paramdef>struct drm_fb_helper * <parameter>fb_helper</parameter></paramdef>
23253  </funcprototype></funcsynopsis>
23254</refsynopsisdiv>
23255<refsect1>
23256 <title>Arguments</title>
23257 <variablelist>
23258  <varlistentry>
23259   <term><parameter>fb_helper</parameter></term>
23260   <listitem>
23261    <para>
23262     driver-allocated fbdev helper
23263    </para>
23264   </listitem>
23265  </varlistentry>
23266 </variablelist>
23267</refsect1>
23268<refsect1>
23269<title>Description</title>
23270<para>
23271   A helper to alloc fb_info and the members cmap and apertures. Called
23272   by the driver within the fb_probe fb_helper callback function.
23273</para>
23274</refsect1>
23275<refsect1>
23276<title>RETURNS</title>
23277<para>
23278   fb_info pointer if things went okay, pointer containing error code
23279   otherwise
23280</para>
23281</refsect1>
23282</refentry>
23283
23284<refentry id="API-drm-fb-helper-unregister-fbi">
23285<refentryinfo>
23286 <title>LINUX</title>
23287 <productname>Kernel Hackers Manual</productname>
23288 <date>July 2017</date>
23289</refentryinfo>
23290<refmeta>
23291 <refentrytitle><phrase>drm_fb_helper_unregister_fbi</phrase></refentrytitle>
23292 <manvolnum>9</manvolnum>
23293 <refmiscinfo class="version">4.4.14</refmiscinfo>
23294</refmeta>
23295<refnamediv>
23296 <refname>drm_fb_helper_unregister_fbi</refname>
23297 <refpurpose>
23298     unregister fb_info framebuffer device
23299 </refpurpose>
23300</refnamediv>
23301<refsynopsisdiv>
23302 <title>Synopsis</title>
23303  <funcsynopsis><funcprototype>
23304   <funcdef>void <function>drm_fb_helper_unregister_fbi </function></funcdef>
23305   <paramdef>struct drm_fb_helper * <parameter>fb_helper</parameter></paramdef>
23306  </funcprototype></funcsynopsis>
23307</refsynopsisdiv>
23308<refsect1>
23309 <title>Arguments</title>
23310 <variablelist>
23311  <varlistentry>
23312   <term><parameter>fb_helper</parameter></term>
23313   <listitem>
23314    <para>
23315     driver-allocated fbdev helper
23316    </para>
23317   </listitem>
23318  </varlistentry>
23319 </variablelist>
23320</refsect1>
23321<refsect1>
23322<title>Description</title>
23323<para>
23324   A wrapper around unregister_framebuffer, to release the fb_info
23325   framebuffer device
23326</para>
23327</refsect1>
23328</refentry>
23329
23330<refentry id="API-drm-fb-helper-release-fbi">
23331<refentryinfo>
23332 <title>LINUX</title>
23333 <productname>Kernel Hackers Manual</productname>
23334 <date>July 2017</date>
23335</refentryinfo>
23336<refmeta>
23337 <refentrytitle><phrase>drm_fb_helper_release_fbi</phrase></refentrytitle>
23338 <manvolnum>9</manvolnum>
23339 <refmiscinfo class="version">4.4.14</refmiscinfo>
23340</refmeta>
23341<refnamediv>
23342 <refname>drm_fb_helper_release_fbi</refname>
23343 <refpurpose>
23344     dealloc fb_info and its members
23345 </refpurpose>
23346</refnamediv>
23347<refsynopsisdiv>
23348 <title>Synopsis</title>
23349  <funcsynopsis><funcprototype>
23350   <funcdef>void <function>drm_fb_helper_release_fbi </function></funcdef>
23351   <paramdef>struct drm_fb_helper * <parameter>fb_helper</parameter></paramdef>
23352  </funcprototype></funcsynopsis>
23353</refsynopsisdiv>
23354<refsect1>
23355 <title>Arguments</title>
23356 <variablelist>
23357  <varlistentry>
23358   <term><parameter>fb_helper</parameter></term>
23359   <listitem>
23360    <para>
23361     driver-allocated fbdev helper
23362    </para>
23363   </listitem>
23364  </varlistentry>
23365 </variablelist>
23366</refsect1>
23367<refsect1>
23368<title>Description</title>
23369<para>
23370   A helper to free memory taken by fb_info and the members cmap and
23371   apertures
23372</para>
23373</refsect1>
23374</refentry>
23375
23376<refentry id="API-drm-fb-helper-unlink-fbi">
23377<refentryinfo>
23378 <title>LINUX</title>
23379 <productname>Kernel Hackers Manual</productname>
23380 <date>July 2017</date>
23381</refentryinfo>
23382<refmeta>
23383 <refentrytitle><phrase>drm_fb_helper_unlink_fbi</phrase></refentrytitle>
23384 <manvolnum>9</manvolnum>
23385 <refmiscinfo class="version">4.4.14</refmiscinfo>
23386</refmeta>
23387<refnamediv>
23388 <refname>drm_fb_helper_unlink_fbi</refname>
23389 <refpurpose>
23390     wrapper around unlink_framebuffer
23391 </refpurpose>
23392</refnamediv>
23393<refsynopsisdiv>
23394 <title>Synopsis</title>
23395  <funcsynopsis><funcprototype>
23396   <funcdef>void <function>drm_fb_helper_unlink_fbi </function></funcdef>
23397   <paramdef>struct drm_fb_helper * <parameter>fb_helper</parameter></paramdef>
23398  </funcprototype></funcsynopsis>
23399</refsynopsisdiv>
23400<refsect1>
23401 <title>Arguments</title>
23402 <variablelist>
23403  <varlistentry>
23404   <term><parameter>fb_helper</parameter></term>
23405   <listitem>
23406    <para>
23407     driver-allocated fbdev helper
23408    </para>
23409   </listitem>
23410  </varlistentry>
23411 </variablelist>
23412</refsect1>
23413<refsect1>
23414<title>Description</title>
23415<para>
23416   A wrapper around unlink_framebuffer implemented by fbdev core
23417</para>
23418</refsect1>
23419</refentry>
23420
23421<refentry id="API-drm-fb-helper-sys-read">
23422<refentryinfo>
23423 <title>LINUX</title>
23424 <productname>Kernel Hackers Manual</productname>
23425 <date>July 2017</date>
23426</refentryinfo>
23427<refmeta>
23428 <refentrytitle><phrase>drm_fb_helper_sys_read</phrase></refentrytitle>
23429 <manvolnum>9</manvolnum>
23430 <refmiscinfo class="version">4.4.14</refmiscinfo>
23431</refmeta>
23432<refnamediv>
23433 <refname>drm_fb_helper_sys_read</refname>
23434 <refpurpose>
23435     wrapper around fb_sys_read
23436 </refpurpose>
23437</refnamediv>
23438<refsynopsisdiv>
23439 <title>Synopsis</title>
23440  <funcsynopsis><funcprototype>
23441   <funcdef>ssize_t <function>drm_fb_helper_sys_read </function></funcdef>
23442   <paramdef>struct fb_info * <parameter>info</parameter></paramdef>
23443   <paramdef>char __user * <parameter>buf</parameter></paramdef>
23444   <paramdef>size_t <parameter>count</parameter></paramdef>
23445   <paramdef>loff_t * <parameter>ppos</parameter></paramdef>
23446  </funcprototype></funcsynopsis>
23447</refsynopsisdiv>
23448<refsect1>
23449 <title>Arguments</title>
23450 <variablelist>
23451  <varlistentry>
23452   <term><parameter>info</parameter></term>
23453   <listitem>
23454    <para>
23455     fb_info struct pointer
23456    </para>
23457   </listitem>
23458  </varlistentry>
23459  <varlistentry>
23460   <term><parameter>buf</parameter></term>
23461   <listitem>
23462    <para>
23463     userspace buffer to read from framebuffer memory
23464    </para>
23465   </listitem>
23466  </varlistentry>
23467  <varlistentry>
23468   <term><parameter>count</parameter></term>
23469   <listitem>
23470    <para>
23471     number of bytes to read from framebuffer memory
23472    </para>
23473   </listitem>
23474  </varlistentry>
23475  <varlistentry>
23476   <term><parameter>ppos</parameter></term>
23477   <listitem>
23478    <para>
23479     read offset within framebuffer memory
23480    </para>
23481   </listitem>
23482  </varlistentry>
23483 </variablelist>
23484</refsect1>
23485<refsect1>
23486<title>Description</title>
23487<para>
23488   A wrapper around fb_sys_read implemented by fbdev core
23489</para>
23490</refsect1>
23491</refentry>
23492
23493<refentry id="API-drm-fb-helper-sys-write">
23494<refentryinfo>
23495 <title>LINUX</title>
23496 <productname>Kernel Hackers Manual</productname>
23497 <date>July 2017</date>
23498</refentryinfo>
23499<refmeta>
23500 <refentrytitle><phrase>drm_fb_helper_sys_write</phrase></refentrytitle>
23501 <manvolnum>9</manvolnum>
23502 <refmiscinfo class="version">4.4.14</refmiscinfo>
23503</refmeta>
23504<refnamediv>
23505 <refname>drm_fb_helper_sys_write</refname>
23506 <refpurpose>
23507     wrapper around fb_sys_write
23508 </refpurpose>
23509</refnamediv>
23510<refsynopsisdiv>
23511 <title>Synopsis</title>
23512  <funcsynopsis><funcprototype>
23513   <funcdef>ssize_t <function>drm_fb_helper_sys_write </function></funcdef>
23514   <paramdef>struct fb_info * <parameter>info</parameter></paramdef>
23515   <paramdef>const char __user * <parameter>buf</parameter></paramdef>
23516   <paramdef>size_t <parameter>count</parameter></paramdef>
23517   <paramdef>loff_t * <parameter>ppos</parameter></paramdef>
23518  </funcprototype></funcsynopsis>
23519</refsynopsisdiv>
23520<refsect1>
23521 <title>Arguments</title>
23522 <variablelist>
23523  <varlistentry>
23524   <term><parameter>info</parameter></term>
23525   <listitem>
23526    <para>
23527     fb_info struct pointer
23528    </para>
23529   </listitem>
23530  </varlistentry>
23531  <varlistentry>
23532   <term><parameter>buf</parameter></term>
23533   <listitem>
23534    <para>
23535     userspace buffer to write to framebuffer memory
23536    </para>
23537   </listitem>
23538  </varlistentry>
23539  <varlistentry>
23540   <term><parameter>count</parameter></term>
23541   <listitem>
23542    <para>
23543     number of bytes to write to framebuffer memory
23544    </para>
23545   </listitem>
23546  </varlistentry>
23547  <varlistentry>
23548   <term><parameter>ppos</parameter></term>
23549   <listitem>
23550    <para>
23551     write offset within framebuffer memory
23552    </para>
23553   </listitem>
23554  </varlistentry>
23555 </variablelist>
23556</refsect1>
23557<refsect1>
23558<title>Description</title>
23559<para>
23560   A wrapper around fb_sys_write implemented by fbdev core
23561</para>
23562</refsect1>
23563</refentry>
23564
23565<refentry id="API-drm-fb-helper-sys-fillrect">
23566<refentryinfo>
23567 <title>LINUX</title>
23568 <productname>Kernel Hackers Manual</productname>
23569 <date>July 2017</date>
23570</refentryinfo>
23571<refmeta>
23572 <refentrytitle><phrase>drm_fb_helper_sys_fillrect</phrase></refentrytitle>
23573 <manvolnum>9</manvolnum>
23574 <refmiscinfo class="version">4.4.14</refmiscinfo>
23575</refmeta>
23576<refnamediv>
23577 <refname>drm_fb_helper_sys_fillrect</refname>
23578 <refpurpose>
23579     wrapper around sys_fillrect
23580 </refpurpose>
23581</refnamediv>
23582<refsynopsisdiv>
23583 <title>Synopsis</title>
23584  <funcsynopsis><funcprototype>
23585   <funcdef>void <function>drm_fb_helper_sys_fillrect </function></funcdef>
23586   <paramdef>struct fb_info * <parameter>info</parameter></paramdef>
23587   <paramdef>const struct fb_fillrect * <parameter>rect</parameter></paramdef>
23588  </funcprototype></funcsynopsis>
23589</refsynopsisdiv>
23590<refsect1>
23591 <title>Arguments</title>
23592 <variablelist>
23593  <varlistentry>
23594   <term><parameter>info</parameter></term>
23595   <listitem>
23596    <para>
23597     fbdev registered by the helper
23598    </para>
23599   </listitem>
23600  </varlistentry>
23601  <varlistentry>
23602   <term><parameter>rect</parameter></term>
23603   <listitem>
23604    <para>
23605     info about rectangle to fill
23606    </para>
23607   </listitem>
23608  </varlistentry>
23609 </variablelist>
23610</refsect1>
23611<refsect1>
23612<title>Description</title>
23613<para>
23614   A wrapper around sys_fillrect implemented by fbdev core
23615</para>
23616</refsect1>
23617</refentry>
23618
23619<refentry id="API-drm-fb-helper-sys-copyarea">
23620<refentryinfo>
23621 <title>LINUX</title>
23622 <productname>Kernel Hackers Manual</productname>
23623 <date>July 2017</date>
23624</refentryinfo>
23625<refmeta>
23626 <refentrytitle><phrase>drm_fb_helper_sys_copyarea</phrase></refentrytitle>
23627 <manvolnum>9</manvolnum>
23628 <refmiscinfo class="version">4.4.14</refmiscinfo>
23629</refmeta>
23630<refnamediv>
23631 <refname>drm_fb_helper_sys_copyarea</refname>
23632 <refpurpose>
23633     wrapper around sys_copyarea
23634 </refpurpose>
23635</refnamediv>
23636<refsynopsisdiv>
23637 <title>Synopsis</title>
23638  <funcsynopsis><funcprototype>
23639   <funcdef>void <function>drm_fb_helper_sys_copyarea </function></funcdef>
23640   <paramdef>struct fb_info * <parameter>info</parameter></paramdef>
23641   <paramdef>const struct fb_copyarea * <parameter>area</parameter></paramdef>
23642  </funcprototype></funcsynopsis>
23643</refsynopsisdiv>
23644<refsect1>
23645 <title>Arguments</title>
23646 <variablelist>
23647  <varlistentry>
23648   <term><parameter>info</parameter></term>
23649   <listitem>
23650    <para>
23651     fbdev registered by the helper
23652    </para>
23653   </listitem>
23654  </varlistentry>
23655  <varlistentry>
23656   <term><parameter>area</parameter></term>
23657   <listitem>
23658    <para>
23659     info about area to copy
23660    </para>
23661   </listitem>
23662  </varlistentry>
23663 </variablelist>
23664</refsect1>
23665<refsect1>
23666<title>Description</title>
23667<para>
23668   A wrapper around sys_copyarea implemented by fbdev core
23669</para>
23670</refsect1>
23671</refentry>
23672
23673<refentry id="API-drm-fb-helper-sys-imageblit">
23674<refentryinfo>
23675 <title>LINUX</title>
23676 <productname>Kernel Hackers Manual</productname>
23677 <date>July 2017</date>
23678</refentryinfo>
23679<refmeta>
23680 <refentrytitle><phrase>drm_fb_helper_sys_imageblit</phrase></refentrytitle>
23681 <manvolnum>9</manvolnum>
23682 <refmiscinfo class="version">4.4.14</refmiscinfo>
23683</refmeta>
23684<refnamediv>
23685 <refname>drm_fb_helper_sys_imageblit</refname>
23686 <refpurpose>
23687     wrapper around sys_imageblit
23688 </refpurpose>
23689</refnamediv>
23690<refsynopsisdiv>
23691 <title>Synopsis</title>
23692  <funcsynopsis><funcprototype>
23693   <funcdef>void <function>drm_fb_helper_sys_imageblit </function></funcdef>
23694   <paramdef>struct fb_info * <parameter>info</parameter></paramdef>
23695   <paramdef>const struct fb_image * <parameter>image</parameter></paramdef>
23696  </funcprototype></funcsynopsis>
23697</refsynopsisdiv>
23698<refsect1>
23699 <title>Arguments</title>
23700 <variablelist>
23701  <varlistentry>
23702   <term><parameter>info</parameter></term>
23703   <listitem>
23704    <para>
23705     fbdev registered by the helper
23706    </para>
23707   </listitem>
23708  </varlistentry>
23709  <varlistentry>
23710   <term><parameter>image</parameter></term>
23711   <listitem>
23712    <para>
23713     info about image to blit
23714    </para>
23715   </listitem>
23716  </varlistentry>
23717 </variablelist>
23718</refsect1>
23719<refsect1>
23720<title>Description</title>
23721<para>
23722   A wrapper around sys_imageblit implemented by fbdev core
23723</para>
23724</refsect1>
23725</refentry>
23726
23727<refentry id="API-drm-fb-helper-cfb-fillrect">
23728<refentryinfo>
23729 <title>LINUX</title>
23730 <productname>Kernel Hackers Manual</productname>
23731 <date>July 2017</date>
23732</refentryinfo>
23733<refmeta>
23734 <refentrytitle><phrase>drm_fb_helper_cfb_fillrect</phrase></refentrytitle>
23735 <manvolnum>9</manvolnum>
23736 <refmiscinfo class="version">4.4.14</refmiscinfo>
23737</refmeta>
23738<refnamediv>
23739 <refname>drm_fb_helper_cfb_fillrect</refname>
23740 <refpurpose>
23741     wrapper around cfb_fillrect
23742 </refpurpose>
23743</refnamediv>
23744<refsynopsisdiv>
23745 <title>Synopsis</title>
23746  <funcsynopsis><funcprototype>
23747   <funcdef>void <function>drm_fb_helper_cfb_fillrect </function></funcdef>
23748   <paramdef>struct fb_info * <parameter>info</parameter></paramdef>
23749   <paramdef>const struct fb_fillrect * <parameter>rect</parameter></paramdef>
23750  </funcprototype></funcsynopsis>
23751</refsynopsisdiv>
23752<refsect1>
23753 <title>Arguments</title>
23754 <variablelist>
23755  <varlistentry>
23756   <term><parameter>info</parameter></term>
23757   <listitem>
23758    <para>
23759     fbdev registered by the helper
23760    </para>
23761   </listitem>
23762  </varlistentry>
23763  <varlistentry>
23764   <term><parameter>rect</parameter></term>
23765   <listitem>
23766    <para>
23767     info about rectangle to fill
23768    </para>
23769   </listitem>
23770  </varlistentry>
23771 </variablelist>
23772</refsect1>
23773<refsect1>
23774<title>Description</title>
23775<para>
23776   A wrapper around cfb_imageblit implemented by fbdev core
23777</para>
23778</refsect1>
23779</refentry>
23780
23781<refentry id="API-drm-fb-helper-cfb-copyarea">
23782<refentryinfo>
23783 <title>LINUX</title>
23784 <productname>Kernel Hackers Manual</productname>
23785 <date>July 2017</date>
23786</refentryinfo>
23787<refmeta>
23788 <refentrytitle><phrase>drm_fb_helper_cfb_copyarea</phrase></refentrytitle>
23789 <manvolnum>9</manvolnum>
23790 <refmiscinfo class="version">4.4.14</refmiscinfo>
23791</refmeta>
23792<refnamediv>
23793 <refname>drm_fb_helper_cfb_copyarea</refname>
23794 <refpurpose>
23795     wrapper around cfb_copyarea
23796 </refpurpose>
23797</refnamediv>
23798<refsynopsisdiv>
23799 <title>Synopsis</title>
23800  <funcsynopsis><funcprototype>
23801   <funcdef>void <function>drm_fb_helper_cfb_copyarea </function></funcdef>
23802   <paramdef>struct fb_info * <parameter>info</parameter></paramdef>
23803   <paramdef>const struct fb_copyarea * <parameter>area</parameter></paramdef>
23804  </funcprototype></funcsynopsis>
23805</refsynopsisdiv>
23806<refsect1>
23807 <title>Arguments</title>
23808 <variablelist>
23809  <varlistentry>
23810   <term><parameter>info</parameter></term>
23811   <listitem>
23812    <para>
23813     fbdev registered by the helper
23814    </para>
23815   </listitem>
23816  </varlistentry>
23817  <varlistentry>
23818   <term><parameter>area</parameter></term>
23819   <listitem>
23820    <para>
23821     info about area to copy
23822    </para>
23823   </listitem>
23824  </varlistentry>
23825 </variablelist>
23826</refsect1>
23827<refsect1>
23828<title>Description</title>
23829<para>
23830   A wrapper around cfb_copyarea implemented by fbdev core
23831</para>
23832</refsect1>
23833</refentry>
23834
23835<refentry id="API-drm-fb-helper-cfb-imageblit">
23836<refentryinfo>
23837 <title>LINUX</title>
23838 <productname>Kernel Hackers Manual</productname>
23839 <date>July 2017</date>
23840</refentryinfo>
23841<refmeta>
23842 <refentrytitle><phrase>drm_fb_helper_cfb_imageblit</phrase></refentrytitle>
23843 <manvolnum>9</manvolnum>
23844 <refmiscinfo class="version">4.4.14</refmiscinfo>
23845</refmeta>
23846<refnamediv>
23847 <refname>drm_fb_helper_cfb_imageblit</refname>
23848 <refpurpose>
23849     wrapper around cfb_imageblit
23850 </refpurpose>
23851</refnamediv>
23852<refsynopsisdiv>
23853 <title>Synopsis</title>
23854  <funcsynopsis><funcprototype>
23855   <funcdef>void <function>drm_fb_helper_cfb_imageblit </function></funcdef>
23856   <paramdef>struct fb_info * <parameter>info</parameter></paramdef>
23857   <paramdef>const struct fb_image * <parameter>image</parameter></paramdef>
23858  </funcprototype></funcsynopsis>
23859</refsynopsisdiv>
23860<refsect1>
23861 <title>Arguments</title>
23862 <variablelist>
23863  <varlistentry>
23864   <term><parameter>info</parameter></term>
23865   <listitem>
23866    <para>
23867     fbdev registered by the helper
23868    </para>
23869   </listitem>
23870  </varlistentry>
23871  <varlistentry>
23872   <term><parameter>image</parameter></term>
23873   <listitem>
23874    <para>
23875     info about image to blit
23876    </para>
23877   </listitem>
23878  </varlistentry>
23879 </variablelist>
23880</refsect1>
23881<refsect1>
23882<title>Description</title>
23883<para>
23884   A wrapper around cfb_imageblit implemented by fbdev core
23885</para>
23886</refsect1>
23887</refentry>
23888
23889<refentry id="API-drm-fb-helper-set-suspend">
23890<refentryinfo>
23891 <title>LINUX</title>
23892 <productname>Kernel Hackers Manual</productname>
23893 <date>July 2017</date>
23894</refentryinfo>
23895<refmeta>
23896 <refentrytitle><phrase>drm_fb_helper_set_suspend</phrase></refentrytitle>
23897 <manvolnum>9</manvolnum>
23898 <refmiscinfo class="version">4.4.14</refmiscinfo>
23899</refmeta>
23900<refnamediv>
23901 <refname>drm_fb_helper_set_suspend</refname>
23902 <refpurpose>
23903     wrapper around fb_set_suspend
23904 </refpurpose>
23905</refnamediv>
23906<refsynopsisdiv>
23907 <title>Synopsis</title>
23908  <funcsynopsis><funcprototype>
23909   <funcdef>void <function>drm_fb_helper_set_suspend </function></funcdef>
23910   <paramdef>struct drm_fb_helper * <parameter>fb_helper</parameter></paramdef>
23911   <paramdef>int <parameter>state</parameter></paramdef>
23912  </funcprototype></funcsynopsis>
23913</refsynopsisdiv>
23914<refsect1>
23915 <title>Arguments</title>
23916 <variablelist>
23917  <varlistentry>
23918   <term><parameter>fb_helper</parameter></term>
23919   <listitem>
23920    <para>
23921     driver-allocated fbdev helper
23922    </para>
23923   </listitem>
23924  </varlistentry>
23925  <varlistentry>
23926   <term><parameter>state</parameter></term>
23927   <listitem>
23928    <para>
23929     desired state, zero to resume, non-zero to suspend
23930    </para>
23931   </listitem>
23932  </varlistentry>
23933 </variablelist>
23934</refsect1>
23935<refsect1>
23936<title>Description</title>
23937<para>
23938   A wrapper around fb_set_suspend implemented by fbdev core
23939</para>
23940</refsect1>
23941</refentry>
23942
23943<refentry id="API-drm-fb-helper-setcmap">
23944<refentryinfo>
23945 <title>LINUX</title>
23946 <productname>Kernel Hackers Manual</productname>
23947 <date>July 2017</date>
23948</refentryinfo>
23949<refmeta>
23950 <refentrytitle><phrase>drm_fb_helper_setcmap</phrase></refentrytitle>
23951 <manvolnum>9</manvolnum>
23952 <refmiscinfo class="version">4.4.14</refmiscinfo>
23953</refmeta>
23954<refnamediv>
23955 <refname>drm_fb_helper_setcmap</refname>
23956 <refpurpose>
23957     implementation for -&gt;fb_setcmap
23958 </refpurpose>
23959</refnamediv>
23960<refsynopsisdiv>
23961 <title>Synopsis</title>
23962  <funcsynopsis><funcprototype>
23963   <funcdef>int <function>drm_fb_helper_setcmap </function></funcdef>
23964   <paramdef>struct fb_cmap * <parameter>cmap</parameter></paramdef>
23965   <paramdef>struct fb_info * <parameter>info</parameter></paramdef>
23966  </funcprototype></funcsynopsis>
23967</refsynopsisdiv>
23968<refsect1>
23969 <title>Arguments</title>
23970 <variablelist>
23971  <varlistentry>
23972   <term><parameter>cmap</parameter></term>
23973   <listitem>
23974    <para>
23975     cmap to set
23976    </para>
23977   </listitem>
23978  </varlistentry>
23979  <varlistentry>
23980   <term><parameter>info</parameter></term>
23981   <listitem>
23982    <para>
23983     fbdev registered by the helper
23984    </para>
23985   </listitem>
23986  </varlistentry>
23987 </variablelist>
23988</refsect1>
23989</refentry>
23990
23991<refentry id="API-drm-fb-helper-check-var">
23992<refentryinfo>
23993 <title>LINUX</title>
23994 <productname>Kernel Hackers Manual</productname>
23995 <date>July 2017</date>
23996</refentryinfo>
23997<refmeta>
23998 <refentrytitle><phrase>drm_fb_helper_check_var</phrase></refentrytitle>
23999 <manvolnum>9</manvolnum>
24000 <refmiscinfo class="version">4.4.14</refmiscinfo>
24001</refmeta>
24002<refnamediv>
24003 <refname>drm_fb_helper_check_var</refname>
24004 <refpurpose>
24005     implementation for -&gt;fb_check_var
24006 </refpurpose>
24007</refnamediv>
24008<refsynopsisdiv>
24009 <title>Synopsis</title>
24010  <funcsynopsis><funcprototype>
24011   <funcdef>int <function>drm_fb_helper_check_var </function></funcdef>
24012   <paramdef>struct fb_var_screeninfo * <parameter>var</parameter></paramdef>
24013   <paramdef>struct fb_info * <parameter>info</parameter></paramdef>
24014  </funcprototype></funcsynopsis>
24015</refsynopsisdiv>
24016<refsect1>
24017 <title>Arguments</title>
24018 <variablelist>
24019  <varlistentry>
24020   <term><parameter>var</parameter></term>
24021   <listitem>
24022    <para>
24023     screeninfo to check
24024    </para>
24025   </listitem>
24026  </varlistentry>
24027  <varlistentry>
24028   <term><parameter>info</parameter></term>
24029   <listitem>
24030    <para>
24031     fbdev registered by the helper
24032    </para>
24033   </listitem>
24034  </varlistentry>
24035 </variablelist>
24036</refsect1>
24037</refentry>
24038
24039<refentry id="API-drm-fb-helper-set-par">
24040<refentryinfo>
24041 <title>LINUX</title>
24042 <productname>Kernel Hackers Manual</productname>
24043 <date>July 2017</date>
24044</refentryinfo>
24045<refmeta>
24046 <refentrytitle><phrase>drm_fb_helper_set_par</phrase></refentrytitle>
24047 <manvolnum>9</manvolnum>
24048 <refmiscinfo class="version">4.4.14</refmiscinfo>
24049</refmeta>
24050<refnamediv>
24051 <refname>drm_fb_helper_set_par</refname>
24052 <refpurpose>
24053     implementation for -&gt;fb_set_par
24054 </refpurpose>
24055</refnamediv>
24056<refsynopsisdiv>
24057 <title>Synopsis</title>
24058  <funcsynopsis><funcprototype>
24059   <funcdef>int <function>drm_fb_helper_set_par </function></funcdef>
24060   <paramdef>struct fb_info * <parameter>info</parameter></paramdef>
24061  </funcprototype></funcsynopsis>
24062</refsynopsisdiv>
24063<refsect1>
24064 <title>Arguments</title>
24065 <variablelist>
24066  <varlistentry>
24067   <term><parameter>info</parameter></term>
24068   <listitem>
24069    <para>
24070     fbdev registered by the helper
24071    </para>
24072   </listitem>
24073  </varlistentry>
24074 </variablelist>
24075</refsect1>
24076<refsect1>
24077<title>Description</title>
24078<para>
24079   This will let fbcon do the mode init and is called at initialization time by
24080   the fbdev core when registering the driver, and later on through the hotplug
24081   callback.
24082</para>
24083</refsect1>
24084</refentry>
24085
24086<refentry id="API-drm-fb-helper-pan-display">
24087<refentryinfo>
24088 <title>LINUX</title>
24089 <productname>Kernel Hackers Manual</productname>
24090 <date>July 2017</date>
24091</refentryinfo>
24092<refmeta>
24093 <refentrytitle><phrase>drm_fb_helper_pan_display</phrase></refentrytitle>
24094 <manvolnum>9</manvolnum>
24095 <refmiscinfo class="version">4.4.14</refmiscinfo>
24096</refmeta>
24097<refnamediv>
24098 <refname>drm_fb_helper_pan_display</refname>
24099 <refpurpose>
24100     implementation for -&gt;fb_pan_display
24101 </refpurpose>
24102</refnamediv>
24103<refsynopsisdiv>
24104 <title>Synopsis</title>
24105  <funcsynopsis><funcprototype>
24106   <funcdef>int <function>drm_fb_helper_pan_display </function></funcdef>
24107   <paramdef>struct fb_var_screeninfo * <parameter>var</parameter></paramdef>
24108   <paramdef>struct fb_info * <parameter>info</parameter></paramdef>
24109  </funcprototype></funcsynopsis>
24110</refsynopsisdiv>
24111<refsect1>
24112 <title>Arguments</title>
24113 <variablelist>
24114  <varlistentry>
24115   <term><parameter>var</parameter></term>
24116   <listitem>
24117    <para>
24118     updated screen information
24119    </para>
24120   </listitem>
24121  </varlistentry>
24122  <varlistentry>
24123   <term><parameter>info</parameter></term>
24124   <listitem>
24125    <para>
24126     fbdev registered by the helper
24127    </para>
24128   </listitem>
24129  </varlistentry>
24130 </variablelist>
24131</refsect1>
24132</refentry>
24133
24134<refentry id="API-drm-fb-helper-fill-fix">
24135<refentryinfo>
24136 <title>LINUX</title>
24137 <productname>Kernel Hackers Manual</productname>
24138 <date>July 2017</date>
24139</refentryinfo>
24140<refmeta>
24141 <refentrytitle><phrase>drm_fb_helper_fill_fix</phrase></refentrytitle>
24142 <manvolnum>9</manvolnum>
24143 <refmiscinfo class="version">4.4.14</refmiscinfo>
24144</refmeta>
24145<refnamediv>
24146 <refname>drm_fb_helper_fill_fix</refname>
24147 <refpurpose>
24148     initializes fixed fbdev information
24149 </refpurpose>
24150</refnamediv>
24151<refsynopsisdiv>
24152 <title>Synopsis</title>
24153  <funcsynopsis><funcprototype>
24154   <funcdef>void <function>drm_fb_helper_fill_fix </function></funcdef>
24155   <paramdef>struct fb_info * <parameter>info</parameter></paramdef>
24156   <paramdef>uint32_t <parameter>pitch</parameter></paramdef>
24157   <paramdef>uint32_t <parameter>depth</parameter></paramdef>
24158  </funcprototype></funcsynopsis>
24159</refsynopsisdiv>
24160<refsect1>
24161 <title>Arguments</title>
24162 <variablelist>
24163  <varlistentry>
24164   <term><parameter>info</parameter></term>
24165   <listitem>
24166    <para>
24167     fbdev registered by the helper
24168    </para>
24169   </listitem>
24170  </varlistentry>
24171  <varlistentry>
24172   <term><parameter>pitch</parameter></term>
24173   <listitem>
24174    <para>
24175     desired pitch
24176    </para>
24177   </listitem>
24178  </varlistentry>
24179  <varlistentry>
24180   <term><parameter>depth</parameter></term>
24181   <listitem>
24182    <para>
24183     desired depth
24184    </para>
24185   </listitem>
24186  </varlistentry>
24187 </variablelist>
24188</refsect1>
24189<refsect1>
24190<title>Description</title>
24191<para>
24192   Helper to fill in the fixed fbdev information useful for a non-accelerated
24193   fbdev emulations. Drivers which support acceleration methods which impose
24194   additional constraints need to set up their own limits.
24195   </para><para>
24196
24197   Drivers should call this (or their equivalent setup code) from their
24198   -&gt;fb_probe callback.
24199</para>
24200</refsect1>
24201</refentry>
24202
24203<refentry id="API-drm-fb-helper-fill-var">
24204<refentryinfo>
24205 <title>LINUX</title>
24206 <productname>Kernel Hackers Manual</productname>
24207 <date>July 2017</date>
24208</refentryinfo>
24209<refmeta>
24210 <refentrytitle><phrase>drm_fb_helper_fill_var</phrase></refentrytitle>
24211 <manvolnum>9</manvolnum>
24212 <refmiscinfo class="version">4.4.14</refmiscinfo>
24213</refmeta>
24214<refnamediv>
24215 <refname>drm_fb_helper_fill_var</refname>
24216 <refpurpose>
24217     initalizes variable fbdev information
24218 </refpurpose>
24219</refnamediv>
24220<refsynopsisdiv>
24221 <title>Synopsis</title>
24222  <funcsynopsis><funcprototype>
24223   <funcdef>void <function>drm_fb_helper_fill_var </function></funcdef>
24224   <paramdef>struct fb_info * <parameter>info</parameter></paramdef>
24225   <paramdef>struct drm_fb_helper * <parameter>fb_helper</parameter></paramdef>
24226   <paramdef>uint32_t <parameter>fb_width</parameter></paramdef>
24227   <paramdef>uint32_t <parameter>fb_height</parameter></paramdef>
24228  </funcprototype></funcsynopsis>
24229</refsynopsisdiv>
24230<refsect1>
24231 <title>Arguments</title>
24232 <variablelist>
24233  <varlistentry>
24234   <term><parameter>info</parameter></term>
24235   <listitem>
24236    <para>
24237     fbdev instance to set up
24238    </para>
24239   </listitem>
24240  </varlistentry>
24241  <varlistentry>
24242   <term><parameter>fb_helper</parameter></term>
24243   <listitem>
24244    <para>
24245     fb helper instance to use as template
24246    </para>
24247   </listitem>
24248  </varlistentry>
24249  <varlistentry>
24250   <term><parameter>fb_width</parameter></term>
24251   <listitem>
24252    <para>
24253     desired fb width
24254    </para>
24255   </listitem>
24256  </varlistentry>
24257  <varlistentry>
24258   <term><parameter>fb_height</parameter></term>
24259   <listitem>
24260    <para>
24261     desired fb height
24262    </para>
24263   </listitem>
24264  </varlistentry>
24265 </variablelist>
24266</refsect1>
24267<refsect1>
24268<title>Description</title>
24269<para>
24270   Sets up the variable fbdev metainformation from the given fb helper instance
24271   and the drm framebuffer allocated in fb_helper-&gt;fb.
24272   </para><para>
24273
24274   Drivers should call this (or their equivalent setup code) from their
24275   -&gt;fb_probe callback after having allocated the fbdev backing
24276   storage framebuffer.
24277</para>
24278</refsect1>
24279</refentry>
24280
24281<refentry id="API-drm-fb-helper-initial-config">
24282<refentryinfo>
24283 <title>LINUX</title>
24284 <productname>Kernel Hackers Manual</productname>
24285 <date>July 2017</date>
24286</refentryinfo>
24287<refmeta>
24288 <refentrytitle><phrase>drm_fb_helper_initial_config</phrase></refentrytitle>
24289 <manvolnum>9</manvolnum>
24290 <refmiscinfo class="version">4.4.14</refmiscinfo>
24291</refmeta>
24292<refnamediv>
24293 <refname>drm_fb_helper_initial_config</refname>
24294 <refpurpose>
24295     setup a sane initial connector configuration
24296 </refpurpose>
24297</refnamediv>
24298<refsynopsisdiv>
24299 <title>Synopsis</title>
24300  <funcsynopsis><funcprototype>
24301   <funcdef>int <function>drm_fb_helper_initial_config </function></funcdef>
24302   <paramdef>struct drm_fb_helper * <parameter>fb_helper</parameter></paramdef>
24303   <paramdef>int <parameter>bpp_sel</parameter></paramdef>
24304  </funcprototype></funcsynopsis>
24305</refsynopsisdiv>
24306<refsect1>
24307 <title>Arguments</title>
24308 <variablelist>
24309  <varlistentry>
24310   <term><parameter>fb_helper</parameter></term>
24311   <listitem>
24312    <para>
24313     fb_helper device struct
24314    </para>
24315   </listitem>
24316  </varlistentry>
24317  <varlistentry>
24318   <term><parameter>bpp_sel</parameter></term>
24319   <listitem>
24320    <para>
24321     bpp value to use for the framebuffer configuration
24322    </para>
24323   </listitem>
24324  </varlistentry>
24325 </variablelist>
24326</refsect1>
24327<refsect1>
24328<title>Description</title>
24329<para>
24330   Scans the CRTCs and connectors and tries to put together an initial setup.
24331   At the moment, this is a cloned configuration across all heads with
24332   a new framebuffer object as the backing store.
24333   </para><para>
24334
24335   Note that this also registers the fbdev and so allows userspace to call into
24336   the driver through the fbdev interfaces.
24337   </para><para>
24338
24339   This function will call down into the -&gt;fb_probe callback to let
24340   the driver allocate and initialize the fbdev info structure and the drm
24341   framebuffer used to back the fbdev. <function>drm_fb_helper_fill_var</function> and
24342   <function>drm_fb_helper_fill_fix</function> are provided as helpers to setup simple default
24343   values for the fbdev info structure.
24344</para>
24345</refsect1>
24346<refsect1>
24347<title>RETURNS</title>
24348<para>
24349   Zero if everything went ok, nonzero otherwise.
24350</para>
24351</refsect1>
24352</refentry>
24353
24354<refentry id="API-drm-fb-helper-hotplug-event">
24355<refentryinfo>
24356 <title>LINUX</title>
24357 <productname>Kernel Hackers Manual</productname>
24358 <date>July 2017</date>
24359</refentryinfo>
24360<refmeta>
24361 <refentrytitle><phrase>drm_fb_helper_hotplug_event</phrase></refentrytitle>
24362 <manvolnum>9</manvolnum>
24363 <refmiscinfo class="version">4.4.14</refmiscinfo>
24364</refmeta>
24365<refnamediv>
24366 <refname>drm_fb_helper_hotplug_event</refname>
24367 <refpurpose>
24368     respond to a hotplug notification by probing all the outputs attached to the fb
24369 </refpurpose>
24370</refnamediv>
24371<refsynopsisdiv>
24372 <title>Synopsis</title>
24373  <funcsynopsis><funcprototype>
24374   <funcdef>int <function>drm_fb_helper_hotplug_event </function></funcdef>
24375   <paramdef>struct drm_fb_helper * <parameter>fb_helper</parameter></paramdef>
24376  </funcprototype></funcsynopsis>
24377</refsynopsisdiv>
24378<refsect1>
24379 <title>Arguments</title>
24380 <variablelist>
24381  <varlistentry>
24382   <term><parameter>fb_helper</parameter></term>
24383   <listitem>
24384    <para>
24385     the drm_fb_helper
24386    </para>
24387   </listitem>
24388  </varlistentry>
24389 </variablelist>
24390</refsect1>
24391<refsect1>
24392<title>Description</title>
24393<para>
24394   Scan the connectors attached to the fb_helper and try to put together a
24395   setup after *notification of a change in output configuration.
24396   </para><para>
24397
24398   Called at runtime, takes the mode config locks to be able to check/change the
24399   modeset configuration. Must be run from process context (which usually means
24400   either the output polling work or a work item launched from the driver's
24401   hotplug interrupt).
24402   </para><para>
24403
24404   Note that drivers may call this even before calling
24405   drm_fb_helper_initial_config but only aftert drm_fb_helper_init. This allows
24406   for a race-free fbcon setup and will make sure that the fbdev emulation will
24407   not miss any hotplug events.
24408</para>
24409</refsect1>
24410<refsect1>
24411<title>RETURNS</title>
24412<para>
24413   0 on success and a non-zero error code otherwise.
24414</para>
24415</refsect1>
24416</refentry>
24417
24418<!-- include/drm/drm_fb_helper.h -->
24419<refentry id="API-struct-drm-fb-helper-surface-size">
24420<refentryinfo>
24421 <title>LINUX</title>
24422 <productname>Kernel Hackers Manual</productname>
24423 <date>July 2017</date>
24424</refentryinfo>
24425<refmeta>
24426 <refentrytitle><phrase>struct drm_fb_helper_surface_size</phrase></refentrytitle>
24427 <manvolnum>9</manvolnum>
24428 <refmiscinfo class="version">4.4.14</refmiscinfo>
24429</refmeta>
24430<refnamediv>
24431 <refname>struct drm_fb_helper_surface_size</refname>
24432 <refpurpose>
24433  describes fbdev size and scanout surface size
24434 </refpurpose>
24435</refnamediv>
24436<refsynopsisdiv>
24437 <title>Synopsis</title>
24438  <programlisting>
24439struct drm_fb_helper_surface_size {
24440  u32 fb_width;
24441  u32 fb_height;
24442  u32 surface_width;
24443  u32 surface_height;
24444  u32 surface_bpp;
24445  u32 surface_depth;
24446};  </programlisting>
24447</refsynopsisdiv>
24448 <refsect1>
24449  <title>Members</title>
24450  <variablelist>
24451    <varlistentry>      <term>fb_width</term>
24452      <listitem><para>
24453fbdev width
24454      </para></listitem>
24455    </varlistentry>
24456    <varlistentry>      <term>fb_height</term>
24457      <listitem><para>
24458fbdev height
24459      </para></listitem>
24460    </varlistentry>
24461    <varlistentry>      <term>surface_width</term>
24462      <listitem><para>
24463scanout buffer width
24464      </para></listitem>
24465    </varlistentry>
24466    <varlistentry>      <term>surface_height</term>
24467      <listitem><para>
24468scanout buffer height
24469      </para></listitem>
24470    </varlistentry>
24471    <varlistentry>      <term>surface_bpp</term>
24472      <listitem><para>
24473scanout buffer bpp
24474      </para></listitem>
24475    </varlistentry>
24476    <varlistentry>      <term>surface_depth</term>
24477      <listitem><para>
24478scanout buffer depth
24479      </para></listitem>
24480    </varlistentry>
24481  </variablelist>
24482 </refsect1>
24483<refsect1>
24484<title>Description</title>
24485<para>
24486   Note that the scanout surface width/height may be larger than the fbdev
24487   width/height.  In case of multiple displays, the scanout surface is sized
24488   according to the largest width/height (so it is large enough for all CRTCs
24489   to scanout).  But the fbdev width/height is sized to the minimum width/
24490   height of all the displays.  This ensures that fbcon fits on the smallest
24491   of the attached displays.
24492   </para><para>
24493
24494   So what is passed to <function>drm_fb_helper_fill_var</function> should be fb_width/fb_height,
24495   rather than the surface size.
24496</para>
24497</refsect1>
24498</refentry>
24499
24500<refentry id="API-struct-drm-fb-helper-funcs">
24501<refentryinfo>
24502 <title>LINUX</title>
24503 <productname>Kernel Hackers Manual</productname>
24504 <date>July 2017</date>
24505</refentryinfo>
24506<refmeta>
24507 <refentrytitle><phrase>struct drm_fb_helper_funcs</phrase></refentrytitle>
24508 <manvolnum>9</manvolnum>
24509 <refmiscinfo class="version">4.4.14</refmiscinfo>
24510</refmeta>
24511<refnamediv>
24512 <refname>struct drm_fb_helper_funcs</refname>
24513 <refpurpose>
24514     driver callbacks for the fbdev emulation library
24515 </refpurpose>
24516</refnamediv>
24517<refsynopsisdiv>
24518 <title>Synopsis</title>
24519  <programlisting>
24520struct drm_fb_helper_funcs {
24521  void (* gamma_set) (struct drm_crtc *crtc, u16 red, u16 green,u16 blue, int regno);
24522  void (* gamma_get) (struct drm_crtc *crtc, u16 *red, u16 *green,u16 *blue, int regno);
24523  int (* fb_probe) (struct drm_fb_helper *helper,struct drm_fb_helper_surface_size *sizes);
24524  bool (* initial_config) (struct drm_fb_helper *fb_helper,struct drm_fb_helper_crtc **crtcs,struct drm_display_mode **modes,struct drm_fb_offset *offsets,bool *enabled, int width, int height);
24525};  </programlisting>
24526</refsynopsisdiv>
24527 <refsect1>
24528  <title>Members</title>
24529  <variablelist>
24530    <varlistentry>      <term>gamma_set</term>
24531      <listitem><para>
24532   Set the given gamma lut register on the given crtc.
24533      </para></listitem>
24534    </varlistentry>
24535    <varlistentry>      <term>gamma_get</term>
24536      <listitem><para>
24537   Read the given gamma lut register on the given crtc, used to
24538   save the current lut when force-restoring the fbdev for e.g.
24539   kdbg.
24540      </para></listitem>
24541    </varlistentry>
24542    <varlistentry>      <term>fb_probe</term>
24543      <listitem><para>
24544   Driver callback to allocate and initialize the fbdev info
24545   structure. Furthermore it also needs to allocate the drm
24546   framebuffer used to back the fbdev.
24547      </para></listitem>
24548    </varlistentry>
24549    <varlistentry>      <term>initial_config</term>
24550      <listitem><para>
24551   Setup an initial fbdev display configuration
24552      </para></listitem>
24553    </varlistentry>
24554  </variablelist>
24555 </refsect1>
24556<refsect1>
24557<title>Description</title>
24558<para>
24559   Driver callbacks used by the fbdev emulation helper library.
24560</para>
24561</refsect1>
24562</refentry>
24563
24564<refentry id="API-struct-drm-fb-helper">
24565<refentryinfo>
24566 <title>LINUX</title>
24567 <productname>Kernel Hackers Manual</productname>
24568 <date>July 2017</date>
24569</refentryinfo>
24570<refmeta>
24571 <refentrytitle><phrase>struct drm_fb_helper</phrase></refentrytitle>
24572 <manvolnum>9</manvolnum>
24573 <refmiscinfo class="version">4.4.14</refmiscinfo>
24574</refmeta>
24575<refnamediv>
24576 <refname>struct drm_fb_helper</refname>
24577 <refpurpose>
24578     helper to emulate fbdev on top of kms
24579 </refpurpose>
24580</refnamediv>
24581<refsynopsisdiv>
24582 <title>Synopsis</title>
24583  <programlisting>
24584struct drm_fb_helper {
24585  struct drm_framebuffer * fb;
24586  struct drm_device * dev;
24587  int crtc_count;
24588  struct drm_fb_helper_crtc * crtc_info;
24589  int connector_count;
24590  int connector_info_alloc_count;
24591  const struct drm_fb_helper_funcs * funcs;
24592  struct fb_info * fbdev;
24593  u32 pseudo_palette[17];
24594  struct list_head kernel_fb_list;
24595  bool delayed_hotplug;
24596  bool atomic;
24597};  </programlisting>
24598</refsynopsisdiv>
24599 <refsect1>
24600  <title>Members</title>
24601  <variablelist>
24602    <varlistentry>      <term>fb</term>
24603      <listitem><para>
24604   Scanout framebuffer object
24605      </para></listitem>
24606    </varlistentry>
24607    <varlistentry>      <term>dev</term>
24608      <listitem><para>
24609   DRM device
24610      </para></listitem>
24611    </varlistentry>
24612    <varlistentry>      <term>crtc_count</term>
24613      <listitem><para>
24614   number of possible CRTCs
24615      </para></listitem>
24616    </varlistentry>
24617    <varlistentry>      <term>crtc_info</term>
24618      <listitem><para>
24619   per-CRTC helper state (mode, x/y offset, etc)
24620      </para></listitem>
24621    </varlistentry>
24622    <varlistentry>      <term>connector_count</term>
24623      <listitem><para>
24624   number of connected connectors
24625      </para></listitem>
24626    </varlistentry>
24627    <varlistentry>      <term>connector_info_alloc_count</term>
24628      <listitem><para>
24629   size of connector_info
24630      </para></listitem>
24631    </varlistentry>
24632    <varlistentry>      <term>funcs</term>
24633      <listitem><para>
24634   driver callbacks for fb helper
24635      </para></listitem>
24636    </varlistentry>
24637    <varlistentry>      <term>fbdev</term>
24638      <listitem><para>
24639   emulated fbdev device info struct
24640      </para></listitem>
24641    </varlistentry>
24642    <varlistentry>      <term>pseudo_palette[17]</term>
24643      <listitem><para>
24644   fake palette of 16 colors
24645      </para></listitem>
24646    </varlistentry>
24647    <varlistentry>      <term>kernel_fb_list</term>
24648      <listitem><para>
24649   list_head in kernel_fb_helper_list
24650      </para></listitem>
24651    </varlistentry>
24652    <varlistentry>      <term>delayed_hotplug</term>
24653      <listitem><para>
24654   was there a hotplug while kms master active?
24655      </para></listitem>
24656    </varlistentry>
24657    <varlistentry>      <term>atomic</term>
24658      <listitem><para>
24659   </para><para>
24660
24661   Use atomic updates for <function>restore_fbdev_mode</function>, etc.  This defaults to
24662   true if driver has DRIVER_ATOMIC feature flag, but drivers can
24663   override it to true after <function>drm_fb_helper_init</function> if they support atomic
24664   modeset but do not yet advertise DRIVER_ATOMIC (note that fb-helper
24665   does not require ASYNC commits).
24666      </para></listitem>
24667    </varlistentry>
24668  </variablelist>
24669 </refsect1>
24670</refentry>
24671
24672    </sect2>
24673    <sect2>
24674      <title>Display Port Helper Functions Reference</title>
24675<para>
24676   </para><para>
24677   These functions contain some common logic and helpers at various abstraction
24678   levels to deal with Display Port sink devices and related things like DP aux
24679   channel transfers, EDID reading over DP aux channels, decoding certain DPCD
24680   blocks, ...
24681</para>
24682
24683<para>
24684   </para><para>
24685   The DisplayPort AUX channel is an abstraction to allow generic, driver-
24686   independent access to AUX functionality. Drivers can take advantage of
24687   this by filling in the fields of the drm_dp_aux structure.
24688   </para><para>
24689   Transactions are described using a hardware-independent drm_dp_aux_msg
24690   structure, which is passed into a driver's .<function>transfer</function> implementation.
24691   Both native and I2C-over-AUX transactions are supported.
24692</para>
24693
24694<!-- include/drm/drm_dp_helper.h -->
24695<refentry id="API-struct-drm-dp-aux-msg">
24696<refentryinfo>
24697 <title>LINUX</title>
24698 <productname>Kernel Hackers Manual</productname>
24699 <date>July 2017</date>
24700</refentryinfo>
24701<refmeta>
24702 <refentrytitle><phrase>struct drm_dp_aux_msg</phrase></refentrytitle>
24703 <manvolnum>9</manvolnum>
24704 <refmiscinfo class="version">4.4.14</refmiscinfo>
24705</refmeta>
24706<refnamediv>
24707 <refname>struct drm_dp_aux_msg</refname>
24708 <refpurpose>
24709  DisplayPort AUX channel transaction
24710 </refpurpose>
24711</refnamediv>
24712<refsynopsisdiv>
24713 <title>Synopsis</title>
24714  <programlisting>
24715struct drm_dp_aux_msg {
24716  unsigned int address;
24717  u8 request;
24718  u8 reply;
24719  void * buffer;
24720  size_t size;
24721};  </programlisting>
24722</refsynopsisdiv>
24723 <refsect1>
24724  <title>Members</title>
24725  <variablelist>
24726    <varlistentry>      <term>address</term>
24727      <listitem><para>
24728address of the (first) register to access
24729      </para></listitem>
24730    </varlistentry>
24731    <varlistentry>      <term>request</term>
24732      <listitem><para>
24733contains the type of transaction (see DP_AUX_* macros)
24734      </para></listitem>
24735    </varlistentry>
24736    <varlistentry>      <term>reply</term>
24737      <listitem><para>
24738upon completion, contains the reply type of the transaction
24739      </para></listitem>
24740    </varlistentry>
24741    <varlistentry>      <term>buffer</term>
24742      <listitem><para>
24743pointer to a transmission or reception buffer
24744      </para></listitem>
24745    </varlistentry>
24746    <varlistentry>      <term>size</term>
24747      <listitem><para>
24748size of <parameter>buffer</parameter>
24749      </para></listitem>
24750    </varlistentry>
24751  </variablelist>
24752 </refsect1>
24753</refentry>
24754
24755<refentry id="API-struct-drm-dp-aux">
24756<refentryinfo>
24757 <title>LINUX</title>
24758 <productname>Kernel Hackers Manual</productname>
24759 <date>July 2017</date>
24760</refentryinfo>
24761<refmeta>
24762 <refentrytitle><phrase>struct drm_dp_aux</phrase></refentrytitle>
24763 <manvolnum>9</manvolnum>
24764 <refmiscinfo class="version">4.4.14</refmiscinfo>
24765</refmeta>
24766<refnamediv>
24767 <refname>struct drm_dp_aux</refname>
24768 <refpurpose>
24769     DisplayPort AUX channel
24770 </refpurpose>
24771</refnamediv>
24772<refsynopsisdiv>
24773 <title>Synopsis</title>
24774  <programlisting>
24775struct drm_dp_aux {
24776  const char * name;
24777  struct i2c_adapter ddc;
24778  struct device * dev;
24779  struct mutex hw_mutex;
24780  ssize_t (* transfer) (struct drm_dp_aux *aux,struct drm_dp_aux_msg *msg);
24781};  </programlisting>
24782</refsynopsisdiv>
24783 <refsect1>
24784  <title>Members</title>
24785  <variablelist>
24786    <varlistentry>      <term>name</term>
24787      <listitem><para>
24788   user-visible name of this AUX channel and the I2C-over-AUX adapter
24789      </para></listitem>
24790    </varlistentry>
24791    <varlistentry>      <term>ddc</term>
24792      <listitem><para>
24793   I2C adapter that can be used for I2C-over-AUX communication
24794      </para></listitem>
24795    </varlistentry>
24796    <varlistentry>      <term>dev</term>
24797      <listitem><para>
24798   pointer to struct device that is the parent for this AUX channel
24799      </para></listitem>
24800    </varlistentry>
24801    <varlistentry>      <term>hw_mutex</term>
24802      <listitem><para>
24803   internal mutex used for locking transfers
24804      </para></listitem>
24805    </varlistentry>
24806    <varlistentry>      <term>transfer</term>
24807      <listitem><para>
24808   transfers a message representing a single AUX transaction
24809      </para></listitem>
24810    </varlistentry>
24811  </variablelist>
24812 </refsect1>
24813<refsect1>
24814<title>Description</title>
24815<para>
24816   The .dev field should be set to a pointer to the device that implements
24817   the AUX channel.
24818   </para><para>
24819
24820   The .name field may be used to specify the name of the I2C adapter. If set to
24821   NULL, <function>dev_name</function> of .dev will be used.
24822   </para><para>
24823
24824   Drivers provide a hardware-specific implementation of how transactions
24825   are executed via the .<function>transfer</function> function. A pointer to a drm_dp_aux_msg
24826   structure describing the transaction is passed into this function. Upon
24827   success, the implementation should return the number of payload bytes
24828   that were transferred, or a negative error-code on failure. Helpers
24829   propagate errors from the .<function>transfer</function> function, with the exception of
24830   the -EBUSY error, which causes a transaction to be retried. On a short,
24831   helpers will return -EPROTO to make it simpler to check for failure.
24832   </para><para>
24833
24834   An AUX channel can also be used to transport I2C messages to a sink. A
24835   typical application of that is to access an EDID that's present in the
24836   sink device. The .<function>transfer</function> function can also be used to execute such
24837   transactions. The <function>drm_dp_aux_register</function> function registers an I2C
24838   adapter that can be passed to <function>drm_probe_ddc</function>. Upon removal, drivers
24839   should call <function>drm_dp_aux_unregister</function> to remove the I2C adapter.
24840   The I2C adapter uses long transfers by default; if a partial response is
24841   received, the adapter will drop down to the size given by the partial
24842   response for this transaction only.
24843   </para><para>
24844
24845   Note that the aux helper code assumes that the .<function>transfer</function> function
24846   only modifies the reply field of the drm_dp_aux_msg structure.  The
24847   retry logic and i2c helpers assume this is the case.
24848</para>
24849</refsect1>
24850</refentry>
24851
24852<refentry id="API-drm-dp-dpcd-readb">
24853<refentryinfo>
24854 <title>LINUX</title>
24855 <productname>Kernel Hackers Manual</productname>
24856 <date>July 2017</date>
24857</refentryinfo>
24858<refmeta>
24859 <refentrytitle><phrase>drm_dp_dpcd_readb</phrase></refentrytitle>
24860 <manvolnum>9</manvolnum>
24861 <refmiscinfo class="version">4.4.14</refmiscinfo>
24862</refmeta>
24863<refnamediv>
24864 <refname>drm_dp_dpcd_readb</refname>
24865 <refpurpose>
24866     read a single byte from the DPCD
24867 </refpurpose>
24868</refnamediv>
24869<refsynopsisdiv>
24870 <title>Synopsis</title>
24871  <funcsynopsis><funcprototype>
24872   <funcdef>ssize_t <function>drm_dp_dpcd_readb </function></funcdef>
24873   <paramdef>struct drm_dp_aux * <parameter>aux</parameter></paramdef>
24874   <paramdef>unsigned int <parameter>offset</parameter></paramdef>
24875   <paramdef>u8 * <parameter>valuep</parameter></paramdef>
24876  </funcprototype></funcsynopsis>
24877</refsynopsisdiv>
24878<refsect1>
24879 <title>Arguments</title>
24880 <variablelist>
24881  <varlistentry>
24882   <term><parameter>aux</parameter></term>
24883   <listitem>
24884    <para>
24885     DisplayPort AUX channel
24886    </para>
24887   </listitem>
24888  </varlistentry>
24889  <varlistentry>
24890   <term><parameter>offset</parameter></term>
24891   <listitem>
24892    <para>
24893     address of the register to read
24894    </para>
24895   </listitem>
24896  </varlistentry>
24897  <varlistentry>
24898   <term><parameter>valuep</parameter></term>
24899   <listitem>
24900    <para>
24901     location where the value of the register will be stored
24902    </para>
24903   </listitem>
24904  </varlistentry>
24905 </variablelist>
24906</refsect1>
24907<refsect1>
24908<title>Description</title>
24909<para>
24910   Returns the number of bytes transferred (1) on success, or a negative
24911   error code on failure.
24912</para>
24913</refsect1>
24914</refentry>
24915
24916<refentry id="API-drm-dp-dpcd-writeb">
24917<refentryinfo>
24918 <title>LINUX</title>
24919 <productname>Kernel Hackers Manual</productname>
24920 <date>July 2017</date>
24921</refentryinfo>
24922<refmeta>
24923 <refentrytitle><phrase>drm_dp_dpcd_writeb</phrase></refentrytitle>
24924 <manvolnum>9</manvolnum>
24925 <refmiscinfo class="version">4.4.14</refmiscinfo>
24926</refmeta>
24927<refnamediv>
24928 <refname>drm_dp_dpcd_writeb</refname>
24929 <refpurpose>
24930     write a single byte to the DPCD
24931 </refpurpose>
24932</refnamediv>
24933<refsynopsisdiv>
24934 <title>Synopsis</title>
24935  <funcsynopsis><funcprototype>
24936   <funcdef>ssize_t <function>drm_dp_dpcd_writeb </function></funcdef>
24937   <paramdef>struct drm_dp_aux * <parameter>aux</parameter></paramdef>
24938   <paramdef>unsigned int <parameter>offset</parameter></paramdef>
24939   <paramdef>u8 <parameter>value</parameter></paramdef>
24940  </funcprototype></funcsynopsis>
24941</refsynopsisdiv>
24942<refsect1>
24943 <title>Arguments</title>
24944 <variablelist>
24945  <varlistentry>
24946   <term><parameter>aux</parameter></term>
24947   <listitem>
24948    <para>
24949     DisplayPort AUX channel
24950    </para>
24951   </listitem>
24952  </varlistentry>
24953  <varlistentry>
24954   <term><parameter>offset</parameter></term>
24955   <listitem>
24956    <para>
24957     address of the register to write
24958    </para>
24959   </listitem>
24960  </varlistentry>
24961  <varlistentry>
24962   <term><parameter>value</parameter></term>
24963   <listitem>
24964    <para>
24965     value to write to the register
24966    </para>
24967   </listitem>
24968  </varlistentry>
24969 </variablelist>
24970</refsect1>
24971<refsect1>
24972<title>Description</title>
24973<para>
24974   Returns the number of bytes transferred (1) on success, or a negative
24975   error code on failure.
24976</para>
24977</refsect1>
24978</refentry>
24979
24980<!-- drivers/gpu/drm/drm_dp_helper.c -->
24981<refentry id="API-drm-dp-dpcd-read">
24982<refentryinfo>
24983 <title>LINUX</title>
24984 <productname>Kernel Hackers Manual</productname>
24985 <date>July 2017</date>
24986</refentryinfo>
24987<refmeta>
24988 <refentrytitle><phrase>drm_dp_dpcd_read</phrase></refentrytitle>
24989 <manvolnum>9</manvolnum>
24990 <refmiscinfo class="version">4.4.14</refmiscinfo>
24991</refmeta>
24992<refnamediv>
24993 <refname>drm_dp_dpcd_read</refname>
24994 <refpurpose>
24995  read a series of bytes from the DPCD
24996 </refpurpose>
24997</refnamediv>
24998<refsynopsisdiv>
24999 <title>Synopsis</title>
25000  <funcsynopsis><funcprototype>
25001   <funcdef>ssize_t <function>drm_dp_dpcd_read </function></funcdef>
25002   <paramdef>struct drm_dp_aux * <parameter>aux</parameter></paramdef>
25003   <paramdef>unsigned int <parameter>offset</parameter></paramdef>
25004   <paramdef>void * <parameter>buffer</parameter></paramdef>
25005   <paramdef>size_t <parameter>size</parameter></paramdef>
25006  </funcprototype></funcsynopsis>
25007</refsynopsisdiv>
25008<refsect1>
25009 <title>Arguments</title>
25010 <variablelist>
25011  <varlistentry>
25012   <term><parameter>aux</parameter></term>
25013   <listitem>
25014    <para>
25015     DisplayPort AUX channel
25016    </para>
25017   </listitem>
25018  </varlistentry>
25019  <varlistentry>
25020   <term><parameter>offset</parameter></term>
25021   <listitem>
25022    <para>
25023     address of the (first) register to read
25024    </para>
25025   </listitem>
25026  </varlistentry>
25027  <varlistentry>
25028   <term><parameter>buffer</parameter></term>
25029   <listitem>
25030    <para>
25031     buffer to store the register values
25032    </para>
25033   </listitem>
25034  </varlistentry>
25035  <varlistentry>
25036   <term><parameter>size</parameter></term>
25037   <listitem>
25038    <para>
25039     number of bytes in <parameter>buffer</parameter>
25040    </para>
25041   </listitem>
25042  </varlistentry>
25043 </variablelist>
25044</refsect1>
25045<refsect1>
25046<title>Description</title>
25047<para>
25048   Returns the number of bytes transferred on success, or a negative error
25049   code on failure. -EIO is returned if the request was NAKed by the sink or
25050   if the retry count was exceeded. If not all bytes were transferred, this
25051   function returns -EPROTO. Errors from the underlying AUX channel transfer
25052   function, with the exception of -EBUSY (which causes the transaction to
25053   be retried), are propagated to the caller.
25054</para>
25055</refsect1>
25056</refentry>
25057
25058<refentry id="API-drm-dp-dpcd-write">
25059<refentryinfo>
25060 <title>LINUX</title>
25061 <productname>Kernel Hackers Manual</productname>
25062 <date>July 2017</date>
25063</refentryinfo>
25064<refmeta>
25065 <refentrytitle><phrase>drm_dp_dpcd_write</phrase></refentrytitle>
25066 <manvolnum>9</manvolnum>
25067 <refmiscinfo class="version">4.4.14</refmiscinfo>
25068</refmeta>
25069<refnamediv>
25070 <refname>drm_dp_dpcd_write</refname>
25071 <refpurpose>
25072     write a series of bytes to the DPCD
25073 </refpurpose>
25074</refnamediv>
25075<refsynopsisdiv>
25076 <title>Synopsis</title>
25077  <funcsynopsis><funcprototype>
25078   <funcdef>ssize_t <function>drm_dp_dpcd_write </function></funcdef>
25079   <paramdef>struct drm_dp_aux * <parameter>aux</parameter></paramdef>
25080   <paramdef>unsigned int <parameter>offset</parameter></paramdef>
25081   <paramdef>void * <parameter>buffer</parameter></paramdef>
25082   <paramdef>size_t <parameter>size</parameter></paramdef>
25083  </funcprototype></funcsynopsis>
25084</refsynopsisdiv>
25085<refsect1>
25086 <title>Arguments</title>
25087 <variablelist>
25088  <varlistentry>
25089   <term><parameter>aux</parameter></term>
25090   <listitem>
25091    <para>
25092     DisplayPort AUX channel
25093    </para>
25094   </listitem>
25095  </varlistentry>
25096  <varlistentry>
25097   <term><parameter>offset</parameter></term>
25098   <listitem>
25099    <para>
25100     address of the (first) register to write
25101    </para>
25102   </listitem>
25103  </varlistentry>
25104  <varlistentry>
25105   <term><parameter>buffer</parameter></term>
25106   <listitem>
25107    <para>
25108     buffer containing the values to write
25109    </para>
25110   </listitem>
25111  </varlistentry>
25112  <varlistentry>
25113   <term><parameter>size</parameter></term>
25114   <listitem>
25115    <para>
25116     number of bytes in <parameter>buffer</parameter>
25117    </para>
25118   </listitem>
25119  </varlistentry>
25120 </variablelist>
25121</refsect1>
25122<refsect1>
25123<title>Description</title>
25124<para>
25125   Returns the number of bytes transferred on success, or a negative error
25126   code on failure. -EIO is returned if the request was NAKed by the sink or
25127   if the retry count was exceeded. If not all bytes were transferred, this
25128   function returns -EPROTO. Errors from the underlying AUX channel transfer
25129   function, with the exception of -EBUSY (which causes the transaction to
25130   be retried), are propagated to the caller.
25131</para>
25132</refsect1>
25133</refentry>
25134
25135<refentry id="API-drm-dp-dpcd-read-link-status">
25136<refentryinfo>
25137 <title>LINUX</title>
25138 <productname>Kernel Hackers Manual</productname>
25139 <date>July 2017</date>
25140</refentryinfo>
25141<refmeta>
25142 <refentrytitle><phrase>drm_dp_dpcd_read_link_status</phrase></refentrytitle>
25143 <manvolnum>9</manvolnum>
25144 <refmiscinfo class="version">4.4.14</refmiscinfo>
25145</refmeta>
25146<refnamediv>
25147 <refname>drm_dp_dpcd_read_link_status</refname>
25148 <refpurpose>
25149     read DPCD link status (bytes 0x202-0x207)
25150 </refpurpose>
25151</refnamediv>
25152<refsynopsisdiv>
25153 <title>Synopsis</title>
25154  <funcsynopsis><funcprototype>
25155   <funcdef>int <function>drm_dp_dpcd_read_link_status </function></funcdef>
25156   <paramdef>struct drm_dp_aux * <parameter>aux</parameter></paramdef>
25157   <paramdef>u8 <parameter>status[DP_LINK_STATUS_SIZE]</parameter></paramdef>
25158  </funcprototype></funcsynopsis>
25159</refsynopsisdiv>
25160<refsect1>
25161 <title>Arguments</title>
25162 <variablelist>
25163  <varlistentry>
25164   <term><parameter>aux</parameter></term>
25165   <listitem>
25166    <para>
25167     DisplayPort AUX channel
25168    </para>
25169   </listitem>
25170  </varlistentry>
25171  <varlistentry>
25172   <term><parameter>status[DP_LINK_STATUS_SIZE]</parameter></term>
25173   <listitem>
25174    <para>
25175     buffer to store the link status in (must be at least 6 bytes)
25176    </para>
25177   </listitem>
25178  </varlistentry>
25179 </variablelist>
25180</refsect1>
25181<refsect1>
25182<title>Description</title>
25183<para>
25184   Returns the number of bytes transferred on success or a negative error
25185   code on failure.
25186</para>
25187</refsect1>
25188</refentry>
25189
25190<refentry id="API-drm-dp-link-probe">
25191<refentryinfo>
25192 <title>LINUX</title>
25193 <productname>Kernel Hackers Manual</productname>
25194 <date>July 2017</date>
25195</refentryinfo>
25196<refmeta>
25197 <refentrytitle><phrase>drm_dp_link_probe</phrase></refentrytitle>
25198 <manvolnum>9</manvolnum>
25199 <refmiscinfo class="version">4.4.14</refmiscinfo>
25200</refmeta>
25201<refnamediv>
25202 <refname>drm_dp_link_probe</refname>
25203 <refpurpose>
25204     probe a DisplayPort link for capabilities
25205 </refpurpose>
25206</refnamediv>
25207<refsynopsisdiv>
25208 <title>Synopsis</title>
25209  <funcsynopsis><funcprototype>
25210   <funcdef>int <function>drm_dp_link_probe </function></funcdef>
25211   <paramdef>struct drm_dp_aux * <parameter>aux</parameter></paramdef>
25212   <paramdef>struct drm_dp_link * <parameter>link</parameter></paramdef>
25213  </funcprototype></funcsynopsis>
25214</refsynopsisdiv>
25215<refsect1>
25216 <title>Arguments</title>
25217 <variablelist>
25218  <varlistentry>
25219   <term><parameter>aux</parameter></term>
25220   <listitem>
25221    <para>
25222     DisplayPort AUX channel
25223    </para>
25224   </listitem>
25225  </varlistentry>
25226  <varlistentry>
25227   <term><parameter>link</parameter></term>
25228   <listitem>
25229    <para>
25230     pointer to structure in which to return link capabilities
25231    </para>
25232   </listitem>
25233  </varlistentry>
25234 </variablelist>
25235</refsect1>
25236<refsect1>
25237<title>Description</title>
25238<para>
25239   The structure filled in by this function can usually be passed directly
25240   into <function>drm_dp_link_power_up</function> and <function>drm_dp_link_configure</function> to power up and
25241   configure the link based on the link's capabilities.
25242   </para><para>
25243
25244   Returns 0 on success or a negative error code on failure.
25245</para>
25246</refsect1>
25247</refentry>
25248
25249<refentry id="API-drm-dp-link-power-up">
25250<refentryinfo>
25251 <title>LINUX</title>
25252 <productname>Kernel Hackers Manual</productname>
25253 <date>July 2017</date>
25254</refentryinfo>
25255<refmeta>
25256 <refentrytitle><phrase>drm_dp_link_power_up</phrase></refentrytitle>
25257 <manvolnum>9</manvolnum>
25258 <refmiscinfo class="version">4.4.14</refmiscinfo>
25259</refmeta>
25260<refnamediv>
25261 <refname>drm_dp_link_power_up</refname>
25262 <refpurpose>
25263     power up a DisplayPort link
25264 </refpurpose>
25265</refnamediv>
25266<refsynopsisdiv>
25267 <title>Synopsis</title>
25268  <funcsynopsis><funcprototype>
25269   <funcdef>int <function>drm_dp_link_power_up </function></funcdef>
25270   <paramdef>struct drm_dp_aux * <parameter>aux</parameter></paramdef>
25271   <paramdef>struct drm_dp_link * <parameter>link</parameter></paramdef>
25272  </funcprototype></funcsynopsis>
25273</refsynopsisdiv>
25274<refsect1>
25275 <title>Arguments</title>
25276 <variablelist>
25277  <varlistentry>
25278   <term><parameter>aux</parameter></term>
25279   <listitem>
25280    <para>
25281     DisplayPort AUX channel
25282    </para>
25283   </listitem>
25284  </varlistentry>
25285  <varlistentry>
25286   <term><parameter>link</parameter></term>
25287   <listitem>
25288    <para>
25289     pointer to a structure containing the link configuration
25290    </para>
25291   </listitem>
25292  </varlistentry>
25293 </variablelist>
25294</refsect1>
25295<refsect1>
25296<title>Description</title>
25297<para>
25298   Returns 0 on success or a negative error code on failure.
25299</para>
25300</refsect1>
25301</refentry>
25302
25303<refentry id="API-drm-dp-link-power-down">
25304<refentryinfo>
25305 <title>LINUX</title>
25306 <productname>Kernel Hackers Manual</productname>
25307 <date>July 2017</date>
25308</refentryinfo>
25309<refmeta>
25310 <refentrytitle><phrase>drm_dp_link_power_down</phrase></refentrytitle>
25311 <manvolnum>9</manvolnum>
25312 <refmiscinfo class="version">4.4.14</refmiscinfo>
25313</refmeta>
25314<refnamediv>
25315 <refname>drm_dp_link_power_down</refname>
25316 <refpurpose>
25317     power down a DisplayPort link
25318 </refpurpose>
25319</refnamediv>
25320<refsynopsisdiv>
25321 <title>Synopsis</title>
25322  <funcsynopsis><funcprototype>
25323   <funcdef>int <function>drm_dp_link_power_down </function></funcdef>
25324   <paramdef>struct drm_dp_aux * <parameter>aux</parameter></paramdef>
25325   <paramdef>struct drm_dp_link * <parameter>link</parameter></paramdef>
25326  </funcprototype></funcsynopsis>
25327</refsynopsisdiv>
25328<refsect1>
25329 <title>Arguments</title>
25330 <variablelist>
25331  <varlistentry>
25332   <term><parameter>aux</parameter></term>
25333   <listitem>
25334    <para>
25335     DisplayPort AUX channel
25336    </para>
25337   </listitem>
25338  </varlistentry>
25339  <varlistentry>
25340   <term><parameter>link</parameter></term>
25341   <listitem>
25342    <para>
25343     pointer to a structure containing the link configuration
25344    </para>
25345   </listitem>
25346  </varlistentry>
25347 </variablelist>
25348</refsect1>
25349<refsect1>
25350<title>Description</title>
25351<para>
25352   Returns 0 on success or a negative error code on failure.
25353</para>
25354</refsect1>
25355</refentry>
25356
25357<refentry id="API-drm-dp-link-configure">
25358<refentryinfo>
25359 <title>LINUX</title>
25360 <productname>Kernel Hackers Manual</productname>
25361 <date>July 2017</date>
25362</refentryinfo>
25363<refmeta>
25364 <refentrytitle><phrase>drm_dp_link_configure</phrase></refentrytitle>
25365 <manvolnum>9</manvolnum>
25366 <refmiscinfo class="version">4.4.14</refmiscinfo>
25367</refmeta>
25368<refnamediv>
25369 <refname>drm_dp_link_configure</refname>
25370 <refpurpose>
25371     configure a DisplayPort link
25372 </refpurpose>
25373</refnamediv>
25374<refsynopsisdiv>
25375 <title>Synopsis</title>
25376  <funcsynopsis><funcprototype>
25377   <funcdef>int <function>drm_dp_link_configure </function></funcdef>
25378   <paramdef>struct drm_dp_aux * <parameter>aux</parameter></paramdef>
25379   <paramdef>struct drm_dp_link * <parameter>link</parameter></paramdef>
25380  </funcprototype></funcsynopsis>
25381</refsynopsisdiv>
25382<refsect1>
25383 <title>Arguments</title>
25384 <variablelist>
25385  <varlistentry>
25386   <term><parameter>aux</parameter></term>
25387   <listitem>
25388    <para>
25389     DisplayPort AUX channel
25390    </para>
25391   </listitem>
25392  </varlistentry>
25393  <varlistentry>
25394   <term><parameter>link</parameter></term>
25395   <listitem>
25396    <para>
25397     pointer to a structure containing the link configuration
25398    </para>
25399   </listitem>
25400  </varlistentry>
25401 </variablelist>
25402</refsect1>
25403<refsect1>
25404<title>Description</title>
25405<para>
25406   Returns 0 on success or a negative error code on failure.
25407</para>
25408</refsect1>
25409</refentry>
25410
25411<refentry id="API-drm-dp-aux-register">
25412<refentryinfo>
25413 <title>LINUX</title>
25414 <productname>Kernel Hackers Manual</productname>
25415 <date>July 2017</date>
25416</refentryinfo>
25417<refmeta>
25418 <refentrytitle><phrase>drm_dp_aux_register</phrase></refentrytitle>
25419 <manvolnum>9</manvolnum>
25420 <refmiscinfo class="version">4.4.14</refmiscinfo>
25421</refmeta>
25422<refnamediv>
25423 <refname>drm_dp_aux_register</refname>
25424 <refpurpose>
25425     initialise and register aux channel
25426 </refpurpose>
25427</refnamediv>
25428<refsynopsisdiv>
25429 <title>Synopsis</title>
25430  <funcsynopsis><funcprototype>
25431   <funcdef>int <function>drm_dp_aux_register </function></funcdef>
25432   <paramdef>struct drm_dp_aux * <parameter>aux</parameter></paramdef>
25433  </funcprototype></funcsynopsis>
25434</refsynopsisdiv>
25435<refsect1>
25436 <title>Arguments</title>
25437 <variablelist>
25438  <varlistentry>
25439   <term><parameter>aux</parameter></term>
25440   <listitem>
25441    <para>
25442     DisplayPort AUX channel
25443    </para>
25444   </listitem>
25445  </varlistentry>
25446 </variablelist>
25447</refsect1>
25448<refsect1>
25449<title>Description</title>
25450<para>
25451   Returns 0 on success or a negative error code on failure.
25452</para>
25453</refsect1>
25454</refentry>
25455
25456<refentry id="API-drm-dp-aux-unregister">
25457<refentryinfo>
25458 <title>LINUX</title>
25459 <productname>Kernel Hackers Manual</productname>
25460 <date>July 2017</date>
25461</refentryinfo>
25462<refmeta>
25463 <refentrytitle><phrase>drm_dp_aux_unregister</phrase></refentrytitle>
25464 <manvolnum>9</manvolnum>
25465 <refmiscinfo class="version">4.4.14</refmiscinfo>
25466</refmeta>
25467<refnamediv>
25468 <refname>drm_dp_aux_unregister</refname>
25469 <refpurpose>
25470     unregister an AUX adapter
25471 </refpurpose>
25472</refnamediv>
25473<refsynopsisdiv>
25474 <title>Synopsis</title>
25475  <funcsynopsis><funcprototype>
25476   <funcdef>void <function>drm_dp_aux_unregister </function></funcdef>
25477   <paramdef>struct drm_dp_aux * <parameter>aux</parameter></paramdef>
25478  </funcprototype></funcsynopsis>
25479</refsynopsisdiv>
25480<refsect1>
25481 <title>Arguments</title>
25482 <variablelist>
25483  <varlistentry>
25484   <term><parameter>aux</parameter></term>
25485   <listitem>
25486    <para>
25487     DisplayPort AUX channel
25488    </para>
25489   </listitem>
25490  </varlistentry>
25491 </variablelist>
25492</refsect1>
25493</refentry>
25494
25495    </sect2>
25496    <sect2>
25497      <title>Display Port MST Helper Functions Reference</title>
25498<para>
25499   </para><para>
25500   These functions contain parts of the DisplayPort 1.2a MultiStream Transport
25501   protocol. The helpers contain a topology manager and bandwidth manager.
25502   The helpers encapsulate the sending and received of sideband msgs.
25503</para>
25504
25505<!-- include/drm/drm_dp_mst_helper.h -->
25506<refentry id="API-struct-drm-dp-vcpi">
25507<refentryinfo>
25508 <title>LINUX</title>
25509 <productname>Kernel Hackers Manual</productname>
25510 <date>July 2017</date>
25511</refentryinfo>
25512<refmeta>
25513 <refentrytitle><phrase>struct drm_dp_vcpi</phrase></refentrytitle>
25514 <manvolnum>9</manvolnum>
25515 <refmiscinfo class="version">4.4.14</refmiscinfo>
25516</refmeta>
25517<refnamediv>
25518 <refname>struct drm_dp_vcpi</refname>
25519 <refpurpose>
25520  Virtual Channel Payload Identifier
25521 </refpurpose>
25522</refnamediv>
25523<refsynopsisdiv>
25524 <title>Synopsis</title>
25525  <programlisting>
25526struct drm_dp_vcpi {
25527  int vcpi;
25528  int pbn;
25529  int aligned_pbn;
25530  int num_slots;
25531};  </programlisting>
25532</refsynopsisdiv>
25533 <refsect1>
25534  <title>Members</title>
25535  <variablelist>
25536    <varlistentry>      <term>vcpi</term>
25537      <listitem><para>
25538Virtual channel ID.
25539      </para></listitem>
25540    </varlistentry>
25541    <varlistentry>      <term>pbn</term>
25542      <listitem><para>
25543Payload Bandwidth Number for this channel
25544      </para></listitem>
25545    </varlistentry>
25546    <varlistentry>      <term>aligned_pbn</term>
25547      <listitem><para>
25548PBN aligned with slot size
25549      </para></listitem>
25550    </varlistentry>
25551    <varlistentry>      <term>num_slots</term>
25552      <listitem><para>
25553number of slots for this PBN
25554      </para></listitem>
25555    </varlistentry>
25556  </variablelist>
25557 </refsect1>
25558</refentry>
25559
25560<refentry id="API-struct-drm-dp-mst-port">
25561<refentryinfo>
25562 <title>LINUX</title>
25563 <productname>Kernel Hackers Manual</productname>
25564 <date>July 2017</date>
25565</refentryinfo>
25566<refmeta>
25567 <refentrytitle><phrase>struct drm_dp_mst_port</phrase></refentrytitle>
25568 <manvolnum>9</manvolnum>
25569 <refmiscinfo class="version">4.4.14</refmiscinfo>
25570</refmeta>
25571<refnamediv>
25572 <refname>struct drm_dp_mst_port</refname>
25573 <refpurpose>
25574     MST port
25575 </refpurpose>
25576</refnamediv>
25577<refsynopsisdiv>
25578 <title>Synopsis</title>
25579  <programlisting>
25580struct drm_dp_mst_port {
25581  struct kref kref;
25582  u8 port_num;
25583  bool input;
25584  bool mcs;
25585  bool ddps;
25586  u8 pdt;
25587  bool ldps;
25588  u8 dpcd_rev;
25589  u8 num_sdp_streams;
25590  u8 num_sdp_stream_sinks;
25591  uint16_t available_pbn;
25592  struct list_head next;
25593  struct drm_dp_mst_branch * mstb;
25594  struct drm_dp_aux aux;
25595  struct drm_dp_mst_branch * parent;
25596  struct drm_dp_vcpi vcpi;
25597  struct drm_connector * connector;
25598  struct drm_dp_mst_topology_mgr * mgr;
25599};  </programlisting>
25600</refsynopsisdiv>
25601 <refsect1>
25602  <title>Members</title>
25603  <variablelist>
25604    <varlistentry>      <term>kref</term>
25605      <listitem><para>
25606   reference count for this port.
25607      </para></listitem>
25608    </varlistentry>
25609    <varlistentry>      <term>port_num</term>
25610      <listitem><para>
25611   port number
25612      </para></listitem>
25613    </varlistentry>
25614    <varlistentry>      <term>input</term>
25615      <listitem><para>
25616   if this port is an input port.
25617      </para></listitem>
25618    </varlistentry>
25619    <varlistentry>      <term>mcs</term>
25620      <listitem><para>
25621   message capability status - DP 1.2 spec.
25622      </para></listitem>
25623    </varlistentry>
25624    <varlistentry>      <term>ddps</term>
25625      <listitem><para>
25626   DisplayPort Device Plug Status - DP 1.2
25627      </para></listitem>
25628    </varlistentry>
25629    <varlistentry>      <term>pdt</term>
25630      <listitem><para>
25631   Peer Device Type
25632      </para></listitem>
25633    </varlistentry>
25634    <varlistentry>      <term>ldps</term>
25635      <listitem><para>
25636   Legacy Device Plug Status
25637      </para></listitem>
25638    </varlistentry>
25639    <varlistentry>      <term>dpcd_rev</term>
25640      <listitem><para>
25641   DPCD revision of device on this port
25642      </para></listitem>
25643    </varlistentry>
25644    <varlistentry>      <term>num_sdp_streams</term>
25645      <listitem><para>
25646   Number of simultaneous streams
25647      </para></listitem>
25648    </varlistentry>
25649    <varlistentry>      <term>num_sdp_stream_sinks</term>
25650      <listitem><para>
25651   Number of stream sinks
25652      </para></listitem>
25653    </varlistentry>
25654    <varlistentry>      <term>available_pbn</term>
25655      <listitem><para>
25656   Available bandwidth for this port.
25657      </para></listitem>
25658    </varlistentry>
25659    <varlistentry>      <term>next</term>
25660      <listitem><para>
25661   link to next port on this branch device
25662      </para></listitem>
25663    </varlistentry>
25664    <varlistentry>      <term>mstb</term>
25665      <listitem><para>
25666   branch device attach below this port
25667      </para></listitem>
25668    </varlistentry>
25669    <varlistentry>      <term>aux</term>
25670      <listitem><para>
25671   i2c aux transport to talk to device connected to this port.
25672      </para></listitem>
25673    </varlistentry>
25674    <varlistentry>      <term>parent</term>
25675      <listitem><para>
25676   branch device parent of this port
25677      </para></listitem>
25678    </varlistentry>
25679    <varlistentry>      <term>vcpi</term>
25680      <listitem><para>
25681   Virtual Channel Payload info for this port.
25682      </para></listitem>
25683    </varlistentry>
25684    <varlistentry>      <term>connector</term>
25685      <listitem><para>
25686   DRM connector this port is connected to.
25687      </para></listitem>
25688    </varlistentry>
25689    <varlistentry>      <term>mgr</term>
25690      <listitem><para>
25691   topology manager this port lives under.
25692      </para></listitem>
25693    </varlistentry>
25694  </variablelist>
25695 </refsect1>
25696<refsect1>
25697<title>Description</title>
25698<para>
25699   This structure represents an MST port endpoint on a device somewhere
25700   in the MST topology.
25701</para>
25702</refsect1>
25703</refentry>
25704
25705<refentry id="API-struct-drm-dp-mst-branch">
25706<refentryinfo>
25707 <title>LINUX</title>
25708 <productname>Kernel Hackers Manual</productname>
25709 <date>July 2017</date>
25710</refentryinfo>
25711<refmeta>
25712 <refentrytitle><phrase>struct drm_dp_mst_branch</phrase></refentrytitle>
25713 <manvolnum>9</manvolnum>
25714 <refmiscinfo class="version">4.4.14</refmiscinfo>
25715</refmeta>
25716<refnamediv>
25717 <refname>struct drm_dp_mst_branch</refname>
25718 <refpurpose>
25719     MST branch device.
25720 </refpurpose>
25721</refnamediv>
25722<refsynopsisdiv>
25723 <title>Synopsis</title>
25724  <programlisting>
25725struct drm_dp_mst_branch {
25726  struct kref kref;
25727  u8 rad[8];
25728  u8 lct;
25729  int num_ports;
25730  int msg_slots;
25731  struct list_head ports;
25732  struct drm_dp_mst_port * port_parent;
25733  struct drm_dp_mst_topology_mgr * mgr;
25734  struct drm_dp_sideband_msg_tx * tx_slots[2];
25735  int last_seqno;
25736  bool link_address_sent;
25737  u8 guid[16];
25738};  </programlisting>
25739</refsynopsisdiv>
25740 <refsect1>
25741  <title>Members</title>
25742  <variablelist>
25743    <varlistentry>      <term>kref</term>
25744      <listitem><para>
25745   reference count for this port.
25746      </para></listitem>
25747    </varlistentry>
25748    <varlistentry>      <term>rad[8]</term>
25749      <listitem><para>
25750   Relative Address to talk to this branch device.
25751      </para></listitem>
25752    </varlistentry>
25753    <varlistentry>      <term>lct</term>
25754      <listitem><para>
25755   Link count total to talk to this branch device.
25756      </para></listitem>
25757    </varlistentry>
25758    <varlistentry>      <term>num_ports</term>
25759      <listitem><para>
25760   number of ports on the branch.
25761      </para></listitem>
25762    </varlistentry>
25763    <varlistentry>      <term>msg_slots</term>
25764      <listitem><para>
25765   one bit per transmitted msg slot.
25766      </para></listitem>
25767    </varlistentry>
25768    <varlistentry>      <term>ports</term>
25769      <listitem><para>
25770   linked list of ports on this branch.
25771      </para></listitem>
25772    </varlistentry>
25773    <varlistentry>      <term>port_parent</term>
25774      <listitem><para>
25775   pointer to the port parent, NULL if toplevel.
25776      </para></listitem>
25777    </varlistentry>
25778    <varlistentry>      <term>mgr</term>
25779      <listitem><para>
25780   topology manager for this branch device.
25781      </para></listitem>
25782    </varlistentry>
25783    <varlistentry>      <term>tx_slots[2]</term>
25784      <listitem><para>
25785   transmission slots for this device.
25786      </para></listitem>
25787    </varlistentry>
25788    <varlistentry>      <term>last_seqno</term>
25789      <listitem><para>
25790   last sequence number used to talk to this.
25791      </para></listitem>
25792    </varlistentry>
25793    <varlistentry>      <term>link_address_sent</term>
25794      <listitem><para>
25795   if a link address message has been sent to this device yet.
25796      </para></listitem>
25797    </varlistentry>
25798    <varlistentry>      <term>guid[16]</term>
25799      <listitem><para>
25800   guid for DP 1.2 branch device. port under this branch can be
25801   identified by port #.
25802      </para></listitem>
25803    </varlistentry>
25804  </variablelist>
25805 </refsect1>
25806<refsect1>
25807<title>Description</title>
25808<para>
25809   This structure represents an MST branch device, there is one
25810   primary branch device at the root, along with any other branches connected
25811   to downstream port of parent branches.
25812</para>
25813</refsect1>
25814</refentry>
25815
25816<refentry id="API-struct-drm-dp-mst-topology-mgr">
25817<refentryinfo>
25818 <title>LINUX</title>
25819 <productname>Kernel Hackers Manual</productname>
25820 <date>July 2017</date>
25821</refentryinfo>
25822<refmeta>
25823 <refentrytitle><phrase>struct drm_dp_mst_topology_mgr</phrase></refentrytitle>
25824 <manvolnum>9</manvolnum>
25825 <refmiscinfo class="version">4.4.14</refmiscinfo>
25826</refmeta>
25827<refnamediv>
25828 <refname>struct drm_dp_mst_topology_mgr</refname>
25829 <refpurpose>
25830     DisplayPort MST manager
25831 </refpurpose>
25832</refnamediv>
25833<refsynopsisdiv>
25834 <title>Synopsis</title>
25835  <programlisting>
25836struct drm_dp_mst_topology_mgr {
25837  struct device * dev;
25838  struct drm_dp_mst_topology_cbs * cbs;
25839  struct drm_dp_aux * aux;
25840  int max_payloads;
25841  int conn_base_id;
25842  struct drm_dp_sideband_msg_rx down_rep_recv;
25843  struct drm_dp_sideband_msg_rx up_req_recv;
25844  struct mutex lock;
25845  bool mst_state;
25846  struct drm_dp_mst_branch * mst_primary;
25847  u8 dpcd[DP_RECEIVER_CAP_SIZE];
25848  int pbn_div;
25849};  </programlisting>
25850</refsynopsisdiv>
25851 <refsect1>
25852  <title>Members</title>
25853  <variablelist>
25854    <varlistentry>      <term>dev</term>
25855      <listitem><para>
25856   device pointer for adding i2c devices etc.
25857      </para></listitem>
25858    </varlistentry>
25859    <varlistentry>      <term>cbs</term>
25860      <listitem><para>
25861   callbacks for connector addition and destruction.
25862   <parameter>max_dpcd_transaction_bytes</parameter> - maximum number of bytes to read/write in one go.
25863      </para></listitem>
25864    </varlistentry>
25865    <varlistentry>      <term>aux</term>
25866      <listitem><para>
25867   aux channel for the DP connector.
25868      </para></listitem>
25869    </varlistentry>
25870    <varlistentry>      <term>max_payloads</term>
25871      <listitem><para>
25872   maximum number of payloads the GPU can generate.
25873      </para></listitem>
25874    </varlistentry>
25875    <varlistentry>      <term>conn_base_id</term>
25876      <listitem><para>
25877   DRM connector ID this mgr is connected to.
25878      </para></listitem>
25879    </varlistentry>
25880    <varlistentry>      <term>down_rep_recv</term>
25881      <listitem><para>
25882   msg receiver state for down replies.
25883      </para></listitem>
25884    </varlistentry>
25885    <varlistentry>      <term>up_req_recv</term>
25886      <listitem><para>
25887   msg receiver state for up requests.
25888      </para></listitem>
25889    </varlistentry>
25890    <varlistentry>      <term>lock</term>
25891      <listitem><para>
25892   protects mst state, primary, dpcd.
25893      </para></listitem>
25894    </varlistentry>
25895    <varlistentry>      <term>mst_state</term>
25896      <listitem><para>
25897   if this manager is enabled for an MST capable port.
25898      </para></listitem>
25899    </varlistentry>
25900    <varlistentry>      <term>mst_primary</term>
25901      <listitem><para>
25902   pointer to the primary branch device.
25903      </para></listitem>
25904    </varlistentry>
25905    <varlistentry>      <term>dpcd[DP_RECEIVER_CAP_SIZE]</term>
25906      <listitem><para>
25907   cache of DPCD for primary port.
25908      </para></listitem>
25909    </varlistentry>
25910    <varlistentry>      <term>pbn_div</term>
25911      <listitem><para>
25912   PBN to slots divisor.
25913      </para></listitem>
25914    </varlistentry>
25915  </variablelist>
25916 </refsect1>
25917<refsect1>
25918<title>Description</title>
25919<para>
25920   This struct represents the toplevel displayport MST topology manager.
25921   There should be one instance of this for every MST capable DP connector
25922   on the GPU.
25923</para>
25924</refsect1>
25925</refentry>
25926
25927<!-- drivers/gpu/drm/drm_dp_mst_topology.c -->
25928<refentry id="API-drm-dp-update-payload-part1">
25929<refentryinfo>
25930 <title>LINUX</title>
25931 <productname>Kernel Hackers Manual</productname>
25932 <date>July 2017</date>
25933</refentryinfo>
25934<refmeta>
25935 <refentrytitle><phrase>drm_dp_update_payload_part1</phrase></refentrytitle>
25936 <manvolnum>9</manvolnum>
25937 <refmiscinfo class="version">4.4.14</refmiscinfo>
25938</refmeta>
25939<refnamediv>
25940 <refname>drm_dp_update_payload_part1</refname>
25941 <refpurpose>
25942  Execute payload update part 1
25943 </refpurpose>
25944</refnamediv>
25945<refsynopsisdiv>
25946 <title>Synopsis</title>
25947  <funcsynopsis><funcprototype>
25948   <funcdef>int <function>drm_dp_update_payload_part1 </function></funcdef>
25949   <paramdef>struct drm_dp_mst_topology_mgr * <parameter>mgr</parameter></paramdef>
25950  </funcprototype></funcsynopsis>
25951</refsynopsisdiv>
25952<refsect1>
25953 <title>Arguments</title>
25954 <variablelist>
25955  <varlistentry>
25956   <term><parameter>mgr</parameter></term>
25957   <listitem>
25958    <para>
25959     manager to use.
25960    </para>
25961   </listitem>
25962  </varlistentry>
25963 </variablelist>
25964</refsect1>
25965<refsect1>
25966<title>Description</title>
25967<para>
25968   This iterates over all proposed virtual channels, and tries to
25969   allocate space in the link for them. For 0-&gt;slots transitions,
25970   this step just writes the VCPI to the MST device. For slots-&gt;0
25971   transitions, this writes the updated VCPIs and removes the
25972   remote VC payloads.
25973   </para><para>
25974
25975   after calling this the driver should generate ACT and payload
25976   packets.
25977</para>
25978</refsect1>
25979</refentry>
25980
25981<refentry id="API-drm-dp-update-payload-part2">
25982<refentryinfo>
25983 <title>LINUX</title>
25984 <productname>Kernel Hackers Manual</productname>
25985 <date>July 2017</date>
25986</refentryinfo>
25987<refmeta>
25988 <refentrytitle><phrase>drm_dp_update_payload_part2</phrase></refentrytitle>
25989 <manvolnum>9</manvolnum>
25990 <refmiscinfo class="version">4.4.14</refmiscinfo>
25991</refmeta>
25992<refnamediv>
25993 <refname>drm_dp_update_payload_part2</refname>
25994 <refpurpose>
25995     Execute payload update part 2
25996 </refpurpose>
25997</refnamediv>
25998<refsynopsisdiv>
25999 <title>Synopsis</title>
26000  <funcsynopsis><funcprototype>
26001   <funcdef>int <function>drm_dp_update_payload_part2 </function></funcdef>
26002   <paramdef>struct drm_dp_mst_topology_mgr * <parameter>mgr</parameter></paramdef>
26003  </funcprototype></funcsynopsis>
26004</refsynopsisdiv>
26005<refsect1>
26006 <title>Arguments</title>
26007 <variablelist>
26008  <varlistentry>
26009   <term><parameter>mgr</parameter></term>
26010   <listitem>
26011    <para>
26012     manager to use.
26013    </para>
26014   </listitem>
26015  </varlistentry>
26016 </variablelist>
26017</refsect1>
26018<refsect1>
26019<title>Description</title>
26020<para>
26021   This iterates over all proposed virtual channels, and tries to
26022   allocate space in the link for them. For 0-&gt;slots transitions,
26023   this step writes the remote VC payload commands. For slots-&gt;0
26024   this just resets some internal state.
26025</para>
26026</refsect1>
26027</refentry>
26028
26029<refentry id="API-drm-dp-mst-topology-mgr-set-mst">
26030<refentryinfo>
26031 <title>LINUX</title>
26032 <productname>Kernel Hackers Manual</productname>
26033 <date>July 2017</date>
26034</refentryinfo>
26035<refmeta>
26036 <refentrytitle><phrase>drm_dp_mst_topology_mgr_set_mst</phrase></refentrytitle>
26037 <manvolnum>9</manvolnum>
26038 <refmiscinfo class="version">4.4.14</refmiscinfo>
26039</refmeta>
26040<refnamediv>
26041 <refname>drm_dp_mst_topology_mgr_set_mst</refname>
26042 <refpurpose>
26043     Set the MST state for a topology manager
26044 </refpurpose>
26045</refnamediv>
26046<refsynopsisdiv>
26047 <title>Synopsis</title>
26048  <funcsynopsis><funcprototype>
26049   <funcdef>int <function>drm_dp_mst_topology_mgr_set_mst </function></funcdef>
26050   <paramdef>struct drm_dp_mst_topology_mgr * <parameter>mgr</parameter></paramdef>
26051   <paramdef>bool <parameter>mst_state</parameter></paramdef>
26052  </funcprototype></funcsynopsis>
26053</refsynopsisdiv>
26054<refsect1>
26055 <title>Arguments</title>
26056 <variablelist>
26057  <varlistentry>
26058   <term><parameter>mgr</parameter></term>
26059   <listitem>
26060    <para>
26061     manager to set state for
26062    </para>
26063   </listitem>
26064  </varlistentry>
26065  <varlistentry>
26066   <term><parameter>mst_state</parameter></term>
26067   <listitem>
26068    <para>
26069     true to enable MST on this connector - false to disable.
26070    </para>
26071   </listitem>
26072  </varlistentry>
26073 </variablelist>
26074</refsect1>
26075<refsect1>
26076<title>Description</title>
26077<para>
26078   This is called by the driver when it detects an MST capable device plugged
26079   into a DP MST capable port, or when a DP MST capable device is unplugged.
26080</para>
26081</refsect1>
26082</refentry>
26083
26084<refentry id="API-drm-dp-mst-topology-mgr-suspend">
26085<refentryinfo>
26086 <title>LINUX</title>
26087 <productname>Kernel Hackers Manual</productname>
26088 <date>July 2017</date>
26089</refentryinfo>
26090<refmeta>
26091 <refentrytitle><phrase>drm_dp_mst_topology_mgr_suspend</phrase></refentrytitle>
26092 <manvolnum>9</manvolnum>
26093 <refmiscinfo class="version">4.4.14</refmiscinfo>
26094</refmeta>
26095<refnamediv>
26096 <refname>drm_dp_mst_topology_mgr_suspend</refname>
26097 <refpurpose>
26098     suspend the MST manager
26099 </refpurpose>
26100</refnamediv>
26101<refsynopsisdiv>
26102 <title>Synopsis</title>
26103  <funcsynopsis><funcprototype>
26104   <funcdef>void <function>drm_dp_mst_topology_mgr_suspend </function></funcdef>
26105   <paramdef>struct drm_dp_mst_topology_mgr * <parameter>mgr</parameter></paramdef>
26106  </funcprototype></funcsynopsis>
26107</refsynopsisdiv>
26108<refsect1>
26109 <title>Arguments</title>
26110 <variablelist>
26111  <varlistentry>
26112   <term><parameter>mgr</parameter></term>
26113   <listitem>
26114    <para>
26115     manager to suspend
26116    </para>
26117   </listitem>
26118  </varlistentry>
26119 </variablelist>
26120</refsect1>
26121<refsect1>
26122<title>Description</title>
26123<para>
26124   This function tells the MST device that we can't handle UP messages
26125   anymore. This should stop it from sending any since we are suspended.
26126</para>
26127</refsect1>
26128</refentry>
26129
26130<refentry id="API-drm-dp-mst-topology-mgr-resume">
26131<refentryinfo>
26132 <title>LINUX</title>
26133 <productname>Kernel Hackers Manual</productname>
26134 <date>July 2017</date>
26135</refentryinfo>
26136<refmeta>
26137 <refentrytitle><phrase>drm_dp_mst_topology_mgr_resume</phrase></refentrytitle>
26138 <manvolnum>9</manvolnum>
26139 <refmiscinfo class="version">4.4.14</refmiscinfo>
26140</refmeta>
26141<refnamediv>
26142 <refname>drm_dp_mst_topology_mgr_resume</refname>
26143 <refpurpose>
26144     resume the MST manager
26145 </refpurpose>
26146</refnamediv>
26147<refsynopsisdiv>
26148 <title>Synopsis</title>
26149  <funcsynopsis><funcprototype>
26150   <funcdef>int <function>drm_dp_mst_topology_mgr_resume </function></funcdef>
26151   <paramdef>struct drm_dp_mst_topology_mgr * <parameter>mgr</parameter></paramdef>
26152  </funcprototype></funcsynopsis>
26153</refsynopsisdiv>
26154<refsect1>
26155 <title>Arguments</title>
26156 <variablelist>
26157  <varlistentry>
26158   <term><parameter>mgr</parameter></term>
26159   <listitem>
26160    <para>
26161     manager to resume
26162    </para>
26163   </listitem>
26164  </varlistentry>
26165 </variablelist>
26166</refsect1>
26167<refsect1>
26168<title>Description</title>
26169<para>
26170   This will fetch DPCD and see if the device is still there,
26171   if it is, it will rewrite the MSTM control bits, and return.
26172   </para><para>
26173
26174   if the device fails this returns -1, and the driver should do
26175   a full MST reprobe, in case we were undocked.
26176</para>
26177</refsect1>
26178</refentry>
26179
26180<refentry id="API-drm-dp-mst-hpd-irq">
26181<refentryinfo>
26182 <title>LINUX</title>
26183 <productname>Kernel Hackers Manual</productname>
26184 <date>July 2017</date>
26185</refentryinfo>
26186<refmeta>
26187 <refentrytitle><phrase>drm_dp_mst_hpd_irq</phrase></refentrytitle>
26188 <manvolnum>9</manvolnum>
26189 <refmiscinfo class="version">4.4.14</refmiscinfo>
26190</refmeta>
26191<refnamediv>
26192 <refname>drm_dp_mst_hpd_irq</refname>
26193 <refpurpose>
26194     MST hotplug IRQ notify
26195 </refpurpose>
26196</refnamediv>
26197<refsynopsisdiv>
26198 <title>Synopsis</title>
26199  <funcsynopsis><funcprototype>
26200   <funcdef>int <function>drm_dp_mst_hpd_irq </function></funcdef>
26201   <paramdef>struct drm_dp_mst_topology_mgr * <parameter>mgr</parameter></paramdef>
26202   <paramdef>u8 * <parameter>esi</parameter></paramdef>
26203   <paramdef>bool * <parameter>handled</parameter></paramdef>
26204  </funcprototype></funcsynopsis>
26205</refsynopsisdiv>
26206<refsect1>
26207 <title>Arguments</title>
26208 <variablelist>
26209  <varlistentry>
26210   <term><parameter>mgr</parameter></term>
26211   <listitem>
26212    <para>
26213     manager to notify irq for.
26214    </para>
26215   </listitem>
26216  </varlistentry>
26217  <varlistentry>
26218   <term><parameter>esi</parameter></term>
26219   <listitem>
26220    <para>
26221     4 bytes from SINK_COUNT_ESI
26222    </para>
26223   </listitem>
26224  </varlistentry>
26225  <varlistentry>
26226   <term><parameter>handled</parameter></term>
26227   <listitem>
26228    <para>
26229     whether the hpd interrupt was consumed or not
26230    </para>
26231   </listitem>
26232  </varlistentry>
26233 </variablelist>
26234</refsect1>
26235<refsect1>
26236<title>Description</title>
26237<para>
26238   This should be called from the driver when it detects a short IRQ,
26239   along with the value of the DEVICE_SERVICE_IRQ_VECTOR_ESI0. The
26240   topology manager will process the sideband messages received as a result
26241   of this.
26242</para>
26243</refsect1>
26244</refentry>
26245
26246<refentry id="API-drm-dp-mst-detect-port">
26247<refentryinfo>
26248 <title>LINUX</title>
26249 <productname>Kernel Hackers Manual</productname>
26250 <date>July 2017</date>
26251</refentryinfo>
26252<refmeta>
26253 <refentrytitle><phrase>drm_dp_mst_detect_port</phrase></refentrytitle>
26254 <manvolnum>9</manvolnum>
26255 <refmiscinfo class="version">4.4.14</refmiscinfo>
26256</refmeta>
26257<refnamediv>
26258 <refname>drm_dp_mst_detect_port</refname>
26259 <refpurpose>
26260     get connection status for an MST port
26261 </refpurpose>
26262</refnamediv>
26263<refsynopsisdiv>
26264 <title>Synopsis</title>
26265  <funcsynopsis><funcprototype>
26266   <funcdef>enum drm_connector_status <function>drm_dp_mst_detect_port </function></funcdef>
26267   <paramdef>struct drm_connector * <parameter>connector</parameter></paramdef>
26268   <paramdef>struct drm_dp_mst_topology_mgr * <parameter>mgr</parameter></paramdef>
26269   <paramdef>struct drm_dp_mst_port * <parameter>port</parameter></paramdef>
26270  </funcprototype></funcsynopsis>
26271</refsynopsisdiv>
26272<refsect1>
26273 <title>Arguments</title>
26274 <variablelist>
26275  <varlistentry>
26276   <term><parameter>connector</parameter></term>
26277   <listitem>
26278    <para>
26279     -- undescribed --
26280    </para>
26281   </listitem>
26282  </varlistentry>
26283  <varlistentry>
26284   <term><parameter>mgr</parameter></term>
26285   <listitem>
26286    <para>
26287     manager for this port
26288    </para>
26289   </listitem>
26290  </varlistentry>
26291  <varlistentry>
26292   <term><parameter>port</parameter></term>
26293   <listitem>
26294    <para>
26295     unverified pointer to a port
26296    </para>
26297   </listitem>
26298  </varlistentry>
26299 </variablelist>
26300</refsect1>
26301<refsect1>
26302<title>Description</title>
26303<para>
26304   This returns the current connection state for a port. It validates the
26305   port pointer still exists so the caller doesn't require a reference
26306</para>
26307</refsect1>
26308</refentry>
26309
26310<refentry id="API-drm-dp-mst-get-edid">
26311<refentryinfo>
26312 <title>LINUX</title>
26313 <productname>Kernel Hackers Manual</productname>
26314 <date>July 2017</date>
26315</refentryinfo>
26316<refmeta>
26317 <refentrytitle><phrase>drm_dp_mst_get_edid</phrase></refentrytitle>
26318 <manvolnum>9</manvolnum>
26319 <refmiscinfo class="version">4.4.14</refmiscinfo>
26320</refmeta>
26321<refnamediv>
26322 <refname>drm_dp_mst_get_edid</refname>
26323 <refpurpose>
26324     get EDID for an MST port
26325 </refpurpose>
26326</refnamediv>
26327<refsynopsisdiv>
26328 <title>Synopsis</title>
26329  <funcsynopsis><funcprototype>
26330   <funcdef>struct edid * <function>drm_dp_mst_get_edid </function></funcdef>
26331   <paramdef>struct drm_connector * <parameter>connector</parameter></paramdef>
26332   <paramdef>struct drm_dp_mst_topology_mgr * <parameter>mgr</parameter></paramdef>
26333   <paramdef>struct drm_dp_mst_port * <parameter>port</parameter></paramdef>
26334  </funcprototype></funcsynopsis>
26335</refsynopsisdiv>
26336<refsect1>
26337 <title>Arguments</title>
26338 <variablelist>
26339  <varlistentry>
26340   <term><parameter>connector</parameter></term>
26341   <listitem>
26342    <para>
26343     toplevel connector to get EDID for
26344    </para>
26345   </listitem>
26346  </varlistentry>
26347  <varlistentry>
26348   <term><parameter>mgr</parameter></term>
26349   <listitem>
26350    <para>
26351     manager for this port
26352    </para>
26353   </listitem>
26354  </varlistentry>
26355  <varlistentry>
26356   <term><parameter>port</parameter></term>
26357   <listitem>
26358    <para>
26359     unverified pointer to a port.
26360    </para>
26361   </listitem>
26362  </varlistentry>
26363 </variablelist>
26364</refsect1>
26365<refsect1>
26366<title>Description</title>
26367<para>
26368   This returns an EDID for the port connected to a connector,
26369   It validates the pointer still exists so the caller doesn't require a
26370   reference.
26371</para>
26372</refsect1>
26373</refentry>
26374
26375<refentry id="API-drm-dp-find-vcpi-slots">
26376<refentryinfo>
26377 <title>LINUX</title>
26378 <productname>Kernel Hackers Manual</productname>
26379 <date>July 2017</date>
26380</refentryinfo>
26381<refmeta>
26382 <refentrytitle><phrase>drm_dp_find_vcpi_slots</phrase></refentrytitle>
26383 <manvolnum>9</manvolnum>
26384 <refmiscinfo class="version">4.4.14</refmiscinfo>
26385</refmeta>
26386<refnamediv>
26387 <refname>drm_dp_find_vcpi_slots</refname>
26388 <refpurpose>
26389     find slots for this PBN value
26390 </refpurpose>
26391</refnamediv>
26392<refsynopsisdiv>
26393 <title>Synopsis</title>
26394  <funcsynopsis><funcprototype>
26395   <funcdef>int <function>drm_dp_find_vcpi_slots </function></funcdef>
26396   <paramdef>struct drm_dp_mst_topology_mgr * <parameter>mgr</parameter></paramdef>
26397   <paramdef>int <parameter>pbn</parameter></paramdef>
26398  </funcprototype></funcsynopsis>
26399</refsynopsisdiv>
26400<refsect1>
26401 <title>Arguments</title>
26402 <variablelist>
26403  <varlistentry>
26404   <term><parameter>mgr</parameter></term>
26405   <listitem>
26406    <para>
26407     manager to use
26408    </para>
26409   </listitem>
26410  </varlistentry>
26411  <varlistentry>
26412   <term><parameter>pbn</parameter></term>
26413   <listitem>
26414    <para>
26415     payload bandwidth to convert into slots.
26416    </para>
26417   </listitem>
26418  </varlistentry>
26419 </variablelist>
26420</refsect1>
26421</refentry>
26422
26423<refentry id="API-drm-dp-mst-allocate-vcpi">
26424<refentryinfo>
26425 <title>LINUX</title>
26426 <productname>Kernel Hackers Manual</productname>
26427 <date>July 2017</date>
26428</refentryinfo>
26429<refmeta>
26430 <refentrytitle><phrase>drm_dp_mst_allocate_vcpi</phrase></refentrytitle>
26431 <manvolnum>9</manvolnum>
26432 <refmiscinfo class="version">4.4.14</refmiscinfo>
26433</refmeta>
26434<refnamediv>
26435 <refname>drm_dp_mst_allocate_vcpi</refname>
26436 <refpurpose>
26437     Allocate a virtual channel
26438 </refpurpose>
26439</refnamediv>
26440<refsynopsisdiv>
26441 <title>Synopsis</title>
26442  <funcsynopsis><funcprototype>
26443   <funcdef>bool <function>drm_dp_mst_allocate_vcpi </function></funcdef>
26444   <paramdef>struct drm_dp_mst_topology_mgr * <parameter>mgr</parameter></paramdef>
26445   <paramdef>struct drm_dp_mst_port * <parameter>port</parameter></paramdef>
26446   <paramdef>int <parameter>pbn</parameter></paramdef>
26447   <paramdef>int * <parameter>slots</parameter></paramdef>
26448  </funcprototype></funcsynopsis>
26449</refsynopsisdiv>
26450<refsect1>
26451 <title>Arguments</title>
26452 <variablelist>
26453  <varlistentry>
26454   <term><parameter>mgr</parameter></term>
26455   <listitem>
26456    <para>
26457     manager for this port
26458    </para>
26459   </listitem>
26460  </varlistentry>
26461  <varlistentry>
26462   <term><parameter>port</parameter></term>
26463   <listitem>
26464    <para>
26465     port to allocate a virtual channel for.
26466    </para>
26467   </listitem>
26468  </varlistentry>
26469  <varlistentry>
26470   <term><parameter>pbn</parameter></term>
26471   <listitem>
26472    <para>
26473     payload bandwidth number to request
26474    </para>
26475   </listitem>
26476  </varlistentry>
26477  <varlistentry>
26478   <term><parameter>slots</parameter></term>
26479   <listitem>
26480    <para>
26481     returned number of slots for this PBN.
26482    </para>
26483   </listitem>
26484  </varlistentry>
26485 </variablelist>
26486</refsect1>
26487</refentry>
26488
26489<refentry id="API-drm-dp-mst-reset-vcpi-slots">
26490<refentryinfo>
26491 <title>LINUX</title>
26492 <productname>Kernel Hackers Manual</productname>
26493 <date>July 2017</date>
26494</refentryinfo>
26495<refmeta>
26496 <refentrytitle><phrase>drm_dp_mst_reset_vcpi_slots</phrase></refentrytitle>
26497 <manvolnum>9</manvolnum>
26498 <refmiscinfo class="version">4.4.14</refmiscinfo>
26499</refmeta>
26500<refnamediv>
26501 <refname>drm_dp_mst_reset_vcpi_slots</refname>
26502 <refpurpose>
26503     Reset number of slots to 0 for VCPI
26504 </refpurpose>
26505</refnamediv>
26506<refsynopsisdiv>
26507 <title>Synopsis</title>
26508  <funcsynopsis><funcprototype>
26509   <funcdef>void <function>drm_dp_mst_reset_vcpi_slots </function></funcdef>
26510   <paramdef>struct drm_dp_mst_topology_mgr * <parameter>mgr</parameter></paramdef>
26511   <paramdef>struct drm_dp_mst_port * <parameter>port</parameter></paramdef>
26512  </funcprototype></funcsynopsis>
26513</refsynopsisdiv>
26514<refsect1>
26515 <title>Arguments</title>
26516 <variablelist>
26517  <varlistentry>
26518   <term><parameter>mgr</parameter></term>
26519   <listitem>
26520    <para>
26521     manager for this port
26522    </para>
26523   </listitem>
26524  </varlistentry>
26525  <varlistentry>
26526   <term><parameter>port</parameter></term>
26527   <listitem>
26528    <para>
26529     unverified pointer to a port.
26530    </para>
26531   </listitem>
26532  </varlistentry>
26533 </variablelist>
26534</refsect1>
26535<refsect1>
26536<title>Description</title>
26537<para>
26538   This just resets the number of slots for the ports VCPI for later programming.
26539</para>
26540</refsect1>
26541</refentry>
26542
26543<refentry id="API-drm-dp-mst-deallocate-vcpi">
26544<refentryinfo>
26545 <title>LINUX</title>
26546 <productname>Kernel Hackers Manual</productname>
26547 <date>July 2017</date>
26548</refentryinfo>
26549<refmeta>
26550 <refentrytitle><phrase>drm_dp_mst_deallocate_vcpi</phrase></refentrytitle>
26551 <manvolnum>9</manvolnum>
26552 <refmiscinfo class="version">4.4.14</refmiscinfo>
26553</refmeta>
26554<refnamediv>
26555 <refname>drm_dp_mst_deallocate_vcpi</refname>
26556 <refpurpose>
26557     deallocate a VCPI
26558 </refpurpose>
26559</refnamediv>
26560<refsynopsisdiv>
26561 <title>Synopsis</title>
26562  <funcsynopsis><funcprototype>
26563   <funcdef>void <function>drm_dp_mst_deallocate_vcpi </function></funcdef>
26564   <paramdef>struct drm_dp_mst_topology_mgr * <parameter>mgr</parameter></paramdef>
26565   <paramdef>struct drm_dp_mst_port * <parameter>port</parameter></paramdef>
26566  </funcprototype></funcsynopsis>
26567</refsynopsisdiv>
26568<refsect1>
26569 <title>Arguments</title>
26570 <variablelist>
26571  <varlistentry>
26572   <term><parameter>mgr</parameter></term>
26573   <listitem>
26574    <para>
26575     manager for this port
26576    </para>
26577   </listitem>
26578  </varlistentry>
26579  <varlistentry>
26580   <term><parameter>port</parameter></term>
26581   <listitem>
26582    <para>
26583     unverified port to deallocate vcpi for
26584    </para>
26585   </listitem>
26586  </varlistentry>
26587 </variablelist>
26588</refsect1>
26589</refentry>
26590
26591<refentry id="API-drm-dp-check-act-status">
26592<refentryinfo>
26593 <title>LINUX</title>
26594 <productname>Kernel Hackers Manual</productname>
26595 <date>July 2017</date>
26596</refentryinfo>
26597<refmeta>
26598 <refentrytitle><phrase>drm_dp_check_act_status</phrase></refentrytitle>
26599 <manvolnum>9</manvolnum>
26600 <refmiscinfo class="version">4.4.14</refmiscinfo>
26601</refmeta>
26602<refnamediv>
26603 <refname>drm_dp_check_act_status</refname>
26604 <refpurpose>
26605     Check ACT handled status.
26606 </refpurpose>
26607</refnamediv>
26608<refsynopsisdiv>
26609 <title>Synopsis</title>
26610  <funcsynopsis><funcprototype>
26611   <funcdef>int <function>drm_dp_check_act_status </function></funcdef>
26612   <paramdef>struct drm_dp_mst_topology_mgr * <parameter>mgr</parameter></paramdef>
26613  </funcprototype></funcsynopsis>
26614</refsynopsisdiv>
26615<refsect1>
26616 <title>Arguments</title>
26617 <variablelist>
26618  <varlistentry>
26619   <term><parameter>mgr</parameter></term>
26620   <listitem>
26621    <para>
26622     manager to use
26623    </para>
26624   </listitem>
26625  </varlistentry>
26626 </variablelist>
26627</refsect1>
26628<refsect1>
26629<title>Description</title>
26630<para>
26631   Check the payload status bits in the DPCD for ACT handled completion.
26632</para>
26633</refsect1>
26634</refentry>
26635
26636<refentry id="API-drm-dp-calc-pbn-mode">
26637<refentryinfo>
26638 <title>LINUX</title>
26639 <productname>Kernel Hackers Manual</productname>
26640 <date>July 2017</date>
26641</refentryinfo>
26642<refmeta>
26643 <refentrytitle><phrase>drm_dp_calc_pbn_mode</phrase></refentrytitle>
26644 <manvolnum>9</manvolnum>
26645 <refmiscinfo class="version">4.4.14</refmiscinfo>
26646</refmeta>
26647<refnamediv>
26648 <refname>drm_dp_calc_pbn_mode</refname>
26649 <refpurpose>
26650     Calculate the PBN for a mode.
26651 </refpurpose>
26652</refnamediv>
26653<refsynopsisdiv>
26654 <title>Synopsis</title>
26655  <funcsynopsis><funcprototype>
26656   <funcdef>int <function>drm_dp_calc_pbn_mode </function></funcdef>
26657   <paramdef>int <parameter>clock</parameter></paramdef>
26658   <paramdef>int <parameter>bpp</parameter></paramdef>
26659  </funcprototype></funcsynopsis>
26660</refsynopsisdiv>
26661<refsect1>
26662 <title>Arguments</title>
26663 <variablelist>
26664  <varlistentry>
26665   <term><parameter>clock</parameter></term>
26666   <listitem>
26667    <para>
26668     dot clock for the mode
26669    </para>
26670   </listitem>
26671  </varlistentry>
26672  <varlistentry>
26673   <term><parameter>bpp</parameter></term>
26674   <listitem>
26675    <para>
26676     bpp for the mode.
26677    </para>
26678   </listitem>
26679  </varlistentry>
26680 </variablelist>
26681</refsect1>
26682<refsect1>
26683<title>Description</title>
26684<para>
26685   This uses the formula in the spec to calculate the PBN value for a mode.
26686</para>
26687</refsect1>
26688</refentry>
26689
26690<refentry id="API-drm-dp-mst-dump-topology">
26691<refentryinfo>
26692 <title>LINUX</title>
26693 <productname>Kernel Hackers Manual</productname>
26694 <date>July 2017</date>
26695</refentryinfo>
26696<refmeta>
26697 <refentrytitle><phrase>drm_dp_mst_dump_topology</phrase></refentrytitle>
26698 <manvolnum>9</manvolnum>
26699 <refmiscinfo class="version">4.4.14</refmiscinfo>
26700</refmeta>
26701<refnamediv>
26702 <refname>drm_dp_mst_dump_topology</refname>
26703 <refpurpose>
26704   </refpurpose>
26705</refnamediv>
26706<refsynopsisdiv>
26707 <title>Synopsis</title>
26708  <funcsynopsis><funcprototype>
26709   <funcdef>void <function>drm_dp_mst_dump_topology </function></funcdef>
26710   <paramdef>struct seq_file * <parameter>m</parameter></paramdef>
26711   <paramdef>struct drm_dp_mst_topology_mgr * <parameter>mgr</parameter></paramdef>
26712  </funcprototype></funcsynopsis>
26713</refsynopsisdiv>
26714<refsect1>
26715 <title>Arguments</title>
26716 <variablelist>
26717  <varlistentry>
26718   <term><parameter>m</parameter></term>
26719   <listitem>
26720    <para>
26721     seq_file to dump output to
26722    </para>
26723   </listitem>
26724  </varlistentry>
26725  <varlistentry>
26726   <term><parameter>mgr</parameter></term>
26727   <listitem>
26728    <para>
26729     manager to dump current topology for.
26730    </para>
26731   </listitem>
26732  </varlistentry>
26733 </variablelist>
26734</refsect1>
26735<refsect1>
26736<title>Description</title>
26737<para>
26738   helper to dump MST topology to a seq file for debugfs.
26739</para>
26740</refsect1>
26741</refentry>
26742
26743<refentry id="API-drm-dp-mst-topology-mgr-init">
26744<refentryinfo>
26745 <title>LINUX</title>
26746 <productname>Kernel Hackers Manual</productname>
26747 <date>July 2017</date>
26748</refentryinfo>
26749<refmeta>
26750 <refentrytitle><phrase>drm_dp_mst_topology_mgr_init</phrase></refentrytitle>
26751 <manvolnum>9</manvolnum>
26752 <refmiscinfo class="version">4.4.14</refmiscinfo>
26753</refmeta>
26754<refnamediv>
26755 <refname>drm_dp_mst_topology_mgr_init</refname>
26756 <refpurpose>
26757     initialise a topology manager
26758 </refpurpose>
26759</refnamediv>
26760<refsynopsisdiv>
26761 <title>Synopsis</title>
26762  <funcsynopsis><funcprototype>
26763   <funcdef>int <function>drm_dp_mst_topology_mgr_init </function></funcdef>
26764   <paramdef>struct drm_dp_mst_topology_mgr * <parameter>mgr</parameter></paramdef>
26765   <paramdef>struct device * <parameter>dev</parameter></paramdef>
26766   <paramdef>struct drm_dp_aux * <parameter>aux</parameter></paramdef>
26767   <paramdef>int <parameter>max_dpcd_transaction_bytes</parameter></paramdef>
26768   <paramdef>int <parameter>max_payloads</parameter></paramdef>
26769   <paramdef>int <parameter>conn_base_id</parameter></paramdef>
26770  </funcprototype></funcsynopsis>
26771</refsynopsisdiv>
26772<refsect1>
26773 <title>Arguments</title>
26774 <variablelist>
26775  <varlistentry>
26776   <term><parameter>mgr</parameter></term>
26777   <listitem>
26778    <para>
26779     manager struct to initialise
26780    </para>
26781   </listitem>
26782  </varlistentry>
26783  <varlistentry>
26784   <term><parameter>dev</parameter></term>
26785   <listitem>
26786    <para>
26787     device providing this structure - for i2c addition.
26788    </para>
26789   </listitem>
26790  </varlistentry>
26791  <varlistentry>
26792   <term><parameter>aux</parameter></term>
26793   <listitem>
26794    <para>
26795     DP helper aux channel to talk to this device
26796    </para>
26797   </listitem>
26798  </varlistentry>
26799  <varlistentry>
26800   <term><parameter>max_dpcd_transaction_bytes</parameter></term>
26801   <listitem>
26802    <para>
26803     hw specific DPCD transaction limit
26804    </para>
26805   </listitem>
26806  </varlistentry>
26807  <varlistentry>
26808   <term><parameter>max_payloads</parameter></term>
26809   <listitem>
26810    <para>
26811     maximum number of payloads this GPU can source
26812    </para>
26813   </listitem>
26814  </varlistentry>
26815  <varlistentry>
26816   <term><parameter>conn_base_id</parameter></term>
26817   <listitem>
26818    <para>
26819     the connector object ID the MST device is connected to.
26820    </para>
26821   </listitem>
26822  </varlistentry>
26823 </variablelist>
26824</refsect1>
26825<refsect1>
26826<title>Description</title>
26827<para>
26828   Return 0 for success, or negative error code on failure
26829</para>
26830</refsect1>
26831</refentry>
26832
26833<refentry id="API-drm-dp-mst-topology-mgr-destroy">
26834<refentryinfo>
26835 <title>LINUX</title>
26836 <productname>Kernel Hackers Manual</productname>
26837 <date>July 2017</date>
26838</refentryinfo>
26839<refmeta>
26840 <refentrytitle><phrase>drm_dp_mst_topology_mgr_destroy</phrase></refentrytitle>
26841 <manvolnum>9</manvolnum>
26842 <refmiscinfo class="version">4.4.14</refmiscinfo>
26843</refmeta>
26844<refnamediv>
26845 <refname>drm_dp_mst_topology_mgr_destroy</refname>
26846 <refpurpose>
26847     destroy topology manager.
26848 </refpurpose>
26849</refnamediv>
26850<refsynopsisdiv>
26851 <title>Synopsis</title>
26852  <funcsynopsis><funcprototype>
26853   <funcdef>void <function>drm_dp_mst_topology_mgr_destroy </function></funcdef>
26854   <paramdef>struct drm_dp_mst_topology_mgr * <parameter>mgr</parameter></paramdef>
26855  </funcprototype></funcsynopsis>
26856</refsynopsisdiv>
26857<refsect1>
26858 <title>Arguments</title>
26859 <variablelist>
26860  <varlistentry>
26861   <term><parameter>mgr</parameter></term>
26862   <listitem>
26863    <para>
26864     manager to destroy
26865    </para>
26866   </listitem>
26867  </varlistentry>
26868 </variablelist>
26869</refsect1>
26870</refentry>
26871
26872    </sect2>
26873    <sect2>
26874      <title>MIPI DSI Helper Functions Reference</title>
26875<para>
26876   </para><para>
26877   These functions contain some common logic and helpers to deal with MIPI DSI
26878   peripherals.
26879   </para><para>
26880   Helpers are provided for a number of standard MIPI DSI command as well as a
26881   subset of the MIPI DCS command set.
26882</para>
26883
26884<!-- include/drm/drm_mipi_dsi.h -->
26885<refentry id="API-struct-mipi-dsi-msg">
26886<refentryinfo>
26887 <title>LINUX</title>
26888 <productname>Kernel Hackers Manual</productname>
26889 <date>July 2017</date>
26890</refentryinfo>
26891<refmeta>
26892 <refentrytitle><phrase>struct mipi_dsi_msg</phrase></refentrytitle>
26893 <manvolnum>9</manvolnum>
26894 <refmiscinfo class="version">4.4.14</refmiscinfo>
26895</refmeta>
26896<refnamediv>
26897 <refname>struct mipi_dsi_msg</refname>
26898 <refpurpose>
26899  read/write DSI buffer
26900 </refpurpose>
26901</refnamediv>
26902<refsynopsisdiv>
26903 <title>Synopsis</title>
26904  <programlisting>
26905struct mipi_dsi_msg {
26906  u8 channel;
26907  u8 type;
26908  u16 flags;
26909  size_t tx_len;
26910  const void * tx_buf;
26911  size_t rx_len;
26912  void * rx_buf;
26913};  </programlisting>
26914</refsynopsisdiv>
26915 <refsect1>
26916  <title>Members</title>
26917  <variablelist>
26918    <varlistentry>      <term>channel</term>
26919      <listitem><para>
26920virtual channel id
26921      </para></listitem>
26922    </varlistentry>
26923    <varlistentry>      <term>type</term>
26924      <listitem><para>
26925payload data type
26926      </para></listitem>
26927    </varlistentry>
26928    <varlistentry>      <term>flags</term>
26929      <listitem><para>
26930flags controlling this message transmission
26931      </para></listitem>
26932    </varlistentry>
26933    <varlistentry>      <term>tx_len</term>
26934      <listitem><para>
26935length of <parameter>tx_buf</parameter>
26936      </para></listitem>
26937    </varlistentry>
26938    <varlistentry>      <term>tx_buf</term>
26939      <listitem><para>
26940data to be written
26941      </para></listitem>
26942    </varlistentry>
26943    <varlistentry>      <term>rx_len</term>
26944      <listitem><para>
26945length of <parameter>rx_buf</parameter>
26946      </para></listitem>
26947    </varlistentry>
26948    <varlistentry>      <term>rx_buf</term>
26949      <listitem><para>
26950data to be read, or NULL
26951      </para></listitem>
26952    </varlistentry>
26953  </variablelist>
26954 </refsect1>
26955</refentry>
26956
26957<refentry id="API-struct-mipi-dsi-packet">
26958<refentryinfo>
26959 <title>LINUX</title>
26960 <productname>Kernel Hackers Manual</productname>
26961 <date>July 2017</date>
26962</refentryinfo>
26963<refmeta>
26964 <refentrytitle><phrase>struct mipi_dsi_packet</phrase></refentrytitle>
26965 <manvolnum>9</manvolnum>
26966 <refmiscinfo class="version">4.4.14</refmiscinfo>
26967</refmeta>
26968<refnamediv>
26969 <refname>struct mipi_dsi_packet</refname>
26970 <refpurpose>
26971     represents a MIPI DSI packet in protocol format
26972 </refpurpose>
26973</refnamediv>
26974<refsynopsisdiv>
26975 <title>Synopsis</title>
26976  <programlisting>
26977struct mipi_dsi_packet {
26978  size_t size;
26979  u8 header[4];
26980  size_t payload_length;
26981  const u8 * payload;
26982};  </programlisting>
26983</refsynopsisdiv>
26984 <refsect1>
26985  <title>Members</title>
26986  <variablelist>
26987    <varlistentry>      <term>size</term>
26988      <listitem><para>
26989   size (in bytes) of the packet
26990      </para></listitem>
26991    </varlistentry>
26992    <varlistentry>      <term>header[4]</term>
26993      <listitem><para>
26994   the four bytes that make up the header (Data ID, Word Count or
26995   Packet Data, and ECC)
26996      </para></listitem>
26997    </varlistentry>
26998    <varlistentry>      <term>payload_length</term>
26999      <listitem><para>
27000   number of bytes in the payload
27001      </para></listitem>
27002    </varlistentry>
27003    <varlistentry>      <term>payload</term>
27004      <listitem><para>
27005   a pointer to a buffer containing the payload, if any
27006      </para></listitem>
27007    </varlistentry>
27008  </variablelist>
27009 </refsect1>
27010</refentry>
27011
27012<refentry id="API-struct-mipi-dsi-host-ops">
27013<refentryinfo>
27014 <title>LINUX</title>
27015 <productname>Kernel Hackers Manual</productname>
27016 <date>July 2017</date>
27017</refentryinfo>
27018<refmeta>
27019 <refentrytitle><phrase>struct mipi_dsi_host_ops</phrase></refentrytitle>
27020 <manvolnum>9</manvolnum>
27021 <refmiscinfo class="version">4.4.14</refmiscinfo>
27022</refmeta>
27023<refnamediv>
27024 <refname>struct mipi_dsi_host_ops</refname>
27025 <refpurpose>
27026     DSI bus operations
27027 </refpurpose>
27028</refnamediv>
27029<refsynopsisdiv>
27030 <title>Synopsis</title>
27031  <programlisting>
27032struct mipi_dsi_host_ops {
27033  int (* attach) (struct mipi_dsi_host *host,struct mipi_dsi_device *dsi);
27034  int (* detach) (struct mipi_dsi_host *host,struct mipi_dsi_device *dsi);
27035  ssize_t (* transfer) (struct mipi_dsi_host *host,const struct mipi_dsi_msg *msg);
27036};  </programlisting>
27037</refsynopsisdiv>
27038 <refsect1>
27039  <title>Members</title>
27040  <variablelist>
27041    <varlistentry>      <term>attach</term>
27042      <listitem><para>
27043   attach DSI device to DSI host
27044      </para></listitem>
27045    </varlistentry>
27046    <varlistentry>      <term>detach</term>
27047      <listitem><para>
27048   detach DSI device from DSI host
27049      </para></listitem>
27050    </varlistentry>
27051    <varlistentry>      <term>transfer</term>
27052      <listitem><para>
27053   transmit a DSI packet
27054      </para></listitem>
27055    </varlistentry>
27056  </variablelist>
27057 </refsect1>
27058<refsect1>
27059<title>Description</title>
27060<para>
27061   DSI packets transmitted by .<function>transfer</function> are passed in as mipi_dsi_msg
27062   structures. This structure contains information about the type of packet
27063   being transmitted as well as the transmit and receive buffers. When an
27064   error is encountered during transmission, this function will return a
27065   negative error code. On success it shall return the number of bytes
27066   transmitted for write packets or the number of bytes received for read
27067   packets.
27068   </para><para>
27069
27070   Note that typically DSI packet transmission is atomic, so the .<function>transfer</function>
27071   function will seldomly return anything other than the number of bytes
27072   contained in the transmit buffer on success.
27073</para>
27074</refsect1>
27075</refentry>
27076
27077<refentry id="API-struct-mipi-dsi-host">
27078<refentryinfo>
27079 <title>LINUX</title>
27080 <productname>Kernel Hackers Manual</productname>
27081 <date>July 2017</date>
27082</refentryinfo>
27083<refmeta>
27084 <refentrytitle><phrase>struct mipi_dsi_host</phrase></refentrytitle>
27085 <manvolnum>9</manvolnum>
27086 <refmiscinfo class="version">4.4.14</refmiscinfo>
27087</refmeta>
27088<refnamediv>
27089 <refname>struct mipi_dsi_host</refname>
27090 <refpurpose>
27091     DSI host device
27092 </refpurpose>
27093</refnamediv>
27094<refsynopsisdiv>
27095 <title>Synopsis</title>
27096  <programlisting>
27097struct mipi_dsi_host {
27098  struct device * dev;
27099  const struct mipi_dsi_host_ops * ops;
27100};  </programlisting>
27101</refsynopsisdiv>
27102 <refsect1>
27103  <title>Members</title>
27104  <variablelist>
27105    <varlistentry>      <term>dev</term>
27106      <listitem><para>
27107   driver model device node for this DSI host
27108      </para></listitem>
27109    </varlistentry>
27110    <varlistentry>      <term>ops</term>
27111      <listitem><para>
27112   DSI host operations
27113      </para></listitem>
27114    </varlistentry>
27115  </variablelist>
27116 </refsect1>
27117</refentry>
27118
27119<refentry id="API-struct-mipi-dsi-device">
27120<refentryinfo>
27121 <title>LINUX</title>
27122 <productname>Kernel Hackers Manual</productname>
27123 <date>July 2017</date>
27124</refentryinfo>
27125<refmeta>
27126 <refentrytitle><phrase>struct mipi_dsi_device</phrase></refentrytitle>
27127 <manvolnum>9</manvolnum>
27128 <refmiscinfo class="version">4.4.14</refmiscinfo>
27129</refmeta>
27130<refnamediv>
27131 <refname>struct mipi_dsi_device</refname>
27132 <refpurpose>
27133     DSI peripheral device
27134 </refpurpose>
27135</refnamediv>
27136<refsynopsisdiv>
27137 <title>Synopsis</title>
27138  <programlisting>
27139struct mipi_dsi_device {
27140  struct mipi_dsi_host * host;
27141  struct device dev;
27142  unsigned int channel;
27143  unsigned int lanes;
27144  enum mipi_dsi_pixel_format format;
27145  unsigned long mode_flags;
27146};  </programlisting>
27147</refsynopsisdiv>
27148 <refsect1>
27149  <title>Members</title>
27150  <variablelist>
27151    <varlistentry>      <term>host</term>
27152      <listitem><para>
27153   DSI host for this peripheral
27154      </para></listitem>
27155    </varlistentry>
27156    <varlistentry>      <term>dev</term>
27157      <listitem><para>
27158   driver model device node for this peripheral
27159      </para></listitem>
27160    </varlistentry>
27161    <varlistentry>      <term>channel</term>
27162      <listitem><para>
27163   virtual channel assigned to the peripheral
27164      </para></listitem>
27165    </varlistentry>
27166    <varlistentry>      <term>lanes</term>
27167      <listitem><para>
27168   number of active data lanes
27169      </para></listitem>
27170    </varlistentry>
27171    <varlistentry>      <term>format</term>
27172      <listitem><para>
27173   pixel format for video mode
27174      </para></listitem>
27175    </varlistentry>
27176    <varlistentry>      <term>mode_flags</term>
27177      <listitem><para>
27178   DSI operation mode related flags
27179      </para></listitem>
27180    </varlistentry>
27181  </variablelist>
27182 </refsect1>
27183</refentry>
27184
27185<refentry id="API-enum-mipi-dsi-dcs-tear-mode">
27186<refentryinfo>
27187 <title>LINUX</title>
27188 <productname>Kernel Hackers Manual</productname>
27189 <date>July 2017</date>
27190</refentryinfo>
27191<refmeta>
27192 <refentrytitle><phrase>enum mipi_dsi_dcs_tear_mode</phrase></refentrytitle>
27193 <manvolnum>9</manvolnum>
27194 <refmiscinfo class="version">4.4.14</refmiscinfo>
27195</refmeta>
27196<refnamediv>
27197 <refname>enum mipi_dsi_dcs_tear_mode</refname>
27198 <refpurpose>
27199     Tearing Effect Output Line mode
27200 </refpurpose>
27201</refnamediv>
27202<refsynopsisdiv>
27203 <title>Synopsis</title>
27204  <programlisting>
27205enum mipi_dsi_dcs_tear_mode {
27206  MIPI_DSI_DCS_TEAR_MODE_VBLANK,
27207  MIPI_DSI_DCS_TEAR_MODE_VHBLANK
27208};  </programlisting>
27209</refsynopsisdiv>
27210<refsect1>
27211 <title>Constants</title>
27212  <variablelist>
27213    <varlistentry>      <term>MIPI_DSI_DCS_TEAR_MODE_VBLANK</term>
27214      <listitem><para>
27215   the TE output line consists of V-Blanking
27216   information only
27217      </para></listitem>
27218    </varlistentry>
27219    <varlistentry>      <term>MIPI_DSI_DCS_TEAR_MODE_VHBLANK</term>
27220      <listitem><para>
27221   the TE output line consists of both
27222   V-Blanking and H-Blanking information
27223      </para></listitem>
27224    </varlistentry>
27225  </variablelist>
27226</refsect1>
27227</refentry>
27228
27229<refentry id="API-struct-mipi-dsi-driver">
27230<refentryinfo>
27231 <title>LINUX</title>
27232 <productname>Kernel Hackers Manual</productname>
27233 <date>July 2017</date>
27234</refentryinfo>
27235<refmeta>
27236 <refentrytitle><phrase>struct mipi_dsi_driver</phrase></refentrytitle>
27237 <manvolnum>9</manvolnum>
27238 <refmiscinfo class="version">4.4.14</refmiscinfo>
27239</refmeta>
27240<refnamediv>
27241 <refname>struct mipi_dsi_driver</refname>
27242 <refpurpose>
27243     DSI driver
27244 </refpurpose>
27245</refnamediv>
27246<refsynopsisdiv>
27247 <title>Synopsis</title>
27248  <programlisting>
27249struct mipi_dsi_driver {
27250  struct device_driver driver;
27251  int(* probe) (struct mipi_dsi_device *dsi);
27252  int(* remove) (struct mipi_dsi_device *dsi);
27253  void (* shutdown) (struct mipi_dsi_device *dsi);
27254};  </programlisting>
27255</refsynopsisdiv>
27256 <refsect1>
27257  <title>Members</title>
27258  <variablelist>
27259    <varlistentry>      <term>driver</term>
27260      <listitem><para>
27261   device driver model driver
27262      </para></listitem>
27263    </varlistentry>
27264    <varlistentry>      <term>probe</term>
27265      <listitem><para>
27266   callback for device binding
27267      </para></listitem>
27268    </varlistentry>
27269    <varlistentry>      <term>remove</term>
27270      <listitem><para>
27271   callback for device unbinding
27272      </para></listitem>
27273    </varlistentry>
27274    <varlistentry>      <term>shutdown</term>
27275      <listitem><para>
27276   called at shutdown time to quiesce the device
27277      </para></listitem>
27278    </varlistentry>
27279  </variablelist>
27280 </refsect1>
27281</refentry>
27282
27283<!-- drivers/gpu/drm/drm_mipi_dsi.c -->
27284<refentry id="API-of-find-mipi-dsi-device-by-node">
27285<refentryinfo>
27286 <title>LINUX</title>
27287 <productname>Kernel Hackers Manual</productname>
27288 <date>July 2017</date>
27289</refentryinfo>
27290<refmeta>
27291 <refentrytitle><phrase>of_find_mipi_dsi_device_by_node</phrase></refentrytitle>
27292 <manvolnum>9</manvolnum>
27293 <refmiscinfo class="version">4.4.14</refmiscinfo>
27294</refmeta>
27295<refnamediv>
27296 <refname>of_find_mipi_dsi_device_by_node</refname>
27297 <refpurpose>
27298  find the MIPI DSI device matching a device tree node
27299 </refpurpose>
27300</refnamediv>
27301<refsynopsisdiv>
27302 <title>Synopsis</title>
27303  <funcsynopsis><funcprototype>
27304   <funcdef>struct mipi_dsi_device * <function>of_find_mipi_dsi_device_by_node </function></funcdef>
27305   <paramdef>struct device_node * <parameter>np</parameter></paramdef>
27306  </funcprototype></funcsynopsis>
27307</refsynopsisdiv>
27308<refsect1>
27309 <title>Arguments</title>
27310 <variablelist>
27311  <varlistentry>
27312   <term><parameter>np</parameter></term>
27313   <listitem>
27314    <para>
27315     device tree node
27316    </para>
27317   </listitem>
27318  </varlistentry>
27319 </variablelist>
27320</refsect1>
27321<refsect1>
27322<title>Return</title>
27323<para>
27324   A pointer to the MIPI DSI device corresponding to <parameter>np</parameter> or NULL if no
27325   such device exists (or has not been registered yet).
27326</para>
27327</refsect1>
27328</refentry>
27329
27330<refentry id="API-mipi-dsi-attach">
27331<refentryinfo>
27332 <title>LINUX</title>
27333 <productname>Kernel Hackers Manual</productname>
27334 <date>July 2017</date>
27335</refentryinfo>
27336<refmeta>
27337 <refentrytitle><phrase>mipi_dsi_attach</phrase></refentrytitle>
27338 <manvolnum>9</manvolnum>
27339 <refmiscinfo class="version">4.4.14</refmiscinfo>
27340</refmeta>
27341<refnamediv>
27342 <refname>mipi_dsi_attach</refname>
27343 <refpurpose>
27344     attach a DSI device to its DSI host
27345 </refpurpose>
27346</refnamediv>
27347<refsynopsisdiv>
27348 <title>Synopsis</title>
27349  <funcsynopsis><funcprototype>
27350   <funcdef>int <function>mipi_dsi_attach </function></funcdef>
27351   <paramdef>struct mipi_dsi_device * <parameter>dsi</parameter></paramdef>
27352  </funcprototype></funcsynopsis>
27353</refsynopsisdiv>
27354<refsect1>
27355 <title>Arguments</title>
27356 <variablelist>
27357  <varlistentry>
27358   <term><parameter>dsi</parameter></term>
27359   <listitem>
27360    <para>
27361     DSI peripheral
27362    </para>
27363   </listitem>
27364  </varlistentry>
27365 </variablelist>
27366</refsect1>
27367</refentry>
27368
27369<refentry id="API-mipi-dsi-detach">
27370<refentryinfo>
27371 <title>LINUX</title>
27372 <productname>Kernel Hackers Manual</productname>
27373 <date>July 2017</date>
27374</refentryinfo>
27375<refmeta>
27376 <refentrytitle><phrase>mipi_dsi_detach</phrase></refentrytitle>
27377 <manvolnum>9</manvolnum>
27378 <refmiscinfo class="version">4.4.14</refmiscinfo>
27379</refmeta>
27380<refnamediv>
27381 <refname>mipi_dsi_detach</refname>
27382 <refpurpose>
27383     detach a DSI device from its DSI host
27384 </refpurpose>
27385</refnamediv>
27386<refsynopsisdiv>
27387 <title>Synopsis</title>
27388  <funcsynopsis><funcprototype>
27389   <funcdef>int <function>mipi_dsi_detach </function></funcdef>
27390   <paramdef>struct mipi_dsi_device * <parameter>dsi</parameter></paramdef>
27391  </funcprototype></funcsynopsis>
27392</refsynopsisdiv>
27393<refsect1>
27394 <title>Arguments</title>
27395 <variablelist>
27396  <varlistentry>
27397   <term><parameter>dsi</parameter></term>
27398   <listitem>
27399    <para>
27400     DSI peripheral
27401    </para>
27402   </listitem>
27403  </varlistentry>
27404 </variablelist>
27405</refsect1>
27406</refentry>
27407
27408<refentry id="API-mipi-dsi-packet-format-is-short">
27409<refentryinfo>
27410 <title>LINUX</title>
27411 <productname>Kernel Hackers Manual</productname>
27412 <date>July 2017</date>
27413</refentryinfo>
27414<refmeta>
27415 <refentrytitle><phrase>mipi_dsi_packet_format_is_short</phrase></refentrytitle>
27416 <manvolnum>9</manvolnum>
27417 <refmiscinfo class="version">4.4.14</refmiscinfo>
27418</refmeta>
27419<refnamediv>
27420 <refname>mipi_dsi_packet_format_is_short</refname>
27421 <refpurpose>
27422     check if a packet is of the short format
27423 </refpurpose>
27424</refnamediv>
27425<refsynopsisdiv>
27426 <title>Synopsis</title>
27427  <funcsynopsis><funcprototype>
27428   <funcdef>bool <function>mipi_dsi_packet_format_is_short </function></funcdef>
27429   <paramdef>u8 <parameter>type</parameter></paramdef>
27430  </funcprototype></funcsynopsis>
27431</refsynopsisdiv>
27432<refsect1>
27433 <title>Arguments</title>
27434 <variablelist>
27435  <varlistentry>
27436   <term><parameter>type</parameter></term>
27437   <listitem>
27438    <para>
27439     MIPI DSI data type of the packet
27440    </para>
27441   </listitem>
27442  </varlistentry>
27443 </variablelist>
27444</refsect1>
27445<refsect1>
27446<title>Return</title>
27447<para>
27448   true if the packet for the given data type is a short packet, false
27449   otherwise.
27450</para>
27451</refsect1>
27452</refentry>
27453
27454<refentry id="API-mipi-dsi-packet-format-is-long">
27455<refentryinfo>
27456 <title>LINUX</title>
27457 <productname>Kernel Hackers Manual</productname>
27458 <date>July 2017</date>
27459</refentryinfo>
27460<refmeta>
27461 <refentrytitle><phrase>mipi_dsi_packet_format_is_long</phrase></refentrytitle>
27462 <manvolnum>9</manvolnum>
27463 <refmiscinfo class="version">4.4.14</refmiscinfo>
27464</refmeta>
27465<refnamediv>
27466 <refname>mipi_dsi_packet_format_is_long</refname>
27467 <refpurpose>
27468     check if a packet is of the long format
27469 </refpurpose>
27470</refnamediv>
27471<refsynopsisdiv>
27472 <title>Synopsis</title>
27473  <funcsynopsis><funcprototype>
27474   <funcdef>bool <function>mipi_dsi_packet_format_is_long </function></funcdef>
27475   <paramdef>u8 <parameter>type</parameter></paramdef>
27476  </funcprototype></funcsynopsis>
27477</refsynopsisdiv>
27478<refsect1>
27479 <title>Arguments</title>
27480 <variablelist>
27481  <varlistentry>
27482   <term><parameter>type</parameter></term>
27483   <listitem>
27484    <para>
27485     MIPI DSI data type of the packet
27486    </para>
27487   </listitem>
27488  </varlistentry>
27489 </variablelist>
27490</refsect1>
27491<refsect1>
27492<title>Return</title>
27493<para>
27494   true if the packet for the given data type is a long packet, false
27495   otherwise.
27496</para>
27497</refsect1>
27498</refentry>
27499
27500<refentry id="API-mipi-dsi-create-packet">
27501<refentryinfo>
27502 <title>LINUX</title>
27503 <productname>Kernel Hackers Manual</productname>
27504 <date>July 2017</date>
27505</refentryinfo>
27506<refmeta>
27507 <refentrytitle><phrase>mipi_dsi_create_packet</phrase></refentrytitle>
27508 <manvolnum>9</manvolnum>
27509 <refmiscinfo class="version">4.4.14</refmiscinfo>
27510</refmeta>
27511<refnamediv>
27512 <refname>mipi_dsi_create_packet</refname>
27513 <refpurpose>
27514     create a packet from a message according to the DSI protocol
27515 </refpurpose>
27516</refnamediv>
27517<refsynopsisdiv>
27518 <title>Synopsis</title>
27519  <funcsynopsis><funcprototype>
27520   <funcdef>int <function>mipi_dsi_create_packet </function></funcdef>
27521   <paramdef>struct mipi_dsi_packet * <parameter>packet</parameter></paramdef>
27522   <paramdef>const struct mipi_dsi_msg * <parameter>msg</parameter></paramdef>
27523  </funcprototype></funcsynopsis>
27524</refsynopsisdiv>
27525<refsect1>
27526 <title>Arguments</title>
27527 <variablelist>
27528  <varlistentry>
27529   <term><parameter>packet</parameter></term>
27530   <listitem>
27531    <para>
27532     pointer to a DSI packet structure
27533    </para>
27534   </listitem>
27535  </varlistentry>
27536  <varlistentry>
27537   <term><parameter>msg</parameter></term>
27538   <listitem>
27539    <para>
27540     message to translate into a packet
27541    </para>
27542   </listitem>
27543  </varlistentry>
27544 </variablelist>
27545</refsect1>
27546<refsect1>
27547<title>Return</title>
27548<para>
27549   0 on success or a negative error code on failure.
27550</para>
27551</refsect1>
27552</refentry>
27553
27554<refentry id="API-mipi-dsi-generic-write">
27555<refentryinfo>
27556 <title>LINUX</title>
27557 <productname>Kernel Hackers Manual</productname>
27558 <date>July 2017</date>
27559</refentryinfo>
27560<refmeta>
27561 <refentrytitle><phrase>mipi_dsi_generic_write</phrase></refentrytitle>
27562 <manvolnum>9</manvolnum>
27563 <refmiscinfo class="version">4.4.14</refmiscinfo>
27564</refmeta>
27565<refnamediv>
27566 <refname>mipi_dsi_generic_write</refname>
27567 <refpurpose>
27568     transmit data using a generic write packet
27569 </refpurpose>
27570</refnamediv>
27571<refsynopsisdiv>
27572 <title>Synopsis</title>
27573  <funcsynopsis><funcprototype>
27574   <funcdef>ssize_t <function>mipi_dsi_generic_write </function></funcdef>
27575   <paramdef>struct mipi_dsi_device * <parameter>dsi</parameter></paramdef>
27576   <paramdef>const void * <parameter>payload</parameter></paramdef>
27577   <paramdef>size_t <parameter>size</parameter></paramdef>
27578  </funcprototype></funcsynopsis>
27579</refsynopsisdiv>
27580<refsect1>
27581 <title>Arguments</title>
27582 <variablelist>
27583  <varlistentry>
27584   <term><parameter>dsi</parameter></term>
27585   <listitem>
27586    <para>
27587     DSI peripheral device
27588    </para>
27589   </listitem>
27590  </varlistentry>
27591  <varlistentry>
27592   <term><parameter>payload</parameter></term>
27593   <listitem>
27594    <para>
27595     buffer containing the payload
27596    </para>
27597   </listitem>
27598  </varlistentry>
27599  <varlistentry>
27600   <term><parameter>size</parameter></term>
27601   <listitem>
27602    <para>
27603     size of payload buffer
27604    </para>
27605   </listitem>
27606  </varlistentry>
27607 </variablelist>
27608</refsect1>
27609<refsect1>
27610<title>Description</title>
27611<para>
27612   This function will automatically choose the right data type depending on
27613   the payload length.
27614</para>
27615</refsect1>
27616<refsect1>
27617<title>Return</title>
27618<para>
27619   The number of bytes transmitted on success or a negative error code
27620   on failure.
27621</para>
27622</refsect1>
27623</refentry>
27624
27625<refentry id="API-mipi-dsi-generic-read">
27626<refentryinfo>
27627 <title>LINUX</title>
27628 <productname>Kernel Hackers Manual</productname>
27629 <date>July 2017</date>
27630</refentryinfo>
27631<refmeta>
27632 <refentrytitle><phrase>mipi_dsi_generic_read</phrase></refentrytitle>
27633 <manvolnum>9</manvolnum>
27634 <refmiscinfo class="version">4.4.14</refmiscinfo>
27635</refmeta>
27636<refnamediv>
27637 <refname>mipi_dsi_generic_read</refname>
27638 <refpurpose>
27639     receive data using a generic read packet
27640 </refpurpose>
27641</refnamediv>
27642<refsynopsisdiv>
27643 <title>Synopsis</title>
27644  <funcsynopsis><funcprototype>
27645   <funcdef>ssize_t <function>mipi_dsi_generic_read </function></funcdef>
27646   <paramdef>struct mipi_dsi_device * <parameter>dsi</parameter></paramdef>
27647   <paramdef>const void * <parameter>params</parameter></paramdef>
27648   <paramdef>size_t <parameter>num_params</parameter></paramdef>
27649   <paramdef>void * <parameter>data</parameter></paramdef>
27650   <paramdef>size_t <parameter>size</parameter></paramdef>
27651  </funcprototype></funcsynopsis>
27652</refsynopsisdiv>
27653<refsect1>
27654 <title>Arguments</title>
27655 <variablelist>
27656  <varlistentry>
27657   <term><parameter>dsi</parameter></term>
27658   <listitem>
27659    <para>
27660     DSI peripheral device
27661    </para>
27662   </listitem>
27663  </varlistentry>
27664  <varlistentry>
27665   <term><parameter>params</parameter></term>
27666   <listitem>
27667    <para>
27668     buffer containing the request parameters
27669    </para>
27670   </listitem>
27671  </varlistentry>
27672  <varlistentry>
27673   <term><parameter>num_params</parameter></term>
27674   <listitem>
27675    <para>
27676     number of request parameters
27677    </para>
27678   </listitem>
27679  </varlistentry>
27680  <varlistentry>
27681   <term><parameter>data</parameter></term>
27682   <listitem>
27683    <para>
27684     buffer in which to return the received data
27685    </para>
27686   </listitem>
27687  </varlistentry>
27688  <varlistentry>
27689   <term><parameter>size</parameter></term>
27690   <listitem>
27691    <para>
27692     size of receive buffer
27693    </para>
27694   </listitem>
27695  </varlistentry>
27696 </variablelist>
27697</refsect1>
27698<refsect1>
27699<title>Description</title>
27700<para>
27701   This function will automatically choose the right data type depending on
27702   the number of parameters passed in.
27703</para>
27704</refsect1>
27705<refsect1>
27706<title>Return</title>
27707<para>
27708   The number of bytes successfully read or a negative error code on
27709   failure.
27710</para>
27711</refsect1>
27712</refentry>
27713
27714<refentry id="API-mipi-dsi-dcs-write-buffer">
27715<refentryinfo>
27716 <title>LINUX</title>
27717 <productname>Kernel Hackers Manual</productname>
27718 <date>July 2017</date>
27719</refentryinfo>
27720<refmeta>
27721 <refentrytitle><phrase>mipi_dsi_dcs_write_buffer</phrase></refentrytitle>
27722 <manvolnum>9</manvolnum>
27723 <refmiscinfo class="version">4.4.14</refmiscinfo>
27724</refmeta>
27725<refnamediv>
27726 <refname>mipi_dsi_dcs_write_buffer</refname>
27727 <refpurpose>
27728     transmit a DCS command with payload
27729 </refpurpose>
27730</refnamediv>
27731<refsynopsisdiv>
27732 <title>Synopsis</title>
27733  <funcsynopsis><funcprototype>
27734   <funcdef>ssize_t <function>mipi_dsi_dcs_write_buffer </function></funcdef>
27735   <paramdef>struct mipi_dsi_device * <parameter>dsi</parameter></paramdef>
27736   <paramdef>const void * <parameter>data</parameter></paramdef>
27737   <paramdef>size_t <parameter>len</parameter></paramdef>
27738  </funcprototype></funcsynopsis>
27739</refsynopsisdiv>
27740<refsect1>
27741 <title>Arguments</title>
27742 <variablelist>
27743  <varlistentry>
27744   <term><parameter>dsi</parameter></term>
27745   <listitem>
27746    <para>
27747     DSI peripheral device
27748    </para>
27749   </listitem>
27750  </varlistentry>
27751  <varlistentry>
27752   <term><parameter>data</parameter></term>
27753   <listitem>
27754    <para>
27755     buffer containing data to be transmitted
27756    </para>
27757   </listitem>
27758  </varlistentry>
27759  <varlistentry>
27760   <term><parameter>len</parameter></term>
27761   <listitem>
27762    <para>
27763     size of transmission buffer
27764    </para>
27765   </listitem>
27766  </varlistentry>
27767 </variablelist>
27768</refsect1>
27769<refsect1>
27770<title>Description</title>
27771<para>
27772   This function will automatically choose the right data type depending on
27773   the command payload length.
27774</para>
27775</refsect1>
27776<refsect1>
27777<title>Return</title>
27778<para>
27779   The number of bytes successfully transmitted or a negative error
27780   code on failure.
27781</para>
27782</refsect1>
27783</refentry>
27784
27785<refentry id="API-mipi-dsi-dcs-write">
27786<refentryinfo>
27787 <title>LINUX</title>
27788 <productname>Kernel Hackers Manual</productname>
27789 <date>July 2017</date>
27790</refentryinfo>
27791<refmeta>
27792 <refentrytitle><phrase>mipi_dsi_dcs_write</phrase></refentrytitle>
27793 <manvolnum>9</manvolnum>
27794 <refmiscinfo class="version">4.4.14</refmiscinfo>
27795</refmeta>
27796<refnamediv>
27797 <refname>mipi_dsi_dcs_write</refname>
27798 <refpurpose>
27799     send DCS write command
27800 </refpurpose>
27801</refnamediv>
27802<refsynopsisdiv>
27803 <title>Synopsis</title>
27804  <funcsynopsis><funcprototype>
27805   <funcdef>ssize_t <function>mipi_dsi_dcs_write </function></funcdef>
27806   <paramdef>struct mipi_dsi_device * <parameter>dsi</parameter></paramdef>
27807   <paramdef>u8 <parameter>cmd</parameter></paramdef>
27808   <paramdef>const void * <parameter>data</parameter></paramdef>
27809   <paramdef>size_t <parameter>len</parameter></paramdef>
27810  </funcprototype></funcsynopsis>
27811</refsynopsisdiv>
27812<refsect1>
27813 <title>Arguments</title>
27814 <variablelist>
27815  <varlistentry>
27816   <term><parameter>dsi</parameter></term>
27817   <listitem>
27818    <para>
27819     DSI peripheral device
27820    </para>
27821   </listitem>
27822  </varlistentry>
27823  <varlistentry>
27824   <term><parameter>cmd</parameter></term>
27825   <listitem>
27826    <para>
27827     DCS command
27828    </para>
27829   </listitem>
27830  </varlistentry>
27831  <varlistentry>
27832   <term><parameter>data</parameter></term>
27833   <listitem>
27834    <para>
27835     buffer containing the command payload
27836    </para>
27837   </listitem>
27838  </varlistentry>
27839  <varlistentry>
27840   <term><parameter>len</parameter></term>
27841   <listitem>
27842    <para>
27843     command payload length
27844    </para>
27845   </listitem>
27846  </varlistentry>
27847 </variablelist>
27848</refsect1>
27849<refsect1>
27850<title>Description</title>
27851<para>
27852   This function will automatically choose the right data type depending on
27853   the command payload length.
27854</para>
27855</refsect1>
27856<refsect1>
27857<title>Return</title>
27858<para>
27859   The number of bytes successfully transmitted or a negative error
27860   code on failure.
27861</para>
27862</refsect1>
27863</refentry>
27864
27865<refentry id="API-mipi-dsi-dcs-read">
27866<refentryinfo>
27867 <title>LINUX</title>
27868 <productname>Kernel Hackers Manual</productname>
27869 <date>July 2017</date>
27870</refentryinfo>
27871<refmeta>
27872 <refentrytitle><phrase>mipi_dsi_dcs_read</phrase></refentrytitle>
27873 <manvolnum>9</manvolnum>
27874 <refmiscinfo class="version">4.4.14</refmiscinfo>
27875</refmeta>
27876<refnamediv>
27877 <refname>mipi_dsi_dcs_read</refname>
27878 <refpurpose>
27879     send DCS read request command
27880 </refpurpose>
27881</refnamediv>
27882<refsynopsisdiv>
27883 <title>Synopsis</title>
27884  <funcsynopsis><funcprototype>
27885   <funcdef>ssize_t <function>mipi_dsi_dcs_read </function></funcdef>
27886   <paramdef>struct mipi_dsi_device * <parameter>dsi</parameter></paramdef>
27887   <paramdef>u8 <parameter>cmd</parameter></paramdef>
27888   <paramdef>void * <parameter>data</parameter></paramdef>
27889   <paramdef>size_t <parameter>len</parameter></paramdef>
27890  </funcprototype></funcsynopsis>
27891</refsynopsisdiv>
27892<refsect1>
27893 <title>Arguments</title>
27894 <variablelist>
27895  <varlistentry>
27896   <term><parameter>dsi</parameter></term>
27897   <listitem>
27898    <para>
27899     DSI peripheral device
27900    </para>
27901   </listitem>
27902  </varlistentry>
27903  <varlistentry>
27904   <term><parameter>cmd</parameter></term>
27905   <listitem>
27906    <para>
27907     DCS command
27908    </para>
27909   </listitem>
27910  </varlistentry>
27911  <varlistentry>
27912   <term><parameter>data</parameter></term>
27913   <listitem>
27914    <para>
27915     buffer in which to receive data
27916    </para>
27917   </listitem>
27918  </varlistentry>
27919  <varlistentry>
27920   <term><parameter>len</parameter></term>
27921   <listitem>
27922    <para>
27923     size of receive buffer
27924    </para>
27925   </listitem>
27926  </varlistentry>
27927 </variablelist>
27928</refsect1>
27929<refsect1>
27930<title>Return</title>
27931<para>
27932   The number of bytes read or a negative error code on failure.
27933</para>
27934</refsect1>
27935</refentry>
27936
27937<refentry id="API-mipi-dsi-dcs-nop">
27938<refentryinfo>
27939 <title>LINUX</title>
27940 <productname>Kernel Hackers Manual</productname>
27941 <date>July 2017</date>
27942</refentryinfo>
27943<refmeta>
27944 <refentrytitle><phrase>mipi_dsi_dcs_nop</phrase></refentrytitle>
27945 <manvolnum>9</manvolnum>
27946 <refmiscinfo class="version">4.4.14</refmiscinfo>
27947</refmeta>
27948<refnamediv>
27949 <refname>mipi_dsi_dcs_nop</refname>
27950 <refpurpose>
27951     send DCS nop packet
27952 </refpurpose>
27953</refnamediv>
27954<refsynopsisdiv>
27955 <title>Synopsis</title>
27956  <funcsynopsis><funcprototype>
27957   <funcdef>int <function>mipi_dsi_dcs_nop </function></funcdef>
27958   <paramdef>struct mipi_dsi_device * <parameter>dsi</parameter></paramdef>
27959  </funcprototype></funcsynopsis>
27960</refsynopsisdiv>
27961<refsect1>
27962 <title>Arguments</title>
27963 <variablelist>
27964  <varlistentry>
27965   <term><parameter>dsi</parameter></term>
27966   <listitem>
27967    <para>
27968     DSI peripheral device
27969    </para>
27970   </listitem>
27971  </varlistentry>
27972 </variablelist>
27973</refsect1>
27974<refsect1>
27975<title>Return</title>
27976<para>
27977   0 on success or a negative error code on failure.
27978</para>
27979</refsect1>
27980</refentry>
27981
27982<refentry id="API-mipi-dsi-dcs-soft-reset">
27983<refentryinfo>
27984 <title>LINUX</title>
27985 <productname>Kernel Hackers Manual</productname>
27986 <date>July 2017</date>
27987</refentryinfo>
27988<refmeta>
27989 <refentrytitle><phrase>mipi_dsi_dcs_soft_reset</phrase></refentrytitle>
27990 <manvolnum>9</manvolnum>
27991 <refmiscinfo class="version">4.4.14</refmiscinfo>
27992</refmeta>
27993<refnamediv>
27994 <refname>mipi_dsi_dcs_soft_reset</refname>
27995 <refpurpose>
27996     perform a software reset of the display module
27997 </refpurpose>
27998</refnamediv>
27999<refsynopsisdiv>
28000 <title>Synopsis</title>
28001  <funcsynopsis><funcprototype>
28002   <funcdef>int <function>mipi_dsi_dcs_soft_reset </function></funcdef>
28003   <paramdef>struct mipi_dsi_device * <parameter>dsi</parameter></paramdef>
28004  </funcprototype></funcsynopsis>
28005</refsynopsisdiv>
28006<refsect1>
28007 <title>Arguments</title>
28008 <variablelist>
28009  <varlistentry>
28010   <term><parameter>dsi</parameter></term>
28011   <listitem>
28012    <para>
28013     DSI peripheral device
28014    </para>
28015   </listitem>
28016  </varlistentry>
28017 </variablelist>
28018</refsect1>
28019<refsect1>
28020<title>Return</title>
28021<para>
28022   0 on success or a negative error code on failure.
28023</para>
28024</refsect1>
28025</refentry>
28026
28027<refentry id="API-mipi-dsi-dcs-get-power-mode">
28028<refentryinfo>
28029 <title>LINUX</title>
28030 <productname>Kernel Hackers Manual</productname>
28031 <date>July 2017</date>
28032</refentryinfo>
28033<refmeta>
28034 <refentrytitle><phrase>mipi_dsi_dcs_get_power_mode</phrase></refentrytitle>
28035 <manvolnum>9</manvolnum>
28036 <refmiscinfo class="version">4.4.14</refmiscinfo>
28037</refmeta>
28038<refnamediv>
28039 <refname>mipi_dsi_dcs_get_power_mode</refname>
28040 <refpurpose>
28041     query the display module's current power mode
28042 </refpurpose>
28043</refnamediv>
28044<refsynopsisdiv>
28045 <title>Synopsis</title>
28046  <funcsynopsis><funcprototype>
28047   <funcdef>int <function>mipi_dsi_dcs_get_power_mode </function></funcdef>
28048   <paramdef>struct mipi_dsi_device * <parameter>dsi</parameter></paramdef>
28049   <paramdef>u8 * <parameter>mode</parameter></paramdef>
28050  </funcprototype></funcsynopsis>
28051</refsynopsisdiv>
28052<refsect1>
28053 <title>Arguments</title>
28054 <variablelist>
28055  <varlistentry>
28056   <term><parameter>dsi</parameter></term>
28057   <listitem>
28058    <para>
28059     DSI peripheral device
28060    </para>
28061   </listitem>
28062  </varlistentry>
28063  <varlistentry>
28064   <term><parameter>mode</parameter></term>
28065   <listitem>
28066    <para>
28067     return location for the current power mode
28068    </para>
28069   </listitem>
28070  </varlistentry>
28071 </variablelist>
28072</refsect1>
28073<refsect1>
28074<title>Return</title>
28075<para>
28076   0 on success or a negative error code on failure.
28077</para>
28078</refsect1>
28079</refentry>
28080
28081<refentry id="API-mipi-dsi-dcs-get-pixel-format">
28082<refentryinfo>
28083 <title>LINUX</title>
28084 <productname>Kernel Hackers Manual</productname>
28085 <date>July 2017</date>
28086</refentryinfo>
28087<refmeta>
28088 <refentrytitle><phrase>mipi_dsi_dcs_get_pixel_format</phrase></refentrytitle>
28089 <manvolnum>9</manvolnum>
28090 <refmiscinfo class="version">4.4.14</refmiscinfo>
28091</refmeta>
28092<refnamediv>
28093 <refname>mipi_dsi_dcs_get_pixel_format</refname>
28094 <refpurpose>
28095     gets the pixel format for the RGB image data used by the interface
28096 </refpurpose>
28097</refnamediv>
28098<refsynopsisdiv>
28099 <title>Synopsis</title>
28100  <funcsynopsis><funcprototype>
28101   <funcdef>int <function>mipi_dsi_dcs_get_pixel_format </function></funcdef>
28102   <paramdef>struct mipi_dsi_device * <parameter>dsi</parameter></paramdef>
28103   <paramdef>u8 * <parameter>format</parameter></paramdef>
28104  </funcprototype></funcsynopsis>
28105</refsynopsisdiv>
28106<refsect1>
28107 <title>Arguments</title>
28108 <variablelist>
28109  <varlistentry>
28110   <term><parameter>dsi</parameter></term>
28111   <listitem>
28112    <para>
28113     DSI peripheral device
28114    </para>
28115   </listitem>
28116  </varlistentry>
28117  <varlistentry>
28118   <term><parameter>format</parameter></term>
28119   <listitem>
28120    <para>
28121     return location for the pixel format
28122    </para>
28123   </listitem>
28124  </varlistentry>
28125 </variablelist>
28126</refsect1>
28127<refsect1>
28128<title>Return</title>
28129<para>
28130   0 on success or a negative error code on failure.
28131</para>
28132</refsect1>
28133</refentry>
28134
28135<refentry id="API-mipi-dsi-dcs-enter-sleep-mode">
28136<refentryinfo>
28137 <title>LINUX</title>
28138 <productname>Kernel Hackers Manual</productname>
28139 <date>July 2017</date>
28140</refentryinfo>
28141<refmeta>
28142 <refentrytitle><phrase>mipi_dsi_dcs_enter_sleep_mode</phrase></refentrytitle>
28143 <manvolnum>9</manvolnum>
28144 <refmiscinfo class="version">4.4.14</refmiscinfo>
28145</refmeta>
28146<refnamediv>
28147 <refname>mipi_dsi_dcs_enter_sleep_mode</refname>
28148 <refpurpose>
28149     disable all unnecessary blocks inside the display module except interface communication
28150 </refpurpose>
28151</refnamediv>
28152<refsynopsisdiv>
28153 <title>Synopsis</title>
28154  <funcsynopsis><funcprototype>
28155   <funcdef>int <function>mipi_dsi_dcs_enter_sleep_mode </function></funcdef>
28156   <paramdef>struct mipi_dsi_device * <parameter>dsi</parameter></paramdef>
28157  </funcprototype></funcsynopsis>
28158</refsynopsisdiv>
28159<refsect1>
28160 <title>Arguments</title>
28161 <variablelist>
28162  <varlistentry>
28163   <term><parameter>dsi</parameter></term>
28164   <listitem>
28165    <para>
28166     DSI peripheral device
28167    </para>
28168   </listitem>
28169  </varlistentry>
28170 </variablelist>
28171</refsect1>
28172<refsect1>
28173<title>Return</title>
28174<para>
28175   0 on success or a negative error code on failure.
28176</para>
28177</refsect1>
28178</refentry>
28179
28180<refentry id="API-mipi-dsi-dcs-exit-sleep-mode">
28181<refentryinfo>
28182 <title>LINUX</title>
28183 <productname>Kernel Hackers Manual</productname>
28184 <date>July 2017</date>
28185</refentryinfo>
28186<refmeta>
28187 <refentrytitle><phrase>mipi_dsi_dcs_exit_sleep_mode</phrase></refentrytitle>
28188 <manvolnum>9</manvolnum>
28189 <refmiscinfo class="version">4.4.14</refmiscinfo>
28190</refmeta>
28191<refnamediv>
28192 <refname>mipi_dsi_dcs_exit_sleep_mode</refname>
28193 <refpurpose>
28194     enable all blocks inside the display module
28195 </refpurpose>
28196</refnamediv>
28197<refsynopsisdiv>
28198 <title>Synopsis</title>
28199  <funcsynopsis><funcprototype>
28200   <funcdef>int <function>mipi_dsi_dcs_exit_sleep_mode </function></funcdef>
28201   <paramdef>struct mipi_dsi_device * <parameter>dsi</parameter></paramdef>
28202  </funcprototype></funcsynopsis>
28203</refsynopsisdiv>
28204<refsect1>
28205 <title>Arguments</title>
28206 <variablelist>
28207  <varlistentry>
28208   <term><parameter>dsi</parameter></term>
28209   <listitem>
28210    <para>
28211     DSI peripheral device
28212    </para>
28213   </listitem>
28214  </varlistentry>
28215 </variablelist>
28216</refsect1>
28217<refsect1>
28218<title>Return</title>
28219<para>
28220   0 on success or a negative error code on failure.
28221</para>
28222</refsect1>
28223</refentry>
28224
28225<refentry id="API-mipi-dsi-dcs-set-display-off">
28226<refentryinfo>
28227 <title>LINUX</title>
28228 <productname>Kernel Hackers Manual</productname>
28229 <date>July 2017</date>
28230</refentryinfo>
28231<refmeta>
28232 <refentrytitle><phrase>mipi_dsi_dcs_set_display_off</phrase></refentrytitle>
28233 <manvolnum>9</manvolnum>
28234 <refmiscinfo class="version">4.4.14</refmiscinfo>
28235</refmeta>
28236<refnamediv>
28237 <refname>mipi_dsi_dcs_set_display_off</refname>
28238 <refpurpose>
28239     stop displaying the image data on the display device
28240 </refpurpose>
28241</refnamediv>
28242<refsynopsisdiv>
28243 <title>Synopsis</title>
28244  <funcsynopsis><funcprototype>
28245   <funcdef>int <function>mipi_dsi_dcs_set_display_off </function></funcdef>
28246   <paramdef>struct mipi_dsi_device * <parameter>dsi</parameter></paramdef>
28247  </funcprototype></funcsynopsis>
28248</refsynopsisdiv>
28249<refsect1>
28250 <title>Arguments</title>
28251 <variablelist>
28252  <varlistentry>
28253   <term><parameter>dsi</parameter></term>
28254   <listitem>
28255    <para>
28256     DSI peripheral device
28257    </para>
28258   </listitem>
28259  </varlistentry>
28260 </variablelist>
28261</refsect1>
28262<refsect1>
28263<title>Return</title>
28264<para>
28265   0 on success or a negative error code on failure.
28266</para>
28267</refsect1>
28268</refentry>
28269
28270<refentry id="API-mipi-dsi-dcs-set-display-on">
28271<refentryinfo>
28272 <title>LINUX</title>
28273 <productname>Kernel Hackers Manual</productname>
28274 <date>July 2017</date>
28275</refentryinfo>
28276<refmeta>
28277 <refentrytitle><phrase>mipi_dsi_dcs_set_display_on</phrase></refentrytitle>
28278 <manvolnum>9</manvolnum>
28279 <refmiscinfo class="version">4.4.14</refmiscinfo>
28280</refmeta>
28281<refnamediv>
28282 <refname>mipi_dsi_dcs_set_display_on</refname>
28283 <refpurpose>
28284     start displaying the image data on the display device
28285 </refpurpose>
28286</refnamediv>
28287<refsynopsisdiv>
28288 <title>Synopsis</title>
28289  <funcsynopsis><funcprototype>
28290   <funcdef>int <function>mipi_dsi_dcs_set_display_on </function></funcdef>
28291   <paramdef>struct mipi_dsi_device * <parameter>dsi</parameter></paramdef>
28292  </funcprototype></funcsynopsis>
28293</refsynopsisdiv>
28294<refsect1>
28295 <title>Arguments</title>
28296 <variablelist>
28297  <varlistentry>
28298   <term><parameter>dsi</parameter></term>
28299   <listitem>
28300    <para>
28301     DSI peripheral device
28302    </para>
28303   </listitem>
28304  </varlistentry>
28305 </variablelist>
28306</refsect1>
28307<refsect1>
28308<title>Return</title>
28309<para>
28310   0 on success or a negative error code on failure
28311</para>
28312</refsect1>
28313</refentry>
28314
28315<refentry id="API-mipi-dsi-dcs-set-column-address">
28316<refentryinfo>
28317 <title>LINUX</title>
28318 <productname>Kernel Hackers Manual</productname>
28319 <date>July 2017</date>
28320</refentryinfo>
28321<refmeta>
28322 <refentrytitle><phrase>mipi_dsi_dcs_set_column_address</phrase></refentrytitle>
28323 <manvolnum>9</manvolnum>
28324 <refmiscinfo class="version">4.4.14</refmiscinfo>
28325</refmeta>
28326<refnamediv>
28327 <refname>mipi_dsi_dcs_set_column_address</refname>
28328 <refpurpose>
28329     define the column extent of the frame memory accessed by the host processor
28330 </refpurpose>
28331</refnamediv>
28332<refsynopsisdiv>
28333 <title>Synopsis</title>
28334  <funcsynopsis><funcprototype>
28335   <funcdef>int <function>mipi_dsi_dcs_set_column_address </function></funcdef>
28336   <paramdef>struct mipi_dsi_device * <parameter>dsi</parameter></paramdef>
28337   <paramdef>u16 <parameter>start</parameter></paramdef>
28338   <paramdef>u16 <parameter>end</parameter></paramdef>
28339  </funcprototype></funcsynopsis>
28340</refsynopsisdiv>
28341<refsect1>
28342 <title>Arguments</title>
28343 <variablelist>
28344  <varlistentry>
28345   <term><parameter>dsi</parameter></term>
28346   <listitem>
28347    <para>
28348     DSI peripheral device
28349    </para>
28350   </listitem>
28351  </varlistentry>
28352  <varlistentry>
28353   <term><parameter>start</parameter></term>
28354   <listitem>
28355    <para>
28356     first column of frame memory
28357    </para>
28358   </listitem>
28359  </varlistentry>
28360  <varlistentry>
28361   <term><parameter>end</parameter></term>
28362   <listitem>
28363    <para>
28364     last column of frame memory
28365    </para>
28366   </listitem>
28367  </varlistentry>
28368 </variablelist>
28369</refsect1>
28370<refsect1>
28371<title>Return</title>
28372<para>
28373   0 on success or a negative error code on failure.
28374</para>
28375</refsect1>
28376</refentry>
28377
28378<refentry id="API-mipi-dsi-dcs-set-page-address">
28379<refentryinfo>
28380 <title>LINUX</title>
28381 <productname>Kernel Hackers Manual</productname>
28382 <date>July 2017</date>
28383</refentryinfo>
28384<refmeta>
28385 <refentrytitle><phrase>mipi_dsi_dcs_set_page_address</phrase></refentrytitle>
28386 <manvolnum>9</manvolnum>
28387 <refmiscinfo class="version">4.4.14</refmiscinfo>
28388</refmeta>
28389<refnamediv>
28390 <refname>mipi_dsi_dcs_set_page_address</refname>
28391 <refpurpose>
28392     define the page extent of the frame memory accessed by the host processor
28393 </refpurpose>
28394</refnamediv>
28395<refsynopsisdiv>
28396 <title>Synopsis</title>
28397  <funcsynopsis><funcprototype>
28398   <funcdef>int <function>mipi_dsi_dcs_set_page_address </function></funcdef>
28399   <paramdef>struct mipi_dsi_device * <parameter>dsi</parameter></paramdef>
28400   <paramdef>u16 <parameter>start</parameter></paramdef>
28401   <paramdef>u16 <parameter>end</parameter></paramdef>
28402  </funcprototype></funcsynopsis>
28403</refsynopsisdiv>
28404<refsect1>
28405 <title>Arguments</title>
28406 <variablelist>
28407  <varlistentry>
28408   <term><parameter>dsi</parameter></term>
28409   <listitem>
28410    <para>
28411     DSI peripheral device
28412    </para>
28413   </listitem>
28414  </varlistentry>
28415  <varlistentry>
28416   <term><parameter>start</parameter></term>
28417   <listitem>
28418    <para>
28419     first page of frame memory
28420    </para>
28421   </listitem>
28422  </varlistentry>
28423  <varlistentry>
28424   <term><parameter>end</parameter></term>
28425   <listitem>
28426    <para>
28427     last page of frame memory
28428    </para>
28429   </listitem>
28430  </varlistentry>
28431 </variablelist>
28432</refsect1>
28433<refsect1>
28434<title>Return</title>
28435<para>
28436   0 on success or a negative error code on failure.
28437</para>
28438</refsect1>
28439</refentry>
28440
28441<refentry id="API-mipi-dsi-dcs-set-tear-off">
28442<refentryinfo>
28443 <title>LINUX</title>
28444 <productname>Kernel Hackers Manual</productname>
28445 <date>July 2017</date>
28446</refentryinfo>
28447<refmeta>
28448 <refentrytitle><phrase>mipi_dsi_dcs_set_tear_off</phrase></refentrytitle>
28449 <manvolnum>9</manvolnum>
28450 <refmiscinfo class="version">4.4.14</refmiscinfo>
28451</refmeta>
28452<refnamediv>
28453 <refname>mipi_dsi_dcs_set_tear_off</refname>
28454 <refpurpose>
28455     turn off the display module's Tearing Effect output signal on the TE signal line
28456 </refpurpose>
28457</refnamediv>
28458<refsynopsisdiv>
28459 <title>Synopsis</title>
28460  <funcsynopsis><funcprototype>
28461   <funcdef>int <function>mipi_dsi_dcs_set_tear_off </function></funcdef>
28462   <paramdef>struct mipi_dsi_device * <parameter>dsi</parameter></paramdef>
28463  </funcprototype></funcsynopsis>
28464</refsynopsisdiv>
28465<refsect1>
28466 <title>Arguments</title>
28467 <variablelist>
28468  <varlistentry>
28469   <term><parameter>dsi</parameter></term>
28470   <listitem>
28471    <para>
28472     DSI peripheral device
28473    </para>
28474   </listitem>
28475  </varlistentry>
28476 </variablelist>
28477</refsect1>
28478<refsect1>
28479<title>Return</title>
28480<para>
28481   0 on success or a negative error code on failure
28482</para>
28483</refsect1>
28484</refentry>
28485
28486<refentry id="API-mipi-dsi-dcs-set-tear-on">
28487<refentryinfo>
28488 <title>LINUX</title>
28489 <productname>Kernel Hackers Manual</productname>
28490 <date>July 2017</date>
28491</refentryinfo>
28492<refmeta>
28493 <refentrytitle><phrase>mipi_dsi_dcs_set_tear_on</phrase></refentrytitle>
28494 <manvolnum>9</manvolnum>
28495 <refmiscinfo class="version">4.4.14</refmiscinfo>
28496</refmeta>
28497<refnamediv>
28498 <refname>mipi_dsi_dcs_set_tear_on</refname>
28499 <refpurpose>
28500     turn on the display module's Tearing Effect output signal on the TE signal line.
28501 </refpurpose>
28502</refnamediv>
28503<refsynopsisdiv>
28504 <title>Synopsis</title>
28505  <funcsynopsis><funcprototype>
28506   <funcdef>int <function>mipi_dsi_dcs_set_tear_on </function></funcdef>
28507   <paramdef>struct mipi_dsi_device * <parameter>dsi</parameter></paramdef>
28508   <paramdef>enum mipi_dsi_dcs_tear_mode <parameter>mode</parameter></paramdef>
28509  </funcprototype></funcsynopsis>
28510</refsynopsisdiv>
28511<refsect1>
28512 <title>Arguments</title>
28513 <variablelist>
28514  <varlistentry>
28515   <term><parameter>dsi</parameter></term>
28516   <listitem>
28517    <para>
28518     DSI peripheral device
28519    </para>
28520   </listitem>
28521  </varlistentry>
28522  <varlistentry>
28523   <term><parameter>mode</parameter></term>
28524   <listitem>
28525    <para>
28526     the Tearing Effect Output Line mode
28527    </para>
28528   </listitem>
28529  </varlistentry>
28530 </variablelist>
28531</refsect1>
28532<refsect1>
28533<title>Return</title>
28534<para>
28535   0 on success or a negative error code on failure
28536</para>
28537</refsect1>
28538</refentry>
28539
28540<refentry id="API-mipi-dsi-dcs-set-pixel-format">
28541<refentryinfo>
28542 <title>LINUX</title>
28543 <productname>Kernel Hackers Manual</productname>
28544 <date>July 2017</date>
28545</refentryinfo>
28546<refmeta>
28547 <refentrytitle><phrase>mipi_dsi_dcs_set_pixel_format</phrase></refentrytitle>
28548 <manvolnum>9</manvolnum>
28549 <refmiscinfo class="version">4.4.14</refmiscinfo>
28550</refmeta>
28551<refnamediv>
28552 <refname>mipi_dsi_dcs_set_pixel_format</refname>
28553 <refpurpose>
28554     sets the pixel format for the RGB image data used by the interface
28555 </refpurpose>
28556</refnamediv>
28557<refsynopsisdiv>
28558 <title>Synopsis</title>
28559  <funcsynopsis><funcprototype>
28560   <funcdef>int <function>mipi_dsi_dcs_set_pixel_format </function></funcdef>
28561   <paramdef>struct mipi_dsi_device * <parameter>dsi</parameter></paramdef>
28562   <paramdef>u8 <parameter>format</parameter></paramdef>
28563  </funcprototype></funcsynopsis>
28564</refsynopsisdiv>
28565<refsect1>
28566 <title>Arguments</title>
28567 <variablelist>
28568  <varlistentry>
28569   <term><parameter>dsi</parameter></term>
28570   <listitem>
28571    <para>
28572     DSI peripheral device
28573    </para>
28574   </listitem>
28575  </varlistentry>
28576  <varlistentry>
28577   <term><parameter>format</parameter></term>
28578   <listitem>
28579    <para>
28580     pixel format
28581    </para>
28582   </listitem>
28583  </varlistentry>
28584 </variablelist>
28585</refsect1>
28586<refsect1>
28587<title>Return</title>
28588<para>
28589   0 on success or a negative error code on failure.
28590</para>
28591</refsect1>
28592</refentry>
28593
28594<refentry id="API-mipi-dsi-driver-register-full">
28595<refentryinfo>
28596 <title>LINUX</title>
28597 <productname>Kernel Hackers Manual</productname>
28598 <date>July 2017</date>
28599</refentryinfo>
28600<refmeta>
28601 <refentrytitle><phrase>mipi_dsi_driver_register_full</phrase></refentrytitle>
28602 <manvolnum>9</manvolnum>
28603 <refmiscinfo class="version">4.4.14</refmiscinfo>
28604</refmeta>
28605<refnamediv>
28606 <refname>mipi_dsi_driver_register_full</refname>
28607 <refpurpose>
28608     register a driver for DSI devices
28609 </refpurpose>
28610</refnamediv>
28611<refsynopsisdiv>
28612 <title>Synopsis</title>
28613  <funcsynopsis><funcprototype>
28614   <funcdef>int <function>mipi_dsi_driver_register_full </function></funcdef>
28615   <paramdef>struct mipi_dsi_driver * <parameter>drv</parameter></paramdef>
28616   <paramdef>struct module * <parameter>owner</parameter></paramdef>
28617  </funcprototype></funcsynopsis>
28618</refsynopsisdiv>
28619<refsect1>
28620 <title>Arguments</title>
28621 <variablelist>
28622  <varlistentry>
28623   <term><parameter>drv</parameter></term>
28624   <listitem>
28625    <para>
28626     DSI driver structure
28627    </para>
28628   </listitem>
28629  </varlistentry>
28630  <varlistentry>
28631   <term><parameter>owner</parameter></term>
28632   <listitem>
28633    <para>
28634     owner module
28635    </para>
28636   </listitem>
28637  </varlistentry>
28638 </variablelist>
28639</refsect1>
28640<refsect1>
28641<title>Return</title>
28642<para>
28643   0 on success or a negative error code on failure.
28644</para>
28645</refsect1>
28646</refentry>
28647
28648<refentry id="API-mipi-dsi-driver-unregister">
28649<refentryinfo>
28650 <title>LINUX</title>
28651 <productname>Kernel Hackers Manual</productname>
28652 <date>July 2017</date>
28653</refentryinfo>
28654<refmeta>
28655 <refentrytitle><phrase>mipi_dsi_driver_unregister</phrase></refentrytitle>
28656 <manvolnum>9</manvolnum>
28657 <refmiscinfo class="version">4.4.14</refmiscinfo>
28658</refmeta>
28659<refnamediv>
28660 <refname>mipi_dsi_driver_unregister</refname>
28661 <refpurpose>
28662     unregister a driver for DSI devices
28663 </refpurpose>
28664</refnamediv>
28665<refsynopsisdiv>
28666 <title>Synopsis</title>
28667  <funcsynopsis><funcprototype>
28668   <funcdef>void <function>mipi_dsi_driver_unregister </function></funcdef>
28669   <paramdef>struct mipi_dsi_driver * <parameter>drv</parameter></paramdef>
28670  </funcprototype></funcsynopsis>
28671</refsynopsisdiv>
28672<refsect1>
28673 <title>Arguments</title>
28674 <variablelist>
28675  <varlistentry>
28676   <term><parameter>drv</parameter></term>
28677   <listitem>
28678    <para>
28679     DSI driver structure
28680    </para>
28681   </listitem>
28682  </varlistentry>
28683 </variablelist>
28684</refsect1>
28685<refsect1>
28686<title>Return</title>
28687<para>
28688   0 on success or a negative error code on failure.
28689</para>
28690</refsect1>
28691</refentry>
28692
28693    </sect2>
28694    <sect2>
28695      <title>EDID Helper Functions Reference</title>
28696<!-- drivers/gpu/drm/drm_edid.c -->
28697<refentry id="API-drm-edid-header-is-valid">
28698<refentryinfo>
28699 <title>LINUX</title>
28700 <productname>Kernel Hackers Manual</productname>
28701 <date>July 2017</date>
28702</refentryinfo>
28703<refmeta>
28704 <refentrytitle><phrase>drm_edid_header_is_valid</phrase></refentrytitle>
28705 <manvolnum>9</manvolnum>
28706 <refmiscinfo class="version">4.4.14</refmiscinfo>
28707</refmeta>
28708<refnamediv>
28709 <refname>drm_edid_header_is_valid</refname>
28710 <refpurpose>
28711  sanity check the header of the base EDID block
28712 </refpurpose>
28713</refnamediv>
28714<refsynopsisdiv>
28715 <title>Synopsis</title>
28716  <funcsynopsis><funcprototype>
28717   <funcdef>int <function>drm_edid_header_is_valid </function></funcdef>
28718   <paramdef>const u8 * <parameter>raw_edid</parameter></paramdef>
28719  </funcprototype></funcsynopsis>
28720</refsynopsisdiv>
28721<refsect1>
28722 <title>Arguments</title>
28723 <variablelist>
28724  <varlistentry>
28725   <term><parameter>raw_edid</parameter></term>
28726   <listitem>
28727    <para>
28728     pointer to raw base EDID block
28729    </para>
28730   </listitem>
28731  </varlistentry>
28732 </variablelist>
28733</refsect1>
28734<refsect1>
28735<title>Description</title>
28736<para>
28737   Sanity check the header of the base EDID block.
28738</para>
28739</refsect1>
28740<refsect1>
28741<title>Return</title>
28742<para>
28743   8 if the header is perfect, down to 0 if it's totally wrong.
28744</para>
28745</refsect1>
28746</refentry>
28747
28748<refentry id="API-drm-edid-block-valid">
28749<refentryinfo>
28750 <title>LINUX</title>
28751 <productname>Kernel Hackers Manual</productname>
28752 <date>July 2017</date>
28753</refentryinfo>
28754<refmeta>
28755 <refentrytitle><phrase>drm_edid_block_valid</phrase></refentrytitle>
28756 <manvolnum>9</manvolnum>
28757 <refmiscinfo class="version">4.4.14</refmiscinfo>
28758</refmeta>
28759<refnamediv>
28760 <refname>drm_edid_block_valid</refname>
28761 <refpurpose>
28762     Sanity check the EDID block (base or extension)
28763 </refpurpose>
28764</refnamediv>
28765<refsynopsisdiv>
28766 <title>Synopsis</title>
28767  <funcsynopsis><funcprototype>
28768   <funcdef>bool <function>drm_edid_block_valid </function></funcdef>
28769   <paramdef>u8 * <parameter>raw_edid</parameter></paramdef>
28770   <paramdef>int <parameter>block</parameter></paramdef>
28771   <paramdef>bool <parameter>print_bad_edid</parameter></paramdef>
28772   <paramdef>bool * <parameter>edid_corrupt</parameter></paramdef>
28773  </funcprototype></funcsynopsis>
28774</refsynopsisdiv>
28775<refsect1>
28776 <title>Arguments</title>
28777 <variablelist>
28778  <varlistentry>
28779   <term><parameter>raw_edid</parameter></term>
28780   <listitem>
28781    <para>
28782     pointer to raw EDID block
28783    </para>
28784   </listitem>
28785  </varlistentry>
28786  <varlistentry>
28787   <term><parameter>block</parameter></term>
28788   <listitem>
28789    <para>
28790     type of block to validate (0 for base, extension otherwise)
28791    </para>
28792   </listitem>
28793  </varlistentry>
28794  <varlistentry>
28795   <term><parameter>print_bad_edid</parameter></term>
28796   <listitem>
28797    <para>
28798     if true, dump bad EDID blocks to the console
28799    </para>
28800   </listitem>
28801  </varlistentry>
28802  <varlistentry>
28803   <term><parameter>edid_corrupt</parameter></term>
28804   <listitem>
28805    <para>
28806     if true, the header or checksum is invalid
28807    </para>
28808   </listitem>
28809  </varlistentry>
28810 </variablelist>
28811</refsect1>
28812<refsect1>
28813<title>Description</title>
28814<para>
28815   Validate a base or extension EDID block and optionally dump bad blocks to
28816   the console.
28817</para>
28818</refsect1>
28819<refsect1>
28820<title>Return</title>
28821<para>
28822   True if the block is valid, false otherwise.
28823</para>
28824</refsect1>
28825</refentry>
28826
28827<refentry id="API-drm-edid-is-valid">
28828<refentryinfo>
28829 <title>LINUX</title>
28830 <productname>Kernel Hackers Manual</productname>
28831 <date>July 2017</date>
28832</refentryinfo>
28833<refmeta>
28834 <refentrytitle><phrase>drm_edid_is_valid</phrase></refentrytitle>
28835 <manvolnum>9</manvolnum>
28836 <refmiscinfo class="version">4.4.14</refmiscinfo>
28837</refmeta>
28838<refnamediv>
28839 <refname>drm_edid_is_valid</refname>
28840 <refpurpose>
28841     sanity check EDID data
28842 </refpurpose>
28843</refnamediv>
28844<refsynopsisdiv>
28845 <title>Synopsis</title>
28846  <funcsynopsis><funcprototype>
28847   <funcdef>bool <function>drm_edid_is_valid </function></funcdef>
28848   <paramdef>struct edid * <parameter>edid</parameter></paramdef>
28849  </funcprototype></funcsynopsis>
28850</refsynopsisdiv>
28851<refsect1>
28852 <title>Arguments</title>
28853 <variablelist>
28854  <varlistentry>
28855   <term><parameter>edid</parameter></term>
28856   <listitem>
28857    <para>
28858     EDID data
28859    </para>
28860   </listitem>
28861  </varlistentry>
28862 </variablelist>
28863</refsect1>
28864<refsect1>
28865<title>Description</title>
28866<para>
28867   Sanity-check an entire EDID record (including extensions)
28868</para>
28869</refsect1>
28870<refsect1>
28871<title>Return</title>
28872<para>
28873   True if the EDID data is valid, false otherwise.
28874</para>
28875</refsect1>
28876</refentry>
28877
28878<refentry id="API-drm-do-get-edid">
28879<refentryinfo>
28880 <title>LINUX</title>
28881 <productname>Kernel Hackers Manual</productname>
28882 <date>July 2017</date>
28883</refentryinfo>
28884<refmeta>
28885 <refentrytitle><phrase>drm_do_get_edid</phrase></refentrytitle>
28886 <manvolnum>9</manvolnum>
28887 <refmiscinfo class="version">4.4.14</refmiscinfo>
28888</refmeta>
28889<refnamediv>
28890 <refname>drm_do_get_edid</refname>
28891 <refpurpose>
28892     get EDID data using a custom EDID block read function
28893 </refpurpose>
28894</refnamediv>
28895<refsynopsisdiv>
28896 <title>Synopsis</title>
28897  <funcsynopsis><funcprototype>
28898   <funcdef>struct edid * <function>drm_do_get_edid </function></funcdef>
28899   <paramdef>struct drm_connector * <parameter>connector</parameter></paramdef>
28900   <paramdef>int (*<parameter>get_edid_block</parameter>)
28901     <funcparams>void *data, u8 *buf, unsigned int block, 			      size_t len</funcparams></paramdef>
28902   <paramdef>void * <parameter>data</parameter></paramdef>
28903  </funcprototype></funcsynopsis>
28904</refsynopsisdiv>
28905<refsect1>
28906 <title>Arguments</title>
28907 <variablelist>
28908  <varlistentry>
28909   <term><parameter>connector</parameter></term>
28910   <listitem>
28911    <para>
28912     connector we're probing
28913    </para>
28914   </listitem>
28915  </varlistentry>
28916  <varlistentry>
28917   <term><parameter>get_edid_block</parameter></term>
28918   <listitem>
28919    <para>
28920     EDID block read function
28921    </para>
28922   </listitem>
28923  </varlistentry>
28924  <varlistentry>
28925   <term><parameter>data</parameter></term>
28926   <listitem>
28927    <para>
28928     private data passed to the block read function
28929    </para>
28930   </listitem>
28931  </varlistentry>
28932 </variablelist>
28933</refsect1>
28934<refsect1>
28935<title>Description</title>
28936<para>
28937   When the I2C adapter connected to the DDC bus is hidden behind a device that
28938   exposes a different interface to read EDID blocks this function can be used
28939   to get EDID data using a custom block read function.
28940   </para><para>
28941
28942   As in the general case the DDC bus is accessible by the kernel at the I2C
28943   level, drivers must make all reasonable efforts to expose it as an I2C
28944   adapter and use <function>drm_get_edid</function> instead of abusing this function.
28945</para>
28946</refsect1>
28947<refsect1>
28948<title>Return</title>
28949<para>
28950   Pointer to valid EDID or NULL if we couldn't find any.
28951</para>
28952</refsect1>
28953</refentry>
28954
28955<refentry id="API-drm-probe-ddc">
28956<refentryinfo>
28957 <title>LINUX</title>
28958 <productname>Kernel Hackers Manual</productname>
28959 <date>July 2017</date>
28960</refentryinfo>
28961<refmeta>
28962 <refentrytitle><phrase>drm_probe_ddc</phrase></refentrytitle>
28963 <manvolnum>9</manvolnum>
28964 <refmiscinfo class="version">4.4.14</refmiscinfo>
28965</refmeta>
28966<refnamediv>
28967 <refname>drm_probe_ddc</refname>
28968 <refpurpose>
28969     probe DDC presence
28970 </refpurpose>
28971</refnamediv>
28972<refsynopsisdiv>
28973 <title>Synopsis</title>
28974  <funcsynopsis><funcprototype>
28975   <funcdef>bool <function>drm_probe_ddc </function></funcdef>
28976   <paramdef>struct i2c_adapter * <parameter>adapter</parameter></paramdef>
28977  </funcprototype></funcsynopsis>
28978</refsynopsisdiv>
28979<refsect1>
28980 <title>Arguments</title>
28981 <variablelist>
28982  <varlistentry>
28983   <term><parameter>adapter</parameter></term>
28984   <listitem>
28985    <para>
28986     I2C adapter to probe
28987    </para>
28988   </listitem>
28989  </varlistentry>
28990 </variablelist>
28991</refsect1>
28992<refsect1>
28993<title>Return</title>
28994<para>
28995   True on success, false on failure.
28996</para>
28997</refsect1>
28998</refentry>
28999
29000<refentry id="API-drm-get-edid">
29001<refentryinfo>
29002 <title>LINUX</title>
29003 <productname>Kernel Hackers Manual</productname>
29004 <date>July 2017</date>
29005</refentryinfo>
29006<refmeta>
29007 <refentrytitle><phrase>drm_get_edid</phrase></refentrytitle>
29008 <manvolnum>9</manvolnum>
29009 <refmiscinfo class="version">4.4.14</refmiscinfo>
29010</refmeta>
29011<refnamediv>
29012 <refname>drm_get_edid</refname>
29013 <refpurpose>
29014     get EDID data, if available
29015 </refpurpose>
29016</refnamediv>
29017<refsynopsisdiv>
29018 <title>Synopsis</title>
29019  <funcsynopsis><funcprototype>
29020   <funcdef>struct edid * <function>drm_get_edid </function></funcdef>
29021   <paramdef>struct drm_connector * <parameter>connector</parameter></paramdef>
29022   <paramdef>struct i2c_adapter * <parameter>adapter</parameter></paramdef>
29023  </funcprototype></funcsynopsis>
29024</refsynopsisdiv>
29025<refsect1>
29026 <title>Arguments</title>
29027 <variablelist>
29028  <varlistentry>
29029   <term><parameter>connector</parameter></term>
29030   <listitem>
29031    <para>
29032     connector we're probing
29033    </para>
29034   </listitem>
29035  </varlistentry>
29036  <varlistentry>
29037   <term><parameter>adapter</parameter></term>
29038   <listitem>
29039    <para>
29040     I2C adapter to use for DDC
29041    </para>
29042   </listitem>
29043  </varlistentry>
29044 </variablelist>
29045</refsect1>
29046<refsect1>
29047<title>Description</title>
29048<para>
29049   Poke the given I2C channel to grab EDID data if possible.  If found,
29050   attach it to the connector.
29051</para>
29052</refsect1>
29053<refsect1>
29054<title>Return</title>
29055<para>
29056   Pointer to valid EDID or NULL if we couldn't find any.
29057</para>
29058</refsect1>
29059</refentry>
29060
29061<refentry id="API-drm-edid-duplicate">
29062<refentryinfo>
29063 <title>LINUX</title>
29064 <productname>Kernel Hackers Manual</productname>
29065 <date>July 2017</date>
29066</refentryinfo>
29067<refmeta>
29068 <refentrytitle><phrase>drm_edid_duplicate</phrase></refentrytitle>
29069 <manvolnum>9</manvolnum>
29070 <refmiscinfo class="version">4.4.14</refmiscinfo>
29071</refmeta>
29072<refnamediv>
29073 <refname>drm_edid_duplicate</refname>
29074 <refpurpose>
29075     duplicate an EDID and the extensions
29076 </refpurpose>
29077</refnamediv>
29078<refsynopsisdiv>
29079 <title>Synopsis</title>
29080  <funcsynopsis><funcprototype>
29081   <funcdef>struct edid * <function>drm_edid_duplicate </function></funcdef>
29082   <paramdef>const struct edid * <parameter>edid</parameter></paramdef>
29083  </funcprototype></funcsynopsis>
29084</refsynopsisdiv>
29085<refsect1>
29086 <title>Arguments</title>
29087 <variablelist>
29088  <varlistentry>
29089   <term><parameter>edid</parameter></term>
29090   <listitem>
29091    <para>
29092     EDID to duplicate
29093    </para>
29094   </listitem>
29095  </varlistentry>
29096 </variablelist>
29097</refsect1>
29098<refsect1>
29099<title>Return</title>
29100<para>
29101   Pointer to duplicated EDID or NULL on allocation failure.
29102</para>
29103</refsect1>
29104</refentry>
29105
29106<refentry id="API-drm-match-cea-mode">
29107<refentryinfo>
29108 <title>LINUX</title>
29109 <productname>Kernel Hackers Manual</productname>
29110 <date>July 2017</date>
29111</refentryinfo>
29112<refmeta>
29113 <refentrytitle><phrase>drm_match_cea_mode</phrase></refentrytitle>
29114 <manvolnum>9</manvolnum>
29115 <refmiscinfo class="version">4.4.14</refmiscinfo>
29116</refmeta>
29117<refnamediv>
29118 <refname>drm_match_cea_mode</refname>
29119 <refpurpose>
29120     look for a CEA mode matching given mode
29121 </refpurpose>
29122</refnamediv>
29123<refsynopsisdiv>
29124 <title>Synopsis</title>
29125  <funcsynopsis><funcprototype>
29126   <funcdef>u8 <function>drm_match_cea_mode </function></funcdef>
29127   <paramdef>const struct drm_display_mode * <parameter>to_match</parameter></paramdef>
29128  </funcprototype></funcsynopsis>
29129</refsynopsisdiv>
29130<refsect1>
29131 <title>Arguments</title>
29132 <variablelist>
29133  <varlistentry>
29134   <term><parameter>to_match</parameter></term>
29135   <listitem>
29136    <para>
29137     display mode
29138    </para>
29139   </listitem>
29140  </varlistentry>
29141 </variablelist>
29142</refsect1>
29143<refsect1>
29144<title>Return</title>
29145<para>
29146   The CEA Video ID (VIC) of the mode or 0 if it isn't a CEA-861
29147   mode.
29148</para>
29149</refsect1>
29150</refentry>
29151
29152<refentry id="API-drm-get-cea-aspect-ratio">
29153<refentryinfo>
29154 <title>LINUX</title>
29155 <productname>Kernel Hackers Manual</productname>
29156 <date>July 2017</date>
29157</refentryinfo>
29158<refmeta>
29159 <refentrytitle><phrase>drm_get_cea_aspect_ratio</phrase></refentrytitle>
29160 <manvolnum>9</manvolnum>
29161 <refmiscinfo class="version">4.4.14</refmiscinfo>
29162</refmeta>
29163<refnamediv>
29164 <refname>drm_get_cea_aspect_ratio</refname>
29165 <refpurpose>
29166     get the picture aspect ratio corresponding to the input VIC from the CEA mode list
29167 </refpurpose>
29168</refnamediv>
29169<refsynopsisdiv>
29170 <title>Synopsis</title>
29171  <funcsynopsis><funcprototype>
29172   <funcdef>enum hdmi_picture_aspect <function>drm_get_cea_aspect_ratio </function></funcdef>
29173   <paramdef>const u8 <parameter>video_code</parameter></paramdef>
29174  </funcprototype></funcsynopsis>
29175</refsynopsisdiv>
29176<refsect1>
29177 <title>Arguments</title>
29178 <variablelist>
29179  <varlistentry>
29180   <term><parameter>video_code</parameter></term>
29181   <listitem>
29182    <para>
29183     ID given to each of the CEA modes
29184    </para>
29185   </listitem>
29186  </varlistentry>
29187 </variablelist>
29188</refsect1>
29189<refsect1>
29190<title>Description</title>
29191<para>
29192   Returns picture aspect ratio
29193</para>
29194</refsect1>
29195</refentry>
29196
29197<refentry id="API-drm-edid-to-eld">
29198<refentryinfo>
29199 <title>LINUX</title>
29200 <productname>Kernel Hackers Manual</productname>
29201 <date>July 2017</date>
29202</refentryinfo>
29203<refmeta>
29204 <refentrytitle><phrase>drm_edid_to_eld</phrase></refentrytitle>
29205 <manvolnum>9</manvolnum>
29206 <refmiscinfo class="version">4.4.14</refmiscinfo>
29207</refmeta>
29208<refnamediv>
29209 <refname>drm_edid_to_eld</refname>
29210 <refpurpose>
29211     build ELD from EDID
29212 </refpurpose>
29213</refnamediv>
29214<refsynopsisdiv>
29215 <title>Synopsis</title>
29216  <funcsynopsis><funcprototype>
29217   <funcdef>void <function>drm_edid_to_eld </function></funcdef>
29218   <paramdef>struct drm_connector * <parameter>connector</parameter></paramdef>
29219   <paramdef>struct edid * <parameter>edid</parameter></paramdef>
29220  </funcprototype></funcsynopsis>
29221</refsynopsisdiv>
29222<refsect1>
29223 <title>Arguments</title>
29224 <variablelist>
29225  <varlistentry>
29226   <term><parameter>connector</parameter></term>
29227   <listitem>
29228    <para>
29229     connector corresponding to the HDMI/DP sink
29230    </para>
29231   </listitem>
29232  </varlistentry>
29233  <varlistentry>
29234   <term><parameter>edid</parameter></term>
29235   <listitem>
29236    <para>
29237     EDID to parse
29238    </para>
29239   </listitem>
29240  </varlistentry>
29241 </variablelist>
29242</refsect1>
29243<refsect1>
29244<title>Description</title>
29245<para>
29246   Fill the ELD (EDID-Like Data) buffer for passing to the audio driver. The
29247   Conn_Type, HDCP and Port_ID ELD fields are left for the graphics driver to
29248   fill in.
29249</para>
29250</refsect1>
29251</refentry>
29252
29253<refentry id="API-drm-edid-to-sad">
29254<refentryinfo>
29255 <title>LINUX</title>
29256 <productname>Kernel Hackers Manual</productname>
29257 <date>July 2017</date>
29258</refentryinfo>
29259<refmeta>
29260 <refentrytitle><phrase>drm_edid_to_sad</phrase></refentrytitle>
29261 <manvolnum>9</manvolnum>
29262 <refmiscinfo class="version">4.4.14</refmiscinfo>
29263</refmeta>
29264<refnamediv>
29265 <refname>drm_edid_to_sad</refname>
29266 <refpurpose>
29267     extracts SADs from EDID
29268 </refpurpose>
29269</refnamediv>
29270<refsynopsisdiv>
29271 <title>Synopsis</title>
29272  <funcsynopsis><funcprototype>
29273   <funcdef>int <function>drm_edid_to_sad </function></funcdef>
29274   <paramdef>struct edid * <parameter>edid</parameter></paramdef>
29275   <paramdef>struct cea_sad ** <parameter>sads</parameter></paramdef>
29276  </funcprototype></funcsynopsis>
29277</refsynopsisdiv>
29278<refsect1>
29279 <title>Arguments</title>
29280 <variablelist>
29281  <varlistentry>
29282   <term><parameter>edid</parameter></term>
29283   <listitem>
29284    <para>
29285     EDID to parse
29286    </para>
29287   </listitem>
29288  </varlistentry>
29289  <varlistentry>
29290   <term><parameter>sads</parameter></term>
29291   <listitem>
29292    <para>
29293     pointer that will be set to the extracted SADs
29294    </para>
29295   </listitem>
29296  </varlistentry>
29297 </variablelist>
29298</refsect1>
29299<refsect1>
29300<title>Description</title>
29301<para>
29302   Looks for CEA EDID block and extracts SADs (Short Audio Descriptors) from it.
29303</para>
29304</refsect1>
29305<refsect1>
29306<title>Note</title>
29307<para>
29308   The returned pointer needs to be freed using <function>kfree</function>.
29309</para>
29310</refsect1>
29311<refsect1>
29312<title>Return</title>
29313<para>
29314   The number of found SADs or negative number on error.
29315</para>
29316</refsect1>
29317</refentry>
29318
29319<refentry id="API-drm-edid-to-speaker-allocation">
29320<refentryinfo>
29321 <title>LINUX</title>
29322 <productname>Kernel Hackers Manual</productname>
29323 <date>July 2017</date>
29324</refentryinfo>
29325<refmeta>
29326 <refentrytitle><phrase>drm_edid_to_speaker_allocation</phrase></refentrytitle>
29327 <manvolnum>9</manvolnum>
29328 <refmiscinfo class="version">4.4.14</refmiscinfo>
29329</refmeta>
29330<refnamediv>
29331 <refname>drm_edid_to_speaker_allocation</refname>
29332 <refpurpose>
29333     extracts Speaker Allocation Data Blocks from EDID
29334 </refpurpose>
29335</refnamediv>
29336<refsynopsisdiv>
29337 <title>Synopsis</title>
29338  <funcsynopsis><funcprototype>
29339   <funcdef>int <function>drm_edid_to_speaker_allocation </function></funcdef>
29340   <paramdef>struct edid * <parameter>edid</parameter></paramdef>
29341   <paramdef>u8 ** <parameter>sadb</parameter></paramdef>
29342  </funcprototype></funcsynopsis>
29343</refsynopsisdiv>
29344<refsect1>
29345 <title>Arguments</title>
29346 <variablelist>
29347  <varlistentry>
29348   <term><parameter>edid</parameter></term>
29349   <listitem>
29350    <para>
29351     EDID to parse
29352    </para>
29353   </listitem>
29354  </varlistentry>
29355  <varlistentry>
29356   <term><parameter>sadb</parameter></term>
29357   <listitem>
29358    <para>
29359     pointer to the speaker block
29360    </para>
29361   </listitem>
29362  </varlistentry>
29363 </variablelist>
29364</refsect1>
29365<refsect1>
29366<title>Description</title>
29367<para>
29368   Looks for CEA EDID block and extracts the Speaker Allocation Data Block from it.
29369</para>
29370</refsect1>
29371<refsect1>
29372<title>Note</title>
29373<para>
29374   The returned pointer needs to be freed using <function>kfree</function>.
29375</para>
29376</refsect1>
29377<refsect1>
29378<title>Return</title>
29379<para>
29380   The number of found Speaker Allocation Blocks or negative number on
29381   error.
29382</para>
29383</refsect1>
29384</refentry>
29385
29386<refentry id="API-drm-av-sync-delay">
29387<refentryinfo>
29388 <title>LINUX</title>
29389 <productname>Kernel Hackers Manual</productname>
29390 <date>July 2017</date>
29391</refentryinfo>
29392<refmeta>
29393 <refentrytitle><phrase>drm_av_sync_delay</phrase></refentrytitle>
29394 <manvolnum>9</manvolnum>
29395 <refmiscinfo class="version">4.4.14</refmiscinfo>
29396</refmeta>
29397<refnamediv>
29398 <refname>drm_av_sync_delay</refname>
29399 <refpurpose>
29400     compute the HDMI/DP sink audio-video sync delay
29401 </refpurpose>
29402</refnamediv>
29403<refsynopsisdiv>
29404 <title>Synopsis</title>
29405  <funcsynopsis><funcprototype>
29406   <funcdef>int <function>drm_av_sync_delay </function></funcdef>
29407   <paramdef>struct drm_connector * <parameter>connector</parameter></paramdef>
29408   <paramdef>const struct drm_display_mode * <parameter>mode</parameter></paramdef>
29409  </funcprototype></funcsynopsis>
29410</refsynopsisdiv>
29411<refsect1>
29412 <title>Arguments</title>
29413 <variablelist>
29414  <varlistentry>
29415   <term><parameter>connector</parameter></term>
29416   <listitem>
29417    <para>
29418     connector associated with the HDMI/DP sink
29419    </para>
29420   </listitem>
29421  </varlistentry>
29422  <varlistentry>
29423   <term><parameter>mode</parameter></term>
29424   <listitem>
29425    <para>
29426     the display mode
29427    </para>
29428   </listitem>
29429  </varlistentry>
29430 </variablelist>
29431</refsect1>
29432<refsect1>
29433<title>Return</title>
29434<para>
29435   The HDMI/DP sink's audio-video sync delay in milliseconds or 0 if
29436   the sink doesn't support audio or video.
29437</para>
29438</refsect1>
29439</refentry>
29440
29441<refentry id="API-drm-select-eld">
29442<refentryinfo>
29443 <title>LINUX</title>
29444 <productname>Kernel Hackers Manual</productname>
29445 <date>July 2017</date>
29446</refentryinfo>
29447<refmeta>
29448 <refentrytitle><phrase>drm_select_eld</phrase></refentrytitle>
29449 <manvolnum>9</manvolnum>
29450 <refmiscinfo class="version">4.4.14</refmiscinfo>
29451</refmeta>
29452<refnamediv>
29453 <refname>drm_select_eld</refname>
29454 <refpurpose>
29455     select one ELD from multiple HDMI/DP sinks
29456 </refpurpose>
29457</refnamediv>
29458<refsynopsisdiv>
29459 <title>Synopsis</title>
29460  <funcsynopsis><funcprototype>
29461   <funcdef>struct drm_connector * <function>drm_select_eld </function></funcdef>
29462   <paramdef>struct drm_encoder * <parameter>encoder</parameter></paramdef>
29463  </funcprototype></funcsynopsis>
29464</refsynopsisdiv>
29465<refsect1>
29466 <title>Arguments</title>
29467 <variablelist>
29468  <varlistentry>
29469   <term><parameter>encoder</parameter></term>
29470   <listitem>
29471    <para>
29472     the encoder just changed display mode
29473    </para>
29474   </listitem>
29475  </varlistentry>
29476 </variablelist>
29477</refsect1>
29478<refsect1>
29479<title>Description</title>
29480<para>
29481   It's possible for one encoder to be associated with multiple HDMI/DP sinks.
29482   The policy is now hard coded to simply use the first HDMI/DP sink's ELD.
29483</para>
29484</refsect1>
29485<refsect1>
29486<title>Return</title>
29487<para>
29488   The connector associated with the first HDMI/DP sink that has ELD
29489   attached to it.
29490</para>
29491</refsect1>
29492</refentry>
29493
29494<refentry id="API-drm-detect-hdmi-monitor">
29495<refentryinfo>
29496 <title>LINUX</title>
29497 <productname>Kernel Hackers Manual</productname>
29498 <date>July 2017</date>
29499</refentryinfo>
29500<refmeta>
29501 <refentrytitle><phrase>drm_detect_hdmi_monitor</phrase></refentrytitle>
29502 <manvolnum>9</manvolnum>
29503 <refmiscinfo class="version">4.4.14</refmiscinfo>
29504</refmeta>
29505<refnamediv>
29506 <refname>drm_detect_hdmi_monitor</refname>
29507 <refpurpose>
29508     detect whether monitor is HDMI
29509 </refpurpose>
29510</refnamediv>
29511<refsynopsisdiv>
29512 <title>Synopsis</title>
29513  <funcsynopsis><funcprototype>
29514   <funcdef>bool <function>drm_detect_hdmi_monitor </function></funcdef>
29515   <paramdef>struct edid * <parameter>edid</parameter></paramdef>
29516  </funcprototype></funcsynopsis>
29517</refsynopsisdiv>
29518<refsect1>
29519 <title>Arguments</title>
29520 <variablelist>
29521  <varlistentry>
29522   <term><parameter>edid</parameter></term>
29523   <listitem>
29524    <para>
29525     monitor EDID information
29526    </para>
29527   </listitem>
29528  </varlistentry>
29529 </variablelist>
29530</refsect1>
29531<refsect1>
29532<title>Description</title>
29533<para>
29534   Parse the CEA extension according to CEA-861-B.
29535</para>
29536</refsect1>
29537<refsect1>
29538<title>Return</title>
29539<para>
29540   True if the monitor is HDMI, false if not or unknown.
29541</para>
29542</refsect1>
29543</refentry>
29544
29545<refentry id="API-drm-detect-monitor-audio">
29546<refentryinfo>
29547 <title>LINUX</title>
29548 <productname>Kernel Hackers Manual</productname>
29549 <date>July 2017</date>
29550</refentryinfo>
29551<refmeta>
29552 <refentrytitle><phrase>drm_detect_monitor_audio</phrase></refentrytitle>
29553 <manvolnum>9</manvolnum>
29554 <refmiscinfo class="version">4.4.14</refmiscinfo>
29555</refmeta>
29556<refnamediv>
29557 <refname>drm_detect_monitor_audio</refname>
29558 <refpurpose>
29559     check monitor audio capability
29560 </refpurpose>
29561</refnamediv>
29562<refsynopsisdiv>
29563 <title>Synopsis</title>
29564  <funcsynopsis><funcprototype>
29565   <funcdef>bool <function>drm_detect_monitor_audio </function></funcdef>
29566   <paramdef>struct edid * <parameter>edid</parameter></paramdef>
29567  </funcprototype></funcsynopsis>
29568</refsynopsisdiv>
29569<refsect1>
29570 <title>Arguments</title>
29571 <variablelist>
29572  <varlistentry>
29573   <term><parameter>edid</parameter></term>
29574   <listitem>
29575    <para>
29576     EDID block to scan
29577    </para>
29578   </listitem>
29579  </varlistentry>
29580 </variablelist>
29581</refsect1>
29582<refsect1>
29583<title>Description</title>
29584<para>
29585   Monitor should have CEA extension block.
29586   If monitor has 'basic audio', but no CEA audio blocks, it's 'basic
29587   audio' only. If there is any audio extension block and supported
29588   audio format, assume at least 'basic audio' support, even if 'basic
29589   audio' is not defined in EDID.
29590</para>
29591</refsect1>
29592<refsect1>
29593<title>Return</title>
29594<para>
29595   True if the monitor supports audio, false otherwise.
29596</para>
29597</refsect1>
29598</refentry>
29599
29600<refentry id="API-drm-rgb-quant-range-selectable">
29601<refentryinfo>
29602 <title>LINUX</title>
29603 <productname>Kernel Hackers Manual</productname>
29604 <date>July 2017</date>
29605</refentryinfo>
29606<refmeta>
29607 <refentrytitle><phrase>drm_rgb_quant_range_selectable</phrase></refentrytitle>
29608 <manvolnum>9</manvolnum>
29609 <refmiscinfo class="version">4.4.14</refmiscinfo>
29610</refmeta>
29611<refnamediv>
29612 <refname>drm_rgb_quant_range_selectable</refname>
29613 <refpurpose>
29614     is RGB quantization range selectable?
29615 </refpurpose>
29616</refnamediv>
29617<refsynopsisdiv>
29618 <title>Synopsis</title>
29619  <funcsynopsis><funcprototype>
29620   <funcdef>bool <function>drm_rgb_quant_range_selectable </function></funcdef>
29621   <paramdef>struct edid * <parameter>edid</parameter></paramdef>
29622  </funcprototype></funcsynopsis>
29623</refsynopsisdiv>
29624<refsect1>
29625 <title>Arguments</title>
29626 <variablelist>
29627  <varlistentry>
29628   <term><parameter>edid</parameter></term>
29629   <listitem>
29630    <para>
29631     EDID block to scan
29632    </para>
29633   </listitem>
29634  </varlistentry>
29635 </variablelist>
29636</refsect1>
29637<refsect1>
29638<title>Description</title>
29639<para>
29640   Check whether the monitor reports the RGB quantization range selection
29641   as supported. The AVI infoframe can then be used to inform the monitor
29642   which quantization range (full or limited) is used.
29643</para>
29644</refsect1>
29645<refsect1>
29646<title>Return</title>
29647<para>
29648   True if the RGB quantization range is selectable, false otherwise.
29649</para>
29650</refsect1>
29651</refentry>
29652
29653<refentry id="API-drm-add-edid-modes">
29654<refentryinfo>
29655 <title>LINUX</title>
29656 <productname>Kernel Hackers Manual</productname>
29657 <date>July 2017</date>
29658</refentryinfo>
29659<refmeta>
29660 <refentrytitle><phrase>drm_add_edid_modes</phrase></refentrytitle>
29661 <manvolnum>9</manvolnum>
29662 <refmiscinfo class="version">4.4.14</refmiscinfo>
29663</refmeta>
29664<refnamediv>
29665 <refname>drm_add_edid_modes</refname>
29666 <refpurpose>
29667     add modes from EDID data, if available
29668 </refpurpose>
29669</refnamediv>
29670<refsynopsisdiv>
29671 <title>Synopsis</title>
29672  <funcsynopsis><funcprototype>
29673   <funcdef>int <function>drm_add_edid_modes </function></funcdef>
29674   <paramdef>struct drm_connector * <parameter>connector</parameter></paramdef>
29675   <paramdef>struct edid * <parameter>edid</parameter></paramdef>
29676  </funcprototype></funcsynopsis>
29677</refsynopsisdiv>
29678<refsect1>
29679 <title>Arguments</title>
29680 <variablelist>
29681  <varlistentry>
29682   <term><parameter>connector</parameter></term>
29683   <listitem>
29684    <para>
29685     connector we're probing
29686    </para>
29687   </listitem>
29688  </varlistentry>
29689  <varlistentry>
29690   <term><parameter>edid</parameter></term>
29691   <listitem>
29692    <para>
29693     EDID data
29694    </para>
29695   </listitem>
29696  </varlistentry>
29697 </variablelist>
29698</refsect1>
29699<refsect1>
29700<title>Description</title>
29701<para>
29702   Add the specified modes to the connector's mode list.
29703</para>
29704</refsect1>
29705<refsect1>
29706<title>Return</title>
29707<para>
29708   The number of modes added or 0 if we couldn't find any.
29709</para>
29710</refsect1>
29711</refentry>
29712
29713<refentry id="API-drm-add-modes-noedid">
29714<refentryinfo>
29715 <title>LINUX</title>
29716 <productname>Kernel Hackers Manual</productname>
29717 <date>July 2017</date>
29718</refentryinfo>
29719<refmeta>
29720 <refentrytitle><phrase>drm_add_modes_noedid</phrase></refentrytitle>
29721 <manvolnum>9</manvolnum>
29722 <refmiscinfo class="version">4.4.14</refmiscinfo>
29723</refmeta>
29724<refnamediv>
29725 <refname>drm_add_modes_noedid</refname>
29726 <refpurpose>
29727     add modes for the connectors without EDID
29728 </refpurpose>
29729</refnamediv>
29730<refsynopsisdiv>
29731 <title>Synopsis</title>
29732  <funcsynopsis><funcprototype>
29733   <funcdef>int <function>drm_add_modes_noedid </function></funcdef>
29734   <paramdef>struct drm_connector * <parameter>connector</parameter></paramdef>
29735   <paramdef>int <parameter>hdisplay</parameter></paramdef>
29736   <paramdef>int <parameter>vdisplay</parameter></paramdef>
29737  </funcprototype></funcsynopsis>
29738</refsynopsisdiv>
29739<refsect1>
29740 <title>Arguments</title>
29741 <variablelist>
29742  <varlistentry>
29743   <term><parameter>connector</parameter></term>
29744   <listitem>
29745    <para>
29746     connector we're probing
29747    </para>
29748   </listitem>
29749  </varlistentry>
29750  <varlistentry>
29751   <term><parameter>hdisplay</parameter></term>
29752   <listitem>
29753    <para>
29754     the horizontal display limit
29755    </para>
29756   </listitem>
29757  </varlistentry>
29758  <varlistentry>
29759   <term><parameter>vdisplay</parameter></term>
29760   <listitem>
29761    <para>
29762     the vertical display limit
29763    </para>
29764   </listitem>
29765  </varlistentry>
29766 </variablelist>
29767</refsect1>
29768<refsect1>
29769<title>Description</title>
29770<para>
29771   Add the specified modes to the connector's mode list. Only when the
29772   hdisplay/vdisplay is not beyond the given limit, it will be added.
29773</para>
29774</refsect1>
29775<refsect1>
29776<title>Return</title>
29777<para>
29778   The number of modes added or 0 if we couldn't find any.
29779</para>
29780</refsect1>
29781</refentry>
29782
29783<refentry id="API-drm-set-preferred-mode">
29784<refentryinfo>
29785 <title>LINUX</title>
29786 <productname>Kernel Hackers Manual</productname>
29787 <date>July 2017</date>
29788</refentryinfo>
29789<refmeta>
29790 <refentrytitle><phrase>drm_set_preferred_mode</phrase></refentrytitle>
29791 <manvolnum>9</manvolnum>
29792 <refmiscinfo class="version">4.4.14</refmiscinfo>
29793</refmeta>
29794<refnamediv>
29795 <refname>drm_set_preferred_mode</refname>
29796 <refpurpose>
29797     Sets the preferred mode of a connector
29798 </refpurpose>
29799</refnamediv>
29800<refsynopsisdiv>
29801 <title>Synopsis</title>
29802  <funcsynopsis><funcprototype>
29803   <funcdef>void <function>drm_set_preferred_mode </function></funcdef>
29804   <paramdef>struct drm_connector * <parameter>connector</parameter></paramdef>
29805   <paramdef>int <parameter>hpref</parameter></paramdef>
29806   <paramdef>int <parameter>vpref</parameter></paramdef>
29807  </funcprototype></funcsynopsis>
29808</refsynopsisdiv>
29809<refsect1>
29810 <title>Arguments</title>
29811 <variablelist>
29812  <varlistentry>
29813   <term><parameter>connector</parameter></term>
29814   <listitem>
29815    <para>
29816     connector whose mode list should be processed
29817    </para>
29818   </listitem>
29819  </varlistentry>
29820  <varlistentry>
29821   <term><parameter>hpref</parameter></term>
29822   <listitem>
29823    <para>
29824     horizontal resolution of preferred mode
29825    </para>
29826   </listitem>
29827  </varlistentry>
29828  <varlistentry>
29829   <term><parameter>vpref</parameter></term>
29830   <listitem>
29831    <para>
29832     vertical resolution of preferred mode
29833    </para>
29834   </listitem>
29835  </varlistentry>
29836 </variablelist>
29837</refsect1>
29838<refsect1>
29839<title>Description</title>
29840<para>
29841   Marks a mode as preferred if it matches the resolution specified by <parameter>hpref</parameter>
29842   and <parameter>vpref</parameter>.
29843</para>
29844</refsect1>
29845</refentry>
29846
29847<refentry id="API-drm-hdmi-avi-infoframe-from-display-mode">
29848<refentryinfo>
29849 <title>LINUX</title>
29850 <productname>Kernel Hackers Manual</productname>
29851 <date>July 2017</date>
29852</refentryinfo>
29853<refmeta>
29854 <refentrytitle><phrase>drm_hdmi_avi_infoframe_from_display_mode</phrase></refentrytitle>
29855 <manvolnum>9</manvolnum>
29856 <refmiscinfo class="version">4.4.14</refmiscinfo>
29857</refmeta>
29858<refnamediv>
29859 <refname>drm_hdmi_avi_infoframe_from_display_mode</refname>
29860 <refpurpose>
29861     fill an HDMI AVI infoframe with data from a DRM display mode
29862 </refpurpose>
29863</refnamediv>
29864<refsynopsisdiv>
29865 <title>Synopsis</title>
29866  <funcsynopsis><funcprototype>
29867   <funcdef>int <function>drm_hdmi_avi_infoframe_from_display_mode </function></funcdef>
29868   <paramdef>struct hdmi_avi_infoframe * <parameter>frame</parameter></paramdef>
29869   <paramdef>const struct drm_display_mode * <parameter>mode</parameter></paramdef>
29870  </funcprototype></funcsynopsis>
29871</refsynopsisdiv>
29872<refsect1>
29873 <title>Arguments</title>
29874 <variablelist>
29875  <varlistentry>
29876   <term><parameter>frame</parameter></term>
29877   <listitem>
29878    <para>
29879     HDMI AVI infoframe
29880    </para>
29881   </listitem>
29882  </varlistentry>
29883  <varlistentry>
29884   <term><parameter>mode</parameter></term>
29885   <listitem>
29886    <para>
29887     DRM display mode
29888    </para>
29889   </listitem>
29890  </varlistentry>
29891 </variablelist>
29892</refsect1>
29893<refsect1>
29894<title>Return</title>
29895<para>
29896   0 on success or a negative error code on failure.
29897</para>
29898</refsect1>
29899</refentry>
29900
29901<refentry id="API-drm-hdmi-vendor-infoframe-from-display-mode">
29902<refentryinfo>
29903 <title>LINUX</title>
29904 <productname>Kernel Hackers Manual</productname>
29905 <date>July 2017</date>
29906</refentryinfo>
29907<refmeta>
29908 <refentrytitle><phrase>drm_hdmi_vendor_infoframe_from_display_mode</phrase></refentrytitle>
29909 <manvolnum>9</manvolnum>
29910 <refmiscinfo class="version">4.4.14</refmiscinfo>
29911</refmeta>
29912<refnamediv>
29913 <refname>drm_hdmi_vendor_infoframe_from_display_mode</refname>
29914 <refpurpose>
29915     fill an HDMI infoframe with data from a DRM display mode
29916 </refpurpose>
29917</refnamediv>
29918<refsynopsisdiv>
29919 <title>Synopsis</title>
29920  <funcsynopsis><funcprototype>
29921   <funcdef>int <function>drm_hdmi_vendor_infoframe_from_display_mode </function></funcdef>
29922   <paramdef>struct hdmi_vendor_infoframe * <parameter>frame</parameter></paramdef>
29923   <paramdef>const struct drm_display_mode * <parameter>mode</parameter></paramdef>
29924  </funcprototype></funcsynopsis>
29925</refsynopsisdiv>
29926<refsect1>
29927 <title>Arguments</title>
29928 <variablelist>
29929  <varlistentry>
29930   <term><parameter>frame</parameter></term>
29931   <listitem>
29932    <para>
29933     HDMI vendor infoframe
29934    </para>
29935   </listitem>
29936  </varlistentry>
29937  <varlistentry>
29938   <term><parameter>mode</parameter></term>
29939   <listitem>
29940    <para>
29941     DRM display mode
29942    </para>
29943   </listitem>
29944  </varlistentry>
29945 </variablelist>
29946</refsect1>
29947<refsect1>
29948<title>Description</title>
29949<para>
29950   Note that there's is a need to send HDMI vendor infoframes only when using a
29951   4k or stereoscopic 3D mode. So when giving any other mode as input this
29952   function will return -EINVAL, error that can be safely ignored.
29953</para>
29954</refsect1>
29955<refsect1>
29956<title>Return</title>
29957<para>
29958   0 on success or a negative error code on failure.
29959</para>
29960</refsect1>
29961</refentry>
29962
29963    </sect2>
29964    <sect2>
29965      <title>Rectangle Utilities Reference</title>
29966<para>
29967   </para><para>
29968   Utility functions to help manage rectangular areas for
29969   clipping, scaling, etc. calculations.
29970</para>
29971
29972<!-- include/drm/drm_rect.h -->
29973<refentry id="API-struct-drm-rect">
29974<refentryinfo>
29975 <title>LINUX</title>
29976 <productname>Kernel Hackers Manual</productname>
29977 <date>July 2017</date>
29978</refentryinfo>
29979<refmeta>
29980 <refentrytitle><phrase>struct drm_rect</phrase></refentrytitle>
29981 <manvolnum>9</manvolnum>
29982 <refmiscinfo class="version">4.4.14</refmiscinfo>
29983</refmeta>
29984<refnamediv>
29985 <refname>struct drm_rect</refname>
29986 <refpurpose>
29987  two dimensional rectangle
29988 </refpurpose>
29989</refnamediv>
29990<refsynopsisdiv>
29991 <title>Synopsis</title>
29992  <programlisting>
29993struct drm_rect {
29994  int x1;
29995  int y1;
29996  int x2;
29997  int y2;
29998};  </programlisting>
29999</refsynopsisdiv>
30000 <refsect1>
30001  <title>Members</title>
30002  <variablelist>
30003    <varlistentry>      <term>x1</term>
30004      <listitem><para>
30005horizontal starting coordinate (inclusive)
30006      </para></listitem>
30007    </varlistentry>
30008    <varlistentry>      <term>y1</term>
30009      <listitem><para>
30010vertical starting coordinate (inclusive)
30011      </para></listitem>
30012    </varlistentry>
30013    <varlistentry>      <term>x2</term>
30014      <listitem><para>
30015horizontal ending coordinate (exclusive)
30016      </para></listitem>
30017    </varlistentry>
30018    <varlistentry>      <term>y2</term>
30019      <listitem><para>
30020vertical ending coordinate (exclusive)
30021      </para></listitem>
30022    </varlistentry>
30023  </variablelist>
30024 </refsect1>
30025</refentry>
30026
30027<refentry id="API-drm-rect-adjust-size">
30028<refentryinfo>
30029 <title>LINUX</title>
30030 <productname>Kernel Hackers Manual</productname>
30031 <date>July 2017</date>
30032</refentryinfo>
30033<refmeta>
30034 <refentrytitle><phrase>drm_rect_adjust_size</phrase></refentrytitle>
30035 <manvolnum>9</manvolnum>
30036 <refmiscinfo class="version">4.4.14</refmiscinfo>
30037</refmeta>
30038<refnamediv>
30039 <refname>drm_rect_adjust_size</refname>
30040 <refpurpose>
30041     adjust the size of the rectangle
30042 </refpurpose>
30043</refnamediv>
30044<refsynopsisdiv>
30045 <title>Synopsis</title>
30046  <funcsynopsis><funcprototype>
30047   <funcdef>void <function>drm_rect_adjust_size </function></funcdef>
30048   <paramdef>struct drm_rect * <parameter>r</parameter></paramdef>
30049   <paramdef>int <parameter>dw</parameter></paramdef>
30050   <paramdef>int <parameter>dh</parameter></paramdef>
30051  </funcprototype></funcsynopsis>
30052</refsynopsisdiv>
30053<refsect1>
30054 <title>Arguments</title>
30055 <variablelist>
30056  <varlistentry>
30057   <term><parameter>r</parameter></term>
30058   <listitem>
30059    <para>
30060     rectangle to be adjusted
30061    </para>
30062   </listitem>
30063  </varlistentry>
30064  <varlistentry>
30065   <term><parameter>dw</parameter></term>
30066   <listitem>
30067    <para>
30068     horizontal adjustment
30069    </para>
30070   </listitem>
30071  </varlistentry>
30072  <varlistentry>
30073   <term><parameter>dh</parameter></term>
30074   <listitem>
30075    <para>
30076     vertical adjustment
30077    </para>
30078   </listitem>
30079  </varlistentry>
30080 </variablelist>
30081</refsect1>
30082<refsect1>
30083<title>Description</title>
30084<para>
30085   Change the size of rectangle <parameter>r</parameter> by <parameter>dw</parameter> in the horizontal direction,
30086   and by <parameter>dh</parameter> in the vertical direction, while keeping the center
30087   of <parameter>r</parameter> stationary.
30088   </para><para>
30089
30090   Positive <parameter>dw</parameter> and <parameter>dh</parameter> increase the size, negative values decrease it.
30091</para>
30092</refsect1>
30093</refentry>
30094
30095<refentry id="API-drm-rect-translate">
30096<refentryinfo>
30097 <title>LINUX</title>
30098 <productname>Kernel Hackers Manual</productname>
30099 <date>July 2017</date>
30100</refentryinfo>
30101<refmeta>
30102 <refentrytitle><phrase>drm_rect_translate</phrase></refentrytitle>
30103 <manvolnum>9</manvolnum>
30104 <refmiscinfo class="version">4.4.14</refmiscinfo>
30105</refmeta>
30106<refnamediv>
30107 <refname>drm_rect_translate</refname>
30108 <refpurpose>
30109     translate the rectangle
30110 </refpurpose>
30111</refnamediv>
30112<refsynopsisdiv>
30113 <title>Synopsis</title>
30114  <funcsynopsis><funcprototype>
30115   <funcdef>void <function>drm_rect_translate </function></funcdef>
30116   <paramdef>struct drm_rect * <parameter>r</parameter></paramdef>
30117   <paramdef>int <parameter>dx</parameter></paramdef>
30118   <paramdef>int <parameter>dy</parameter></paramdef>
30119  </funcprototype></funcsynopsis>
30120</refsynopsisdiv>
30121<refsect1>
30122 <title>Arguments</title>
30123 <variablelist>
30124  <varlistentry>
30125   <term><parameter>r</parameter></term>
30126   <listitem>
30127    <para>
30128     rectangle to be tranlated
30129    </para>
30130   </listitem>
30131  </varlistentry>
30132  <varlistentry>
30133   <term><parameter>dx</parameter></term>
30134   <listitem>
30135    <para>
30136     horizontal translation
30137    </para>
30138   </listitem>
30139  </varlistentry>
30140  <varlistentry>
30141   <term><parameter>dy</parameter></term>
30142   <listitem>
30143    <para>
30144     vertical translation
30145    </para>
30146   </listitem>
30147  </varlistentry>
30148 </variablelist>
30149</refsect1>
30150<refsect1>
30151<title>Description</title>
30152<para>
30153   Move rectangle <parameter>r</parameter> by <parameter>dx</parameter> in the horizontal direction,
30154   and by <parameter>dy</parameter> in the vertical direction.
30155</para>
30156</refsect1>
30157</refentry>
30158
30159<refentry id="API-drm-rect-downscale">
30160<refentryinfo>
30161 <title>LINUX</title>
30162 <productname>Kernel Hackers Manual</productname>
30163 <date>July 2017</date>
30164</refentryinfo>
30165<refmeta>
30166 <refentrytitle><phrase>drm_rect_downscale</phrase></refentrytitle>
30167 <manvolnum>9</manvolnum>
30168 <refmiscinfo class="version">4.4.14</refmiscinfo>
30169</refmeta>
30170<refnamediv>
30171 <refname>drm_rect_downscale</refname>
30172 <refpurpose>
30173     downscale a rectangle
30174 </refpurpose>
30175</refnamediv>
30176<refsynopsisdiv>
30177 <title>Synopsis</title>
30178  <funcsynopsis><funcprototype>
30179   <funcdef>void <function>drm_rect_downscale </function></funcdef>
30180   <paramdef>struct drm_rect * <parameter>r</parameter></paramdef>
30181   <paramdef>int <parameter>horz</parameter></paramdef>
30182   <paramdef>int <parameter>vert</parameter></paramdef>
30183  </funcprototype></funcsynopsis>
30184</refsynopsisdiv>
30185<refsect1>
30186 <title>Arguments</title>
30187 <variablelist>
30188  <varlistentry>
30189   <term><parameter>r</parameter></term>
30190   <listitem>
30191    <para>
30192     rectangle to be downscaled
30193    </para>
30194   </listitem>
30195  </varlistentry>
30196  <varlistentry>
30197   <term><parameter>horz</parameter></term>
30198   <listitem>
30199    <para>
30200     horizontal downscale factor
30201    </para>
30202   </listitem>
30203  </varlistentry>
30204  <varlistentry>
30205   <term><parameter>vert</parameter></term>
30206   <listitem>
30207    <para>
30208     vertical downscale factor
30209    </para>
30210   </listitem>
30211  </varlistentry>
30212 </variablelist>
30213</refsect1>
30214<refsect1>
30215<title>Description</title>
30216<para>
30217   Divide the coordinates of rectangle <parameter>r</parameter> by <parameter>horz</parameter> and <parameter>vert</parameter>.
30218</para>
30219</refsect1>
30220</refentry>
30221
30222<refentry id="API-drm-rect-width">
30223<refentryinfo>
30224 <title>LINUX</title>
30225 <productname>Kernel Hackers Manual</productname>
30226 <date>July 2017</date>
30227</refentryinfo>
30228<refmeta>
30229 <refentrytitle><phrase>drm_rect_width</phrase></refentrytitle>
30230 <manvolnum>9</manvolnum>
30231 <refmiscinfo class="version">4.4.14</refmiscinfo>
30232</refmeta>
30233<refnamediv>
30234 <refname>drm_rect_width</refname>
30235 <refpurpose>
30236     determine the rectangle width
30237 </refpurpose>
30238</refnamediv>
30239<refsynopsisdiv>
30240 <title>Synopsis</title>
30241  <funcsynopsis><funcprototype>
30242   <funcdef>int <function>drm_rect_width </function></funcdef>
30243   <paramdef>const struct drm_rect * <parameter>r</parameter></paramdef>
30244  </funcprototype></funcsynopsis>
30245</refsynopsisdiv>
30246<refsect1>
30247 <title>Arguments</title>
30248 <variablelist>
30249  <varlistentry>
30250   <term><parameter>r</parameter></term>
30251   <listitem>
30252    <para>
30253     rectangle whose width is returned
30254    </para>
30255   </listitem>
30256  </varlistentry>
30257 </variablelist>
30258</refsect1>
30259<refsect1>
30260<title>RETURNS</title>
30261<para>
30262   The width of the rectangle.
30263</para>
30264</refsect1>
30265</refentry>
30266
30267<refentry id="API-drm-rect-height">
30268<refentryinfo>
30269 <title>LINUX</title>
30270 <productname>Kernel Hackers Manual</productname>
30271 <date>July 2017</date>
30272</refentryinfo>
30273<refmeta>
30274 <refentrytitle><phrase>drm_rect_height</phrase></refentrytitle>
30275 <manvolnum>9</manvolnum>
30276 <refmiscinfo class="version">4.4.14</refmiscinfo>
30277</refmeta>
30278<refnamediv>
30279 <refname>drm_rect_height</refname>
30280 <refpurpose>
30281     determine the rectangle height
30282 </refpurpose>
30283</refnamediv>
30284<refsynopsisdiv>
30285 <title>Synopsis</title>
30286  <funcsynopsis><funcprototype>
30287   <funcdef>int <function>drm_rect_height </function></funcdef>
30288   <paramdef>const struct drm_rect * <parameter>r</parameter></paramdef>
30289  </funcprototype></funcsynopsis>
30290</refsynopsisdiv>
30291<refsect1>
30292 <title>Arguments</title>
30293 <variablelist>
30294  <varlistentry>
30295   <term><parameter>r</parameter></term>
30296   <listitem>
30297    <para>
30298     rectangle whose height is returned
30299    </para>
30300   </listitem>
30301  </varlistentry>
30302 </variablelist>
30303</refsect1>
30304<refsect1>
30305<title>RETURNS</title>
30306<para>
30307   The height of the rectangle.
30308</para>
30309</refsect1>
30310</refentry>
30311
30312<refentry id="API-drm-rect-visible">
30313<refentryinfo>
30314 <title>LINUX</title>
30315 <productname>Kernel Hackers Manual</productname>
30316 <date>July 2017</date>
30317</refentryinfo>
30318<refmeta>
30319 <refentrytitle><phrase>drm_rect_visible</phrase></refentrytitle>
30320 <manvolnum>9</manvolnum>
30321 <refmiscinfo class="version">4.4.14</refmiscinfo>
30322</refmeta>
30323<refnamediv>
30324 <refname>drm_rect_visible</refname>
30325 <refpurpose>
30326     determine if the the rectangle is visible
30327 </refpurpose>
30328</refnamediv>
30329<refsynopsisdiv>
30330 <title>Synopsis</title>
30331  <funcsynopsis><funcprototype>
30332   <funcdef>bool <function>drm_rect_visible </function></funcdef>
30333   <paramdef>const struct drm_rect * <parameter>r</parameter></paramdef>
30334  </funcprototype></funcsynopsis>
30335</refsynopsisdiv>
30336<refsect1>
30337 <title>Arguments</title>
30338 <variablelist>
30339  <varlistentry>
30340   <term><parameter>r</parameter></term>
30341   <listitem>
30342    <para>
30343     rectangle whose visibility is returned
30344    </para>
30345   </listitem>
30346  </varlistentry>
30347 </variablelist>
30348</refsect1>
30349<refsect1>
30350<title>RETURNS</title>
30351<para>
30352   <constant>true</constant> if the rectangle is visible, <constant>false</constant> otherwise.
30353</para>
30354</refsect1>
30355</refentry>
30356
30357<refentry id="API-drm-rect-equals">
30358<refentryinfo>
30359 <title>LINUX</title>
30360 <productname>Kernel Hackers Manual</productname>
30361 <date>July 2017</date>
30362</refentryinfo>
30363<refmeta>
30364 <refentrytitle><phrase>drm_rect_equals</phrase></refentrytitle>
30365 <manvolnum>9</manvolnum>
30366 <refmiscinfo class="version">4.4.14</refmiscinfo>
30367</refmeta>
30368<refnamediv>
30369 <refname>drm_rect_equals</refname>
30370 <refpurpose>
30371     determine if two rectangles are equal
30372 </refpurpose>
30373</refnamediv>
30374<refsynopsisdiv>
30375 <title>Synopsis</title>
30376  <funcsynopsis><funcprototype>
30377   <funcdef>bool <function>drm_rect_equals </function></funcdef>
30378   <paramdef>const struct drm_rect * <parameter>r1</parameter></paramdef>
30379   <paramdef>const struct drm_rect * <parameter>r2</parameter></paramdef>
30380  </funcprototype></funcsynopsis>
30381</refsynopsisdiv>
30382<refsect1>
30383 <title>Arguments</title>
30384 <variablelist>
30385  <varlistentry>
30386   <term><parameter>r1</parameter></term>
30387   <listitem>
30388    <para>
30389     first rectangle
30390    </para>
30391   </listitem>
30392  </varlistentry>
30393  <varlistentry>
30394   <term><parameter>r2</parameter></term>
30395   <listitem>
30396    <para>
30397     second rectangle
30398    </para>
30399   </listitem>
30400  </varlistentry>
30401 </variablelist>
30402</refsect1>
30403<refsect1>
30404<title>RETURNS</title>
30405<para>
30406   <constant>true</constant> if the rectangles are equal, <constant>false</constant> otherwise.
30407</para>
30408</refsect1>
30409</refentry>
30410
30411<!-- drivers/gpu/drm/drm_rect.c -->
30412<refentry id="API-drm-rect-intersect">
30413<refentryinfo>
30414 <title>LINUX</title>
30415 <productname>Kernel Hackers Manual</productname>
30416 <date>July 2017</date>
30417</refentryinfo>
30418<refmeta>
30419 <refentrytitle><phrase>drm_rect_intersect</phrase></refentrytitle>
30420 <manvolnum>9</manvolnum>
30421 <refmiscinfo class="version">4.4.14</refmiscinfo>
30422</refmeta>
30423<refnamediv>
30424 <refname>drm_rect_intersect</refname>
30425 <refpurpose>
30426  intersect two rectangles
30427 </refpurpose>
30428</refnamediv>
30429<refsynopsisdiv>
30430 <title>Synopsis</title>
30431  <funcsynopsis><funcprototype>
30432   <funcdef>bool <function>drm_rect_intersect </function></funcdef>
30433   <paramdef>struct drm_rect * <parameter>r1</parameter></paramdef>
30434   <paramdef>const struct drm_rect * <parameter>r2</parameter></paramdef>
30435  </funcprototype></funcsynopsis>
30436</refsynopsisdiv>
30437<refsect1>
30438 <title>Arguments</title>
30439 <variablelist>
30440  <varlistentry>
30441   <term><parameter>r1</parameter></term>
30442   <listitem>
30443    <para>
30444     first rectangle
30445    </para>
30446   </listitem>
30447  </varlistentry>
30448  <varlistentry>
30449   <term><parameter>r2</parameter></term>
30450   <listitem>
30451    <para>
30452     second rectangle
30453    </para>
30454   </listitem>
30455  </varlistentry>
30456 </variablelist>
30457</refsect1>
30458<refsect1>
30459<title>Description</title>
30460<para>
30461   Calculate the intersection of rectangles <parameter>r1</parameter> and <parameter>r2</parameter>.
30462   <parameter>r1</parameter> will be overwritten with the intersection.
30463</para>
30464</refsect1>
30465<refsect1>
30466<title>RETURNS</title>
30467<para>
30468   <constant>true</constant> if rectangle <parameter>r1</parameter> is still visible after the operation,
30469   <constant>false</constant> otherwise.
30470</para>
30471</refsect1>
30472</refentry>
30473
30474<refentry id="API-drm-rect-clip-scaled">
30475<refentryinfo>
30476 <title>LINUX</title>
30477 <productname>Kernel Hackers Manual</productname>
30478 <date>July 2017</date>
30479</refentryinfo>
30480<refmeta>
30481 <refentrytitle><phrase>drm_rect_clip_scaled</phrase></refentrytitle>
30482 <manvolnum>9</manvolnum>
30483 <refmiscinfo class="version">4.4.14</refmiscinfo>
30484</refmeta>
30485<refnamediv>
30486 <refname>drm_rect_clip_scaled</refname>
30487 <refpurpose>
30488     perform a scaled clip operation
30489 </refpurpose>
30490</refnamediv>
30491<refsynopsisdiv>
30492 <title>Synopsis</title>
30493  <funcsynopsis><funcprototype>
30494   <funcdef>bool <function>drm_rect_clip_scaled </function></funcdef>
30495   <paramdef>struct drm_rect * <parameter>src</parameter></paramdef>
30496   <paramdef>struct drm_rect * <parameter>dst</parameter></paramdef>
30497   <paramdef>const struct drm_rect * <parameter>clip</parameter></paramdef>
30498   <paramdef>int <parameter>hscale</parameter></paramdef>
30499   <paramdef>int <parameter>vscale</parameter></paramdef>
30500  </funcprototype></funcsynopsis>
30501</refsynopsisdiv>
30502<refsect1>
30503 <title>Arguments</title>
30504 <variablelist>
30505  <varlistentry>
30506   <term><parameter>src</parameter></term>
30507   <listitem>
30508    <para>
30509     source window rectangle
30510    </para>
30511   </listitem>
30512  </varlistentry>
30513  <varlistentry>
30514   <term><parameter>dst</parameter></term>
30515   <listitem>
30516    <para>
30517     destination window rectangle
30518    </para>
30519   </listitem>
30520  </varlistentry>
30521  <varlistentry>
30522   <term><parameter>clip</parameter></term>
30523   <listitem>
30524    <para>
30525     clip rectangle
30526    </para>
30527   </listitem>
30528  </varlistentry>
30529  <varlistentry>
30530   <term><parameter>hscale</parameter></term>
30531   <listitem>
30532    <para>
30533     horizontal scaling factor
30534    </para>
30535   </listitem>
30536  </varlistentry>
30537  <varlistentry>
30538   <term><parameter>vscale</parameter></term>
30539   <listitem>
30540    <para>
30541     vertical scaling factor
30542    </para>
30543   </listitem>
30544  </varlistentry>
30545 </variablelist>
30546</refsect1>
30547<refsect1>
30548<title>Description</title>
30549<para>
30550   Clip rectangle <parameter>dst</parameter> by rectangle <parameter>clip</parameter>. Clip rectangle <parameter>src</parameter> by the
30551   same amounts multiplied by <parameter>hscale</parameter> and <parameter>vscale</parameter>.
30552</para>
30553</refsect1>
30554<refsect1>
30555<title>RETURNS</title>
30556<para>
30557   <constant>true</constant> if rectangle <parameter>dst</parameter> is still visible after being clipped,
30558   <constant>false</constant> otherwise
30559</para>
30560</refsect1>
30561</refentry>
30562
30563<refentry id="API-drm-rect-calc-hscale">
30564<refentryinfo>
30565 <title>LINUX</title>
30566 <productname>Kernel Hackers Manual</productname>
30567 <date>July 2017</date>
30568</refentryinfo>
30569<refmeta>
30570 <refentrytitle><phrase>drm_rect_calc_hscale</phrase></refentrytitle>
30571 <manvolnum>9</manvolnum>
30572 <refmiscinfo class="version">4.4.14</refmiscinfo>
30573</refmeta>
30574<refnamediv>
30575 <refname>drm_rect_calc_hscale</refname>
30576 <refpurpose>
30577     calculate the horizontal scaling factor
30578 </refpurpose>
30579</refnamediv>
30580<refsynopsisdiv>
30581 <title>Synopsis</title>
30582  <funcsynopsis><funcprototype>
30583   <funcdef>int <function>drm_rect_calc_hscale </function></funcdef>
30584   <paramdef>const struct drm_rect * <parameter>src</parameter></paramdef>
30585   <paramdef>const struct drm_rect * <parameter>dst</parameter></paramdef>
30586   <paramdef>int <parameter>min_hscale</parameter></paramdef>
30587   <paramdef>int <parameter>max_hscale</parameter></paramdef>
30588  </funcprototype></funcsynopsis>
30589</refsynopsisdiv>
30590<refsect1>
30591 <title>Arguments</title>
30592 <variablelist>
30593  <varlistentry>
30594   <term><parameter>src</parameter></term>
30595   <listitem>
30596    <para>
30597     source window rectangle
30598    </para>
30599   </listitem>
30600  </varlistentry>
30601  <varlistentry>
30602   <term><parameter>dst</parameter></term>
30603   <listitem>
30604    <para>
30605     destination window rectangle
30606    </para>
30607   </listitem>
30608  </varlistentry>
30609  <varlistentry>
30610   <term><parameter>min_hscale</parameter></term>
30611   <listitem>
30612    <para>
30613     minimum allowed horizontal scaling factor
30614    </para>
30615   </listitem>
30616  </varlistentry>
30617  <varlistentry>
30618   <term><parameter>max_hscale</parameter></term>
30619   <listitem>
30620    <para>
30621     maximum allowed horizontal scaling factor
30622    </para>
30623   </listitem>
30624  </varlistentry>
30625 </variablelist>
30626</refsect1>
30627<refsect1>
30628<title>Description</title>
30629<para>
30630   Calculate the horizontal scaling factor as
30631   (<parameter>src</parameter> width) / (<parameter>dst</parameter> width).
30632</para>
30633</refsect1>
30634<refsect1>
30635<title>RETURNS</title>
30636<para>
30637   The horizontal scaling factor, or errno of out of limits.
30638</para>
30639</refsect1>
30640</refentry>
30641
30642<refentry id="API-drm-rect-calc-vscale">
30643<refentryinfo>
30644 <title>LINUX</title>
30645 <productname>Kernel Hackers Manual</productname>
30646 <date>July 2017</date>
30647</refentryinfo>
30648<refmeta>
30649 <refentrytitle><phrase>drm_rect_calc_vscale</phrase></refentrytitle>
30650 <manvolnum>9</manvolnum>
30651 <refmiscinfo class="version">4.4.14</refmiscinfo>
30652</refmeta>
30653<refnamediv>
30654 <refname>drm_rect_calc_vscale</refname>
30655 <refpurpose>
30656     calculate the vertical scaling factor
30657 </refpurpose>
30658</refnamediv>
30659<refsynopsisdiv>
30660 <title>Synopsis</title>
30661  <funcsynopsis><funcprototype>
30662   <funcdef>int <function>drm_rect_calc_vscale </function></funcdef>
30663   <paramdef>const struct drm_rect * <parameter>src</parameter></paramdef>
30664   <paramdef>const struct drm_rect * <parameter>dst</parameter></paramdef>
30665   <paramdef>int <parameter>min_vscale</parameter></paramdef>
30666   <paramdef>int <parameter>max_vscale</parameter></paramdef>
30667  </funcprototype></funcsynopsis>
30668</refsynopsisdiv>
30669<refsect1>
30670 <title>Arguments</title>
30671 <variablelist>
30672  <varlistentry>
30673   <term><parameter>src</parameter></term>
30674   <listitem>
30675    <para>
30676     source window rectangle
30677    </para>
30678   </listitem>
30679  </varlistentry>
30680  <varlistentry>
30681   <term><parameter>dst</parameter></term>
30682   <listitem>
30683    <para>
30684     destination window rectangle
30685    </para>
30686   </listitem>
30687  </varlistentry>
30688  <varlistentry>
30689   <term><parameter>min_vscale</parameter></term>
30690   <listitem>
30691    <para>
30692     minimum allowed vertical scaling factor
30693    </para>
30694   </listitem>
30695  </varlistentry>
30696  <varlistentry>
30697   <term><parameter>max_vscale</parameter></term>
30698   <listitem>
30699    <para>
30700     maximum allowed vertical scaling factor
30701    </para>
30702   </listitem>
30703  </varlistentry>
30704 </variablelist>
30705</refsect1>
30706<refsect1>
30707<title>Description</title>
30708<para>
30709   Calculate the vertical scaling factor as
30710   (<parameter>src</parameter> height) / (<parameter>dst</parameter> height).
30711</para>
30712</refsect1>
30713<refsect1>
30714<title>RETURNS</title>
30715<para>
30716   The vertical scaling factor, or errno of out of limits.
30717</para>
30718</refsect1>
30719</refentry>
30720
30721<refentry id="API-drm-rect-calc-hscale-relaxed">
30722<refentryinfo>
30723 <title>LINUX</title>
30724 <productname>Kernel Hackers Manual</productname>
30725 <date>July 2017</date>
30726</refentryinfo>
30727<refmeta>
30728 <refentrytitle><phrase>drm_rect_calc_hscale_relaxed</phrase></refentrytitle>
30729 <manvolnum>9</manvolnum>
30730 <refmiscinfo class="version">4.4.14</refmiscinfo>
30731</refmeta>
30732<refnamediv>
30733 <refname>drm_rect_calc_hscale_relaxed</refname>
30734 <refpurpose>
30735     calculate the horizontal scaling factor
30736 </refpurpose>
30737</refnamediv>
30738<refsynopsisdiv>
30739 <title>Synopsis</title>
30740  <funcsynopsis><funcprototype>
30741   <funcdef>int <function>drm_rect_calc_hscale_relaxed </function></funcdef>
30742   <paramdef>struct drm_rect * <parameter>src</parameter></paramdef>
30743   <paramdef>struct drm_rect * <parameter>dst</parameter></paramdef>
30744   <paramdef>int <parameter>min_hscale</parameter></paramdef>
30745   <paramdef>int <parameter>max_hscale</parameter></paramdef>
30746  </funcprototype></funcsynopsis>
30747</refsynopsisdiv>
30748<refsect1>
30749 <title>Arguments</title>
30750 <variablelist>
30751  <varlistentry>
30752   <term><parameter>src</parameter></term>
30753   <listitem>
30754    <para>
30755     source window rectangle
30756    </para>
30757   </listitem>
30758  </varlistentry>
30759  <varlistentry>
30760   <term><parameter>dst</parameter></term>
30761   <listitem>
30762    <para>
30763     destination window rectangle
30764    </para>
30765   </listitem>
30766  </varlistentry>
30767  <varlistentry>
30768   <term><parameter>min_hscale</parameter></term>
30769   <listitem>
30770    <para>
30771     minimum allowed horizontal scaling factor
30772    </para>
30773   </listitem>
30774  </varlistentry>
30775  <varlistentry>
30776   <term><parameter>max_hscale</parameter></term>
30777   <listitem>
30778    <para>
30779     maximum allowed horizontal scaling factor
30780    </para>
30781   </listitem>
30782  </varlistentry>
30783 </variablelist>
30784</refsect1>
30785<refsect1>
30786<title>Description</title>
30787<para>
30788   Calculate the horizontal scaling factor as
30789   (<parameter>src</parameter> width) / (<parameter>dst</parameter> width).
30790   </para><para>
30791
30792   If the calculated scaling factor is below <parameter>min_vscale</parameter>,
30793   decrease the height of rectangle <parameter>dst</parameter> to compensate.
30794   </para><para>
30795
30796   If the calculated scaling factor is above <parameter>max_vscale</parameter>,
30797   decrease the height of rectangle <parameter>src</parameter> to compensate.
30798</para>
30799</refsect1>
30800<refsect1>
30801<title>RETURNS</title>
30802<para>
30803   The horizontal scaling factor.
30804</para>
30805</refsect1>
30806</refentry>
30807
30808<refentry id="API-drm-rect-calc-vscale-relaxed">
30809<refentryinfo>
30810 <title>LINUX</title>
30811 <productname>Kernel Hackers Manual</productname>
30812 <date>July 2017</date>
30813</refentryinfo>
30814<refmeta>
30815 <refentrytitle><phrase>drm_rect_calc_vscale_relaxed</phrase></refentrytitle>
30816 <manvolnum>9</manvolnum>
30817 <refmiscinfo class="version">4.4.14</refmiscinfo>
30818</refmeta>
30819<refnamediv>
30820 <refname>drm_rect_calc_vscale_relaxed</refname>
30821 <refpurpose>
30822     calculate the vertical scaling factor
30823 </refpurpose>
30824</refnamediv>
30825<refsynopsisdiv>
30826 <title>Synopsis</title>
30827  <funcsynopsis><funcprototype>
30828   <funcdef>int <function>drm_rect_calc_vscale_relaxed </function></funcdef>
30829   <paramdef>struct drm_rect * <parameter>src</parameter></paramdef>
30830   <paramdef>struct drm_rect * <parameter>dst</parameter></paramdef>
30831   <paramdef>int <parameter>min_vscale</parameter></paramdef>
30832   <paramdef>int <parameter>max_vscale</parameter></paramdef>
30833  </funcprototype></funcsynopsis>
30834</refsynopsisdiv>
30835<refsect1>
30836 <title>Arguments</title>
30837 <variablelist>
30838  <varlistentry>
30839   <term><parameter>src</parameter></term>
30840   <listitem>
30841    <para>
30842     source window rectangle
30843    </para>
30844   </listitem>
30845  </varlistentry>
30846  <varlistentry>
30847   <term><parameter>dst</parameter></term>
30848   <listitem>
30849    <para>
30850     destination window rectangle
30851    </para>
30852   </listitem>
30853  </varlistentry>
30854  <varlistentry>
30855   <term><parameter>min_vscale</parameter></term>
30856   <listitem>
30857    <para>
30858     minimum allowed vertical scaling factor
30859    </para>
30860   </listitem>
30861  </varlistentry>
30862  <varlistentry>
30863   <term><parameter>max_vscale</parameter></term>
30864   <listitem>
30865    <para>
30866     maximum allowed vertical scaling factor
30867    </para>
30868   </listitem>
30869  </varlistentry>
30870 </variablelist>
30871</refsect1>
30872<refsect1>
30873<title>Description</title>
30874<para>
30875   Calculate the vertical scaling factor as
30876   (<parameter>src</parameter> height) / (<parameter>dst</parameter> height).
30877   </para><para>
30878
30879   If the calculated scaling factor is below <parameter>min_vscale</parameter>,
30880   decrease the height of rectangle <parameter>dst</parameter> to compensate.
30881   </para><para>
30882
30883   If the calculated scaling factor is above <parameter>max_vscale</parameter>,
30884   decrease the height of rectangle <parameter>src</parameter> to compensate.
30885</para>
30886</refsect1>
30887<refsect1>
30888<title>RETURNS</title>
30889<para>
30890   The vertical scaling factor.
30891</para>
30892</refsect1>
30893</refentry>
30894
30895<refentry id="API-drm-rect-debug-print">
30896<refentryinfo>
30897 <title>LINUX</title>
30898 <productname>Kernel Hackers Manual</productname>
30899 <date>July 2017</date>
30900</refentryinfo>
30901<refmeta>
30902 <refentrytitle><phrase>drm_rect_debug_print</phrase></refentrytitle>
30903 <manvolnum>9</manvolnum>
30904 <refmiscinfo class="version">4.4.14</refmiscinfo>
30905</refmeta>
30906<refnamediv>
30907 <refname>drm_rect_debug_print</refname>
30908 <refpurpose>
30909     print the rectangle information
30910 </refpurpose>
30911</refnamediv>
30912<refsynopsisdiv>
30913 <title>Synopsis</title>
30914  <funcsynopsis><funcprototype>
30915   <funcdef>void <function>drm_rect_debug_print </function></funcdef>
30916   <paramdef>const struct drm_rect * <parameter>r</parameter></paramdef>
30917   <paramdef>bool <parameter>fixed_point</parameter></paramdef>
30918  </funcprototype></funcsynopsis>
30919</refsynopsisdiv>
30920<refsect1>
30921 <title>Arguments</title>
30922 <variablelist>
30923  <varlistentry>
30924   <term><parameter>r</parameter></term>
30925   <listitem>
30926    <para>
30927     rectangle to print
30928    </para>
30929   </listitem>
30930  </varlistentry>
30931  <varlistentry>
30932   <term><parameter>fixed_point</parameter></term>
30933   <listitem>
30934    <para>
30935     rectangle is in 16.16 fixed point format
30936    </para>
30937   </listitem>
30938  </varlistentry>
30939 </variablelist>
30940</refsect1>
30941</refentry>
30942
30943<refentry id="API-drm-rect-rotate">
30944<refentryinfo>
30945 <title>LINUX</title>
30946 <productname>Kernel Hackers Manual</productname>
30947 <date>July 2017</date>
30948</refentryinfo>
30949<refmeta>
30950 <refentrytitle><phrase>drm_rect_rotate</phrase></refentrytitle>
30951 <manvolnum>9</manvolnum>
30952 <refmiscinfo class="version">4.4.14</refmiscinfo>
30953</refmeta>
30954<refnamediv>
30955 <refname>drm_rect_rotate</refname>
30956 <refpurpose>
30957     Rotate the rectangle
30958 </refpurpose>
30959</refnamediv>
30960<refsynopsisdiv>
30961 <title>Synopsis</title>
30962  <funcsynopsis><funcprototype>
30963   <funcdef>void <function>drm_rect_rotate </function></funcdef>
30964   <paramdef>struct drm_rect * <parameter>r</parameter></paramdef>
30965   <paramdef>int <parameter>width</parameter></paramdef>
30966   <paramdef>int <parameter>height</parameter></paramdef>
30967   <paramdef>unsigned int <parameter>rotation</parameter></paramdef>
30968  </funcprototype></funcsynopsis>
30969</refsynopsisdiv>
30970<refsect1>
30971 <title>Arguments</title>
30972 <variablelist>
30973  <varlistentry>
30974   <term><parameter>r</parameter></term>
30975   <listitem>
30976    <para>
30977     rectangle to be rotated
30978    </para>
30979   </listitem>
30980  </varlistentry>
30981  <varlistentry>
30982   <term><parameter>width</parameter></term>
30983   <listitem>
30984    <para>
30985     Width of the coordinate space
30986    </para>
30987   </listitem>
30988  </varlistentry>
30989  <varlistentry>
30990   <term><parameter>height</parameter></term>
30991   <listitem>
30992    <para>
30993     Height of the coordinate space
30994    </para>
30995   </listitem>
30996  </varlistentry>
30997  <varlistentry>
30998   <term><parameter>rotation</parameter></term>
30999   <listitem>
31000    <para>
31001     Transformation to be applied
31002    </para>
31003   </listitem>
31004  </varlistentry>
31005 </variablelist>
31006</refsect1>
31007<refsect1>
31008<title>Description</title>
31009<para>
31010   Apply <parameter>rotation</parameter> to the coordinates of rectangle <parameter>r</parameter>.
31011   </para><para>
31012
31013   <parameter>width</parameter> and <parameter>height</parameter> combined with <parameter>rotation</parameter> define
31014   the location of the new origin.
31015   </para><para>
31016
31017   <parameter>width</parameter> correcsponds to the horizontal and <parameter>height</parameter>
31018   to the vertical axis of the untransformed coordinate
31019   space.
31020</para>
31021</refsect1>
31022</refentry>
31023
31024<refentry id="API-drm-rect-rotate-inv">
31025<refentryinfo>
31026 <title>LINUX</title>
31027 <productname>Kernel Hackers Manual</productname>
31028 <date>July 2017</date>
31029</refentryinfo>
31030<refmeta>
31031 <refentrytitle><phrase>drm_rect_rotate_inv</phrase></refentrytitle>
31032 <manvolnum>9</manvolnum>
31033 <refmiscinfo class="version">4.4.14</refmiscinfo>
31034</refmeta>
31035<refnamediv>
31036 <refname>drm_rect_rotate_inv</refname>
31037 <refpurpose>
31038     Inverse rotate the rectangle
31039 </refpurpose>
31040</refnamediv>
31041<refsynopsisdiv>
31042 <title>Synopsis</title>
31043  <funcsynopsis><funcprototype>
31044   <funcdef>void <function>drm_rect_rotate_inv </function></funcdef>
31045   <paramdef>struct drm_rect * <parameter>r</parameter></paramdef>
31046   <paramdef>int <parameter>width</parameter></paramdef>
31047   <paramdef>int <parameter>height</parameter></paramdef>
31048   <paramdef>unsigned int <parameter>rotation</parameter></paramdef>
31049  </funcprototype></funcsynopsis>
31050</refsynopsisdiv>
31051<refsect1>
31052 <title>Arguments</title>
31053 <variablelist>
31054  <varlistentry>
31055   <term><parameter>r</parameter></term>
31056   <listitem>
31057    <para>
31058     rectangle to be rotated
31059    </para>
31060   </listitem>
31061  </varlistentry>
31062  <varlistentry>
31063   <term><parameter>width</parameter></term>
31064   <listitem>
31065    <para>
31066     Width of the coordinate space
31067    </para>
31068   </listitem>
31069  </varlistentry>
31070  <varlistentry>
31071   <term><parameter>height</parameter></term>
31072   <listitem>
31073    <para>
31074     Height of the coordinate space
31075    </para>
31076   </listitem>
31077  </varlistentry>
31078  <varlistentry>
31079   <term><parameter>rotation</parameter></term>
31080   <listitem>
31081    <para>
31082     Transformation whose inverse is to be applied
31083    </para>
31084   </listitem>
31085  </varlistentry>
31086 </variablelist>
31087</refsect1>
31088<refsect1>
31089<title>Description</title>
31090<para>
31091   Apply the inverse of <parameter>rotation</parameter> to the coordinates
31092   of rectangle <parameter>r</parameter>.
31093   </para><para>
31094
31095   <parameter>width</parameter> and <parameter>height</parameter> combined with <parameter>rotation</parameter> define
31096   the location of the new origin.
31097   </para><para>
31098
31099   <parameter>width</parameter> correcsponds to the horizontal and <parameter>height</parameter>
31100   to the vertical axis of the original untransformed
31101   coordinate space, so that you never have to flip
31102   them when doing a rotatation and its inverse.
31103   That is, if you do:
31104   </para><para>
31105
31106   drm_rotate(<structname>r</structname>, width, height, rotation);
31107   drm_rotate_inv(<structname>r</structname>, width, height, rotation);
31108   </para><para>
31109
31110   you will always get back the original rectangle.
31111</para>
31112</refsect1>
31113</refentry>
31114
31115    </sect2>
31116    <sect2>
31117      <title>Flip-work Helper Reference</title>
31118<para>
31119   </para><para>
31120   Util to queue up work to run from work-queue context after flip/vblank.
31121   Typically this can be used to defer unref of framebuffer's, cursor
31122   bo's, etc until after vblank.  The APIs are all thread-safe.
31123   Moreover, drm_flip_work_queue_task and drm_flip_work_queue can be called
31124   in atomic context.
31125</para>
31126
31127<!-- include/drm/drm_flip_work.h -->
31128<refentry id="API-struct-drm-flip-task">
31129<refentryinfo>
31130 <title>LINUX</title>
31131 <productname>Kernel Hackers Manual</productname>
31132 <date>July 2017</date>
31133</refentryinfo>
31134<refmeta>
31135 <refentrytitle><phrase>struct drm_flip_task</phrase></refentrytitle>
31136 <manvolnum>9</manvolnum>
31137 <refmiscinfo class="version">4.4.14</refmiscinfo>
31138</refmeta>
31139<refnamediv>
31140 <refname>struct drm_flip_task</refname>
31141 <refpurpose>
31142  flip work task
31143 </refpurpose>
31144</refnamediv>
31145<refsynopsisdiv>
31146 <title>Synopsis</title>
31147  <programlisting>
31148struct drm_flip_task {
31149  struct list_head node;
31150  void * data;
31151};  </programlisting>
31152</refsynopsisdiv>
31153 <refsect1>
31154  <title>Members</title>
31155  <variablelist>
31156    <varlistentry>      <term>node</term>
31157      <listitem><para>
31158list entry element
31159      </para></listitem>
31160    </varlistentry>
31161    <varlistentry>      <term>data</term>
31162      <listitem><para>
31163data to pass to work-&gt;func
31164      </para></listitem>
31165    </varlistentry>
31166  </variablelist>
31167 </refsect1>
31168</refentry>
31169
31170<refentry id="API-struct-drm-flip-work">
31171<refentryinfo>
31172 <title>LINUX</title>
31173 <productname>Kernel Hackers Manual</productname>
31174 <date>July 2017</date>
31175</refentryinfo>
31176<refmeta>
31177 <refentrytitle><phrase>struct drm_flip_work</phrase></refentrytitle>
31178 <manvolnum>9</manvolnum>
31179 <refmiscinfo class="version">4.4.14</refmiscinfo>
31180</refmeta>
31181<refnamediv>
31182 <refname>struct drm_flip_work</refname>
31183 <refpurpose>
31184     flip work queue
31185 </refpurpose>
31186</refnamediv>
31187<refsynopsisdiv>
31188 <title>Synopsis</title>
31189  <programlisting>
31190struct drm_flip_work {
31191  const char * name;
31192  drm_flip_func_t func;
31193  struct work_struct worker;
31194  struct list_head queued;
31195  struct list_head commited;
31196  spinlock_t lock;
31197};  </programlisting>
31198</refsynopsisdiv>
31199 <refsect1>
31200  <title>Members</title>
31201  <variablelist>
31202    <varlistentry>      <term>name</term>
31203      <listitem><para>
31204   debug name
31205      </para></listitem>
31206    </varlistentry>
31207    <varlistentry>      <term>func</term>
31208      <listitem><para>
31209   callback fxn called for each committed item
31210      </para></listitem>
31211    </varlistentry>
31212    <varlistentry>      <term>worker</term>
31213      <listitem><para>
31214   worker which calls <parameter>func</parameter>
31215      </para></listitem>
31216    </varlistentry>
31217    <varlistentry>      <term>queued</term>
31218      <listitem><para>
31219   queued tasks
31220      </para></listitem>
31221    </varlistentry>
31222    <varlistentry>      <term>commited</term>
31223      <listitem><para>
31224   commited tasks
31225      </para></listitem>
31226    </varlistentry>
31227    <varlistentry>      <term>lock</term>
31228      <listitem><para>
31229   lock to access queued and commited lists
31230      </para></listitem>
31231    </varlistentry>
31232  </variablelist>
31233 </refsect1>
31234</refentry>
31235
31236<!-- drivers/gpu/drm/drm_flip_work.c -->
31237<refentry id="API-drm-flip-work-allocate-task">
31238<refentryinfo>
31239 <title>LINUX</title>
31240 <productname>Kernel Hackers Manual</productname>
31241 <date>July 2017</date>
31242</refentryinfo>
31243<refmeta>
31244 <refentrytitle><phrase>drm_flip_work_allocate_task</phrase></refentrytitle>
31245 <manvolnum>9</manvolnum>
31246 <refmiscinfo class="version">4.4.14</refmiscinfo>
31247</refmeta>
31248<refnamediv>
31249 <refname>drm_flip_work_allocate_task</refname>
31250 <refpurpose>
31251  allocate a flip-work task
31252 </refpurpose>
31253</refnamediv>
31254<refsynopsisdiv>
31255 <title>Synopsis</title>
31256  <funcsynopsis><funcprototype>
31257   <funcdef>struct drm_flip_task * <function>drm_flip_work_allocate_task </function></funcdef>
31258   <paramdef>void * <parameter>data</parameter></paramdef>
31259   <paramdef>gfp_t <parameter>flags</parameter></paramdef>
31260  </funcprototype></funcsynopsis>
31261</refsynopsisdiv>
31262<refsect1>
31263 <title>Arguments</title>
31264 <variablelist>
31265  <varlistentry>
31266   <term><parameter>data</parameter></term>
31267   <listitem>
31268    <para>
31269     data associated to the task
31270    </para>
31271   </listitem>
31272  </varlistentry>
31273  <varlistentry>
31274   <term><parameter>flags</parameter></term>
31275   <listitem>
31276    <para>
31277     allocator flags
31278    </para>
31279   </listitem>
31280  </varlistentry>
31281 </variablelist>
31282</refsect1>
31283<refsect1>
31284<title>Description</title>
31285<para>
31286   Allocate a drm_flip_task object and attach private data to it.
31287</para>
31288</refsect1>
31289</refentry>
31290
31291<refentry id="API-drm-flip-work-queue-task">
31292<refentryinfo>
31293 <title>LINUX</title>
31294 <productname>Kernel Hackers Manual</productname>
31295 <date>July 2017</date>
31296</refentryinfo>
31297<refmeta>
31298 <refentrytitle><phrase>drm_flip_work_queue_task</phrase></refentrytitle>
31299 <manvolnum>9</manvolnum>
31300 <refmiscinfo class="version">4.4.14</refmiscinfo>
31301</refmeta>
31302<refnamediv>
31303 <refname>drm_flip_work_queue_task</refname>
31304 <refpurpose>
31305     queue a specific task
31306 </refpurpose>
31307</refnamediv>
31308<refsynopsisdiv>
31309 <title>Synopsis</title>
31310  <funcsynopsis><funcprototype>
31311   <funcdef>void <function>drm_flip_work_queue_task </function></funcdef>
31312   <paramdef>struct drm_flip_work * <parameter>work</parameter></paramdef>
31313   <paramdef>struct drm_flip_task * <parameter>task</parameter></paramdef>
31314  </funcprototype></funcsynopsis>
31315</refsynopsisdiv>
31316<refsect1>
31317 <title>Arguments</title>
31318 <variablelist>
31319  <varlistentry>
31320   <term><parameter>work</parameter></term>
31321   <listitem>
31322    <para>
31323     the flip-work
31324    </para>
31325   </listitem>
31326  </varlistentry>
31327  <varlistentry>
31328   <term><parameter>task</parameter></term>
31329   <listitem>
31330    <para>
31331     the task to handle
31332    </para>
31333   </listitem>
31334  </varlistentry>
31335 </variablelist>
31336</refsect1>
31337<refsect1>
31338<title>Description</title>
31339<para>
31340   Queues task, that will later be run (passed back to drm_flip_func_t
31341   func) on a work queue after <function>drm_flip_work_commit</function> is called.
31342</para>
31343</refsect1>
31344</refentry>
31345
31346<refentry id="API-drm-flip-work-queue">
31347<refentryinfo>
31348 <title>LINUX</title>
31349 <productname>Kernel Hackers Manual</productname>
31350 <date>July 2017</date>
31351</refentryinfo>
31352<refmeta>
31353 <refentrytitle><phrase>drm_flip_work_queue</phrase></refentrytitle>
31354 <manvolnum>9</manvolnum>
31355 <refmiscinfo class="version">4.4.14</refmiscinfo>
31356</refmeta>
31357<refnamediv>
31358 <refname>drm_flip_work_queue</refname>
31359 <refpurpose>
31360     queue work
31361 </refpurpose>
31362</refnamediv>
31363<refsynopsisdiv>
31364 <title>Synopsis</title>
31365  <funcsynopsis><funcprototype>
31366   <funcdef>void <function>drm_flip_work_queue </function></funcdef>
31367   <paramdef>struct drm_flip_work * <parameter>work</parameter></paramdef>
31368   <paramdef>void * <parameter>val</parameter></paramdef>
31369  </funcprototype></funcsynopsis>
31370</refsynopsisdiv>
31371<refsect1>
31372 <title>Arguments</title>
31373 <variablelist>
31374  <varlistentry>
31375   <term><parameter>work</parameter></term>
31376   <listitem>
31377    <para>
31378     the flip-work
31379    </para>
31380   </listitem>
31381  </varlistentry>
31382  <varlistentry>
31383   <term><parameter>val</parameter></term>
31384   <listitem>
31385    <para>
31386     the value to queue
31387    </para>
31388   </listitem>
31389  </varlistentry>
31390 </variablelist>
31391</refsect1>
31392<refsect1>
31393<title>Description</title>
31394<para>
31395   Queues work, that will later be run (passed back to drm_flip_func_t
31396   func) on a work queue after <function>drm_flip_work_commit</function> is called.
31397</para>
31398</refsect1>
31399</refentry>
31400
31401<refentry id="API-drm-flip-work-commit">
31402<refentryinfo>
31403 <title>LINUX</title>
31404 <productname>Kernel Hackers Manual</productname>
31405 <date>July 2017</date>
31406</refentryinfo>
31407<refmeta>
31408 <refentrytitle><phrase>drm_flip_work_commit</phrase></refentrytitle>
31409 <manvolnum>9</manvolnum>
31410 <refmiscinfo class="version">4.4.14</refmiscinfo>
31411</refmeta>
31412<refnamediv>
31413 <refname>drm_flip_work_commit</refname>
31414 <refpurpose>
31415     commit queued work
31416 </refpurpose>
31417</refnamediv>
31418<refsynopsisdiv>
31419 <title>Synopsis</title>
31420  <funcsynopsis><funcprototype>
31421   <funcdef>void <function>drm_flip_work_commit </function></funcdef>
31422   <paramdef>struct drm_flip_work * <parameter>work</parameter></paramdef>
31423   <paramdef>struct workqueue_struct * <parameter>wq</parameter></paramdef>
31424  </funcprototype></funcsynopsis>
31425</refsynopsisdiv>
31426<refsect1>
31427 <title>Arguments</title>
31428 <variablelist>
31429  <varlistentry>
31430   <term><parameter>work</parameter></term>
31431   <listitem>
31432    <para>
31433     the flip-work
31434    </para>
31435   </listitem>
31436  </varlistentry>
31437  <varlistentry>
31438   <term><parameter>wq</parameter></term>
31439   <listitem>
31440    <para>
31441     the work-queue to run the queued work on
31442    </para>
31443   </listitem>
31444  </varlistentry>
31445 </variablelist>
31446</refsect1>
31447<refsect1>
31448<title>Description</title>
31449<para>
31450   Trigger work previously queued by <function>drm_flip_work_queue</function> to run
31451   on a workqueue.  The typical usage would be to queue work (via
31452   <function>drm_flip_work_queue</function>) at any point (from vblank irq and/or
31453   prior), and then from vblank irq commit the queued work.
31454</para>
31455</refsect1>
31456</refentry>
31457
31458<refentry id="API-drm-flip-work-init">
31459<refentryinfo>
31460 <title>LINUX</title>
31461 <productname>Kernel Hackers Manual</productname>
31462 <date>July 2017</date>
31463</refentryinfo>
31464<refmeta>
31465 <refentrytitle><phrase>drm_flip_work_init</phrase></refentrytitle>
31466 <manvolnum>9</manvolnum>
31467 <refmiscinfo class="version">4.4.14</refmiscinfo>
31468</refmeta>
31469<refnamediv>
31470 <refname>drm_flip_work_init</refname>
31471 <refpurpose>
31472     initialize flip-work
31473 </refpurpose>
31474</refnamediv>
31475<refsynopsisdiv>
31476 <title>Synopsis</title>
31477  <funcsynopsis><funcprototype>
31478   <funcdef>void <function>drm_flip_work_init </function></funcdef>
31479   <paramdef>struct drm_flip_work * <parameter>work</parameter></paramdef>
31480   <paramdef>const char * <parameter>name</parameter></paramdef>
31481   <paramdef>drm_flip_func_t <parameter>func</parameter></paramdef>
31482  </funcprototype></funcsynopsis>
31483</refsynopsisdiv>
31484<refsect1>
31485 <title>Arguments</title>
31486 <variablelist>
31487  <varlistentry>
31488   <term><parameter>work</parameter></term>
31489   <listitem>
31490    <para>
31491     the flip-work to initialize
31492    </para>
31493   </listitem>
31494  </varlistentry>
31495  <varlistentry>
31496   <term><parameter>name</parameter></term>
31497   <listitem>
31498    <para>
31499     debug name
31500    </para>
31501   </listitem>
31502  </varlistentry>
31503  <varlistentry>
31504   <term><parameter>func</parameter></term>
31505   <listitem>
31506    <para>
31507     the callback work function
31508    </para>
31509   </listitem>
31510  </varlistentry>
31511 </variablelist>
31512</refsect1>
31513<refsect1>
31514<title>Description</title>
31515<para>
31516   Initializes/allocates resources for the flip-work
31517</para>
31518</refsect1>
31519</refentry>
31520
31521<refentry id="API-drm-flip-work-cleanup">
31522<refentryinfo>
31523 <title>LINUX</title>
31524 <productname>Kernel Hackers Manual</productname>
31525 <date>July 2017</date>
31526</refentryinfo>
31527<refmeta>
31528 <refentrytitle><phrase>drm_flip_work_cleanup</phrase></refentrytitle>
31529 <manvolnum>9</manvolnum>
31530 <refmiscinfo class="version">4.4.14</refmiscinfo>
31531</refmeta>
31532<refnamediv>
31533 <refname>drm_flip_work_cleanup</refname>
31534 <refpurpose>
31535     cleans up flip-work
31536 </refpurpose>
31537</refnamediv>
31538<refsynopsisdiv>
31539 <title>Synopsis</title>
31540  <funcsynopsis><funcprototype>
31541   <funcdef>void <function>drm_flip_work_cleanup </function></funcdef>
31542   <paramdef>struct drm_flip_work * <parameter>work</parameter></paramdef>
31543  </funcprototype></funcsynopsis>
31544</refsynopsisdiv>
31545<refsect1>
31546 <title>Arguments</title>
31547 <variablelist>
31548  <varlistentry>
31549   <term><parameter>work</parameter></term>
31550   <listitem>
31551    <para>
31552     the flip-work to cleanup
31553    </para>
31554   </listitem>
31555  </varlistentry>
31556 </variablelist>
31557</refsect1>
31558<refsect1>
31559<title>Description</title>
31560<para>
31561   Destroy resources allocated for the flip-work
31562</para>
31563</refsect1>
31564</refentry>
31565
31566    </sect2>
31567    <sect2>
31568      <title>HDMI Infoframes Helper Reference</title>
31569      <para>
31570	Strictly speaking this is not a DRM helper library but generally useable
31571	by any driver interfacing with HDMI outputs like v4l or alsa drivers.
31572	But it nicely fits into the overall topic of mode setting helper
31573	libraries and hence is also included here.
31574      </para>
31575<!-- include/linux/hdmi.h -->
31576<refentry id="API-struct-hdmi-infoframe">
31577<refentryinfo>
31578 <title>LINUX</title>
31579 <productname>Kernel Hackers Manual</productname>
31580 <date>July 2017</date>
31581</refentryinfo>
31582<refmeta>
31583 <refentrytitle><phrase>union hdmi_infoframe</phrase></refentrytitle>
31584 <manvolnum>9</manvolnum>
31585 <refmiscinfo class="version">4.4.14</refmiscinfo>
31586</refmeta>
31587<refnamediv>
31588 <refname>union hdmi_infoframe</refname>
31589 <refpurpose>
31590  overall union of all abstract infoframe representations
31591 </refpurpose>
31592</refnamediv>
31593<refsynopsisdiv>
31594 <title>Synopsis</title>
31595  <programlisting>
31596union hdmi_infoframe {
31597  struct hdmi_any_infoframe any;
31598  struct hdmi_avi_infoframe avi;
31599  struct hdmi_spd_infoframe spd;
31600  union hdmi_vendor_any_infoframe vendor;
31601  struct hdmi_audio_infoframe audio;
31602};  </programlisting>
31603</refsynopsisdiv>
31604 <refsect1>
31605  <title>Members</title>
31606  <variablelist>
31607    <varlistentry>      <term>any</term>
31608      <listitem><para>
31609generic infoframe
31610      </para></listitem>
31611    </varlistentry>
31612    <varlistentry>      <term>avi</term>
31613      <listitem><para>
31614avi infoframe
31615      </para></listitem>
31616    </varlistentry>
31617    <varlistentry>      <term>spd</term>
31618      <listitem><para>
31619spd infoframe
31620      </para></listitem>
31621    </varlistentry>
31622    <varlistentry>      <term>vendor</term>
31623      <listitem><para>
31624union of all vendor infoframes
31625      </para></listitem>
31626    </varlistentry>
31627    <varlistentry>      <term>audio</term>
31628      <listitem><para>
31629audio infoframe
31630      </para></listitem>
31631    </varlistentry>
31632  </variablelist>
31633 </refsect1>
31634<refsect1>
31635<title>Description</title>
31636<para>
31637   This is used by the generic pack function. This works since all infoframes
31638   have the same header which also indicates which type of infoframe should be
31639   packed.
31640</para>
31641</refsect1>
31642</refentry>
31643
31644<!-- drivers/video/hdmi.c -->
31645<refentry id="API-hdmi-avi-infoframe-init">
31646<refentryinfo>
31647 <title>LINUX</title>
31648 <productname>Kernel Hackers Manual</productname>
31649 <date>July 2017</date>
31650</refentryinfo>
31651<refmeta>
31652 <refentrytitle><phrase>hdmi_avi_infoframe_init</phrase></refentrytitle>
31653 <manvolnum>9</manvolnum>
31654 <refmiscinfo class="version">4.4.14</refmiscinfo>
31655</refmeta>
31656<refnamediv>
31657 <refname>hdmi_avi_infoframe_init</refname>
31658 <refpurpose>
31659  initialize an HDMI AVI infoframe
31660 </refpurpose>
31661</refnamediv>
31662<refsynopsisdiv>
31663 <title>Synopsis</title>
31664  <funcsynopsis><funcprototype>
31665   <funcdef>int <function>hdmi_avi_infoframe_init </function></funcdef>
31666   <paramdef>struct hdmi_avi_infoframe * <parameter>frame</parameter></paramdef>
31667  </funcprototype></funcsynopsis>
31668</refsynopsisdiv>
31669<refsect1>
31670 <title>Arguments</title>
31671 <variablelist>
31672  <varlistentry>
31673   <term><parameter>frame</parameter></term>
31674   <listitem>
31675    <para>
31676     HDMI AVI infoframe
31677    </para>
31678   </listitem>
31679  </varlistentry>
31680 </variablelist>
31681</refsect1>
31682<refsect1>
31683<title>Description</title>
31684<para>
31685   Returns 0 on success or a negative error code on failure.
31686</para>
31687</refsect1>
31688</refentry>
31689
31690<refentry id="API-hdmi-avi-infoframe-pack">
31691<refentryinfo>
31692 <title>LINUX</title>
31693 <productname>Kernel Hackers Manual</productname>
31694 <date>July 2017</date>
31695</refentryinfo>
31696<refmeta>
31697 <refentrytitle><phrase>hdmi_avi_infoframe_pack</phrase></refentrytitle>
31698 <manvolnum>9</manvolnum>
31699 <refmiscinfo class="version">4.4.14</refmiscinfo>
31700</refmeta>
31701<refnamediv>
31702 <refname>hdmi_avi_infoframe_pack</refname>
31703 <refpurpose>
31704     write HDMI AVI infoframe to binary buffer
31705 </refpurpose>
31706</refnamediv>
31707<refsynopsisdiv>
31708 <title>Synopsis</title>
31709  <funcsynopsis><funcprototype>
31710   <funcdef>ssize_t <function>hdmi_avi_infoframe_pack </function></funcdef>
31711   <paramdef>struct hdmi_avi_infoframe * <parameter>frame</parameter></paramdef>
31712   <paramdef>void * <parameter>buffer</parameter></paramdef>
31713   <paramdef>size_t <parameter>size</parameter></paramdef>
31714  </funcprototype></funcsynopsis>
31715</refsynopsisdiv>
31716<refsect1>
31717 <title>Arguments</title>
31718 <variablelist>
31719  <varlistentry>
31720   <term><parameter>frame</parameter></term>
31721   <listitem>
31722    <para>
31723     HDMI AVI infoframe
31724    </para>
31725   </listitem>
31726  </varlistentry>
31727  <varlistentry>
31728   <term><parameter>buffer</parameter></term>
31729   <listitem>
31730    <para>
31731     destination buffer
31732    </para>
31733   </listitem>
31734  </varlistentry>
31735  <varlistentry>
31736   <term><parameter>size</parameter></term>
31737   <listitem>
31738    <para>
31739     size of buffer
31740    </para>
31741   </listitem>
31742  </varlistentry>
31743 </variablelist>
31744</refsect1>
31745<refsect1>
31746<title>Description</title>
31747<para>
31748   Packs the information contained in the <parameter>frame</parameter> structure into a binary
31749   representation that can be written into the corresponding controller
31750   registers. Also computes the checksum as required by section 5.3.5 of
31751   the HDMI 1.4 specification.
31752   </para><para>
31753
31754   Returns the number of bytes packed into the binary buffer or a negative
31755   error code on failure.
31756</para>
31757</refsect1>
31758</refentry>
31759
31760<refentry id="API-hdmi-spd-infoframe-init">
31761<refentryinfo>
31762 <title>LINUX</title>
31763 <productname>Kernel Hackers Manual</productname>
31764 <date>July 2017</date>
31765</refentryinfo>
31766<refmeta>
31767 <refentrytitle><phrase>hdmi_spd_infoframe_init</phrase></refentrytitle>
31768 <manvolnum>9</manvolnum>
31769 <refmiscinfo class="version">4.4.14</refmiscinfo>
31770</refmeta>
31771<refnamediv>
31772 <refname>hdmi_spd_infoframe_init</refname>
31773 <refpurpose>
31774     initialize an HDMI SPD infoframe
31775 </refpurpose>
31776</refnamediv>
31777<refsynopsisdiv>
31778 <title>Synopsis</title>
31779  <funcsynopsis><funcprototype>
31780   <funcdef>int <function>hdmi_spd_infoframe_init </function></funcdef>
31781   <paramdef>struct hdmi_spd_infoframe * <parameter>frame</parameter></paramdef>
31782   <paramdef>const char * <parameter>vendor</parameter></paramdef>
31783   <paramdef>const char * <parameter>product</parameter></paramdef>
31784  </funcprototype></funcsynopsis>
31785</refsynopsisdiv>
31786<refsect1>
31787 <title>Arguments</title>
31788 <variablelist>
31789  <varlistentry>
31790   <term><parameter>frame</parameter></term>
31791   <listitem>
31792    <para>
31793     HDMI SPD infoframe
31794    </para>
31795   </listitem>
31796  </varlistentry>
31797  <varlistentry>
31798   <term><parameter>vendor</parameter></term>
31799   <listitem>
31800    <para>
31801     vendor string
31802    </para>
31803   </listitem>
31804  </varlistentry>
31805  <varlistentry>
31806   <term><parameter>product</parameter></term>
31807   <listitem>
31808    <para>
31809     product string
31810    </para>
31811   </listitem>
31812  </varlistentry>
31813 </variablelist>
31814</refsect1>
31815<refsect1>
31816<title>Description</title>
31817<para>
31818   Returns 0 on success or a negative error code on failure.
31819</para>
31820</refsect1>
31821</refentry>
31822
31823<refentry id="API-hdmi-spd-infoframe-pack">
31824<refentryinfo>
31825 <title>LINUX</title>
31826 <productname>Kernel Hackers Manual</productname>
31827 <date>July 2017</date>
31828</refentryinfo>
31829<refmeta>
31830 <refentrytitle><phrase>hdmi_spd_infoframe_pack</phrase></refentrytitle>
31831 <manvolnum>9</manvolnum>
31832 <refmiscinfo class="version">4.4.14</refmiscinfo>
31833</refmeta>
31834<refnamediv>
31835 <refname>hdmi_spd_infoframe_pack</refname>
31836 <refpurpose>
31837     write HDMI SPD infoframe to binary buffer
31838 </refpurpose>
31839</refnamediv>
31840<refsynopsisdiv>
31841 <title>Synopsis</title>
31842  <funcsynopsis><funcprototype>
31843   <funcdef>ssize_t <function>hdmi_spd_infoframe_pack </function></funcdef>
31844   <paramdef>struct hdmi_spd_infoframe * <parameter>frame</parameter></paramdef>
31845   <paramdef>void * <parameter>buffer</parameter></paramdef>
31846   <paramdef>size_t <parameter>size</parameter></paramdef>
31847  </funcprototype></funcsynopsis>
31848</refsynopsisdiv>
31849<refsect1>
31850 <title>Arguments</title>
31851 <variablelist>
31852  <varlistentry>
31853   <term><parameter>frame</parameter></term>
31854   <listitem>
31855    <para>
31856     HDMI SPD infoframe
31857    </para>
31858   </listitem>
31859  </varlistentry>
31860  <varlistentry>
31861   <term><parameter>buffer</parameter></term>
31862   <listitem>
31863    <para>
31864     destination buffer
31865    </para>
31866   </listitem>
31867  </varlistentry>
31868  <varlistentry>
31869   <term><parameter>size</parameter></term>
31870   <listitem>
31871    <para>
31872     size of buffer
31873    </para>
31874   </listitem>
31875  </varlistentry>
31876 </variablelist>
31877</refsect1>
31878<refsect1>
31879<title>Description</title>
31880<para>
31881   Packs the information contained in the <parameter>frame</parameter> structure into a binary
31882   representation that can be written into the corresponding controller
31883   registers. Also computes the checksum as required by section 5.3.5 of
31884   the HDMI 1.4 specification.
31885   </para><para>
31886
31887   Returns the number of bytes packed into the binary buffer or a negative
31888   error code on failure.
31889</para>
31890</refsect1>
31891</refentry>
31892
31893<refentry id="API-hdmi-audio-infoframe-init">
31894<refentryinfo>
31895 <title>LINUX</title>
31896 <productname>Kernel Hackers Manual</productname>
31897 <date>July 2017</date>
31898</refentryinfo>
31899<refmeta>
31900 <refentrytitle><phrase>hdmi_audio_infoframe_init</phrase></refentrytitle>
31901 <manvolnum>9</manvolnum>
31902 <refmiscinfo class="version">4.4.14</refmiscinfo>
31903</refmeta>
31904<refnamediv>
31905 <refname>hdmi_audio_infoframe_init</refname>
31906 <refpurpose>
31907     initialize an HDMI audio infoframe
31908 </refpurpose>
31909</refnamediv>
31910<refsynopsisdiv>
31911 <title>Synopsis</title>
31912  <funcsynopsis><funcprototype>
31913   <funcdef>int <function>hdmi_audio_infoframe_init </function></funcdef>
31914   <paramdef>struct hdmi_audio_infoframe * <parameter>frame</parameter></paramdef>
31915  </funcprototype></funcsynopsis>
31916</refsynopsisdiv>
31917<refsect1>
31918 <title>Arguments</title>
31919 <variablelist>
31920  <varlistentry>
31921   <term><parameter>frame</parameter></term>
31922   <listitem>
31923    <para>
31924     HDMI audio infoframe
31925    </para>
31926   </listitem>
31927  </varlistentry>
31928 </variablelist>
31929</refsect1>
31930<refsect1>
31931<title>Description</title>
31932<para>
31933   Returns 0 on success or a negative error code on failure.
31934</para>
31935</refsect1>
31936</refentry>
31937
31938<refentry id="API-hdmi-audio-infoframe-pack">
31939<refentryinfo>
31940 <title>LINUX</title>
31941 <productname>Kernel Hackers Manual</productname>
31942 <date>July 2017</date>
31943</refentryinfo>
31944<refmeta>
31945 <refentrytitle><phrase>hdmi_audio_infoframe_pack</phrase></refentrytitle>
31946 <manvolnum>9</manvolnum>
31947 <refmiscinfo class="version">4.4.14</refmiscinfo>
31948</refmeta>
31949<refnamediv>
31950 <refname>hdmi_audio_infoframe_pack</refname>
31951 <refpurpose>
31952     write HDMI audio infoframe to binary buffer
31953 </refpurpose>
31954</refnamediv>
31955<refsynopsisdiv>
31956 <title>Synopsis</title>
31957  <funcsynopsis><funcprototype>
31958   <funcdef>ssize_t <function>hdmi_audio_infoframe_pack </function></funcdef>
31959   <paramdef>struct hdmi_audio_infoframe * <parameter>frame</parameter></paramdef>
31960   <paramdef>void * <parameter>buffer</parameter></paramdef>
31961   <paramdef>size_t <parameter>size</parameter></paramdef>
31962  </funcprototype></funcsynopsis>
31963</refsynopsisdiv>
31964<refsect1>
31965 <title>Arguments</title>
31966 <variablelist>
31967  <varlistentry>
31968   <term><parameter>frame</parameter></term>
31969   <listitem>
31970    <para>
31971     HDMI audio infoframe
31972    </para>
31973   </listitem>
31974  </varlistentry>
31975  <varlistentry>
31976   <term><parameter>buffer</parameter></term>
31977   <listitem>
31978    <para>
31979     destination buffer
31980    </para>
31981   </listitem>
31982  </varlistentry>
31983  <varlistentry>
31984   <term><parameter>size</parameter></term>
31985   <listitem>
31986    <para>
31987     size of buffer
31988    </para>
31989   </listitem>
31990  </varlistentry>
31991 </variablelist>
31992</refsect1>
31993<refsect1>
31994<title>Description</title>
31995<para>
31996   Packs the information contained in the <parameter>frame</parameter> structure into a binary
31997   representation that can be written into the corresponding controller
31998   registers. Also computes the checksum as required by section 5.3.5 of
31999   the HDMI 1.4 specification.
32000   </para><para>
32001
32002   Returns the number of bytes packed into the binary buffer or a negative
32003   error code on failure.
32004</para>
32005</refsect1>
32006</refentry>
32007
32008<refentry id="API-hdmi-vendor-infoframe-init">
32009<refentryinfo>
32010 <title>LINUX</title>
32011 <productname>Kernel Hackers Manual</productname>
32012 <date>July 2017</date>
32013</refentryinfo>
32014<refmeta>
32015 <refentrytitle><phrase>hdmi_vendor_infoframe_init</phrase></refentrytitle>
32016 <manvolnum>9</manvolnum>
32017 <refmiscinfo class="version">4.4.14</refmiscinfo>
32018</refmeta>
32019<refnamediv>
32020 <refname>hdmi_vendor_infoframe_init</refname>
32021 <refpurpose>
32022     initialize an HDMI vendor infoframe
32023 </refpurpose>
32024</refnamediv>
32025<refsynopsisdiv>
32026 <title>Synopsis</title>
32027  <funcsynopsis><funcprototype>
32028   <funcdef>int <function>hdmi_vendor_infoframe_init </function></funcdef>
32029   <paramdef>struct hdmi_vendor_infoframe * <parameter>frame</parameter></paramdef>
32030  </funcprototype></funcsynopsis>
32031</refsynopsisdiv>
32032<refsect1>
32033 <title>Arguments</title>
32034 <variablelist>
32035  <varlistentry>
32036   <term><parameter>frame</parameter></term>
32037   <listitem>
32038    <para>
32039     HDMI vendor infoframe
32040    </para>
32041   </listitem>
32042  </varlistentry>
32043 </variablelist>
32044</refsect1>
32045<refsect1>
32046<title>Description</title>
32047<para>
32048   Returns 0 on success or a negative error code on failure.
32049</para>
32050</refsect1>
32051</refentry>
32052
32053<refentry id="API-hdmi-vendor-infoframe-pack">
32054<refentryinfo>
32055 <title>LINUX</title>
32056 <productname>Kernel Hackers Manual</productname>
32057 <date>July 2017</date>
32058</refentryinfo>
32059<refmeta>
32060 <refentrytitle><phrase>hdmi_vendor_infoframe_pack</phrase></refentrytitle>
32061 <manvolnum>9</manvolnum>
32062 <refmiscinfo class="version">4.4.14</refmiscinfo>
32063</refmeta>
32064<refnamediv>
32065 <refname>hdmi_vendor_infoframe_pack</refname>
32066 <refpurpose>
32067     write a HDMI vendor infoframe to binary buffer
32068 </refpurpose>
32069</refnamediv>
32070<refsynopsisdiv>
32071 <title>Synopsis</title>
32072  <funcsynopsis><funcprototype>
32073   <funcdef>ssize_t <function>hdmi_vendor_infoframe_pack </function></funcdef>
32074   <paramdef>struct hdmi_vendor_infoframe * <parameter>frame</parameter></paramdef>
32075   <paramdef>void * <parameter>buffer</parameter></paramdef>
32076   <paramdef>size_t <parameter>size</parameter></paramdef>
32077  </funcprototype></funcsynopsis>
32078</refsynopsisdiv>
32079<refsect1>
32080 <title>Arguments</title>
32081 <variablelist>
32082  <varlistentry>
32083   <term><parameter>frame</parameter></term>
32084   <listitem>
32085    <para>
32086     HDMI infoframe
32087    </para>
32088   </listitem>
32089  </varlistentry>
32090  <varlistentry>
32091   <term><parameter>buffer</parameter></term>
32092   <listitem>
32093    <para>
32094     destination buffer
32095    </para>
32096   </listitem>
32097  </varlistentry>
32098  <varlistentry>
32099   <term><parameter>size</parameter></term>
32100   <listitem>
32101    <para>
32102     size of buffer
32103    </para>
32104   </listitem>
32105  </varlistentry>
32106 </variablelist>
32107</refsect1>
32108<refsect1>
32109<title>Description</title>
32110<para>
32111   Packs the information contained in the <parameter>frame</parameter> structure into a binary
32112   representation that can be written into the corresponding controller
32113   registers. Also computes the checksum as required by section 5.3.5 of
32114   the HDMI 1.4 specification.
32115   </para><para>
32116
32117   Returns the number of bytes packed into the binary buffer or a negative
32118   error code on failure.
32119</para>
32120</refsect1>
32121</refentry>
32122
32123<refentry id="API-hdmi-infoframe-pack">
32124<refentryinfo>
32125 <title>LINUX</title>
32126 <productname>Kernel Hackers Manual</productname>
32127 <date>July 2017</date>
32128</refentryinfo>
32129<refmeta>
32130 <refentrytitle><phrase>hdmi_infoframe_pack</phrase></refentrytitle>
32131 <manvolnum>9</manvolnum>
32132 <refmiscinfo class="version">4.4.14</refmiscinfo>
32133</refmeta>
32134<refnamediv>
32135 <refname>hdmi_infoframe_pack</refname>
32136 <refpurpose>
32137     write a HDMI infoframe to binary buffer
32138 </refpurpose>
32139</refnamediv>
32140<refsynopsisdiv>
32141 <title>Synopsis</title>
32142  <funcsynopsis><funcprototype>
32143   <funcdef>ssize_t <function>hdmi_infoframe_pack </function></funcdef>
32144   <paramdef>union hdmi_infoframe * <parameter>frame</parameter></paramdef>
32145   <paramdef>void * <parameter>buffer</parameter></paramdef>
32146   <paramdef>size_t <parameter>size</parameter></paramdef>
32147  </funcprototype></funcsynopsis>
32148</refsynopsisdiv>
32149<refsect1>
32150 <title>Arguments</title>
32151 <variablelist>
32152  <varlistentry>
32153   <term><parameter>frame</parameter></term>
32154   <listitem>
32155    <para>
32156     HDMI infoframe
32157    </para>
32158   </listitem>
32159  </varlistentry>
32160  <varlistentry>
32161   <term><parameter>buffer</parameter></term>
32162   <listitem>
32163    <para>
32164     destination buffer
32165    </para>
32166   </listitem>
32167  </varlistentry>
32168  <varlistentry>
32169   <term><parameter>size</parameter></term>
32170   <listitem>
32171    <para>
32172     size of buffer
32173    </para>
32174   </listitem>
32175  </varlistentry>
32176 </variablelist>
32177</refsect1>
32178<refsect1>
32179<title>Description</title>
32180<para>
32181   Packs the information contained in the <parameter>frame</parameter> structure into a binary
32182   representation that can be written into the corresponding controller
32183   registers. Also computes the checksum as required by section 5.3.5 of
32184   the HDMI 1.4 specification.
32185   </para><para>
32186
32187   Returns the number of bytes packed into the binary buffer or a negative
32188   error code on failure.
32189</para>
32190</refsect1>
32191</refentry>
32192
32193<refentry id="API-hdmi-infoframe-log">
32194<refentryinfo>
32195 <title>LINUX</title>
32196 <productname>Kernel Hackers Manual</productname>
32197 <date>July 2017</date>
32198</refentryinfo>
32199<refmeta>
32200 <refentrytitle><phrase>hdmi_infoframe_log</phrase></refentrytitle>
32201 <manvolnum>9</manvolnum>
32202 <refmiscinfo class="version">4.4.14</refmiscinfo>
32203</refmeta>
32204<refnamediv>
32205 <refname>hdmi_infoframe_log</refname>
32206 <refpurpose>
32207     log info of HDMI infoframe
32208 </refpurpose>
32209</refnamediv>
32210<refsynopsisdiv>
32211 <title>Synopsis</title>
32212  <funcsynopsis><funcprototype>
32213   <funcdef>void <function>hdmi_infoframe_log </function></funcdef>
32214   <paramdef>const char * <parameter>level</parameter></paramdef>
32215   <paramdef>struct device * <parameter>dev</parameter></paramdef>
32216   <paramdef>union hdmi_infoframe * <parameter>frame</parameter></paramdef>
32217  </funcprototype></funcsynopsis>
32218</refsynopsisdiv>
32219<refsect1>
32220 <title>Arguments</title>
32221 <variablelist>
32222  <varlistentry>
32223   <term><parameter>level</parameter></term>
32224   <listitem>
32225    <para>
32226     logging level
32227    </para>
32228   </listitem>
32229  </varlistentry>
32230  <varlistentry>
32231   <term><parameter>dev</parameter></term>
32232   <listitem>
32233    <para>
32234     device
32235    </para>
32236   </listitem>
32237  </varlistentry>
32238  <varlistentry>
32239   <term><parameter>frame</parameter></term>
32240   <listitem>
32241    <para>
32242     HDMI infoframe
32243    </para>
32244   </listitem>
32245  </varlistentry>
32246 </variablelist>
32247</refsect1>
32248</refentry>
32249
32250<refentry id="API-hdmi-infoframe-unpack">
32251<refentryinfo>
32252 <title>LINUX</title>
32253 <productname>Kernel Hackers Manual</productname>
32254 <date>July 2017</date>
32255</refentryinfo>
32256<refmeta>
32257 <refentrytitle><phrase>hdmi_infoframe_unpack</phrase></refentrytitle>
32258 <manvolnum>9</manvolnum>
32259 <refmiscinfo class="version">4.4.14</refmiscinfo>
32260</refmeta>
32261<refnamediv>
32262 <refname>hdmi_infoframe_unpack</refname>
32263 <refpurpose>
32264     unpack binary buffer to a HDMI infoframe
32265 </refpurpose>
32266</refnamediv>
32267<refsynopsisdiv>
32268 <title>Synopsis</title>
32269  <funcsynopsis><funcprototype>
32270   <funcdef>int <function>hdmi_infoframe_unpack </function></funcdef>
32271   <paramdef>union hdmi_infoframe * <parameter>frame</parameter></paramdef>
32272   <paramdef>void * <parameter>buffer</parameter></paramdef>
32273  </funcprototype></funcsynopsis>
32274</refsynopsisdiv>
32275<refsect1>
32276 <title>Arguments</title>
32277 <variablelist>
32278  <varlistentry>
32279   <term><parameter>frame</parameter></term>
32280   <listitem>
32281    <para>
32282     HDMI infoframe
32283    </para>
32284   </listitem>
32285  </varlistentry>
32286  <varlistentry>
32287   <term><parameter>buffer</parameter></term>
32288   <listitem>
32289    <para>
32290     source buffer
32291    </para>
32292   </listitem>
32293  </varlistentry>
32294 </variablelist>
32295</refsect1>
32296<refsect1>
32297<title>Description</title>
32298<para>
32299   Unpacks the information contained in binary buffer <parameter>buffer</parameter> into a structured
32300   <parameter>frame</parameter> of a HDMI infoframe.
32301   Also verifies the checksum as required by section 5.3.5 of the HDMI 1.4
32302   specification.
32303   </para><para>
32304
32305   Returns 0 on success or a negative error code on failure.
32306</para>
32307</refsect1>
32308</refentry>
32309
32310    </sect2>
32311    <sect2>
32312      <title id="drm-kms-planehelpers">Plane Helper Reference</title>
32313<!-- drivers/gpu/drm/drm_plane_helper.c -->
32314<refentry id="API-drm-plane-helper-check-update">
32315<refentryinfo>
32316 <title>LINUX</title>
32317 <productname>Kernel Hackers Manual</productname>
32318 <date>July 2017</date>
32319</refentryinfo>
32320<refmeta>
32321 <refentrytitle><phrase>drm_plane_helper_check_update</phrase></refentrytitle>
32322 <manvolnum>9</manvolnum>
32323 <refmiscinfo class="version">4.4.14</refmiscinfo>
32324</refmeta>
32325<refnamediv>
32326 <refname>drm_plane_helper_check_update</refname>
32327 <refpurpose>
32328  Check plane update for validity
32329 </refpurpose>
32330</refnamediv>
32331<refsynopsisdiv>
32332 <title>Synopsis</title>
32333  <funcsynopsis><funcprototype>
32334   <funcdef>int <function>drm_plane_helper_check_update </function></funcdef>
32335   <paramdef>struct drm_plane * <parameter>plane</parameter></paramdef>
32336   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
32337   <paramdef>struct drm_framebuffer * <parameter>fb</parameter></paramdef>
32338   <paramdef>struct drm_rect * <parameter>src</parameter></paramdef>
32339   <paramdef>struct drm_rect * <parameter>dest</parameter></paramdef>
32340   <paramdef>const struct drm_rect * <parameter>clip</parameter></paramdef>
32341   <paramdef>int <parameter>min_scale</parameter></paramdef>
32342   <paramdef>int <parameter>max_scale</parameter></paramdef>
32343   <paramdef>bool <parameter>can_position</parameter></paramdef>
32344   <paramdef>bool <parameter>can_update_disabled</parameter></paramdef>
32345   <paramdef>bool * <parameter>visible</parameter></paramdef>
32346  </funcprototype></funcsynopsis>
32347</refsynopsisdiv>
32348<refsect1>
32349 <title>Arguments</title>
32350 <variablelist>
32351  <varlistentry>
32352   <term><parameter>plane</parameter></term>
32353   <listitem>
32354    <para>
32355     plane object to update
32356    </para>
32357   </listitem>
32358  </varlistentry>
32359  <varlistentry>
32360   <term><parameter>crtc</parameter></term>
32361   <listitem>
32362    <para>
32363     owning CRTC of owning plane
32364    </para>
32365   </listitem>
32366  </varlistentry>
32367  <varlistentry>
32368   <term><parameter>fb</parameter></term>
32369   <listitem>
32370    <para>
32371     framebuffer to flip onto plane
32372    </para>
32373   </listitem>
32374  </varlistentry>
32375  <varlistentry>
32376   <term><parameter>src</parameter></term>
32377   <listitem>
32378    <para>
32379     source coordinates in 16.16 fixed point
32380    </para>
32381   </listitem>
32382  </varlistentry>
32383  <varlistentry>
32384   <term><parameter>dest</parameter></term>
32385   <listitem>
32386    <para>
32387     integer destination coordinates
32388    </para>
32389   </listitem>
32390  </varlistentry>
32391  <varlistentry>
32392   <term><parameter>clip</parameter></term>
32393   <listitem>
32394    <para>
32395     integer clipping coordinates
32396    </para>
32397   </listitem>
32398  </varlistentry>
32399  <varlistentry>
32400   <term><parameter>min_scale</parameter></term>
32401   <listitem>
32402    <para>
32403     minimum <parameter>src</parameter>:<parameter>dest</parameter> scaling factor in 16.16 fixed point
32404    </para>
32405   </listitem>
32406  </varlistentry>
32407  <varlistentry>
32408   <term><parameter>max_scale</parameter></term>
32409   <listitem>
32410    <para>
32411     maximum <parameter>src</parameter>:<parameter>dest</parameter> scaling factor in 16.16 fixed point
32412    </para>
32413   </listitem>
32414  </varlistentry>
32415  <varlistentry>
32416   <term><parameter>can_position</parameter></term>
32417   <listitem>
32418    <para>
32419     is it legal to position the plane such that it
32420     doesn't cover the entire crtc?  This will generally
32421     only be false for primary planes.
32422    </para>
32423   </listitem>
32424  </varlistentry>
32425  <varlistentry>
32426   <term><parameter>can_update_disabled</parameter></term>
32427   <listitem>
32428    <para>
32429     can the plane be updated while the crtc
32430     is disabled?
32431    </para>
32432   </listitem>
32433  </varlistentry>
32434  <varlistentry>
32435   <term><parameter>visible</parameter></term>
32436   <listitem>
32437    <para>
32438     output parameter indicating whether plane is still visible after
32439     clipping
32440    </para>
32441   </listitem>
32442  </varlistentry>
32443 </variablelist>
32444</refsect1>
32445<refsect1>
32446<title>Description</title>
32447<para>
32448   Checks that a desired plane update is valid.  Drivers that provide
32449   their own plane handling rather than helper-provided implementations may
32450   still wish to call this function to avoid duplication of error checking
32451   code.
32452</para>
32453</refsect1>
32454<refsect1>
32455<title>RETURNS</title>
32456<para>
32457   Zero if update appears valid, error code on failure
32458</para>
32459</refsect1>
32460</refentry>
32461
32462<refentry id="API-drm-primary-helper-update">
32463<refentryinfo>
32464 <title>LINUX</title>
32465 <productname>Kernel Hackers Manual</productname>
32466 <date>July 2017</date>
32467</refentryinfo>
32468<refmeta>
32469 <refentrytitle><phrase>drm_primary_helper_update</phrase></refentrytitle>
32470 <manvolnum>9</manvolnum>
32471 <refmiscinfo class="version">4.4.14</refmiscinfo>
32472</refmeta>
32473<refnamediv>
32474 <refname>drm_primary_helper_update</refname>
32475 <refpurpose>
32476     Helper for primary plane update
32477 </refpurpose>
32478</refnamediv>
32479<refsynopsisdiv>
32480 <title>Synopsis</title>
32481  <funcsynopsis><funcprototype>
32482   <funcdef>int <function>drm_primary_helper_update </function></funcdef>
32483   <paramdef>struct drm_plane * <parameter>plane</parameter></paramdef>
32484   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
32485   <paramdef>struct drm_framebuffer * <parameter>fb</parameter></paramdef>
32486   <paramdef>int <parameter>crtc_x</parameter></paramdef>
32487   <paramdef>int <parameter>crtc_y</parameter></paramdef>
32488   <paramdef>unsigned int <parameter>crtc_w</parameter></paramdef>
32489   <paramdef>unsigned int <parameter>crtc_h</parameter></paramdef>
32490   <paramdef>uint32_t <parameter>src_x</parameter></paramdef>
32491   <paramdef>uint32_t <parameter>src_y</parameter></paramdef>
32492   <paramdef>uint32_t <parameter>src_w</parameter></paramdef>
32493   <paramdef>uint32_t <parameter>src_h</parameter></paramdef>
32494  </funcprototype></funcsynopsis>
32495</refsynopsisdiv>
32496<refsect1>
32497 <title>Arguments</title>
32498 <variablelist>
32499  <varlistentry>
32500   <term><parameter>plane</parameter></term>
32501   <listitem>
32502    <para>
32503     plane object to update
32504    </para>
32505   </listitem>
32506  </varlistentry>
32507  <varlistentry>
32508   <term><parameter>crtc</parameter></term>
32509   <listitem>
32510    <para>
32511     owning CRTC of owning plane
32512    </para>
32513   </listitem>
32514  </varlistentry>
32515  <varlistentry>
32516   <term><parameter>fb</parameter></term>
32517   <listitem>
32518    <para>
32519     framebuffer to flip onto plane
32520    </para>
32521   </listitem>
32522  </varlistentry>
32523  <varlistentry>
32524   <term><parameter>crtc_x</parameter></term>
32525   <listitem>
32526    <para>
32527     x offset of primary plane on crtc
32528    </para>
32529   </listitem>
32530  </varlistentry>
32531  <varlistentry>
32532   <term><parameter>crtc_y</parameter></term>
32533   <listitem>
32534    <para>
32535     y offset of primary plane on crtc
32536    </para>
32537   </listitem>
32538  </varlistentry>
32539  <varlistentry>
32540   <term><parameter>crtc_w</parameter></term>
32541   <listitem>
32542    <para>
32543     width of primary plane rectangle on crtc
32544    </para>
32545   </listitem>
32546  </varlistentry>
32547  <varlistentry>
32548   <term><parameter>crtc_h</parameter></term>
32549   <listitem>
32550    <para>
32551     height of primary plane rectangle on crtc
32552    </para>
32553   </listitem>
32554  </varlistentry>
32555  <varlistentry>
32556   <term><parameter>src_x</parameter></term>
32557   <listitem>
32558    <para>
32559     x offset of <parameter>fb</parameter> for panning
32560    </para>
32561   </listitem>
32562  </varlistentry>
32563  <varlistentry>
32564   <term><parameter>src_y</parameter></term>
32565   <listitem>
32566    <para>
32567     y offset of <parameter>fb</parameter> for panning
32568    </para>
32569   </listitem>
32570  </varlistentry>
32571  <varlistentry>
32572   <term><parameter>src_w</parameter></term>
32573   <listitem>
32574    <para>
32575     width of source rectangle in <parameter>fb</parameter>
32576    </para>
32577   </listitem>
32578  </varlistentry>
32579  <varlistentry>
32580   <term><parameter>src_h</parameter></term>
32581   <listitem>
32582    <para>
32583     height of source rectangle in <parameter>fb</parameter>
32584    </para>
32585   </listitem>
32586  </varlistentry>
32587 </variablelist>
32588</refsect1>
32589<refsect1>
32590<title>Description</title>
32591<para>
32592   Provides a default plane update handler for primary planes.  This is handler
32593   is called in response to a userspace SetPlane operation on the plane with a
32594   non-NULL framebuffer.  We call the driver's modeset handler to update the
32595   framebuffer.
32596   </para><para>
32597
32598   <function>SetPlane</function> on a primary plane of a disabled CRTC is not supported, and will
32599   return an error.
32600   </para><para>
32601
32602   Note that we make some assumptions about hardware limitations that may not be
32603   true for all hardware --
32604   1) Primary plane cannot be repositioned.
32605   2) Primary plane cannot be scaled.
32606   3) Primary plane must cover the entire CRTC.
32607   4) Subpixel positioning is not supported.
32608   Drivers for hardware that don't have these restrictions can provide their
32609   own implementation rather than using this helper.
32610</para>
32611</refsect1>
32612<refsect1>
32613<title>RETURNS</title>
32614<para>
32615   Zero on success, error code on failure
32616</para>
32617</refsect1>
32618</refentry>
32619
32620<refentry id="API-drm-primary-helper-disable">
32621<refentryinfo>
32622 <title>LINUX</title>
32623 <productname>Kernel Hackers Manual</productname>
32624 <date>July 2017</date>
32625</refentryinfo>
32626<refmeta>
32627 <refentrytitle><phrase>drm_primary_helper_disable</phrase></refentrytitle>
32628 <manvolnum>9</manvolnum>
32629 <refmiscinfo class="version">4.4.14</refmiscinfo>
32630</refmeta>
32631<refnamediv>
32632 <refname>drm_primary_helper_disable</refname>
32633 <refpurpose>
32634     Helper for primary plane disable
32635 </refpurpose>
32636</refnamediv>
32637<refsynopsisdiv>
32638 <title>Synopsis</title>
32639  <funcsynopsis><funcprototype>
32640   <funcdef>int <function>drm_primary_helper_disable </function></funcdef>
32641   <paramdef>struct drm_plane * <parameter>plane</parameter></paramdef>
32642  </funcprototype></funcsynopsis>
32643</refsynopsisdiv>
32644<refsect1>
32645 <title>Arguments</title>
32646 <variablelist>
32647  <varlistentry>
32648   <term><parameter>plane</parameter></term>
32649   <listitem>
32650    <para>
32651     plane to disable
32652    </para>
32653   </listitem>
32654  </varlistentry>
32655 </variablelist>
32656</refsect1>
32657<refsect1>
32658<title>Description</title>
32659<para>
32660   Provides a default plane disable handler for primary planes.  This is handler
32661   is called in response to a userspace SetPlane operation on the plane with a
32662   NULL framebuffer parameter.  It unconditionally fails the disable call with
32663   -EINVAL the only way to disable the primary plane without driver support is
32664   to disable the entier CRTC. Which does not match the plane -&gt;disable hook.
32665   </para><para>
32666
32667   Note that some hardware may be able to disable the primary plane without
32668   disabling the whole CRTC.  Drivers for such hardware should provide their
32669   own disable handler that disables just the primary plane (and they'll likely
32670   need to provide their own update handler as well to properly re-enable a
32671   disabled primary plane).
32672</para>
32673</refsect1>
32674<refsect1>
32675<title>RETURNS</title>
32676<para>
32677   Unconditionally returns -EINVAL.
32678</para>
32679</refsect1>
32680</refentry>
32681
32682<refentry id="API-drm-primary-helper-destroy">
32683<refentryinfo>
32684 <title>LINUX</title>
32685 <productname>Kernel Hackers Manual</productname>
32686 <date>July 2017</date>
32687</refentryinfo>
32688<refmeta>
32689 <refentrytitle><phrase>drm_primary_helper_destroy</phrase></refentrytitle>
32690 <manvolnum>9</manvolnum>
32691 <refmiscinfo class="version">4.4.14</refmiscinfo>
32692</refmeta>
32693<refnamediv>
32694 <refname>drm_primary_helper_destroy</refname>
32695 <refpurpose>
32696     Helper for primary plane destruction
32697 </refpurpose>
32698</refnamediv>
32699<refsynopsisdiv>
32700 <title>Synopsis</title>
32701  <funcsynopsis><funcprototype>
32702   <funcdef>void <function>drm_primary_helper_destroy </function></funcdef>
32703   <paramdef>struct drm_plane * <parameter>plane</parameter></paramdef>
32704  </funcprototype></funcsynopsis>
32705</refsynopsisdiv>
32706<refsect1>
32707 <title>Arguments</title>
32708 <variablelist>
32709  <varlistentry>
32710   <term><parameter>plane</parameter></term>
32711   <listitem>
32712    <para>
32713     plane to destroy
32714    </para>
32715   </listitem>
32716  </varlistentry>
32717 </variablelist>
32718</refsect1>
32719<refsect1>
32720<title>Description</title>
32721<para>
32722   Provides a default plane destroy handler for primary planes.  This handler
32723   is called during CRTC destruction.  We disable the primary plane, remove
32724   it from the DRM plane list, and deallocate the plane structure.
32725</para>
32726</refsect1>
32727</refentry>
32728
32729<refentry id="API-drm-crtc-init">
32730<refentryinfo>
32731 <title>LINUX</title>
32732 <productname>Kernel Hackers Manual</productname>
32733 <date>July 2017</date>
32734</refentryinfo>
32735<refmeta>
32736 <refentrytitle><phrase>drm_crtc_init</phrase></refentrytitle>
32737 <manvolnum>9</manvolnum>
32738 <refmiscinfo class="version">4.4.14</refmiscinfo>
32739</refmeta>
32740<refnamediv>
32741 <refname>drm_crtc_init</refname>
32742 <refpurpose>
32743     Legacy CRTC initialization function
32744 </refpurpose>
32745</refnamediv>
32746<refsynopsisdiv>
32747 <title>Synopsis</title>
32748  <funcsynopsis><funcprototype>
32749   <funcdef>int <function>drm_crtc_init </function></funcdef>
32750   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
32751   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
32752   <paramdef>const struct drm_crtc_funcs * <parameter>funcs</parameter></paramdef>
32753  </funcprototype></funcsynopsis>
32754</refsynopsisdiv>
32755<refsect1>
32756 <title>Arguments</title>
32757 <variablelist>
32758  <varlistentry>
32759   <term><parameter>dev</parameter></term>
32760   <listitem>
32761    <para>
32762     DRM device
32763    </para>
32764   </listitem>
32765  </varlistentry>
32766  <varlistentry>
32767   <term><parameter>crtc</parameter></term>
32768   <listitem>
32769    <para>
32770     CRTC object to init
32771    </para>
32772   </listitem>
32773  </varlistentry>
32774  <varlistentry>
32775   <term><parameter>funcs</parameter></term>
32776   <listitem>
32777    <para>
32778     callbacks for the new CRTC
32779    </para>
32780   </listitem>
32781  </varlistentry>
32782 </variablelist>
32783</refsect1>
32784<refsect1>
32785<title>Description</title>
32786<para>
32787   Initialize a CRTC object with a default helper-provided primary plane and no
32788   cursor plane.
32789</para>
32790</refsect1>
32791<refsect1>
32792<title>Returns</title>
32793<para>
32794   Zero on success, error code on failure.
32795</para>
32796</refsect1>
32797</refentry>
32798
32799<refentry id="API-drm-plane-helper-update">
32800<refentryinfo>
32801 <title>LINUX</title>
32802 <productname>Kernel Hackers Manual</productname>
32803 <date>July 2017</date>
32804</refentryinfo>
32805<refmeta>
32806 <refentrytitle><phrase>drm_plane_helper_update</phrase></refentrytitle>
32807 <manvolnum>9</manvolnum>
32808 <refmiscinfo class="version">4.4.14</refmiscinfo>
32809</refmeta>
32810<refnamediv>
32811 <refname>drm_plane_helper_update</refname>
32812 <refpurpose>
32813     Transitional helper for plane update
32814 </refpurpose>
32815</refnamediv>
32816<refsynopsisdiv>
32817 <title>Synopsis</title>
32818  <funcsynopsis><funcprototype>
32819   <funcdef>int <function>drm_plane_helper_update </function></funcdef>
32820   <paramdef>struct drm_plane * <parameter>plane</parameter></paramdef>
32821   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
32822   <paramdef>struct drm_framebuffer * <parameter>fb</parameter></paramdef>
32823   <paramdef>int <parameter>crtc_x</parameter></paramdef>
32824   <paramdef>int <parameter>crtc_y</parameter></paramdef>
32825   <paramdef>unsigned int <parameter>crtc_w</parameter></paramdef>
32826   <paramdef>unsigned int <parameter>crtc_h</parameter></paramdef>
32827   <paramdef>uint32_t <parameter>src_x</parameter></paramdef>
32828   <paramdef>uint32_t <parameter>src_y</parameter></paramdef>
32829   <paramdef>uint32_t <parameter>src_w</parameter></paramdef>
32830   <paramdef>uint32_t <parameter>src_h</parameter></paramdef>
32831  </funcprototype></funcsynopsis>
32832</refsynopsisdiv>
32833<refsect1>
32834 <title>Arguments</title>
32835 <variablelist>
32836  <varlistentry>
32837   <term><parameter>plane</parameter></term>
32838   <listitem>
32839    <para>
32840     plane object to update
32841    </para>
32842   </listitem>
32843  </varlistentry>
32844  <varlistentry>
32845   <term><parameter>crtc</parameter></term>
32846   <listitem>
32847    <para>
32848     owning CRTC of owning plane
32849    </para>
32850   </listitem>
32851  </varlistentry>
32852  <varlistentry>
32853   <term><parameter>fb</parameter></term>
32854   <listitem>
32855    <para>
32856     framebuffer to flip onto plane
32857    </para>
32858   </listitem>
32859  </varlistentry>
32860  <varlistentry>
32861   <term><parameter>crtc_x</parameter></term>
32862   <listitem>
32863    <para>
32864     x offset of primary plane on crtc
32865    </para>
32866   </listitem>
32867  </varlistentry>
32868  <varlistentry>
32869   <term><parameter>crtc_y</parameter></term>
32870   <listitem>
32871    <para>
32872     y offset of primary plane on crtc
32873    </para>
32874   </listitem>
32875  </varlistentry>
32876  <varlistentry>
32877   <term><parameter>crtc_w</parameter></term>
32878   <listitem>
32879    <para>
32880     width of primary plane rectangle on crtc
32881    </para>
32882   </listitem>
32883  </varlistentry>
32884  <varlistentry>
32885   <term><parameter>crtc_h</parameter></term>
32886   <listitem>
32887    <para>
32888     height of primary plane rectangle on crtc
32889    </para>
32890   </listitem>
32891  </varlistentry>
32892  <varlistentry>
32893   <term><parameter>src_x</parameter></term>
32894   <listitem>
32895    <para>
32896     x offset of <parameter>fb</parameter> for panning
32897    </para>
32898   </listitem>
32899  </varlistentry>
32900  <varlistentry>
32901   <term><parameter>src_y</parameter></term>
32902   <listitem>
32903    <para>
32904     y offset of <parameter>fb</parameter> for panning
32905    </para>
32906   </listitem>
32907  </varlistentry>
32908  <varlistentry>
32909   <term><parameter>src_w</parameter></term>
32910   <listitem>
32911    <para>
32912     width of source rectangle in <parameter>fb</parameter>
32913    </para>
32914   </listitem>
32915  </varlistentry>
32916  <varlistentry>
32917   <term><parameter>src_h</parameter></term>
32918   <listitem>
32919    <para>
32920     height of source rectangle in <parameter>fb</parameter>
32921    </para>
32922   </listitem>
32923  </varlistentry>
32924 </variablelist>
32925</refsect1>
32926<refsect1>
32927<title>Description</title>
32928<para>
32929   Provides a default plane update handler using the atomic plane update
32930   functions. It is fully left to the driver to check plane constraints and
32931   handle corner-cases like a fully occluded or otherwise invisible plane.
32932   </para><para>
32933
32934   This is useful for piecewise transitioning of a driver to the atomic helpers.
32935</para>
32936</refsect1>
32937<refsect1>
32938<title>RETURNS</title>
32939<para>
32940   Zero on success, error code on failure
32941</para>
32942</refsect1>
32943</refentry>
32944
32945<refentry id="API-drm-plane-helper-disable">
32946<refentryinfo>
32947 <title>LINUX</title>
32948 <productname>Kernel Hackers Manual</productname>
32949 <date>July 2017</date>
32950</refentryinfo>
32951<refmeta>
32952 <refentrytitle><phrase>drm_plane_helper_disable</phrase></refentrytitle>
32953 <manvolnum>9</manvolnum>
32954 <refmiscinfo class="version">4.4.14</refmiscinfo>
32955</refmeta>
32956<refnamediv>
32957 <refname>drm_plane_helper_disable</refname>
32958 <refpurpose>
32959     Transitional helper for plane disable
32960 </refpurpose>
32961</refnamediv>
32962<refsynopsisdiv>
32963 <title>Synopsis</title>
32964  <funcsynopsis><funcprototype>
32965   <funcdef>int <function>drm_plane_helper_disable </function></funcdef>
32966   <paramdef>struct drm_plane * <parameter>plane</parameter></paramdef>
32967  </funcprototype></funcsynopsis>
32968</refsynopsisdiv>
32969<refsect1>
32970 <title>Arguments</title>
32971 <variablelist>
32972  <varlistentry>
32973   <term><parameter>plane</parameter></term>
32974   <listitem>
32975    <para>
32976     plane to disable
32977    </para>
32978   </listitem>
32979  </varlistentry>
32980 </variablelist>
32981</refsect1>
32982<refsect1>
32983<title>Description</title>
32984<para>
32985   Provides a default plane disable handler using the atomic plane update
32986   functions. It is fully left to the driver to check plane constraints and
32987   handle corner-cases like a fully occluded or otherwise invisible plane.
32988   </para><para>
32989
32990   This is useful for piecewise transitioning of a driver to the atomic helpers.
32991</para>
32992</refsect1>
32993<refsect1>
32994<title>RETURNS</title>
32995<para>
32996   Zero on success, error code on failure
32997</para>
32998</refsect1>
32999</refentry>
33000
33001<para>
33002   </para><para>
33003   This helper library has two parts. The first part has support to implement
33004   primary plane support on top of the normal CRTC configuration interface.
33005   Since the legacy -&gt;set_config interface ties the primary plane together with
33006   the CRTC state this does not allow userspace to disable the primary plane
33007   itself.  To avoid too much duplicated code use
33008   <function>drm_plane_helper_check_update</function> which can be used to enforce the same
33009   restrictions as primary planes had thus. The default primary plane only
33010   expose XRBG8888 and ARGB8888 as valid pixel formats for the attached
33011   framebuffer.
33012   </para><para>
33013   Drivers are highly recommended to implement proper support for primary
33014   planes, and newly merged drivers must not rely upon these transitional
33015   helpers.
33016   </para><para>
33017   The second part also implements transitional helpers which allow drivers to
33018   gradually switch to the atomic helper infrastructure for plane updates. Once
33019   that switch is complete drivers shouldn't use these any longer, instead using
33020   the proper legacy implementations for update and disable plane hooks provided
33021   by the atomic helpers.
33022   </para><para>
33023   Again drivers are strongly urged to switch to the new interfaces.
33024</para>
33025
33026    </sect2>
33027    <sect2>
33028	  <title>Tile group</title>
33029<para>
33030   </para><para>
33031   Tile groups are used to represent tiled monitors with a unique
33032   integer identifier. Tiled monitors using DisplayID v1.3 have
33033   a unique 8-byte handle, we store this in a tile group, so we
33034   have a common identifier for all tiles in a monitor group.
33035</para>
33036
33037    </sect2>
33038    <sect2>
33039	<title>Bridges</title>
33040      <sect3>
33041	 <title>Overview</title>
33042<para>
33043   </para><para>
33044   drm_bridge represents a device that hangs on to an encoder. These are handy
33045   when a regular drm_encoder entity isn't enough to represent the entire
33046   encoder chain.
33047   </para><para>
33048   A bridge is always associated to a single drm_encoder at a time, but can be
33049   either connected to it directly, or through an intermediate bridge:
33050   </para><para>
33051   encoder ---&gt; bridge B ---&gt; bridge A
33052   </para><para>
33053   Here, the output of the encoder feeds to bridge B, and that furthers feeds to
33054   bridge A.
33055   </para><para>
33056   The driver using the bridge is responsible to make the associations between
33057   the encoder and bridges. Once these links are made, the bridges will
33058   participate along with encoder functions to perform mode_set/enable/disable
33059   through the ops provided in drm_bridge_funcs.
33060   </para><para>
33061   drm_bridge, like drm_panel, aren't drm_mode_object entities like planes,
33062   crtcs, encoders or connectors. They just provide additional hooks to get the
33063   desired output at the end of the encoder chain.
33064</para>
33065
33066      </sect3>
33067      <sect3>
33068	 <title>Default bridge callback sequence</title>
33069<para>
33070   </para><para>
33071   The drm_bridge_funcs ops are populated by the bridge driver. The drm
33072   internals(atomic and crtc helpers) use the helpers defined in drm_bridge.c
33073   These helpers call a specific drm_bridge_funcs op for all the bridges
33074   during encoder configuration.
33075   </para><para>
33076   When creating a bridge driver, one can implement drm_bridge_funcs op with
33077   the help of these rough rules:
33078   </para><para>
33079   pre_enable: this contains things needed to be done for the bridge before
33080   its clock and timings are enabled by its source. For a bridge, its source
33081   is generally the encoder or bridge just before it in the encoder chain.
33082   </para><para>
33083   enable: this contains things needed to be done for the bridge once its
33084   source is enabled. In other words, enable is called once the source is
33085   ready with clock and timing needed by the bridge.
33086   </para><para>
33087   disable: this contains things needed to be done for the bridge assuming
33088   that its source is still enabled, i.e. clock and timings are still on.
33089   </para><para>
33090   post_disable: this contains things needed to be done for the bridge once
33091   its source is disabled, i.e. once clocks and timings are off.
33092   </para><para>
33093   mode_fixup: this should fixup the given mode for the bridge. It is called
33094   after the encoder's mode fixup. mode_fixup can also reject a mode completely
33095   if it's unsuitable for the hardware.
33096   </para><para>
33097   mode_set: this sets up the mode for the bridge. It assumes that its source
33098   (an encoder or a bridge) has set the mode too.
33099</para>
33100
33101      </sect3>
33102<!-- drivers/gpu/drm/drm_bridge.c -->
33103<refentry id="API-drm-bridge-add">
33104<refentryinfo>
33105 <title>LINUX</title>
33106 <productname>Kernel Hackers Manual</productname>
33107 <date>July 2017</date>
33108</refentryinfo>
33109<refmeta>
33110 <refentrytitle><phrase>drm_bridge_add</phrase></refentrytitle>
33111 <manvolnum>9</manvolnum>
33112 <refmiscinfo class="version">4.4.14</refmiscinfo>
33113</refmeta>
33114<refnamediv>
33115 <refname>drm_bridge_add</refname>
33116 <refpurpose>
33117  add the given bridge to the global bridge list
33118 </refpurpose>
33119</refnamediv>
33120<refsynopsisdiv>
33121 <title>Synopsis</title>
33122  <funcsynopsis><funcprototype>
33123   <funcdef>int <function>drm_bridge_add </function></funcdef>
33124   <paramdef>struct drm_bridge * <parameter>bridge</parameter></paramdef>
33125  </funcprototype></funcsynopsis>
33126</refsynopsisdiv>
33127<refsect1>
33128 <title>Arguments</title>
33129 <variablelist>
33130  <varlistentry>
33131   <term><parameter>bridge</parameter></term>
33132   <listitem>
33133    <para>
33134     bridge control structure
33135    </para>
33136   </listitem>
33137  </varlistentry>
33138 </variablelist>
33139</refsect1>
33140<refsect1>
33141<title>RETURNS</title>
33142<para>
33143   Unconditionally returns Zero.
33144</para>
33145</refsect1>
33146</refentry>
33147
33148<refentry id="API-drm-bridge-remove">
33149<refentryinfo>
33150 <title>LINUX</title>
33151 <productname>Kernel Hackers Manual</productname>
33152 <date>July 2017</date>
33153</refentryinfo>
33154<refmeta>
33155 <refentrytitle><phrase>drm_bridge_remove</phrase></refentrytitle>
33156 <manvolnum>9</manvolnum>
33157 <refmiscinfo class="version">4.4.14</refmiscinfo>
33158</refmeta>
33159<refnamediv>
33160 <refname>drm_bridge_remove</refname>
33161 <refpurpose>
33162     remove the given bridge from the global bridge list
33163 </refpurpose>
33164</refnamediv>
33165<refsynopsisdiv>
33166 <title>Synopsis</title>
33167  <funcsynopsis><funcprototype>
33168   <funcdef>void <function>drm_bridge_remove </function></funcdef>
33169   <paramdef>struct drm_bridge * <parameter>bridge</parameter></paramdef>
33170  </funcprototype></funcsynopsis>
33171</refsynopsisdiv>
33172<refsect1>
33173 <title>Arguments</title>
33174 <variablelist>
33175  <varlistentry>
33176   <term><parameter>bridge</parameter></term>
33177   <listitem>
33178    <para>
33179     bridge control structure
33180    </para>
33181   </listitem>
33182  </varlistentry>
33183 </variablelist>
33184</refsect1>
33185</refentry>
33186
33187<refentry id="API-drm-bridge-attach">
33188<refentryinfo>
33189 <title>LINUX</title>
33190 <productname>Kernel Hackers Manual</productname>
33191 <date>July 2017</date>
33192</refentryinfo>
33193<refmeta>
33194 <refentrytitle><phrase>drm_bridge_attach</phrase></refentrytitle>
33195 <manvolnum>9</manvolnum>
33196 <refmiscinfo class="version">4.4.14</refmiscinfo>
33197</refmeta>
33198<refnamediv>
33199 <refname>drm_bridge_attach</refname>
33200 <refpurpose>
33201     associate given bridge to our DRM device
33202 </refpurpose>
33203</refnamediv>
33204<refsynopsisdiv>
33205 <title>Synopsis</title>
33206  <funcsynopsis><funcprototype>
33207   <funcdef>int <function>drm_bridge_attach </function></funcdef>
33208   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
33209   <paramdef>struct drm_bridge * <parameter>bridge</parameter></paramdef>
33210  </funcprototype></funcsynopsis>
33211</refsynopsisdiv>
33212<refsect1>
33213 <title>Arguments</title>
33214 <variablelist>
33215  <varlistentry>
33216   <term><parameter>dev</parameter></term>
33217   <listitem>
33218    <para>
33219     DRM device
33220    </para>
33221   </listitem>
33222  </varlistentry>
33223  <varlistentry>
33224   <term><parameter>bridge</parameter></term>
33225   <listitem>
33226    <para>
33227     bridge control structure
33228    </para>
33229   </listitem>
33230  </varlistentry>
33231 </variablelist>
33232</refsect1>
33233<refsect1>
33234<title>Description</title>
33235<para>
33236   called by a kms driver to link one of our encoder/bridge to the given
33237   bridge.
33238   </para><para>
33239
33240   Note that setting up links between the bridge and our encoder/bridge
33241   objects needs to be handled by the kms driver itself
33242</para>
33243</refsect1>
33244<refsect1>
33245<title>RETURNS</title>
33246<para>
33247   Zero on success, error code on failure
33248</para>
33249</refsect1>
33250</refentry>
33251
33252<refentry id="API-drm-bridge-mode-fixup">
33253<refentryinfo>
33254 <title>LINUX</title>
33255 <productname>Kernel Hackers Manual</productname>
33256 <date>July 2017</date>
33257</refentryinfo>
33258<refmeta>
33259 <refentrytitle><phrase>drm_bridge_mode_fixup</phrase></refentrytitle>
33260 <manvolnum>9</manvolnum>
33261 <refmiscinfo class="version">4.4.14</refmiscinfo>
33262</refmeta>
33263<refnamediv>
33264 <refname>drm_bridge_mode_fixup</refname>
33265 <refpurpose>
33266     fixup proposed mode for all bridges in the encoder chain
33267 </refpurpose>
33268</refnamediv>
33269<refsynopsisdiv>
33270 <title>Synopsis</title>
33271  <funcsynopsis><funcprototype>
33272   <funcdef>bool <function>drm_bridge_mode_fixup </function></funcdef>
33273   <paramdef>struct drm_bridge * <parameter>bridge</parameter></paramdef>
33274   <paramdef>const struct drm_display_mode * <parameter>mode</parameter></paramdef>
33275   <paramdef>struct drm_display_mode * <parameter>adjusted_mode</parameter></paramdef>
33276  </funcprototype></funcsynopsis>
33277</refsynopsisdiv>
33278<refsect1>
33279 <title>Arguments</title>
33280 <variablelist>
33281  <varlistentry>
33282   <term><parameter>bridge</parameter></term>
33283   <listitem>
33284    <para>
33285     bridge control structure
33286    </para>
33287   </listitem>
33288  </varlistentry>
33289  <varlistentry>
33290   <term><parameter>mode</parameter></term>
33291   <listitem>
33292    <para>
33293     desired mode to be set for the bridge
33294    </para>
33295   </listitem>
33296  </varlistentry>
33297  <varlistentry>
33298   <term><parameter>adjusted_mode</parameter></term>
33299   <listitem>
33300    <para>
33301     updated mode that works for this bridge
33302    </para>
33303   </listitem>
33304  </varlistentry>
33305 </variablelist>
33306</refsect1>
33307<refsect1>
33308<title>Description</title>
33309<para>
33310   Calls 'mode_fixup' drm_bridge_funcs op for all the bridges in the
33311   encoder chain, starting from the first bridge to the last.
33312</para>
33313</refsect1>
33314<refsect1>
33315<title>Note</title>
33316<para>
33317   the bridge passed should be the one closest to the encoder
33318</para>
33319</refsect1>
33320<refsect1>
33321<title>RETURNS</title>
33322<para>
33323   true on success, false on failure
33324</para>
33325</refsect1>
33326</refentry>
33327
33328<refentry id="API-drm-bridge-disable">
33329<refentryinfo>
33330 <title>LINUX</title>
33331 <productname>Kernel Hackers Manual</productname>
33332 <date>July 2017</date>
33333</refentryinfo>
33334<refmeta>
33335 <refentrytitle><phrase>drm_bridge_disable</phrase></refentrytitle>
33336 <manvolnum>9</manvolnum>
33337 <refmiscinfo class="version">4.4.14</refmiscinfo>
33338</refmeta>
33339<refnamediv>
33340 <refname>drm_bridge_disable</refname>
33341 <refpurpose>
33342     calls 'disable' drm_bridge_funcs op for all bridges in the encoder chain.
33343 </refpurpose>
33344</refnamediv>
33345<refsynopsisdiv>
33346 <title>Synopsis</title>
33347  <funcsynopsis><funcprototype>
33348   <funcdef>void <function>drm_bridge_disable </function></funcdef>
33349   <paramdef>struct drm_bridge * <parameter>bridge</parameter></paramdef>
33350  </funcprototype></funcsynopsis>
33351</refsynopsisdiv>
33352<refsect1>
33353 <title>Arguments</title>
33354 <variablelist>
33355  <varlistentry>
33356   <term><parameter>bridge</parameter></term>
33357   <listitem>
33358    <para>
33359     bridge control structure
33360    </para>
33361   </listitem>
33362  </varlistentry>
33363 </variablelist>
33364</refsect1>
33365<refsect1>
33366<title>Description</title>
33367<para>
33368   Calls 'disable' drm_bridge_funcs op for all the bridges in the encoder
33369   chain, starting from the last bridge to the first. These are called before
33370   calling the encoder's prepare op.
33371</para>
33372</refsect1>
33373<refsect1>
33374<title>Note</title>
33375<para>
33376   the bridge passed should be the one closest to the encoder
33377</para>
33378</refsect1>
33379</refentry>
33380
33381<refentry id="API-drm-bridge-post-disable">
33382<refentryinfo>
33383 <title>LINUX</title>
33384 <productname>Kernel Hackers Manual</productname>
33385 <date>July 2017</date>
33386</refentryinfo>
33387<refmeta>
33388 <refentrytitle><phrase>drm_bridge_post_disable</phrase></refentrytitle>
33389 <manvolnum>9</manvolnum>
33390 <refmiscinfo class="version">4.4.14</refmiscinfo>
33391</refmeta>
33392<refnamediv>
33393 <refname>drm_bridge_post_disable</refname>
33394 <refpurpose>
33395     calls 'post_disable' drm_bridge_funcs op for all bridges in the encoder chain.
33396 </refpurpose>
33397</refnamediv>
33398<refsynopsisdiv>
33399 <title>Synopsis</title>
33400  <funcsynopsis><funcprototype>
33401   <funcdef>void <function>drm_bridge_post_disable </function></funcdef>
33402   <paramdef>struct drm_bridge * <parameter>bridge</parameter></paramdef>
33403  </funcprototype></funcsynopsis>
33404</refsynopsisdiv>
33405<refsect1>
33406 <title>Arguments</title>
33407 <variablelist>
33408  <varlistentry>
33409   <term><parameter>bridge</parameter></term>
33410   <listitem>
33411    <para>
33412     bridge control structure
33413    </para>
33414   </listitem>
33415  </varlistentry>
33416 </variablelist>
33417</refsect1>
33418<refsect1>
33419<title>Description</title>
33420<para>
33421   Calls 'post_disable' drm_bridge_funcs op for all the bridges in the
33422   encoder chain, starting from the first bridge to the last. These are called
33423   after completing the encoder's prepare op.
33424</para>
33425</refsect1>
33426<refsect1>
33427<title>Note</title>
33428<para>
33429   the bridge passed should be the one closest to the encoder
33430</para>
33431</refsect1>
33432</refentry>
33433
33434<refentry id="API-drm-bridge-mode-set">
33435<refentryinfo>
33436 <title>LINUX</title>
33437 <productname>Kernel Hackers Manual</productname>
33438 <date>July 2017</date>
33439</refentryinfo>
33440<refmeta>
33441 <refentrytitle><phrase>drm_bridge_mode_set</phrase></refentrytitle>
33442 <manvolnum>9</manvolnum>
33443 <refmiscinfo class="version">4.4.14</refmiscinfo>
33444</refmeta>
33445<refnamediv>
33446 <refname>drm_bridge_mode_set</refname>
33447 <refpurpose>
33448     set proposed mode for all bridges in the encoder chain
33449 </refpurpose>
33450</refnamediv>
33451<refsynopsisdiv>
33452 <title>Synopsis</title>
33453  <funcsynopsis><funcprototype>
33454   <funcdef>void <function>drm_bridge_mode_set </function></funcdef>
33455   <paramdef>struct drm_bridge * <parameter>bridge</parameter></paramdef>
33456   <paramdef>struct drm_display_mode * <parameter>mode</parameter></paramdef>
33457   <paramdef>struct drm_display_mode * <parameter>adjusted_mode</parameter></paramdef>
33458  </funcprototype></funcsynopsis>
33459</refsynopsisdiv>
33460<refsect1>
33461 <title>Arguments</title>
33462 <variablelist>
33463  <varlistentry>
33464   <term><parameter>bridge</parameter></term>
33465   <listitem>
33466    <para>
33467     bridge control structure
33468    </para>
33469   </listitem>
33470  </varlistentry>
33471  <varlistentry>
33472   <term><parameter>mode</parameter></term>
33473   <listitem>
33474    <para>
33475     desired mode to be set for the bridge
33476    </para>
33477   </listitem>
33478  </varlistentry>
33479  <varlistentry>
33480   <term><parameter>adjusted_mode</parameter></term>
33481   <listitem>
33482    <para>
33483     updated mode that works for this bridge
33484    </para>
33485   </listitem>
33486  </varlistentry>
33487 </variablelist>
33488</refsect1>
33489<refsect1>
33490<title>Description</title>
33491<para>
33492   Calls 'mode_set' drm_bridge_funcs op for all the bridges in the
33493   encoder chain, starting from the first bridge to the last.
33494</para>
33495</refsect1>
33496<refsect1>
33497<title>Note</title>
33498<para>
33499   the bridge passed should be the one closest to the encoder
33500</para>
33501</refsect1>
33502</refentry>
33503
33504<refentry id="API-drm-bridge-pre-enable">
33505<refentryinfo>
33506 <title>LINUX</title>
33507 <productname>Kernel Hackers Manual</productname>
33508 <date>July 2017</date>
33509</refentryinfo>
33510<refmeta>
33511 <refentrytitle><phrase>drm_bridge_pre_enable</phrase></refentrytitle>
33512 <manvolnum>9</manvolnum>
33513 <refmiscinfo class="version">4.4.14</refmiscinfo>
33514</refmeta>
33515<refnamediv>
33516 <refname>drm_bridge_pre_enable</refname>
33517 <refpurpose>
33518     calls 'pre_enable' drm_bridge_funcs op for all bridges in the encoder chain.
33519 </refpurpose>
33520</refnamediv>
33521<refsynopsisdiv>
33522 <title>Synopsis</title>
33523  <funcsynopsis><funcprototype>
33524   <funcdef>void <function>drm_bridge_pre_enable </function></funcdef>
33525   <paramdef>struct drm_bridge * <parameter>bridge</parameter></paramdef>
33526  </funcprototype></funcsynopsis>
33527</refsynopsisdiv>
33528<refsect1>
33529 <title>Arguments</title>
33530 <variablelist>
33531  <varlistentry>
33532   <term><parameter>bridge</parameter></term>
33533   <listitem>
33534    <para>
33535     bridge control structure
33536    </para>
33537   </listitem>
33538  </varlistentry>
33539 </variablelist>
33540</refsect1>
33541<refsect1>
33542<title>Description</title>
33543<para>
33544   Calls 'pre_enable' drm_bridge_funcs op for all the bridges in the encoder
33545   chain, starting from the last bridge to the first. These are called
33546   before calling the encoder's commit op.
33547</para>
33548</refsect1>
33549<refsect1>
33550<title>Note</title>
33551<para>
33552   the bridge passed should be the one closest to the encoder
33553</para>
33554</refsect1>
33555</refentry>
33556
33557<refentry id="API-drm-bridge-enable">
33558<refentryinfo>
33559 <title>LINUX</title>
33560 <productname>Kernel Hackers Manual</productname>
33561 <date>July 2017</date>
33562</refentryinfo>
33563<refmeta>
33564 <refentrytitle><phrase>drm_bridge_enable</phrase></refentrytitle>
33565 <manvolnum>9</manvolnum>
33566 <refmiscinfo class="version">4.4.14</refmiscinfo>
33567</refmeta>
33568<refnamediv>
33569 <refname>drm_bridge_enable</refname>
33570 <refpurpose>
33571     calls 'enable' drm_bridge_funcs op for all bridges in the encoder chain.
33572 </refpurpose>
33573</refnamediv>
33574<refsynopsisdiv>
33575 <title>Synopsis</title>
33576  <funcsynopsis><funcprototype>
33577   <funcdef>void <function>drm_bridge_enable </function></funcdef>
33578   <paramdef>struct drm_bridge * <parameter>bridge</parameter></paramdef>
33579  </funcprototype></funcsynopsis>
33580</refsynopsisdiv>
33581<refsect1>
33582 <title>Arguments</title>
33583 <variablelist>
33584  <varlistentry>
33585   <term><parameter>bridge</parameter></term>
33586   <listitem>
33587    <para>
33588     bridge control structure
33589    </para>
33590   </listitem>
33591  </varlistentry>
33592 </variablelist>
33593</refsect1>
33594<refsect1>
33595<title>Description</title>
33596<para>
33597   Calls 'enable' drm_bridge_funcs op for all the bridges in the encoder
33598   chain, starting from the first bridge to the last. These are called
33599   after completing the encoder's commit op.
33600   </para><para>
33601
33602   Note that the bridge passed should be the one closest to the encoder
33603</para>
33604</refsect1>
33605</refentry>
33606
33607<refentry id="API-of-drm-find-bridge">
33608<refentryinfo>
33609 <title>LINUX</title>
33610 <productname>Kernel Hackers Manual</productname>
33611 <date>July 2017</date>
33612</refentryinfo>
33613<refmeta>
33614 <refentrytitle><phrase>of_drm_find_bridge</phrase></refentrytitle>
33615 <manvolnum>9</manvolnum>
33616 <refmiscinfo class="version">4.4.14</refmiscinfo>
33617</refmeta>
33618<refnamediv>
33619 <refname>of_drm_find_bridge</refname>
33620 <refpurpose>
33621     find the bridge corresponding to the device node in the global bridge list
33622 </refpurpose>
33623</refnamediv>
33624<refsynopsisdiv>
33625 <title>Synopsis</title>
33626  <funcsynopsis><funcprototype>
33627   <funcdef>struct drm_bridge * <function>of_drm_find_bridge </function></funcdef>
33628   <paramdef>struct device_node * <parameter>np</parameter></paramdef>
33629  </funcprototype></funcsynopsis>
33630</refsynopsisdiv>
33631<refsect1>
33632 <title>Arguments</title>
33633 <variablelist>
33634  <varlistentry>
33635   <term><parameter>np</parameter></term>
33636   <listitem>
33637    <para>
33638     device node
33639    </para>
33640   </listitem>
33641  </varlistentry>
33642 </variablelist>
33643</refsect1>
33644<refsect1>
33645<title>RETURNS</title>
33646<para>
33647   drm_bridge control struct on success, NULL on failure
33648</para>
33649</refsect1>
33650</refentry>
33651
33652    </sect2>
33653  </sect1>
33654
33655  <!-- Internals: kms properties -->
33656
33657  <sect1 id="drm-kms-properties">
33658    <title>KMS Properties</title>
33659    <para>
33660      Drivers may need to expose additional parameters to applications than
33661      those described in the previous sections. KMS supports attaching
33662      properties to CRTCs, connectors and planes and offers a userspace API to
33663      list, get and set the property values.
33664    </para>
33665    <para>
33666      Properties are identified by a name that uniquely defines the property
33667      purpose, and store an associated value. For all property types except blob
33668      properties the value is a 64-bit unsigned integer.
33669    </para>
33670    <para>
33671      KMS differentiates between properties and property instances. Drivers
33672      first create properties and then create and associate individual instances
33673      of those properties to objects. A property can be instantiated multiple
33674      times and associated with different objects. Values are stored in property
33675      instances, and all other property information are stored in the property
33676      and shared between all instances of the property.
33677    </para>
33678    <para>
33679      Every property is created with a type that influences how the KMS core
33680      handles the property. Supported property types are
33681      <variablelist>
33682        <varlistentry>
33683          <term>DRM_MODE_PROP_RANGE</term>
33684          <listitem><para>Range properties report their minimum and maximum
33685            admissible values. The KMS core verifies that values set by
33686            application fit in that range.</para></listitem>
33687        </varlistentry>
33688        <varlistentry>
33689          <term>DRM_MODE_PROP_ENUM</term>
33690          <listitem><para>Enumerated properties take a numerical value that
33691            ranges from 0 to the number of enumerated values defined by the
33692            property minus one, and associate a free-formed string name to each
33693            value. Applications can retrieve the list of defined value-name pairs
33694            and use the numerical value to get and set property instance values.
33695            </para></listitem>
33696        </varlistentry>
33697        <varlistentry>
33698          <term>DRM_MODE_PROP_BITMASK</term>
33699          <listitem><para>Bitmask properties are enumeration properties that
33700            additionally restrict all enumerated values to the 0..63 range.
33701            Bitmask property instance values combine one or more of the
33702            enumerated bits defined by the property.</para></listitem>
33703        </varlistentry>
33704        <varlistentry>
33705          <term>DRM_MODE_PROP_BLOB</term>
33706          <listitem><para>Blob properties store a binary blob without any format
33707            restriction. The binary blobs are created as KMS standalone objects,
33708            and blob property instance values store the ID of their associated
33709            blob object.</para>
33710	    <para>Blob properties are only used for the connector EDID property
33711	    and cannot be created by drivers.</para></listitem>
33712        </varlistentry>
33713      </variablelist>
33714    </para>
33715    <para>
33716      To create a property drivers call one of the following functions depending
33717      on the property type. All property creation functions take property flags
33718      and name, as well as type-specific arguments.
33719      <itemizedlist>
33720        <listitem>
33721          <synopsis>struct drm_property *drm_property_create_range(struct drm_device *dev, int flags,
33722                                               const char *name,
33723                                               uint64_t min, uint64_t max);</synopsis>
33724          <para>Create a range property with the given minimum and maximum
33725            values.</para>
33726        </listitem>
33727        <listitem>
33728          <synopsis>struct drm_property *drm_property_create_enum(struct drm_device *dev, int flags,
33729                                              const char *name,
33730                                              const struct drm_prop_enum_list *props,
33731                                              int num_values);</synopsis>
33732          <para>Create an enumerated property. The <parameter>props</parameter>
33733            argument points to an array of <parameter>num_values</parameter>
33734            value-name pairs.</para>
33735        </listitem>
33736        <listitem>
33737          <synopsis>struct drm_property *drm_property_create_bitmask(struct drm_device *dev,
33738                                                 int flags, const char *name,
33739                                                 const struct drm_prop_enum_list *props,
33740                                                 int num_values);</synopsis>
33741          <para>Create a bitmask property. The <parameter>props</parameter>
33742            argument points to an array of <parameter>num_values</parameter>
33743            value-name pairs.</para>
33744        </listitem>
33745      </itemizedlist>
33746    </para>
33747    <para>
33748      Properties can additionally be created as immutable, in which case they
33749      will be read-only for applications but can be modified by the driver. To
33750      create an immutable property drivers must set the DRM_MODE_PROP_IMMUTABLE
33751      flag at property creation time.
33752    </para>
33753    <para>
33754      When no array of value-name pairs is readily available at property
33755      creation time for enumerated or range properties, drivers can create
33756      the property using the <function>drm_property_create</function> function
33757      and manually add enumeration value-name pairs by calling the
33758      <function>drm_property_add_enum</function> function. Care must be taken to
33759      properly specify the property type through the <parameter>flags</parameter>
33760      argument.
33761    </para>
33762    <para>
33763      After creating properties drivers can attach property instances to CRTC,
33764      connector and plane objects by calling the
33765      <function>drm_object_attach_property</function>. The function takes a
33766      pointer to the target object, a pointer to the previously created property
33767      and an initial instance value.
33768    </para>
33769    <sect2>
33770	<title>Existing KMS Properties</title>
33771	<para>
33772	The following table gives description of drm properties exposed by various
33773	modules/drivers.
33774	</para>
33775	<table border="1" cellpadding="0" cellspacing="0">
33776	<tbody>
33777	<tr style="font-weight: bold;">
33778	<td valign="top" >Owner Module/Drivers</td>
33779	<td valign="top" >Group</td>
33780	<td valign="top" >Property Name</td>
33781	<td valign="top" >Type</td>
33782	<td valign="top" >Property Values</td>
33783	<td valign="top" >Object attached</td>
33784	<td valign="top" >Description/Restrictions</td>
33785	</tr>
33786	<tr>
33787	<td rowspan="37" valign="top" >DRM</td>
33788	<td valign="top" >Generic</td>
33789	<td valign="top" >“rotation”</td>
33790	<td valign="top" >BITMASK</td>
33791	<td valign="top" >{ 0, "rotate-0" },
33792	{ 1, "rotate-90" },
33793	{ 2, "rotate-180" },
33794	{ 3, "rotate-270" },
33795	{ 4, "reflect-x" },
33796	{ 5, "reflect-y" }</td>
33797	<td valign="top" >CRTC, Plane</td>
33798	<td valign="top" >rotate-(degrees) rotates the image by the specified amount in degrees
33799	in counter clockwise direction. reflect-x and reflect-y reflects the
33800	image along the specified axis prior to rotation</td>
33801	</tr>
33802	<tr>
33803	<td rowspan="5" valign="top" >Connector</td>
33804	<td valign="top" >“EDID”</td>
33805	<td valign="top" >BLOB | IMMUTABLE</td>
33806	<td valign="top" >0</td>
33807	<td valign="top" >Connector</td>
33808	<td valign="top" >Contains id of edid blob ptr object.</td>
33809	</tr>
33810	<tr>
33811	<td valign="top" >“DPMS”</td>
33812	<td valign="top" >ENUM</td>
33813	<td valign="top" >{ “On”, “Standby”, “Suspend”, “Off” }</td>
33814	<td valign="top" >Connector</td>
33815	<td valign="top" >Contains DPMS operation mode value.</td>
33816	</tr>
33817	<tr>
33818	<td valign="top" >“PATH”</td>
33819	<td valign="top" >BLOB | IMMUTABLE</td>
33820	<td valign="top" >0</td>
33821	<td valign="top" >Connector</td>
33822	<td valign="top" >Contains topology path to a connector.</td>
33823	</tr>
33824	<tr>
33825	<td valign="top" >“TILE”</td>
33826	<td valign="top" >BLOB | IMMUTABLE</td>
33827	<td valign="top" >0</td>
33828	<td valign="top" >Connector</td>
33829	<td valign="top" >Contains tiling information for a connector.</td>
33830	</tr>
33831	<tr>
33832	<td valign="top" >“CRTC_ID”</td>
33833	<td valign="top" >OBJECT</td>
33834	<td valign="top" >DRM_MODE_OBJECT_CRTC</td>
33835	<td valign="top" >Connector</td>
33836	<td valign="top" >CRTC that connector is attached to (atomic)</td>
33837	</tr>
33838	<tr>
33839	<td rowspan="11" valign="top" >Plane</td>
33840	<td valign="top" >“type”</td>
33841	<td valign="top" >ENUM | IMMUTABLE</td>
33842	<td valign="top" >{ "Overlay", "Primary", "Cursor" }</td>
33843	<td valign="top" >Plane</td>
33844	<td valign="top" >Plane type</td>
33845	</tr>
33846	<tr>
33847	<td valign="top" >“SRC_X”</td>
33848	<td valign="top" >RANGE</td>
33849	<td valign="top" >Min=0, Max=UINT_MAX</td>
33850	<td valign="top" >Plane</td>
33851	<td valign="top" >Scanout source x coordinate in 16.16 fixed point (atomic)</td>
33852	</tr>
33853	<tr>
33854	<td valign="top" >“SRC_Y”</td>
33855	<td valign="top" >RANGE</td>
33856	<td valign="top" >Min=0, Max=UINT_MAX</td>
33857	<td valign="top" >Plane</td>
33858	<td valign="top" >Scanout source y coordinate in 16.16 fixed point (atomic)</td>
33859	</tr>
33860	<tr>
33861	<td valign="top" >“SRC_W”</td>
33862	<td valign="top" >RANGE</td>
33863	<td valign="top" >Min=0, Max=UINT_MAX</td>
33864	<td valign="top" >Plane</td>
33865	<td valign="top" >Scanout source width in 16.16 fixed point (atomic)</td>
33866	</tr>
33867	<tr>
33868	<td valign="top" >“SRC_H”</td>
33869	<td valign="top" >RANGE</td>
33870	<td valign="top" >Min=0, Max=UINT_MAX</td>
33871	<td valign="top" >Plane</td>
33872	<td valign="top" >Scanout source height in 16.16 fixed point (atomic)</td>
33873	</tr>
33874	<tr>
33875	<td valign="top" >“CRTC_X”</td>
33876	<td valign="top" >SIGNED_RANGE</td>
33877	<td valign="top" >Min=INT_MIN, Max=INT_MAX</td>
33878	<td valign="top" >Plane</td>
33879	<td valign="top" >Scanout CRTC (destination) x coordinate (atomic)</td>
33880	</tr>
33881	<tr>
33882	<td valign="top" >“CRTC_Y”</td>
33883	<td valign="top" >SIGNED_RANGE</td>
33884	<td valign="top" >Min=INT_MIN, Max=INT_MAX</td>
33885	<td valign="top" >Plane</td>
33886	<td valign="top" >Scanout CRTC (destination) y coordinate (atomic)</td>
33887	</tr>
33888	<tr>
33889	<td valign="top" >“CRTC_W”</td>
33890	<td valign="top" >RANGE</td>
33891	<td valign="top" >Min=0, Max=UINT_MAX</td>
33892	<td valign="top" >Plane</td>
33893	<td valign="top" >Scanout CRTC (destination) width (atomic)</td>
33894	</tr>
33895	<tr>
33896	<td valign="top" >“CRTC_H”</td>
33897	<td valign="top" >RANGE</td>
33898	<td valign="top" >Min=0, Max=UINT_MAX</td>
33899	<td valign="top" >Plane</td>
33900	<td valign="top" >Scanout CRTC (destination) height (atomic)</td>
33901	</tr>
33902	<tr>
33903	<td valign="top" >“FB_ID”</td>
33904	<td valign="top" >OBJECT</td>
33905	<td valign="top" >DRM_MODE_OBJECT_FB</td>
33906	<td valign="top" >Plane</td>
33907	<td valign="top" >Scanout framebuffer (atomic)</td>
33908	</tr>
33909	<tr>
33910	<td valign="top" >“CRTC_ID”</td>
33911	<td valign="top" >OBJECT</td>
33912	<td valign="top" >DRM_MODE_OBJECT_CRTC</td>
33913	<td valign="top" >Plane</td>
33914	<td valign="top" >CRTC that plane is attached to (atomic)</td>
33915	</tr>
33916	<tr>
33917	<td rowspan="2" valign="top" >DVI-I</td>
33918	<td valign="top" >“subconnector”</td>
33919	<td valign="top" >ENUM</td>
33920	<td valign="top" >{ “Unknown”, “DVI-D”, “DVI-A” }</td>
33921	<td valign="top" >Connector</td>
33922	<td valign="top" >TBD</td>
33923	</tr>
33924	<tr>
33925	<td valign="top" >“select subconnector”</td>
33926	<td valign="top" >ENUM</td>
33927	<td valign="top" >{ “Automatic”, “DVI-D”, “DVI-A” }</td>
33928	<td valign="top" >Connector</td>
33929	<td valign="top" >TBD</td>
33930	</tr>
33931	<tr>
33932	<td rowspan="13" valign="top" >TV</td>
33933	<td valign="top" >“subconnector”</td>
33934	<td valign="top" >ENUM</td>
33935	<td valign="top" >{ "Unknown", "Composite", "SVIDEO", "Component", "SCART" }</td>
33936	<td valign="top" >Connector</td>
33937	<td valign="top" >TBD</td>
33938	</tr>
33939	<tr>
33940	<td valign="top" >“select subconnector”</td>
33941	<td valign="top" >ENUM</td>
33942	<td valign="top" >{ "Automatic", "Composite", "SVIDEO", "Component", "SCART" }</td>
33943	<td valign="top" >Connector</td>
33944	<td valign="top" >TBD</td>
33945	</tr>
33946	<tr>
33947	<td valign="top" >“mode”</td>
33948	<td valign="top" >ENUM</td>
33949	<td valign="top" >{ "NTSC_M", "NTSC_J", "NTSC_443", "PAL_B" } etc.</td>
33950	<td valign="top" >Connector</td>
33951	<td valign="top" >TBD</td>
33952	</tr>
33953	<tr>
33954	<td valign="top" >“left margin”</td>
33955	<td valign="top" >RANGE</td>
33956	<td valign="top" >Min=0, Max=100</td>
33957	<td valign="top" >Connector</td>
33958	<td valign="top" >TBD</td>
33959	</tr>
33960	<tr>
33961	<td valign="top" >“right margin”</td>
33962	<td valign="top" >RANGE</td>
33963	<td valign="top" >Min=0, Max=100</td>
33964	<td valign="top" >Connector</td>
33965	<td valign="top" >TBD</td>
33966	</tr>
33967	<tr>
33968	<td valign="top" >“top margin”</td>
33969	<td valign="top" >RANGE</td>
33970	<td valign="top" >Min=0, Max=100</td>
33971	<td valign="top" >Connector</td>
33972	<td valign="top" >TBD</td>
33973	</tr>
33974	<tr>
33975	<td valign="top" >“bottom margin”</td>
33976	<td valign="top" >RANGE</td>
33977	<td valign="top" >Min=0, Max=100</td>
33978	<td valign="top" >Connector</td>
33979	<td valign="top" >TBD</td>
33980	</tr>
33981	<tr>
33982	<td valign="top" >“brightness”</td>
33983	<td valign="top" >RANGE</td>
33984	<td valign="top" >Min=0, Max=100</td>
33985	<td valign="top" >Connector</td>
33986	<td valign="top" >TBD</td>
33987	</tr>
33988	<tr>
33989	<td valign="top" >“contrast”</td>
33990	<td valign="top" >RANGE</td>
33991	<td valign="top" >Min=0, Max=100</td>
33992	<td valign="top" >Connector</td>
33993	<td valign="top" >TBD</td>
33994	</tr>
33995	<tr>
33996	<td valign="top" >“flicker reduction”</td>
33997	<td valign="top" >RANGE</td>
33998	<td valign="top" >Min=0, Max=100</td>
33999	<td valign="top" >Connector</td>
34000	<td valign="top" >TBD</td>
34001	</tr>
34002	<tr>
34003	<td valign="top" >“overscan”</td>
34004	<td valign="top" >RANGE</td>
34005	<td valign="top" >Min=0, Max=100</td>
34006	<td valign="top" >Connector</td>
34007	<td valign="top" >TBD</td>
34008	</tr>
34009	<tr>
34010	<td valign="top" >“saturation”</td>
34011	<td valign="top" >RANGE</td>
34012	<td valign="top" >Min=0, Max=100</td>
34013	<td valign="top" >Connector</td>
34014	<td valign="top" >TBD</td>
34015	</tr>
34016	<tr>
34017	<td valign="top" >“hue”</td>
34018	<td valign="top" >RANGE</td>
34019	<td valign="top" >Min=0, Max=100</td>
34020	<td valign="top" >Connector</td>
34021	<td valign="top" >TBD</td>
34022	</tr>
34023	<tr>
34024	<td rowspan="2" valign="top" >Virtual GPU</td>
34025	<td valign="top" >“suggested X”</td>
34026	<td valign="top" >RANGE</td>
34027	<td valign="top" >Min=0, Max=0xffffffff</td>
34028	<td valign="top" >Connector</td>
34029	<td valign="top" >property to suggest an X offset for a connector</td>
34030	</tr>
34031	<tr>
34032	<td valign="top" >“suggested Y”</td>
34033	<td valign="top" >RANGE</td>
34034	<td valign="top" >Min=0, Max=0xffffffff</td>
34035	<td valign="top" >Connector</td>
34036	<td valign="top" >property to suggest an Y offset for a connector</td>
34037	</tr>
34038	<tr>
34039	<td rowspan="3" valign="top" >Optional</td>
34040	<td valign="top" >“scaling mode”</td>
34041	<td valign="top" >ENUM</td>
34042	<td valign="top" >{ "None", "Full", "Center", "Full aspect" }</td>
34043	<td valign="top" >Connector</td>
34044	<td valign="top" >TBD</td>
34045	</tr>
34046	<tr>
34047	<td valign="top" >"aspect ratio"</td>
34048	<td valign="top" >ENUM</td>
34049	<td valign="top" >{ "None", "4:3", "16:9" }</td>
34050	<td valign="top" >Connector</td>
34051	<td valign="top" >DRM property to set aspect ratio from user space app.
34052		This enum is made generic to allow addition of custom aspect
34053		ratios.</td>
34054	</tr>
34055	<tr>
34056	<td valign="top" >“dirty”</td>
34057	<td valign="top" >ENUM | IMMUTABLE</td>
34058	<td valign="top" >{ "Off", "On", "Annotate" }</td>
34059	<td valign="top" >Connector</td>
34060	<td valign="top" >TBD</td>
34061	</tr>
34062	<tr>
34063	<td rowspan="20" valign="top" >i915</td>
34064	<td rowspan="2" valign="top" >Generic</td>
34065	<td valign="top" >"Broadcast RGB"</td>
34066	<td valign="top" >ENUM</td>
34067	<td valign="top" >{ "Automatic", "Full", "Limited 16:235" }</td>
34068	<td valign="top" >Connector</td>
34069	<td valign="top" >TBD</td>
34070	</tr>
34071	<tr>
34072	<td valign="top" >“audio”</td>
34073	<td valign="top" >ENUM</td>
34074	<td valign="top" >{ "force-dvi", "off", "auto", "on" }</td>
34075	<td valign="top" >Connector</td>
34076	<td valign="top" >TBD</td>
34077	</tr>
34078	<tr>
34079	<td rowspan="17" valign="top" >SDVO-TV</td>
34080	<td valign="top" >“mode”</td>
34081	<td valign="top" >ENUM</td>
34082	<td valign="top" >{ "NTSC_M", "NTSC_J", "NTSC_443", "PAL_B" } etc.</td>
34083	<td valign="top" >Connector</td>
34084	<td valign="top" >TBD</td>
34085	</tr>
34086	<tr>
34087	<td valign="top" >"left_margin"</td>
34088	<td valign="top" >RANGE</td>
34089	<td valign="top" >Min=0, Max= SDVO dependent</td>
34090	<td valign="top" >Connector</td>
34091	<td valign="top" >TBD</td>
34092	</tr>
34093	<tr>
34094	<td valign="top" >"right_margin"</td>
34095	<td valign="top" >RANGE</td>
34096	<td valign="top" >Min=0, Max= SDVO dependent</td>
34097	<td valign="top" >Connector</td>
34098	<td valign="top" >TBD</td>
34099	</tr>
34100	<tr>
34101	<td valign="top" >"top_margin"</td>
34102	<td valign="top" >RANGE</td>
34103	<td valign="top" >Min=0, Max= SDVO dependent</td>
34104	<td valign="top" >Connector</td>
34105	<td valign="top" >TBD</td>
34106	</tr>
34107	<tr>
34108	<td valign="top" >"bottom_margin"</td>
34109	<td valign="top" >RANGE</td>
34110	<td valign="top" >Min=0, Max= SDVO dependent</td>
34111	<td valign="top" >Connector</td>
34112	<td valign="top" >TBD</td>
34113	</tr>
34114	<tr>
34115	<td valign="top" >“hpos”</td>
34116	<td valign="top" >RANGE</td>
34117	<td valign="top" >Min=0, Max= SDVO dependent</td>
34118	<td valign="top" >Connector</td>
34119	<td valign="top" >TBD</td>
34120	</tr>
34121	<tr>
34122	<td valign="top" >“vpos”</td>
34123	<td valign="top" >RANGE</td>
34124	<td valign="top" >Min=0, Max= SDVO dependent</td>
34125	<td valign="top" >Connector</td>
34126	<td valign="top" >TBD</td>
34127	</tr>
34128	<tr>
34129	<td valign="top" >“contrast”</td>
34130	<td valign="top" >RANGE</td>
34131	<td valign="top" >Min=0, Max= SDVO dependent</td>
34132	<td valign="top" >Connector</td>
34133	<td valign="top" >TBD</td>
34134	</tr>
34135	<tr>
34136	<td valign="top" >“saturation”</td>
34137	<td valign="top" >RANGE</td>
34138	<td valign="top" >Min=0, Max= SDVO dependent</td>
34139	<td valign="top" >Connector</td>
34140	<td valign="top" >TBD</td>
34141	</tr>
34142	<tr>
34143	<td valign="top" >“hue”</td>
34144	<td valign="top" >RANGE</td>
34145	<td valign="top" >Min=0, Max= SDVO dependent</td>
34146	<td valign="top" >Connector</td>
34147	<td valign="top" >TBD</td>
34148	</tr>
34149	<tr>
34150	<td valign="top" >“sharpness”</td>
34151	<td valign="top" >RANGE</td>
34152	<td valign="top" >Min=0, Max= SDVO dependent</td>
34153	<td valign="top" >Connector</td>
34154	<td valign="top" >TBD</td>
34155	</tr>
34156	<tr>
34157	<td valign="top" >“flicker_filter”</td>
34158	<td valign="top" >RANGE</td>
34159	<td valign="top" >Min=0, Max= SDVO dependent</td>
34160	<td valign="top" >Connector</td>
34161	<td valign="top" >TBD</td>
34162	</tr>
34163	<tr>
34164	<td valign="top" >“flicker_filter_adaptive”</td>
34165	<td valign="top" >RANGE</td>
34166	<td valign="top" >Min=0, Max= SDVO dependent</td>
34167	<td valign="top" >Connector</td>
34168	<td valign="top" >TBD</td>
34169	</tr>
34170	<tr>
34171	<td valign="top" >“flicker_filter_2d”</td>
34172	<td valign="top" >RANGE</td>
34173	<td valign="top" >Min=0, Max= SDVO dependent</td>
34174	<td valign="top" >Connector</td>
34175	<td valign="top" >TBD</td>
34176	</tr>
34177	<tr>
34178	<td valign="top" >“tv_chroma_filter”</td>
34179	<td valign="top" >RANGE</td>
34180	<td valign="top" >Min=0, Max= SDVO dependent</td>
34181	<td valign="top" >Connector</td>
34182	<td valign="top" >TBD</td>
34183	</tr>
34184	<tr>
34185	<td valign="top" >“tv_luma_filter”</td>
34186	<td valign="top" >RANGE</td>
34187	<td valign="top" >Min=0, Max= SDVO dependent</td>
34188	<td valign="top" >Connector</td>
34189	<td valign="top" >TBD</td>
34190	</tr>
34191	<tr>
34192	<td valign="top" >“dot_crawl”</td>
34193	<td valign="top" >RANGE</td>
34194	<td valign="top" >Min=0, Max=1</td>
34195	<td valign="top" >Connector</td>
34196	<td valign="top" >TBD</td>
34197	</tr>
34198	<tr>
34199	<td valign="top" >SDVO-TV/LVDS</td>
34200	<td valign="top" >“brightness”</td>
34201	<td valign="top" >RANGE</td>
34202	<td valign="top" >Min=0, Max= SDVO dependent</td>
34203	<td valign="top" >Connector</td>
34204	<td valign="top" >TBD</td>
34205	</tr>
34206	<tr>
34207	<td rowspan="2" valign="top" >CDV gma-500</td>
34208	<td rowspan="2" valign="top" >Generic</td>
34209	<td valign="top" >"Broadcast RGB"</td>
34210	<td valign="top" >ENUM</td>
34211	<td valign="top" >{ “Full”, “Limited 16:235” }</td>
34212	<td valign="top" >Connector</td>
34213	<td valign="top" >TBD</td>
34214	</tr>
34215	<tr>
34216	<td valign="top" >"Broadcast RGB"</td>
34217	<td valign="top" >ENUM</td>
34218	<td valign="top" >{ “off”, “auto”, “on” }</td>
34219	<td valign="top" >Connector</td>
34220	<td valign="top" >TBD</td>
34221	</tr>
34222	<tr>
34223	<td rowspan="19" valign="top" >Poulsbo</td>
34224	<td rowspan="1" valign="top" >Generic</td>
34225	<td valign="top" >“backlight”</td>
34226	<td valign="top" >RANGE</td>
34227	<td valign="top" >Min=0, Max=100</td>
34228	<td valign="top" >Connector</td>
34229	<td valign="top" >TBD</td>
34230	</tr>
34231	<tr>
34232	<td rowspan="17" valign="top" >SDVO-TV</td>
34233	<td valign="top" >“mode”</td>
34234	<td valign="top" >ENUM</td>
34235	<td valign="top" >{ "NTSC_M", "NTSC_J", "NTSC_443", "PAL_B" } etc.</td>
34236	<td valign="top" >Connector</td>
34237	<td valign="top" >TBD</td>
34238	</tr>
34239	<tr>
34240	<td valign="top" >"left_margin"</td>
34241	<td valign="top" >RANGE</td>
34242	<td valign="top" >Min=0, Max= SDVO dependent</td>
34243	<td valign="top" >Connector</td>
34244	<td valign="top" >TBD</td>
34245	</tr>
34246	<tr>
34247	<td valign="top" >"right_margin"</td>
34248	<td valign="top" >RANGE</td>
34249	<td valign="top" >Min=0, Max= SDVO dependent</td>
34250	<td valign="top" >Connector</td>
34251	<td valign="top" >TBD</td>
34252	</tr>
34253	<tr>
34254	<td valign="top" >"top_margin"</td>
34255	<td valign="top" >RANGE</td>
34256	<td valign="top" >Min=0, Max= SDVO dependent</td>
34257	<td valign="top" >Connector</td>
34258	<td valign="top" >TBD</td>
34259	</tr>
34260	<tr>
34261	<td valign="top" >"bottom_margin"</td>
34262	<td valign="top" >RANGE</td>
34263	<td valign="top" >Min=0, Max= SDVO dependent</td>
34264	<td valign="top" >Connector</td>
34265	<td valign="top" >TBD</td>
34266	</tr>
34267	<tr>
34268	<td valign="top" >“hpos”</td>
34269	<td valign="top" >RANGE</td>
34270	<td valign="top" >Min=0, Max= SDVO dependent</td>
34271	<td valign="top" >Connector</td>
34272	<td valign="top" >TBD</td>
34273	</tr>
34274	<tr>
34275	<td valign="top" >“vpos”</td>
34276	<td valign="top" >RANGE</td>
34277	<td valign="top" >Min=0, Max= SDVO dependent</td>
34278	<td valign="top" >Connector</td>
34279	<td valign="top" >TBD</td>
34280	</tr>
34281	<tr>
34282	<td valign="top" >“contrast”</td>
34283	<td valign="top" >RANGE</td>
34284	<td valign="top" >Min=0, Max= SDVO dependent</td>
34285	<td valign="top" >Connector</td>
34286	<td valign="top" >TBD</td>
34287	</tr>
34288	<tr>
34289	<td valign="top" >“saturation”</td>
34290	<td valign="top" >RANGE</td>
34291	<td valign="top" >Min=0, Max= SDVO dependent</td>
34292	<td valign="top" >Connector</td>
34293	<td valign="top" >TBD</td>
34294	</tr>
34295	<tr>
34296	<td valign="top" >“hue”</td>
34297	<td valign="top" >RANGE</td>
34298	<td valign="top" >Min=0, Max= SDVO dependent</td>
34299	<td valign="top" >Connector</td>
34300	<td valign="top" >TBD</td>
34301	</tr>
34302	<tr>
34303	<td valign="top" >“sharpness”</td>
34304	<td valign="top" >RANGE</td>
34305	<td valign="top" >Min=0, Max= SDVO dependent</td>
34306	<td valign="top" >Connector</td>
34307	<td valign="top" >TBD</td>
34308	</tr>
34309	<tr>
34310	<td valign="top" >“flicker_filter”</td>
34311	<td valign="top" >RANGE</td>
34312	<td valign="top" >Min=0, Max= SDVO dependent</td>
34313	<td valign="top" >Connector</td>
34314	<td valign="top" >TBD</td>
34315	</tr>
34316	<tr>
34317	<td valign="top" >“flicker_filter_adaptive”</td>
34318	<td valign="top" >RANGE</td>
34319	<td valign="top" >Min=0, Max= SDVO dependent</td>
34320	<td valign="top" >Connector</td>
34321	<td valign="top" >TBD</td>
34322	</tr>
34323	<tr>
34324	<td valign="top" >“flicker_filter_2d”</td>
34325	<td valign="top" >RANGE</td>
34326	<td valign="top" >Min=0, Max= SDVO dependent</td>
34327	<td valign="top" >Connector</td>
34328	<td valign="top" >TBD</td>
34329	</tr>
34330	<tr>
34331	<td valign="top" >“tv_chroma_filter”</td>
34332	<td valign="top" >RANGE</td>
34333	<td valign="top" >Min=0, Max= SDVO dependent</td>
34334	<td valign="top" >Connector</td>
34335	<td valign="top" >TBD</td>
34336	</tr>
34337	<tr>
34338	<td valign="top" >“tv_luma_filter”</td>
34339	<td valign="top" >RANGE</td>
34340	<td valign="top" >Min=0, Max= SDVO dependent</td>
34341	<td valign="top" >Connector</td>
34342	<td valign="top" >TBD</td>
34343	</tr>
34344	<tr>
34345	<td valign="top" >“dot_crawl”</td>
34346	<td valign="top" >RANGE</td>
34347	<td valign="top" >Min=0, Max=1</td>
34348	<td valign="top" >Connector</td>
34349	<td valign="top" >TBD</td>
34350	</tr>
34351	<tr>
34352	<td valign="top" >SDVO-TV/LVDS</td>
34353	<td valign="top" >“brightness”</td>
34354	<td valign="top" >RANGE</td>
34355	<td valign="top" >Min=0, Max= SDVO dependent</td>
34356	<td valign="top" >Connector</td>
34357	<td valign="top" >TBD</td>
34358	</tr>
34359	<tr>
34360	<td rowspan="11" valign="top" >armada</td>
34361	<td rowspan="2" valign="top" >CRTC</td>
34362	<td valign="top" >"CSC_YUV"</td>
34363	<td valign="top" >ENUM</td>
34364	<td valign="top" >{ "Auto" , "CCIR601", "CCIR709" }</td>
34365	<td valign="top" >CRTC</td>
34366	<td valign="top" >TBD</td>
34367	</tr>
34368	<tr>
34369	<td valign="top" >"CSC_RGB"</td>
34370	<td valign="top" >ENUM</td>
34371	<td valign="top" >{ "Auto", "Computer system", "Studio" }</td>
34372	<td valign="top" >CRTC</td>
34373	<td valign="top" >TBD</td>
34374	</tr>
34375	<tr>
34376	<td rowspan="9" valign="top" >Overlay</td>
34377	<td valign="top" >"colorkey"</td>
34378	<td valign="top" >RANGE</td>
34379	<td valign="top" >Min=0, Max=0xffffff</td>
34380	<td valign="top" >Plane</td>
34381	<td valign="top" >TBD</td>
34382	</tr>
34383	<tr>
34384	<td valign="top" >"colorkey_min"</td>
34385	<td valign="top" >RANGE</td>
34386	<td valign="top" >Min=0, Max=0xffffff</td>
34387	<td valign="top" >Plane</td>
34388	<td valign="top" >TBD</td>
34389	</tr>
34390	<tr>
34391	<td valign="top" >"colorkey_max"</td>
34392	<td valign="top" >RANGE</td>
34393	<td valign="top" >Min=0, Max=0xffffff</td>
34394	<td valign="top" >Plane</td>
34395	<td valign="top" >TBD</td>
34396	</tr>
34397	<tr>
34398	<td valign="top" >"colorkey_val"</td>
34399	<td valign="top" >RANGE</td>
34400	<td valign="top" >Min=0, Max=0xffffff</td>
34401	<td valign="top" >Plane</td>
34402	<td valign="top" >TBD</td>
34403	</tr>
34404	<tr>
34405	<td valign="top" >"colorkey_alpha"</td>
34406	<td valign="top" >RANGE</td>
34407	<td valign="top" >Min=0, Max=0xffffff</td>
34408	<td valign="top" >Plane</td>
34409	<td valign="top" >TBD</td>
34410	</tr>
34411	<tr>
34412	<td valign="top" >"colorkey_mode"</td>
34413	<td valign="top" >ENUM</td>
34414	<td valign="top" >{ "disabled", "Y component", "U component"
34415	, "V component", "RGB", “R component", "G component", "B component" }</td>
34416	<td valign="top" >Plane</td>
34417	<td valign="top" >TBD</td>
34418	</tr>
34419	<tr>
34420	<td valign="top" >"brightness"</td>
34421	<td valign="top" >RANGE</td>
34422	<td valign="top" >Min=0, Max=256 + 255</td>
34423	<td valign="top" >Plane</td>
34424	<td valign="top" >TBD</td>
34425	</tr>
34426	<tr>
34427	<td valign="top" >"contrast"</td>
34428	<td valign="top" >RANGE</td>
34429	<td valign="top" >Min=0, Max=0x7fff</td>
34430	<td valign="top" >Plane</td>
34431	<td valign="top" >TBD</td>
34432	</tr>
34433	<tr>
34434	<td valign="top" >"saturation"</td>
34435	<td valign="top" >RANGE</td>
34436	<td valign="top" >Min=0, Max=0x7fff</td>
34437	<td valign="top" >Plane</td>
34438	<td valign="top" >TBD</td>
34439	</tr>
34440	<tr>
34441	<td rowspan="2" valign="top" >exynos</td>
34442	<td valign="top" >CRTC</td>
34443	<td valign="top" >“mode”</td>
34444	<td valign="top" >ENUM</td>
34445	<td valign="top" >{ "normal", "blank" }</td>
34446	<td valign="top" >CRTC</td>
34447	<td valign="top" >TBD</td>
34448	</tr>
34449	<tr>
34450	<td valign="top" >Overlay</td>
34451	<td valign="top" >“zpos”</td>
34452	<td valign="top" >RANGE</td>
34453	<td valign="top" >Min=0, Max=MAX_PLANE-1</td>
34454	<td valign="top" >Plane</td>
34455	<td valign="top" >TBD</td>
34456	</tr>
34457	<tr>
34458	<td rowspan="2" valign="top" >i2c/ch7006_drv</td>
34459	<td valign="top" >Generic</td>
34460	<td valign="top" >“scale”</td>
34461	<td valign="top" >RANGE</td>
34462	<td valign="top" >Min=0, Max=2</td>
34463	<td valign="top" >Connector</td>
34464	<td valign="top" >TBD</td>
34465	</tr>
34466	<tr>
34467	<td rowspan="1" valign="top" >TV</td>
34468	<td valign="top" >“mode”</td>
34469	<td valign="top" >ENUM</td>
34470	<td valign="top" >{ "PAL", "PAL-M","PAL-N"}, ”PAL-Nc"
34471	, "PAL-60", "NTSC-M", "NTSC-J" }</td>
34472	<td valign="top" >Connector</td>
34473	<td valign="top" >TBD</td>
34474	</tr>
34475	<tr>
34476	<td rowspan="15" valign="top" >nouveau</td>
34477	<td rowspan="6" valign="top" >NV10 Overlay</td>
34478	<td valign="top" >"colorkey"</td>
34479	<td valign="top" >RANGE</td>
34480	<td valign="top" >Min=0, Max=0x01ffffff</td>
34481	<td valign="top" >Plane</td>
34482	<td valign="top" >TBD</td>
34483	</tr>
34484	<tr>
34485	<td valign="top" >“contrast”</td>
34486	<td valign="top" >RANGE</td>
34487	<td valign="top" >Min=0, Max=8192-1</td>
34488	<td valign="top" >Plane</td>
34489	<td valign="top" >TBD</td>
34490	</tr>
34491	<tr>
34492	<td valign="top" >“brightness”</td>
34493	<td valign="top" >RANGE</td>
34494	<td valign="top" >Min=0, Max=1024</td>
34495	<td valign="top" >Plane</td>
34496	<td valign="top" >TBD</td>
34497	</tr>
34498	<tr>
34499	<td valign="top" >“hue”</td>
34500	<td valign="top" >RANGE</td>
34501	<td valign="top" >Min=0, Max=359</td>
34502	<td valign="top" >Plane</td>
34503	<td valign="top" >TBD</td>
34504	</tr>
34505	<tr>
34506	<td valign="top" >“saturation”</td>
34507	<td valign="top" >RANGE</td>
34508	<td valign="top" >Min=0, Max=8192-1</td>
34509	<td valign="top" >Plane</td>
34510	<td valign="top" >TBD</td>
34511	</tr>
34512	<tr>
34513	<td valign="top" >“iturbt_709”</td>
34514	<td valign="top" >RANGE</td>
34515	<td valign="top" >Min=0, Max=1</td>
34516	<td valign="top" >Plane</td>
34517	<td valign="top" >TBD</td>
34518	</tr>
34519	<tr>
34520	<td rowspan="2" valign="top" >Nv04 Overlay</td>
34521	<td valign="top" >“colorkey”</td>
34522	<td valign="top" >RANGE</td>
34523	<td valign="top" >Min=0, Max=0x01ffffff</td>
34524	<td valign="top" >Plane</td>
34525	<td valign="top" >TBD</td>
34526	</tr>
34527	<tr>
34528	<td valign="top" >“brightness”</td>
34529	<td valign="top" >RANGE</td>
34530	<td valign="top" >Min=0, Max=1024</td>
34531	<td valign="top" >Plane</td>
34532	<td valign="top" >TBD</td>
34533	</tr>
34534	<tr>
34535	<td rowspan="7" valign="top" >Display</td>
34536	<td valign="top" >“dithering mode”</td>
34537	<td valign="top" >ENUM</td>
34538	<td valign="top" >{ "auto", "off", "on" }</td>
34539	<td valign="top" >Connector</td>
34540	<td valign="top" >TBD</td>
34541	</tr>
34542	<tr>
34543	<td valign="top" >“dithering depth”</td>
34544	<td valign="top" >ENUM</td>
34545	<td valign="top" >{ "auto", "off", "on", "static 2x2", "dynamic 2x2", "temporal" }</td>
34546	<td valign="top" >Connector</td>
34547	<td valign="top" >TBD</td>
34548	</tr>
34549	<tr>
34550	<td valign="top" >“underscan”</td>
34551	<td valign="top" >ENUM</td>
34552	<td valign="top" >{ "auto", "6 bpc", "8 bpc" }</td>
34553	<td valign="top" >Connector</td>
34554	<td valign="top" >TBD</td>
34555	</tr>
34556	<tr>
34557	<td valign="top" >“underscan hborder”</td>
34558	<td valign="top" >RANGE</td>
34559	<td valign="top" >Min=0, Max=128</td>
34560	<td valign="top" >Connector</td>
34561	<td valign="top" >TBD</td>
34562	</tr>
34563	<tr>
34564	<td valign="top" >“underscan vborder”</td>
34565	<td valign="top" >RANGE</td>
34566	<td valign="top" >Min=0, Max=128</td>
34567	<td valign="top" >Connector</td>
34568	<td valign="top" >TBD</td>
34569	</tr>
34570	<tr>
34571	<td valign="top" >“vibrant hue”</td>
34572	<td valign="top" >RANGE</td>
34573	<td valign="top" >Min=0, Max=180</td>
34574	<td valign="top" >Connector</td>
34575	<td valign="top" >TBD</td>
34576	</tr>
34577	<tr>
34578	<td valign="top" >“color vibrance”</td>
34579	<td valign="top" >RANGE</td>
34580	<td valign="top" >Min=0, Max=200</td>
34581	<td valign="top" >Connector</td>
34582	<td valign="top" >TBD</td>
34583	</tr>
34584	<tr>
34585	<td valign="top" >omap</td>
34586	<td valign="top" >Generic</td>
34587	<td valign="top" >“zorder”</td>
34588	<td valign="top" >RANGE</td>
34589	<td valign="top" >Min=0, Max=3</td>
34590	<td valign="top" >CRTC, Plane</td>
34591	<td valign="top" >TBD</td>
34592	</tr>
34593	<tr>
34594	<td valign="top" >qxl</td>
34595	<td valign="top" >Generic</td>
34596	<td valign="top" >“hotplug_mode_update"</td>
34597	<td valign="top" >RANGE</td>
34598	<td valign="top" >Min=0, Max=1</td>
34599	<td valign="top" >Connector</td>
34600	<td valign="top" >TBD</td>
34601	</tr>
34602	<tr>
34603	<td rowspan="9" valign="top" >radeon</td>
34604	<td valign="top" >DVI-I</td>
34605	<td valign="top" >“coherent”</td>
34606	<td valign="top" >RANGE</td>
34607	<td valign="top" >Min=0, Max=1</td>
34608	<td valign="top" >Connector</td>
34609	<td valign="top" >TBD</td>
34610	</tr>
34611	<tr>
34612	<td valign="top" >DAC enable load detect</td>
34613	<td valign="top" >“load detection”</td>
34614	<td valign="top" >RANGE</td>
34615	<td valign="top" >Min=0, Max=1</td>
34616	<td valign="top" >Connector</td>
34617	<td valign="top" >TBD</td>
34618	</tr>
34619	<tr>
34620	<td valign="top" >TV Standard</td>
34621	<td valign="top" >"tv standard"</td>
34622	<td valign="top" >ENUM</td>
34623	<td valign="top" >{ "ntsc", "pal", "pal-m", "pal-60", "ntsc-j"
34624	, "scart-pal", "pal-cn", "secam" }</td>
34625	<td valign="top" >Connector</td>
34626	<td valign="top" >TBD</td>
34627	</tr>
34628	<tr>
34629	<td valign="top" >legacy TMDS PLL detect</td>
34630	<td valign="top" >"tmds_pll"</td>
34631	<td valign="top" >ENUM</td>
34632	<td valign="top" >{ "driver", "bios" }</td>
34633	<td valign="top" >-</td>
34634	<td valign="top" >TBD</td>
34635	</tr>
34636	<tr>
34637	<td rowspan="3" valign="top" >Underscan</td>
34638	<td valign="top" >"underscan"</td>
34639	<td valign="top" >ENUM</td>
34640	<td valign="top" >{ "off", "on", "auto" }</td>
34641	<td valign="top" >Connector</td>
34642	<td valign="top" >TBD</td>
34643	</tr>
34644	<tr>
34645	<td valign="top" >"underscan hborder"</td>
34646	<td valign="top" >RANGE</td>
34647	<td valign="top" >Min=0, Max=128</td>
34648	<td valign="top" >Connector</td>
34649	<td valign="top" >TBD</td>
34650	</tr>
34651	<tr>
34652	<td valign="top" >"underscan vborder"</td>
34653	<td valign="top" >RANGE</td>
34654	<td valign="top" >Min=0, Max=128</td>
34655	<td valign="top" >Connector</td>
34656	<td valign="top" >TBD</td>
34657	</tr>
34658	<tr>
34659	<td valign="top" >Audio</td>
34660	<td valign="top" >“audio”</td>
34661	<td valign="top" >ENUM</td>
34662	<td valign="top" >{ "off", "on", "auto" }</td>
34663	<td valign="top" >Connector</td>
34664	<td valign="top" >TBD</td>
34665	</tr>
34666	<tr>
34667	<td valign="top" >FMT Dithering</td>
34668	<td valign="top" >“dither”</td>
34669	<td valign="top" >ENUM</td>
34670	<td valign="top" >{ "off", "on" }</td>
34671	<td valign="top" >Connector</td>
34672	<td valign="top" >TBD</td>
34673	</tr>
34674	<tr>
34675	<td rowspan="3" valign="top" >rcar-du</td>
34676	<td rowspan="3" valign="top" >Generic</td>
34677	<td valign="top" >"alpha"</td>
34678	<td valign="top" >RANGE</td>
34679	<td valign="top" >Min=0, Max=255</td>
34680	<td valign="top" >Plane</td>
34681	<td valign="top" >TBD</td>
34682	</tr>
34683	<tr>
34684	<td valign="top" >"colorkey"</td>
34685	<td valign="top" >RANGE</td>
34686	<td valign="top" >Min=0, Max=0x01ffffff</td>
34687	<td valign="top" >Plane</td>
34688	<td valign="top" >TBD</td>
34689	</tr>
34690	<tr>
34691	<td valign="top" >"zpos"</td>
34692	<td valign="top" >RANGE</td>
34693	<td valign="top" >Min=1, Max=7</td>
34694	<td valign="top" >Plane</td>
34695	<td valign="top" >TBD</td>
34696	</tr>
34697	</tbody>
34698	</table>
34699    </sect2>
34700  </sect1>
34701
34702  <!-- Internals: vertical blanking -->
34703
34704  <sect1 id="drm-vertical-blank">
34705    <title>Vertical Blanking</title>
34706    <para>
34707      Vertical blanking plays a major role in graphics rendering. To achieve
34708      tear-free display, users must synchronize page flips and/or rendering to
34709      vertical blanking. The DRM API offers ioctls to perform page flips
34710      synchronized to vertical blanking and wait for vertical blanking.
34711    </para>
34712    <para>
34713      The DRM core handles most of the vertical blanking management logic, which
34714      involves filtering out spurious interrupts, keeping race-free blanking
34715      counters, coping with counter wrap-around and resets and keeping use
34716      counts. It relies on the driver to generate vertical blanking interrupts
34717      and optionally provide a hardware vertical blanking counter. Drivers must
34718      implement the following operations.
34719    </para>
34720    <itemizedlist>
34721      <listitem>
34722        <synopsis>int (*enable_vblank) (struct drm_device *dev, int crtc);
34723void (*disable_vblank) (struct drm_device *dev, int crtc);</synopsis>
34724        <para>
34725	  Enable or disable vertical blanking interrupts for the given CRTC.
34726	</para>
34727      </listitem>
34728      <listitem>
34729        <synopsis>u32 (*get_vblank_counter) (struct drm_device *dev, int crtc);</synopsis>
34730        <para>
34731	  Retrieve the value of the vertical blanking counter for the given
34732	  CRTC. If the hardware maintains a vertical blanking counter its value
34733	  should be returned. Otherwise drivers can use the
34734	  <function>drm_vblank_count</function> helper function to handle this
34735	  operation.
34736	</para>
34737      </listitem>
34738    </itemizedlist>
34739    <para>
34740      Drivers must initialize the vertical blanking handling core with a call to
34741      <function>drm_vblank_init</function> in their
34742      <methodname>load</methodname> operation. The function will set the struct
34743      <structname>drm_device</structname>
34744      <structfield>vblank_disable_allowed</structfield> field to 0. This will
34745      keep vertical blanking interrupts enabled permanently until the first mode
34746      set operation, where <structfield>vblank_disable_allowed</structfield> is
34747      set to 1. The reason behind this is not clear. Drivers can set the field
34748      to 1 after <function>calling drm_vblank_init</function> to make vertical
34749      blanking interrupts dynamically managed from the beginning.
34750    </para>
34751    <para>
34752      Vertical blanking interrupts can be enabled by the DRM core or by drivers
34753      themselves (for instance to handle page flipping operations). The DRM core
34754      maintains a vertical blanking use count to ensure that the interrupts are
34755      not disabled while a user still needs them. To increment the use count,
34756      drivers call <function>drm_vblank_get</function>. Upon return vertical
34757      blanking interrupts are guaranteed to be enabled.
34758    </para>
34759    <para>
34760      To decrement the use count drivers call
34761      <function>drm_vblank_put</function>. Only when the use count drops to zero
34762      will the DRM core disable the vertical blanking interrupts after a delay
34763      by scheduling a timer. The delay is accessible through the vblankoffdelay
34764      module parameter or the <varname>drm_vblank_offdelay</varname> global
34765      variable and expressed in milliseconds. Its default value is 5000 ms.
34766      Zero means never disable, and a negative value means disable immediately.
34767      Drivers may override the behaviour by setting the
34768      <structname>drm_device</structname>
34769      <structfield>vblank_disable_immediate</structfield> flag, which when set
34770      causes vblank interrupts to be disabled immediately regardless of the
34771      drm_vblank_offdelay value. The flag should only be set if there's a
34772      properly working hardware vblank counter present.
34773    </para>
34774    <para>
34775      When a vertical blanking interrupt occurs drivers only need to call the
34776      <function>drm_handle_vblank</function> function to account for the
34777      interrupt.
34778    </para>
34779    <para>
34780      Resources allocated by <function>drm_vblank_init</function> must be freed
34781      with a call to <function>drm_vblank_cleanup</function> in the driver
34782      <methodname>unload</methodname> operation handler.
34783    </para>
34784    <sect2>
34785      <title>Vertical Blanking and Interrupt Handling Functions Reference</title>
34786<!-- drivers/gpu/drm/drm_irq.c -->
34787<refentry id="API-drm-vblank-cleanup">
34788<refentryinfo>
34789 <title>LINUX</title>
34790 <productname>Kernel Hackers Manual</productname>
34791 <date>July 2017</date>
34792</refentryinfo>
34793<refmeta>
34794 <refentrytitle><phrase>drm_vblank_cleanup</phrase></refentrytitle>
34795 <manvolnum>9</manvolnum>
34796 <refmiscinfo class="version">4.4.14</refmiscinfo>
34797</refmeta>
34798<refnamediv>
34799 <refname>drm_vblank_cleanup</refname>
34800 <refpurpose>
34801  cleanup vblank support
34802 </refpurpose>
34803</refnamediv>
34804<refsynopsisdiv>
34805 <title>Synopsis</title>
34806  <funcsynopsis><funcprototype>
34807   <funcdef>void <function>drm_vblank_cleanup </function></funcdef>
34808   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
34809  </funcprototype></funcsynopsis>
34810</refsynopsisdiv>
34811<refsect1>
34812 <title>Arguments</title>
34813 <variablelist>
34814  <varlistentry>
34815   <term><parameter>dev</parameter></term>
34816   <listitem>
34817    <para>
34818     DRM device
34819    </para>
34820   </listitem>
34821  </varlistentry>
34822 </variablelist>
34823</refsect1>
34824<refsect1>
34825<title>Description</title>
34826<para>
34827   This function cleans up any resources allocated in drm_vblank_init.
34828</para>
34829</refsect1>
34830</refentry>
34831
34832<refentry id="API-drm-vblank-init">
34833<refentryinfo>
34834 <title>LINUX</title>
34835 <productname>Kernel Hackers Manual</productname>
34836 <date>July 2017</date>
34837</refentryinfo>
34838<refmeta>
34839 <refentrytitle><phrase>drm_vblank_init</phrase></refentrytitle>
34840 <manvolnum>9</manvolnum>
34841 <refmiscinfo class="version">4.4.14</refmiscinfo>
34842</refmeta>
34843<refnamediv>
34844 <refname>drm_vblank_init</refname>
34845 <refpurpose>
34846     initialize vblank support
34847 </refpurpose>
34848</refnamediv>
34849<refsynopsisdiv>
34850 <title>Synopsis</title>
34851  <funcsynopsis><funcprototype>
34852   <funcdef>int <function>drm_vblank_init </function></funcdef>
34853   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
34854   <paramdef>unsigned int <parameter>num_crtcs</parameter></paramdef>
34855  </funcprototype></funcsynopsis>
34856</refsynopsisdiv>
34857<refsect1>
34858 <title>Arguments</title>
34859 <variablelist>
34860  <varlistentry>
34861   <term><parameter>dev</parameter></term>
34862   <listitem>
34863    <para>
34864     DRM device
34865    </para>
34866   </listitem>
34867  </varlistentry>
34868  <varlistentry>
34869   <term><parameter>num_crtcs</parameter></term>
34870   <listitem>
34871    <para>
34872     number of CRTCs supported by <parameter>dev</parameter>
34873    </para>
34874   </listitem>
34875  </varlistentry>
34876 </variablelist>
34877</refsect1>
34878<refsect1>
34879<title>Description</title>
34880<para>
34881   This function initializes vblank support for <parameter>num_crtcs</parameter> display pipelines.
34882</para>
34883</refsect1>
34884<refsect1>
34885<title>Returns</title>
34886<para>
34887   Zero on success or a negative error code on failure.
34888</para>
34889</refsect1>
34890</refentry>
34891
34892<refentry id="API-drm-irq-install">
34893<refentryinfo>
34894 <title>LINUX</title>
34895 <productname>Kernel Hackers Manual</productname>
34896 <date>July 2017</date>
34897</refentryinfo>
34898<refmeta>
34899 <refentrytitle><phrase>drm_irq_install</phrase></refentrytitle>
34900 <manvolnum>9</manvolnum>
34901 <refmiscinfo class="version">4.4.14</refmiscinfo>
34902</refmeta>
34903<refnamediv>
34904 <refname>drm_irq_install</refname>
34905 <refpurpose>
34906     install IRQ handler
34907 </refpurpose>
34908</refnamediv>
34909<refsynopsisdiv>
34910 <title>Synopsis</title>
34911  <funcsynopsis><funcprototype>
34912   <funcdef>int <function>drm_irq_install </function></funcdef>
34913   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
34914   <paramdef>int <parameter>irq</parameter></paramdef>
34915  </funcprototype></funcsynopsis>
34916</refsynopsisdiv>
34917<refsect1>
34918 <title>Arguments</title>
34919 <variablelist>
34920  <varlistentry>
34921   <term><parameter>dev</parameter></term>
34922   <listitem>
34923    <para>
34924     DRM device
34925    </para>
34926   </listitem>
34927  </varlistentry>
34928  <varlistentry>
34929   <term><parameter>irq</parameter></term>
34930   <listitem>
34931    <para>
34932     IRQ number to install the handler for
34933    </para>
34934   </listitem>
34935  </varlistentry>
34936 </variablelist>
34937</refsect1>
34938<refsect1>
34939<title>Description</title>
34940<para>
34941   Initializes the IRQ related data. Installs the handler, calling the driver
34942   <function>irq_preinstall</function> and <function>irq_postinstall</function> functions before and after the
34943   installation.
34944   </para><para>
34945
34946   This is the simplified helper interface provided for drivers with no special
34947   needs. Drivers which need to install interrupt handlers for multiple
34948   interrupts must instead set drm_device-&gt;irq_enabled to signal the DRM core
34949   that vblank interrupts are available.
34950</para>
34951</refsect1>
34952<refsect1>
34953<title>Returns</title>
34954<para>
34955   Zero on success or a negative error code on failure.
34956</para>
34957</refsect1>
34958</refentry>
34959
34960<refentry id="API-drm-irq-uninstall">
34961<refentryinfo>
34962 <title>LINUX</title>
34963 <productname>Kernel Hackers Manual</productname>
34964 <date>July 2017</date>
34965</refentryinfo>
34966<refmeta>
34967 <refentrytitle><phrase>drm_irq_uninstall</phrase></refentrytitle>
34968 <manvolnum>9</manvolnum>
34969 <refmiscinfo class="version">4.4.14</refmiscinfo>
34970</refmeta>
34971<refnamediv>
34972 <refname>drm_irq_uninstall</refname>
34973 <refpurpose>
34974     uninstall the IRQ handler
34975 </refpurpose>
34976</refnamediv>
34977<refsynopsisdiv>
34978 <title>Synopsis</title>
34979  <funcsynopsis><funcprototype>
34980   <funcdef>int <function>drm_irq_uninstall </function></funcdef>
34981   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
34982  </funcprototype></funcsynopsis>
34983</refsynopsisdiv>
34984<refsect1>
34985 <title>Arguments</title>
34986 <variablelist>
34987  <varlistentry>
34988   <term><parameter>dev</parameter></term>
34989   <listitem>
34990    <para>
34991     DRM device
34992    </para>
34993   </listitem>
34994  </varlistentry>
34995 </variablelist>
34996</refsect1>
34997<refsect1>
34998<title>Description</title>
34999<para>
35000   Calls the driver's <function>irq_uninstall</function> function and unregisters the IRQ handler.
35001   This should only be called by drivers which used <function>drm_irq_install</function> to set up
35002   their interrupt handler. Other drivers must only reset
35003   drm_device-&gt;irq_enabled to false.
35004   </para><para>
35005
35006   Note that for kernel modesetting drivers it is a bug if this function fails.
35007   The sanity checks are only to catch buggy user modesetting drivers which call
35008   the same function through an ioctl.
35009</para>
35010</refsect1>
35011<refsect1>
35012<title>Returns</title>
35013<para>
35014   Zero on success or a negative error code on failure.
35015</para>
35016</refsect1>
35017</refentry>
35018
35019<refentry id="API-drm-calc-timestamping-constants">
35020<refentryinfo>
35021 <title>LINUX</title>
35022 <productname>Kernel Hackers Manual</productname>
35023 <date>July 2017</date>
35024</refentryinfo>
35025<refmeta>
35026 <refentrytitle><phrase>drm_calc_timestamping_constants</phrase></refentrytitle>
35027 <manvolnum>9</manvolnum>
35028 <refmiscinfo class="version">4.4.14</refmiscinfo>
35029</refmeta>
35030<refnamediv>
35031 <refname>drm_calc_timestamping_constants</refname>
35032 <refpurpose>
35033     calculate vblank timestamp constants
35034 </refpurpose>
35035</refnamediv>
35036<refsynopsisdiv>
35037 <title>Synopsis</title>
35038  <funcsynopsis><funcprototype>
35039   <funcdef>void <function>drm_calc_timestamping_constants </function></funcdef>
35040   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
35041   <paramdef>const struct drm_display_mode * <parameter>mode</parameter></paramdef>
35042  </funcprototype></funcsynopsis>
35043</refsynopsisdiv>
35044<refsect1>
35045 <title>Arguments</title>
35046 <variablelist>
35047  <varlistentry>
35048   <term><parameter>crtc</parameter></term>
35049   <listitem>
35050    <para>
35051     drm_crtc whose timestamp constants should be updated.
35052    </para>
35053   </listitem>
35054  </varlistentry>
35055  <varlistentry>
35056   <term><parameter>mode</parameter></term>
35057   <listitem>
35058    <para>
35059     display mode containing the scanout timings
35060    </para>
35061   </listitem>
35062  </varlistentry>
35063 </variablelist>
35064</refsect1>
35065<refsect1>
35066<title>Description</title>
35067<para>
35068   Calculate and store various constants which are later
35069   needed by vblank and swap-completion timestamping, e.g,
35070   by <function>drm_calc_vbltimestamp_from_scanoutpos</function>. They are
35071   derived from CRTC's true scanout timing, so they take
35072   things like panel scaling or other adjustments into account.
35073</para>
35074</refsect1>
35075</refentry>
35076
35077<refentry id="API-drm-calc-vbltimestamp-from-scanoutpos">
35078<refentryinfo>
35079 <title>LINUX</title>
35080 <productname>Kernel Hackers Manual</productname>
35081 <date>July 2017</date>
35082</refentryinfo>
35083<refmeta>
35084 <refentrytitle><phrase>drm_calc_vbltimestamp_from_scanoutpos</phrase></refentrytitle>
35085 <manvolnum>9</manvolnum>
35086 <refmiscinfo class="version">4.4.14</refmiscinfo>
35087</refmeta>
35088<refnamediv>
35089 <refname>drm_calc_vbltimestamp_from_scanoutpos</refname>
35090 <refpurpose>
35091     precise vblank timestamp helper
35092 </refpurpose>
35093</refnamediv>
35094<refsynopsisdiv>
35095 <title>Synopsis</title>
35096  <funcsynopsis><funcprototype>
35097   <funcdef>int <function>drm_calc_vbltimestamp_from_scanoutpos </function></funcdef>
35098   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
35099   <paramdef>unsigned int <parameter>pipe</parameter></paramdef>
35100   <paramdef>int * <parameter>max_error</parameter></paramdef>
35101   <paramdef>struct timeval * <parameter>vblank_time</parameter></paramdef>
35102   <paramdef>unsigned <parameter>flags</parameter></paramdef>
35103   <paramdef>const struct drm_display_mode * <parameter>mode</parameter></paramdef>
35104  </funcprototype></funcsynopsis>
35105</refsynopsisdiv>
35106<refsect1>
35107 <title>Arguments</title>
35108 <variablelist>
35109  <varlistentry>
35110   <term><parameter>dev</parameter></term>
35111   <listitem>
35112    <para>
35113     DRM device
35114    </para>
35115   </listitem>
35116  </varlistentry>
35117  <varlistentry>
35118   <term><parameter>pipe</parameter></term>
35119   <listitem>
35120    <para>
35121     index of CRTC whose vblank timestamp to retrieve
35122    </para>
35123   </listitem>
35124  </varlistentry>
35125  <varlistentry>
35126   <term><parameter>max_error</parameter></term>
35127   <listitem>
35128    <para>
35129     Desired maximum allowable error in timestamps (nanosecs)
35130     On return contains true maximum error of timestamp
35131    </para>
35132   </listitem>
35133  </varlistentry>
35134  <varlistentry>
35135   <term><parameter>vblank_time</parameter></term>
35136   <listitem>
35137    <para>
35138     Pointer to struct timeval which should receive the timestamp
35139    </para>
35140   </listitem>
35141  </varlistentry>
35142  <varlistentry>
35143   <term><parameter>flags</parameter></term>
35144   <listitem>
35145    <para>
35146     Flags to pass to driver:
35147     0 = Default,
35148     DRM_CALLED_FROM_VBLIRQ = If function is called from vbl IRQ handler
35149    </para>
35150   </listitem>
35151  </varlistentry>
35152  <varlistentry>
35153   <term><parameter>mode</parameter></term>
35154   <listitem>
35155    <para>
35156     mode which defines the scanout timings
35157    </para>
35158   </listitem>
35159  </varlistentry>
35160 </variablelist>
35161</refsect1>
35162<refsect1>
35163<title>Description</title>
35164<para>
35165   Implements calculation of exact vblank timestamps from given drm_display_mode
35166   timings and current video scanout position of a CRTC. This can be called from
35167   within <function>get_vblank_timestamp</function> implementation of a kms driver to implement the
35168   actual timestamping.
35169   </para><para>
35170
35171   Should return timestamps conforming to the OML_sync_control OpenML
35172   extension specification. The timestamp corresponds to the end of
35173   the vblank interval, aka start of scanout of topmost-leftmost display
35174   pixel in the following video frame.
35175   </para><para>
35176
35177   Requires support for optional dev-&gt;driver-&gt;<function>get_scanout_position</function>
35178   in kms driver, plus a bit of setup code to provide a drm_display_mode
35179   that corresponds to the true scanout timing.
35180   </para><para>
35181
35182   The current implementation only handles standard video modes. It
35183   returns as no operation if a doublescan or interlaced video mode is
35184   active. Higher level code is expected to handle this.
35185</para>
35186</refsect1>
35187<refsect1>
35188<title>Returns</title>
35189<para>
35190   Negative value on error, failure or if not supported in current
35191</para>
35192</refsect1>
35193<refsect1>
35194<title>video mode</title>
35195<para>
35196   </para><para>
35197
35198   -EINVAL   - Invalid CRTC.
35199   -EAGAIN   - Temporary unavailable, e.g., called before initial modeset.
35200   -ENOTSUPP - Function not supported in current display mode.
35201   -EIO      - Failed, e.g., due to failed scanout position query.
35202   </para><para>
35203
35204   Returns or'ed positive status flags on success:
35205   </para><para>
35206
35207   DRM_VBLANKTIME_SCANOUTPOS_METHOD - Signal this method used for timestamping.
35208   DRM_VBLANKTIME_INVBL - Timestamp taken while scanout was in vblank interval.
35209</para>
35210</refsect1>
35211</refentry>
35212
35213<refentry id="API-drm-vblank-count">
35214<refentryinfo>
35215 <title>LINUX</title>
35216 <productname>Kernel Hackers Manual</productname>
35217 <date>July 2017</date>
35218</refentryinfo>
35219<refmeta>
35220 <refentrytitle><phrase>drm_vblank_count</phrase></refentrytitle>
35221 <manvolnum>9</manvolnum>
35222 <refmiscinfo class="version">4.4.14</refmiscinfo>
35223</refmeta>
35224<refnamediv>
35225 <refname>drm_vblank_count</refname>
35226 <refpurpose>
35227     retrieve <quote>cooked</quote> vblank counter value
35228 </refpurpose>
35229</refnamediv>
35230<refsynopsisdiv>
35231 <title>Synopsis</title>
35232  <funcsynopsis><funcprototype>
35233   <funcdef>u32 <function>drm_vblank_count </function></funcdef>
35234   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
35235   <paramdef>unsigned int <parameter>pipe</parameter></paramdef>
35236  </funcprototype></funcsynopsis>
35237</refsynopsisdiv>
35238<refsect1>
35239 <title>Arguments</title>
35240 <variablelist>
35241  <varlistentry>
35242   <term><parameter>dev</parameter></term>
35243   <listitem>
35244    <para>
35245     DRM device
35246    </para>
35247   </listitem>
35248  </varlistentry>
35249  <varlistentry>
35250   <term><parameter>pipe</parameter></term>
35251   <listitem>
35252    <para>
35253     index of CRTC for which to retrieve the counter
35254    </para>
35255   </listitem>
35256  </varlistentry>
35257 </variablelist>
35258</refsect1>
35259<refsect1>
35260<title>Description</title>
35261<para>
35262   Fetches the <quote>cooked</quote> vblank count value that represents the number of
35263   vblank events since the system was booted, including lost events due to
35264   modesetting activity.
35265   </para><para>
35266
35267   This is the legacy version of <function>drm_crtc_vblank_count</function>.
35268</para>
35269</refsect1>
35270<refsect1>
35271<title>Returns</title>
35272<para>
35273   The software vblank counter.
35274</para>
35275</refsect1>
35276</refentry>
35277
35278<refentry id="API-drm-crtc-vblank-count">
35279<refentryinfo>
35280 <title>LINUX</title>
35281 <productname>Kernel Hackers Manual</productname>
35282 <date>July 2017</date>
35283</refentryinfo>
35284<refmeta>
35285 <refentrytitle><phrase>drm_crtc_vblank_count</phrase></refentrytitle>
35286 <manvolnum>9</manvolnum>
35287 <refmiscinfo class="version">4.4.14</refmiscinfo>
35288</refmeta>
35289<refnamediv>
35290 <refname>drm_crtc_vblank_count</refname>
35291 <refpurpose>
35292     retrieve <quote>cooked</quote> vblank counter value
35293 </refpurpose>
35294</refnamediv>
35295<refsynopsisdiv>
35296 <title>Synopsis</title>
35297  <funcsynopsis><funcprototype>
35298   <funcdef>u32 <function>drm_crtc_vblank_count </function></funcdef>
35299   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
35300  </funcprototype></funcsynopsis>
35301</refsynopsisdiv>
35302<refsect1>
35303 <title>Arguments</title>
35304 <variablelist>
35305  <varlistentry>
35306   <term><parameter>crtc</parameter></term>
35307   <listitem>
35308    <para>
35309     which counter to retrieve
35310    </para>
35311   </listitem>
35312  </varlistentry>
35313 </variablelist>
35314</refsect1>
35315<refsect1>
35316<title>Description</title>
35317<para>
35318   Fetches the <quote>cooked</quote> vblank count value that represents the number of
35319   vblank events since the system was booted, including lost events due to
35320   modesetting activity.
35321   </para><para>
35322
35323   This is the native KMS version of <function>drm_vblank_count</function>.
35324</para>
35325</refsect1>
35326<refsect1>
35327<title>Returns</title>
35328<para>
35329   The software vblank counter.
35330</para>
35331</refsect1>
35332</refentry>
35333
35334<refentry id="API-drm-vblank-count-and-time">
35335<refentryinfo>
35336 <title>LINUX</title>
35337 <productname>Kernel Hackers Manual</productname>
35338 <date>July 2017</date>
35339</refentryinfo>
35340<refmeta>
35341 <refentrytitle><phrase>drm_vblank_count_and_time</phrase></refentrytitle>
35342 <manvolnum>9</manvolnum>
35343 <refmiscinfo class="version">4.4.14</refmiscinfo>
35344</refmeta>
35345<refnamediv>
35346 <refname>drm_vblank_count_and_time</refname>
35347 <refpurpose>
35348     retrieve <quote>cooked</quote> vblank counter value and the system timestamp corresponding to that vblank counter value.
35349 </refpurpose>
35350</refnamediv>
35351<refsynopsisdiv>
35352 <title>Synopsis</title>
35353  <funcsynopsis><funcprototype>
35354   <funcdef>u32 <function>drm_vblank_count_and_time </function></funcdef>
35355   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
35356   <paramdef>unsigned int <parameter>pipe</parameter></paramdef>
35357   <paramdef>struct timeval * <parameter>vblanktime</parameter></paramdef>
35358  </funcprototype></funcsynopsis>
35359</refsynopsisdiv>
35360<refsect1>
35361 <title>Arguments</title>
35362 <variablelist>
35363  <varlistentry>
35364   <term><parameter>dev</parameter></term>
35365   <listitem>
35366    <para>
35367     DRM device
35368    </para>
35369   </listitem>
35370  </varlistentry>
35371  <varlistentry>
35372   <term><parameter>pipe</parameter></term>
35373   <listitem>
35374    <para>
35375     index of CRTC whose counter to retrieve
35376    </para>
35377   </listitem>
35378  </varlistentry>
35379  <varlistentry>
35380   <term><parameter>vblanktime</parameter></term>
35381   <listitem>
35382    <para>
35383     Pointer to struct timeval to receive the vblank timestamp.
35384    </para>
35385   </listitem>
35386  </varlistentry>
35387 </variablelist>
35388</refsect1>
35389<refsect1>
35390<title>Description</title>
35391<para>
35392   Fetches the <quote>cooked</quote> vblank count value that represents the number of
35393   vblank events since the system was booted, including lost events due to
35394   modesetting activity. Returns corresponding system timestamp of the time
35395   of the vblank interval that corresponds to the current vblank counter value.
35396   </para><para>
35397
35398   This is the legacy version of <function>drm_crtc_vblank_count_and_time</function>.
35399</para>
35400</refsect1>
35401</refentry>
35402
35403<refentry id="API-drm-crtc-vblank-count-and-time">
35404<refentryinfo>
35405 <title>LINUX</title>
35406 <productname>Kernel Hackers Manual</productname>
35407 <date>July 2017</date>
35408</refentryinfo>
35409<refmeta>
35410 <refentrytitle><phrase>drm_crtc_vblank_count_and_time</phrase></refentrytitle>
35411 <manvolnum>9</manvolnum>
35412 <refmiscinfo class="version">4.4.14</refmiscinfo>
35413</refmeta>
35414<refnamediv>
35415 <refname>drm_crtc_vblank_count_and_time</refname>
35416 <refpurpose>
35417     retrieve <quote>cooked</quote> vblank counter value and the system timestamp corresponding to that vblank counter value
35418 </refpurpose>
35419</refnamediv>
35420<refsynopsisdiv>
35421 <title>Synopsis</title>
35422  <funcsynopsis><funcprototype>
35423   <funcdef>u32 <function>drm_crtc_vblank_count_and_time </function></funcdef>
35424   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
35425   <paramdef>struct timeval * <parameter>vblanktime</parameter></paramdef>
35426  </funcprototype></funcsynopsis>
35427</refsynopsisdiv>
35428<refsect1>
35429 <title>Arguments</title>
35430 <variablelist>
35431  <varlistentry>
35432   <term><parameter>crtc</parameter></term>
35433   <listitem>
35434    <para>
35435     which counter to retrieve
35436    </para>
35437   </listitem>
35438  </varlistentry>
35439  <varlistentry>
35440   <term><parameter>vblanktime</parameter></term>
35441   <listitem>
35442    <para>
35443     Pointer to struct timeval to receive the vblank timestamp.
35444    </para>
35445   </listitem>
35446  </varlistentry>
35447 </variablelist>
35448</refsect1>
35449<refsect1>
35450<title>Description</title>
35451<para>
35452   Fetches the <quote>cooked</quote> vblank count value that represents the number of
35453   vblank events since the system was booted, including lost events due to
35454   modesetting activity. Returns corresponding system timestamp of the time
35455   of the vblank interval that corresponds to the current vblank counter value.
35456   </para><para>
35457
35458   This is the native KMS version of <function>drm_vblank_count_and_time</function>.
35459</para>
35460</refsect1>
35461</refentry>
35462
35463<refentry id="API-drm-arm-vblank-event">
35464<refentryinfo>
35465 <title>LINUX</title>
35466 <productname>Kernel Hackers Manual</productname>
35467 <date>July 2017</date>
35468</refentryinfo>
35469<refmeta>
35470 <refentrytitle><phrase>drm_arm_vblank_event</phrase></refentrytitle>
35471 <manvolnum>9</manvolnum>
35472 <refmiscinfo class="version">4.4.14</refmiscinfo>
35473</refmeta>
35474<refnamediv>
35475 <refname>drm_arm_vblank_event</refname>
35476 <refpurpose>
35477     arm vblank event after pageflip
35478 </refpurpose>
35479</refnamediv>
35480<refsynopsisdiv>
35481 <title>Synopsis</title>
35482  <funcsynopsis><funcprototype>
35483   <funcdef>void <function>drm_arm_vblank_event </function></funcdef>
35484   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
35485   <paramdef>unsigned int <parameter>pipe</parameter></paramdef>
35486   <paramdef>struct drm_pending_vblank_event * <parameter>e</parameter></paramdef>
35487  </funcprototype></funcsynopsis>
35488</refsynopsisdiv>
35489<refsect1>
35490 <title>Arguments</title>
35491 <variablelist>
35492  <varlistentry>
35493   <term><parameter>dev</parameter></term>
35494   <listitem>
35495    <para>
35496     DRM device
35497    </para>
35498   </listitem>
35499  </varlistentry>
35500  <varlistentry>
35501   <term><parameter>pipe</parameter></term>
35502   <listitem>
35503    <para>
35504     CRTC index
35505    </para>
35506   </listitem>
35507  </varlistentry>
35508  <varlistentry>
35509   <term><parameter>e</parameter></term>
35510   <listitem>
35511    <para>
35512     the event to prepare to send
35513    </para>
35514   </listitem>
35515  </varlistentry>
35516 </variablelist>
35517</refsect1>
35518<refsect1>
35519<title>Description</title>
35520<para>
35521   A lot of drivers need to generate vblank events for the very next vblank
35522   interrupt. For example when the page flip interrupt happens when the page
35523   flip gets armed, but not when it actually executes within the next vblank
35524   period. This helper function implements exactly the required vblank arming
35525   behaviour.
35526   </para><para>
35527
35528   Caller must hold event lock. Caller must also hold a vblank reference for
35529   the event <parameter>e</parameter>, which will be dropped when the next vblank arrives.
35530   </para><para>
35531
35532   This is the legacy version of <function>drm_crtc_arm_vblank_event</function>.
35533</para>
35534</refsect1>
35535</refentry>
35536
35537<refentry id="API-drm-crtc-arm-vblank-event">
35538<refentryinfo>
35539 <title>LINUX</title>
35540 <productname>Kernel Hackers Manual</productname>
35541 <date>July 2017</date>
35542</refentryinfo>
35543<refmeta>
35544 <refentrytitle><phrase>drm_crtc_arm_vblank_event</phrase></refentrytitle>
35545 <manvolnum>9</manvolnum>
35546 <refmiscinfo class="version">4.4.14</refmiscinfo>
35547</refmeta>
35548<refnamediv>
35549 <refname>drm_crtc_arm_vblank_event</refname>
35550 <refpurpose>
35551     arm vblank event after pageflip
35552 </refpurpose>
35553</refnamediv>
35554<refsynopsisdiv>
35555 <title>Synopsis</title>
35556  <funcsynopsis><funcprototype>
35557   <funcdef>void <function>drm_crtc_arm_vblank_event </function></funcdef>
35558   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
35559   <paramdef>struct drm_pending_vblank_event * <parameter>e</parameter></paramdef>
35560  </funcprototype></funcsynopsis>
35561</refsynopsisdiv>
35562<refsect1>
35563 <title>Arguments</title>
35564 <variablelist>
35565  <varlistentry>
35566   <term><parameter>crtc</parameter></term>
35567   <listitem>
35568    <para>
35569     the source CRTC of the vblank event
35570    </para>
35571   </listitem>
35572  </varlistentry>
35573  <varlistentry>
35574   <term><parameter>e</parameter></term>
35575   <listitem>
35576    <para>
35577     the event to send
35578    </para>
35579   </listitem>
35580  </varlistentry>
35581 </variablelist>
35582</refsect1>
35583<refsect1>
35584<title>Description</title>
35585<para>
35586   A lot of drivers need to generate vblank events for the very next vblank
35587   interrupt. For example when the page flip interrupt happens when the page
35588   flip gets armed, but not when it actually executes within the next vblank
35589   period. This helper function implements exactly the required vblank arming
35590   behaviour.
35591   </para><para>
35592
35593   Caller must hold event lock. Caller must also hold a vblank reference for
35594   the event <parameter>e</parameter>, which will be dropped when the next vblank arrives.
35595   </para><para>
35596
35597   This is the native KMS version of <function>drm_arm_vblank_event</function>.
35598</para>
35599</refsect1>
35600</refentry>
35601
35602<refentry id="API-drm-send-vblank-event">
35603<refentryinfo>
35604 <title>LINUX</title>
35605 <productname>Kernel Hackers Manual</productname>
35606 <date>July 2017</date>
35607</refentryinfo>
35608<refmeta>
35609 <refentrytitle><phrase>drm_send_vblank_event</phrase></refentrytitle>
35610 <manvolnum>9</manvolnum>
35611 <refmiscinfo class="version">4.4.14</refmiscinfo>
35612</refmeta>
35613<refnamediv>
35614 <refname>drm_send_vblank_event</refname>
35615 <refpurpose>
35616     helper to send vblank event after pageflip
35617 </refpurpose>
35618</refnamediv>
35619<refsynopsisdiv>
35620 <title>Synopsis</title>
35621  <funcsynopsis><funcprototype>
35622   <funcdef>void <function>drm_send_vblank_event </function></funcdef>
35623   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
35624   <paramdef>unsigned int <parameter>pipe</parameter></paramdef>
35625   <paramdef>struct drm_pending_vblank_event * <parameter>e</parameter></paramdef>
35626  </funcprototype></funcsynopsis>
35627</refsynopsisdiv>
35628<refsect1>
35629 <title>Arguments</title>
35630 <variablelist>
35631  <varlistentry>
35632   <term><parameter>dev</parameter></term>
35633   <listitem>
35634    <para>
35635     DRM device
35636    </para>
35637   </listitem>
35638  </varlistentry>
35639  <varlistentry>
35640   <term><parameter>pipe</parameter></term>
35641   <listitem>
35642    <para>
35643     CRTC index
35644    </para>
35645   </listitem>
35646  </varlistentry>
35647  <varlistentry>
35648   <term><parameter>e</parameter></term>
35649   <listitem>
35650    <para>
35651     the event to send
35652    </para>
35653   </listitem>
35654  </varlistentry>
35655 </variablelist>
35656</refsect1>
35657<refsect1>
35658<title>Description</title>
35659<para>
35660   Updates sequence # and timestamp on event, and sends it to userspace.
35661   Caller must hold event lock.
35662   </para><para>
35663
35664   This is the legacy version of <function>drm_crtc_send_vblank_event</function>.
35665</para>
35666</refsect1>
35667</refentry>
35668
35669<refentry id="API-drm-crtc-send-vblank-event">
35670<refentryinfo>
35671 <title>LINUX</title>
35672 <productname>Kernel Hackers Manual</productname>
35673 <date>July 2017</date>
35674</refentryinfo>
35675<refmeta>
35676 <refentrytitle><phrase>drm_crtc_send_vblank_event</phrase></refentrytitle>
35677 <manvolnum>9</manvolnum>
35678 <refmiscinfo class="version">4.4.14</refmiscinfo>
35679</refmeta>
35680<refnamediv>
35681 <refname>drm_crtc_send_vblank_event</refname>
35682 <refpurpose>
35683     helper to send vblank event after pageflip
35684 </refpurpose>
35685</refnamediv>
35686<refsynopsisdiv>
35687 <title>Synopsis</title>
35688  <funcsynopsis><funcprototype>
35689   <funcdef>void <function>drm_crtc_send_vblank_event </function></funcdef>
35690   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
35691   <paramdef>struct drm_pending_vblank_event * <parameter>e</parameter></paramdef>
35692  </funcprototype></funcsynopsis>
35693</refsynopsisdiv>
35694<refsect1>
35695 <title>Arguments</title>
35696 <variablelist>
35697  <varlistentry>
35698   <term><parameter>crtc</parameter></term>
35699   <listitem>
35700    <para>
35701     the source CRTC of the vblank event
35702    </para>
35703   </listitem>
35704  </varlistentry>
35705  <varlistentry>
35706   <term><parameter>e</parameter></term>
35707   <listitem>
35708    <para>
35709     the event to send
35710    </para>
35711   </listitem>
35712  </varlistentry>
35713 </variablelist>
35714</refsect1>
35715<refsect1>
35716<title>Description</title>
35717<para>
35718   Updates sequence # and timestamp on event, and sends it to userspace.
35719   Caller must hold event lock.
35720   </para><para>
35721
35722   This is the native KMS version of <function>drm_send_vblank_event</function>.
35723</para>
35724</refsect1>
35725</refentry>
35726
35727<refentry id="API-drm-vblank-get">
35728<refentryinfo>
35729 <title>LINUX</title>
35730 <productname>Kernel Hackers Manual</productname>
35731 <date>July 2017</date>
35732</refentryinfo>
35733<refmeta>
35734 <refentrytitle><phrase>drm_vblank_get</phrase></refentrytitle>
35735 <manvolnum>9</manvolnum>
35736 <refmiscinfo class="version">4.4.14</refmiscinfo>
35737</refmeta>
35738<refnamediv>
35739 <refname>drm_vblank_get</refname>
35740 <refpurpose>
35741     get a reference count on vblank events
35742 </refpurpose>
35743</refnamediv>
35744<refsynopsisdiv>
35745 <title>Synopsis</title>
35746  <funcsynopsis><funcprototype>
35747   <funcdef>int <function>drm_vblank_get </function></funcdef>
35748   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
35749   <paramdef>unsigned int <parameter>pipe</parameter></paramdef>
35750  </funcprototype></funcsynopsis>
35751</refsynopsisdiv>
35752<refsect1>
35753 <title>Arguments</title>
35754 <variablelist>
35755  <varlistentry>
35756   <term><parameter>dev</parameter></term>
35757   <listitem>
35758    <para>
35759     DRM device
35760    </para>
35761   </listitem>
35762  </varlistentry>
35763  <varlistentry>
35764   <term><parameter>pipe</parameter></term>
35765   <listitem>
35766    <para>
35767     index of CRTC to own
35768    </para>
35769   </listitem>
35770  </varlistentry>
35771 </variablelist>
35772</refsect1>
35773<refsect1>
35774<title>Description</title>
35775<para>
35776   Acquire a reference count on vblank events to avoid having them disabled
35777   while in use.
35778   </para><para>
35779
35780   This is the legacy version of <function>drm_crtc_vblank_get</function>.
35781</para>
35782</refsect1>
35783<refsect1>
35784<title>Returns</title>
35785<para>
35786   Zero on success or a negative error code on failure.
35787</para>
35788</refsect1>
35789</refentry>
35790
35791<refentry id="API-drm-crtc-vblank-get">
35792<refentryinfo>
35793 <title>LINUX</title>
35794 <productname>Kernel Hackers Manual</productname>
35795 <date>July 2017</date>
35796</refentryinfo>
35797<refmeta>
35798 <refentrytitle><phrase>drm_crtc_vblank_get</phrase></refentrytitle>
35799 <manvolnum>9</manvolnum>
35800 <refmiscinfo class="version">4.4.14</refmiscinfo>
35801</refmeta>
35802<refnamediv>
35803 <refname>drm_crtc_vblank_get</refname>
35804 <refpurpose>
35805     get a reference count on vblank events
35806 </refpurpose>
35807</refnamediv>
35808<refsynopsisdiv>
35809 <title>Synopsis</title>
35810  <funcsynopsis><funcprototype>
35811   <funcdef>int <function>drm_crtc_vblank_get </function></funcdef>
35812   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
35813  </funcprototype></funcsynopsis>
35814</refsynopsisdiv>
35815<refsect1>
35816 <title>Arguments</title>
35817 <variablelist>
35818  <varlistentry>
35819   <term><parameter>crtc</parameter></term>
35820   <listitem>
35821    <para>
35822     which CRTC to own
35823    </para>
35824   </listitem>
35825  </varlistentry>
35826 </variablelist>
35827</refsect1>
35828<refsect1>
35829<title>Description</title>
35830<para>
35831   Acquire a reference count on vblank events to avoid having them disabled
35832   while in use.
35833   </para><para>
35834
35835   This is the native kms version of <function>drm_vblank_get</function>.
35836</para>
35837</refsect1>
35838<refsect1>
35839<title>Returns</title>
35840<para>
35841   Zero on success or a negative error code on failure.
35842</para>
35843</refsect1>
35844</refentry>
35845
35846<refentry id="API-drm-vblank-put">
35847<refentryinfo>
35848 <title>LINUX</title>
35849 <productname>Kernel Hackers Manual</productname>
35850 <date>July 2017</date>
35851</refentryinfo>
35852<refmeta>
35853 <refentrytitle><phrase>drm_vblank_put</phrase></refentrytitle>
35854 <manvolnum>9</manvolnum>
35855 <refmiscinfo class="version">4.4.14</refmiscinfo>
35856</refmeta>
35857<refnamediv>
35858 <refname>drm_vblank_put</refname>
35859 <refpurpose>
35860     release ownership of vblank events
35861 </refpurpose>
35862</refnamediv>
35863<refsynopsisdiv>
35864 <title>Synopsis</title>
35865  <funcsynopsis><funcprototype>
35866   <funcdef>void <function>drm_vblank_put </function></funcdef>
35867   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
35868   <paramdef>unsigned int <parameter>pipe</parameter></paramdef>
35869  </funcprototype></funcsynopsis>
35870</refsynopsisdiv>
35871<refsect1>
35872 <title>Arguments</title>
35873 <variablelist>
35874  <varlistentry>
35875   <term><parameter>dev</parameter></term>
35876   <listitem>
35877    <para>
35878     DRM device
35879    </para>
35880   </listitem>
35881  </varlistentry>
35882  <varlistentry>
35883   <term><parameter>pipe</parameter></term>
35884   <listitem>
35885    <para>
35886     index of CRTC to release
35887    </para>
35888   </listitem>
35889  </varlistentry>
35890 </variablelist>
35891</refsect1>
35892<refsect1>
35893<title>Description</title>
35894<para>
35895   Release ownership of a given vblank counter, turning off interrupts
35896   if possible. Disable interrupts after drm_vblank_offdelay milliseconds.
35897   </para><para>
35898
35899   This is the legacy version of <function>drm_crtc_vblank_put</function>.
35900</para>
35901</refsect1>
35902</refentry>
35903
35904<refentry id="API-drm-crtc-vblank-put">
35905<refentryinfo>
35906 <title>LINUX</title>
35907 <productname>Kernel Hackers Manual</productname>
35908 <date>July 2017</date>
35909</refentryinfo>
35910<refmeta>
35911 <refentrytitle><phrase>drm_crtc_vblank_put</phrase></refentrytitle>
35912 <manvolnum>9</manvolnum>
35913 <refmiscinfo class="version">4.4.14</refmiscinfo>
35914</refmeta>
35915<refnamediv>
35916 <refname>drm_crtc_vblank_put</refname>
35917 <refpurpose>
35918     give up ownership of vblank events
35919 </refpurpose>
35920</refnamediv>
35921<refsynopsisdiv>
35922 <title>Synopsis</title>
35923  <funcsynopsis><funcprototype>
35924   <funcdef>void <function>drm_crtc_vblank_put </function></funcdef>
35925   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
35926  </funcprototype></funcsynopsis>
35927</refsynopsisdiv>
35928<refsect1>
35929 <title>Arguments</title>
35930 <variablelist>
35931  <varlistentry>
35932   <term><parameter>crtc</parameter></term>
35933   <listitem>
35934    <para>
35935     which counter to give up
35936    </para>
35937   </listitem>
35938  </varlistentry>
35939 </variablelist>
35940</refsect1>
35941<refsect1>
35942<title>Description</title>
35943<para>
35944   Release ownership of a given vblank counter, turning off interrupts
35945   if possible. Disable interrupts after drm_vblank_offdelay milliseconds.
35946   </para><para>
35947
35948   This is the native kms version of <function>drm_vblank_put</function>.
35949</para>
35950</refsect1>
35951</refentry>
35952
35953<refentry id="API-drm-wait-one-vblank">
35954<refentryinfo>
35955 <title>LINUX</title>
35956 <productname>Kernel Hackers Manual</productname>
35957 <date>July 2017</date>
35958</refentryinfo>
35959<refmeta>
35960 <refentrytitle><phrase>drm_wait_one_vblank</phrase></refentrytitle>
35961 <manvolnum>9</manvolnum>
35962 <refmiscinfo class="version">4.4.14</refmiscinfo>
35963</refmeta>
35964<refnamediv>
35965 <refname>drm_wait_one_vblank</refname>
35966 <refpurpose>
35967     wait for one vblank
35968 </refpurpose>
35969</refnamediv>
35970<refsynopsisdiv>
35971 <title>Synopsis</title>
35972  <funcsynopsis><funcprototype>
35973   <funcdef>void <function>drm_wait_one_vblank </function></funcdef>
35974   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
35975   <paramdef>unsigned int <parameter>pipe</parameter></paramdef>
35976  </funcprototype></funcsynopsis>
35977</refsynopsisdiv>
35978<refsect1>
35979 <title>Arguments</title>
35980 <variablelist>
35981  <varlistentry>
35982   <term><parameter>dev</parameter></term>
35983   <listitem>
35984    <para>
35985     DRM device
35986    </para>
35987   </listitem>
35988  </varlistentry>
35989  <varlistentry>
35990   <term><parameter>pipe</parameter></term>
35991   <listitem>
35992    <para>
35993     CRTC index
35994    </para>
35995   </listitem>
35996  </varlistentry>
35997 </variablelist>
35998</refsect1>
35999<refsect1>
36000<title>Description</title>
36001<para>
36002   This waits for one vblank to pass on <parameter>pipe</parameter>, using the irq driver interfaces.
36003   It is a failure to call this when the vblank irq for <parameter>pipe</parameter> is disabled, e.g.
36004   due to lack of driver support or because the crtc is off.
36005</para>
36006</refsect1>
36007</refentry>
36008
36009<refentry id="API-drm-crtc-wait-one-vblank">
36010<refentryinfo>
36011 <title>LINUX</title>
36012 <productname>Kernel Hackers Manual</productname>
36013 <date>July 2017</date>
36014</refentryinfo>
36015<refmeta>
36016 <refentrytitle><phrase>drm_crtc_wait_one_vblank</phrase></refentrytitle>
36017 <manvolnum>9</manvolnum>
36018 <refmiscinfo class="version">4.4.14</refmiscinfo>
36019</refmeta>
36020<refnamediv>
36021 <refname>drm_crtc_wait_one_vblank</refname>
36022 <refpurpose>
36023     wait for one vblank
36024 </refpurpose>
36025</refnamediv>
36026<refsynopsisdiv>
36027 <title>Synopsis</title>
36028  <funcsynopsis><funcprototype>
36029   <funcdef>void <function>drm_crtc_wait_one_vblank </function></funcdef>
36030   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
36031  </funcprototype></funcsynopsis>
36032</refsynopsisdiv>
36033<refsect1>
36034 <title>Arguments</title>
36035 <variablelist>
36036  <varlistentry>
36037   <term><parameter>crtc</parameter></term>
36038   <listitem>
36039    <para>
36040     DRM crtc
36041    </para>
36042   </listitem>
36043  </varlistentry>
36044 </variablelist>
36045</refsect1>
36046<refsect1>
36047<title>Description</title>
36048<para>
36049   This waits for one vblank to pass on <parameter>crtc</parameter>, using the irq driver interfaces.
36050   It is a failure to call this when the vblank irq for <parameter>crtc</parameter> is disabled, e.g.
36051   due to lack of driver support or because the crtc is off.
36052</para>
36053</refsect1>
36054</refentry>
36055
36056<refentry id="API-drm-vblank-off">
36057<refentryinfo>
36058 <title>LINUX</title>
36059 <productname>Kernel Hackers Manual</productname>
36060 <date>July 2017</date>
36061</refentryinfo>
36062<refmeta>
36063 <refentrytitle><phrase>drm_vblank_off</phrase></refentrytitle>
36064 <manvolnum>9</manvolnum>
36065 <refmiscinfo class="version">4.4.14</refmiscinfo>
36066</refmeta>
36067<refnamediv>
36068 <refname>drm_vblank_off</refname>
36069 <refpurpose>
36070     disable vblank events on a CRTC
36071 </refpurpose>
36072</refnamediv>
36073<refsynopsisdiv>
36074 <title>Synopsis</title>
36075  <funcsynopsis><funcprototype>
36076   <funcdef>void <function>drm_vblank_off </function></funcdef>
36077   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
36078   <paramdef>unsigned int <parameter>pipe</parameter></paramdef>
36079  </funcprototype></funcsynopsis>
36080</refsynopsisdiv>
36081<refsect1>
36082 <title>Arguments</title>
36083 <variablelist>
36084  <varlistentry>
36085   <term><parameter>dev</parameter></term>
36086   <listitem>
36087    <para>
36088     DRM device
36089    </para>
36090   </listitem>
36091  </varlistentry>
36092  <varlistentry>
36093   <term><parameter>pipe</parameter></term>
36094   <listitem>
36095    <para>
36096     CRTC index
36097    </para>
36098   </listitem>
36099  </varlistentry>
36100 </variablelist>
36101</refsect1>
36102<refsect1>
36103<title>Description</title>
36104<para>
36105   Drivers can use this function to shut down the vblank interrupt handling when
36106   disabling a crtc. This function ensures that the latest vblank frame count is
36107   stored so that <function>drm_vblank_on</function> can restore it again.
36108   </para><para>
36109
36110   Drivers must use this function when the hardware vblank counter can get
36111   reset, e.g. when suspending.
36112   </para><para>
36113
36114   This is the legacy version of <function>drm_crtc_vblank_off</function>.
36115</para>
36116</refsect1>
36117</refentry>
36118
36119<refentry id="API-drm-crtc-vblank-off">
36120<refentryinfo>
36121 <title>LINUX</title>
36122 <productname>Kernel Hackers Manual</productname>
36123 <date>July 2017</date>
36124</refentryinfo>
36125<refmeta>
36126 <refentrytitle><phrase>drm_crtc_vblank_off</phrase></refentrytitle>
36127 <manvolnum>9</manvolnum>
36128 <refmiscinfo class="version">4.4.14</refmiscinfo>
36129</refmeta>
36130<refnamediv>
36131 <refname>drm_crtc_vblank_off</refname>
36132 <refpurpose>
36133     disable vblank events on a CRTC
36134 </refpurpose>
36135</refnamediv>
36136<refsynopsisdiv>
36137 <title>Synopsis</title>
36138  <funcsynopsis><funcprototype>
36139   <funcdef>void <function>drm_crtc_vblank_off </function></funcdef>
36140   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
36141  </funcprototype></funcsynopsis>
36142</refsynopsisdiv>
36143<refsect1>
36144 <title>Arguments</title>
36145 <variablelist>
36146  <varlistentry>
36147   <term><parameter>crtc</parameter></term>
36148   <listitem>
36149    <para>
36150     CRTC in question
36151    </para>
36152   </listitem>
36153  </varlistentry>
36154 </variablelist>
36155</refsect1>
36156<refsect1>
36157<title>Description</title>
36158<para>
36159   Drivers can use this function to shut down the vblank interrupt handling when
36160   disabling a crtc. This function ensures that the latest vblank frame count is
36161   stored so that drm_vblank_on can restore it again.
36162   </para><para>
36163
36164   Drivers must use this function when the hardware vblank counter can get
36165   reset, e.g. when suspending.
36166   </para><para>
36167
36168   This is the native kms version of <function>drm_vblank_off</function>.
36169</para>
36170</refsect1>
36171</refentry>
36172
36173<refentry id="API-drm-crtc-vblank-reset">
36174<refentryinfo>
36175 <title>LINUX</title>
36176 <productname>Kernel Hackers Manual</productname>
36177 <date>July 2017</date>
36178</refentryinfo>
36179<refmeta>
36180 <refentrytitle><phrase>drm_crtc_vblank_reset</phrase></refentrytitle>
36181 <manvolnum>9</manvolnum>
36182 <refmiscinfo class="version">4.4.14</refmiscinfo>
36183</refmeta>
36184<refnamediv>
36185 <refname>drm_crtc_vblank_reset</refname>
36186 <refpurpose>
36187     reset vblank state to off on a CRTC
36188 </refpurpose>
36189</refnamediv>
36190<refsynopsisdiv>
36191 <title>Synopsis</title>
36192  <funcsynopsis><funcprototype>
36193   <funcdef>void <function>drm_crtc_vblank_reset </function></funcdef>
36194   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
36195  </funcprototype></funcsynopsis>
36196</refsynopsisdiv>
36197<refsect1>
36198 <title>Arguments</title>
36199 <variablelist>
36200  <varlistentry>
36201   <term><parameter>crtc</parameter></term>
36202   <listitem>
36203    <para>
36204     CRTC in question
36205    </para>
36206   </listitem>
36207  </varlistentry>
36208 </variablelist>
36209</refsect1>
36210<refsect1>
36211<title>Description</title>
36212<para>
36213   Drivers can use this function to reset the vblank state to off at load time.
36214   Drivers should use this together with the <function>drm_crtc_vblank_off</function> and
36215   <function>drm_crtc_vblank_on</function> functions. The difference compared to
36216   <function>drm_crtc_vblank_off</function> is that this function doesn't save the vblank counter
36217   and hence doesn't need to call any driver hooks.
36218</para>
36219</refsect1>
36220</refentry>
36221
36222<refentry id="API-drm-vblank-on">
36223<refentryinfo>
36224 <title>LINUX</title>
36225 <productname>Kernel Hackers Manual</productname>
36226 <date>July 2017</date>
36227</refentryinfo>
36228<refmeta>
36229 <refentrytitle><phrase>drm_vblank_on</phrase></refentrytitle>
36230 <manvolnum>9</manvolnum>
36231 <refmiscinfo class="version">4.4.14</refmiscinfo>
36232</refmeta>
36233<refnamediv>
36234 <refname>drm_vblank_on</refname>
36235 <refpurpose>
36236     enable vblank events on a CRTC
36237 </refpurpose>
36238</refnamediv>
36239<refsynopsisdiv>
36240 <title>Synopsis</title>
36241  <funcsynopsis><funcprototype>
36242   <funcdef>void <function>drm_vblank_on </function></funcdef>
36243   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
36244   <paramdef>unsigned int <parameter>pipe</parameter></paramdef>
36245  </funcprototype></funcsynopsis>
36246</refsynopsisdiv>
36247<refsect1>
36248 <title>Arguments</title>
36249 <variablelist>
36250  <varlistentry>
36251   <term><parameter>dev</parameter></term>
36252   <listitem>
36253    <para>
36254     DRM device
36255    </para>
36256   </listitem>
36257  </varlistentry>
36258  <varlistentry>
36259   <term><parameter>pipe</parameter></term>
36260   <listitem>
36261    <para>
36262     CRTC index
36263    </para>
36264   </listitem>
36265  </varlistentry>
36266 </variablelist>
36267</refsect1>
36268<refsect1>
36269<title>Description</title>
36270<para>
36271   This functions restores the vblank interrupt state captured with
36272   <function>drm_vblank_off</function> again. Note that calls to <function>drm_vblank_on</function> and
36273   <function>drm_vblank_off</function> can be unbalanced and so can also be unconditionally called
36274   in driver load code to reflect the current hardware state of the crtc.
36275   </para><para>
36276
36277   This is the legacy version of <function>drm_crtc_vblank_on</function>.
36278</para>
36279</refsect1>
36280</refentry>
36281
36282<refentry id="API-drm-crtc-vblank-on">
36283<refentryinfo>
36284 <title>LINUX</title>
36285 <productname>Kernel Hackers Manual</productname>
36286 <date>July 2017</date>
36287</refentryinfo>
36288<refmeta>
36289 <refentrytitle><phrase>drm_crtc_vblank_on</phrase></refentrytitle>
36290 <manvolnum>9</manvolnum>
36291 <refmiscinfo class="version">4.4.14</refmiscinfo>
36292</refmeta>
36293<refnamediv>
36294 <refname>drm_crtc_vblank_on</refname>
36295 <refpurpose>
36296     enable vblank events on a CRTC
36297 </refpurpose>
36298</refnamediv>
36299<refsynopsisdiv>
36300 <title>Synopsis</title>
36301  <funcsynopsis><funcprototype>
36302   <funcdef>void <function>drm_crtc_vblank_on </function></funcdef>
36303   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
36304  </funcprototype></funcsynopsis>
36305</refsynopsisdiv>
36306<refsect1>
36307 <title>Arguments</title>
36308 <variablelist>
36309  <varlistentry>
36310   <term><parameter>crtc</parameter></term>
36311   <listitem>
36312    <para>
36313     CRTC in question
36314    </para>
36315   </listitem>
36316  </varlistentry>
36317 </variablelist>
36318</refsect1>
36319<refsect1>
36320<title>Description</title>
36321<para>
36322   This functions restores the vblank interrupt state captured with
36323   <function>drm_vblank_off</function> again. Note that calls to <function>drm_vblank_on</function> and
36324   <function>drm_vblank_off</function> can be unbalanced and so can also be unconditionally called
36325   in driver load code to reflect the current hardware state of the crtc.
36326   </para><para>
36327
36328   This is the native kms version of <function>drm_vblank_on</function>.
36329</para>
36330</refsect1>
36331</refentry>
36332
36333<refentry id="API-drm-vblank-pre-modeset">
36334<refentryinfo>
36335 <title>LINUX</title>
36336 <productname>Kernel Hackers Manual</productname>
36337 <date>July 2017</date>
36338</refentryinfo>
36339<refmeta>
36340 <refentrytitle><phrase>drm_vblank_pre_modeset</phrase></refentrytitle>
36341 <manvolnum>9</manvolnum>
36342 <refmiscinfo class="version">4.4.14</refmiscinfo>
36343</refmeta>
36344<refnamediv>
36345 <refname>drm_vblank_pre_modeset</refname>
36346 <refpurpose>
36347     account for vblanks across mode sets
36348 </refpurpose>
36349</refnamediv>
36350<refsynopsisdiv>
36351 <title>Synopsis</title>
36352  <funcsynopsis><funcprototype>
36353   <funcdef>void <function>drm_vblank_pre_modeset </function></funcdef>
36354   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
36355   <paramdef>unsigned int <parameter>pipe</parameter></paramdef>
36356  </funcprototype></funcsynopsis>
36357</refsynopsisdiv>
36358<refsect1>
36359 <title>Arguments</title>
36360 <variablelist>
36361  <varlistentry>
36362   <term><parameter>dev</parameter></term>
36363   <listitem>
36364    <para>
36365     DRM device
36366    </para>
36367   </listitem>
36368  </varlistentry>
36369  <varlistentry>
36370   <term><parameter>pipe</parameter></term>
36371   <listitem>
36372    <para>
36373     CRTC index
36374    </para>
36375   </listitem>
36376  </varlistentry>
36377 </variablelist>
36378</refsect1>
36379<refsect1>
36380<title>Description</title>
36381<para>
36382   Account for vblank events across mode setting events, which will likely
36383   reset the hardware frame counter.
36384   </para><para>
36385
36386   This is done by grabbing a temporary vblank reference to ensure that the
36387   vblank interrupt keeps running across the modeset sequence. With this the
36388   software-side vblank frame counting will ensure that there are no jumps or
36389   discontinuities.
36390   </para><para>
36391
36392   Unfortunately this approach is racy and also doesn't work when the vblank
36393   interrupt stops running, e.g. across system suspend resume. It is therefore
36394   highly recommended that drivers use the newer <function>drm_vblank_off</function> and
36395   <function>drm_vblank_on</function> instead. <function>drm_vblank_pre_modeset</function> only works correctly when
36396   using <quote>cooked</quote> software vblank frame counters and not relying on any hardware
36397   counters.
36398   </para><para>
36399
36400   Drivers must call <function>drm_vblank_post_modeset</function> when re-enabling the same crtc
36401   again.
36402</para>
36403</refsect1>
36404</refentry>
36405
36406<refentry id="API-drm-vblank-post-modeset">
36407<refentryinfo>
36408 <title>LINUX</title>
36409 <productname>Kernel Hackers Manual</productname>
36410 <date>July 2017</date>
36411</refentryinfo>
36412<refmeta>
36413 <refentrytitle><phrase>drm_vblank_post_modeset</phrase></refentrytitle>
36414 <manvolnum>9</manvolnum>
36415 <refmiscinfo class="version">4.4.14</refmiscinfo>
36416</refmeta>
36417<refnamediv>
36418 <refname>drm_vblank_post_modeset</refname>
36419 <refpurpose>
36420     undo drm_vblank_pre_modeset changes
36421 </refpurpose>
36422</refnamediv>
36423<refsynopsisdiv>
36424 <title>Synopsis</title>
36425  <funcsynopsis><funcprototype>
36426   <funcdef>void <function>drm_vblank_post_modeset </function></funcdef>
36427   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
36428   <paramdef>unsigned int <parameter>pipe</parameter></paramdef>
36429  </funcprototype></funcsynopsis>
36430</refsynopsisdiv>
36431<refsect1>
36432 <title>Arguments</title>
36433 <variablelist>
36434  <varlistentry>
36435   <term><parameter>dev</parameter></term>
36436   <listitem>
36437    <para>
36438     DRM device
36439    </para>
36440   </listitem>
36441  </varlistentry>
36442  <varlistentry>
36443   <term><parameter>pipe</parameter></term>
36444   <listitem>
36445    <para>
36446     CRTC index
36447    </para>
36448   </listitem>
36449  </varlistentry>
36450 </variablelist>
36451</refsect1>
36452<refsect1>
36453<title>Description</title>
36454<para>
36455   This function again drops the temporary vblank reference acquired in
36456   drm_vblank_pre_modeset.
36457</para>
36458</refsect1>
36459</refentry>
36460
36461<refentry id="API-drm-handle-vblank">
36462<refentryinfo>
36463 <title>LINUX</title>
36464 <productname>Kernel Hackers Manual</productname>
36465 <date>July 2017</date>
36466</refentryinfo>
36467<refmeta>
36468 <refentrytitle><phrase>drm_handle_vblank</phrase></refentrytitle>
36469 <manvolnum>9</manvolnum>
36470 <refmiscinfo class="version">4.4.14</refmiscinfo>
36471</refmeta>
36472<refnamediv>
36473 <refname>drm_handle_vblank</refname>
36474 <refpurpose>
36475     handle a vblank event
36476 </refpurpose>
36477</refnamediv>
36478<refsynopsisdiv>
36479 <title>Synopsis</title>
36480  <funcsynopsis><funcprototype>
36481   <funcdef>bool <function>drm_handle_vblank </function></funcdef>
36482   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
36483   <paramdef>unsigned int <parameter>pipe</parameter></paramdef>
36484  </funcprototype></funcsynopsis>
36485</refsynopsisdiv>
36486<refsect1>
36487 <title>Arguments</title>
36488 <variablelist>
36489  <varlistentry>
36490   <term><parameter>dev</parameter></term>
36491   <listitem>
36492    <para>
36493     DRM device
36494    </para>
36495   </listitem>
36496  </varlistentry>
36497  <varlistentry>
36498   <term><parameter>pipe</parameter></term>
36499   <listitem>
36500    <para>
36501     index of CRTC where this event occurred
36502    </para>
36503   </listitem>
36504  </varlistentry>
36505 </variablelist>
36506</refsect1>
36507<refsect1>
36508<title>Description</title>
36509<para>
36510   Drivers should call this routine in their vblank interrupt handlers to
36511   update the vblank counter and send any signals that may be pending.
36512   </para><para>
36513
36514   This is the legacy version of <function>drm_crtc_handle_vblank</function>.
36515</para>
36516</refsect1>
36517</refentry>
36518
36519<refentry id="API-drm-crtc-handle-vblank">
36520<refentryinfo>
36521 <title>LINUX</title>
36522 <productname>Kernel Hackers Manual</productname>
36523 <date>July 2017</date>
36524</refentryinfo>
36525<refmeta>
36526 <refentrytitle><phrase>drm_crtc_handle_vblank</phrase></refentrytitle>
36527 <manvolnum>9</manvolnum>
36528 <refmiscinfo class="version">4.4.14</refmiscinfo>
36529</refmeta>
36530<refnamediv>
36531 <refname>drm_crtc_handle_vblank</refname>
36532 <refpurpose>
36533     handle a vblank event
36534 </refpurpose>
36535</refnamediv>
36536<refsynopsisdiv>
36537 <title>Synopsis</title>
36538  <funcsynopsis><funcprototype>
36539   <funcdef>bool <function>drm_crtc_handle_vblank </function></funcdef>
36540   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
36541  </funcprototype></funcsynopsis>
36542</refsynopsisdiv>
36543<refsect1>
36544 <title>Arguments</title>
36545 <variablelist>
36546  <varlistentry>
36547   <term><parameter>crtc</parameter></term>
36548   <listitem>
36549    <para>
36550     where this event occurred
36551    </para>
36552   </listitem>
36553  </varlistentry>
36554 </variablelist>
36555</refsect1>
36556<refsect1>
36557<title>Description</title>
36558<para>
36559   Drivers should call this routine in their vblank interrupt handlers to
36560   update the vblank counter and send any signals that may be pending.
36561   </para><para>
36562
36563   This is the native KMS version of <function>drm_handle_vblank</function>.
36564</para>
36565</refsect1>
36566<refsect1>
36567<title>Returns</title>
36568<para>
36569   True if the event was successfully handled, false on failure.
36570</para>
36571</refsect1>
36572</refentry>
36573
36574<refentry id="API-drm-vblank-no-hw-counter">
36575<refentryinfo>
36576 <title>LINUX</title>
36577 <productname>Kernel Hackers Manual</productname>
36578 <date>July 2017</date>
36579</refentryinfo>
36580<refmeta>
36581 <refentrytitle><phrase>drm_vblank_no_hw_counter</phrase></refentrytitle>
36582 <manvolnum>9</manvolnum>
36583 <refmiscinfo class="version">4.4.14</refmiscinfo>
36584</refmeta>
36585<refnamediv>
36586 <refname>drm_vblank_no_hw_counter</refname>
36587 <refpurpose>
36588     "No hw counter" implementation of .<function>get_vblank_counter</function>
36589 </refpurpose>
36590</refnamediv>
36591<refsynopsisdiv>
36592 <title>Synopsis</title>
36593  <funcsynopsis><funcprototype>
36594   <funcdef>u32 <function>drm_vblank_no_hw_counter </function></funcdef>
36595   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
36596   <paramdef>unsigned int <parameter>pipe</parameter></paramdef>
36597  </funcprototype></funcsynopsis>
36598</refsynopsisdiv>
36599<refsect1>
36600 <title>Arguments</title>
36601 <variablelist>
36602  <varlistentry>
36603   <term><parameter>dev</parameter></term>
36604   <listitem>
36605    <para>
36606     DRM device
36607    </para>
36608   </listitem>
36609  </varlistentry>
36610  <varlistentry>
36611   <term><parameter>pipe</parameter></term>
36612   <listitem>
36613    <para>
36614     CRTC for which to read the counter
36615    </para>
36616   </listitem>
36617  </varlistentry>
36618 </variablelist>
36619</refsect1>
36620<refsect1>
36621<title>Description</title>
36622<para>
36623   Drivers can plug this into the .<function>get_vblank_counter</function> function if
36624   there is no useable hardware frame counter available.
36625</para>
36626</refsect1>
36627<refsect1>
36628<title>Returns</title>
36629<para>
36630   0
36631</para>
36632</refsect1>
36633</refentry>
36634
36635<refentry id="API-drm-crtc-vblank-waitqueue">
36636<refentryinfo>
36637 <title>LINUX</title>
36638 <productname>Kernel Hackers Manual</productname>
36639 <date>July 2017</date>
36640</refentryinfo>
36641<refmeta>
36642 <refentrytitle><phrase>drm_crtc_vblank_waitqueue</phrase></refentrytitle>
36643 <manvolnum>9</manvolnum>
36644 <refmiscinfo class="version">4.4.14</refmiscinfo>
36645</refmeta>
36646<refnamediv>
36647 <refname>drm_crtc_vblank_waitqueue</refname>
36648 <refpurpose>
36649  get vblank waitqueue for the CRTC
36650 </refpurpose>
36651</refnamediv>
36652<refsynopsisdiv>
36653 <title>Synopsis</title>
36654  <funcsynopsis><funcprototype>
36655   <funcdef>wait_queue_head_t * <function>drm_crtc_vblank_waitqueue </function></funcdef>
36656   <paramdef>struct drm_crtc * <parameter>crtc</parameter></paramdef>
36657  </funcprototype></funcsynopsis>
36658</refsynopsisdiv>
36659<refsect1>
36660 <title>Arguments</title>
36661 <variablelist>
36662  <varlistentry>
36663   <term><parameter>crtc</parameter></term>
36664   <listitem>
36665    <para>
36666     which CRTC's vblank waitqueue to retrieve
36667    </para>
36668   </listitem>
36669  </varlistentry>
36670 </variablelist>
36671</refsect1>
36672<refsect1>
36673<title>Description</title>
36674<para>
36675   This function returns a pointer to the vblank waitqueue for the CRTC.
36676   Drivers can use this to implement vblank waits using <function>wait_event</function> &amp; co.
36677</para>
36678</refsect1>
36679</refentry>
36680
36681    </sect2>
36682  </sect1>
36683
36684  <!-- Internals: open/close, file operations and ioctls -->
36685
36686  <sect1>
36687    <title>Open/Close, File Operations and IOCTLs</title>
36688    <sect2>
36689      <title>Open and Close</title>
36690      <synopsis>int (*firstopen) (struct drm_device *);
36691void (*lastclose) (struct drm_device *);
36692int (*open) (struct drm_device *, struct drm_file *);
36693void (*preclose) (struct drm_device *, struct drm_file *);
36694void (*postclose) (struct drm_device *, struct drm_file *);</synopsis>
36695      <abstract>Open and close handlers. None of those methods are mandatory.
36696      </abstract>
36697      <para>
36698        The <methodname>firstopen</methodname> method is called by the DRM core
36699	for legacy UMS (User Mode Setting) drivers only when an application
36700	opens a device that has no other opened file handle. UMS drivers can
36701	implement it to acquire device resources. KMS drivers can't use the
36702	method and must acquire resources in the <methodname>load</methodname>
36703	method instead.
36704      </para>
36705      <para>
36706	Similarly the <methodname>lastclose</methodname> method is called when
36707	the last application holding a file handle opened on the device closes
36708	it, for both UMS and KMS drivers. Additionally, the method is also
36709	called at module unload time or, for hot-pluggable devices, when the
36710	device is unplugged. The <methodname>firstopen</methodname> and
36711	<methodname>lastclose</methodname> calls can thus be unbalanced.
36712      </para>
36713      <para>
36714        The <methodname>open</methodname> method is called every time the device
36715	is opened by an application. Drivers can allocate per-file private data
36716	in this method and store them in the struct
36717	<structname>drm_file</structname> <structfield>driver_priv</structfield>
36718	field. Note that the <methodname>open</methodname> method is called
36719	before <methodname>firstopen</methodname>.
36720      </para>
36721      <para>
36722        The close operation is split into <methodname>preclose</methodname> and
36723	<methodname>postclose</methodname> methods. Drivers must stop and
36724	cleanup all per-file operations in the <methodname>preclose</methodname>
36725	method. For instance pending vertical blanking and page flip events must
36726	be cancelled. No per-file operation is allowed on the file handle after
36727	returning from the <methodname>preclose</methodname> method.
36728      </para>
36729      <para>
36730        Finally the <methodname>postclose</methodname> method is called as the
36731	last step of the close operation, right before calling the
36732	<methodname>lastclose</methodname> method if no other open file handle
36733	exists for the device. Drivers that have allocated per-file private data
36734	in the <methodname>open</methodname> method should free it here.
36735      </para>
36736      <para>
36737        The <methodname>lastclose</methodname> method should restore CRTC and
36738	plane properties to default value, so that a subsequent open of the
36739	device will not inherit state from the previous user. It can also be
36740	used to execute delayed power switching state changes, e.g. in
36741	conjunction with the vga_switcheroo infrastructure (see
36742	<xref linkend="vga_switcheroo"/>). Beyond that KMS drivers should not
36743	do any further cleanup. Only legacy UMS drivers might need to clean up
36744	device state so that the vga console or an independent fbdev driver
36745	could take over.
36746      </para>
36747    </sect2>
36748    <sect2>
36749      <title>File Operations</title>
36750      <synopsis>const struct file_operations *fops</synopsis>
36751      <abstract>File operations for the DRM device node.</abstract>
36752      <para>
36753        Drivers must define the file operations structure that forms the DRM
36754	userspace API entry point, even though most of those operations are
36755	implemented in the DRM core. The <methodname>open</methodname>,
36756	<methodname>release</methodname> and <methodname>ioctl</methodname>
36757	operations are handled by
36758	<programlisting>
36759	.owner = THIS_MODULE,
36760	.open = drm_open,
36761	.release = drm_release,
36762	.unlocked_ioctl = drm_ioctl,
36763  #ifdef CONFIG_COMPAT
36764	.compat_ioctl = drm_compat_ioctl,
36765  #endif
36766        </programlisting>
36767      </para>
36768      <para>
36769        Drivers that implement private ioctls that requires 32/64bit
36770	compatibility support must provide their own
36771	<methodname>compat_ioctl</methodname> handler that processes private
36772	ioctls and calls <function>drm_compat_ioctl</function> for core ioctls.
36773      </para>
36774      <para>
36775        The <methodname>read</methodname> and <methodname>poll</methodname>
36776	operations provide support for reading DRM events and polling them. They
36777	are implemented by
36778	<programlisting>
36779	.poll = drm_poll,
36780	.read = drm_read,
36781	.llseek = no_llseek,
36782	</programlisting>
36783      </para>
36784      <para>
36785        The memory mapping implementation varies depending on how the driver
36786	manages memory. Pre-GEM drivers will use <function>drm_mmap</function>,
36787	while GEM-aware drivers will use <function>drm_gem_mmap</function>. See
36788	<xref linkend="drm-gem"/>.
36789	<programlisting>
36790	.mmap = drm_gem_mmap,
36791	</programlisting>
36792      </para>
36793      <para>
36794        No other file operation is supported by the DRM API.
36795      </para>
36796    </sect2>
36797    <sect2>
36798      <title>IOCTLs</title>
36799      <synopsis>struct drm_ioctl_desc *ioctls;
36800int num_ioctls;</synopsis>
36801      <abstract>Driver-specific ioctls descriptors table.</abstract>
36802      <para>
36803        Driver-specific ioctls numbers start at DRM_COMMAND_BASE. The ioctls
36804	descriptors table is indexed by the ioctl number offset from the base
36805	value. Drivers can use the DRM_IOCTL_DEF_DRV() macro to initialize the
36806	table entries.
36807      </para>
36808      <para>
36809        <programlisting>DRM_IOCTL_DEF_DRV(ioctl, func, flags)</programlisting>
36810	<para>
36811	  <parameter>ioctl</parameter> is the ioctl name. Drivers must define
36812	  the DRM_##ioctl and DRM_IOCTL_##ioctl macros to the ioctl number
36813	  offset from DRM_COMMAND_BASE and the ioctl number respectively. The
36814	  first macro is private to the device while the second must be exposed
36815	  to userspace in a public header.
36816	</para>
36817	<para>
36818	  <parameter>func</parameter> is a pointer to the ioctl handler function
36819	  compatible with the <type>drm_ioctl_t</type> type.
36820	  <programlisting>typedef int drm_ioctl_t(struct drm_device *dev, void *data,
36821		struct drm_file *file_priv);</programlisting>
36822	</para>
36823	<para>
36824	  <parameter>flags</parameter> is a bitmask combination of the following
36825	  values. It restricts how the ioctl is allowed to be called.
36826	  <itemizedlist>
36827	    <listitem><para>
36828	      DRM_AUTH - Only authenticated callers allowed
36829	    </para></listitem>
36830	    <listitem><para>
36831	      DRM_MASTER - The ioctl can only be called on the master file
36832	      handle
36833	    </para></listitem>
36834            <listitem><para>
36835	      DRM_ROOT_ONLY - Only callers with the SYSADMIN capability allowed
36836	    </para></listitem>
36837            <listitem><para>
36838	      DRM_CONTROL_ALLOW - The ioctl can only be called on a control
36839	      device
36840	    </para></listitem>
36841            <listitem><para>
36842	      DRM_UNLOCKED - The ioctl handler will be called without locking
36843	      the DRM global mutex. This is the enforced default for kms drivers
36844	      (i.e. using the DRIVER_MODESET flag) and hence shouldn't be used
36845	      any more for new drivers.
36846	    </para></listitem>
36847	  </itemizedlist>
36848	</para>
36849      </para>
36850<!-- drivers/gpu/drm/drm_ioctl.c -->
36851<refentry id="API-drm-noop">
36852<refentryinfo>
36853 <title>LINUX</title>
36854 <productname>Kernel Hackers Manual</productname>
36855 <date>July 2017</date>
36856</refentryinfo>
36857<refmeta>
36858 <refentrytitle><phrase>drm_noop</phrase></refentrytitle>
36859 <manvolnum>9</manvolnum>
36860 <refmiscinfo class="version">4.4.14</refmiscinfo>
36861</refmeta>
36862<refnamediv>
36863 <refname>drm_noop</refname>
36864 <refpurpose>
36865  DRM no-op ioctl implemntation
36866 </refpurpose>
36867</refnamediv>
36868<refsynopsisdiv>
36869 <title>Synopsis</title>
36870  <funcsynopsis><funcprototype>
36871   <funcdef>int <function>drm_noop </function></funcdef>
36872   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
36873   <paramdef>void * <parameter>data</parameter></paramdef>
36874   <paramdef>struct drm_file * <parameter>file_priv</parameter></paramdef>
36875  </funcprototype></funcsynopsis>
36876</refsynopsisdiv>
36877<refsect1>
36878 <title>Arguments</title>
36879 <variablelist>
36880  <varlistentry>
36881   <term><parameter>dev</parameter></term>
36882   <listitem>
36883    <para>
36884     DRM device for the ioctl
36885    </para>
36886   </listitem>
36887  </varlistentry>
36888  <varlistentry>
36889   <term><parameter>data</parameter></term>
36890   <listitem>
36891    <para>
36892     data pointer for the ioctl
36893    </para>
36894   </listitem>
36895  </varlistentry>
36896  <varlistentry>
36897   <term><parameter>file_priv</parameter></term>
36898   <listitem>
36899    <para>
36900     DRM file for the ioctl call
36901    </para>
36902   </listitem>
36903  </varlistentry>
36904 </variablelist>
36905</refsect1>
36906<refsect1>
36907<title>Description</title>
36908<para>
36909   This no-op implementation for drm ioctls is useful for deprecated
36910   functionality where we can't return a failure code because existing userspace
36911   checks the result of the ioctl, but doesn't care about the action.
36912   </para><para>
36913
36914   Always returns successfully with 0.
36915</para>
36916</refsect1>
36917</refentry>
36918
36919<refentry id="API-drm-invalid-op">
36920<refentryinfo>
36921 <title>LINUX</title>
36922 <productname>Kernel Hackers Manual</productname>
36923 <date>July 2017</date>
36924</refentryinfo>
36925<refmeta>
36926 <refentrytitle><phrase>drm_invalid_op</phrase></refentrytitle>
36927 <manvolnum>9</manvolnum>
36928 <refmiscinfo class="version">4.4.14</refmiscinfo>
36929</refmeta>
36930<refnamediv>
36931 <refname>drm_invalid_op</refname>
36932 <refpurpose>
36933     DRM invalid ioctl implemntation
36934 </refpurpose>
36935</refnamediv>
36936<refsynopsisdiv>
36937 <title>Synopsis</title>
36938  <funcsynopsis><funcprototype>
36939   <funcdef>int <function>drm_invalid_op </function></funcdef>
36940   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
36941   <paramdef>void * <parameter>data</parameter></paramdef>
36942   <paramdef>struct drm_file * <parameter>file_priv</parameter></paramdef>
36943  </funcprototype></funcsynopsis>
36944</refsynopsisdiv>
36945<refsect1>
36946 <title>Arguments</title>
36947 <variablelist>
36948  <varlistentry>
36949   <term><parameter>dev</parameter></term>
36950   <listitem>
36951    <para>
36952     DRM device for the ioctl
36953    </para>
36954   </listitem>
36955  </varlistentry>
36956  <varlistentry>
36957   <term><parameter>data</parameter></term>
36958   <listitem>
36959    <para>
36960     data pointer for the ioctl
36961    </para>
36962   </listitem>
36963  </varlistentry>
36964  <varlistentry>
36965   <term><parameter>file_priv</parameter></term>
36966   <listitem>
36967    <para>
36968     DRM file for the ioctl call
36969    </para>
36970   </listitem>
36971  </varlistentry>
36972 </variablelist>
36973</refsect1>
36974<refsect1>
36975<title>Description</title>
36976<para>
36977   This no-op implementation for drm ioctls is useful for deprecated
36978   functionality where we really don't want to allow userspace to call the ioctl
36979   any more. This is the case for old ums interfaces for drivers that
36980   transitioned to kms gradually and so kept the old legacy tables around. This
36981   only applies to radeon and i915 kms drivers, other drivers shouldn't need to
36982   use this function.
36983   </para><para>
36984
36985   Always fails with a return value of -EINVAL.
36986</para>
36987</refsect1>
36988</refentry>
36989
36990<refentry id="API-drm-ioctl">
36991<refentryinfo>
36992 <title>LINUX</title>
36993 <productname>Kernel Hackers Manual</productname>
36994 <date>July 2017</date>
36995</refentryinfo>
36996<refmeta>
36997 <refentrytitle><phrase>drm_ioctl</phrase></refentrytitle>
36998 <manvolnum>9</manvolnum>
36999 <refmiscinfo class="version">4.4.14</refmiscinfo>
37000</refmeta>
37001<refnamediv>
37002 <refname>drm_ioctl</refname>
37003 <refpurpose>
37004     ioctl callback implementation for DRM drivers
37005 </refpurpose>
37006</refnamediv>
37007<refsynopsisdiv>
37008 <title>Synopsis</title>
37009  <funcsynopsis><funcprototype>
37010   <funcdef>long <function>drm_ioctl </function></funcdef>
37011   <paramdef>struct file * <parameter>filp</parameter></paramdef>
37012   <paramdef>unsigned int <parameter>cmd</parameter></paramdef>
37013   <paramdef>unsigned long <parameter>arg</parameter></paramdef>
37014  </funcprototype></funcsynopsis>
37015</refsynopsisdiv>
37016<refsect1>
37017 <title>Arguments</title>
37018 <variablelist>
37019  <varlistentry>
37020   <term><parameter>filp</parameter></term>
37021   <listitem>
37022    <para>
37023     file this ioctl is called on
37024    </para>
37025   </listitem>
37026  </varlistentry>
37027  <varlistentry>
37028   <term><parameter>cmd</parameter></term>
37029   <listitem>
37030    <para>
37031     ioctl cmd number
37032    </para>
37033   </listitem>
37034  </varlistentry>
37035  <varlistentry>
37036   <term><parameter>arg</parameter></term>
37037   <listitem>
37038    <para>
37039     user argument
37040    </para>
37041   </listitem>
37042  </varlistentry>
37043 </variablelist>
37044</refsect1>
37045<refsect1>
37046<title>Looks up the ioctl function in the </title>
37047<para>
37048   :ioctls table, checking for root
37049   previleges if so required, and dispatches to the respective function.
37050</para>
37051</refsect1>
37052<refsect1>
37053<title>Returns</title>
37054<para>
37055   Zero on success, negative error code on failure.
37056</para>
37057</refsect1>
37058</refentry>
37059
37060<refentry id="API-drm-ioctl-flags">
37061<refentryinfo>
37062 <title>LINUX</title>
37063 <productname>Kernel Hackers Manual</productname>
37064 <date>July 2017</date>
37065</refentryinfo>
37066<refmeta>
37067 <refentrytitle><phrase>drm_ioctl_flags</phrase></refentrytitle>
37068 <manvolnum>9</manvolnum>
37069 <refmiscinfo class="version">4.4.14</refmiscinfo>
37070</refmeta>
37071<refnamediv>
37072 <refname>drm_ioctl_flags</refname>
37073 <refpurpose>
37074     Check for core ioctl and return ioctl permission flags
37075 </refpurpose>
37076</refnamediv>
37077<refsynopsisdiv>
37078 <title>Synopsis</title>
37079  <funcsynopsis><funcprototype>
37080   <funcdef>bool <function>drm_ioctl_flags </function></funcdef>
37081   <paramdef>unsigned int <parameter>nr</parameter></paramdef>
37082   <paramdef>unsigned int * <parameter>flags</parameter></paramdef>
37083  </funcprototype></funcsynopsis>
37084</refsynopsisdiv>
37085<refsect1>
37086 <title>Arguments</title>
37087 <variablelist>
37088  <varlistentry>
37089   <term><parameter>nr</parameter></term>
37090   <listitem>
37091    <para>
37092     ioctl number
37093    </para>
37094   </listitem>
37095  </varlistentry>
37096  <varlistentry>
37097   <term><parameter>flags</parameter></term>
37098   <listitem>
37099    <para>
37100     where to return the ioctl permission flags
37101    </para>
37102   </listitem>
37103  </varlistentry>
37104 </variablelist>
37105</refsect1>
37106<refsect1>
37107<title>Description</title>
37108<para>
37109   This ioctl is only used by the vmwgfx driver to augment the access checks
37110   done by the drm core and insofar a pretty decent layering violation. This
37111   shouldn't be used by any drivers.
37112</para>
37113</refsect1>
37114<refsect1>
37115<title>Returns</title>
37116<para>
37117   True if the <parameter>nr</parameter> corresponds to a DRM core ioctl numer, false otherwise.
37118</para>
37119</refsect1>
37120</refentry>
37121
37122    </sect2>
37123  </sect1>
37124  <sect1>
37125    <title>Legacy Support Code</title>
37126    <para>
37127      The section very briefly covers some of the old legacy support code which
37128      is only used by old DRM drivers which have done a so-called shadow-attach
37129      to the underlying device instead of registering as a real driver. This
37130      also includes some of the old generic buffer management and command
37131      submission code. Do not use any of this in new and modern drivers.
37132    </para>
37133
37134    <sect2>
37135      <title>Legacy Suspend/Resume</title>
37136      <para>
37137	The DRM core provides some suspend/resume code, but drivers wanting full
37138	suspend/resume support should provide save() and restore() functions.
37139	These are called at suspend, hibernate, or resume time, and should perform
37140	any state save or restore required by your device across suspend or
37141	hibernate states.
37142      </para>
37143      <synopsis>int (*suspend) (struct drm_device *, pm_message_t state);
37144  int (*resume) (struct drm_device *);</synopsis>
37145      <para>
37146	Those are legacy suspend and resume methods which
37147	<emphasis>only</emphasis> work with the legacy shadow-attach driver
37148	registration functions. New driver should use the power management
37149	interface provided by their bus type (usually through
37150	the struct <structname>device_driver</structname> dev_pm_ops) and set
37151	these methods to NULL.
37152      </para>
37153    </sect2>
37154
37155    <sect2>
37156      <title>Legacy DMA Services</title>
37157      <para>
37158	This should cover how DMA mapping etc. is supported by the core.
37159	These functions are deprecated and should not be used.
37160      </para>
37161    </sect2>
37162  </sect1>
37163  </chapter>
37164
37165<!-- TODO
37166
37167- Add a glossary
37168- Document the struct_mutex catch-all lock
37169- Document connector properties
37170
37171- Why is the load method optional?
37172- What are drivers supposed to set the initial display state to, and how?
37173  Connector's DPMS states are not initialized and are thus equal to
37174  DRM_MODE_DPMS_ON. The fbcon compatibility layer calls
37175  drm_helper_disable_unused_functions(), which disables unused encoders and
37176  CRTCs, but doesn't touch the connectors' DPMS state, and
37177  drm_helper_connector_dpms() in reaction to fbdev blanking events. Do drivers
37178  that don't implement (or just don't use) fbcon compatibility need to call
37179  those functions themselves?
37180- KMS drivers must call drm_vblank_pre_modeset() and drm_vblank_post_modeset()
37181  around mode setting. Should this be done in the DRM core?
37182- vblank_disable_allowed is set to 1 in the first drm_vblank_post_modeset()
37183  call and never set back to 0. It seems to be safe to permanently set it to 1
37184  in drm_vblank_init() for KMS driver, and it might be safe for UMS drivers as
37185  well. This should be investigated.
37186- crtc and connector .save and .restore operations are only used internally in
37187  drivers, should they be removed from the core?
37188- encoder mid-layer .save and .restore operations are only used internally in
37189  drivers, should they be removed from the core?
37190- encoder mid-layer .detect operation is only used internally in drivers,
37191  should it be removed from the core?
37192-->
37193
37194  <!-- External interfaces -->
37195
37196  <chapter id="drmExternals">
37197    <title>Userland interfaces</title>
37198    <para>
37199      The DRM core exports several interfaces to applications,
37200      generally intended to be used through corresponding libdrm
37201      wrapper functions.  In addition, drivers export device-specific
37202      interfaces for use by userspace drivers &amp; device-aware
37203      applications through ioctls and sysfs files.
37204    </para>
37205    <para>
37206      External interfaces include: memory mapping, context management,
37207      DMA operations, AGP management, vblank control, fence
37208      management, memory management, and output management.
37209    </para>
37210    <para>
37211      Cover generic ioctls and sysfs layout here.  We only need high-level
37212      info, since man pages should cover the rest.
37213    </para>
37214
37215  <!-- External: render nodes -->
37216
37217    <sect1>
37218      <title>Render nodes</title>
37219      <para>
37220        DRM core provides multiple character-devices for user-space to use.
37221        Depending on which device is opened, user-space can perform a different
37222        set of operations (mainly ioctls). The primary node is always created
37223        and called card&lt;num&gt;. Additionally, a currently
37224        unused control node, called controlD&lt;num&gt; is also
37225        created. The primary node provides all legacy operations and
37226        historically was the only interface used by userspace. With KMS, the
37227        control node was introduced. However, the planned KMS control interface
37228        has never been written and so the control node stays unused to date.
37229      </para>
37230      <para>
37231        With the increased use of offscreen renderers and GPGPU applications,
37232        clients no longer require running compositors or graphics servers to
37233        make use of a GPU. But the DRM API required unprivileged clients to
37234        authenticate to a DRM-Master prior to getting GPU access. To avoid this
37235        step and to grant clients GPU access without authenticating, render
37236        nodes were introduced. Render nodes solely serve render clients, that
37237        is, no modesetting or privileged ioctls can be issued on render nodes.
37238        Only non-global rendering commands are allowed. If a driver supports
37239        render nodes, it must advertise it via the DRIVER_RENDER
37240        DRM driver capability. If not supported, the primary node must be used
37241        for render clients together with the legacy drmAuth authentication
37242        procedure.
37243      </para>
37244      <para>
37245        If a driver advertises render node support, DRM core will create a
37246        separate render node called renderD&lt;num&gt;. There will
37247        be one render node per device. No ioctls except  PRIME-related ioctls
37248        will be allowed on this node. Especially GEM_OPEN will be
37249        explicitly prohibited. Render nodes are designed to avoid the
37250        buffer-leaks, which occur if clients guess the flink names or mmap
37251        offsets on the legacy interface. Additionally to this basic interface,
37252        drivers must mark their driver-dependent render-only ioctls as
37253        DRM_RENDER_ALLOW so render clients can use them. Driver
37254        authors must be careful not to allow any privileged ioctls on render
37255        nodes.
37256      </para>
37257      <para>
37258        With render nodes, user-space can now control access to the render node
37259        via basic file-system access-modes. A running graphics server which
37260        authenticates clients on the privileged primary/legacy node is no longer
37261        required. Instead, a client can open the render node and is immediately
37262        granted GPU access. Communication between clients (or servers) is done
37263        via PRIME. FLINK from render node to legacy node is not supported. New
37264        clients must not use the insecure FLINK interface.
37265      </para>
37266      <para>
37267        Besides dropping all modeset/global ioctls, render nodes also drop the
37268        DRM-Master concept. There is no reason to associate render clients with
37269        a DRM-Master as they are independent of any graphics server. Besides,
37270        they must work without any running master, anyway.
37271        Drivers must be able to run without a master object if they support
37272        render nodes. If, on the other hand, a driver requires shared state
37273        between clients which is visible to user-space and accessible beyond
37274        open-file boundaries, they cannot support render nodes.
37275      </para>
37276    </sect1>
37277
37278  <!-- External: vblank handling -->
37279
37280    <sect1>
37281      <title>VBlank event handling</title>
37282      <para>
37283        The DRM core exposes two vertical blank related ioctls:
37284        <variablelist>
37285          <varlistentry>
37286            <term>DRM_IOCTL_WAIT_VBLANK</term>
37287            <listitem>
37288              <para>
37289                This takes a struct drm_wait_vblank structure as its argument,
37290                and it is used to block or request a signal when a specified
37291                vblank event occurs.
37292              </para>
37293            </listitem>
37294          </varlistentry>
37295          <varlistentry>
37296            <term>DRM_IOCTL_MODESET_CTL</term>
37297            <listitem>
37298              <para>
37299		This was only used for user-mode-settind drivers around
37300		modesetting changes to allow the kernel to update the vblank
37301		interrupt after mode setting, since on many devices the vertical
37302		blank counter is reset to 0 at some point during modeset. Modern
37303		drivers should not call this any more since with kernel mode
37304		setting it is a no-op.
37305              </para>
37306            </listitem>
37307          </varlistentry>
37308        </variablelist>
37309      </para>
37310    </sect1>
37311
37312  </chapter>
37313</part>
37314<part id="drmDrivers">
37315  <title>DRM Drivers</title>
37316
37317  <partintro>
37318    <para>
37319      This second part of the GPU Driver Developer's Guide documents driver
37320      code, implementation details and also all the driver-specific userspace
37321      interfaces. Especially since all hardware-acceleration interfaces to
37322      userspace are driver specific for efficiency and other reasons these
37323      interfaces can be rather substantial. Hence every driver has its own
37324      chapter.
37325    </para>
37326  </partintro>
37327
37328  <chapter id="drmI915">
37329    <title>drm/i915 Intel GFX Driver</title>
37330    <para>
37331      The drm/i915 driver supports all (with the exception of some very early
37332      models) integrated GFX chipsets with both Intel display and rendering
37333      blocks. This excludes a set of SoC platforms with an SGX rendering unit,
37334      those have basic support through the gma500 drm driver.
37335    </para>
37336    <sect1>
37337      <title>Core Driver Infrastructure</title>
37338      <para>
37339	This section covers core driver infrastructure used by both the display
37340	and the GEM parts of the driver.
37341      </para>
37342      <sect2>
37343        <title>Runtime Power Management</title>
37344<para>
37345   </para><para>
37346   The i915 driver supports dynamic enabling and disabling of entire hardware
37347   blocks at runtime. This is especially important on the display side where
37348   software is supposed to control many power gates manually on recent hardware,
37349   since on the GT side a lot of the power management is done by the hardware.
37350   But even there some manual control at the device level is required.
37351   </para><para>
37352   Since i915 supports a diverse set of platforms with a unified codebase and
37353   hardware engineers just love to shuffle functionality around between power
37354   domains there's a sizeable amount of indirection required. This file provides
37355   generic functions to the driver for grabbing and releasing references for
37356   abstract power domains. It then maps those to the actual power wells
37357   present for a given platform.
37358</para>
37359
37360<!-- drivers/gpu/drm/i915/intel_runtime_pm.c -->
37361<refentry id="API---intel-display-power-is-enabled">
37362<refentryinfo>
37363 <title>LINUX</title>
37364 <productname>Kernel Hackers Manual</productname>
37365 <date>July 2017</date>
37366</refentryinfo>
37367<refmeta>
37368 <refentrytitle><phrase>__intel_display_power_is_enabled</phrase></refentrytitle>
37369 <manvolnum>9</manvolnum>
37370 <refmiscinfo class="version">4.4.14</refmiscinfo>
37371</refmeta>
37372<refnamediv>
37373 <refname>__intel_display_power_is_enabled</refname>
37374 <refpurpose>
37375  unlocked check for a power domain
37376 </refpurpose>
37377</refnamediv>
37378<refsynopsisdiv>
37379 <title>Synopsis</title>
37380  <funcsynopsis><funcprototype>
37381   <funcdef>bool <function>__intel_display_power_is_enabled </function></funcdef>
37382   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
37383   <paramdef>enum intel_display_power_domain <parameter>domain</parameter></paramdef>
37384  </funcprototype></funcsynopsis>
37385</refsynopsisdiv>
37386<refsect1>
37387 <title>Arguments</title>
37388 <variablelist>
37389  <varlistentry>
37390   <term><parameter>dev_priv</parameter></term>
37391   <listitem>
37392    <para>
37393     i915 device instance
37394    </para>
37395   </listitem>
37396  </varlistentry>
37397  <varlistentry>
37398   <term><parameter>domain</parameter></term>
37399   <listitem>
37400    <para>
37401     power domain to check
37402    </para>
37403   </listitem>
37404  </varlistentry>
37405 </variablelist>
37406</refsect1>
37407<refsect1>
37408<title>Description</title>
37409<para>
37410   This is the unlocked version of <function>intel_display_power_is_enabled</function> and should
37411   only be used from error capture and recovery code where deadlocks are
37412   possible.
37413</para>
37414</refsect1>
37415<refsect1>
37416<title>Returns</title>
37417<para>
37418   True when the power domain is enabled, false otherwise.
37419</para>
37420</refsect1>
37421</refentry>
37422
37423<refentry id="API-intel-display-power-is-enabled">
37424<refentryinfo>
37425 <title>LINUX</title>
37426 <productname>Kernel Hackers Manual</productname>
37427 <date>July 2017</date>
37428</refentryinfo>
37429<refmeta>
37430 <refentrytitle><phrase>intel_display_power_is_enabled</phrase></refentrytitle>
37431 <manvolnum>9</manvolnum>
37432 <refmiscinfo class="version">4.4.14</refmiscinfo>
37433</refmeta>
37434<refnamediv>
37435 <refname>intel_display_power_is_enabled</refname>
37436 <refpurpose>
37437     check for a power domain
37438 </refpurpose>
37439</refnamediv>
37440<refsynopsisdiv>
37441 <title>Synopsis</title>
37442  <funcsynopsis><funcprototype>
37443   <funcdef>bool <function>intel_display_power_is_enabled </function></funcdef>
37444   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
37445   <paramdef>enum intel_display_power_domain <parameter>domain</parameter></paramdef>
37446  </funcprototype></funcsynopsis>
37447</refsynopsisdiv>
37448<refsect1>
37449 <title>Arguments</title>
37450 <variablelist>
37451  <varlistentry>
37452   <term><parameter>dev_priv</parameter></term>
37453   <listitem>
37454    <para>
37455     i915 device instance
37456    </para>
37457   </listitem>
37458  </varlistentry>
37459  <varlistentry>
37460   <term><parameter>domain</parameter></term>
37461   <listitem>
37462    <para>
37463     power domain to check
37464    </para>
37465   </listitem>
37466  </varlistentry>
37467 </variablelist>
37468</refsect1>
37469<refsect1>
37470<title>Description</title>
37471<para>
37472   This function can be used to check the hw power domain state. It is mostly
37473   used in hardware state readout functions. Everywhere else code should rely
37474   upon explicit power domain reference counting to ensure that the hardware
37475   block is powered up before accessing it.
37476   </para><para>
37477
37478   Callers must hold the relevant modesetting locks to ensure that concurrent
37479   threads can't disable the power well while the caller tries to read a few
37480   registers.
37481</para>
37482</refsect1>
37483<refsect1>
37484<title>Returns</title>
37485<para>
37486   True when the power domain is enabled, false otherwise.
37487</para>
37488</refsect1>
37489</refentry>
37490
37491<refentry id="API-intel-display-set-init-power">
37492<refentryinfo>
37493 <title>LINUX</title>
37494 <productname>Kernel Hackers Manual</productname>
37495 <date>July 2017</date>
37496</refentryinfo>
37497<refmeta>
37498 <refentrytitle><phrase>intel_display_set_init_power</phrase></refentrytitle>
37499 <manvolnum>9</manvolnum>
37500 <refmiscinfo class="version">4.4.14</refmiscinfo>
37501</refmeta>
37502<refnamediv>
37503 <refname>intel_display_set_init_power</refname>
37504 <refpurpose>
37505     set the initial power domain state
37506 </refpurpose>
37507</refnamediv>
37508<refsynopsisdiv>
37509 <title>Synopsis</title>
37510  <funcsynopsis><funcprototype>
37511   <funcdef>void <function>intel_display_set_init_power </function></funcdef>
37512   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
37513   <paramdef>bool <parameter>enable</parameter></paramdef>
37514  </funcprototype></funcsynopsis>
37515</refsynopsisdiv>
37516<refsect1>
37517 <title>Arguments</title>
37518 <variablelist>
37519  <varlistentry>
37520   <term><parameter>dev_priv</parameter></term>
37521   <listitem>
37522    <para>
37523     i915 device instance
37524    </para>
37525   </listitem>
37526  </varlistentry>
37527  <varlistentry>
37528   <term><parameter>enable</parameter></term>
37529   <listitem>
37530    <para>
37531     whether to enable or disable the initial power domain state
37532    </para>
37533   </listitem>
37534  </varlistentry>
37535 </variablelist>
37536</refsect1>
37537<refsect1>
37538<title>Description</title>
37539<para>
37540   For simplicity our driver load/unload and system suspend/resume code assumes
37541   that all power domains are always enabled. This functions controls the state
37542   of this little hack. While the initial power domain state is enabled runtime
37543   pm is effectively disabled.
37544</para>
37545</refsect1>
37546</refentry>
37547
37548<refentry id="API-intel-display-power-get">
37549<refentryinfo>
37550 <title>LINUX</title>
37551 <productname>Kernel Hackers Manual</productname>
37552 <date>July 2017</date>
37553</refentryinfo>
37554<refmeta>
37555 <refentrytitle><phrase>intel_display_power_get</phrase></refentrytitle>
37556 <manvolnum>9</manvolnum>
37557 <refmiscinfo class="version">4.4.14</refmiscinfo>
37558</refmeta>
37559<refnamediv>
37560 <refname>intel_display_power_get</refname>
37561 <refpurpose>
37562     grab a power domain reference
37563 </refpurpose>
37564</refnamediv>
37565<refsynopsisdiv>
37566 <title>Synopsis</title>
37567  <funcsynopsis><funcprototype>
37568   <funcdef>void <function>intel_display_power_get </function></funcdef>
37569   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
37570   <paramdef>enum intel_display_power_domain <parameter>domain</parameter></paramdef>
37571  </funcprototype></funcsynopsis>
37572</refsynopsisdiv>
37573<refsect1>
37574 <title>Arguments</title>
37575 <variablelist>
37576  <varlistentry>
37577   <term><parameter>dev_priv</parameter></term>
37578   <listitem>
37579    <para>
37580     i915 device instance
37581    </para>
37582   </listitem>
37583  </varlistentry>
37584  <varlistentry>
37585   <term><parameter>domain</parameter></term>
37586   <listitem>
37587    <para>
37588     power domain to reference
37589    </para>
37590   </listitem>
37591  </varlistentry>
37592 </variablelist>
37593</refsect1>
37594<refsect1>
37595<title>Description</title>
37596<para>
37597   This function grabs a power domain reference for <parameter>domain</parameter> and ensures that the
37598   power domain and all its parents are powered up. Therefore users should only
37599   grab a reference to the innermost power domain they need.
37600   </para><para>
37601
37602   Any power domain reference obtained by this function must have a symmetric
37603   call to <function>intel_display_power_put</function> to release the reference again.
37604</para>
37605</refsect1>
37606</refentry>
37607
37608<refentry id="API-intel-display-power-put">
37609<refentryinfo>
37610 <title>LINUX</title>
37611 <productname>Kernel Hackers Manual</productname>
37612 <date>July 2017</date>
37613</refentryinfo>
37614<refmeta>
37615 <refentrytitle><phrase>intel_display_power_put</phrase></refentrytitle>
37616 <manvolnum>9</manvolnum>
37617 <refmiscinfo class="version">4.4.14</refmiscinfo>
37618</refmeta>
37619<refnamediv>
37620 <refname>intel_display_power_put</refname>
37621 <refpurpose>
37622     release a power domain reference
37623 </refpurpose>
37624</refnamediv>
37625<refsynopsisdiv>
37626 <title>Synopsis</title>
37627  <funcsynopsis><funcprototype>
37628   <funcdef>void <function>intel_display_power_put </function></funcdef>
37629   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
37630   <paramdef>enum intel_display_power_domain <parameter>domain</parameter></paramdef>
37631  </funcprototype></funcsynopsis>
37632</refsynopsisdiv>
37633<refsect1>
37634 <title>Arguments</title>
37635 <variablelist>
37636  <varlistentry>
37637   <term><parameter>dev_priv</parameter></term>
37638   <listitem>
37639    <para>
37640     i915 device instance
37641    </para>
37642   </listitem>
37643  </varlistentry>
37644  <varlistentry>
37645   <term><parameter>domain</parameter></term>
37646   <listitem>
37647    <para>
37648     power domain to reference
37649    </para>
37650   </listitem>
37651  </varlistentry>
37652 </variablelist>
37653</refsect1>
37654<refsect1>
37655<title>Description</title>
37656<para>
37657   This function drops the power domain reference obtained by
37658   <function>intel_display_power_get</function> and might power down the corresponding hardware
37659   block right away if this is the last reference.
37660</para>
37661</refsect1>
37662</refentry>
37663
37664<refentry id="API-intel-power-domains-init">
37665<refentryinfo>
37666 <title>LINUX</title>
37667 <productname>Kernel Hackers Manual</productname>
37668 <date>July 2017</date>
37669</refentryinfo>
37670<refmeta>
37671 <refentrytitle><phrase>intel_power_domains_init</phrase></refentrytitle>
37672 <manvolnum>9</manvolnum>
37673 <refmiscinfo class="version">4.4.14</refmiscinfo>
37674</refmeta>
37675<refnamediv>
37676 <refname>intel_power_domains_init</refname>
37677 <refpurpose>
37678     initializes the power domain structures
37679 </refpurpose>
37680</refnamediv>
37681<refsynopsisdiv>
37682 <title>Synopsis</title>
37683  <funcsynopsis><funcprototype>
37684   <funcdef>int <function>intel_power_domains_init </function></funcdef>
37685   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
37686  </funcprototype></funcsynopsis>
37687</refsynopsisdiv>
37688<refsect1>
37689 <title>Arguments</title>
37690 <variablelist>
37691  <varlistentry>
37692   <term><parameter>dev_priv</parameter></term>
37693   <listitem>
37694    <para>
37695     i915 device instance
37696    </para>
37697   </listitem>
37698  </varlistentry>
37699 </variablelist>
37700</refsect1>
37701<refsect1>
37702<title>Description</title>
37703<para>
37704   Initializes the power domain structures for <parameter>dev_priv</parameter> depending upon the
37705   supported platform.
37706</para>
37707</refsect1>
37708</refentry>
37709
37710<refentry id="API-intel-power-domains-fini">
37711<refentryinfo>
37712 <title>LINUX</title>
37713 <productname>Kernel Hackers Manual</productname>
37714 <date>July 2017</date>
37715</refentryinfo>
37716<refmeta>
37717 <refentrytitle><phrase>intel_power_domains_fini</phrase></refentrytitle>
37718 <manvolnum>9</manvolnum>
37719 <refmiscinfo class="version">4.4.14</refmiscinfo>
37720</refmeta>
37721<refnamediv>
37722 <refname>intel_power_domains_fini</refname>
37723 <refpurpose>
37724     finalizes the power domain structures
37725 </refpurpose>
37726</refnamediv>
37727<refsynopsisdiv>
37728 <title>Synopsis</title>
37729  <funcsynopsis><funcprototype>
37730   <funcdef>void <function>intel_power_domains_fini </function></funcdef>
37731   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
37732  </funcprototype></funcsynopsis>
37733</refsynopsisdiv>
37734<refsect1>
37735 <title>Arguments</title>
37736 <variablelist>
37737  <varlistentry>
37738   <term><parameter>dev_priv</parameter></term>
37739   <listitem>
37740    <para>
37741     i915 device instance
37742    </para>
37743   </listitem>
37744  </varlistentry>
37745 </variablelist>
37746</refsect1>
37747<refsect1>
37748<title>Description</title>
37749<para>
37750   Finalizes the power domain structures for <parameter>dev_priv</parameter> depending upon the
37751   supported platform. This function also disables runtime pm and ensures that
37752   the device stays powered up so that the driver can be reloaded.
37753</para>
37754</refsect1>
37755</refentry>
37756
37757<refentry id="API-intel-power-domains-init-hw">
37758<refentryinfo>
37759 <title>LINUX</title>
37760 <productname>Kernel Hackers Manual</productname>
37761 <date>July 2017</date>
37762</refentryinfo>
37763<refmeta>
37764 <refentrytitle><phrase>intel_power_domains_init_hw</phrase></refentrytitle>
37765 <manvolnum>9</manvolnum>
37766 <refmiscinfo class="version">4.4.14</refmiscinfo>
37767</refmeta>
37768<refnamediv>
37769 <refname>intel_power_domains_init_hw</refname>
37770 <refpurpose>
37771     initialize hardware power domain state
37772 </refpurpose>
37773</refnamediv>
37774<refsynopsisdiv>
37775 <title>Synopsis</title>
37776  <funcsynopsis><funcprototype>
37777   <funcdef>void <function>intel_power_domains_init_hw </function></funcdef>
37778   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
37779  </funcprototype></funcsynopsis>
37780</refsynopsisdiv>
37781<refsect1>
37782 <title>Arguments</title>
37783 <variablelist>
37784  <varlistentry>
37785   <term><parameter>dev_priv</parameter></term>
37786   <listitem>
37787    <para>
37788     i915 device instance
37789    </para>
37790   </listitem>
37791  </varlistentry>
37792 </variablelist>
37793</refsect1>
37794<refsect1>
37795<title>Description</title>
37796<para>
37797   This function initializes the hardware power domain state and enables all
37798   power domains using <function>intel_display_set_init_power</function>.
37799</para>
37800</refsect1>
37801</refentry>
37802
37803<refentry id="API-intel-runtime-pm-get">
37804<refentryinfo>
37805 <title>LINUX</title>
37806 <productname>Kernel Hackers Manual</productname>
37807 <date>July 2017</date>
37808</refentryinfo>
37809<refmeta>
37810 <refentrytitle><phrase>intel_runtime_pm_get</phrase></refentrytitle>
37811 <manvolnum>9</manvolnum>
37812 <refmiscinfo class="version">4.4.14</refmiscinfo>
37813</refmeta>
37814<refnamediv>
37815 <refname>intel_runtime_pm_get</refname>
37816 <refpurpose>
37817     grab a runtime pm reference
37818 </refpurpose>
37819</refnamediv>
37820<refsynopsisdiv>
37821 <title>Synopsis</title>
37822  <funcsynopsis><funcprototype>
37823   <funcdef>void <function>intel_runtime_pm_get </function></funcdef>
37824   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
37825  </funcprototype></funcsynopsis>
37826</refsynopsisdiv>
37827<refsect1>
37828 <title>Arguments</title>
37829 <variablelist>
37830  <varlistentry>
37831   <term><parameter>dev_priv</parameter></term>
37832   <listitem>
37833    <para>
37834     i915 device instance
37835    </para>
37836   </listitem>
37837  </varlistentry>
37838 </variablelist>
37839</refsect1>
37840<refsect1>
37841<title>Description</title>
37842<para>
37843   This function grabs a device-level runtime pm reference (mostly used for GEM
37844   code to ensure the GTT or GT is on) and ensures that it is powered up.
37845   </para><para>
37846
37847   Any runtime pm reference obtained by this function must have a symmetric
37848   call to <function>intel_runtime_pm_put</function> to release the reference again.
37849</para>
37850</refsect1>
37851</refentry>
37852
37853<refentry id="API-intel-runtime-pm-get-noresume">
37854<refentryinfo>
37855 <title>LINUX</title>
37856 <productname>Kernel Hackers Manual</productname>
37857 <date>July 2017</date>
37858</refentryinfo>
37859<refmeta>
37860 <refentrytitle><phrase>intel_runtime_pm_get_noresume</phrase></refentrytitle>
37861 <manvolnum>9</manvolnum>
37862 <refmiscinfo class="version">4.4.14</refmiscinfo>
37863</refmeta>
37864<refnamediv>
37865 <refname>intel_runtime_pm_get_noresume</refname>
37866 <refpurpose>
37867     grab a runtime pm reference
37868 </refpurpose>
37869</refnamediv>
37870<refsynopsisdiv>
37871 <title>Synopsis</title>
37872  <funcsynopsis><funcprototype>
37873   <funcdef>void <function>intel_runtime_pm_get_noresume </function></funcdef>
37874   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
37875  </funcprototype></funcsynopsis>
37876</refsynopsisdiv>
37877<refsect1>
37878 <title>Arguments</title>
37879 <variablelist>
37880  <varlistentry>
37881   <term><parameter>dev_priv</parameter></term>
37882   <listitem>
37883    <para>
37884     i915 device instance
37885    </para>
37886   </listitem>
37887  </varlistentry>
37888 </variablelist>
37889</refsect1>
37890<refsect1>
37891<title>Description</title>
37892<para>
37893   This function grabs a device-level runtime pm reference (mostly used for GEM
37894   code to ensure the GTT or GT is on).
37895   </para><para>
37896
37897   It will _not_ power up the device but instead only check that it's powered
37898   on.  Therefore it is only valid to call this functions from contexts where
37899   the device is known to be powered up and where trying to power it up would
37900   result in hilarity and deadlocks. That pretty much means only the system
37901   suspend/resume code where this is used to grab runtime pm references for
37902   delayed setup down in work items.
37903   </para><para>
37904
37905   Any runtime pm reference obtained by this function must have a symmetric
37906   call to <function>intel_runtime_pm_put</function> to release the reference again.
37907</para>
37908</refsect1>
37909</refentry>
37910
37911<refentry id="API-intel-runtime-pm-put">
37912<refentryinfo>
37913 <title>LINUX</title>
37914 <productname>Kernel Hackers Manual</productname>
37915 <date>July 2017</date>
37916</refentryinfo>
37917<refmeta>
37918 <refentrytitle><phrase>intel_runtime_pm_put</phrase></refentrytitle>
37919 <manvolnum>9</manvolnum>
37920 <refmiscinfo class="version">4.4.14</refmiscinfo>
37921</refmeta>
37922<refnamediv>
37923 <refname>intel_runtime_pm_put</refname>
37924 <refpurpose>
37925     release a runtime pm reference
37926 </refpurpose>
37927</refnamediv>
37928<refsynopsisdiv>
37929 <title>Synopsis</title>
37930  <funcsynopsis><funcprototype>
37931   <funcdef>void <function>intel_runtime_pm_put </function></funcdef>
37932   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
37933  </funcprototype></funcsynopsis>
37934</refsynopsisdiv>
37935<refsect1>
37936 <title>Arguments</title>
37937 <variablelist>
37938  <varlistentry>
37939   <term><parameter>dev_priv</parameter></term>
37940   <listitem>
37941    <para>
37942     i915 device instance
37943    </para>
37944   </listitem>
37945  </varlistentry>
37946 </variablelist>
37947</refsect1>
37948<refsect1>
37949<title>Description</title>
37950<para>
37951   This function drops the device-level runtime pm reference obtained by
37952   <function>intel_runtime_pm_get</function> and might power down the corresponding
37953   hardware block right away if this is the last reference.
37954</para>
37955</refsect1>
37956</refentry>
37957
37958<refentry id="API-intel-runtime-pm-enable">
37959<refentryinfo>
37960 <title>LINUX</title>
37961 <productname>Kernel Hackers Manual</productname>
37962 <date>July 2017</date>
37963</refentryinfo>
37964<refmeta>
37965 <refentrytitle><phrase>intel_runtime_pm_enable</phrase></refentrytitle>
37966 <manvolnum>9</manvolnum>
37967 <refmiscinfo class="version">4.4.14</refmiscinfo>
37968</refmeta>
37969<refnamediv>
37970 <refname>intel_runtime_pm_enable</refname>
37971 <refpurpose>
37972     enable runtime pm
37973 </refpurpose>
37974</refnamediv>
37975<refsynopsisdiv>
37976 <title>Synopsis</title>
37977  <funcsynopsis><funcprototype>
37978   <funcdef>void <function>intel_runtime_pm_enable </function></funcdef>
37979   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
37980  </funcprototype></funcsynopsis>
37981</refsynopsisdiv>
37982<refsect1>
37983 <title>Arguments</title>
37984 <variablelist>
37985  <varlistentry>
37986   <term><parameter>dev_priv</parameter></term>
37987   <listitem>
37988    <para>
37989     i915 device instance
37990    </para>
37991   </listitem>
37992  </varlistentry>
37993 </variablelist>
37994</refsect1>
37995<refsect1>
37996<title>Description</title>
37997<para>
37998   This function enables runtime pm at the end of the driver load sequence.
37999   </para><para>
38000
38001   Note that this function does currently not enable runtime pm for the
38002   subordinate display power domains. That is only done on the first modeset
38003   using <function>intel_display_set_init_power</function>.
38004</para>
38005</refsect1>
38006</refentry>
38007
38008<!-- drivers/gpu/drm/i915/intel_uncore.c -->
38009<refentry id="API-intel-uncore-forcewake-get">
38010<refentryinfo>
38011 <title>LINUX</title>
38012 <productname>Kernel Hackers Manual</productname>
38013 <date>July 2017</date>
38014</refentryinfo>
38015<refmeta>
38016 <refentrytitle><phrase>intel_uncore_forcewake_get</phrase></refentrytitle>
38017 <manvolnum>9</manvolnum>
38018 <refmiscinfo class="version">4.4.14</refmiscinfo>
38019</refmeta>
38020<refnamediv>
38021 <refname>intel_uncore_forcewake_get</refname>
38022 <refpurpose>
38023  grab forcewake domain references
38024 </refpurpose>
38025</refnamediv>
38026<refsynopsisdiv>
38027 <title>Synopsis</title>
38028  <funcsynopsis><funcprototype>
38029   <funcdef>void <function>intel_uncore_forcewake_get </function></funcdef>
38030   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
38031   <paramdef>enum forcewake_domains <parameter>fw_domains</parameter></paramdef>
38032  </funcprototype></funcsynopsis>
38033</refsynopsisdiv>
38034<refsect1>
38035 <title>Arguments</title>
38036 <variablelist>
38037  <varlistentry>
38038   <term><parameter>dev_priv</parameter></term>
38039   <listitem>
38040    <para>
38041     i915 device instance
38042    </para>
38043   </listitem>
38044  </varlistentry>
38045  <varlistentry>
38046   <term><parameter>fw_domains</parameter></term>
38047   <listitem>
38048    <para>
38049     forcewake domains to get reference on
38050    </para>
38051   </listitem>
38052  </varlistentry>
38053 </variablelist>
38054</refsect1>
38055<refsect1>
38056<title>Description</title>
38057<para>
38058   This function can be used get GT's forcewake domain references.
38059   Normal register access will handle the forcewake domains automatically.
38060   However if some sequence requires the GT to not power down a particular
38061   forcewake domains this function should be called at the beginning of the
38062   sequence. And subsequently the reference should be dropped by symmetric
38063   call to <function>intel_unforce_forcewake_put</function>. Usually caller wants all the domains
38064   to be kept awake so the <parameter>fw_domains</parameter> would be then FORCEWAKE_ALL.
38065</para>
38066</refsect1>
38067</refentry>
38068
38069<refentry id="API-intel-uncore-forcewake-get--locked">
38070<refentryinfo>
38071 <title>LINUX</title>
38072 <productname>Kernel Hackers Manual</productname>
38073 <date>July 2017</date>
38074</refentryinfo>
38075<refmeta>
38076 <refentrytitle><phrase>intel_uncore_forcewake_get__locked</phrase></refentrytitle>
38077 <manvolnum>9</manvolnum>
38078 <refmiscinfo class="version">4.4.14</refmiscinfo>
38079</refmeta>
38080<refnamediv>
38081 <refname>intel_uncore_forcewake_get__locked</refname>
38082 <refpurpose>
38083     grab forcewake domain references
38084 </refpurpose>
38085</refnamediv>
38086<refsynopsisdiv>
38087 <title>Synopsis</title>
38088  <funcsynopsis><funcprototype>
38089   <funcdef>void <function>intel_uncore_forcewake_get__locked </function></funcdef>
38090   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
38091   <paramdef>enum forcewake_domains <parameter>fw_domains</parameter></paramdef>
38092  </funcprototype></funcsynopsis>
38093</refsynopsisdiv>
38094<refsect1>
38095 <title>Arguments</title>
38096 <variablelist>
38097  <varlistentry>
38098   <term><parameter>dev_priv</parameter></term>
38099   <listitem>
38100    <para>
38101     i915 device instance
38102    </para>
38103   </listitem>
38104  </varlistentry>
38105  <varlistentry>
38106   <term><parameter>fw_domains</parameter></term>
38107   <listitem>
38108    <para>
38109     forcewake domains to get reference on
38110    </para>
38111   </listitem>
38112  </varlistentry>
38113 </variablelist>
38114</refsect1>
38115<refsect1>
38116<title>Description</title>
38117<para>
38118   See <function>intel_uncore_forcewake_get</function>. This variant places the onus
38119   on the caller to explicitly handle the dev_priv-&gt;uncore.lock spinlock.
38120</para>
38121</refsect1>
38122</refentry>
38123
38124<refentry id="API-intel-uncore-forcewake-put">
38125<refentryinfo>
38126 <title>LINUX</title>
38127 <productname>Kernel Hackers Manual</productname>
38128 <date>July 2017</date>
38129</refentryinfo>
38130<refmeta>
38131 <refentrytitle><phrase>intel_uncore_forcewake_put</phrase></refentrytitle>
38132 <manvolnum>9</manvolnum>
38133 <refmiscinfo class="version">4.4.14</refmiscinfo>
38134</refmeta>
38135<refnamediv>
38136 <refname>intel_uncore_forcewake_put</refname>
38137 <refpurpose>
38138     release a forcewake domain reference
38139 </refpurpose>
38140</refnamediv>
38141<refsynopsisdiv>
38142 <title>Synopsis</title>
38143  <funcsynopsis><funcprototype>
38144   <funcdef>void <function>intel_uncore_forcewake_put </function></funcdef>
38145   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
38146   <paramdef>enum forcewake_domains <parameter>fw_domains</parameter></paramdef>
38147  </funcprototype></funcsynopsis>
38148</refsynopsisdiv>
38149<refsect1>
38150 <title>Arguments</title>
38151 <variablelist>
38152  <varlistentry>
38153   <term><parameter>dev_priv</parameter></term>
38154   <listitem>
38155    <para>
38156     i915 device instance
38157    </para>
38158   </listitem>
38159  </varlistentry>
38160  <varlistentry>
38161   <term><parameter>fw_domains</parameter></term>
38162   <listitem>
38163    <para>
38164     forcewake domains to put references
38165    </para>
38166   </listitem>
38167  </varlistentry>
38168 </variablelist>
38169</refsect1>
38170<refsect1>
38171<title>Description</title>
38172<para>
38173   This function drops the device-level forcewakes for specified
38174   domains obtained by <function>intel_uncore_forcewake_get</function>.
38175</para>
38176</refsect1>
38177</refentry>
38178
38179<refentry id="API-intel-uncore-forcewake-put--locked">
38180<refentryinfo>
38181 <title>LINUX</title>
38182 <productname>Kernel Hackers Manual</productname>
38183 <date>July 2017</date>
38184</refentryinfo>
38185<refmeta>
38186 <refentrytitle><phrase>intel_uncore_forcewake_put__locked</phrase></refentrytitle>
38187 <manvolnum>9</manvolnum>
38188 <refmiscinfo class="version">4.4.14</refmiscinfo>
38189</refmeta>
38190<refnamediv>
38191 <refname>intel_uncore_forcewake_put__locked</refname>
38192 <refpurpose>
38193     grab forcewake domain references
38194 </refpurpose>
38195</refnamediv>
38196<refsynopsisdiv>
38197 <title>Synopsis</title>
38198  <funcsynopsis><funcprototype>
38199   <funcdef>void <function>intel_uncore_forcewake_put__locked </function></funcdef>
38200   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
38201   <paramdef>enum forcewake_domains <parameter>fw_domains</parameter></paramdef>
38202  </funcprototype></funcsynopsis>
38203</refsynopsisdiv>
38204<refsect1>
38205 <title>Arguments</title>
38206 <variablelist>
38207  <varlistentry>
38208   <term><parameter>dev_priv</parameter></term>
38209   <listitem>
38210    <para>
38211     i915 device instance
38212    </para>
38213   </listitem>
38214  </varlistentry>
38215  <varlistentry>
38216   <term><parameter>fw_domains</parameter></term>
38217   <listitem>
38218    <para>
38219     forcewake domains to get reference on
38220    </para>
38221   </listitem>
38222  </varlistentry>
38223 </variablelist>
38224</refsect1>
38225<refsect1>
38226<title>Description</title>
38227<para>
38228   See <function>intel_uncore_forcewake_put</function>. This variant places the onus
38229   on the caller to explicitly handle the dev_priv-&gt;uncore.lock spinlock.
38230</para>
38231</refsect1>
38232</refentry>
38233
38234      </sect2>
38235      <sect2>
38236        <title>Interrupt Handling</title>
38237<para>
38238   </para><para>
38239   These functions provide the basic support for enabling and disabling the
38240   interrupt handling support. There's a lot more functionality in i915_irq.c
38241   and related files, but that will be described in separate chapters.
38242</para>
38243
38244<refentry id="API-intel-irq-init">
38245<refentryinfo>
38246 <title>LINUX</title>
38247 <productname>Kernel Hackers Manual</productname>
38248 <date>July 2017</date>
38249</refentryinfo>
38250<refmeta>
38251 <refentrytitle><phrase>intel_irq_init</phrase></refentrytitle>
38252 <manvolnum>9</manvolnum>
38253 <refmiscinfo class="version">4.4.14</refmiscinfo>
38254</refmeta>
38255<refnamediv>
38256 <refname>intel_irq_init</refname>
38257 <refpurpose>
38258  initializes irq support
38259 </refpurpose>
38260</refnamediv>
38261<refsynopsisdiv>
38262 <title>Synopsis</title>
38263  <funcsynopsis><funcprototype>
38264   <funcdef>void <function>intel_irq_init </function></funcdef>
38265   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
38266  </funcprototype></funcsynopsis>
38267</refsynopsisdiv>
38268<refsect1>
38269 <title>Arguments</title>
38270 <variablelist>
38271  <varlistentry>
38272   <term><parameter>dev_priv</parameter></term>
38273   <listitem>
38274    <para>
38275     i915 device instance
38276    </para>
38277   </listitem>
38278  </varlistentry>
38279 </variablelist>
38280</refsect1>
38281<refsect1>
38282<title>Description</title>
38283<para>
38284   This function initializes all the irq support including work items, timers
38285   and all the vtables. It does not setup the interrupt itself though.
38286</para>
38287</refsect1>
38288</refentry>
38289
38290<refentry id="API-intel-runtime-pm-disable-interrupts">
38291<refentryinfo>
38292 <title>LINUX</title>
38293 <productname>Kernel Hackers Manual</productname>
38294 <date>July 2017</date>
38295</refentryinfo>
38296<refmeta>
38297 <refentrytitle><phrase>intel_runtime_pm_disable_interrupts</phrase></refentrytitle>
38298 <manvolnum>9</manvolnum>
38299 <refmiscinfo class="version">4.4.14</refmiscinfo>
38300</refmeta>
38301<refnamediv>
38302 <refname>intel_runtime_pm_disable_interrupts</refname>
38303 <refpurpose>
38304  runtime interrupt disabling
38305 </refpurpose>
38306</refnamediv>
38307<refsynopsisdiv>
38308 <title>Synopsis</title>
38309  <funcsynopsis><funcprototype>
38310   <funcdef>void <function>intel_runtime_pm_disable_interrupts </function></funcdef>
38311   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
38312  </funcprototype></funcsynopsis>
38313</refsynopsisdiv>
38314<refsect1>
38315 <title>Arguments</title>
38316 <variablelist>
38317  <varlistentry>
38318   <term><parameter>dev_priv</parameter></term>
38319   <listitem>
38320    <para>
38321     i915 device instance
38322    </para>
38323   </listitem>
38324  </varlistentry>
38325 </variablelist>
38326</refsect1>
38327<refsect1>
38328<title>Description</title>
38329<para>
38330   This function is used to disable interrupts at runtime, both in the runtime
38331   pm and the system suspend/resume code.
38332</para>
38333</refsect1>
38334</refentry>
38335
38336<refentry id="API-intel-runtime-pm-enable-interrupts">
38337<refentryinfo>
38338 <title>LINUX</title>
38339 <productname>Kernel Hackers Manual</productname>
38340 <date>July 2017</date>
38341</refentryinfo>
38342<refmeta>
38343 <refentrytitle><phrase>intel_runtime_pm_enable_interrupts</phrase></refentrytitle>
38344 <manvolnum>9</manvolnum>
38345 <refmiscinfo class="version">4.4.14</refmiscinfo>
38346</refmeta>
38347<refnamediv>
38348 <refname>intel_runtime_pm_enable_interrupts</refname>
38349 <refpurpose>
38350  runtime interrupt enabling
38351 </refpurpose>
38352</refnamediv>
38353<refsynopsisdiv>
38354 <title>Synopsis</title>
38355  <funcsynopsis><funcprototype>
38356   <funcdef>void <function>intel_runtime_pm_enable_interrupts </function></funcdef>
38357   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
38358  </funcprototype></funcsynopsis>
38359</refsynopsisdiv>
38360<refsect1>
38361 <title>Arguments</title>
38362 <variablelist>
38363  <varlistentry>
38364   <term><parameter>dev_priv</parameter></term>
38365   <listitem>
38366    <para>
38367     i915 device instance
38368    </para>
38369   </listitem>
38370  </varlistentry>
38371 </variablelist>
38372</refsect1>
38373<refsect1>
38374<title>Description</title>
38375<para>
38376   This function is used to enable interrupts at runtime, both in the runtime
38377   pm and the system suspend/resume code.
38378</para>
38379</refsect1>
38380</refentry>
38381
38382      </sect2>
38383      <sect2>
38384        <title>Intel GVT-g Guest Support(vGPU)</title>
38385<para>
38386   </para><para>
38387   Intel GVT-g is a graphics virtualization technology which shares the
38388   GPU among multiple virtual machines on a time-sharing basis. Each
38389   virtual machine is presented a virtual GPU (vGPU), which has equivalent
38390   features as the underlying physical GPU (pGPU), so i915 driver can run
38391   seamlessly in a virtual machine. This file provides vGPU specific
38392   optimizations when running in a virtual machine, to reduce the complexity
38393   of vGPU emulation and to improve the overall performance.
38394   </para><para>
38395   A primary function introduced here is so-called <quote>address space ballooning</quote>
38396   technique. Intel GVT-g partitions global graphics memory among multiple VMs,
38397   so each VM can directly access a portion of the memory without hypervisor's
38398   intervention, e.g. filling textures or queuing commands. However with the
38399   partitioning an unmodified i915 driver would assume a smaller graphics
38400   memory starting from address ZERO, then requires vGPU emulation module to
38401   translate the graphics address between 'guest view' and 'host view', for
38402   all registers and command opcodes which contain a graphics memory address.
38403   To reduce the complexity, Intel GVT-g introduces <quote>address space ballooning</quote>,
38404   by telling the exact partitioning knowledge to each guest i915 driver, which
38405   then reserves and prevents non-allocated portions from allocation. Thus vGPU
38406   emulation module only needs to scan and validate graphics addresses without
38407   complexity of address translation.
38408   </para><para>
38409</para>
38410
38411<!-- drivers/gpu/drm/i915/i915_vgpu.c -->
38412<refentry id="API-i915-check-vgpu">
38413<refentryinfo>
38414 <title>LINUX</title>
38415 <productname>Kernel Hackers Manual</productname>
38416 <date>July 2017</date>
38417</refentryinfo>
38418<refmeta>
38419 <refentrytitle><phrase>i915_check_vgpu</phrase></refentrytitle>
38420 <manvolnum>9</manvolnum>
38421 <refmiscinfo class="version">4.4.14</refmiscinfo>
38422</refmeta>
38423<refnamediv>
38424 <refname>i915_check_vgpu</refname>
38425 <refpurpose>
38426  detect virtual GPU
38427 </refpurpose>
38428</refnamediv>
38429<refsynopsisdiv>
38430 <title>Synopsis</title>
38431  <funcsynopsis><funcprototype>
38432   <funcdef>void <function>i915_check_vgpu </function></funcdef>
38433   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
38434  </funcprototype></funcsynopsis>
38435</refsynopsisdiv>
38436<refsect1>
38437 <title>Arguments</title>
38438 <variablelist>
38439  <varlistentry>
38440   <term><parameter>dev</parameter></term>
38441   <listitem>
38442    <para>
38443     drm device *
38444    </para>
38445   </listitem>
38446  </varlistentry>
38447 </variablelist>
38448</refsect1>
38449<refsect1>
38450<title>Description</title>
38451<para>
38452   This function is called at the initialization stage, to detect whether
38453   running on a vGPU.
38454</para>
38455</refsect1>
38456</refentry>
38457
38458<refentry id="API-intel-vgt-deballoon">
38459<refentryinfo>
38460 <title>LINUX</title>
38461 <productname>Kernel Hackers Manual</productname>
38462 <date>July 2017</date>
38463</refentryinfo>
38464<refmeta>
38465 <refentrytitle><phrase>intel_vgt_deballoon</phrase></refentrytitle>
38466 <manvolnum>9</manvolnum>
38467 <refmiscinfo class="version">4.4.14</refmiscinfo>
38468</refmeta>
38469<refnamediv>
38470 <refname>intel_vgt_deballoon</refname>
38471 <refpurpose>
38472     deballoon reserved graphics address trunks
38473 </refpurpose>
38474</refnamediv>
38475<refsynopsisdiv>
38476 <title>Synopsis</title>
38477  <funcsynopsis><funcprototype>
38478   <funcdef>void <function>intel_vgt_deballoon </function></funcdef>
38479   <paramdef> <parameter>void</parameter></paramdef>
38480  </funcprototype></funcsynopsis>
38481</refsynopsisdiv>
38482<refsect1>
38483 <title>Arguments</title>
38484 <variablelist>
38485  <varlistentry>
38486   <term><parameter>void</parameter></term>
38487   <listitem>
38488    <para>
38489     no arguments
38490    </para>
38491   </listitem>
38492  </varlistentry>
38493 </variablelist>
38494</refsect1>
38495<refsect1>
38496<title>Description</title>
38497<para>
38498   </para><para>
38499
38500   This function is called to deallocate the ballooned-out graphic memory, when
38501   driver is unloaded or when ballooning fails.
38502</para>
38503</refsect1>
38504</refentry>
38505
38506<refentry id="API-intel-vgt-balloon">
38507<refentryinfo>
38508 <title>LINUX</title>
38509 <productname>Kernel Hackers Manual</productname>
38510 <date>July 2017</date>
38511</refentryinfo>
38512<refmeta>
38513 <refentrytitle><phrase>intel_vgt_balloon</phrase></refentrytitle>
38514 <manvolnum>9</manvolnum>
38515 <refmiscinfo class="version">4.4.14</refmiscinfo>
38516</refmeta>
38517<refnamediv>
38518 <refname>intel_vgt_balloon</refname>
38519 <refpurpose>
38520     balloon out reserved graphics address trunks
38521 </refpurpose>
38522</refnamediv>
38523<refsynopsisdiv>
38524 <title>Synopsis</title>
38525  <funcsynopsis><funcprototype>
38526   <funcdef>int <function>intel_vgt_balloon </function></funcdef>
38527   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
38528  </funcprototype></funcsynopsis>
38529</refsynopsisdiv>
38530<refsect1>
38531 <title>Arguments</title>
38532 <variablelist>
38533  <varlistentry>
38534   <term><parameter>dev</parameter></term>
38535   <listitem>
38536    <para>
38537     drm device
38538    </para>
38539   </listitem>
38540  </varlistentry>
38541 </variablelist>
38542</refsect1>
38543<refsect1>
38544<title>Description</title>
38545<para>
38546   This function is called at the initialization stage, to balloon out the
38547   graphic address space allocated to other vGPUs, by marking these spaces as
38548   reserved. The ballooning related knowledge(starting address and size of
38549   the mappable/unmappable graphic memory) is described in the vgt_if structure
38550   in a reserved mmio range.
38551   </para><para>
38552
38553   To give an example, the drawing below depicts one typical scenario after
38554   ballooning. Here the vGPU1 has 2 pieces of graphic address spaces ballooned
38555   out each for the mappable and the non-mappable part. From the vGPU1 point of
38556   view, the total size is the same as the physical one, with the start address
38557   of its graphic space being zero. Yet there are some portions ballooned out(
38558   the shadow part, which are marked as reserved by drm allocator). From the
38559   host point of view, the graphic address space is partitioned by multiple
38560   vGPUs in different VMs.
38561   </para><para>
38562
38563   vGPU1 view         Host view
38564   0 ------&gt; +-----------+     +-----------+
38565   ^       |///////////|     |   vGPU3   |
38566   |       |///////////|     +-----------+
38567   |       |///////////|     |   vGPU2   |
38568   |       +-----------+     +-----------+
38569   mappable GM    | available | ==&gt; |   vGPU1   |
38570   |       +-----------+     +-----------+
38571   |       |///////////|     |           |
38572   v       |///////////|     |   Host    |
38573   +=======+===========+     +===========+
38574   ^       |///////////|     |   vGPU3   |
38575   |       |///////////|     +-----------+
38576   |       |///////////|     |   vGPU2   |
38577   |       +-----------+     +-----------+
38578   unmappable GM    | available | ==&gt; |   vGPU1   |
38579   |       +-----------+     +-----------+
38580   |       |///////////|     |           |
38581   |       |///////////|     |   Host    |
38582   v       |///////////|     |           |
38583   total GM size ------&gt; +-----------+     +-----------+
38584</para>
38585</refsect1>
38586<refsect1>
38587<title>Returns</title>
38588<para>
38589   zero on success, non-zero if configuration invalid or ballooning failed
38590</para>
38591</refsect1>
38592</refentry>
38593
38594      </sect2>
38595    </sect1>
38596    <sect1>
38597      <title>Display Hardware Handling</title>
38598      <para>
38599        This section covers everything related to the display hardware including
38600        the mode setting infrastructure, plane, sprite and cursor handling and
38601        display, output probing and related topics.
38602      </para>
38603      <sect2>
38604        <title>Mode Setting Infrastructure</title>
38605        <para>
38606          The i915 driver is thus far the only DRM driver which doesn't use the
38607          common DRM helper code to implement mode setting sequences. Thus it
38608          has its own tailor-made infrastructure for executing a display
38609          configuration change.
38610        </para>
38611      </sect2>
38612      <sect2>
38613        <title>Frontbuffer Tracking</title>
38614<para>
38615   </para><para>
38616   Many features require us to track changes to the currently active
38617   frontbuffer, especially rendering targeted at the frontbuffer.
38618   </para><para>
38619   To be able to do so GEM tracks frontbuffers using a bitmask for all possible
38620   frontbuffer slots through <function>i915_gem_track_fb</function>. The function in this file are
38621   then called when the contents of the frontbuffer are invalidated, when
38622   frontbuffer rendering has stopped again to flush out all the changes and when
38623   the frontbuffer is exchanged with a flip. Subsystems interested in
38624   frontbuffer changes (e.g. PSR, FBC, DRRS) should directly put their callbacks
38625   into the relevant places and filter for the frontbuffer slots that they are
38626   interested int.
38627   </para><para>
38628   On a high level there are two types of powersaving features. The first one
38629   work like a special cache (FBC and PSR) and are interested when they should
38630   stop caching and when to restart caching. This is done by placing callbacks
38631   into the invalidate and the flush functions: At invalidate the caching must
38632   be stopped and at flush time it can be restarted. And maybe they need to know
38633   when the frontbuffer changes (e.g. when the hw doesn't initiate an invalidate
38634   and flush on its own) which can be achieved with placing callbacks into the
38635   flip functions.
38636   </para><para>
38637   The other type of display power saving feature only cares about busyness
38638   (e.g. DRRS). In that case all three (invalidate, flush and flip) indicate
38639   busyness. There is no direct way to detect idleness. Instead an idle timer
38640   work delayed work should be started from the flush and flip functions and
38641   cancelled as soon as busyness is detected.
38642   </para><para>
38643   Note that there's also an older frontbuffer activity tracking scheme which
38644   just tracks general activity. This is done by the various mark_busy and
38645   mark_idle functions. For display power management features using these
38646   functions is deprecated and should be avoided.
38647</para>
38648
38649<!-- drivers/gpu/drm/i915/intel_frontbuffer.c -->
38650<refentry id="API-intel-fb-obj-invalidate">
38651<refentryinfo>
38652 <title>LINUX</title>
38653 <productname>Kernel Hackers Manual</productname>
38654 <date>July 2017</date>
38655</refentryinfo>
38656<refmeta>
38657 <refentrytitle><phrase>intel_fb_obj_invalidate</phrase></refentrytitle>
38658 <manvolnum>9</manvolnum>
38659 <refmiscinfo class="version">4.4.14</refmiscinfo>
38660</refmeta>
38661<refnamediv>
38662 <refname>intel_fb_obj_invalidate</refname>
38663 <refpurpose>
38664  invalidate frontbuffer object
38665 </refpurpose>
38666</refnamediv>
38667<refsynopsisdiv>
38668 <title>Synopsis</title>
38669  <funcsynopsis><funcprototype>
38670   <funcdef>void <function>intel_fb_obj_invalidate </function></funcdef>
38671   <paramdef>struct drm_i915_gem_object * <parameter>obj</parameter></paramdef>
38672   <paramdef>enum fb_op_origin <parameter>origin</parameter></paramdef>
38673  </funcprototype></funcsynopsis>
38674</refsynopsisdiv>
38675<refsect1>
38676 <title>Arguments</title>
38677 <variablelist>
38678  <varlistentry>
38679   <term><parameter>obj</parameter></term>
38680   <listitem>
38681    <para>
38682     GEM object to invalidate
38683    </para>
38684   </listitem>
38685  </varlistentry>
38686  <varlistentry>
38687   <term><parameter>origin</parameter></term>
38688   <listitem>
38689    <para>
38690     which operation caused the invalidation
38691    </para>
38692   </listitem>
38693  </varlistentry>
38694 </variablelist>
38695</refsect1>
38696<refsect1>
38697<title>Description</title>
38698<para>
38699   This function gets called every time rendering on the given object starts and
38700   frontbuffer caching (fbc, low refresh rate for DRRS, panel self refresh) must
38701   be invalidated. For ORIGIN_CS any subsequent invalidation will be delayed
38702   until the rendering completes or a flip on this frontbuffer plane is
38703   scheduled.
38704</para>
38705</refsect1>
38706</refentry>
38707
38708<refentry id="API-intel-frontbuffer-flush">
38709<refentryinfo>
38710 <title>LINUX</title>
38711 <productname>Kernel Hackers Manual</productname>
38712 <date>July 2017</date>
38713</refentryinfo>
38714<refmeta>
38715 <refentrytitle><phrase>intel_frontbuffer_flush</phrase></refentrytitle>
38716 <manvolnum>9</manvolnum>
38717 <refmiscinfo class="version">4.4.14</refmiscinfo>
38718</refmeta>
38719<refnamediv>
38720 <refname>intel_frontbuffer_flush</refname>
38721 <refpurpose>
38722     flush frontbuffer
38723 </refpurpose>
38724</refnamediv>
38725<refsynopsisdiv>
38726 <title>Synopsis</title>
38727  <funcsynopsis><funcprototype>
38728   <funcdef>void <function>intel_frontbuffer_flush </function></funcdef>
38729   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
38730   <paramdef>unsigned <parameter>frontbuffer_bits</parameter></paramdef>
38731   <paramdef>enum fb_op_origin <parameter>origin</parameter></paramdef>
38732  </funcprototype></funcsynopsis>
38733</refsynopsisdiv>
38734<refsect1>
38735 <title>Arguments</title>
38736 <variablelist>
38737  <varlistentry>
38738   <term><parameter>dev</parameter></term>
38739   <listitem>
38740    <para>
38741     DRM device
38742    </para>
38743   </listitem>
38744  </varlistentry>
38745  <varlistentry>
38746   <term><parameter>frontbuffer_bits</parameter></term>
38747   <listitem>
38748    <para>
38749     frontbuffer plane tracking bits
38750    </para>
38751   </listitem>
38752  </varlistentry>
38753  <varlistentry>
38754   <term><parameter>origin</parameter></term>
38755   <listitem>
38756    <para>
38757     which operation caused the flush
38758    </para>
38759   </listitem>
38760  </varlistentry>
38761 </variablelist>
38762</refsect1>
38763<refsect1>
38764<title>Description</title>
38765<para>
38766   This function gets called every time rendering on the given planes has
38767   completed and frontbuffer caching can be started again. Flushes will get
38768   delayed if they're blocked by some outstanding asynchronous rendering.
38769   </para><para>
38770
38771   Can be called without any locks held.
38772</para>
38773</refsect1>
38774</refentry>
38775
38776<refentry id="API-intel-fb-obj-flush">
38777<refentryinfo>
38778 <title>LINUX</title>
38779 <productname>Kernel Hackers Manual</productname>
38780 <date>July 2017</date>
38781</refentryinfo>
38782<refmeta>
38783 <refentrytitle><phrase>intel_fb_obj_flush</phrase></refentrytitle>
38784 <manvolnum>9</manvolnum>
38785 <refmiscinfo class="version">4.4.14</refmiscinfo>
38786</refmeta>
38787<refnamediv>
38788 <refname>intel_fb_obj_flush</refname>
38789 <refpurpose>
38790     flush frontbuffer object
38791 </refpurpose>
38792</refnamediv>
38793<refsynopsisdiv>
38794 <title>Synopsis</title>
38795  <funcsynopsis><funcprototype>
38796   <funcdef>void <function>intel_fb_obj_flush </function></funcdef>
38797   <paramdef>struct drm_i915_gem_object * <parameter>obj</parameter></paramdef>
38798   <paramdef>bool <parameter>retire</parameter></paramdef>
38799   <paramdef>enum fb_op_origin <parameter>origin</parameter></paramdef>
38800  </funcprototype></funcsynopsis>
38801</refsynopsisdiv>
38802<refsect1>
38803 <title>Arguments</title>
38804 <variablelist>
38805  <varlistentry>
38806   <term><parameter>obj</parameter></term>
38807   <listitem>
38808    <para>
38809     GEM object to flush
38810    </para>
38811   </listitem>
38812  </varlistentry>
38813  <varlistentry>
38814   <term><parameter>retire</parameter></term>
38815   <listitem>
38816    <para>
38817     set when retiring asynchronous rendering
38818    </para>
38819   </listitem>
38820  </varlistentry>
38821  <varlistentry>
38822   <term><parameter>origin</parameter></term>
38823   <listitem>
38824    <para>
38825     which operation caused the flush
38826    </para>
38827   </listitem>
38828  </varlistentry>
38829 </variablelist>
38830</refsect1>
38831<refsect1>
38832<title>Description</title>
38833<para>
38834   This function gets called every time rendering on the given object has
38835   completed and frontbuffer caching can be started again. If <parameter>retire</parameter> is true
38836   then any delayed flushes will be unblocked.
38837</para>
38838</refsect1>
38839</refentry>
38840
38841<refentry id="API-intel-frontbuffer-flip-prepare">
38842<refentryinfo>
38843 <title>LINUX</title>
38844 <productname>Kernel Hackers Manual</productname>
38845 <date>July 2017</date>
38846</refentryinfo>
38847<refmeta>
38848 <refentrytitle><phrase>intel_frontbuffer_flip_prepare</phrase></refentrytitle>
38849 <manvolnum>9</manvolnum>
38850 <refmiscinfo class="version">4.4.14</refmiscinfo>
38851</refmeta>
38852<refnamediv>
38853 <refname>intel_frontbuffer_flip_prepare</refname>
38854 <refpurpose>
38855     prepare asynchronous frontbuffer flip
38856 </refpurpose>
38857</refnamediv>
38858<refsynopsisdiv>
38859 <title>Synopsis</title>
38860  <funcsynopsis><funcprototype>
38861   <funcdef>void <function>intel_frontbuffer_flip_prepare </function></funcdef>
38862   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
38863   <paramdef>unsigned <parameter>frontbuffer_bits</parameter></paramdef>
38864  </funcprototype></funcsynopsis>
38865</refsynopsisdiv>
38866<refsect1>
38867 <title>Arguments</title>
38868 <variablelist>
38869  <varlistentry>
38870   <term><parameter>dev</parameter></term>
38871   <listitem>
38872    <para>
38873     DRM device
38874    </para>
38875   </listitem>
38876  </varlistentry>
38877  <varlistentry>
38878   <term><parameter>frontbuffer_bits</parameter></term>
38879   <listitem>
38880    <para>
38881     frontbuffer plane tracking bits
38882    </para>
38883   </listitem>
38884  </varlistentry>
38885 </variablelist>
38886</refsect1>
38887<refsect1>
38888<title>Description</title>
38889<para>
38890   This function gets called after scheduling a flip on <parameter>obj</parameter>. The actual
38891   frontbuffer flushing will be delayed until completion is signalled with
38892   intel_frontbuffer_flip_complete. If an invalidate happens in between this
38893   flush will be cancelled.
38894   </para><para>
38895
38896   Can be called without any locks held.
38897</para>
38898</refsect1>
38899</refentry>
38900
38901<refentry id="API-intel-frontbuffer-flip-complete">
38902<refentryinfo>
38903 <title>LINUX</title>
38904 <productname>Kernel Hackers Manual</productname>
38905 <date>July 2017</date>
38906</refentryinfo>
38907<refmeta>
38908 <refentrytitle><phrase>intel_frontbuffer_flip_complete</phrase></refentrytitle>
38909 <manvolnum>9</manvolnum>
38910 <refmiscinfo class="version">4.4.14</refmiscinfo>
38911</refmeta>
38912<refnamediv>
38913 <refname>intel_frontbuffer_flip_complete</refname>
38914 <refpurpose>
38915     complete asynchronous frontbuffer flip
38916 </refpurpose>
38917</refnamediv>
38918<refsynopsisdiv>
38919 <title>Synopsis</title>
38920  <funcsynopsis><funcprototype>
38921   <funcdef>void <function>intel_frontbuffer_flip_complete </function></funcdef>
38922   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
38923   <paramdef>unsigned <parameter>frontbuffer_bits</parameter></paramdef>
38924  </funcprototype></funcsynopsis>
38925</refsynopsisdiv>
38926<refsect1>
38927 <title>Arguments</title>
38928 <variablelist>
38929  <varlistentry>
38930   <term><parameter>dev</parameter></term>
38931   <listitem>
38932    <para>
38933     DRM device
38934    </para>
38935   </listitem>
38936  </varlistentry>
38937  <varlistentry>
38938   <term><parameter>frontbuffer_bits</parameter></term>
38939   <listitem>
38940    <para>
38941     frontbuffer plane tracking bits
38942    </para>
38943   </listitem>
38944  </varlistentry>
38945 </variablelist>
38946</refsect1>
38947<refsect1>
38948<title>Description</title>
38949<para>
38950   This function gets called after the flip has been latched and will complete
38951   on the next vblank. It will execute the flush if it hasn't been cancelled yet.
38952   </para><para>
38953
38954   Can be called without any locks held.
38955</para>
38956</refsect1>
38957</refentry>
38958
38959<refentry id="API-intel-frontbuffer-flip">
38960<refentryinfo>
38961 <title>LINUX</title>
38962 <productname>Kernel Hackers Manual</productname>
38963 <date>July 2017</date>
38964</refentryinfo>
38965<refmeta>
38966 <refentrytitle><phrase>intel_frontbuffer_flip</phrase></refentrytitle>
38967 <manvolnum>9</manvolnum>
38968 <refmiscinfo class="version">4.4.14</refmiscinfo>
38969</refmeta>
38970<refnamediv>
38971 <refname>intel_frontbuffer_flip</refname>
38972 <refpurpose>
38973     synchronous frontbuffer flip
38974 </refpurpose>
38975</refnamediv>
38976<refsynopsisdiv>
38977 <title>Synopsis</title>
38978  <funcsynopsis><funcprototype>
38979   <funcdef>void <function>intel_frontbuffer_flip </function></funcdef>
38980   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
38981   <paramdef>unsigned <parameter>frontbuffer_bits</parameter></paramdef>
38982  </funcprototype></funcsynopsis>
38983</refsynopsisdiv>
38984<refsect1>
38985 <title>Arguments</title>
38986 <variablelist>
38987  <varlistentry>
38988   <term><parameter>dev</parameter></term>
38989   <listitem>
38990    <para>
38991     DRM device
38992    </para>
38993   </listitem>
38994  </varlistentry>
38995  <varlistentry>
38996   <term><parameter>frontbuffer_bits</parameter></term>
38997   <listitem>
38998    <para>
38999     frontbuffer plane tracking bits
39000    </para>
39001   </listitem>
39002  </varlistentry>
39003 </variablelist>
39004</refsect1>
39005<refsect1>
39006<title>Description</title>
39007<para>
39008   This function gets called after scheduling a flip on <parameter>obj</parameter>. This is for
39009   synchronous plane updates which will happen on the next vblank and which will
39010   not get delayed by pending gpu rendering.
39011   </para><para>
39012
39013   Can be called without any locks held.
39014</para>
39015</refsect1>
39016</refentry>
39017
39018<refentry id="API-i915-gem-track-fb">
39019<refentryinfo>
39020 <title>LINUX</title>
39021 <productname>Kernel Hackers Manual</productname>
39022 <date>July 2017</date>
39023</refentryinfo>
39024<refmeta>
39025 <refentrytitle><phrase>i915_gem_track_fb</phrase></refentrytitle>
39026 <manvolnum>9</manvolnum>
39027 <refmiscinfo class="version">4.4.14</refmiscinfo>
39028</refmeta>
39029<refnamediv>
39030 <refname>i915_gem_track_fb</refname>
39031 <refpurpose>
39032  update frontbuffer tracking
39033 </refpurpose>
39034</refnamediv>
39035<refsynopsisdiv>
39036 <title>Synopsis</title>
39037  <funcsynopsis><funcprototype>
39038   <funcdef>void <function>i915_gem_track_fb </function></funcdef>
39039   <paramdef>struct drm_i915_gem_object * <parameter>old</parameter></paramdef>
39040   <paramdef>struct drm_i915_gem_object * <parameter>new</parameter></paramdef>
39041   <paramdef>unsigned <parameter>frontbuffer_bits</parameter></paramdef>
39042  </funcprototype></funcsynopsis>
39043</refsynopsisdiv>
39044<refsect1>
39045 <title>Arguments</title>
39046 <variablelist>
39047  <varlistentry>
39048   <term><parameter>old</parameter></term>
39049   <listitem>
39050    <para>
39051     current GEM buffer for the frontbuffer slots
39052    </para>
39053   </listitem>
39054  </varlistentry>
39055  <varlistentry>
39056   <term><parameter>new</parameter></term>
39057   <listitem>
39058    <para>
39059     new GEM buffer for the frontbuffer slots
39060    </para>
39061   </listitem>
39062  </varlistentry>
39063  <varlistentry>
39064   <term><parameter>frontbuffer_bits</parameter></term>
39065   <listitem>
39066    <para>
39067     bitmask of frontbuffer slots
39068    </para>
39069   </listitem>
39070  </varlistentry>
39071 </variablelist>
39072</refsect1>
39073<refsect1>
39074<title>Description</title>
39075<para>
39076   This updates the frontbuffer tracking bits <parameter>frontbuffer_bits</parameter> by clearing them
39077   from <parameter>old</parameter> and setting them in <parameter>new</parameter>. Both <parameter>old</parameter> and <parameter>new</parameter> can be NULL.
39078</para>
39079</refsect1>
39080</refentry>
39081
39082      </sect2>
39083      <sect2>
39084        <title>Display FIFO Underrun Reporting</title>
39085<para>
39086   </para><para>
39087   The i915 driver checks for display fifo underruns using the interrupt signals
39088   provided by the hardware. This is enabled by default and fairly useful to
39089   debug display issues, especially watermark settings.
39090   </para><para>
39091   If an underrun is detected this is logged into dmesg. To avoid flooding logs
39092   and occupying the cpu underrun interrupts are disabled after the first
39093   occurrence until the next modeset on a given pipe.
39094   </para><para>
39095   Note that underrun detection on gmch platforms is a bit more ugly since there
39096   is no interrupt (despite that the signalling bit is in the PIPESTAT pipe
39097   interrupt register). Also on some other platforms underrun interrupts are
39098   shared, which means that if we detect an underrun we need to disable underrun
39099   reporting on all pipes.
39100   </para><para>
39101   The code also supports underrun detection on the PCH transcoder.
39102</para>
39103
39104<!-- drivers/gpu/drm/i915/intel_fifo_underrun.c -->
39105<refentry id="API-i9xx-check-fifo-underruns">
39106<refentryinfo>
39107 <title>LINUX</title>
39108 <productname>Kernel Hackers Manual</productname>
39109 <date>July 2017</date>
39110</refentryinfo>
39111<refmeta>
39112 <refentrytitle><phrase>i9xx_check_fifo_underruns</phrase></refentrytitle>
39113 <manvolnum>9</manvolnum>
39114 <refmiscinfo class="version">4.4.14</refmiscinfo>
39115</refmeta>
39116<refnamediv>
39117 <refname>i9xx_check_fifo_underruns</refname>
39118 <refpurpose>
39119  check for fifo underruns
39120 </refpurpose>
39121</refnamediv>
39122<refsynopsisdiv>
39123 <title>Synopsis</title>
39124  <funcsynopsis><funcprototype>
39125   <funcdef>void <function>i9xx_check_fifo_underruns </function></funcdef>
39126   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
39127  </funcprototype></funcsynopsis>
39128</refsynopsisdiv>
39129<refsect1>
39130 <title>Arguments</title>
39131 <variablelist>
39132  <varlistentry>
39133   <term><parameter>dev_priv</parameter></term>
39134   <listitem>
39135    <para>
39136     i915 device instance
39137    </para>
39138   </listitem>
39139  </varlistentry>
39140 </variablelist>
39141</refsect1>
39142<refsect1>
39143<title>Description</title>
39144<para>
39145   This function checks for fifo underruns on GMCH platforms. This needs to be
39146   done manually on modeset to make sure that we catch all underruns since they
39147   do not generate an interrupt by themselves on these platforms.
39148</para>
39149</refsect1>
39150</refentry>
39151
39152<refentry id="API-intel-set-cpu-fifo-underrun-reporting">
39153<refentryinfo>
39154 <title>LINUX</title>
39155 <productname>Kernel Hackers Manual</productname>
39156 <date>July 2017</date>
39157</refentryinfo>
39158<refmeta>
39159 <refentrytitle><phrase>intel_set_cpu_fifo_underrun_reporting</phrase></refentrytitle>
39160 <manvolnum>9</manvolnum>
39161 <refmiscinfo class="version">4.4.14</refmiscinfo>
39162</refmeta>
39163<refnamediv>
39164 <refname>intel_set_cpu_fifo_underrun_reporting</refname>
39165 <refpurpose>
39166     set cpu fifo underrrun reporting state
39167 </refpurpose>
39168</refnamediv>
39169<refsynopsisdiv>
39170 <title>Synopsis</title>
39171  <funcsynopsis><funcprototype>
39172   <funcdef>bool <function>intel_set_cpu_fifo_underrun_reporting </function></funcdef>
39173   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
39174   <paramdef>enum pipe <parameter>pipe</parameter></paramdef>
39175   <paramdef>bool <parameter>enable</parameter></paramdef>
39176  </funcprototype></funcsynopsis>
39177</refsynopsisdiv>
39178<refsect1>
39179 <title>Arguments</title>
39180 <variablelist>
39181  <varlistentry>
39182   <term><parameter>dev_priv</parameter></term>
39183   <listitem>
39184    <para>
39185     i915 device instance
39186    </para>
39187   </listitem>
39188  </varlistentry>
39189  <varlistentry>
39190   <term><parameter>pipe</parameter></term>
39191   <listitem>
39192    <para>
39193     (CPU) pipe to set state for
39194    </para>
39195   </listitem>
39196  </varlistentry>
39197  <varlistentry>
39198   <term><parameter>enable</parameter></term>
39199   <listitem>
39200    <para>
39201     whether underruns should be reported or not
39202    </para>
39203   </listitem>
39204  </varlistentry>
39205 </variablelist>
39206</refsect1>
39207<refsect1>
39208<title>Description</title>
39209<para>
39210   This function sets the fifo underrun state for <parameter>pipe</parameter>. It is used in the
39211   modeset code to avoid false positives since on many platforms underruns are
39212   expected when disabling or enabling the pipe.
39213   </para><para>
39214
39215   Notice that on some platforms disabling underrun reports for one pipe
39216   disables for all due to shared interrupts. Actual reporting is still per-pipe
39217   though.
39218   </para><para>
39219
39220   Returns the previous state of underrun reporting.
39221</para>
39222</refsect1>
39223</refentry>
39224
39225<refentry id="API-intel-set-pch-fifo-underrun-reporting">
39226<refentryinfo>
39227 <title>LINUX</title>
39228 <productname>Kernel Hackers Manual</productname>
39229 <date>July 2017</date>
39230</refentryinfo>
39231<refmeta>
39232 <refentrytitle><phrase>intel_set_pch_fifo_underrun_reporting</phrase></refentrytitle>
39233 <manvolnum>9</manvolnum>
39234 <refmiscinfo class="version">4.4.14</refmiscinfo>
39235</refmeta>
39236<refnamediv>
39237 <refname>intel_set_pch_fifo_underrun_reporting</refname>
39238 <refpurpose>
39239     set PCH fifo underrun reporting state
39240 </refpurpose>
39241</refnamediv>
39242<refsynopsisdiv>
39243 <title>Synopsis</title>
39244  <funcsynopsis><funcprototype>
39245   <funcdef>bool <function>intel_set_pch_fifo_underrun_reporting </function></funcdef>
39246   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
39247   <paramdef>enum transcoder <parameter>pch_transcoder</parameter></paramdef>
39248   <paramdef>bool <parameter>enable</parameter></paramdef>
39249  </funcprototype></funcsynopsis>
39250</refsynopsisdiv>
39251<refsect1>
39252 <title>Arguments</title>
39253 <variablelist>
39254  <varlistentry>
39255   <term><parameter>dev_priv</parameter></term>
39256   <listitem>
39257    <para>
39258     i915 device instance
39259    </para>
39260   </listitem>
39261  </varlistentry>
39262  <varlistentry>
39263   <term><parameter>pch_transcoder</parameter></term>
39264   <listitem>
39265    <para>
39266     the PCH transcoder (same as pipe on IVB and older)
39267    </para>
39268   </listitem>
39269  </varlistentry>
39270  <varlistentry>
39271   <term><parameter>enable</parameter></term>
39272   <listitem>
39273    <para>
39274     whether underruns should be reported or not
39275    </para>
39276   </listitem>
39277  </varlistentry>
39278 </variablelist>
39279</refsect1>
39280<refsect1>
39281<title>Description</title>
39282<para>
39283   This function makes us disable or enable PCH fifo underruns for a specific
39284   PCH transcoder. Notice that on some PCHs (e.g. CPT/PPT), disabling FIFO
39285   underrun reporting for one transcoder may also disable all the other PCH
39286   error interruts for the other transcoders, due to the fact that there's just
39287   one interrupt mask/enable bit for all the transcoders.
39288   </para><para>
39289
39290   Returns the previous state of underrun reporting.
39291</para>
39292</refsect1>
39293</refentry>
39294
39295<refentry id="API-intel-cpu-fifo-underrun-irq-handler">
39296<refentryinfo>
39297 <title>LINUX</title>
39298 <productname>Kernel Hackers Manual</productname>
39299 <date>July 2017</date>
39300</refentryinfo>
39301<refmeta>
39302 <refentrytitle><phrase>intel_cpu_fifo_underrun_irq_handler</phrase></refentrytitle>
39303 <manvolnum>9</manvolnum>
39304 <refmiscinfo class="version">4.4.14</refmiscinfo>
39305</refmeta>
39306<refnamediv>
39307 <refname>intel_cpu_fifo_underrun_irq_handler</refname>
39308 <refpurpose>
39309     handle CPU fifo underrun interrupt
39310 </refpurpose>
39311</refnamediv>
39312<refsynopsisdiv>
39313 <title>Synopsis</title>
39314  <funcsynopsis><funcprototype>
39315   <funcdef>void <function>intel_cpu_fifo_underrun_irq_handler </function></funcdef>
39316   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
39317   <paramdef>enum pipe <parameter>pipe</parameter></paramdef>
39318  </funcprototype></funcsynopsis>
39319</refsynopsisdiv>
39320<refsect1>
39321 <title>Arguments</title>
39322 <variablelist>
39323  <varlistentry>
39324   <term><parameter>dev_priv</parameter></term>
39325   <listitem>
39326    <para>
39327     i915 device instance
39328    </para>
39329   </listitem>
39330  </varlistentry>
39331  <varlistentry>
39332   <term><parameter>pipe</parameter></term>
39333   <listitem>
39334    <para>
39335     (CPU) pipe to set state for
39336    </para>
39337   </listitem>
39338  </varlistentry>
39339 </variablelist>
39340</refsect1>
39341<refsect1>
39342<title>Description</title>
39343<para>
39344   This handles a CPU fifo underrun interrupt, generating an underrun warning
39345   into dmesg if underrun reporting is enabled and then disables the underrun
39346   interrupt to avoid an irq storm.
39347</para>
39348</refsect1>
39349</refentry>
39350
39351<refentry id="API-intel-pch-fifo-underrun-irq-handler">
39352<refentryinfo>
39353 <title>LINUX</title>
39354 <productname>Kernel Hackers Manual</productname>
39355 <date>July 2017</date>
39356</refentryinfo>
39357<refmeta>
39358 <refentrytitle><phrase>intel_pch_fifo_underrun_irq_handler</phrase></refentrytitle>
39359 <manvolnum>9</manvolnum>
39360 <refmiscinfo class="version">4.4.14</refmiscinfo>
39361</refmeta>
39362<refnamediv>
39363 <refname>intel_pch_fifo_underrun_irq_handler</refname>
39364 <refpurpose>
39365     handle PCH fifo underrun interrupt
39366 </refpurpose>
39367</refnamediv>
39368<refsynopsisdiv>
39369 <title>Synopsis</title>
39370  <funcsynopsis><funcprototype>
39371   <funcdef>void <function>intel_pch_fifo_underrun_irq_handler </function></funcdef>
39372   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
39373   <paramdef>enum transcoder <parameter>pch_transcoder</parameter></paramdef>
39374  </funcprototype></funcsynopsis>
39375</refsynopsisdiv>
39376<refsect1>
39377 <title>Arguments</title>
39378 <variablelist>
39379  <varlistentry>
39380   <term><parameter>dev_priv</parameter></term>
39381   <listitem>
39382    <para>
39383     i915 device instance
39384    </para>
39385   </listitem>
39386  </varlistentry>
39387  <varlistentry>
39388   <term><parameter>pch_transcoder</parameter></term>
39389   <listitem>
39390    <para>
39391     the PCH transcoder (same as pipe on IVB and older)
39392    </para>
39393   </listitem>
39394  </varlistentry>
39395 </variablelist>
39396</refsect1>
39397<refsect1>
39398<title>Description</title>
39399<para>
39400   This handles a PCH fifo underrun interrupt, generating an underrun warning
39401   into dmesg if underrun reporting is enabled and then disables the underrun
39402   interrupt to avoid an irq storm.
39403</para>
39404</refsect1>
39405</refentry>
39406
39407      </sect2>
39408      <sect2>
39409        <title>Plane Configuration</title>
39410        <para>
39411	  This section covers plane configuration and composition with the
39412	  primary plane, sprites, cursors and overlays. This includes the
39413	  infrastructure to do atomic vsync'ed updates of all this state and
39414	  also tightly coupled topics like watermark setup and computation,
39415	  framebuffer compression and panel self refresh.
39416        </para>
39417      </sect2>
39418      <sect2>
39419        <title>Atomic Plane Helpers</title>
39420<para>
39421   </para><para>
39422   The functions here are used by the atomic plane helper functions to
39423   implement legacy plane updates (i.e., drm_plane-&gt;<function>update_plane</function> and
39424   drm_plane-&gt;<function>disable_plane</function>).  This allows plane updates to use the
39425   atomic state infrastructure and perform plane updates as separate
39426   prepare/check/commit/cleanup steps.
39427</para>
39428
39429<!-- drivers/gpu/drm/i915/intel_atomic_plane.c -->
39430<refentry id="API-intel-create-plane-state">
39431<refentryinfo>
39432 <title>LINUX</title>
39433 <productname>Kernel Hackers Manual</productname>
39434 <date>July 2017</date>
39435</refentryinfo>
39436<refmeta>
39437 <refentrytitle><phrase>intel_create_plane_state</phrase></refentrytitle>
39438 <manvolnum>9</manvolnum>
39439 <refmiscinfo class="version">4.4.14</refmiscinfo>
39440</refmeta>
39441<refnamediv>
39442 <refname>intel_create_plane_state</refname>
39443 <refpurpose>
39444  create plane state object
39445 </refpurpose>
39446</refnamediv>
39447<refsynopsisdiv>
39448 <title>Synopsis</title>
39449  <funcsynopsis><funcprototype>
39450   <funcdef>struct intel_plane_state * <function>intel_create_plane_state </function></funcdef>
39451   <paramdef>struct drm_plane * <parameter>plane</parameter></paramdef>
39452  </funcprototype></funcsynopsis>
39453</refsynopsisdiv>
39454<refsect1>
39455 <title>Arguments</title>
39456 <variablelist>
39457  <varlistentry>
39458   <term><parameter>plane</parameter></term>
39459   <listitem>
39460    <para>
39461     drm plane
39462    </para>
39463   </listitem>
39464  </varlistentry>
39465 </variablelist>
39466</refsect1>
39467<refsect1>
39468<title>Description</title>
39469<para>
39470   Allocates a fresh plane state for the given plane and sets some of
39471   the state values to sensible initial values.
39472</para>
39473</refsect1>
39474<refsect1>
39475<title>Returns</title>
39476<para>
39477   A newly allocated plane state, or NULL on failure
39478</para>
39479</refsect1>
39480</refentry>
39481
39482<refentry id="API-intel-plane-duplicate-state">
39483<refentryinfo>
39484 <title>LINUX</title>
39485 <productname>Kernel Hackers Manual</productname>
39486 <date>July 2017</date>
39487</refentryinfo>
39488<refmeta>
39489 <refentrytitle><phrase>intel_plane_duplicate_state</phrase></refentrytitle>
39490 <manvolnum>9</manvolnum>
39491 <refmiscinfo class="version">4.4.14</refmiscinfo>
39492</refmeta>
39493<refnamediv>
39494 <refname>intel_plane_duplicate_state</refname>
39495 <refpurpose>
39496     duplicate plane state
39497 </refpurpose>
39498</refnamediv>
39499<refsynopsisdiv>
39500 <title>Synopsis</title>
39501  <funcsynopsis><funcprototype>
39502   <funcdef>struct drm_plane_state * <function>intel_plane_duplicate_state </function></funcdef>
39503   <paramdef>struct drm_plane * <parameter>plane</parameter></paramdef>
39504  </funcprototype></funcsynopsis>
39505</refsynopsisdiv>
39506<refsect1>
39507 <title>Arguments</title>
39508 <variablelist>
39509  <varlistentry>
39510   <term><parameter>plane</parameter></term>
39511   <listitem>
39512    <para>
39513     drm plane
39514    </para>
39515   </listitem>
39516  </varlistentry>
39517 </variablelist>
39518</refsect1>
39519<refsect1>
39520<title>Description</title>
39521<para>
39522   Allocates and returns a copy of the plane state (both common and
39523   Intel-specific) for the specified plane.
39524</para>
39525</refsect1>
39526<refsect1>
39527<title>Returns</title>
39528<para>
39529   The newly allocated plane state, or NULL on failure.
39530</para>
39531</refsect1>
39532</refentry>
39533
39534<refentry id="API-intel-plane-destroy-state">
39535<refentryinfo>
39536 <title>LINUX</title>
39537 <productname>Kernel Hackers Manual</productname>
39538 <date>July 2017</date>
39539</refentryinfo>
39540<refmeta>
39541 <refentrytitle><phrase>intel_plane_destroy_state</phrase></refentrytitle>
39542 <manvolnum>9</manvolnum>
39543 <refmiscinfo class="version">4.4.14</refmiscinfo>
39544</refmeta>
39545<refnamediv>
39546 <refname>intel_plane_destroy_state</refname>
39547 <refpurpose>
39548     destroy plane state
39549 </refpurpose>
39550</refnamediv>
39551<refsynopsisdiv>
39552 <title>Synopsis</title>
39553  <funcsynopsis><funcprototype>
39554   <funcdef>void <function>intel_plane_destroy_state </function></funcdef>
39555   <paramdef>struct drm_plane * <parameter>plane</parameter></paramdef>
39556   <paramdef>struct drm_plane_state * <parameter>state</parameter></paramdef>
39557  </funcprototype></funcsynopsis>
39558</refsynopsisdiv>
39559<refsect1>
39560 <title>Arguments</title>
39561 <variablelist>
39562  <varlistentry>
39563   <term><parameter>plane</parameter></term>
39564   <listitem>
39565    <para>
39566     drm plane
39567    </para>
39568   </listitem>
39569  </varlistentry>
39570  <varlistentry>
39571   <term><parameter>state</parameter></term>
39572   <listitem>
39573    <para>
39574     state object to destroy
39575    </para>
39576   </listitem>
39577  </varlistentry>
39578 </variablelist>
39579</refsect1>
39580<refsect1>
39581<title>Description</title>
39582<para>
39583   Destroys the plane state (both common and Intel-specific) for the
39584   specified plane.
39585</para>
39586</refsect1>
39587</refentry>
39588
39589<refentry id="API-intel-plane-atomic-get-property">
39590<refentryinfo>
39591 <title>LINUX</title>
39592 <productname>Kernel Hackers Manual</productname>
39593 <date>July 2017</date>
39594</refentryinfo>
39595<refmeta>
39596 <refentrytitle><phrase>intel_plane_atomic_get_property</phrase></refentrytitle>
39597 <manvolnum>9</manvolnum>
39598 <refmiscinfo class="version">4.4.14</refmiscinfo>
39599</refmeta>
39600<refnamediv>
39601 <refname>intel_plane_atomic_get_property</refname>
39602 <refpurpose>
39603     fetch plane property value
39604 </refpurpose>
39605</refnamediv>
39606<refsynopsisdiv>
39607 <title>Synopsis</title>
39608  <funcsynopsis><funcprototype>
39609   <funcdef>int <function>intel_plane_atomic_get_property </function></funcdef>
39610   <paramdef>struct drm_plane * <parameter>plane</parameter></paramdef>
39611   <paramdef>const struct drm_plane_state * <parameter>state</parameter></paramdef>
39612   <paramdef>struct drm_property * <parameter>property</parameter></paramdef>
39613   <paramdef>uint64_t * <parameter>val</parameter></paramdef>
39614  </funcprototype></funcsynopsis>
39615</refsynopsisdiv>
39616<refsect1>
39617 <title>Arguments</title>
39618 <variablelist>
39619  <varlistentry>
39620   <term><parameter>plane</parameter></term>
39621   <listitem>
39622    <para>
39623     plane to fetch property for
39624    </para>
39625   </listitem>
39626  </varlistentry>
39627  <varlistentry>
39628   <term><parameter>state</parameter></term>
39629   <listitem>
39630    <para>
39631     state containing the property value
39632    </para>
39633   </listitem>
39634  </varlistentry>
39635  <varlistentry>
39636   <term><parameter>property</parameter></term>
39637   <listitem>
39638    <para>
39639     property to look up
39640    </para>
39641   </listitem>
39642  </varlistentry>
39643  <varlistentry>
39644   <term><parameter>val</parameter></term>
39645   <listitem>
39646    <para>
39647     pointer to write property value into
39648    </para>
39649   </listitem>
39650  </varlistentry>
39651 </variablelist>
39652</refsect1>
39653<refsect1>
39654<title>Description</title>
39655<para>
39656   The DRM core does not store shadow copies of properties for
39657   atomic-capable drivers.  This entrypoint is used to fetch
39658   the current value of a driver-specific plane property.
39659</para>
39660</refsect1>
39661</refentry>
39662
39663<refentry id="API-intel-plane-atomic-set-property">
39664<refentryinfo>
39665 <title>LINUX</title>
39666 <productname>Kernel Hackers Manual</productname>
39667 <date>July 2017</date>
39668</refentryinfo>
39669<refmeta>
39670 <refentrytitle><phrase>intel_plane_atomic_set_property</phrase></refentrytitle>
39671 <manvolnum>9</manvolnum>
39672 <refmiscinfo class="version">4.4.14</refmiscinfo>
39673</refmeta>
39674<refnamediv>
39675 <refname>intel_plane_atomic_set_property</refname>
39676 <refpurpose>
39677     set plane property value
39678 </refpurpose>
39679</refnamediv>
39680<refsynopsisdiv>
39681 <title>Synopsis</title>
39682  <funcsynopsis><funcprototype>
39683   <funcdef>int <function>intel_plane_atomic_set_property </function></funcdef>
39684   <paramdef>struct drm_plane * <parameter>plane</parameter></paramdef>
39685   <paramdef>struct drm_plane_state * <parameter>state</parameter></paramdef>
39686   <paramdef>struct drm_property * <parameter>property</parameter></paramdef>
39687   <paramdef>uint64_t <parameter>val</parameter></paramdef>
39688  </funcprototype></funcsynopsis>
39689</refsynopsisdiv>
39690<refsect1>
39691 <title>Arguments</title>
39692 <variablelist>
39693  <varlistentry>
39694   <term><parameter>plane</parameter></term>
39695   <listitem>
39696    <para>
39697     plane to set property for
39698    </para>
39699   </listitem>
39700  </varlistentry>
39701  <varlistentry>
39702   <term><parameter>state</parameter></term>
39703   <listitem>
39704    <para>
39705     state to update property value in
39706    </para>
39707   </listitem>
39708  </varlistentry>
39709  <varlistentry>
39710   <term><parameter>property</parameter></term>
39711   <listitem>
39712    <para>
39713     property to set
39714    </para>
39715   </listitem>
39716  </varlistentry>
39717  <varlistentry>
39718   <term><parameter>val</parameter></term>
39719   <listitem>
39720    <para>
39721     value to set property to
39722    </para>
39723   </listitem>
39724  </varlistentry>
39725 </variablelist>
39726</refsect1>
39727<refsect1>
39728<title>Description</title>
39729<para>
39730   Writes the specified property value for a plane into the provided atomic
39731   state object.
39732   </para><para>
39733
39734   Returns 0 on success, -EINVAL on unrecognized properties
39735</para>
39736</refsect1>
39737</refentry>
39738
39739      </sect2>
39740      <sect2>
39741        <title>Output Probing</title>
39742        <para>
39743	  This section covers output probing and related infrastructure like the
39744	  hotplug interrupt storm detection and mitigation code. Note that the
39745	  i915 driver still uses most of the common DRM helper code for output
39746	  probing, so those sections fully apply.
39747        </para>
39748      </sect2>
39749      <sect2>
39750        <title>Hotplug</title>
39751<para>
39752   </para><para>
39753   Simply put, hotplug occurs when a display is connected to or disconnected
39754   from the system. However, there may be adapters and docking stations and
39755   Display Port short pulses and MST devices involved, complicating matters.
39756   </para><para>
39757   Hotplug in i915 is handled in many different levels of abstraction.
39758   </para><para>
39759   The platform dependent interrupt handling code in i915_irq.c enables,
39760   disables, and does preliminary handling of the interrupts. The interrupt
39761   handlers gather the hotplug detect (HPD) information from relevant registers
39762   into a platform independent mask of hotplug pins that have fired.
39763   </para><para>
39764   The platform independent interrupt handler <function>intel_hpd_irq_handler</function> in
39765   intel_hotplug.c does hotplug irq storm detection and mitigation, and passes
39766   further processing to appropriate bottom halves (Display Port specific and
39767   regular hotplug).
39768   </para><para>
39769   The Display Port work function <function>i915_digport_work_func</function> calls into
39770   <function>intel_dp_hpd_pulse</function> via hooks, which handles DP short pulses and DP MST long
39771   pulses, with failures and non-MST long pulses triggering regular hotplug
39772   processing on the connector.
39773   </para><para>
39774   The regular hotplug work function <function>i915_hotplug_work_func</function> calls connector
39775   detect hooks, and, if connector status changes, triggers sending of hotplug
39776   uevent to userspace via <function>drm_kms_helper_hotplug_event</function>.
39777   </para><para>
39778   Finally, the userspace is responsible for triggering a modeset upon receiving
39779   the hotplug uevent, disabling or enabling the crtc as needed.
39780   </para><para>
39781   The hotplug interrupt storm detection and mitigation code keeps track of the
39782   number of interrupts per hotplug pin per a period of time, and if the number
39783   of interrupts exceeds a certain threshold, the interrupt is disabled for a
39784   while before being re-enabled. The intention is to mitigate issues raising
39785   from broken hardware triggering massive amounts of interrupts and grinding
39786   the system to a halt.
39787   </para><para>
39788   Current implementation expects that hotplug interrupt storm will not be
39789   seen when display port sink is connected, hence on platforms whose DP
39790   callback is handled by i915_digport_work_func reenabling of hpd is not
39791   performed (it was never expected to be disabled in the first place ;) )
39792   this is specific to DP sinks handled by this routine and any other display
39793   such as HDMI or DVI enabled on the same port will have proper logic since
39794   it will use i915_hotplug_work_func where this logic is handled.
39795</para>
39796
39797<!-- drivers/gpu/drm/i915/intel_hotplug.c -->
39798<refentry id="API-intel-hpd-irq-storm-detect">
39799<refentryinfo>
39800 <title>LINUX</title>
39801 <productname>Kernel Hackers Manual</productname>
39802 <date>July 2017</date>
39803</refentryinfo>
39804<refmeta>
39805 <refentrytitle><phrase>intel_hpd_irq_storm_detect</phrase></refentrytitle>
39806 <manvolnum>9</manvolnum>
39807 <refmiscinfo class="version">4.4.14</refmiscinfo>
39808</refmeta>
39809<refnamediv>
39810 <refname>intel_hpd_irq_storm_detect</refname>
39811 <refpurpose>
39812  gather stats and detect HPD irq storm on a pin
39813 </refpurpose>
39814</refnamediv>
39815<refsynopsisdiv>
39816 <title>Synopsis</title>
39817  <funcsynopsis><funcprototype>
39818   <funcdef>bool <function>intel_hpd_irq_storm_detect </function></funcdef>
39819   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
39820   <paramdef>enum hpd_pin <parameter>pin</parameter></paramdef>
39821  </funcprototype></funcsynopsis>
39822</refsynopsisdiv>
39823<refsect1>
39824 <title>Arguments</title>
39825 <variablelist>
39826  <varlistentry>
39827   <term><parameter>dev_priv</parameter></term>
39828   <listitem>
39829    <para>
39830     private driver data pointer
39831    </para>
39832   </listitem>
39833  </varlistentry>
39834  <varlistentry>
39835   <term><parameter>pin</parameter></term>
39836   <listitem>
39837    <para>
39838     the pin to gather stats on
39839    </para>
39840   </listitem>
39841  </varlistentry>
39842 </variablelist>
39843</refsect1>
39844<refsect1>
39845<title>Description</title>
39846<para>
39847   Gather stats about HPD irqs from the specified <parameter>pin</parameter>, and detect irq
39848   storms. Only the pin specific stats and state are changed, the caller is
39849   responsible for further action.
39850   </para><para>
39851
39852   <parameter>HPD_STORM_THRESHOLD</parameter> irqs are allowed within <parameter>HPD_STORM_DETECT_PERIOD</parameter> ms,
39853   otherwise it's considered an irq storm, and the irq state is set to
39854   <parameter>HPD_MARK_DISABLED</parameter>.
39855   </para><para>
39856
39857   Return true if an irq storm was detected on <parameter>pin</parameter>.
39858</para>
39859</refsect1>
39860</refentry>
39861
39862<refentry id="API-intel-hpd-irq-handler">
39863<refentryinfo>
39864 <title>LINUX</title>
39865 <productname>Kernel Hackers Manual</productname>
39866 <date>July 2017</date>
39867</refentryinfo>
39868<refmeta>
39869 <refentrytitle><phrase>intel_hpd_irq_handler</phrase></refentrytitle>
39870 <manvolnum>9</manvolnum>
39871 <refmiscinfo class="version">4.4.14</refmiscinfo>
39872</refmeta>
39873<refnamediv>
39874 <refname>intel_hpd_irq_handler</refname>
39875 <refpurpose>
39876     main hotplug irq handler
39877 </refpurpose>
39878</refnamediv>
39879<refsynopsisdiv>
39880 <title>Synopsis</title>
39881  <funcsynopsis><funcprototype>
39882   <funcdef>void <function>intel_hpd_irq_handler </function></funcdef>
39883   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
39884   <paramdef>u32 <parameter>pin_mask</parameter></paramdef>
39885   <paramdef>u32 <parameter>long_mask</parameter></paramdef>
39886  </funcprototype></funcsynopsis>
39887</refsynopsisdiv>
39888<refsect1>
39889 <title>Arguments</title>
39890 <variablelist>
39891  <varlistentry>
39892   <term><parameter>dev</parameter></term>
39893   <listitem>
39894    <para>
39895     drm device
39896    </para>
39897   </listitem>
39898  </varlistentry>
39899  <varlistentry>
39900   <term><parameter>pin_mask</parameter></term>
39901   <listitem>
39902    <para>
39903     a mask of hpd pins that have triggered the irq
39904    </para>
39905   </listitem>
39906  </varlistentry>
39907  <varlistentry>
39908   <term><parameter>long_mask</parameter></term>
39909   <listitem>
39910    <para>
39911     a mask of hpd pins that may be long hpd pulses
39912    </para>
39913   </listitem>
39914  </varlistentry>
39915 </variablelist>
39916</refsect1>
39917<refsect1>
39918<title>Description</title>
39919<para>
39920   This is the main hotplug irq handler for all platforms. The platform specific
39921   irq handlers call the platform specific hotplug irq handlers, which read and
39922   decode the appropriate registers into bitmasks about hpd pins that have
39923   triggered (<parameter>pin_mask</parameter>), and which of those pins may be long pulses
39924   (<parameter>long_mask</parameter>). The <parameter>long_mask</parameter> is ignored if the port corresponding to the pin
39925   is not a digital port.
39926   </para><para>
39927
39928   Here, we do hotplug irq storm detection and mitigation, and pass further
39929   processing to appropriate bottom halves.
39930</para>
39931</refsect1>
39932</refentry>
39933
39934<refentry id="API-intel-hpd-init">
39935<refentryinfo>
39936 <title>LINUX</title>
39937 <productname>Kernel Hackers Manual</productname>
39938 <date>July 2017</date>
39939</refentryinfo>
39940<refmeta>
39941 <refentrytitle><phrase>intel_hpd_init</phrase></refentrytitle>
39942 <manvolnum>9</manvolnum>
39943 <refmiscinfo class="version">4.4.14</refmiscinfo>
39944</refmeta>
39945<refnamediv>
39946 <refname>intel_hpd_init</refname>
39947 <refpurpose>
39948     initializes and enables hpd support
39949 </refpurpose>
39950</refnamediv>
39951<refsynopsisdiv>
39952 <title>Synopsis</title>
39953  <funcsynopsis><funcprototype>
39954   <funcdef>void <function>intel_hpd_init </function></funcdef>
39955   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
39956  </funcprototype></funcsynopsis>
39957</refsynopsisdiv>
39958<refsect1>
39959 <title>Arguments</title>
39960 <variablelist>
39961  <varlistentry>
39962   <term><parameter>dev_priv</parameter></term>
39963   <listitem>
39964    <para>
39965     i915 device instance
39966    </para>
39967   </listitem>
39968  </varlistentry>
39969 </variablelist>
39970</refsect1>
39971<refsect1>
39972<title>Description</title>
39973<para>
39974   This function enables the hotplug support. It requires that interrupts have
39975   already been enabled with <function>intel_irq_init_hw</function>. From this point on hotplug and
39976   poll request can run concurrently to other code, so locking rules must be
39977   obeyed.
39978   </para><para>
39979
39980   This is a separate step from interrupt enabling to simplify the locking rules
39981   in the driver load and resume code.
39982</para>
39983</refsect1>
39984</refentry>
39985
39986      </sect2>
39987      <sect2>
39988	<title>High Definition Audio</title>
39989<para>
39990   </para><para>
39991   The graphics and audio drivers together support High Definition Audio over
39992   HDMI and Display Port. The audio programming sequences are divided into audio
39993   codec and controller enable and disable sequences. The graphics driver
39994   handles the audio codec sequences, while the audio driver handles the audio
39995   controller sequences.
39996   </para><para>
39997   The disable sequences must be performed before disabling the transcoder or
39998   port. The enable sequences may only be performed after enabling the
39999   transcoder and port, and after completed link training. Therefore the audio
40000   enable/disable sequences are part of the modeset sequence.
40001   </para><para>
40002   The codec and controller sequences could be done either parallel or serial,
40003   but generally the ELDV/PD change in the codec sequence indicates to the audio
40004   driver that the controller sequence should start. Indeed, most of the
40005   co-operation between the graphics and audio drivers is handled via audio
40006   related registers. (The notable exception is the power management, not
40007   covered here.)
40008   </para><para>
40009   The struct i915_audio_component is used to interact between the graphics
40010   and audio drivers. The struct i915_audio_component_ops *ops in it is
40011   defined in graphics driver and called in audio driver. The
40012   struct i915_audio_component_audio_ops *audio_ops is called from i915 driver.
40013</para>
40014
40015<!-- drivers/gpu/drm/i915/intel_audio.c -->
40016<refentry id="API-intel-audio-codec-enable">
40017<refentryinfo>
40018 <title>LINUX</title>
40019 <productname>Kernel Hackers Manual</productname>
40020 <date>July 2017</date>
40021</refentryinfo>
40022<refmeta>
40023 <refentrytitle><phrase>intel_audio_codec_enable</phrase></refentrytitle>
40024 <manvolnum>9</manvolnum>
40025 <refmiscinfo class="version">4.4.14</refmiscinfo>
40026</refmeta>
40027<refnamediv>
40028 <refname>intel_audio_codec_enable</refname>
40029 <refpurpose>
40030  Enable the audio codec for HD audio
40031 </refpurpose>
40032</refnamediv>
40033<refsynopsisdiv>
40034 <title>Synopsis</title>
40035  <funcsynopsis><funcprototype>
40036   <funcdef>void <function>intel_audio_codec_enable </function></funcdef>
40037   <paramdef>struct intel_encoder * <parameter>intel_encoder</parameter></paramdef>
40038  </funcprototype></funcsynopsis>
40039</refsynopsisdiv>
40040<refsect1>
40041 <title>Arguments</title>
40042 <variablelist>
40043  <varlistentry>
40044   <term><parameter>intel_encoder</parameter></term>
40045   <listitem>
40046    <para>
40047     encoder on which to enable audio
40048    </para>
40049   </listitem>
40050  </varlistentry>
40051 </variablelist>
40052</refsect1>
40053<refsect1>
40054<title>Description</title>
40055<para>
40056   The enable sequences may only be performed after enabling the transcoder and
40057   port, and after completed link training.
40058</para>
40059</refsect1>
40060</refentry>
40061
40062<refentry id="API-intel-audio-codec-disable">
40063<refentryinfo>
40064 <title>LINUX</title>
40065 <productname>Kernel Hackers Manual</productname>
40066 <date>July 2017</date>
40067</refentryinfo>
40068<refmeta>
40069 <refentrytitle><phrase>intel_audio_codec_disable</phrase></refentrytitle>
40070 <manvolnum>9</manvolnum>
40071 <refmiscinfo class="version">4.4.14</refmiscinfo>
40072</refmeta>
40073<refnamediv>
40074 <refname>intel_audio_codec_disable</refname>
40075 <refpurpose>
40076     Disable the audio codec for HD audio
40077 </refpurpose>
40078</refnamediv>
40079<refsynopsisdiv>
40080 <title>Synopsis</title>
40081  <funcsynopsis><funcprototype>
40082   <funcdef>void <function>intel_audio_codec_disable </function></funcdef>
40083   <paramdef>struct intel_encoder * <parameter>intel_encoder</parameter></paramdef>
40084  </funcprototype></funcsynopsis>
40085</refsynopsisdiv>
40086<refsect1>
40087 <title>Arguments</title>
40088 <variablelist>
40089  <varlistentry>
40090   <term><parameter>intel_encoder</parameter></term>
40091   <listitem>
40092    <para>
40093     encoder on which to disable audio
40094    </para>
40095   </listitem>
40096  </varlistentry>
40097 </variablelist>
40098</refsect1>
40099<refsect1>
40100<title>Description</title>
40101<para>
40102   The disable sequences must be performed before disabling the transcoder or
40103   port.
40104</para>
40105</refsect1>
40106</refentry>
40107
40108<refentry id="API-intel-init-audio">
40109<refentryinfo>
40110 <title>LINUX</title>
40111 <productname>Kernel Hackers Manual</productname>
40112 <date>July 2017</date>
40113</refentryinfo>
40114<refmeta>
40115 <refentrytitle><phrase>intel_init_audio</phrase></refentrytitle>
40116 <manvolnum>9</manvolnum>
40117 <refmiscinfo class="version">4.4.14</refmiscinfo>
40118</refmeta>
40119<refnamediv>
40120 <refname>intel_init_audio</refname>
40121 <refpurpose>
40122     Set up chip specific audio functions
40123 </refpurpose>
40124</refnamediv>
40125<refsynopsisdiv>
40126 <title>Synopsis</title>
40127  <funcsynopsis><funcprototype>
40128   <funcdef>void <function>intel_init_audio </function></funcdef>
40129   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
40130  </funcprototype></funcsynopsis>
40131</refsynopsisdiv>
40132<refsect1>
40133 <title>Arguments</title>
40134 <variablelist>
40135  <varlistentry>
40136   <term><parameter>dev</parameter></term>
40137   <listitem>
40138    <para>
40139     drm device
40140    </para>
40141   </listitem>
40142  </varlistentry>
40143 </variablelist>
40144</refsect1>
40145</refentry>
40146
40147<refentry id="API-i915-audio-component-init">
40148<refentryinfo>
40149 <title>LINUX</title>
40150 <productname>Kernel Hackers Manual</productname>
40151 <date>July 2017</date>
40152</refentryinfo>
40153<refmeta>
40154 <refentrytitle><phrase>i915_audio_component_init</phrase></refentrytitle>
40155 <manvolnum>9</manvolnum>
40156 <refmiscinfo class="version">4.4.14</refmiscinfo>
40157</refmeta>
40158<refnamediv>
40159 <refname>i915_audio_component_init</refname>
40160 <refpurpose>
40161     initialize and register the audio component
40162 </refpurpose>
40163</refnamediv>
40164<refsynopsisdiv>
40165 <title>Synopsis</title>
40166  <funcsynopsis><funcprototype>
40167   <funcdef>void <function>i915_audio_component_init </function></funcdef>
40168   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
40169  </funcprototype></funcsynopsis>
40170</refsynopsisdiv>
40171<refsect1>
40172 <title>Arguments</title>
40173 <variablelist>
40174  <varlistentry>
40175   <term><parameter>dev_priv</parameter></term>
40176   <listitem>
40177    <para>
40178     i915 device instance
40179    </para>
40180   </listitem>
40181  </varlistentry>
40182 </variablelist>
40183</refsect1>
40184<refsect1>
40185<title>Description</title>
40186<para>
40187   This will register with the component framework a child component which
40188   will bind dynamically to the snd_hda_intel driver's corresponding master
40189   component when the latter is registered. During binding the child
40190   initializes an instance of struct i915_audio_component which it receives
40191   from the master. The master can then start to use the interface defined by
40192   this struct. Each side can break the binding at any point by deregistering
40193   its own component after which each side's component unbind callback is
40194   called.
40195   </para><para>
40196
40197   We ignore any error during registration and continue with reduced
40198   functionality (i.e. without HDMI audio).
40199</para>
40200</refsect1>
40201</refentry>
40202
40203<refentry id="API-i915-audio-component-cleanup">
40204<refentryinfo>
40205 <title>LINUX</title>
40206 <productname>Kernel Hackers Manual</productname>
40207 <date>July 2017</date>
40208</refentryinfo>
40209<refmeta>
40210 <refentrytitle><phrase>i915_audio_component_cleanup</phrase></refentrytitle>
40211 <manvolnum>9</manvolnum>
40212 <refmiscinfo class="version">4.4.14</refmiscinfo>
40213</refmeta>
40214<refnamediv>
40215 <refname>i915_audio_component_cleanup</refname>
40216 <refpurpose>
40217     deregister the audio component
40218 </refpurpose>
40219</refnamediv>
40220<refsynopsisdiv>
40221 <title>Synopsis</title>
40222  <funcsynopsis><funcprototype>
40223   <funcdef>void <function>i915_audio_component_cleanup </function></funcdef>
40224   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
40225  </funcprototype></funcsynopsis>
40226</refsynopsisdiv>
40227<refsect1>
40228 <title>Arguments</title>
40229 <variablelist>
40230  <varlistentry>
40231   <term><parameter>dev_priv</parameter></term>
40232   <listitem>
40233    <para>
40234     i915 device instance
40235    </para>
40236   </listitem>
40237  </varlistentry>
40238 </variablelist>
40239</refsect1>
40240<refsect1>
40241<title>Description</title>
40242<para>
40243   Deregisters the audio component, breaking any existing binding to the
40244   corresponding snd_hda_intel driver's master component.
40245</para>
40246</refsect1>
40247</refentry>
40248
40249<!-- include/drm/i915_component.h -->
40250<refentry id="API-struct-i915-audio-component-ops">
40251<refentryinfo>
40252 <title>LINUX</title>
40253 <productname>Kernel Hackers Manual</productname>
40254 <date>July 2017</date>
40255</refentryinfo>
40256<refmeta>
40257 <refentrytitle><phrase>struct i915_audio_component_ops</phrase></refentrytitle>
40258 <manvolnum>9</manvolnum>
40259 <refmiscinfo class="version">4.4.14</refmiscinfo>
40260</refmeta>
40261<refnamediv>
40262 <refname>struct i915_audio_component_ops</refname>
40263 <refpurpose>
40264  callbacks defined in gfx driver
40265 </refpurpose>
40266</refnamediv>
40267<refsynopsisdiv>
40268 <title>Synopsis</title>
40269  <programlisting>
40270struct i915_audio_component_ops {
40271  struct module * owner;
40272  void (* get_power) (struct device *);
40273  void (* put_power) (struct device *);
40274  void (* codec_wake_override) (struct device *, bool enable);
40275  int (* get_cdclk_freq) (struct device *);
40276  int (* sync_audio_rate) (struct device *, int port, int rate);
40277};  </programlisting>
40278</refsynopsisdiv>
40279 <refsect1>
40280  <title>Members</title>
40281  <variablelist>
40282    <varlistentry>      <term>owner</term>
40283      <listitem><para>
40284the module owner
40285      </para></listitem>
40286    </varlistentry>
40287    <varlistentry>      <term>get_power</term>
40288      <listitem><para>
40289get the POWER_DOMAIN_AUDIO power well
40290      </para></listitem>
40291    </varlistentry>
40292    <varlistentry>      <term>put_power</term>
40293      <listitem><para>
40294put the POWER_DOMAIN_AUDIO power well
40295      </para></listitem>
40296    </varlistentry>
40297    <varlistentry>      <term>codec_wake_override</term>
40298      <listitem><para>
40299Enable/Disable generating the codec wake signal
40300      </para></listitem>
40301    </varlistentry>
40302    <varlistentry>      <term>get_cdclk_freq</term>
40303      <listitem><para>
40304get the Core Display Clock in KHz
40305      </para></listitem>
40306    </varlistentry>
40307    <varlistentry>      <term>sync_audio_rate</term>
40308      <listitem><para>
40309set n/cts based on the sample rate
40310      </para></listitem>
40311    </varlistentry>
40312  </variablelist>
40313 </refsect1>
40314</refentry>
40315
40316<refentry id="API-struct-i915-audio-component">
40317<refentryinfo>
40318 <title>LINUX</title>
40319 <productname>Kernel Hackers Manual</productname>
40320 <date>July 2017</date>
40321</refentryinfo>
40322<refmeta>
40323 <refentrytitle><phrase>struct i915_audio_component</phrase></refentrytitle>
40324 <manvolnum>9</manvolnum>
40325 <refmiscinfo class="version">4.4.14</refmiscinfo>
40326</refmeta>
40327<refnamediv>
40328 <refname>struct i915_audio_component</refname>
40329 <refpurpose>
40330     used for audio video interaction
40331 </refpurpose>
40332</refnamediv>
40333<refsynopsisdiv>
40334 <title>Synopsis</title>
40335  <programlisting>
40336struct i915_audio_component {
40337  struct device * dev;
40338  int aud_sample_rate[MAX_PORTS];
40339  const struct i915_audio_component_ops * ops;
40340  const struct i915_audio_component_audio_ops * audio_ops;
40341};  </programlisting>
40342</refsynopsisdiv>
40343 <refsect1>
40344  <title>Members</title>
40345  <variablelist>
40346    <varlistentry>      <term>dev</term>
40347      <listitem><para>
40348   the device from gfx driver
40349      </para></listitem>
40350    </varlistentry>
40351    <varlistentry>      <term>aud_sample_rate[MAX_PORTS]</term>
40352      <listitem><para>
40353   the array of audio sample rate per port
40354      </para></listitem>
40355    </varlistentry>
40356    <varlistentry>      <term>ops</term>
40357      <listitem><para>
40358   callback for audio driver calling
40359      </para></listitem>
40360    </varlistentry>
40361    <varlistentry>      <term>audio_ops</term>
40362      <listitem><para>
40363   Call from i915 driver
40364      </para></listitem>
40365    </varlistentry>
40366  </variablelist>
40367 </refsect1>
40368</refentry>
40369
40370      </sect2>
40371      <sect2>
40372	<title>Panel Self Refresh PSR (PSR/SRD)</title>
40373<para>
40374   </para><para>
40375   Since Haswell Display controller supports Panel Self-Refresh on display
40376   panels witch have a remote frame buffer (RFB) implemented according to PSR
40377   spec in eDP1.3. PSR feature allows the display to go to lower standby states
40378   when system is idle but display is on as it eliminates display refresh
40379   request to DDR memory completely as long as the frame buffer for that
40380   display is unchanged.
40381   </para><para>
40382   Panel Self Refresh must be supported by both Hardware (source) and
40383   Panel (sink).
40384   </para><para>
40385   PSR saves power by caching the framebuffer in the panel RFB, which allows us
40386   to power down the link and memory controller. For DSI panels the same idea
40387   is called <quote>manual mode</quote>.
40388   </para><para>
40389   The implementation uses the hardware-based PSR support which automatically
40390   enters/exits self-refresh mode. The hardware takes care of sending the
40391   required DP aux message and could even retrain the link (that part isn't
40392   enabled yet though). The hardware also keeps track of any frontbuffer
40393   changes to know when to exit self-refresh mode again. Unfortunately that
40394   part doesn't work too well, hence why the i915 PSR support uses the
40395   software frontbuffer tracking to make sure it doesn't miss a screen
40396   update. For this integration <function>intel_psr_invalidate</function> and <function>intel_psr_flush</function>
40397   get called by the frontbuffer tracking code. Note that because of locking
40398   issues the self-refresh re-enable code is done from a work queue, which
40399   must be correctly synchronized/cancelled when shutting down the pipe."
40400</para>
40401
40402<!-- drivers/gpu/drm/i915/intel_psr.c -->
40403<refentry id="API-intel-psr-enable">
40404<refentryinfo>
40405 <title>LINUX</title>
40406 <productname>Kernel Hackers Manual</productname>
40407 <date>July 2017</date>
40408</refentryinfo>
40409<refmeta>
40410 <refentrytitle><phrase>intel_psr_enable</phrase></refentrytitle>
40411 <manvolnum>9</manvolnum>
40412 <refmiscinfo class="version">4.4.14</refmiscinfo>
40413</refmeta>
40414<refnamediv>
40415 <refname>intel_psr_enable</refname>
40416 <refpurpose>
40417  Enable PSR
40418 </refpurpose>
40419</refnamediv>
40420<refsynopsisdiv>
40421 <title>Synopsis</title>
40422  <funcsynopsis><funcprototype>
40423   <funcdef>void <function>intel_psr_enable </function></funcdef>
40424   <paramdef>struct intel_dp * <parameter>intel_dp</parameter></paramdef>
40425  </funcprototype></funcsynopsis>
40426</refsynopsisdiv>
40427<refsect1>
40428 <title>Arguments</title>
40429 <variablelist>
40430  <varlistentry>
40431   <term><parameter>intel_dp</parameter></term>
40432   <listitem>
40433    <para>
40434     Intel DP
40435    </para>
40436   </listitem>
40437  </varlistentry>
40438 </variablelist>
40439</refsect1>
40440<refsect1>
40441<title>Description</title>
40442<para>
40443   This function can only be called after the pipe is fully trained and enabled.
40444</para>
40445</refsect1>
40446</refentry>
40447
40448<refentry id="API-intel-psr-disable">
40449<refentryinfo>
40450 <title>LINUX</title>
40451 <productname>Kernel Hackers Manual</productname>
40452 <date>July 2017</date>
40453</refentryinfo>
40454<refmeta>
40455 <refentrytitle><phrase>intel_psr_disable</phrase></refentrytitle>
40456 <manvolnum>9</manvolnum>
40457 <refmiscinfo class="version">4.4.14</refmiscinfo>
40458</refmeta>
40459<refnamediv>
40460 <refname>intel_psr_disable</refname>
40461 <refpurpose>
40462     Disable PSR
40463 </refpurpose>
40464</refnamediv>
40465<refsynopsisdiv>
40466 <title>Synopsis</title>
40467  <funcsynopsis><funcprototype>
40468   <funcdef>void <function>intel_psr_disable </function></funcdef>
40469   <paramdef>struct intel_dp * <parameter>intel_dp</parameter></paramdef>
40470  </funcprototype></funcsynopsis>
40471</refsynopsisdiv>
40472<refsect1>
40473 <title>Arguments</title>
40474 <variablelist>
40475  <varlistentry>
40476   <term><parameter>intel_dp</parameter></term>
40477   <listitem>
40478    <para>
40479     Intel DP
40480    </para>
40481   </listitem>
40482  </varlistentry>
40483 </variablelist>
40484</refsect1>
40485<refsect1>
40486<title>Description</title>
40487<para>
40488   This function needs to be called before disabling pipe.
40489</para>
40490</refsect1>
40491</refentry>
40492
40493<refentry id="API-intel-psr-single-frame-update">
40494<refentryinfo>
40495 <title>LINUX</title>
40496 <productname>Kernel Hackers Manual</productname>
40497 <date>July 2017</date>
40498</refentryinfo>
40499<refmeta>
40500 <refentrytitle><phrase>intel_psr_single_frame_update</phrase></refentrytitle>
40501 <manvolnum>9</manvolnum>
40502 <refmiscinfo class="version">4.4.14</refmiscinfo>
40503</refmeta>
40504<refnamediv>
40505 <refname>intel_psr_single_frame_update</refname>
40506 <refpurpose>
40507     Single Frame Update
40508 </refpurpose>
40509</refnamediv>
40510<refsynopsisdiv>
40511 <title>Synopsis</title>
40512  <funcsynopsis><funcprototype>
40513   <funcdef>void <function>intel_psr_single_frame_update </function></funcdef>
40514   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
40515   <paramdef>unsigned <parameter>frontbuffer_bits</parameter></paramdef>
40516  </funcprototype></funcsynopsis>
40517</refsynopsisdiv>
40518<refsect1>
40519 <title>Arguments</title>
40520 <variablelist>
40521  <varlistentry>
40522   <term><parameter>dev</parameter></term>
40523   <listitem>
40524    <para>
40525     DRM device
40526    </para>
40527   </listitem>
40528  </varlistentry>
40529  <varlistentry>
40530   <term><parameter>frontbuffer_bits</parameter></term>
40531   <listitem>
40532    <para>
40533     frontbuffer plane tracking bits
40534    </para>
40535   </listitem>
40536  </varlistentry>
40537 </variablelist>
40538</refsect1>
40539<refsect1>
40540<title>Description</title>
40541<para>
40542   Some platforms support a single frame update feature that is used to
40543   send and update only one frame on Remote Frame Buffer.
40544   So far it is only implemented for Valleyview and Cherryview because
40545   hardware requires this to be done before a page flip.
40546</para>
40547</refsect1>
40548</refentry>
40549
40550<refentry id="API-intel-psr-invalidate">
40551<refentryinfo>
40552 <title>LINUX</title>
40553 <productname>Kernel Hackers Manual</productname>
40554 <date>July 2017</date>
40555</refentryinfo>
40556<refmeta>
40557 <refentrytitle><phrase>intel_psr_invalidate</phrase></refentrytitle>
40558 <manvolnum>9</manvolnum>
40559 <refmiscinfo class="version">4.4.14</refmiscinfo>
40560</refmeta>
40561<refnamediv>
40562 <refname>intel_psr_invalidate</refname>
40563 <refpurpose>
40564     Invalidade PSR
40565 </refpurpose>
40566</refnamediv>
40567<refsynopsisdiv>
40568 <title>Synopsis</title>
40569  <funcsynopsis><funcprototype>
40570   <funcdef>void <function>intel_psr_invalidate </function></funcdef>
40571   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
40572   <paramdef>unsigned <parameter>frontbuffer_bits</parameter></paramdef>
40573  </funcprototype></funcsynopsis>
40574</refsynopsisdiv>
40575<refsect1>
40576 <title>Arguments</title>
40577 <variablelist>
40578  <varlistentry>
40579   <term><parameter>dev</parameter></term>
40580   <listitem>
40581    <para>
40582     DRM device
40583    </para>
40584   </listitem>
40585  </varlistentry>
40586  <varlistentry>
40587   <term><parameter>frontbuffer_bits</parameter></term>
40588   <listitem>
40589    <para>
40590     frontbuffer plane tracking bits
40591    </para>
40592   </listitem>
40593  </varlistentry>
40594 </variablelist>
40595</refsect1>
40596<refsect1>
40597<title>Description</title>
40598<para>
40599   Since the hardware frontbuffer tracking has gaps we need to integrate
40600   with the software frontbuffer tracking. This function gets called every
40601   time frontbuffer rendering starts and a buffer gets dirtied. PSR must be
40602   disabled if the frontbuffer mask contains a buffer relevant to PSR.
40603   </para><para>
40604
40605   Dirty frontbuffers relevant to PSR are tracked in busy_frontbuffer_bits."
40606</para>
40607</refsect1>
40608</refentry>
40609
40610<refentry id="API-intel-psr-flush">
40611<refentryinfo>
40612 <title>LINUX</title>
40613 <productname>Kernel Hackers Manual</productname>
40614 <date>July 2017</date>
40615</refentryinfo>
40616<refmeta>
40617 <refentrytitle><phrase>intel_psr_flush</phrase></refentrytitle>
40618 <manvolnum>9</manvolnum>
40619 <refmiscinfo class="version">4.4.14</refmiscinfo>
40620</refmeta>
40621<refnamediv>
40622 <refname>intel_psr_flush</refname>
40623 <refpurpose>
40624     Flush PSR
40625 </refpurpose>
40626</refnamediv>
40627<refsynopsisdiv>
40628 <title>Synopsis</title>
40629  <funcsynopsis><funcprototype>
40630   <funcdef>void <function>intel_psr_flush </function></funcdef>
40631   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
40632   <paramdef>unsigned <parameter>frontbuffer_bits</parameter></paramdef>
40633   <paramdef>enum fb_op_origin <parameter>origin</parameter></paramdef>
40634  </funcprototype></funcsynopsis>
40635</refsynopsisdiv>
40636<refsect1>
40637 <title>Arguments</title>
40638 <variablelist>
40639  <varlistentry>
40640   <term><parameter>dev</parameter></term>
40641   <listitem>
40642    <para>
40643     DRM device
40644    </para>
40645   </listitem>
40646  </varlistentry>
40647  <varlistentry>
40648   <term><parameter>frontbuffer_bits</parameter></term>
40649   <listitem>
40650    <para>
40651     frontbuffer plane tracking bits
40652    </para>
40653   </listitem>
40654  </varlistentry>
40655  <varlistentry>
40656   <term><parameter>origin</parameter></term>
40657   <listitem>
40658    <para>
40659     which operation caused the flush
40660    </para>
40661   </listitem>
40662  </varlistentry>
40663 </variablelist>
40664</refsect1>
40665<refsect1>
40666<title>Description</title>
40667<para>
40668   Since the hardware frontbuffer tracking has gaps we need to integrate
40669   with the software frontbuffer tracking. This function gets called every
40670   time frontbuffer rendering has completed and flushed out to memory. PSR
40671   can be enabled again if no other frontbuffer relevant to PSR is dirty.
40672   </para><para>
40673
40674   Dirty frontbuffers relevant to PSR are tracked in busy_frontbuffer_bits.
40675</para>
40676</refsect1>
40677</refentry>
40678
40679<refentry id="API-intel-psr-init">
40680<refentryinfo>
40681 <title>LINUX</title>
40682 <productname>Kernel Hackers Manual</productname>
40683 <date>July 2017</date>
40684</refentryinfo>
40685<refmeta>
40686 <refentrytitle><phrase>intel_psr_init</phrase></refentrytitle>
40687 <manvolnum>9</manvolnum>
40688 <refmiscinfo class="version">4.4.14</refmiscinfo>
40689</refmeta>
40690<refnamediv>
40691 <refname>intel_psr_init</refname>
40692 <refpurpose>
40693     Init basic PSR work and mutex.
40694 </refpurpose>
40695</refnamediv>
40696<refsynopsisdiv>
40697 <title>Synopsis</title>
40698  <funcsynopsis><funcprototype>
40699   <funcdef>void <function>intel_psr_init </function></funcdef>
40700   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
40701  </funcprototype></funcsynopsis>
40702</refsynopsisdiv>
40703<refsect1>
40704 <title>Arguments</title>
40705 <variablelist>
40706  <varlistentry>
40707   <term><parameter>dev</parameter></term>
40708   <listitem>
40709    <para>
40710     DRM device
40711    </para>
40712   </listitem>
40713  </varlistentry>
40714 </variablelist>
40715</refsect1>
40716<refsect1>
40717<title>Description</title>
40718<para>
40719   This function is  called only once at driver load to initialize basic
40720   PSR stuff.
40721</para>
40722</refsect1>
40723</refentry>
40724
40725      </sect2>
40726      <sect2>
40727	<title>Frame Buffer Compression (FBC)</title>
40728<para>
40729   </para><para>
40730   FBC tries to save memory bandwidth (and so power consumption) by
40731   compressing the amount of memory used by the display. It is total
40732   transparent to user space and completely handled in the kernel.
40733   </para><para>
40734   The benefits of FBC are mostly visible with solid backgrounds and
40735   variation-less patterns. It comes from keeping the memory footprint small
40736   and having fewer memory pages opened and accessed for refreshing the display.
40737   </para><para>
40738   i915 is responsible to reserve stolen memory for FBC and configure its
40739   offset on proper registers. The hardware takes care of all
40740   compress/decompress. However there are many known cases where we have to
40741   forcibly disable it to allow proper screen updates.
40742</para>
40743
40744<!-- drivers/gpu/drm/i915/intel_fbc.c -->
40745<refentry id="API-intel-fbc-enabled">
40746<refentryinfo>
40747 <title>LINUX</title>
40748 <productname>Kernel Hackers Manual</productname>
40749 <date>July 2017</date>
40750</refentryinfo>
40751<refmeta>
40752 <refentrytitle><phrase>intel_fbc_enabled</phrase></refentrytitle>
40753 <manvolnum>9</manvolnum>
40754 <refmiscinfo class="version">4.4.14</refmiscinfo>
40755</refmeta>
40756<refnamediv>
40757 <refname>intel_fbc_enabled</refname>
40758 <refpurpose>
40759  Is FBC enabled?
40760 </refpurpose>
40761</refnamediv>
40762<refsynopsisdiv>
40763 <title>Synopsis</title>
40764  <funcsynopsis><funcprototype>
40765   <funcdef>bool <function>intel_fbc_enabled </function></funcdef>
40766   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
40767  </funcprototype></funcsynopsis>
40768</refsynopsisdiv>
40769<refsect1>
40770 <title>Arguments</title>
40771 <variablelist>
40772  <varlistentry>
40773   <term><parameter>dev_priv</parameter></term>
40774   <listitem>
40775    <para>
40776     i915 device instance
40777    </para>
40778   </listitem>
40779  </varlistentry>
40780 </variablelist>
40781</refsect1>
40782<refsect1>
40783<title>Description</title>
40784<para>
40785   This function is used to verify the current state of FBC.
40786</para>
40787</refsect1>
40788<refsect1>
40789<title>FIXME</title>
40790<para>
40791   This should be tracked in the plane config eventually
40792   instead of queried at runtime for most callers.
40793</para>
40794</refsect1>
40795</refentry>
40796
40797<refentry id="API-intel-fbc-disable">
40798<refentryinfo>
40799 <title>LINUX</title>
40800 <productname>Kernel Hackers Manual</productname>
40801 <date>July 2017</date>
40802</refentryinfo>
40803<refmeta>
40804 <refentrytitle><phrase>intel_fbc_disable</phrase></refentrytitle>
40805 <manvolnum>9</manvolnum>
40806 <refmiscinfo class="version">4.4.14</refmiscinfo>
40807</refmeta>
40808<refnamediv>
40809 <refname>intel_fbc_disable</refname>
40810 <refpurpose>
40811     disable FBC
40812 </refpurpose>
40813</refnamediv>
40814<refsynopsisdiv>
40815 <title>Synopsis</title>
40816  <funcsynopsis><funcprototype>
40817   <funcdef>void <function>intel_fbc_disable </function></funcdef>
40818   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
40819  </funcprototype></funcsynopsis>
40820</refsynopsisdiv>
40821<refsect1>
40822 <title>Arguments</title>
40823 <variablelist>
40824  <varlistentry>
40825   <term><parameter>dev_priv</parameter></term>
40826   <listitem>
40827    <para>
40828     i915 device instance
40829    </para>
40830   </listitem>
40831  </varlistentry>
40832 </variablelist>
40833</refsect1>
40834<refsect1>
40835<title>Description</title>
40836<para>
40837   This function disables FBC.
40838</para>
40839</refsect1>
40840</refentry>
40841
40842<refentry id="API---intel-fbc-update">
40843<refentryinfo>
40844 <title>LINUX</title>
40845 <productname>Kernel Hackers Manual</productname>
40846 <date>July 2017</date>
40847</refentryinfo>
40848<refmeta>
40849 <refentrytitle><phrase>__intel_fbc_update</phrase></refentrytitle>
40850 <manvolnum>9</manvolnum>
40851 <refmiscinfo class="version">4.4.14</refmiscinfo>
40852</refmeta>
40853<refnamediv>
40854 <refname>__intel_fbc_update</refname>
40855 <refpurpose>
40856     enable/disable FBC as needed, unlocked
40857 </refpurpose>
40858</refnamediv>
40859<refsynopsisdiv>
40860 <title>Synopsis</title>
40861  <funcsynopsis><funcprototype>
40862   <funcdef>void <function>__intel_fbc_update </function></funcdef>
40863   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
40864  </funcprototype></funcsynopsis>
40865</refsynopsisdiv>
40866<refsect1>
40867 <title>Arguments</title>
40868 <variablelist>
40869  <varlistentry>
40870   <term><parameter>dev_priv</parameter></term>
40871   <listitem>
40872    <para>
40873     i915 device instance
40874    </para>
40875   </listitem>
40876  </varlistentry>
40877 </variablelist>
40878</refsect1>
40879<refsect1>
40880<title>Description</title>
40881<para>
40882   Set up the framebuffer compression hardware at mode set time.  We
40883</para>
40884</refsect1>
40885<refsect1>
40886<title>enable it if possible</title>
40887<para>
40888   - plane A only (on pre-965)
40889   - no pixel mulitply/line duplication
40890   - no alpha buffer discard
40891   - no dual wide
40892   - framebuffer &lt;= max_hdisplay in width, max_vdisplay in height
40893   </para><para>
40894
40895   We can't assume that any compression will take place (worst case),
40896   so the compressed buffer has to be the same size as the uncompressed
40897   one.  It also must reside (along with the line length buffer) in
40898   stolen memory.
40899   </para><para>
40900
40901   We need to enable/disable FBC on a global basis.
40902</para>
40903</refsect1>
40904</refentry>
40905
40906<refentry id="API-intel-fbc-init">
40907<refentryinfo>
40908 <title>LINUX</title>
40909 <productname>Kernel Hackers Manual</productname>
40910 <date>July 2017</date>
40911</refentryinfo>
40912<refmeta>
40913 <refentrytitle><phrase>intel_fbc_init</phrase></refentrytitle>
40914 <manvolnum>9</manvolnum>
40915 <refmiscinfo class="version">4.4.14</refmiscinfo>
40916</refmeta>
40917<refnamediv>
40918 <refname>intel_fbc_init</refname>
40919 <refpurpose>
40920     Initialize FBC
40921 </refpurpose>
40922</refnamediv>
40923<refsynopsisdiv>
40924 <title>Synopsis</title>
40925  <funcsynopsis><funcprototype>
40926   <funcdef>void <function>intel_fbc_init </function></funcdef>
40927   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
40928  </funcprototype></funcsynopsis>
40929</refsynopsisdiv>
40930<refsect1>
40931 <title>Arguments</title>
40932 <variablelist>
40933  <varlistentry>
40934   <term><parameter>dev_priv</parameter></term>
40935   <listitem>
40936    <para>
40937     the i915 device
40938    </para>
40939   </listitem>
40940  </varlistentry>
40941 </variablelist>
40942</refsect1>
40943<refsect1>
40944<title>Description</title>
40945<para>
40946   This function might be called during PM init process.
40947</para>
40948</refsect1>
40949</refentry>
40950
40951      </sect2>
40952      <sect2>
40953        <title>Display Refresh Rate Switching (DRRS)</title>
40954<para>
40955   </para><para>
40956   Display Refresh Rate Switching (DRRS) is a power conservation feature
40957   which enables swtching between low and high refresh rates,
40958   dynamically, based on the usage scenario. This feature is applicable
40959   for internal panels.
40960   </para><para>
40961   Indication that the panel supports DRRS is given by the panel EDID, which
40962   would list multiple refresh rates for one resolution.
40963   </para><para>
40964   DRRS is of 2 types - static and seamless.
40965   Static DRRS involves changing refresh rate (RR) by doing a full modeset
40966   (may appear as a blink on screen) and is used in dock-undock scenario.
40967   Seamless DRRS involves changing RR without any visual effect to the user
40968   and can be used during normal system usage. This is done by programming
40969   certain registers.
40970   </para><para>
40971   Support for static/seamless DRRS may be indicated in the VBT based on
40972   inputs from the panel spec.
40973   </para><para>
40974   DRRS saves power by switching to low RR based on usage scenarios.
40975   </para><para>
40976   eDP DRRS:-
40977   The implementation is based on frontbuffer tracking implementation.
40978   When there is a disturbance on the screen triggered by user activity or a
40979   periodic system activity, DRRS is disabled (RR is changed to high RR).
40980   When there is no movement on screen, after a timeout of 1 second, a switch
40981   to low RR is made.
40982   For integration with frontbuffer tracking code,
40983   <function>intel_edp_drrs_invalidate</function> and <function>intel_edp_drrs_flush</function> are called.
40984   </para><para>
40985   DRRS can be further extended to support other internal panels and also
40986   the scenario of video playback wherein RR is set based on the rate
40987   requested by userspace.
40988</para>
40989
40990<refentry id="API-intel-dp-set-drrs-state">
40991<refentryinfo>
40992 <title>LINUX</title>
40993 <productname>Kernel Hackers Manual</productname>
40994 <date>July 2017</date>
40995</refentryinfo>
40996<refmeta>
40997 <refentrytitle><phrase>intel_dp_set_drrs_state</phrase></refentrytitle>
40998 <manvolnum>9</manvolnum>
40999 <refmiscinfo class="version">4.4.14</refmiscinfo>
41000</refmeta>
41001<refnamediv>
41002 <refname>intel_dp_set_drrs_state</refname>
41003 <refpurpose>
41004  program registers for RR switch to take effect
41005 </refpurpose>
41006</refnamediv>
41007<refsynopsisdiv>
41008 <title>Synopsis</title>
41009  <funcsynopsis><funcprototype>
41010   <funcdef>void <function>intel_dp_set_drrs_state </function></funcdef>
41011   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
41012   <paramdef>int <parameter>refresh_rate</parameter></paramdef>
41013  </funcprototype></funcsynopsis>
41014</refsynopsisdiv>
41015<refsect1>
41016 <title>Arguments</title>
41017 <variablelist>
41018  <varlistentry>
41019   <term><parameter>dev</parameter></term>
41020   <listitem>
41021    <para>
41022     DRM device
41023    </para>
41024   </listitem>
41025  </varlistentry>
41026  <varlistentry>
41027   <term><parameter>refresh_rate</parameter></term>
41028   <listitem>
41029    <para>
41030     RR to be programmed
41031    </para>
41032   </listitem>
41033  </varlistentry>
41034 </variablelist>
41035</refsect1>
41036<refsect1>
41037<title>Description</title>
41038<para>
41039   This function gets called when refresh rate (RR) has to be changed from
41040   one frequency to another. Switches can be between high and low RR
41041   supported by the panel or to any other RR based on media playback (in
41042   this case, RR value needs to be passed from user space).
41043   </para><para>
41044
41045   The caller of this function needs to take a lock on dev_priv-&gt;drrs.
41046</para>
41047</refsect1>
41048</refentry>
41049
41050<refentry id="API-intel-edp-drrs-enable">
41051<refentryinfo>
41052 <title>LINUX</title>
41053 <productname>Kernel Hackers Manual</productname>
41054 <date>July 2017</date>
41055</refentryinfo>
41056<refmeta>
41057 <refentrytitle><phrase>intel_edp_drrs_enable</phrase></refentrytitle>
41058 <manvolnum>9</manvolnum>
41059 <refmiscinfo class="version">4.4.14</refmiscinfo>
41060</refmeta>
41061<refnamediv>
41062 <refname>intel_edp_drrs_enable</refname>
41063 <refpurpose>
41064  init drrs struct if supported
41065 </refpurpose>
41066</refnamediv>
41067<refsynopsisdiv>
41068 <title>Synopsis</title>
41069  <funcsynopsis><funcprototype>
41070   <funcdef>void <function>intel_edp_drrs_enable </function></funcdef>
41071   <paramdef>struct intel_dp * <parameter>intel_dp</parameter></paramdef>
41072  </funcprototype></funcsynopsis>
41073</refsynopsisdiv>
41074<refsect1>
41075 <title>Arguments</title>
41076 <variablelist>
41077  <varlistentry>
41078   <term><parameter>intel_dp</parameter></term>
41079   <listitem>
41080    <para>
41081     DP struct
41082    </para>
41083   </listitem>
41084  </varlistentry>
41085 </variablelist>
41086</refsect1>
41087<refsect1>
41088<title>Description</title>
41089<para>
41090   Initializes frontbuffer_bits and drrs.dp
41091</para>
41092</refsect1>
41093</refentry>
41094
41095<refentry id="API-intel-edp-drrs-disable">
41096<refentryinfo>
41097 <title>LINUX</title>
41098 <productname>Kernel Hackers Manual</productname>
41099 <date>July 2017</date>
41100</refentryinfo>
41101<refmeta>
41102 <refentrytitle><phrase>intel_edp_drrs_disable</phrase></refentrytitle>
41103 <manvolnum>9</manvolnum>
41104 <refmiscinfo class="version">4.4.14</refmiscinfo>
41105</refmeta>
41106<refnamediv>
41107 <refname>intel_edp_drrs_disable</refname>
41108 <refpurpose>
41109  Disable DRRS
41110 </refpurpose>
41111</refnamediv>
41112<refsynopsisdiv>
41113 <title>Synopsis</title>
41114  <funcsynopsis><funcprototype>
41115   <funcdef>void <function>intel_edp_drrs_disable </function></funcdef>
41116   <paramdef>struct intel_dp * <parameter>intel_dp</parameter></paramdef>
41117  </funcprototype></funcsynopsis>
41118</refsynopsisdiv>
41119<refsect1>
41120 <title>Arguments</title>
41121 <variablelist>
41122  <varlistentry>
41123   <term><parameter>intel_dp</parameter></term>
41124   <listitem>
41125    <para>
41126     DP struct
41127    </para>
41128   </listitem>
41129  </varlistentry>
41130 </variablelist>
41131</refsect1>
41132</refentry>
41133
41134<refentry id="API-intel-edp-drrs-invalidate">
41135<refentryinfo>
41136 <title>LINUX</title>
41137 <productname>Kernel Hackers Manual</productname>
41138 <date>July 2017</date>
41139</refentryinfo>
41140<refmeta>
41141 <refentrytitle><phrase>intel_edp_drrs_invalidate</phrase></refentrytitle>
41142 <manvolnum>9</manvolnum>
41143 <refmiscinfo class="version">4.4.14</refmiscinfo>
41144</refmeta>
41145<refnamediv>
41146 <refname>intel_edp_drrs_invalidate</refname>
41147 <refpurpose>
41148  Disable Idleness DRRS
41149 </refpurpose>
41150</refnamediv>
41151<refsynopsisdiv>
41152 <title>Synopsis</title>
41153  <funcsynopsis><funcprototype>
41154   <funcdef>void <function>intel_edp_drrs_invalidate </function></funcdef>
41155   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
41156   <paramdef>unsigned <parameter>frontbuffer_bits</parameter></paramdef>
41157  </funcprototype></funcsynopsis>
41158</refsynopsisdiv>
41159<refsect1>
41160 <title>Arguments</title>
41161 <variablelist>
41162  <varlistentry>
41163   <term><parameter>dev</parameter></term>
41164   <listitem>
41165    <para>
41166     DRM device
41167    </para>
41168   </listitem>
41169  </varlistentry>
41170  <varlistentry>
41171   <term><parameter>frontbuffer_bits</parameter></term>
41172   <listitem>
41173    <para>
41174     frontbuffer plane tracking bits
41175    </para>
41176   </listitem>
41177  </varlistentry>
41178 </variablelist>
41179</refsect1>
41180<refsect1>
41181<title>Description</title>
41182<para>
41183   This function gets called everytime rendering on the given planes start.
41184   Hence DRRS needs to be Upclocked, i.e. (LOW_RR -&gt; HIGH_RR).
41185   </para><para>
41186
41187   Dirty frontbuffers relevant to DRRS are tracked in busy_frontbuffer_bits.
41188</para>
41189</refsect1>
41190</refentry>
41191
41192<refentry id="API-intel-edp-drrs-flush">
41193<refentryinfo>
41194 <title>LINUX</title>
41195 <productname>Kernel Hackers Manual</productname>
41196 <date>July 2017</date>
41197</refentryinfo>
41198<refmeta>
41199 <refentrytitle><phrase>intel_edp_drrs_flush</phrase></refentrytitle>
41200 <manvolnum>9</manvolnum>
41201 <refmiscinfo class="version">4.4.14</refmiscinfo>
41202</refmeta>
41203<refnamediv>
41204 <refname>intel_edp_drrs_flush</refname>
41205 <refpurpose>
41206  Restart Idleness DRRS
41207 </refpurpose>
41208</refnamediv>
41209<refsynopsisdiv>
41210 <title>Synopsis</title>
41211  <funcsynopsis><funcprototype>
41212   <funcdef>void <function>intel_edp_drrs_flush </function></funcdef>
41213   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
41214   <paramdef>unsigned <parameter>frontbuffer_bits</parameter></paramdef>
41215  </funcprototype></funcsynopsis>
41216</refsynopsisdiv>
41217<refsect1>
41218 <title>Arguments</title>
41219 <variablelist>
41220  <varlistentry>
41221   <term><parameter>dev</parameter></term>
41222   <listitem>
41223    <para>
41224     DRM device
41225    </para>
41226   </listitem>
41227  </varlistentry>
41228  <varlistentry>
41229   <term><parameter>frontbuffer_bits</parameter></term>
41230   <listitem>
41231    <para>
41232     frontbuffer plane tracking bits
41233    </para>
41234   </listitem>
41235  </varlistentry>
41236 </variablelist>
41237</refsect1>
41238<refsect1>
41239<title>Description</title>
41240<para>
41241   This function gets called every time rendering on the given planes has
41242   completed or flip on a crtc is completed. So DRRS should be upclocked
41243   (LOW_RR -&gt; HIGH_RR). And also Idleness detection should be started again,
41244   if no other planes are dirty.
41245   </para><para>
41246
41247   Dirty frontbuffers relevant to DRRS are tracked in busy_frontbuffer_bits.
41248</para>
41249</refsect1>
41250</refentry>
41251
41252<refentry id="API-intel-dp-drrs-init">
41253<refentryinfo>
41254 <title>LINUX</title>
41255 <productname>Kernel Hackers Manual</productname>
41256 <date>July 2017</date>
41257</refentryinfo>
41258<refmeta>
41259 <refentrytitle><phrase>intel_dp_drrs_init</phrase></refentrytitle>
41260 <manvolnum>9</manvolnum>
41261 <refmiscinfo class="version">4.4.14</refmiscinfo>
41262</refmeta>
41263<refnamediv>
41264 <refname>intel_dp_drrs_init</refname>
41265 <refpurpose>
41266  Init basic DRRS work and mutex.
41267 </refpurpose>
41268</refnamediv>
41269<refsynopsisdiv>
41270 <title>Synopsis</title>
41271  <funcsynopsis><funcprototype>
41272   <funcdef>struct drm_display_mode * <function>intel_dp_drrs_init </function></funcdef>
41273   <paramdef>struct intel_connector * <parameter>intel_connector</parameter></paramdef>
41274   <paramdef>struct drm_display_mode * <parameter>fixed_mode</parameter></paramdef>
41275  </funcprototype></funcsynopsis>
41276</refsynopsisdiv>
41277<refsect1>
41278 <title>Arguments</title>
41279 <variablelist>
41280  <varlistentry>
41281   <term><parameter>intel_connector</parameter></term>
41282   <listitem>
41283    <para>
41284     eDP connector
41285    </para>
41286   </listitem>
41287  </varlistentry>
41288  <varlistentry>
41289   <term><parameter>fixed_mode</parameter></term>
41290   <listitem>
41291    <para>
41292     preferred mode of panel
41293    </para>
41294   </listitem>
41295  </varlistentry>
41296 </variablelist>
41297</refsect1>
41298<refsect1>
41299<title>Description</title>
41300<para>
41301   This function is  called only once at driver load to initialize basic
41302   DRRS stuff.
41303</para>
41304</refsect1>
41305<refsect1>
41306<title>Returns</title>
41307<para>
41308   Downclock mode if panel supports it, else return NULL.
41309   DRRS support is determined by the presence of downclock mode (apart
41310   from VBT setting).
41311</para>
41312</refsect1>
41313</refentry>
41314
41315
41316      </sect2>
41317      <sect2>
41318        <title>DPIO</title>
41319<para>
41320   </para><para>
41321   VLV, CHV and BXT have slightly peculiar display PHYs for driving DP/HDMI
41322   ports. DPIO is the name given to such a display PHY. These PHYs
41323   don't follow the standard programming model using direct MMIO
41324   registers, and instead their registers must be accessed trough IOSF
41325   sideband. VLV has one such PHY for driving ports B and C, and CHV
41326   adds another PHY for driving port D. Each PHY responds to specific
41327   IOSF-SB port.
41328   </para><para>
41329   Each display PHY is made up of one or two channels. Each channel
41330   houses a common lane part which contains the PLL and other common
41331   logic. CH0 common lane also contains the IOSF-SB logic for the
41332   Common Register Interface (CRI) ie. the DPIO registers. CRI clock
41333   must be running when any DPIO registers are accessed.
41334   </para><para>
41335   In addition to having their own registers, the PHYs are also
41336   controlled through some dedicated signals from the display
41337   controller. These include PLL reference clock enable, PLL enable,
41338   and CRI clock selection, for example.
41339   </para><para>
41340   Eeach channel also has two splines (also called data lanes), and
41341   each spline is made up of one Physical Access Coding Sub-Layer
41342   (PCS) block and two TX lanes. So each channel has two PCS blocks
41343   and four TX lanes. The TX lanes are used as DP lanes or TMDS
41344   data/clock pairs depending on the output type.
41345   </para><para>
41346   Additionally the PHY also contains an AUX lane with AUX blocks
41347   for each channel. This is used for DP AUX communication, but
41348   this fact isn't really relevant for the driver since AUX is
41349   controlled from the display controller side. No DPIO registers
41350   need to be accessed during AUX communication,
41351   </para><para>
41352   Generally on VLV/CHV the common lane corresponds to the pipe and
41353   the spline (PCS/TX) corresponds to the port.
41354   </para><para>
41355   For dual channel PHY (VLV/CHV):
41356   </para><para>
41357   pipe A == CMN/PLL/REF CH0
41358   </para><para>
41359   pipe B == CMN/PLL/REF CH1
41360   </para><para>
41361   port B == PCS/TX CH0
41362   </para><para>
41363   port C == PCS/TX CH1
41364   </para><para>
41365   This is especially important when we cross the streams
41366   ie. drive port B with pipe B, or port C with pipe A.
41367   </para><para>
41368   For single channel PHY (CHV):
41369   </para><para>
41370   pipe C == CMN/PLL/REF CH0
41371   </para><para>
41372   port D == PCS/TX CH0
41373   </para><para>
41374   On BXT the entire PHY channel corresponds to the port. That means
41375   the PLL is also now associated with the port rather than the pipe,
41376   and so the clock needs to be routed to the appropriate transcoder.
41377   Port A PLL is directly connected to transcoder EDP and port B/C
41378   PLLs can be routed to any transcoder A/B/C.
41379   </para><para>
41380   Note: DDI0 is digital port B, DD1 is digital port C, and DDI2 is
41381   digital port D (CHV) or port A (BXT).
41382</para>
41383
41384	<table id="dpiox2">
41385	  <title>Dual channel PHY (VLV/CHV/BXT)</title>
41386	  <tgroup cols="8">
41387	    <colspec colname="c0" />
41388	    <colspec colname="c1" />
41389	    <colspec colname="c2" />
41390	    <colspec colname="c3" />
41391	    <colspec colname="c4" />
41392	    <colspec colname="c5" />
41393	    <colspec colname="c6" />
41394	    <colspec colname="c7" />
41395	    <spanspec spanname="ch0" namest="c0" nameend="c3" />
41396	    <spanspec spanname="ch1" namest="c4" nameend="c7" />
41397	    <spanspec spanname="ch0pcs01" namest="c0" nameend="c1" />
41398	    <spanspec spanname="ch0pcs23" namest="c2" nameend="c3" />
41399	    <spanspec spanname="ch1pcs01" namest="c4" nameend="c5" />
41400	    <spanspec spanname="ch1pcs23" namest="c6" nameend="c7" />
41401	    <thead>
41402	      <row>
41403		<entry spanname="ch0">CH0</entry>
41404		<entry spanname="ch1">CH1</entry>
41405	      </row>
41406	    </thead>
41407	    <tbody valign="top" align="center">
41408	      <row>
41409		<entry spanname="ch0">CMN/PLL/REF</entry>
41410		<entry spanname="ch1">CMN/PLL/REF</entry>
41411	      </row>
41412	      <row>
41413		<entry spanname="ch0pcs01">PCS01</entry>
41414		<entry spanname="ch0pcs23">PCS23</entry>
41415		<entry spanname="ch1pcs01">PCS01</entry>
41416		<entry spanname="ch1pcs23">PCS23</entry>
41417	      </row>
41418	      <row>
41419		<entry>TX0</entry>
41420		<entry>TX1</entry>
41421		<entry>TX2</entry>
41422		<entry>TX3</entry>
41423		<entry>TX0</entry>
41424		<entry>TX1</entry>
41425		<entry>TX2</entry>
41426		<entry>TX3</entry>
41427	      </row>
41428	      <row>
41429		<entry spanname="ch0">DDI0</entry>
41430		<entry spanname="ch1">DDI1</entry>
41431	      </row>
41432	    </tbody>
41433	  </tgroup>
41434	</table>
41435	<table id="dpiox1">
41436	  <title>Single channel PHY (CHV/BXT)</title>
41437	  <tgroup cols="4">
41438	    <colspec colname="c0" />
41439	    <colspec colname="c1" />
41440	    <colspec colname="c2" />
41441	    <colspec colname="c3" />
41442	    <spanspec spanname="ch0" namest="c0" nameend="c3" />
41443	    <spanspec spanname="ch0pcs01" namest="c0" nameend="c1" />
41444	    <spanspec spanname="ch0pcs23" namest="c2" nameend="c3" />
41445	    <thead>
41446	      <row>
41447		<entry spanname="ch0">CH0</entry>
41448	      </row>
41449	    </thead>
41450	    <tbody valign="top" align="center">
41451	      <row>
41452		<entry spanname="ch0">CMN/PLL/REF</entry>
41453	      </row>
41454	      <row>
41455		<entry spanname="ch0pcs01">PCS01</entry>
41456		<entry spanname="ch0pcs23">PCS23</entry>
41457	      </row>
41458	      <row>
41459		<entry>TX0</entry>
41460		<entry>TX1</entry>
41461		<entry>TX2</entry>
41462		<entry>TX3</entry>
41463	      </row>
41464	      <row>
41465		<entry spanname="ch0">DDI2</entry>
41466	      </row>
41467	    </tbody>
41468	  </tgroup>
41469	</table>
41470      </sect2>
41471
41472      <sect2>
41473       <title>CSR firmware support for DMC</title>
41474<para>
41475   </para><para>
41476   Display Context Save and Restore (CSR) firmware support added from gen9
41477   onwards to drive newly added DMC (Display microcontroller) in display
41478   engine to save and restore the state of display engine when it enter into
41479   low-power state and comes back to normal.
41480   </para><para>
41481   Firmware loading status will be one of the below states: FW_UNINITIALIZED,
41482   FW_LOADED, FW_FAILED.
41483   </para><para>
41484   Once the firmware is written into the registers status will be moved from
41485   FW_UNINITIALIZED to FW_LOADED and for any erroneous condition status will
41486   be moved to FW_FAILED.
41487</para>
41488
41489<!-- drivers/gpu/drm/i915/intel_csr.c -->
41490<refentry id="API-intel-csr-load-status-get">
41491<refentryinfo>
41492 <title>LINUX</title>
41493 <productname>Kernel Hackers Manual</productname>
41494 <date>July 2017</date>
41495</refentryinfo>
41496<refmeta>
41497 <refentrytitle><phrase>intel_csr_load_status_get</phrase></refentrytitle>
41498 <manvolnum>9</manvolnum>
41499 <refmiscinfo class="version">4.4.14</refmiscinfo>
41500</refmeta>
41501<refnamediv>
41502 <refname>intel_csr_load_status_get</refname>
41503 <refpurpose>
41504  to get firmware loading status.
41505 </refpurpose>
41506</refnamediv>
41507<refsynopsisdiv>
41508 <title>Synopsis</title>
41509  <funcsynopsis><funcprototype>
41510   <funcdef>enum csr_state <function>intel_csr_load_status_get </function></funcdef>
41511   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
41512  </funcprototype></funcsynopsis>
41513</refsynopsisdiv>
41514<refsect1>
41515 <title>Arguments</title>
41516 <variablelist>
41517  <varlistentry>
41518   <term><parameter>dev_priv</parameter></term>
41519   <listitem>
41520    <para>
41521     i915 device.
41522    </para>
41523   </listitem>
41524  </varlistentry>
41525 </variablelist>
41526</refsect1>
41527<refsect1>
41528<title>Description</title>
41529<para>
41530   This function helps to get the firmware loading status.
41531</para>
41532</refsect1>
41533<refsect1>
41534<title>Return</title>
41535<para>
41536   Firmware loading status.
41537</para>
41538</refsect1>
41539</refentry>
41540
41541<refentry id="API-intel-csr-load-status-set">
41542<refentryinfo>
41543 <title>LINUX</title>
41544 <productname>Kernel Hackers Manual</productname>
41545 <date>July 2017</date>
41546</refentryinfo>
41547<refmeta>
41548 <refentrytitle><phrase>intel_csr_load_status_set</phrase></refentrytitle>
41549 <manvolnum>9</manvolnum>
41550 <refmiscinfo class="version">4.4.14</refmiscinfo>
41551</refmeta>
41552<refnamediv>
41553 <refname>intel_csr_load_status_set</refname>
41554 <refpurpose>
41555     help to set firmware loading status.
41556 </refpurpose>
41557</refnamediv>
41558<refsynopsisdiv>
41559 <title>Synopsis</title>
41560  <funcsynopsis><funcprototype>
41561   <funcdef>void <function>intel_csr_load_status_set </function></funcdef>
41562   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
41563   <paramdef>enum csr_state <parameter>state</parameter></paramdef>
41564  </funcprototype></funcsynopsis>
41565</refsynopsisdiv>
41566<refsect1>
41567 <title>Arguments</title>
41568 <variablelist>
41569  <varlistentry>
41570   <term><parameter>dev_priv</parameter></term>
41571   <listitem>
41572    <para>
41573     i915 device.
41574    </para>
41575   </listitem>
41576  </varlistentry>
41577  <varlistentry>
41578   <term><parameter>state</parameter></term>
41579   <listitem>
41580    <para>
41581     enumeration of firmware loading status.
41582    </para>
41583   </listitem>
41584  </varlistentry>
41585 </variablelist>
41586</refsect1>
41587<refsect1>
41588<title>Description</title>
41589<para>
41590   Set the firmware loading status.
41591</para>
41592</refsect1>
41593</refentry>
41594
41595<refentry id="API-intel-csr-load-program">
41596<refentryinfo>
41597 <title>LINUX</title>
41598 <productname>Kernel Hackers Manual</productname>
41599 <date>July 2017</date>
41600</refentryinfo>
41601<refmeta>
41602 <refentrytitle><phrase>intel_csr_load_program</phrase></refentrytitle>
41603 <manvolnum>9</manvolnum>
41604 <refmiscinfo class="version">4.4.14</refmiscinfo>
41605</refmeta>
41606<refnamediv>
41607 <refname>intel_csr_load_program</refname>
41608 <refpurpose>
41609     write the firmware from memory to register.
41610 </refpurpose>
41611</refnamediv>
41612<refsynopsisdiv>
41613 <title>Synopsis</title>
41614  <funcsynopsis><funcprototype>
41615   <funcdef>void <function>intel_csr_load_program </function></funcdef>
41616   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
41617  </funcprototype></funcsynopsis>
41618</refsynopsisdiv>
41619<refsect1>
41620 <title>Arguments</title>
41621 <variablelist>
41622  <varlistentry>
41623   <term><parameter>dev</parameter></term>
41624   <listitem>
41625    <para>
41626     drm device.
41627    </para>
41628   </listitem>
41629  </varlistentry>
41630 </variablelist>
41631</refsect1>
41632<refsect1>
41633<title>Description</title>
41634<para>
41635   CSR firmware is read from a .bin file and kept in internal memory one time.
41636   Everytime display comes back from low power state this function is called to
41637   copy the firmware from internal memory to registers.
41638</para>
41639</refsect1>
41640</refentry>
41641
41642<refentry id="API-intel-csr-ucode-init">
41643<refentryinfo>
41644 <title>LINUX</title>
41645 <productname>Kernel Hackers Manual</productname>
41646 <date>July 2017</date>
41647</refentryinfo>
41648<refmeta>
41649 <refentrytitle><phrase>intel_csr_ucode_init</phrase></refentrytitle>
41650 <manvolnum>9</manvolnum>
41651 <refmiscinfo class="version">4.4.14</refmiscinfo>
41652</refmeta>
41653<refnamediv>
41654 <refname>intel_csr_ucode_init</refname>
41655 <refpurpose>
41656     initialize the firmware loading.
41657 </refpurpose>
41658</refnamediv>
41659<refsynopsisdiv>
41660 <title>Synopsis</title>
41661  <funcsynopsis><funcprototype>
41662   <funcdef>void <function>intel_csr_ucode_init </function></funcdef>
41663   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
41664  </funcprototype></funcsynopsis>
41665</refsynopsisdiv>
41666<refsect1>
41667 <title>Arguments</title>
41668 <variablelist>
41669  <varlistentry>
41670   <term><parameter>dev</parameter></term>
41671   <listitem>
41672    <para>
41673     drm device.
41674    </para>
41675   </listitem>
41676  </varlistentry>
41677 </variablelist>
41678</refsect1>
41679<refsect1>
41680<title>Description</title>
41681<para>
41682   This function is called at the time of loading the display driver to read
41683   firmware from a .bin file and copied into a internal memory.
41684</para>
41685</refsect1>
41686</refentry>
41687
41688<refentry id="API-intel-csr-ucode-fini">
41689<refentryinfo>
41690 <title>LINUX</title>
41691 <productname>Kernel Hackers Manual</productname>
41692 <date>July 2017</date>
41693</refentryinfo>
41694<refmeta>
41695 <refentrytitle><phrase>intel_csr_ucode_fini</phrase></refentrytitle>
41696 <manvolnum>9</manvolnum>
41697 <refmiscinfo class="version">4.4.14</refmiscinfo>
41698</refmeta>
41699<refnamediv>
41700 <refname>intel_csr_ucode_fini</refname>
41701 <refpurpose>
41702     unload the CSR firmware.
41703 </refpurpose>
41704</refnamediv>
41705<refsynopsisdiv>
41706 <title>Synopsis</title>
41707  <funcsynopsis><funcprototype>
41708   <funcdef>void <function>intel_csr_ucode_fini </function></funcdef>
41709   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
41710  </funcprototype></funcsynopsis>
41711</refsynopsisdiv>
41712<refsect1>
41713 <title>Arguments</title>
41714 <variablelist>
41715  <varlistentry>
41716   <term><parameter>dev</parameter></term>
41717   <listitem>
41718    <para>
41719     drm device.
41720    </para>
41721   </listitem>
41722  </varlistentry>
41723 </variablelist>
41724</refsect1>
41725<refsect1>
41726<title>Description</title>
41727<para>
41728   Firmmware unloading includes freeing the internal momory and reset the
41729   firmware loading status.
41730</para>
41731</refsect1>
41732</refentry>
41733
41734      </sect2>
41735    </sect1>
41736
41737    <sect1>
41738      <title>Memory Management and Command Submission</title>
41739      <para>
41740	This sections covers all things related to the GEM implementation in the
41741	i915 driver.
41742      </para>
41743      <sect2>
41744        <title>Batchbuffer Parsing</title>
41745<para>
41746   </para><para>
41747   Motivation:
41748   Certain OpenGL features (e.g. transform feedback, performance monitoring)
41749   require userspace code to submit batches containing commands such as
41750   MI_LOAD_REGISTER_IMM to access various registers. Unfortunately, some
41751   generations of the hardware will noop these commands in <quote>unsecure</quote> batches
41752   (which includes all userspace batches submitted via i915) even though the
41753   commands may be safe and represent the intended programming model of the
41754   device.
41755   </para><para>
41756   The software command parser is similar in operation to the command parsing
41757   done in hardware for unsecure batches. However, the software parser allows
41758   some operations that would be noop'd by hardware, if the parser determines
41759   the operation is safe, and submits the batch as <quote>secure</quote> to prevent hardware
41760   parsing.
41761   </para><para>
41762   Threats:
41763   At a high level, the hardware (and software) checks attempt to prevent
41764   granting userspace undue privileges. There are three categories of privilege.
41765   </para><para>
41766   First, commands which are explicitly defined as privileged or which should
41767   only be used by the kernel driver. The parser generally rejects such
41768   commands, though it may allow some from the drm master process.
41769   </para><para>
41770   Second, commands which access registers. To support correct/enhanced
41771   userspace functionality, particularly certain OpenGL extensions, the parser
41772   provides a whitelist of registers which userspace may safely access (for both
41773   normal and drm master processes).
41774   </para><para>
41775   Third, commands which access privileged memory (i.e. GGTT, HWS page, etc).
41776   The parser always rejects such commands.
41777   </para><para>
41778   The majority of the problematic commands fall in the MI_* range, with only a
41779   few specific commands on each ring (e.g. PIPE_CONTROL and MI_FLUSH_DW).
41780   </para><para>
41781   Implementation:
41782   Each ring maintains tables of commands and registers which the parser uses in
41783   scanning batch buffers submitted to that ring.
41784   </para><para>
41785   Since the set of commands that the parser must check for is significantly
41786   smaller than the number of commands supported, the parser tables contain only
41787   those commands required by the parser. This generally works because command
41788   opcode ranges have standard command length encodings. So for commands that
41789   the parser does not need to check, it can easily skip them. This is
41790   implemented via a per-ring length decoding vfunc.
41791   </para><para>
41792   Unfortunately, there are a number of commands that do not follow the standard
41793   length encoding for their opcode range, primarily amongst the MI_* commands.
41794   To handle this, the parser provides a way to define explicit <quote>skip</quote> entries
41795   in the per-ring command tables.
41796   </para><para>
41797   Other command table entries map fairly directly to high level categories
41798   mentioned above: rejected, master-only, register whitelist. The parser
41799   implements a number of checks, including the privileged memory checks, via a
41800   general bitmasking mechanism.
41801</para>
41802
41803<!-- drivers/gpu/drm/i915/i915_cmd_parser.c -->
41804<refentry id="API-i915-cmd-parser-init-ring">
41805<refentryinfo>
41806 <title>LINUX</title>
41807 <productname>Kernel Hackers Manual</productname>
41808 <date>July 2017</date>
41809</refentryinfo>
41810<refmeta>
41811 <refentrytitle><phrase>i915_cmd_parser_init_ring</phrase></refentrytitle>
41812 <manvolnum>9</manvolnum>
41813 <refmiscinfo class="version">4.4.14</refmiscinfo>
41814</refmeta>
41815<refnamediv>
41816 <refname>i915_cmd_parser_init_ring</refname>
41817 <refpurpose>
41818  set cmd parser related fields for a ringbuffer
41819 </refpurpose>
41820</refnamediv>
41821<refsynopsisdiv>
41822 <title>Synopsis</title>
41823  <funcsynopsis><funcprototype>
41824   <funcdef>int <function>i915_cmd_parser_init_ring </function></funcdef>
41825   <paramdef>struct intel_engine_cs * <parameter>ring</parameter></paramdef>
41826  </funcprototype></funcsynopsis>
41827</refsynopsisdiv>
41828<refsect1>
41829 <title>Arguments</title>
41830 <variablelist>
41831  <varlistentry>
41832   <term><parameter>ring</parameter></term>
41833   <listitem>
41834    <para>
41835     the ringbuffer to initialize
41836    </para>
41837   </listitem>
41838  </varlistentry>
41839 </variablelist>
41840</refsect1>
41841<refsect1>
41842<title>Description</title>
41843<para>
41844   Optionally initializes fields related to batch buffer command parsing in the
41845   struct intel_engine_cs based on whether the platform requires software
41846   command parsing.
41847</para>
41848</refsect1>
41849<refsect1>
41850<title>Return</title>
41851<para>
41852   non-zero if initialization fails
41853</para>
41854</refsect1>
41855</refentry>
41856
41857<refentry id="API-i915-cmd-parser-fini-ring">
41858<refentryinfo>
41859 <title>LINUX</title>
41860 <productname>Kernel Hackers Manual</productname>
41861 <date>July 2017</date>
41862</refentryinfo>
41863<refmeta>
41864 <refentrytitle><phrase>i915_cmd_parser_fini_ring</phrase></refentrytitle>
41865 <manvolnum>9</manvolnum>
41866 <refmiscinfo class="version">4.4.14</refmiscinfo>
41867</refmeta>
41868<refnamediv>
41869 <refname>i915_cmd_parser_fini_ring</refname>
41870 <refpurpose>
41871     clean up cmd parser related fields
41872 </refpurpose>
41873</refnamediv>
41874<refsynopsisdiv>
41875 <title>Synopsis</title>
41876  <funcsynopsis><funcprototype>
41877   <funcdef>void <function>i915_cmd_parser_fini_ring </function></funcdef>
41878   <paramdef>struct intel_engine_cs * <parameter>ring</parameter></paramdef>
41879  </funcprototype></funcsynopsis>
41880</refsynopsisdiv>
41881<refsect1>
41882 <title>Arguments</title>
41883 <variablelist>
41884  <varlistentry>
41885   <term><parameter>ring</parameter></term>
41886   <listitem>
41887    <para>
41888     the ringbuffer to clean up
41889    </para>
41890   </listitem>
41891  </varlistentry>
41892 </variablelist>
41893</refsect1>
41894<refsect1>
41895<title>Description</title>
41896<para>
41897   Releases any resources related to command parsing that may have been
41898   initialized for the specified ring.
41899</para>
41900</refsect1>
41901</refentry>
41902
41903<refentry id="API-i915-needs-cmd-parser">
41904<refentryinfo>
41905 <title>LINUX</title>
41906 <productname>Kernel Hackers Manual</productname>
41907 <date>July 2017</date>
41908</refentryinfo>
41909<refmeta>
41910 <refentrytitle><phrase>i915_needs_cmd_parser</phrase></refentrytitle>
41911 <manvolnum>9</manvolnum>
41912 <refmiscinfo class="version">4.4.14</refmiscinfo>
41913</refmeta>
41914<refnamediv>
41915 <refname>i915_needs_cmd_parser</refname>
41916 <refpurpose>
41917     should a given ring use software command parsing?
41918 </refpurpose>
41919</refnamediv>
41920<refsynopsisdiv>
41921 <title>Synopsis</title>
41922  <funcsynopsis><funcprototype>
41923   <funcdef>bool <function>i915_needs_cmd_parser </function></funcdef>
41924   <paramdef>struct intel_engine_cs * <parameter>ring</parameter></paramdef>
41925  </funcprototype></funcsynopsis>
41926</refsynopsisdiv>
41927<refsect1>
41928 <title>Arguments</title>
41929 <variablelist>
41930  <varlistentry>
41931   <term><parameter>ring</parameter></term>
41932   <listitem>
41933    <para>
41934     the ring in question
41935    </para>
41936   </listitem>
41937  </varlistentry>
41938 </variablelist>
41939</refsect1>
41940<refsect1>
41941<title>Description</title>
41942<para>
41943   Only certain platforms require software batch buffer command parsing, and
41944   only when enabled via module parameter.
41945</para>
41946</refsect1>
41947<refsect1>
41948<title>Return</title>
41949<para>
41950   true if the ring requires software command parsing
41951</para>
41952</refsect1>
41953</refentry>
41954
41955<refentry id="API-i915-parse-cmds">
41956<refentryinfo>
41957 <title>LINUX</title>
41958 <productname>Kernel Hackers Manual</productname>
41959 <date>July 2017</date>
41960</refentryinfo>
41961<refmeta>
41962 <refentrytitle><phrase>i915_parse_cmds</phrase></refentrytitle>
41963 <manvolnum>9</manvolnum>
41964 <refmiscinfo class="version">4.4.14</refmiscinfo>
41965</refmeta>
41966<refnamediv>
41967 <refname>i915_parse_cmds</refname>
41968 <refpurpose>
41969     parse a submitted batch buffer for privilege violations
41970 </refpurpose>
41971</refnamediv>
41972<refsynopsisdiv>
41973 <title>Synopsis</title>
41974  <funcsynopsis><funcprototype>
41975   <funcdef>int <function>i915_parse_cmds </function></funcdef>
41976   <paramdef>struct intel_engine_cs * <parameter>ring</parameter></paramdef>
41977   <paramdef>struct drm_i915_gem_object * <parameter>batch_obj</parameter></paramdef>
41978   <paramdef>struct drm_i915_gem_object * <parameter>shadow_batch_obj</parameter></paramdef>
41979   <paramdef>u32 <parameter>batch_start_offset</parameter></paramdef>
41980   <paramdef>u32 <parameter>batch_len</parameter></paramdef>
41981   <paramdef>bool <parameter>is_master</parameter></paramdef>
41982  </funcprototype></funcsynopsis>
41983</refsynopsisdiv>
41984<refsect1>
41985 <title>Arguments</title>
41986 <variablelist>
41987  <varlistentry>
41988   <term><parameter>ring</parameter></term>
41989   <listitem>
41990    <para>
41991     the ring on which the batch is to execute
41992    </para>
41993   </listitem>
41994  </varlistentry>
41995  <varlistentry>
41996   <term><parameter>batch_obj</parameter></term>
41997   <listitem>
41998    <para>
41999     the batch buffer in question
42000    </para>
42001   </listitem>
42002  </varlistentry>
42003  <varlistentry>
42004   <term><parameter>shadow_batch_obj</parameter></term>
42005   <listitem>
42006    <para>
42007     copy of the batch buffer in question
42008    </para>
42009   </listitem>
42010  </varlistentry>
42011  <varlistentry>
42012   <term><parameter>batch_start_offset</parameter></term>
42013   <listitem>
42014    <para>
42015     byte offset in the batch at which execution starts
42016    </para>
42017   </listitem>
42018  </varlistentry>
42019  <varlistentry>
42020   <term><parameter>batch_len</parameter></term>
42021   <listitem>
42022    <para>
42023     length of the commands in batch_obj
42024    </para>
42025   </listitem>
42026  </varlistentry>
42027  <varlistentry>
42028   <term><parameter>is_master</parameter></term>
42029   <listitem>
42030    <para>
42031     is the submitting process the drm master?
42032    </para>
42033   </listitem>
42034  </varlistentry>
42035 </variablelist>
42036</refsect1>
42037<refsect1>
42038<title>Description</title>
42039<para>
42040   Parses the specified batch buffer looking for privilege violations as
42041   described in the overview.
42042</para>
42043</refsect1>
42044<refsect1>
42045<title>Return</title>
42046<para>
42047   non-zero if the parser finds violations or otherwise fails; -EACCES
42048   if the batch appears legal but should use hardware parsing
42049</para>
42050</refsect1>
42051</refentry>
42052
42053<refentry id="API-i915-cmd-parser-get-version">
42054<refentryinfo>
42055 <title>LINUX</title>
42056 <productname>Kernel Hackers Manual</productname>
42057 <date>July 2017</date>
42058</refentryinfo>
42059<refmeta>
42060 <refentrytitle><phrase>i915_cmd_parser_get_version</phrase></refentrytitle>
42061 <manvolnum>9</manvolnum>
42062 <refmiscinfo class="version">4.4.14</refmiscinfo>
42063</refmeta>
42064<refnamediv>
42065 <refname>i915_cmd_parser_get_version</refname>
42066 <refpurpose>
42067     get the cmd parser version number
42068 </refpurpose>
42069</refnamediv>
42070<refsynopsisdiv>
42071 <title>Synopsis</title>
42072  <funcsynopsis><funcprototype>
42073   <funcdef>int <function>i915_cmd_parser_get_version </function></funcdef>
42074   <paramdef> <parameter>void</parameter></paramdef>
42075  </funcprototype></funcsynopsis>
42076</refsynopsisdiv>
42077<refsect1>
42078 <title>Arguments</title>
42079 <variablelist>
42080  <varlistentry>
42081   <term><parameter>void</parameter></term>
42082   <listitem>
42083    <para>
42084     no arguments
42085    </para>
42086   </listitem>
42087  </varlistentry>
42088 </variablelist>
42089</refsect1>
42090<refsect1>
42091<title>Description</title>
42092<para>
42093   </para><para>
42094
42095   The cmd parser maintains a simple increasing integer version number suitable
42096   for passing to userspace clients to determine what operations are permitted.
42097</para>
42098</refsect1>
42099<refsect1>
42100<title>Return</title>
42101<para>
42102   the current version number of the cmd parser
42103</para>
42104</refsect1>
42105</refentry>
42106
42107      </sect2>
42108      <sect2>
42109        <title>Batchbuffer Pools</title>
42110<para>
42111   </para><para>
42112   In order to submit batch buffers as 'secure', the software command parser
42113   must ensure that a batch buffer cannot be modified after parsing. It does
42114   this by copying the user provided batch buffer contents to a kernel owned
42115   buffer from which the hardware will actually execute, and by carefully
42116   managing the address space bindings for such buffers.
42117   </para><para>
42118   The batch pool framework provides a mechanism for the driver to manage a
42119   set of scratch buffers to use for this purpose. The framework can be
42120   extended to support other uses cases should they arise.
42121</para>
42122
42123<!-- drivers/gpu/drm/i915/i915_gem_batch_pool.c -->
42124<refentry id="API-i915-gem-batch-pool-init">
42125<refentryinfo>
42126 <title>LINUX</title>
42127 <productname>Kernel Hackers Manual</productname>
42128 <date>July 2017</date>
42129</refentryinfo>
42130<refmeta>
42131 <refentrytitle><phrase>i915_gem_batch_pool_init</phrase></refentrytitle>
42132 <manvolnum>9</manvolnum>
42133 <refmiscinfo class="version">4.4.14</refmiscinfo>
42134</refmeta>
42135<refnamediv>
42136 <refname>i915_gem_batch_pool_init</refname>
42137 <refpurpose>
42138  initialize a batch buffer pool
42139 </refpurpose>
42140</refnamediv>
42141<refsynopsisdiv>
42142 <title>Synopsis</title>
42143  <funcsynopsis><funcprototype>
42144   <funcdef>void <function>i915_gem_batch_pool_init </function></funcdef>
42145   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
42146   <paramdef>struct i915_gem_batch_pool * <parameter>pool</parameter></paramdef>
42147  </funcprototype></funcsynopsis>
42148</refsynopsisdiv>
42149<refsect1>
42150 <title>Arguments</title>
42151 <variablelist>
42152  <varlistentry>
42153   <term><parameter>dev</parameter></term>
42154   <listitem>
42155    <para>
42156     the drm device
42157    </para>
42158   </listitem>
42159  </varlistentry>
42160  <varlistentry>
42161   <term><parameter>pool</parameter></term>
42162   <listitem>
42163    <para>
42164     the batch buffer pool
42165    </para>
42166   </listitem>
42167  </varlistentry>
42168 </variablelist>
42169</refsect1>
42170</refentry>
42171
42172<refentry id="API-i915-gem-batch-pool-fini">
42173<refentryinfo>
42174 <title>LINUX</title>
42175 <productname>Kernel Hackers Manual</productname>
42176 <date>July 2017</date>
42177</refentryinfo>
42178<refmeta>
42179 <refentrytitle><phrase>i915_gem_batch_pool_fini</phrase></refentrytitle>
42180 <manvolnum>9</manvolnum>
42181 <refmiscinfo class="version">4.4.14</refmiscinfo>
42182</refmeta>
42183<refnamediv>
42184 <refname>i915_gem_batch_pool_fini</refname>
42185 <refpurpose>
42186     clean up a batch buffer pool
42187 </refpurpose>
42188</refnamediv>
42189<refsynopsisdiv>
42190 <title>Synopsis</title>
42191  <funcsynopsis><funcprototype>
42192   <funcdef>void <function>i915_gem_batch_pool_fini </function></funcdef>
42193   <paramdef>struct i915_gem_batch_pool * <parameter>pool</parameter></paramdef>
42194  </funcprototype></funcsynopsis>
42195</refsynopsisdiv>
42196<refsect1>
42197 <title>Arguments</title>
42198 <variablelist>
42199  <varlistentry>
42200   <term><parameter>pool</parameter></term>
42201   <listitem>
42202    <para>
42203     the pool to clean up
42204    </para>
42205   </listitem>
42206  </varlistentry>
42207 </variablelist>
42208</refsect1>
42209<refsect1>
42210<title>Note</title>
42211<para>
42212   Callers must hold the struct_mutex.
42213</para>
42214</refsect1>
42215</refentry>
42216
42217<refentry id="API-i915-gem-batch-pool-get">
42218<refentryinfo>
42219 <title>LINUX</title>
42220 <productname>Kernel Hackers Manual</productname>
42221 <date>July 2017</date>
42222</refentryinfo>
42223<refmeta>
42224 <refentrytitle><phrase>i915_gem_batch_pool_get</phrase></refentrytitle>
42225 <manvolnum>9</manvolnum>
42226 <refmiscinfo class="version">4.4.14</refmiscinfo>
42227</refmeta>
42228<refnamediv>
42229 <refname>i915_gem_batch_pool_get</refname>
42230 <refpurpose>
42231     allocate a buffer from the pool
42232 </refpurpose>
42233</refnamediv>
42234<refsynopsisdiv>
42235 <title>Synopsis</title>
42236  <funcsynopsis><funcprototype>
42237   <funcdef>struct drm_i915_gem_object * <function>i915_gem_batch_pool_get </function></funcdef>
42238   <paramdef>struct i915_gem_batch_pool * <parameter>pool</parameter></paramdef>
42239   <paramdef>size_t <parameter>size</parameter></paramdef>
42240  </funcprototype></funcsynopsis>
42241</refsynopsisdiv>
42242<refsect1>
42243 <title>Arguments</title>
42244 <variablelist>
42245  <varlistentry>
42246   <term><parameter>pool</parameter></term>
42247   <listitem>
42248    <para>
42249     the batch buffer pool
42250    </para>
42251   </listitem>
42252  </varlistentry>
42253  <varlistentry>
42254   <term><parameter>size</parameter></term>
42255   <listitem>
42256    <para>
42257     the minimum desired size of the returned buffer
42258    </para>
42259   </listitem>
42260  </varlistentry>
42261 </variablelist>
42262</refsect1>
42263<refsect1>
42264<title>Description</title>
42265<para>
42266   Returns an inactive buffer from <parameter>pool</parameter> with at least <parameter>size</parameter> bytes,
42267   with the pages pinned. The caller must <function>i915_gem_object_unpin_pages</function>
42268   on the returned object.
42269</para>
42270</refsect1>
42271<refsect1>
42272<title>Note</title>
42273<para>
42274   Callers must hold the struct_mutex
42275</para>
42276</refsect1>
42277<refsect1>
42278<title>Return</title>
42279<para>
42280   the buffer object or an error pointer
42281</para>
42282</refsect1>
42283</refentry>
42284
42285      </sect2>
42286      <sect2>
42287        <title>Logical Rings, Logical Ring Contexts and Execlists</title>
42288<para>
42289   </para><para>
42290   Motivation:
42291   GEN8 brings an expansion of the HW contexts: <quote>Logical Ring Contexts</quote>.
42292   These expanded contexts enable a number of new abilities, especially
42293   <quote>Execlists</quote> (also implemented in this file).
42294   </para><para>
42295   One of the main differences with the legacy HW contexts is that logical
42296   ring contexts incorporate many more things to the context's state, like
42297   PDPs or ringbuffer control registers:
42298   </para><para>
42299   The reason why PDPs are included in the context is straightforward: as
42300   PPGTTs (per-process GTTs) are actually per-context, having the PDPs
42301   contained there mean you don't need to do a ppgtt-&gt;switch_mm yourself,
42302   instead, the GPU will do it for you on the context switch.
42303   </para><para>
42304   But, what about the ringbuffer control registers (head, tail, etc..)?
42305   shouldn't we just need a set of those per engine command streamer? This is
42306   where the name <quote>Logical Rings</quote> starts to make sense: by virtualizing the
42307   rings, the engine cs shifts to a new <quote>ring buffer</quote> with every context
42308   switch. When you want to submit a workload to the GPU you: A) choose your
42309   context, B) find its appropriate virtualized ring, C) write commands to it
42310   and then, finally, D) tell the GPU to switch to that context.
42311   </para><para>
42312   Instead of the legacy MI_SET_CONTEXT, the way you tell the GPU to switch
42313   to a contexts is via a context execution list, ergo <quote>Execlists</quote>.
42314   </para><para>
42315   LRC implementation:
42316   Regarding the creation of contexts, we have:
42317   </para><para>
42318   - One global default context.
42319   - One local default context for each opened fd.
42320   - One local extra context for each context create ioctl call.
42321   </para><para>
42322   Now that ringbuffers belong per-context (and not per-engine, like before)
42323   and that contexts are uniquely tied to a given engine (and not reusable,
42324   like before) we need:
42325   </para><para>
42326   - One ringbuffer per-engine inside each context.
42327   - One backing object per-engine inside each context.
42328   </para><para>
42329   The global default context starts its life with these new objects fully
42330   allocated and populated. The local default context for each opened fd is
42331   more complex, because we don't know at creation time which engine is going
42332   to use them. To handle this, we have implemented a deferred creation of LR
42333   contexts:
42334   </para><para>
42335   The local context starts its life as a hollow or blank holder, that only
42336   gets populated for a given engine once we receive an execbuffer. If later
42337   on we receive another execbuffer ioctl for the same context but a different
42338   engine, we allocate/populate a new ringbuffer and context backing object and
42339   so on.
42340   </para><para>
42341   Finally, regarding local contexts created using the ioctl call: as they are
42342   only allowed with the render ring, we can allocate &amp; populate them right
42343   away (no need to defer anything, at least for now).
42344   </para><para>
42345   Execlists implementation:
42346   Execlists are the new method by which, on gen8+ hardware, workloads are
42347   submitted for execution (as opposed to the legacy, ringbuffer-based, method).
42348   This method works as follows:
42349   </para><para>
42350   When a request is committed, its commands (the BB start and any leading or
42351   trailing commands, like the seqno breadcrumbs) are placed in the ringbuffer
42352   for the appropriate context. The tail pointer in the hardware context is not
42353   updated at this time, but instead, kept by the driver in the ringbuffer
42354   structure. A structure representing this request is added to a request queue
42355   for the appropriate engine: this structure contains a copy of the context's
42356   tail after the request was written to the ring buffer and a pointer to the
42357   context itself.
42358   </para><para>
42359   If the engine's request queue was empty before the request was added, the
42360   queue is processed immediately. Otherwise the queue will be processed during
42361   a context switch interrupt. In any case, elements on the queue will get sent
42362   (in pairs) to the GPU's ExecLists Submit Port (ELSP, for short) with a
42363   globally unique 20-bits submission ID.
42364   </para><para>
42365   When execution of a request completes, the GPU updates the context status
42366   buffer with a context complete event and generates a context switch interrupt.
42367   During the interrupt handling, the driver examines the events in the buffer:
42368   for each context complete event, if the announced ID matches that on the head
42369   of the request queue, then that request is retired and removed from the queue.
42370   </para><para>
42371   After processing, if any requests were retired and the queue is not empty
42372   then a new execution list can be submitted. The two requests at the front of
42373   the queue are next to be submitted but since a context may not occur twice in
42374   an execution list, if subsequent requests have the same ID as the first then
42375   the two requests must be combined. This is done simply by discarding requests
42376   at the head of the queue until either only one requests is left (in which case
42377   we use a NULL second context) or the first two requests have unique IDs.
42378   </para><para>
42379   By always executing the first two requests in the queue the driver ensures
42380   that the GPU is kept as busy as possible. In the case where a single context
42381   completes but a second context is still executing, the request for this second
42382   context will be at the head of the queue when we remove the first one. This
42383   request will then be resubmitted along with a new request for a different context,
42384   which will cause the hardware to continue executing the second request and queue
42385   the new request (the GPU detects the condition of a context getting preempted
42386   with the same context and optimizes the context switch flow by not doing
42387   preemption, but just sampling the new tail pointer).
42388   </para><para>
42389</para>
42390
42391<!-- drivers/gpu/drm/i915/intel_lrc.c -->
42392<refentry id="API-intel-sanitize-enable-execlists">
42393<refentryinfo>
42394 <title>LINUX</title>
42395 <productname>Kernel Hackers Manual</productname>
42396 <date>July 2017</date>
42397</refentryinfo>
42398<refmeta>
42399 <refentrytitle><phrase>intel_sanitize_enable_execlists</phrase></refentrytitle>
42400 <manvolnum>9</manvolnum>
42401 <refmiscinfo class="version">4.4.14</refmiscinfo>
42402</refmeta>
42403<refnamediv>
42404 <refname>intel_sanitize_enable_execlists</refname>
42405 <refpurpose>
42406  sanitize i915.enable_execlists
42407 </refpurpose>
42408</refnamediv>
42409<refsynopsisdiv>
42410 <title>Synopsis</title>
42411  <funcsynopsis><funcprototype>
42412   <funcdef>int <function>intel_sanitize_enable_execlists </function></funcdef>
42413   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
42414   <paramdef>int <parameter>enable_execlists</parameter></paramdef>
42415  </funcprototype></funcsynopsis>
42416</refsynopsisdiv>
42417<refsect1>
42418 <title>Arguments</title>
42419 <variablelist>
42420  <varlistentry>
42421   <term><parameter>dev</parameter></term>
42422   <listitem>
42423    <para>
42424     DRM device.
42425    </para>
42426   </listitem>
42427  </varlistentry>
42428  <varlistentry>
42429   <term><parameter>enable_execlists</parameter></term>
42430   <listitem>
42431    <para>
42432     value of i915.enable_execlists module parameter.
42433    </para>
42434   </listitem>
42435  </varlistentry>
42436 </variablelist>
42437</refsect1>
42438<refsect1>
42439<title>Description</title>
42440<para>
42441   Only certain platforms support Execlists (the prerequisites being
42442   support for Logical Ring Contexts and Aliasing PPGTT or better).
42443</para>
42444</refsect1>
42445<refsect1>
42446<title>Return</title>
42447<para>
42448   1 if Execlists is supported and has to be enabled.
42449</para>
42450</refsect1>
42451</refentry>
42452
42453<refentry id="API-intel-execlists-ctx-id">
42454<refentryinfo>
42455 <title>LINUX</title>
42456 <productname>Kernel Hackers Manual</productname>
42457 <date>July 2017</date>
42458</refentryinfo>
42459<refmeta>
42460 <refentrytitle><phrase>intel_execlists_ctx_id</phrase></refentrytitle>
42461 <manvolnum>9</manvolnum>
42462 <refmiscinfo class="version">4.4.14</refmiscinfo>
42463</refmeta>
42464<refnamediv>
42465 <refname>intel_execlists_ctx_id</refname>
42466 <refpurpose>
42467     get the Execlists Context ID
42468 </refpurpose>
42469</refnamediv>
42470<refsynopsisdiv>
42471 <title>Synopsis</title>
42472  <funcsynopsis><funcprototype>
42473   <funcdef>u32 <function>intel_execlists_ctx_id </function></funcdef>
42474   <paramdef>struct drm_i915_gem_object * <parameter>ctx_obj</parameter></paramdef>
42475  </funcprototype></funcsynopsis>
42476</refsynopsisdiv>
42477<refsect1>
42478 <title>Arguments</title>
42479 <variablelist>
42480  <varlistentry>
42481   <term><parameter>ctx_obj</parameter></term>
42482   <listitem>
42483    <para>
42484     Logical Ring Context backing object.
42485    </para>
42486   </listitem>
42487  </varlistentry>
42488 </variablelist>
42489</refsect1>
42490<refsect1>
42491<title>Description</title>
42492<para>
42493   Do not confuse with ctx-&gt;id! Unfortunately we have a name overload
42494</para>
42495</refsect1>
42496<refsect1>
42497<title>here</title>
42498<para>
42499   the old context ID we pass to userspace as a handler so that
42500   they can refer to a context, and the new context ID we pass to the
42501   ELSP so that the GPU can inform us of the context status via
42502   interrupts.
42503</para>
42504</refsect1>
42505<refsect1>
42506<title>Return</title>
42507<para>
42508   20-bits globally unique context ID.
42509</para>
42510</refsect1>
42511</refentry>
42512
42513<refentry id="API-intel-lrc-irq-handler">
42514<refentryinfo>
42515 <title>LINUX</title>
42516 <productname>Kernel Hackers Manual</productname>
42517 <date>July 2017</date>
42518</refentryinfo>
42519<refmeta>
42520 <refentrytitle><phrase>intel_lrc_irq_handler</phrase></refentrytitle>
42521 <manvolnum>9</manvolnum>
42522 <refmiscinfo class="version">4.4.14</refmiscinfo>
42523</refmeta>
42524<refnamediv>
42525 <refname>intel_lrc_irq_handler</refname>
42526 <refpurpose>
42527     handle Context Switch interrupts
42528 </refpurpose>
42529</refnamediv>
42530<refsynopsisdiv>
42531 <title>Synopsis</title>
42532  <funcsynopsis><funcprototype>
42533   <funcdef>void <function>intel_lrc_irq_handler </function></funcdef>
42534   <paramdef>struct intel_engine_cs * <parameter>ring</parameter></paramdef>
42535  </funcprototype></funcsynopsis>
42536</refsynopsisdiv>
42537<refsect1>
42538 <title>Arguments</title>
42539 <variablelist>
42540  <varlistentry>
42541   <term><parameter>ring</parameter></term>
42542   <listitem>
42543    <para>
42544     Engine Command Streamer to handle.
42545    </para>
42546   </listitem>
42547  </varlistentry>
42548 </variablelist>
42549</refsect1>
42550<refsect1>
42551<title>Description</title>
42552<para>
42553   Check the unread Context Status Buffers and manage the submission of new
42554   contexts to the ELSP accordingly.
42555</para>
42556</refsect1>
42557</refentry>
42558
42559<refentry id="API-intel-logical-ring-begin">
42560<refentryinfo>
42561 <title>LINUX</title>
42562 <productname>Kernel Hackers Manual</productname>
42563 <date>July 2017</date>
42564</refentryinfo>
42565<refmeta>
42566 <refentrytitle><phrase>intel_logical_ring_begin</phrase></refentrytitle>
42567 <manvolnum>9</manvolnum>
42568 <refmiscinfo class="version">4.4.14</refmiscinfo>
42569</refmeta>
42570<refnamediv>
42571 <refname>intel_logical_ring_begin</refname>
42572 <refpurpose>
42573     prepare the logical ringbuffer to accept some commands
42574 </refpurpose>
42575</refnamediv>
42576<refsynopsisdiv>
42577 <title>Synopsis</title>
42578  <funcsynopsis><funcprototype>
42579   <funcdef>int <function>intel_logical_ring_begin </function></funcdef>
42580   <paramdef>struct drm_i915_gem_request * <parameter>req</parameter></paramdef>
42581   <paramdef>int <parameter>num_dwords</parameter></paramdef>
42582  </funcprototype></funcsynopsis>
42583</refsynopsisdiv>
42584<refsect1>
42585 <title>Arguments</title>
42586 <variablelist>
42587  <varlistentry>
42588   <term><parameter>req</parameter></term>
42589   <listitem>
42590    <para>
42591     The request to start some new work for
42592    </para>
42593   </listitem>
42594  </varlistentry>
42595  <varlistentry>
42596   <term><parameter>num_dwords</parameter></term>
42597   <listitem>
42598    <para>
42599     number of DWORDs that we plan to write to the ringbuffer.
42600    </para>
42601   </listitem>
42602  </varlistentry>
42603 </variablelist>
42604</refsect1>
42605<refsect1>
42606<title>Description</title>
42607<para>
42608   The ringbuffer might not be ready to accept the commands right away (maybe it needs to
42609   be wrapped, or wait a bit for the tail to be updated). This function takes care of that
42610   and also preallocates a request (every workload submission is still mediated through
42611   requests, same as it did with legacy ringbuffer submission).
42612</para>
42613</refsect1>
42614<refsect1>
42615<title>Return</title>
42616<para>
42617   non-zero if the ringbuffer is not ready to be written to.
42618</para>
42619</refsect1>
42620</refentry>
42621
42622<refentry id="API-intel-execlists-submission">
42623<refentryinfo>
42624 <title>LINUX</title>
42625 <productname>Kernel Hackers Manual</productname>
42626 <date>July 2017</date>
42627</refentryinfo>
42628<refmeta>
42629 <refentrytitle><phrase>intel_execlists_submission</phrase></refentrytitle>
42630 <manvolnum>9</manvolnum>
42631 <refmiscinfo class="version">4.4.14</refmiscinfo>
42632</refmeta>
42633<refnamediv>
42634 <refname>intel_execlists_submission</refname>
42635 <refpurpose>
42636     submit a batchbuffer for execution, Execlists style
42637 </refpurpose>
42638</refnamediv>
42639<refsynopsisdiv>
42640 <title>Synopsis</title>
42641  <funcsynopsis><funcprototype>
42642   <funcdef>int <function>intel_execlists_submission </function></funcdef>
42643   <paramdef>struct i915_execbuffer_params * <parameter>params</parameter></paramdef>
42644   <paramdef>struct drm_i915_gem_execbuffer2 * <parameter>args</parameter></paramdef>
42645   <paramdef>struct list_head * <parameter>vmas</parameter></paramdef>
42646  </funcprototype></funcsynopsis>
42647</refsynopsisdiv>
42648<refsect1>
42649 <title>Arguments</title>
42650 <variablelist>
42651  <varlistentry>
42652   <term><parameter>params</parameter></term>
42653   <listitem>
42654    <para>
42655     -- undescribed --
42656    </para>
42657   </listitem>
42658  </varlistentry>
42659  <varlistentry>
42660   <term><parameter>args</parameter></term>
42661   <listitem>
42662    <para>
42663     execbuffer call arguments.
42664    </para>
42665   </listitem>
42666  </varlistentry>
42667  <varlistentry>
42668   <term><parameter>vmas</parameter></term>
42669   <listitem>
42670    <para>
42671     list of vmas.
42672    </para>
42673   </listitem>
42674  </varlistentry>
42675 </variablelist>
42676</refsect1>
42677<refsect1>
42678<title>Description</title>
42679<para>
42680   This is the evil twin version of i915_gem_ringbuffer_submission. It abstracts
42681   away the submission details of the execbuffer ioctl call.
42682</para>
42683</refsect1>
42684<refsect1>
42685<title>Return</title>
42686<para>
42687   non-zero if the submission fails.
42688</para>
42689</refsect1>
42690</refentry>
42691
42692<refentry id="API-gen8-init-indirectctx-bb">
42693<refentryinfo>
42694 <title>LINUX</title>
42695 <productname>Kernel Hackers Manual</productname>
42696 <date>July 2017</date>
42697</refentryinfo>
42698<refmeta>
42699 <refentrytitle><phrase>gen8_init_indirectctx_bb</phrase></refentrytitle>
42700 <manvolnum>9</manvolnum>
42701 <refmiscinfo class="version">4.4.14</refmiscinfo>
42702</refmeta>
42703<refnamediv>
42704 <refname>gen8_init_indirectctx_bb</refname>
42705 <refpurpose>
42706     initialize indirect ctx batch with WA
42707 </refpurpose>
42708</refnamediv>
42709<refsynopsisdiv>
42710 <title>Synopsis</title>
42711  <funcsynopsis><funcprototype>
42712   <funcdef>int <function>gen8_init_indirectctx_bb </function></funcdef>
42713   <paramdef>struct intel_engine_cs * <parameter>ring</parameter></paramdef>
42714   <paramdef>struct i915_wa_ctx_bb * <parameter>wa_ctx</parameter></paramdef>
42715   <paramdef>uint32_t *const <parameter>batch</parameter></paramdef>
42716   <paramdef>uint32_t * <parameter>offset</parameter></paramdef>
42717  </funcprototype></funcsynopsis>
42718</refsynopsisdiv>
42719<refsect1>
42720 <title>Arguments</title>
42721 <variablelist>
42722  <varlistentry>
42723   <term><parameter>ring</parameter></term>
42724   <listitem>
42725    <para>
42726     only applicable for RCS
42727    </para>
42728   </listitem>
42729  </varlistentry>
42730  <varlistentry>
42731   <term><parameter>wa_ctx</parameter></term>
42732   <listitem>
42733    <para>
42734     structure representing wa_ctx
42735    </para>
42736   </listitem>
42737  </varlistentry>
42738  <varlistentry>
42739   <term><parameter>batch</parameter></term>
42740   <listitem>
42741    <para>
42742     page in which WA are loaded
42743    </para>
42744   </listitem>
42745  </varlistentry>
42746  <varlistentry>
42747   <term><parameter>offset</parameter></term>
42748   <listitem>
42749    <para>
42750     This field specifies the start of the batch, it should be
42751     cache-aligned otherwise it is adjusted accordingly.
42752     Typically we only have one indirect_ctx and per_ctx batch buffer which are
42753     initialized at the beginning and shared across all contexts but this field
42754     helps us to have multiple batches at different offsets and select them based
42755     on a criteria. At the moment this batch always start at the beginning of the page
42756     and at this point we don't have multiple wa_ctx batch buffers.
42757    </para>
42758   </listitem>
42759  </varlistentry>
42760 </variablelist>
42761</refsect1>
42762<refsect1>
42763<title>offset</title>
42764<para>
42765   specifies start of the batch, should be cache-aligned. This is updated
42766   with the offset value received as input.
42767</para>
42768</refsect1>
42769<refsect1>
42770<title>size</title>
42771<para>
42772   size of the batch in DWORDS but HW expects in terms of cachelines
42773</para>
42774</refsect1>
42775<refsect1>
42776<title>Description</title>
42777<para>
42778   The number of WA applied are not known at the beginning; we use this field
42779   to return the no of DWORDS written.
42780   </para><para>
42781
42782   It is to be noted that this batch does not contain MI_BATCH_BUFFER_END
42783   so it adds NOOPs as padding to make it cacheline aligned.
42784   MI_BATCH_BUFFER_END will be added to perctx batch and both of them together
42785   makes a complete batch buffer.
42786</para>
42787</refsect1>
42788<refsect1>
42789<title>Return</title>
42790<para>
42791   non-zero if we exceed the PAGE_SIZE limit.
42792</para>
42793</refsect1>
42794</refentry>
42795
42796<refentry id="API-gen8-init-perctx-bb">
42797<refentryinfo>
42798 <title>LINUX</title>
42799 <productname>Kernel Hackers Manual</productname>
42800 <date>July 2017</date>
42801</refentryinfo>
42802<refmeta>
42803 <refentrytitle><phrase>gen8_init_perctx_bb</phrase></refentrytitle>
42804 <manvolnum>9</manvolnum>
42805 <refmiscinfo class="version">4.4.14</refmiscinfo>
42806</refmeta>
42807<refnamediv>
42808 <refname>gen8_init_perctx_bb</refname>
42809 <refpurpose>
42810     initialize per ctx batch with WA
42811 </refpurpose>
42812</refnamediv>
42813<refsynopsisdiv>
42814 <title>Synopsis</title>
42815  <funcsynopsis><funcprototype>
42816   <funcdef>int <function>gen8_init_perctx_bb </function></funcdef>
42817   <paramdef>struct intel_engine_cs * <parameter>ring</parameter></paramdef>
42818   <paramdef>struct i915_wa_ctx_bb * <parameter>wa_ctx</parameter></paramdef>
42819   <paramdef>uint32_t *const <parameter>batch</parameter></paramdef>
42820   <paramdef>uint32_t * <parameter>offset</parameter></paramdef>
42821  </funcprototype></funcsynopsis>
42822</refsynopsisdiv>
42823<refsect1>
42824 <title>Arguments</title>
42825 <variablelist>
42826  <varlistentry>
42827   <term><parameter>ring</parameter></term>
42828   <listitem>
42829    <para>
42830     only applicable for RCS
42831    </para>
42832   </listitem>
42833  </varlistentry>
42834  <varlistentry>
42835   <term><parameter>wa_ctx</parameter></term>
42836   <listitem>
42837    <para>
42838     structure representing wa_ctx
42839    </para>
42840   </listitem>
42841  </varlistentry>
42842  <varlistentry>
42843   <term><parameter>batch</parameter></term>
42844   <listitem>
42845    <para>
42846     page in which WA are loaded
42847    </para>
42848   </listitem>
42849  </varlistentry>
42850  <varlistentry>
42851   <term><parameter>offset</parameter></term>
42852   <listitem>
42853    <para>
42854     This field specifies the start of this batch.
42855     This batch is started immediately after indirect_ctx batch. Since we ensure
42856     that indirect_ctx ends on a cacheline this batch is aligned automatically.
42857    </para>
42858   </listitem>
42859  </varlistentry>
42860 </variablelist>
42861</refsect1>
42862<refsect1>
42863<title>offset</title>
42864<para>
42865   specifies start of the batch, should be cache-aligned.
42866</para>
42867</refsect1>
42868<refsect1>
42869<title>size</title>
42870<para>
42871   size of the batch in DWORDS but HW expects in terms of cachelines
42872</para>
42873</refsect1>
42874<refsect1>
42875<title>Description</title>
42876<para>
42877   The number of DWORDS written are returned using this field.
42878   </para><para>
42879
42880   This batch is terminated with MI_BATCH_BUFFER_END and so we need not add padding
42881   to align it with cacheline as padding after MI_BATCH_BUFFER_END is redundant.
42882</para>
42883</refsect1>
42884</refentry>
42885
42886<refentry id="API-intel-logical-ring-cleanup">
42887<refentryinfo>
42888 <title>LINUX</title>
42889 <productname>Kernel Hackers Manual</productname>
42890 <date>July 2017</date>
42891</refentryinfo>
42892<refmeta>
42893 <refentrytitle><phrase>intel_logical_ring_cleanup</phrase></refentrytitle>
42894 <manvolnum>9</manvolnum>
42895 <refmiscinfo class="version">4.4.14</refmiscinfo>
42896</refmeta>
42897<refnamediv>
42898 <refname>intel_logical_ring_cleanup</refname>
42899 <refpurpose>
42900     deallocate the Engine Command Streamer
42901 </refpurpose>
42902</refnamediv>
42903<refsynopsisdiv>
42904 <title>Synopsis</title>
42905  <funcsynopsis><funcprototype>
42906   <funcdef>void <function>intel_logical_ring_cleanup </function></funcdef>
42907   <paramdef>struct intel_engine_cs * <parameter>ring</parameter></paramdef>
42908  </funcprototype></funcsynopsis>
42909</refsynopsisdiv>
42910<refsect1>
42911 <title>Arguments</title>
42912 <variablelist>
42913  <varlistentry>
42914   <term><parameter>ring</parameter></term>
42915   <listitem>
42916    <para>
42917     Engine Command Streamer.
42918    </para>
42919   </listitem>
42920  </varlistentry>
42921 </variablelist>
42922</refsect1>
42923</refentry>
42924
42925<refentry id="API-intel-logical-rings-init">
42926<refentryinfo>
42927 <title>LINUX</title>
42928 <productname>Kernel Hackers Manual</productname>
42929 <date>July 2017</date>
42930</refentryinfo>
42931<refmeta>
42932 <refentrytitle><phrase>intel_logical_rings_init</phrase></refentrytitle>
42933 <manvolnum>9</manvolnum>
42934 <refmiscinfo class="version">4.4.14</refmiscinfo>
42935</refmeta>
42936<refnamediv>
42937 <refname>intel_logical_rings_init</refname>
42938 <refpurpose>
42939     allocate, populate and init the Engine Command Streamers
42940 </refpurpose>
42941</refnamediv>
42942<refsynopsisdiv>
42943 <title>Synopsis</title>
42944  <funcsynopsis><funcprototype>
42945   <funcdef>int <function>intel_logical_rings_init </function></funcdef>
42946   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
42947  </funcprototype></funcsynopsis>
42948</refsynopsisdiv>
42949<refsect1>
42950 <title>Arguments</title>
42951 <variablelist>
42952  <varlistentry>
42953   <term><parameter>dev</parameter></term>
42954   <listitem>
42955    <para>
42956     DRM device.
42957    </para>
42958   </listitem>
42959  </varlistentry>
42960 </variablelist>
42961</refsect1>
42962<refsect1>
42963<title>Description</title>
42964<para>
42965   This function inits the engines for an Execlists submission style (the equivalent in the
42966   legacy ringbuffer submission world would be i915_gem_init_rings). It does it only for
42967   those engines that are present in the hardware.
42968</para>
42969</refsect1>
42970<refsect1>
42971<title>Return</title>
42972<para>
42973   non-zero if the initialization failed.
42974</para>
42975</refsect1>
42976</refentry>
42977
42978<refentry id="API-intel-lr-context-free">
42979<refentryinfo>
42980 <title>LINUX</title>
42981 <productname>Kernel Hackers Manual</productname>
42982 <date>July 2017</date>
42983</refentryinfo>
42984<refmeta>
42985 <refentrytitle><phrase>intel_lr_context_free</phrase></refentrytitle>
42986 <manvolnum>9</manvolnum>
42987 <refmiscinfo class="version">4.4.14</refmiscinfo>
42988</refmeta>
42989<refnamediv>
42990 <refname>intel_lr_context_free</refname>
42991 <refpurpose>
42992     free the LRC specific bits of a context
42993 </refpurpose>
42994</refnamediv>
42995<refsynopsisdiv>
42996 <title>Synopsis</title>
42997  <funcsynopsis><funcprototype>
42998   <funcdef>void <function>intel_lr_context_free </function></funcdef>
42999   <paramdef>struct intel_context * <parameter>ctx</parameter></paramdef>
43000  </funcprototype></funcsynopsis>
43001</refsynopsisdiv>
43002<refsect1>
43003 <title>Arguments</title>
43004 <variablelist>
43005  <varlistentry>
43006   <term><parameter>ctx</parameter></term>
43007   <listitem>
43008    <para>
43009     the LR context to free.
43010    </para>
43011   </listitem>
43012  </varlistentry>
43013 </variablelist>
43014</refsect1>
43015<refsect1>
43016<title>The real context freeing is done in i915_gem_context_free</title>
43017<para>
43018   this only
43019</para>
43020</refsect1>
43021<refsect1>
43022<title>takes care of the bits that are LRC related</title>
43023<para>
43024   the per-engine backing
43025   objects and the logical ringbuffer.
43026</para>
43027</refsect1>
43028</refentry>
43029
43030<refentry id="API-intel-lr-context-deferred-alloc">
43031<refentryinfo>
43032 <title>LINUX</title>
43033 <productname>Kernel Hackers Manual</productname>
43034 <date>July 2017</date>
43035</refentryinfo>
43036<refmeta>
43037 <refentrytitle><phrase>intel_lr_context_deferred_alloc</phrase></refentrytitle>
43038 <manvolnum>9</manvolnum>
43039 <refmiscinfo class="version">4.4.14</refmiscinfo>
43040</refmeta>
43041<refnamediv>
43042 <refname>intel_lr_context_deferred_alloc</refname>
43043 <refpurpose>
43044     create the LRC specific bits of a context
43045 </refpurpose>
43046</refnamediv>
43047<refsynopsisdiv>
43048 <title>Synopsis</title>
43049  <funcsynopsis><funcprototype>
43050   <funcdef>int <function>intel_lr_context_deferred_alloc </function></funcdef>
43051   <paramdef>struct intel_context * <parameter>ctx</parameter></paramdef>
43052   <paramdef>struct intel_engine_cs * <parameter>ring</parameter></paramdef>
43053  </funcprototype></funcsynopsis>
43054</refsynopsisdiv>
43055<refsect1>
43056 <title>Arguments</title>
43057 <variablelist>
43058  <varlistentry>
43059   <term><parameter>ctx</parameter></term>
43060   <listitem>
43061    <para>
43062     LR context to create.
43063    </para>
43064   </listitem>
43065  </varlistentry>
43066  <varlistentry>
43067   <term><parameter>ring</parameter></term>
43068   <listitem>
43069    <para>
43070     engine to be used with the context.
43071    </para>
43072   </listitem>
43073  </varlistentry>
43074 </variablelist>
43075</refsect1>
43076<refsect1>
43077<title>Description</title>
43078<para>
43079   This function can be called more than once, with different engines, if we plan
43080   to use the context with them. The context backing objects and the ringbuffers
43081   (specially the ringbuffer backing objects) suck a lot of memory up, and that's why
43082</para>
43083</refsect1>
43084<refsect1>
43085<title>the creation is a deferred call</title>
43086<para>
43087   it's better to make sure first that we need to use
43088   a given ring with the context.
43089</para>
43090</refsect1>
43091<refsect1>
43092<title>Return</title>
43093<para>
43094   non-zero on error.
43095</para>
43096</refsect1>
43097</refentry>
43098
43099      </sect2>
43100      <sect2>
43101        <title>Global GTT views</title>
43102<para>
43103   </para><para>
43104   Background and previous state
43105   </para><para>
43106   Historically objects could exists (be bound) in global GTT space only as
43107   singular instances with a view representing all of the object's backing pages
43108   in a linear fashion. This view will be called a normal view.
43109   </para><para>
43110   To support multiple views of the same object, where the number of mapped
43111   pages is not equal to the backing store, or where the layout of the pages
43112   is not linear, concept of a GGTT view was added.
43113   </para><para>
43114   One example of an alternative view is a stereo display driven by a single
43115   image. In this case we would have a framebuffer looking like this
43116   (2x2 pages):
43117   </para><para>
43118   12
43119   34
43120   </para><para>
43121   Above would represent a normal GGTT view as normally mapped for GPU or CPU
43122   rendering. In contrast, fed to the display engine would be an alternative
43123   view which could look something like this:
43124   </para><para>
43125   1212
43126   3434
43127   </para><para>
43128   In this example both the size and layout of pages in the alternative view is
43129   different from the normal view.
43130   </para><para>
43131   Implementation and usage
43132   </para><para>
43133   GGTT views are implemented using VMAs and are distinguished via enum
43134   i915_ggtt_view_type and struct i915_ggtt_view.
43135   </para><para>
43136   A new flavour of core GEM functions which work with GGTT bound objects were
43137   added with the _ggtt_ infix, and sometimes with _view postfix to avoid
43138   renaming  in large amounts of code. They take the struct i915_ggtt_view
43139   parameter encapsulating all metadata required to implement a view.
43140   </para><para>
43141   As a helper for callers which are only interested in the normal view,
43142   globally const i915_ggtt_view_normal singleton instance exists. All old core
43143   GEM API functions, the ones not taking the view parameter, are operating on,
43144   or with the normal GGTT view.
43145   </para><para>
43146   Code wanting to add or use a new GGTT view needs to:
43147   </para><para>
43148   1. Add a new enum with a suitable name.
43149   2. Extend the metadata in the i915_ggtt_view structure if required.
43150   3. Add support to <function>i915_get_vma_pages</function>.
43151   </para><para>
43152   New views are required to build a scatter-gather table from within the
43153   i915_get_vma_pages function. This table is stored in the vma.ggtt_view and
43154   exists for the lifetime of an VMA.
43155   </para><para>
43156   Core API is designed to have copy semantics which means that passed in
43157   struct i915_ggtt_view does not need to be persistent (left around after
43158   calling the core API functions).
43159   </para><para>
43160</para>
43161
43162<!-- drivers/gpu/drm/i915/i915_gem_gtt.c -->
43163<refentry id="API-gen8-ppgtt-alloc-pagetabs">
43164<refentryinfo>
43165 <title>LINUX</title>
43166 <productname>Kernel Hackers Manual</productname>
43167 <date>July 2017</date>
43168</refentryinfo>
43169<refmeta>
43170 <refentrytitle><phrase>gen8_ppgtt_alloc_pagetabs</phrase></refentrytitle>
43171 <manvolnum>9</manvolnum>
43172 <refmiscinfo class="version">4.4.14</refmiscinfo>
43173</refmeta>
43174<refnamediv>
43175 <refname>gen8_ppgtt_alloc_pagetabs</refname>
43176 <refpurpose>
43177  Allocate page tables for VA range.
43178 </refpurpose>
43179</refnamediv>
43180<refsynopsisdiv>
43181 <title>Synopsis</title>
43182  <funcsynopsis><funcprototype>
43183   <funcdef>int <function>gen8_ppgtt_alloc_pagetabs </function></funcdef>
43184   <paramdef>struct i915_address_space * <parameter>vm</parameter></paramdef>
43185   <paramdef>struct i915_page_directory * <parameter>pd</parameter></paramdef>
43186   <paramdef>uint64_t <parameter>start</parameter></paramdef>
43187   <paramdef>uint64_t <parameter>length</parameter></paramdef>
43188   <paramdef>unsigned long * <parameter>new_pts</parameter></paramdef>
43189  </funcprototype></funcsynopsis>
43190</refsynopsisdiv>
43191<refsect1>
43192 <title>Arguments</title>
43193 <variablelist>
43194  <varlistentry>
43195   <term><parameter>vm</parameter></term>
43196   <listitem>
43197    <para>
43198     Master vm structure.
43199    </para>
43200   </listitem>
43201  </varlistentry>
43202  <varlistentry>
43203   <term><parameter>pd</parameter></term>
43204   <listitem>
43205    <para>
43206     Page directory for this address range.
43207    </para>
43208   </listitem>
43209  </varlistentry>
43210  <varlistentry>
43211   <term><parameter>start</parameter></term>
43212   <listitem>
43213    <para>
43214     Starting virtual address to begin allocations.
43215    </para>
43216   </listitem>
43217  </varlistentry>
43218  <varlistentry>
43219   <term><parameter>length</parameter></term>
43220   <listitem>
43221    <para>
43222     Size of the allocations.
43223    </para>
43224   </listitem>
43225  </varlistentry>
43226  <varlistentry>
43227   <term><parameter>new_pts</parameter></term>
43228   <listitem>
43229    <para>
43230     Bitmap set by function with new allocations. Likely used by the
43231     caller to free on error.
43232    </para>
43233   </listitem>
43234  </varlistentry>
43235 </variablelist>
43236</refsect1>
43237<refsect1>
43238<title>Description</title>
43239<para>
43240   Allocate the required number of page tables. Extremely similar to
43241   <function>gen8_ppgtt_alloc_page_directories</function>. The main difference is here we are limited by
43242   the page directory boundary (instead of the page directory pointer). That
43243   boundary is 1GB virtual. Therefore, unlike <function>gen8_ppgtt_alloc_page_directories</function>, it is
43244   possible, and likely that the caller will need to use multiple calls of this
43245   function to achieve the appropriate allocation.
43246</para>
43247</refsect1>
43248<refsect1>
43249<title>Return</title>
43250<para>
43251   0 if success; negative error code otherwise.
43252</para>
43253</refsect1>
43254</refentry>
43255
43256<refentry id="API-gen8-ppgtt-alloc-page-directories">
43257<refentryinfo>
43258 <title>LINUX</title>
43259 <productname>Kernel Hackers Manual</productname>
43260 <date>July 2017</date>
43261</refentryinfo>
43262<refmeta>
43263 <refentrytitle><phrase>gen8_ppgtt_alloc_page_directories</phrase></refentrytitle>
43264 <manvolnum>9</manvolnum>
43265 <refmiscinfo class="version">4.4.14</refmiscinfo>
43266</refmeta>
43267<refnamediv>
43268 <refname>gen8_ppgtt_alloc_page_directories</refname>
43269 <refpurpose>
43270     Allocate page directories for VA range.
43271 </refpurpose>
43272</refnamediv>
43273<refsynopsisdiv>
43274 <title>Synopsis</title>
43275  <funcsynopsis><funcprototype>
43276   <funcdef>int <function>gen8_ppgtt_alloc_page_directories </function></funcdef>
43277   <paramdef>struct i915_address_space * <parameter>vm</parameter></paramdef>
43278   <paramdef>struct i915_page_directory_pointer * <parameter>pdp</parameter></paramdef>
43279   <paramdef>uint64_t <parameter>start</parameter></paramdef>
43280   <paramdef>uint64_t <parameter>length</parameter></paramdef>
43281   <paramdef>unsigned long * <parameter>new_pds</parameter></paramdef>
43282  </funcprototype></funcsynopsis>
43283</refsynopsisdiv>
43284<refsect1>
43285 <title>Arguments</title>
43286 <variablelist>
43287  <varlistentry>
43288   <term><parameter>vm</parameter></term>
43289   <listitem>
43290    <para>
43291     Master vm structure.
43292    </para>
43293   </listitem>
43294  </varlistentry>
43295  <varlistentry>
43296   <term><parameter>pdp</parameter></term>
43297   <listitem>
43298    <para>
43299     Page directory pointer for this address range.
43300    </para>
43301   </listitem>
43302  </varlistentry>
43303  <varlistentry>
43304   <term><parameter>start</parameter></term>
43305   <listitem>
43306    <para>
43307     Starting virtual address to begin allocations.
43308    </para>
43309   </listitem>
43310  </varlistentry>
43311  <varlistentry>
43312   <term><parameter>length</parameter></term>
43313   <listitem>
43314    <para>
43315     Size of the allocations.
43316    </para>
43317   </listitem>
43318  </varlistentry>
43319  <varlistentry>
43320   <term><parameter>new_pds</parameter></term>
43321   <listitem>
43322    <para>
43323     Bitmap set by function with new allocations. Likely used by the
43324     caller to free on error.
43325    </para>
43326   </listitem>
43327  </varlistentry>
43328 </variablelist>
43329</refsect1>
43330<refsect1>
43331<title>Description</title>
43332<para>
43333   Allocate the required number of page directories starting at the pde index of
43334   <parameter>start</parameter>, and ending at the pde index <parameter>start</parameter> + <parameter>length</parameter>. This function will skip
43335   over already allocated page directories within the range, and only allocate
43336   new ones, setting the appropriate pointer within the pdp as well as the
43337   correct position in the bitmap <parameter>new_pds</parameter>.
43338   </para><para>
43339
43340   The function will only allocate the pages within the range for a give page
43341   directory pointer. In other words, if <parameter>start</parameter> + <parameter>length</parameter> straddles a virtually
43342   addressed PDP boundary (512GB for 4k pages), there will be more allocations
43343   required by the caller, This is not currently possible, and the BUG in the
43344   code will prevent it.
43345</para>
43346</refsect1>
43347<refsect1>
43348<title>Return</title>
43349<para>
43350   0 if success; negative error code otherwise.
43351</para>
43352</refsect1>
43353</refentry>
43354
43355<refentry id="API-gen8-ppgtt-alloc-page-dirpointers">
43356<refentryinfo>
43357 <title>LINUX</title>
43358 <productname>Kernel Hackers Manual</productname>
43359 <date>July 2017</date>
43360</refentryinfo>
43361<refmeta>
43362 <refentrytitle><phrase>gen8_ppgtt_alloc_page_dirpointers</phrase></refentrytitle>
43363 <manvolnum>9</manvolnum>
43364 <refmiscinfo class="version">4.4.14</refmiscinfo>
43365</refmeta>
43366<refnamediv>
43367 <refname>gen8_ppgtt_alloc_page_dirpointers</refname>
43368 <refpurpose>
43369     Allocate pdps for VA range.
43370 </refpurpose>
43371</refnamediv>
43372<refsynopsisdiv>
43373 <title>Synopsis</title>
43374  <funcsynopsis><funcprototype>
43375   <funcdef>int <function>gen8_ppgtt_alloc_page_dirpointers </function></funcdef>
43376   <paramdef>struct i915_address_space * <parameter>vm</parameter></paramdef>
43377   <paramdef>struct i915_pml4 * <parameter>pml4</parameter></paramdef>
43378   <paramdef>uint64_t <parameter>start</parameter></paramdef>
43379   <paramdef>uint64_t <parameter>length</parameter></paramdef>
43380   <paramdef>unsigned long * <parameter>new_pdps</parameter></paramdef>
43381  </funcprototype></funcsynopsis>
43382</refsynopsisdiv>
43383<refsect1>
43384 <title>Arguments</title>
43385 <variablelist>
43386  <varlistentry>
43387   <term><parameter>vm</parameter></term>
43388   <listitem>
43389    <para>
43390     Master vm structure.
43391    </para>
43392   </listitem>
43393  </varlistentry>
43394  <varlistentry>
43395   <term><parameter>pml4</parameter></term>
43396   <listitem>
43397    <para>
43398     Page map level 4 for this address range.
43399    </para>
43400   </listitem>
43401  </varlistentry>
43402  <varlistentry>
43403   <term><parameter>start</parameter></term>
43404   <listitem>
43405    <para>
43406     Starting virtual address to begin allocations.
43407    </para>
43408   </listitem>
43409  </varlistentry>
43410  <varlistentry>
43411   <term><parameter>length</parameter></term>
43412   <listitem>
43413    <para>
43414     Size of the allocations.
43415    </para>
43416   </listitem>
43417  </varlistentry>
43418  <varlistentry>
43419   <term><parameter>new_pdps</parameter></term>
43420   <listitem>
43421    <para>
43422     Bitmap set by function with new allocations. Likely used by the
43423     caller to free on error.
43424    </para>
43425   </listitem>
43426  </varlistentry>
43427 </variablelist>
43428</refsect1>
43429<refsect1>
43430<title>Description</title>
43431<para>
43432   Allocate the required number of page directory pointers. Extremely similar to
43433   <function>gen8_ppgtt_alloc_page_directories</function> and <function>gen8_ppgtt_alloc_pagetabs</function>.
43434   The main difference is here we are limited by the pml4 boundary (instead of
43435   the page directory pointer).
43436</para>
43437</refsect1>
43438<refsect1>
43439<title>Return</title>
43440<para>
43441   0 if success; negative error code otherwise.
43442</para>
43443</refsect1>
43444</refentry>
43445
43446<refentry id="API-i915-vma-bind">
43447<refentryinfo>
43448 <title>LINUX</title>
43449 <productname>Kernel Hackers Manual</productname>
43450 <date>July 2017</date>
43451</refentryinfo>
43452<refmeta>
43453 <refentrytitle><phrase>i915_vma_bind</phrase></refentrytitle>
43454 <manvolnum>9</manvolnum>
43455 <refmiscinfo class="version">4.4.14</refmiscinfo>
43456</refmeta>
43457<refnamediv>
43458 <refname>i915_vma_bind</refname>
43459 <refpurpose>
43460     Sets up PTEs for an VMA in it's corresponding address space.
43461 </refpurpose>
43462</refnamediv>
43463<refsynopsisdiv>
43464 <title>Synopsis</title>
43465  <funcsynopsis><funcprototype>
43466   <funcdef>int <function>i915_vma_bind </function></funcdef>
43467   <paramdef>struct i915_vma * <parameter>vma</parameter></paramdef>
43468   <paramdef>enum i915_cache_level <parameter>cache_level</parameter></paramdef>
43469   <paramdef>u32 <parameter>flags</parameter></paramdef>
43470  </funcprototype></funcsynopsis>
43471</refsynopsisdiv>
43472<refsect1>
43473 <title>Arguments</title>
43474 <variablelist>
43475  <varlistentry>
43476   <term><parameter>vma</parameter></term>
43477   <listitem>
43478    <para>
43479     VMA to map
43480    </para>
43481   </listitem>
43482  </varlistentry>
43483  <varlistentry>
43484   <term><parameter>cache_level</parameter></term>
43485   <listitem>
43486    <para>
43487     mapping cache level
43488    </para>
43489   </listitem>
43490  </varlistentry>
43491  <varlistentry>
43492   <term><parameter>flags</parameter></term>
43493   <listitem>
43494    <para>
43495     flags like global or local mapping
43496    </para>
43497   </listitem>
43498  </varlistentry>
43499 </variablelist>
43500</refsect1>
43501<refsect1>
43502<title>Description</title>
43503<para>
43504   DMA addresses are taken from the scatter-gather table of this object (or of
43505   this VMA in case of non-default GGTT views) and PTE entries set up.
43506   Note that DMA addresses are also the only part of the SG table we care about.
43507</para>
43508</refsect1>
43509</refentry>
43510
43511<refentry id="API-i915-ggtt-view-size">
43512<refentryinfo>
43513 <title>LINUX</title>
43514 <productname>Kernel Hackers Manual</productname>
43515 <date>July 2017</date>
43516</refentryinfo>
43517<refmeta>
43518 <refentrytitle><phrase>i915_ggtt_view_size</phrase></refentrytitle>
43519 <manvolnum>9</manvolnum>
43520 <refmiscinfo class="version">4.4.14</refmiscinfo>
43521</refmeta>
43522<refnamediv>
43523 <refname>i915_ggtt_view_size</refname>
43524 <refpurpose>
43525     Get the size of a GGTT view.
43526 </refpurpose>
43527</refnamediv>
43528<refsynopsisdiv>
43529 <title>Synopsis</title>
43530  <funcsynopsis><funcprototype>
43531   <funcdef>size_t <function>i915_ggtt_view_size </function></funcdef>
43532   <paramdef>struct drm_i915_gem_object * <parameter>obj</parameter></paramdef>
43533   <paramdef>const struct i915_ggtt_view * <parameter>view</parameter></paramdef>
43534  </funcprototype></funcsynopsis>
43535</refsynopsisdiv>
43536<refsect1>
43537 <title>Arguments</title>
43538 <variablelist>
43539  <varlistentry>
43540   <term><parameter>obj</parameter></term>
43541   <listitem>
43542    <para>
43543     Object the view is of.
43544    </para>
43545   </listitem>
43546  </varlistentry>
43547  <varlistentry>
43548   <term><parameter>view</parameter></term>
43549   <listitem>
43550    <para>
43551     The view in question.
43552    </para>
43553   </listitem>
43554  </varlistentry>
43555 </variablelist>
43556</refsect1>
43557<refsect1>
43558<title>Description</title>
43559<para>
43560   <parameter>return</parameter> The size of the GGTT view in bytes.
43561</para>
43562</refsect1>
43563</refentry>
43564
43565      </sect2>
43566      <sect2>
43567        <title>GTT Fences and Swizzling</title>
43568<!-- drivers/gpu/drm/i915/i915_gem_fence.c -->
43569<refentry id="API-i915-gem-object-put-fence">
43570<refentryinfo>
43571 <title>LINUX</title>
43572 <productname>Kernel Hackers Manual</productname>
43573 <date>July 2017</date>
43574</refentryinfo>
43575<refmeta>
43576 <refentrytitle><phrase>i915_gem_object_put_fence</phrase></refentrytitle>
43577 <manvolnum>9</manvolnum>
43578 <refmiscinfo class="version">4.4.14</refmiscinfo>
43579</refmeta>
43580<refnamediv>
43581 <refname>i915_gem_object_put_fence</refname>
43582 <refpurpose>
43583  force-remove fence for an object
43584 </refpurpose>
43585</refnamediv>
43586<refsynopsisdiv>
43587 <title>Synopsis</title>
43588  <funcsynopsis><funcprototype>
43589   <funcdef>int <function>i915_gem_object_put_fence </function></funcdef>
43590   <paramdef>struct drm_i915_gem_object * <parameter>obj</parameter></paramdef>
43591  </funcprototype></funcsynopsis>
43592</refsynopsisdiv>
43593<refsect1>
43594 <title>Arguments</title>
43595 <variablelist>
43596  <varlistentry>
43597   <term><parameter>obj</parameter></term>
43598   <listitem>
43599    <para>
43600     object to map through a fence reg
43601    </para>
43602   </listitem>
43603  </varlistentry>
43604 </variablelist>
43605</refsect1>
43606<refsect1>
43607<title>Description</title>
43608<para>
43609   This function force-removes any fence from the given object, which is useful
43610   if the kernel wants to do untiled GTT access.
43611</para>
43612</refsect1>
43613<refsect1>
43614<title>Returns</title>
43615<para>
43616   </para><para>
43617
43618   0 on success, negative error code on failure.
43619</para>
43620</refsect1>
43621</refentry>
43622
43623<refentry id="API-i915-gem-object-get-fence">
43624<refentryinfo>
43625 <title>LINUX</title>
43626 <productname>Kernel Hackers Manual</productname>
43627 <date>July 2017</date>
43628</refentryinfo>
43629<refmeta>
43630 <refentrytitle><phrase>i915_gem_object_get_fence</phrase></refentrytitle>
43631 <manvolnum>9</manvolnum>
43632 <refmiscinfo class="version">4.4.14</refmiscinfo>
43633</refmeta>
43634<refnamediv>
43635 <refname>i915_gem_object_get_fence</refname>
43636 <refpurpose>
43637     set up fencing for an object
43638 </refpurpose>
43639</refnamediv>
43640<refsynopsisdiv>
43641 <title>Synopsis</title>
43642  <funcsynopsis><funcprototype>
43643   <funcdef>int <function>i915_gem_object_get_fence </function></funcdef>
43644   <paramdef>struct drm_i915_gem_object * <parameter>obj</parameter></paramdef>
43645  </funcprototype></funcsynopsis>
43646</refsynopsisdiv>
43647<refsect1>
43648 <title>Arguments</title>
43649 <variablelist>
43650  <varlistentry>
43651   <term><parameter>obj</parameter></term>
43652   <listitem>
43653    <para>
43654     object to map through a fence reg
43655    </para>
43656   </listitem>
43657  </varlistentry>
43658 </variablelist>
43659</refsect1>
43660<refsect1>
43661<title>Description</title>
43662<para>
43663   When mapping objects through the GTT, userspace wants to be able to write
43664   to them without having to worry about swizzling if the object is tiled.
43665   This function walks the fence regs looking for a free one for <parameter>obj</parameter>,
43666   stealing one if it can't find any.
43667   </para><para>
43668
43669   It then sets up the reg based on the object's properties: address, pitch
43670   and tiling format.
43671   </para><para>
43672
43673   For an untiled surface, this removes any existing fence.
43674</para>
43675</refsect1>
43676<refsect1>
43677<title>Returns</title>
43678<para>
43679   </para><para>
43680
43681   0 on success, negative error code on failure.
43682</para>
43683</refsect1>
43684</refentry>
43685
43686<refentry id="API-i915-gem-object-pin-fence">
43687<refentryinfo>
43688 <title>LINUX</title>
43689 <productname>Kernel Hackers Manual</productname>
43690 <date>July 2017</date>
43691</refentryinfo>
43692<refmeta>
43693 <refentrytitle><phrase>i915_gem_object_pin_fence</phrase></refentrytitle>
43694 <manvolnum>9</manvolnum>
43695 <refmiscinfo class="version">4.4.14</refmiscinfo>
43696</refmeta>
43697<refnamediv>
43698 <refname>i915_gem_object_pin_fence</refname>
43699 <refpurpose>
43700     pin fencing state
43701 </refpurpose>
43702</refnamediv>
43703<refsynopsisdiv>
43704 <title>Synopsis</title>
43705  <funcsynopsis><funcprototype>
43706   <funcdef>bool <function>i915_gem_object_pin_fence </function></funcdef>
43707   <paramdef>struct drm_i915_gem_object * <parameter>obj</parameter></paramdef>
43708  </funcprototype></funcsynopsis>
43709</refsynopsisdiv>
43710<refsect1>
43711 <title>Arguments</title>
43712 <variablelist>
43713  <varlistentry>
43714   <term><parameter>obj</parameter></term>
43715   <listitem>
43716    <para>
43717     object to pin fencing for
43718    </para>
43719   </listitem>
43720  </varlistentry>
43721 </variablelist>
43722</refsect1>
43723<refsect1>
43724<title>Description</title>
43725<para>
43726   This pins the fencing state (whether tiled or untiled) to make sure the
43727   object is ready to be used as a scanout target. Fencing status must be
43728   synchronize first by calling <function>i915_gem_object_get_fence</function>:
43729   </para><para>
43730
43731   The resulting fence pin reference must be released again with
43732   <function>i915_gem_object_unpin_fence</function>.
43733</para>
43734</refsect1>
43735<refsect1>
43736<title>Returns</title>
43737<para>
43738   </para><para>
43739
43740   True if the object has a fence, false otherwise.
43741</para>
43742</refsect1>
43743</refentry>
43744
43745<refentry id="API-i915-gem-object-unpin-fence">
43746<refentryinfo>
43747 <title>LINUX</title>
43748 <productname>Kernel Hackers Manual</productname>
43749 <date>July 2017</date>
43750</refentryinfo>
43751<refmeta>
43752 <refentrytitle><phrase>i915_gem_object_unpin_fence</phrase></refentrytitle>
43753 <manvolnum>9</manvolnum>
43754 <refmiscinfo class="version">4.4.14</refmiscinfo>
43755</refmeta>
43756<refnamediv>
43757 <refname>i915_gem_object_unpin_fence</refname>
43758 <refpurpose>
43759     unpin fencing state
43760 </refpurpose>
43761</refnamediv>
43762<refsynopsisdiv>
43763 <title>Synopsis</title>
43764  <funcsynopsis><funcprototype>
43765   <funcdef>void <function>i915_gem_object_unpin_fence </function></funcdef>
43766   <paramdef>struct drm_i915_gem_object * <parameter>obj</parameter></paramdef>
43767  </funcprototype></funcsynopsis>
43768</refsynopsisdiv>
43769<refsect1>
43770 <title>Arguments</title>
43771 <variablelist>
43772  <varlistentry>
43773   <term><parameter>obj</parameter></term>
43774   <listitem>
43775    <para>
43776     object to unpin fencing for
43777    </para>
43778   </listitem>
43779  </varlistentry>
43780 </variablelist>
43781</refsect1>
43782<refsect1>
43783<title>Description</title>
43784<para>
43785   This releases the fence pin reference acquired through
43786   i915_gem_object_pin_fence. It will handle both objects with and without an
43787   attached fence correctly, callers do not need to distinguish this.
43788</para>
43789</refsect1>
43790</refentry>
43791
43792<refentry id="API-i915-gem-restore-fences">
43793<refentryinfo>
43794 <title>LINUX</title>
43795 <productname>Kernel Hackers Manual</productname>
43796 <date>July 2017</date>
43797</refentryinfo>
43798<refmeta>
43799 <refentrytitle><phrase>i915_gem_restore_fences</phrase></refentrytitle>
43800 <manvolnum>9</manvolnum>
43801 <refmiscinfo class="version">4.4.14</refmiscinfo>
43802</refmeta>
43803<refnamediv>
43804 <refname>i915_gem_restore_fences</refname>
43805 <refpurpose>
43806     restore fence state
43807 </refpurpose>
43808</refnamediv>
43809<refsynopsisdiv>
43810 <title>Synopsis</title>
43811  <funcsynopsis><funcprototype>
43812   <funcdef>void <function>i915_gem_restore_fences </function></funcdef>
43813   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
43814  </funcprototype></funcsynopsis>
43815</refsynopsisdiv>
43816<refsect1>
43817 <title>Arguments</title>
43818 <variablelist>
43819  <varlistentry>
43820   <term><parameter>dev</parameter></term>
43821   <listitem>
43822    <para>
43823     DRM device
43824    </para>
43825   </listitem>
43826  </varlistentry>
43827 </variablelist>
43828</refsect1>
43829<refsect1>
43830<title>Description</title>
43831<para>
43832   Restore the hw fence state to match the software tracking again, to be called
43833   after a gpu reset and on resume.
43834</para>
43835</refsect1>
43836</refentry>
43837
43838<refentry id="API-i915-gem-detect-bit-6-swizzle">
43839<refentryinfo>
43840 <title>LINUX</title>
43841 <productname>Kernel Hackers Manual</productname>
43842 <date>July 2017</date>
43843</refentryinfo>
43844<refmeta>
43845 <refentrytitle><phrase>i915_gem_detect_bit_6_swizzle</phrase></refentrytitle>
43846 <manvolnum>9</manvolnum>
43847 <refmiscinfo class="version">4.4.14</refmiscinfo>
43848</refmeta>
43849<refnamediv>
43850 <refname>i915_gem_detect_bit_6_swizzle</refname>
43851 <refpurpose>
43852     detect bit 6 swizzling pattern
43853 </refpurpose>
43854</refnamediv>
43855<refsynopsisdiv>
43856 <title>Synopsis</title>
43857  <funcsynopsis><funcprototype>
43858   <funcdef>void <function>i915_gem_detect_bit_6_swizzle </function></funcdef>
43859   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
43860  </funcprototype></funcsynopsis>
43861</refsynopsisdiv>
43862<refsect1>
43863 <title>Arguments</title>
43864 <variablelist>
43865  <varlistentry>
43866   <term><parameter>dev</parameter></term>
43867   <listitem>
43868    <para>
43869     DRM device
43870    </para>
43871   </listitem>
43872  </varlistentry>
43873 </variablelist>
43874</refsect1>
43875<refsect1>
43876<title>Description</title>
43877<para>
43878   Detects bit 6 swizzling of address lookup between IGD access and CPU
43879   access through main memory.
43880</para>
43881</refsect1>
43882</refentry>
43883
43884<refentry id="API-i915-gem-object-do-bit-17-swizzle">
43885<refentryinfo>
43886 <title>LINUX</title>
43887 <productname>Kernel Hackers Manual</productname>
43888 <date>July 2017</date>
43889</refentryinfo>
43890<refmeta>
43891 <refentrytitle><phrase>i915_gem_object_do_bit_17_swizzle</phrase></refentrytitle>
43892 <manvolnum>9</manvolnum>
43893 <refmiscinfo class="version">4.4.14</refmiscinfo>
43894</refmeta>
43895<refnamediv>
43896 <refname>i915_gem_object_do_bit_17_swizzle</refname>
43897 <refpurpose>
43898     fixup bit 17 swizzling
43899 </refpurpose>
43900</refnamediv>
43901<refsynopsisdiv>
43902 <title>Synopsis</title>
43903  <funcsynopsis><funcprototype>
43904   <funcdef>void <function>i915_gem_object_do_bit_17_swizzle </function></funcdef>
43905   <paramdef>struct drm_i915_gem_object * <parameter>obj</parameter></paramdef>
43906  </funcprototype></funcsynopsis>
43907</refsynopsisdiv>
43908<refsect1>
43909 <title>Arguments</title>
43910 <variablelist>
43911  <varlistentry>
43912   <term><parameter>obj</parameter></term>
43913   <listitem>
43914    <para>
43915     i915 GEM buffer object
43916    </para>
43917   </listitem>
43918  </varlistentry>
43919 </variablelist>
43920</refsect1>
43921<refsect1>
43922<title>Description</title>
43923<para>
43924   This function fixes up the swizzling in case any page frame number for this
43925   object has changed in bit 17 since that state has been saved with
43926   <function>i915_gem_object_save_bit_17_swizzle</function>.
43927   </para><para>
43928
43929   This is called when pinning backing storage again, since the kernel is free
43930   to move unpinned backing storage around (either by directly moving pages or
43931   by swapping them out and back in again).
43932</para>
43933</refsect1>
43934</refentry>
43935
43936<refentry id="API-i915-gem-object-save-bit-17-swizzle">
43937<refentryinfo>
43938 <title>LINUX</title>
43939 <productname>Kernel Hackers Manual</productname>
43940 <date>July 2017</date>
43941</refentryinfo>
43942<refmeta>
43943 <refentrytitle><phrase>i915_gem_object_save_bit_17_swizzle</phrase></refentrytitle>
43944 <manvolnum>9</manvolnum>
43945 <refmiscinfo class="version">4.4.14</refmiscinfo>
43946</refmeta>
43947<refnamediv>
43948 <refname>i915_gem_object_save_bit_17_swizzle</refname>
43949 <refpurpose>
43950     save bit 17 swizzling
43951 </refpurpose>
43952</refnamediv>
43953<refsynopsisdiv>
43954 <title>Synopsis</title>
43955  <funcsynopsis><funcprototype>
43956   <funcdef>void <function>i915_gem_object_save_bit_17_swizzle </function></funcdef>
43957   <paramdef>struct drm_i915_gem_object * <parameter>obj</parameter></paramdef>
43958  </funcprototype></funcsynopsis>
43959</refsynopsisdiv>
43960<refsect1>
43961 <title>Arguments</title>
43962 <variablelist>
43963  <varlistentry>
43964   <term><parameter>obj</parameter></term>
43965   <listitem>
43966    <para>
43967     i915 GEM buffer object
43968    </para>
43969   </listitem>
43970  </varlistentry>
43971 </variablelist>
43972</refsect1>
43973<refsect1>
43974<title>Description</title>
43975<para>
43976   This function saves the bit 17 of each page frame number so that swizzling
43977   can be fixed up later on with <function>i915_gem_object_do_bit_17_swizzle</function>. This must
43978   be called before the backing storage can be unpinned.
43979</para>
43980</refsect1>
43981</refentry>
43982
43983        <sect3>
43984          <title>Global GTT Fence Handling</title>
43985<para>
43986   </para><para>
43987   Important to avoid confusions: <quote>fences</quote> in the i915 driver are not execution
43988   fences used to track command completion but hardware detiler objects which
43989   wrap a given range of the global GTT. Each platform has only a fairly limited
43990   set of these objects.
43991   </para><para>
43992   Fences are used to detile GTT memory mappings. They're also connected to the
43993   hardware frontbuffer render tracking and hence interract with frontbuffer
43994   conmpression. Furthermore on older platforms fences are required for tiled
43995   objects used by the display engine. They can also be used by the render
43996   engine - they're required for blitter commands and are optional for render
43997   commands. But on gen4+ both display (with the exception of fbc) and rendering
43998   have their own tiling state bits and don't need fences.
43999   </para><para>
44000   Also note that fences only support X and Y tiling and hence can't be used for
44001   the fancier new tiling formats like W, Ys and Yf.
44002   </para><para>
44003   Finally note that because fences are such a restricted resource they're
44004   dynamically associated with objects. Furthermore fence state is committed to
44005   the hardware lazily to avoid unecessary stalls on gen2/3. Therefore code must
44006   explictly call <function>i915_gem_object_get_fence</function> to synchronize fencing status
44007   for cpu access. Also note that some code wants an unfenced view, for those
44008   cases the fence can be removed forcefully with <function>i915_gem_object_put_fence</function>.
44009   </para><para>
44010   Internally these functions will synchronize with userspace access by removing
44011   CPU ptes into GTT mmaps (not the GTT ptes themselves) as needed.
44012</para>
44013
44014        </sect3>
44015        <sect3>
44016          <title>Hardware Tiling and Swizzling Details</title>
44017<para>
44018   </para><para>
44019   The idea behind tiling is to increase cache hit rates by rearranging
44020   pixel data so that a group of pixel accesses are in the same cacheline.
44021   Performance improvement from doing this on the back/depth buffer are on
44022   the order of 30%.
44023   </para><para>
44024   Intel architectures make this somewhat more complicated, though, by
44025   adjustments made to addressing of data when the memory is in interleaved
44026   mode (matched pairs of DIMMS) to improve memory bandwidth.
44027   For interleaved memory, the CPU sends every sequential 64 bytes
44028   to an alternate memory channel so it can get the bandwidth from both.
44029   </para><para>
44030   The GPU also rearranges its accesses for increased bandwidth to interleaved
44031   memory, and it matches what the CPU does for non-tiled.  However, when tiled
44032   it does it a little differently, since one walks addresses not just in the
44033   X direction but also Y.  So, along with alternating channels when bit
44034   6 of the address flips, it also alternates when other bits flip --  Bits 9
44035   (every 512 bytes, an X tile scanline) and 10 (every two X tile scanlines)
44036   are common to both the 915 and 965-class hardware.
44037   </para><para>
44038   The CPU also sometimes XORs in higher bits as well, to improve
44039   bandwidth doing strided access like we do so frequently in graphics.  This
44040   is called <quote>Channel XOR Randomization</quote> in the MCH documentation.  The result
44041   is that the CPU is XORing in either bit 11 or bit 17 to bit 6 of its address
44042   decode.
44043   </para><para>
44044   All of this bit 6 XORing has an effect on our memory management,
44045   as we need to make sure that the 3d driver can correctly address object
44046   contents.
44047   </para><para>
44048   If we don't have interleaved memory, all tiling is safe and no swizzling is
44049   required.
44050   </para><para>
44051   When bit 17 is XORed in, we simply refuse to tile at all.  Bit
44052   17 is not just a page offset, so as we page an objet out and back in,
44053   individual pages in it will have different bit 17 addresses, resulting in
44054   each 64 bytes being swapped with its neighbor!
44055   </para><para>
44056   Otherwise, if interleaved, we have to tell the 3d driver what the address
44057   swizzling it needs to do is, since it's writing with the CPU to the pages
44058   (bit 6 and potentially bit 11 XORed in), and the GPU is reading from the
44059   pages (bit 6, 9, and 10 XORed in), resulting in a cumulative bit swizzling
44060   required by the CPU of XORing in bit 6, 9, 10, and potentially 11, in order
44061   to match what the GPU expects.
44062</para>
44063
44064        </sect3>
44065      </sect2>
44066      <sect2>
44067        <title>Object Tiling IOCTLs</title>
44068<!-- drivers/gpu/drm/i915/i915_gem_tiling.c -->
44069<refentry id="API-i915-gem-set-tiling">
44070<refentryinfo>
44071 <title>LINUX</title>
44072 <productname>Kernel Hackers Manual</productname>
44073 <date>July 2017</date>
44074</refentryinfo>
44075<refmeta>
44076 <refentrytitle><phrase>i915_gem_set_tiling</phrase></refentrytitle>
44077 <manvolnum>9</manvolnum>
44078 <refmiscinfo class="version">4.4.14</refmiscinfo>
44079</refmeta>
44080<refnamediv>
44081 <refname>i915_gem_set_tiling</refname>
44082 <refpurpose>
44083  IOCTL handler to set tiling mode
44084 </refpurpose>
44085</refnamediv>
44086<refsynopsisdiv>
44087 <title>Synopsis</title>
44088  <funcsynopsis><funcprototype>
44089   <funcdef>int <function>i915_gem_set_tiling </function></funcdef>
44090   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
44091   <paramdef>void * <parameter>data</parameter></paramdef>
44092   <paramdef>struct drm_file * <parameter>file</parameter></paramdef>
44093  </funcprototype></funcsynopsis>
44094</refsynopsisdiv>
44095<refsect1>
44096 <title>Arguments</title>
44097 <variablelist>
44098  <varlistentry>
44099   <term><parameter>dev</parameter></term>
44100   <listitem>
44101    <para>
44102     DRM device
44103    </para>
44104   </listitem>
44105  </varlistentry>
44106  <varlistentry>
44107   <term><parameter>data</parameter></term>
44108   <listitem>
44109    <para>
44110     data pointer for the ioctl
44111    </para>
44112   </listitem>
44113  </varlistentry>
44114  <varlistentry>
44115   <term><parameter>file</parameter></term>
44116   <listitem>
44117    <para>
44118     DRM file for the ioctl call
44119    </para>
44120   </listitem>
44121  </varlistentry>
44122 </variablelist>
44123</refsect1>
44124<refsect1>
44125<title>Description</title>
44126<para>
44127   Sets the tiling mode of an object, returning the required swizzling of
44128   bit 6 of addresses in the object.
44129   </para><para>
44130
44131   Called by the user via ioctl.
44132</para>
44133</refsect1>
44134<refsect1>
44135<title>Returns</title>
44136<para>
44137   Zero on success, negative errno on failure.
44138</para>
44139</refsect1>
44140</refentry>
44141
44142<refentry id="API-i915-gem-get-tiling">
44143<refentryinfo>
44144 <title>LINUX</title>
44145 <productname>Kernel Hackers Manual</productname>
44146 <date>July 2017</date>
44147</refentryinfo>
44148<refmeta>
44149 <refentrytitle><phrase>i915_gem_get_tiling</phrase></refentrytitle>
44150 <manvolnum>9</manvolnum>
44151 <refmiscinfo class="version">4.4.14</refmiscinfo>
44152</refmeta>
44153<refnamediv>
44154 <refname>i915_gem_get_tiling</refname>
44155 <refpurpose>
44156     IOCTL handler to get tiling mode
44157 </refpurpose>
44158</refnamediv>
44159<refsynopsisdiv>
44160 <title>Synopsis</title>
44161  <funcsynopsis><funcprototype>
44162   <funcdef>int <function>i915_gem_get_tiling </function></funcdef>
44163   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
44164   <paramdef>void * <parameter>data</parameter></paramdef>
44165   <paramdef>struct drm_file * <parameter>file</parameter></paramdef>
44166  </funcprototype></funcsynopsis>
44167</refsynopsisdiv>
44168<refsect1>
44169 <title>Arguments</title>
44170 <variablelist>
44171  <varlistentry>
44172   <term><parameter>dev</parameter></term>
44173   <listitem>
44174    <para>
44175     DRM device
44176    </para>
44177   </listitem>
44178  </varlistentry>
44179  <varlistentry>
44180   <term><parameter>data</parameter></term>
44181   <listitem>
44182    <para>
44183     data pointer for the ioctl
44184    </para>
44185   </listitem>
44186  </varlistentry>
44187  <varlistentry>
44188   <term><parameter>file</parameter></term>
44189   <listitem>
44190    <para>
44191     DRM file for the ioctl call
44192    </para>
44193   </listitem>
44194  </varlistentry>
44195 </variablelist>
44196</refsect1>
44197<refsect1>
44198<title>Description</title>
44199<para>
44200   Returns the current tiling mode and required bit 6 swizzling for the object.
44201   </para><para>
44202
44203   Called by the user via ioctl.
44204</para>
44205</refsect1>
44206<refsect1>
44207<title>Returns</title>
44208<para>
44209   Zero on success, negative errno on failure.
44210</para>
44211</refsect1>
44212</refentry>
44213
44214<para>
44215   </para><para>
44216   <function>i915_gem_set_tiling</function> and <function>i915_gem_get_tiling</function> is the userspace interface to
44217   declare fence register requirements.
44218   </para><para>
44219   In principle GEM doesn't care at all about the internal data layout of an
44220   object, and hence it also doesn't care about tiling or swizzling. There's two
44221   exceptions:
44222   </para><para>
44223   - For X and Y tiling the hardware provides detilers for CPU access, so called
44224   fences. Since there's only a limited amount of them the kernel must manage
44225   these, and therefore userspace must tell the kernel the object tiling if it
44226   wants to use fences for detiling.
44227   - On gen3 and gen4 platforms have a swizzling pattern for tiled objects which
44228   depends upon the physical page frame number. When swapping such objects the
44229   page frame number might change and the kernel must be able to fix this up
44230   and hence now the tiling. Note that on a subset of platforms with
44231   asymmetric memory channel population the swizzling pattern changes in an
44232   unknown way, and for those the kernel simply forbids swapping completely.
44233   </para><para>
44234   Since neither of this applies for new tiling layouts on modern platforms like
44235   W, Ys and Yf tiling GEM only allows object tiling to be set to X or Y tiled.
44236   Anything else can be handled in userspace entirely without the kernel's
44237   invovlement.
44238</para>
44239
44240      </sect2>
44241      <sect2>
44242        <title>Buffer Object Eviction</title>
44243	<para>
44244	  This section documents the interface functions for evicting buffer
44245	  objects to make space available in the virtual gpu address spaces.
44246	  Note that this is mostly orthogonal to shrinking buffer objects
44247	  caches, which has the goal to make main memory (shared with the gpu
44248	  through the unified memory architecture) available.
44249	</para>
44250<!-- drivers/gpu/drm/i915/i915_gem_evict.c -->
44251<refentry id="API-i915-gem-evict-something">
44252<refentryinfo>
44253 <title>LINUX</title>
44254 <productname>Kernel Hackers Manual</productname>
44255 <date>July 2017</date>
44256</refentryinfo>
44257<refmeta>
44258 <refentrytitle><phrase>i915_gem_evict_something</phrase></refentrytitle>
44259 <manvolnum>9</manvolnum>
44260 <refmiscinfo class="version">4.4.14</refmiscinfo>
44261</refmeta>
44262<refnamediv>
44263 <refname>i915_gem_evict_something</refname>
44264 <refpurpose>
44265  Evict vmas to make room for binding a new one
44266 </refpurpose>
44267</refnamediv>
44268<refsynopsisdiv>
44269 <title>Synopsis</title>
44270  <funcsynopsis><funcprototype>
44271   <funcdef>int <function>i915_gem_evict_something </function></funcdef>
44272   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
44273   <paramdef>struct i915_address_space * <parameter>vm</parameter></paramdef>
44274   <paramdef>int <parameter>min_size</parameter></paramdef>
44275   <paramdef>unsigned <parameter>alignment</parameter></paramdef>
44276   <paramdef>unsigned <parameter>cache_level</parameter></paramdef>
44277   <paramdef>unsigned long <parameter>start</parameter></paramdef>
44278   <paramdef>unsigned long <parameter>end</parameter></paramdef>
44279   <paramdef>unsigned <parameter>flags</parameter></paramdef>
44280  </funcprototype></funcsynopsis>
44281</refsynopsisdiv>
44282<refsect1>
44283 <title>Arguments</title>
44284 <variablelist>
44285  <varlistentry>
44286   <term><parameter>dev</parameter></term>
44287   <listitem>
44288    <para>
44289     drm_device
44290    </para>
44291   </listitem>
44292  </varlistentry>
44293  <varlistentry>
44294   <term><parameter>vm</parameter></term>
44295   <listitem>
44296    <para>
44297     address space to evict from
44298    </para>
44299   </listitem>
44300  </varlistentry>
44301  <varlistentry>
44302   <term><parameter>min_size</parameter></term>
44303   <listitem>
44304    <para>
44305     size of the desired free space
44306    </para>
44307   </listitem>
44308  </varlistentry>
44309  <varlistentry>
44310   <term><parameter>alignment</parameter></term>
44311   <listitem>
44312    <para>
44313     alignment constraint of the desired free space
44314    </para>
44315   </listitem>
44316  </varlistentry>
44317  <varlistentry>
44318   <term><parameter>cache_level</parameter></term>
44319   <listitem>
44320    <para>
44321     cache_level for the desired space
44322    </para>
44323   </listitem>
44324  </varlistentry>
44325  <varlistentry>
44326   <term><parameter>start</parameter></term>
44327   <listitem>
44328    <para>
44329     start (inclusive) of the range from which to evict objects
44330    </para>
44331   </listitem>
44332  </varlistentry>
44333  <varlistentry>
44334   <term><parameter>end</parameter></term>
44335   <listitem>
44336    <para>
44337     end (exclusive) of the range from which to evict objects
44338    </para>
44339   </listitem>
44340  </varlistentry>
44341  <varlistentry>
44342   <term><parameter>flags</parameter></term>
44343   <listitem>
44344    <para>
44345     additional flags to control the eviction algorithm
44346    </para>
44347   </listitem>
44348  </varlistentry>
44349 </variablelist>
44350</refsect1>
44351<refsect1>
44352<title>Description</title>
44353<para>
44354   This function will try to evict vmas until a free space satisfying the
44355   requirements is found. Callers must check first whether any such hole exists
44356   already before calling this function.
44357   </para><para>
44358
44359   This function is used by the object/vma binding code.
44360   </para><para>
44361
44362   Since this function is only used to free up virtual address space it only
44363   ignores pinned vmas, and not object where the backing storage itself is
44364   pinned. Hence obj-&gt;pages_pin_count does not protect against eviction.
44365</para>
44366</refsect1>
44367<refsect1>
44368<title>To clarify</title>
44369<para>
44370   This is for freeing up virtual address space, not for freeing
44371   memory in e.g. the shrinker.
44372</para>
44373</refsect1>
44374</refentry>
44375
44376<refentry id="API-i915-gem-evict-vm">
44377<refentryinfo>
44378 <title>LINUX</title>
44379 <productname>Kernel Hackers Manual</productname>
44380 <date>July 2017</date>
44381</refentryinfo>
44382<refmeta>
44383 <refentrytitle><phrase>i915_gem_evict_vm</phrase></refentrytitle>
44384 <manvolnum>9</manvolnum>
44385 <refmiscinfo class="version">4.4.14</refmiscinfo>
44386</refmeta>
44387<refnamediv>
44388 <refname>i915_gem_evict_vm</refname>
44389 <refpurpose>
44390     Evict all idle vmas from a vm
44391 </refpurpose>
44392</refnamediv>
44393<refsynopsisdiv>
44394 <title>Synopsis</title>
44395  <funcsynopsis><funcprototype>
44396   <funcdef>int <function>i915_gem_evict_vm </function></funcdef>
44397   <paramdef>struct i915_address_space * <parameter>vm</parameter></paramdef>
44398   <paramdef>bool <parameter>do_idle</parameter></paramdef>
44399  </funcprototype></funcsynopsis>
44400</refsynopsisdiv>
44401<refsect1>
44402 <title>Arguments</title>
44403 <variablelist>
44404  <varlistentry>
44405   <term><parameter>vm</parameter></term>
44406   <listitem>
44407    <para>
44408     Address space to cleanse
44409    </para>
44410   </listitem>
44411  </varlistentry>
44412  <varlistentry>
44413   <term><parameter>do_idle</parameter></term>
44414   <listitem>
44415    <para>
44416     Boolean directing whether to idle first.
44417    </para>
44418   </listitem>
44419  </varlistentry>
44420 </variablelist>
44421</refsect1>
44422<refsect1>
44423<title>Description</title>
44424<para>
44425   This function evicts all idles vmas from a vm. If all unpinned vmas should be
44426   evicted the <parameter>do_idle</parameter> needs to be set to true.
44427   </para><para>
44428
44429   This is used by the execbuf code as a last-ditch effort to defragment the
44430   address space.
44431</para>
44432</refsect1>
44433<refsect1>
44434<title>To clarify</title>
44435<para>
44436   This is for freeing up virtual address space, not for freeing
44437   memory in e.g. the shrinker.
44438</para>
44439</refsect1>
44440</refentry>
44441
44442      </sect2>
44443      <sect2>
44444        <title>Buffer Object Memory Shrinking</title>
44445	<para>
44446	  This section documents the interface function for shrinking memory
44447	  usage of buffer object caches. Shrinking is used to make main memory
44448	  available.  Note that this is mostly orthogonal to evicting buffer
44449	  objects, which has the goal to make space in gpu virtual address
44450	  spaces.
44451	</para>
44452<!-- drivers/gpu/drm/i915/i915_gem_shrinker.c -->
44453<refentry id="API-i915-gem-shrink">
44454<refentryinfo>
44455 <title>LINUX</title>
44456 <productname>Kernel Hackers Manual</productname>
44457 <date>July 2017</date>
44458</refentryinfo>
44459<refmeta>
44460 <refentrytitle><phrase>i915_gem_shrink</phrase></refentrytitle>
44461 <manvolnum>9</manvolnum>
44462 <refmiscinfo class="version">4.4.14</refmiscinfo>
44463</refmeta>
44464<refnamediv>
44465 <refname>i915_gem_shrink</refname>
44466 <refpurpose>
44467  Shrink buffer object caches
44468 </refpurpose>
44469</refnamediv>
44470<refsynopsisdiv>
44471 <title>Synopsis</title>
44472  <funcsynopsis><funcprototype>
44473   <funcdef>unsigned long <function>i915_gem_shrink </function></funcdef>
44474   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
44475   <paramdef>unsigned long <parameter>target</parameter></paramdef>
44476   <paramdef>unsigned <parameter>flags</parameter></paramdef>
44477  </funcprototype></funcsynopsis>
44478</refsynopsisdiv>
44479<refsect1>
44480 <title>Arguments</title>
44481 <variablelist>
44482  <varlistentry>
44483   <term><parameter>dev_priv</parameter></term>
44484   <listitem>
44485    <para>
44486     i915 device
44487    </para>
44488   </listitem>
44489  </varlistentry>
44490  <varlistentry>
44491   <term><parameter>target</parameter></term>
44492   <listitem>
44493    <para>
44494     amount of memory to make available, in pages
44495    </para>
44496   </listitem>
44497  </varlistentry>
44498  <varlistentry>
44499   <term><parameter>flags</parameter></term>
44500   <listitem>
44501    <para>
44502     control flags for selecting cache types
44503    </para>
44504   </listitem>
44505  </varlistentry>
44506 </variablelist>
44507</refsect1>
44508<refsect1>
44509<title>Description</title>
44510<para>
44511   This function is the main interface to the shrinker. It will try to release
44512   up to <parameter>target</parameter> pages of main memory backing storage from buffer objects.
44513   Selection of the specific caches can be done with <parameter>flags</parameter>. This is e.g. useful
44514   when purgeable objects should be removed from caches preferentially.
44515   </para><para>
44516
44517   Note that it's not guaranteed that released amount is actually available as
44518   free system memory - the pages might still be in-used to due to other reasons
44519   (like cpu mmaps) or the mm core has reused them before we could grab them.
44520   Therefore code that needs to explicitly shrink buffer objects caches (e.g. to
44521   avoid deadlocks in memory reclaim) must fall back to <function>i915_gem_shrink_all</function>.
44522   </para><para>
44523
44524   Also note that any kind of pinning (both per-vma address space pins and
44525   backing storage pins at the buffer object level) result in the shrinker code
44526   having to skip the object.
44527</para>
44528</refsect1>
44529<refsect1>
44530<title>Returns</title>
44531<para>
44532   The number of pages of backing storage actually released.
44533</para>
44534</refsect1>
44535</refentry>
44536
44537<refentry id="API-i915-gem-shrink-all">
44538<refentryinfo>
44539 <title>LINUX</title>
44540 <productname>Kernel Hackers Manual</productname>
44541 <date>July 2017</date>
44542</refentryinfo>
44543<refmeta>
44544 <refentrytitle><phrase>i915_gem_shrink_all</phrase></refentrytitle>
44545 <manvolnum>9</manvolnum>
44546 <refmiscinfo class="version">4.4.14</refmiscinfo>
44547</refmeta>
44548<refnamediv>
44549 <refname>i915_gem_shrink_all</refname>
44550 <refpurpose>
44551     Shrink buffer object caches completely
44552 </refpurpose>
44553</refnamediv>
44554<refsynopsisdiv>
44555 <title>Synopsis</title>
44556  <funcsynopsis><funcprototype>
44557   <funcdef>unsigned long <function>i915_gem_shrink_all </function></funcdef>
44558   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
44559  </funcprototype></funcsynopsis>
44560</refsynopsisdiv>
44561<refsect1>
44562 <title>Arguments</title>
44563 <variablelist>
44564  <varlistentry>
44565   <term><parameter>dev_priv</parameter></term>
44566   <listitem>
44567    <para>
44568     i915 device
44569    </para>
44570   </listitem>
44571  </varlistentry>
44572 </variablelist>
44573</refsect1>
44574<refsect1>
44575<title>Description</title>
44576<para>
44577   This is a simple wraper around <function>i915_gem_shrink</function> to aggressively shrink all
44578   caches completely. It also first waits for and retires all outstanding
44579   requests to also be able to release backing storage for active objects.
44580   </para><para>
44581
44582   This should only be used in code to intentionally quiescent the gpu or as a
44583   last-ditch effort when memory seems to have run out.
44584</para>
44585</refsect1>
44586<refsect1>
44587<title>Returns</title>
44588<para>
44589   The number of pages of backing storage actually released.
44590</para>
44591</refsect1>
44592</refentry>
44593
44594<refentry id="API-i915-gem-shrinker-init">
44595<refentryinfo>
44596 <title>LINUX</title>
44597 <productname>Kernel Hackers Manual</productname>
44598 <date>July 2017</date>
44599</refentryinfo>
44600<refmeta>
44601 <refentrytitle><phrase>i915_gem_shrinker_init</phrase></refentrytitle>
44602 <manvolnum>9</manvolnum>
44603 <refmiscinfo class="version">4.4.14</refmiscinfo>
44604</refmeta>
44605<refnamediv>
44606 <refname>i915_gem_shrinker_init</refname>
44607 <refpurpose>
44608     Initialize i915 shrinker
44609 </refpurpose>
44610</refnamediv>
44611<refsynopsisdiv>
44612 <title>Synopsis</title>
44613  <funcsynopsis><funcprototype>
44614   <funcdef>void <function>i915_gem_shrinker_init </function></funcdef>
44615   <paramdef>struct drm_i915_private * <parameter>dev_priv</parameter></paramdef>
44616  </funcprototype></funcsynopsis>
44617</refsynopsisdiv>
44618<refsect1>
44619 <title>Arguments</title>
44620 <variablelist>
44621  <varlistentry>
44622   <term><parameter>dev_priv</parameter></term>
44623   <listitem>
44624    <para>
44625     i915 device
44626    </para>
44627   </listitem>
44628  </varlistentry>
44629 </variablelist>
44630</refsect1>
44631<refsect1>
44632<title>Description</title>
44633<para>
44634   This function registers and sets up the i915 shrinker and OOM handler.
44635</para>
44636</refsect1>
44637</refentry>
44638
44639      </sect2>
44640    </sect1>
44641    <sect1>
44642      <title>GuC-based Command Submission</title>
44643      <sect2>
44644        <title>GuC</title>
44645<refentry>
44646 <refnamediv>
44647  <refname>
44648   drivers/gpu/drm/i915/intel_guc_loader.c
44649  </refname>
44650  <refpurpose>
44651   Document generation inconsistency
44652  </refpurpose>
44653 </refnamediv>
44654 <refsect1>
44655  <title>
44656   Oops
44657  </title>
44658  <warning>
44659   <para>
44660    The template for this document tried to insert
44661    the structured comment from the file
44662    <filename>drivers/gpu/drm/i915/intel_guc_loader.c</filename> at this point,
44663    but none was found.
44664    This dummy section is inserted to allow
44665    generation to continue.
44666   </para>
44667  </warning>
44668 </refsect1>
44669</refentry>
44670<!-- drivers/gpu/drm/i915/intel_guc_loader.c -->
44671<refentry id="API-intel-guc-ucode-load">
44672<refentryinfo>
44673 <title>LINUX</title>
44674 <productname>Kernel Hackers Manual</productname>
44675 <date>July 2017</date>
44676</refentryinfo>
44677<refmeta>
44678 <refentrytitle><phrase>intel_guc_ucode_load</phrase></refentrytitle>
44679 <manvolnum>9</manvolnum>
44680 <refmiscinfo class="version">4.4.14</refmiscinfo>
44681</refmeta>
44682<refnamediv>
44683 <refname>intel_guc_ucode_load</refname>
44684 <refpurpose>
44685  load GuC uCode into the device
44686 </refpurpose>
44687</refnamediv>
44688<refsynopsisdiv>
44689 <title>Synopsis</title>
44690  <funcsynopsis><funcprototype>
44691   <funcdef>int <function>intel_guc_ucode_load </function></funcdef>
44692   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
44693  </funcprototype></funcsynopsis>
44694</refsynopsisdiv>
44695<refsect1>
44696 <title>Arguments</title>
44697 <variablelist>
44698  <varlistentry>
44699   <term><parameter>dev</parameter></term>
44700   <listitem>
44701    <para>
44702     drm device
44703    </para>
44704   </listitem>
44705  </varlistentry>
44706 </variablelist>
44707</refsect1>
44708<refsect1>
44709<title>Description</title>
44710<para>
44711   Called from <function>gem_init_hw</function> during driver loading and also after a GPU reset.
44712   </para><para>
44713
44714   The firmware image should have already been fetched into memory by the
44715   earlier call to <function>intel_guc_ucode_init</function>, so here we need only check that
44716   is succeeded, and then transfer the image to the h/w.
44717</para>
44718</refsect1>
44719<refsect1>
44720<title>Return</title>
44721<para>
44722   non-zero code on error
44723</para>
44724</refsect1>
44725</refentry>
44726
44727<refentry id="API-intel-guc-ucode-init">
44728<refentryinfo>
44729 <title>LINUX</title>
44730 <productname>Kernel Hackers Manual</productname>
44731 <date>July 2017</date>
44732</refentryinfo>
44733<refmeta>
44734 <refentrytitle><phrase>intel_guc_ucode_init</phrase></refentrytitle>
44735 <manvolnum>9</manvolnum>
44736 <refmiscinfo class="version">4.4.14</refmiscinfo>
44737</refmeta>
44738<refnamediv>
44739 <refname>intel_guc_ucode_init</refname>
44740 <refpurpose>
44741     define parameters and fetch firmware
44742 </refpurpose>
44743</refnamediv>
44744<refsynopsisdiv>
44745 <title>Synopsis</title>
44746  <funcsynopsis><funcprototype>
44747   <funcdef>void <function>intel_guc_ucode_init </function></funcdef>
44748   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
44749  </funcprototype></funcsynopsis>
44750</refsynopsisdiv>
44751<refsect1>
44752 <title>Arguments</title>
44753 <variablelist>
44754  <varlistentry>
44755   <term><parameter>dev</parameter></term>
44756   <listitem>
44757    <para>
44758     drm device
44759    </para>
44760   </listitem>
44761  </varlistentry>
44762 </variablelist>
44763</refsect1>
44764<refsect1>
44765<title>Description</title>
44766<para>
44767   Called early during driver load, but after GEM is initialised.
44768   </para><para>
44769
44770   The firmware will be transferred to the GuC's memory later,
44771   when <function>intel_guc_ucode_load</function> is called.
44772</para>
44773</refsect1>
44774</refentry>
44775
44776<refentry id="API-intel-guc-ucode-fini">
44777<refentryinfo>
44778 <title>LINUX</title>
44779 <productname>Kernel Hackers Manual</productname>
44780 <date>July 2017</date>
44781</refentryinfo>
44782<refmeta>
44783 <refentrytitle><phrase>intel_guc_ucode_fini</phrase></refentrytitle>
44784 <manvolnum>9</manvolnum>
44785 <refmiscinfo class="version">4.4.14</refmiscinfo>
44786</refmeta>
44787<refnamediv>
44788 <refname>intel_guc_ucode_fini</refname>
44789 <refpurpose>
44790     clean up all allocated resources
44791 </refpurpose>
44792</refnamediv>
44793<refsynopsisdiv>
44794 <title>Synopsis</title>
44795  <funcsynopsis><funcprototype>
44796   <funcdef>void <function>intel_guc_ucode_fini </function></funcdef>
44797   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
44798  </funcprototype></funcsynopsis>
44799</refsynopsisdiv>
44800<refsect1>
44801 <title>Arguments</title>
44802 <variablelist>
44803  <varlistentry>
44804   <term><parameter>dev</parameter></term>
44805   <listitem>
44806    <para>
44807     drm device
44808    </para>
44809   </listitem>
44810  </varlistentry>
44811 </variablelist>
44812</refsect1>
44813</refentry>
44814
44815      </sect2>
44816      <sect2>
44817        <title>GuC Client</title>
44818<refentry>
44819 <refnamediv>
44820  <refname>
44821   drivers/gpu/drm/i915/i915_guc_submission.c
44822  </refname>
44823  <refpurpose>
44824   Document generation inconsistency
44825  </refpurpose>
44826 </refnamediv>
44827 <refsect1>
44828  <title>
44829   Oops
44830  </title>
44831  <warning>
44832   <para>
44833    The template for this document tried to insert
44834    the structured comment from the file
44835    <filename>drivers/gpu/drm/i915/i915_guc_submission.c</filename> at this point,
44836    but none was found.
44837    This dummy section is inserted to allow
44838    generation to continue.
44839   </para>
44840  </warning>
44841 </refsect1>
44842</refentry>
44843<!-- drivers/gpu/drm/i915/i915_guc_submission.c -->
44844<refentry id="API-i915-guc-submit">
44845<refentryinfo>
44846 <title>LINUX</title>
44847 <productname>Kernel Hackers Manual</productname>
44848 <date>July 2017</date>
44849</refentryinfo>
44850<refmeta>
44851 <refentrytitle><phrase>i915_guc_submit</phrase></refentrytitle>
44852 <manvolnum>9</manvolnum>
44853 <refmiscinfo class="version">4.4.14</refmiscinfo>
44854</refmeta>
44855<refnamediv>
44856 <refname>i915_guc_submit</refname>
44857 <refpurpose>
44858  Submit commands through GuC
44859 </refpurpose>
44860</refnamediv>
44861<refsynopsisdiv>
44862 <title>Synopsis</title>
44863  <funcsynopsis><funcprototype>
44864   <funcdef>int <function>i915_guc_submit </function></funcdef>
44865   <paramdef>struct i915_guc_client * <parameter>client</parameter></paramdef>
44866   <paramdef>struct drm_i915_gem_request * <parameter>rq</parameter></paramdef>
44867  </funcprototype></funcsynopsis>
44868</refsynopsisdiv>
44869<refsect1>
44870 <title>Arguments</title>
44871 <variablelist>
44872  <varlistentry>
44873   <term><parameter>client</parameter></term>
44874   <listitem>
44875    <para>
44876     the guc client where commands will go through
44877    </para>
44878   </listitem>
44879  </varlistentry>
44880  <varlistentry>
44881   <term><parameter>rq</parameter></term>
44882   <listitem>
44883    <para>
44884     -- undescribed --
44885    </para>
44886   </listitem>
44887  </varlistentry>
44888 </variablelist>
44889</refsect1>
44890<refsect1>
44891<title>Return</title>
44892<para>
44893   0 if succeed
44894</para>
44895</refsect1>
44896</refentry>
44897
44898<refentry id="API-gem-allocate-guc-obj">
44899<refentryinfo>
44900 <title>LINUX</title>
44901 <productname>Kernel Hackers Manual</productname>
44902 <date>July 2017</date>
44903</refentryinfo>
44904<refmeta>
44905 <refentrytitle><phrase>gem_allocate_guc_obj</phrase></refentrytitle>
44906 <manvolnum>9</manvolnum>
44907 <refmiscinfo class="version">4.4.14</refmiscinfo>
44908</refmeta>
44909<refnamediv>
44910 <refname>gem_allocate_guc_obj</refname>
44911 <refpurpose>
44912     Allocate gem object for GuC usage
44913 </refpurpose>
44914</refnamediv>
44915<refsynopsisdiv>
44916 <title>Synopsis</title>
44917  <funcsynopsis><funcprototype>
44918   <funcdef>struct drm_i915_gem_object * <function>gem_allocate_guc_obj </function></funcdef>
44919   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
44920   <paramdef>u32 <parameter>size</parameter></paramdef>
44921  </funcprototype></funcsynopsis>
44922</refsynopsisdiv>
44923<refsect1>
44924 <title>Arguments</title>
44925 <variablelist>
44926  <varlistentry>
44927   <term><parameter>dev</parameter></term>
44928   <listitem>
44929    <para>
44930     drm device
44931    </para>
44932   </listitem>
44933  </varlistentry>
44934  <varlistentry>
44935   <term><parameter>size</parameter></term>
44936   <listitem>
44937    <para>
44938     size of object
44939    </para>
44940   </listitem>
44941  </varlistentry>
44942 </variablelist>
44943</refsect1>
44944<refsect1>
44945<title>Description</title>
44946<para>
44947   This is a wrapper to create a gem obj. In order to use it inside GuC, the
44948   object needs to be pinned lifetime. Also we must pin it to gtt space other
44949   than [0, GUC_WOPCM_TOP) because this range is reserved inside GuC.
44950</para>
44951</refsect1>
44952<refsect1>
44953<title>Return</title>
44954<para>
44955   A drm_i915_gem_object if successful, otherwise NULL.
44956</para>
44957</refsect1>
44958</refentry>
44959
44960<refentry id="API-gem-release-guc-obj">
44961<refentryinfo>
44962 <title>LINUX</title>
44963 <productname>Kernel Hackers Manual</productname>
44964 <date>July 2017</date>
44965</refentryinfo>
44966<refmeta>
44967 <refentrytitle><phrase>gem_release_guc_obj</phrase></refentrytitle>
44968 <manvolnum>9</manvolnum>
44969 <refmiscinfo class="version">4.4.14</refmiscinfo>
44970</refmeta>
44971<refnamediv>
44972 <refname>gem_release_guc_obj</refname>
44973 <refpurpose>
44974     Release gem object allocated for GuC usage
44975 </refpurpose>
44976</refnamediv>
44977<refsynopsisdiv>
44978 <title>Synopsis</title>
44979  <funcsynopsis><funcprototype>
44980   <funcdef>void <function>gem_release_guc_obj </function></funcdef>
44981   <paramdef>struct drm_i915_gem_object * <parameter>obj</parameter></paramdef>
44982  </funcprototype></funcsynopsis>
44983</refsynopsisdiv>
44984<refsect1>
44985 <title>Arguments</title>
44986 <variablelist>
44987  <varlistentry>
44988   <term><parameter>obj</parameter></term>
44989   <listitem>
44990    <para>
44991     gem obj to be released
44992    </para>
44993   </listitem>
44994  </varlistentry>
44995 </variablelist>
44996</refsect1>
44997</refentry>
44998
44999<refentry id="API-guc-client-alloc">
45000<refentryinfo>
45001 <title>LINUX</title>
45002 <productname>Kernel Hackers Manual</productname>
45003 <date>July 2017</date>
45004</refentryinfo>
45005<refmeta>
45006 <refentrytitle><phrase>guc_client_alloc</phrase></refentrytitle>
45007 <manvolnum>9</manvolnum>
45008 <refmiscinfo class="version">4.4.14</refmiscinfo>
45009</refmeta>
45010<refnamediv>
45011 <refname>guc_client_alloc</refname>
45012 <refpurpose>
45013     Allocate an i915_guc_client
45014 </refpurpose>
45015</refnamediv>
45016<refsynopsisdiv>
45017 <title>Synopsis</title>
45018  <funcsynopsis><funcprototype>
45019   <funcdef>struct i915_guc_client * <function>guc_client_alloc </function></funcdef>
45020   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
45021   <paramdef>uint32_t <parameter>priority</parameter></paramdef>
45022   <paramdef>struct intel_context * <parameter>ctx</parameter></paramdef>
45023  </funcprototype></funcsynopsis>
45024</refsynopsisdiv>
45025<refsect1>
45026 <title>Arguments</title>
45027 <variablelist>
45028  <varlistentry>
45029   <term><parameter>dev</parameter></term>
45030   <listitem>
45031    <para>
45032     drm device
45033    </para>
45034   </listitem>
45035  </varlistentry>
45036  <varlistentry>
45037   <term><parameter>priority</parameter></term>
45038   <listitem>
45039    <para>
45040     four levels priority _CRITICAL, _HIGH, _NORMAL and _LOW
45041     The kernel client to replace ExecList submission is created with
45042     NORMAL priority. Priority of a client for scheduler can be HIGH,
45043     while a preemption context can use CRITICAL.
45044     <parameter>ctx</parameter>		the context to own the client (we use the default render context)
45045    </para>
45046   </listitem>
45047  </varlistentry>
45048  <varlistentry>
45049   <term><parameter>ctx</parameter></term>
45050   <listitem>
45051    <para>
45052     -- undescribed --
45053    </para>
45054   </listitem>
45055  </varlistentry>
45056 </variablelist>
45057</refsect1>
45058<refsect1>
45059<title>Return</title>
45060<para>
45061   An i915_guc_client object if success.
45062</para>
45063</refsect1>
45064</refentry>
45065
45066<refentry id="API-intel-guc-suspend">
45067<refentryinfo>
45068 <title>LINUX</title>
45069 <productname>Kernel Hackers Manual</productname>
45070 <date>July 2017</date>
45071</refentryinfo>
45072<refmeta>
45073 <refentrytitle><phrase>intel_guc_suspend</phrase></refentrytitle>
45074 <manvolnum>9</manvolnum>
45075 <refmiscinfo class="version">4.4.14</refmiscinfo>
45076</refmeta>
45077<refnamediv>
45078 <refname>intel_guc_suspend</refname>
45079 <refpurpose>
45080     notify GuC entering suspend state
45081 </refpurpose>
45082</refnamediv>
45083<refsynopsisdiv>
45084 <title>Synopsis</title>
45085  <funcsynopsis><funcprototype>
45086   <funcdef>int <function>intel_guc_suspend </function></funcdef>
45087   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
45088  </funcprototype></funcsynopsis>
45089</refsynopsisdiv>
45090<refsect1>
45091 <title>Arguments</title>
45092 <variablelist>
45093  <varlistentry>
45094   <term><parameter>dev</parameter></term>
45095   <listitem>
45096    <para>
45097     drm device
45098    </para>
45099   </listitem>
45100  </varlistentry>
45101 </variablelist>
45102</refsect1>
45103</refentry>
45104
45105<refentry id="API-intel-guc-resume">
45106<refentryinfo>
45107 <title>LINUX</title>
45108 <productname>Kernel Hackers Manual</productname>
45109 <date>July 2017</date>
45110</refentryinfo>
45111<refmeta>
45112 <refentrytitle><phrase>intel_guc_resume</phrase></refentrytitle>
45113 <manvolnum>9</manvolnum>
45114 <refmiscinfo class="version">4.4.14</refmiscinfo>
45115</refmeta>
45116<refnamediv>
45117 <refname>intel_guc_resume</refname>
45118 <refpurpose>
45119     notify GuC resuming from suspend state
45120 </refpurpose>
45121</refnamediv>
45122<refsynopsisdiv>
45123 <title>Synopsis</title>
45124  <funcsynopsis><funcprototype>
45125   <funcdef>int <function>intel_guc_resume </function></funcdef>
45126   <paramdef>struct drm_device * <parameter>dev</parameter></paramdef>
45127  </funcprototype></funcsynopsis>
45128</refsynopsisdiv>
45129<refsect1>
45130 <title>Arguments</title>
45131 <variablelist>
45132  <varlistentry>
45133   <term><parameter>dev</parameter></term>
45134   <listitem>
45135    <para>
45136     drm device
45137    </para>
45138   </listitem>
45139  </varlistentry>
45140 </variablelist>
45141</refsect1>
45142</refentry>
45143
45144      </sect2>
45145    </sect1>
45146
45147    <sect1>
45148      <title> Tracing </title>
45149      <para>
45150    This sections covers all things related to the tracepoints implemented in
45151    the i915 driver.
45152      </para>
45153      <sect2>
45154        <title> i915_ppgtt_create and i915_ppgtt_release </title>
45155<para>
45156   </para><para>
45157   With full ppgtt enabled each process using drm will allocate at least one
45158   translation table. With these traces it is possible to keep track of the
45159   allocation and of the lifetime of the tables; this can be used during
45160   testing/debug to verify that we are not leaking ppgtts.
45161   These traces identify the ppgtt through the vm pointer, which is also printed
45162   by the i915_vma_bind and i915_vma_unbind tracepoints.
45163</para>
45164
45165      </sect2>
45166      <sect2>
45167        <title> i915_context_create and i915_context_free </title>
45168<para>
45169   </para><para>
45170   These tracepoints are used to track creation and deletion of contexts.
45171   If full ppgtt is enabled, they also print the address of the vm assigned to
45172   the context.
45173</para>
45174
45175      </sect2>
45176      <sect2>
45177        <title> switch_mm </title>
45178<para>
45179   </para><para>
45180   This tracepoint allows tracking of the mm switch, which is an important point
45181   in the lifetime of the vm in the legacy submission path. This tracepoint is
45182   called only if full ppgtt is enabled.
45183</para>
45184
45185      </sect2>
45186    </sect1>
45187
45188  </chapter>
45189</part>
45190
45191<part id="vga_switcheroo">
45192  <title>vga_switcheroo</title>
45193  <partintro>
45194<para>
45195   </para><para>
45196   vga_switcheroo is the Linux subsystem for laptop hybrid graphics.
45197   These come in two flavors:
45198   </para><para>
45199   * muxed: Dual GPUs with a multiplexer chip to switch outputs between GPUs.
45200   * muxless: Dual GPUs but only one of them is connected to outputs.
45201   The other one is merely used to offload rendering, its results
45202   are copied over PCIe into the framebuffer. On Linux this is
45203   supported with DRI PRIME.
45204   </para><para>
45205   Hybrid graphics started to appear in the late Naughties and were initially
45206   all muxed. Newer laptops moved to a muxless architecture for cost reasons.
45207   A notable exception is the MacBook Pro which continues to use a mux.
45208   Muxes come with varying capabilities: Some switch only the panel, others
45209   can also switch external displays. Some switch all display pins at once
45210   while others can switch just the DDC lines. (To allow EDID probing
45211   for the inactive GPU.) Also, muxes are often used to cut power to the
45212   discrete GPU while it is not used.
45213   </para><para>
45214   DRM drivers register GPUs with vga_switcheroo, these are heretoforth called
45215   clients. The mux is called the handler. Muxless machines also register a
45216   handler to control the power state of the discrete GPU, its -&gt;switchto
45217   callback is a no-op for obvious reasons. The discrete GPU is often equipped
45218   with an HDA controller for the HDMI/DP audio signal, this will also
45219   register as a client so that vga_switcheroo can take care of the correct
45220   suspend/resume order when changing the discrete GPU's power state. In total
45221   there can thus be up to three clients: Two vga clients (GPUs) and one audio
45222   client (on the discrete GPU). The code is mostly prepared to support
45223   machines with more than two GPUs should they become available.
45224   The GPU to which the outputs are currently switched is called the
45225   active client in vga_switcheroo parlance. The GPU not in use is the
45226   inactive client.
45227</para>
45228
45229  </partintro>
45230
45231  <chapter id="modes_of_use">
45232    <title>Modes of Use</title>
45233  <sect1>
45234    <title>Manual switching and manual power control</title>
45235<para>
45236   </para><para>
45237   In this mode of use, the file /sys/kernel/debug/vgaswitcheroo/switch
45238   can be read to retrieve the current vga_switcheroo state and commands
45239   can be written to it to change the state. The file appears as soon as
45240   two GPU drivers and one handler have registered with vga_switcheroo.
45241   The following commands are understood:
45242   </para><para>
45243   * OFF: Power off the device not in use.
45244   * ON: Power on the device not in use.
45245   * IGD: Switch to the integrated graphics device.
45246   Power on the integrated GPU if necessary, power off the discrete GPU.
45247   Prerequisite is that no user space processes (e.g. Xorg, alsactl)
45248   have opened device files of the GPUs or the audio client. If the
45249   switch fails, the user may invoke lsof(8) or fuser(1) on /dev/dri/
45250   and /dev/snd/controlC1 to identify processes blocking the switch.
45251   * DIS: Switch to the discrete graphics device.
45252   * DIGD: Delayed switch to the integrated graphics device.
45253   This will perform the switch once the last user space process has
45254   closed the device files of the GPUs and the audio client.
45255   * DDIS: Delayed switch to the discrete graphics device.
45256   * MIGD: Mux-only switch to the integrated graphics device.
45257   Does not remap console or change the power state of either gpu.
45258   If the integrated GPU is currently off, the screen will turn black.
45259   If it is on, the screen will show whatever happens to be in VRAM.
45260   Either way, the user has to blindly enter the command to switch back.
45261   * MDIS: Mux-only switch to the discrete graphics device.
45262   </para><para>
45263   For GPUs whose power state is controlled by the driver's runtime pm,
45264   the ON and OFF commands are a no-op (see next section).
45265   </para><para>
45266   For muxless machines, the IGD/DIS, DIGD/DDIS and MIGD/MDIS commands
45267   should not be used.
45268</para>
45269
45270  </sect1>
45271  <sect1>
45272    <title>Driver power control</title>
45273<para>
45274   </para><para>
45275   In this mode of use, the discrete GPU automatically powers up and down at
45276   the discretion of the driver's runtime pm. On muxed machines, the user may
45277   still influence the muxer state by way of the debugfs interface, however
45278   the ON and OFF commands become a no-op for the discrete GPU.
45279   </para><para>
45280   This mode is the default on Nvidia HybridPower/Optimus and ATI PowerXpress.
45281   Specifying nouveau.runpm=0, radeon.runpm=0 or amdgpu.runpm=0 on the kernel
45282   command line disables it.
45283   </para><para>
45284   When the driver decides to power up or down, it notifies vga_switcheroo
45285   thereof so that it can (a) power the audio device on the GPU up or down,
45286   and (b) update its internal power state representation for the device.
45287   This is achieved by <function>vga_switcheroo_set_dynamic_switch</function>.
45288   </para><para>
45289   After the GPU has been suspended, the handler needs to be called to cut
45290   power to the GPU. Likewise it needs to reinstate power before the GPU
45291   can resume. This is achieved by <function>vga_switcheroo_init_domain_pm_ops</function>,
45292   which augments the GPU's suspend/resume functions by the requisite
45293   calls to the handler.
45294   </para><para>
45295   When the audio device resumes, the GPU needs to be woken. This is achieved
45296   by <function>vga_switcheroo_init_domain_pm_optimus_hdmi_audio</function>, which augments the
45297   audio device's resume function.
45298   </para><para>
45299   On muxed machines, if the mux is initially switched to the discrete GPU,
45300   the user ends up with a black screen when the GPU powers down after boot.
45301   As a workaround, the mux is forced to the integrated GPU on runtime suspend,
45302   cf. https://bugs.freedesktop.org/show_bug.cgi?id=75917
45303</para>
45304
45305  </sect1>
45306  </chapter>
45307
45308  <chapter id="pubfunctions">
45309    <title>Public functions</title>
45310<!-- drivers/gpu/vga/vga_switcheroo.c -->
45311<refentry id="API-vga-switcheroo-register-handler">
45312<refentryinfo>
45313 <title>LINUX</title>
45314 <productname>Kernel Hackers Manual</productname>
45315 <date>July 2017</date>
45316</refentryinfo>
45317<refmeta>
45318 <refentrytitle><phrase>vga_switcheroo_register_handler</phrase></refentrytitle>
45319 <manvolnum>9</manvolnum>
45320 <refmiscinfo class="version">4.4.14</refmiscinfo>
45321</refmeta>
45322<refnamediv>
45323 <refname>vga_switcheroo_register_handler</refname>
45324 <refpurpose>
45325  register handler
45326 </refpurpose>
45327</refnamediv>
45328<refsynopsisdiv>
45329 <title>Synopsis</title>
45330  <funcsynopsis><funcprototype>
45331   <funcdef>int <function>vga_switcheroo_register_handler </function></funcdef>
45332   <paramdef>const struct vga_switcheroo_handler * <parameter>handler</parameter></paramdef>
45333  </funcprototype></funcsynopsis>
45334</refsynopsisdiv>
45335<refsect1>
45336 <title>Arguments</title>
45337 <variablelist>
45338  <varlistentry>
45339   <term><parameter>handler</parameter></term>
45340   <listitem>
45341    <para>
45342     handler callbacks
45343    </para>
45344   </listitem>
45345  </varlistentry>
45346 </variablelist>
45347</refsect1>
45348<refsect1>
45349<title>Description</title>
45350<para>
45351   Register handler. Enable vga_switcheroo if two vga clients have already
45352   registered.
45353</para>
45354</refsect1>
45355<refsect1>
45356<title>Return</title>
45357<para>
45358   0 on success, -EINVAL if a handler was already registered.
45359</para>
45360</refsect1>
45361</refentry>
45362
45363<refentry id="API-vga-switcheroo-unregister-handler">
45364<refentryinfo>
45365 <title>LINUX</title>
45366 <productname>Kernel Hackers Manual</productname>
45367 <date>July 2017</date>
45368</refentryinfo>
45369<refmeta>
45370 <refentrytitle><phrase>vga_switcheroo_unregister_handler</phrase></refentrytitle>
45371 <manvolnum>9</manvolnum>
45372 <refmiscinfo class="version">4.4.14</refmiscinfo>
45373</refmeta>
45374<refnamediv>
45375 <refname>vga_switcheroo_unregister_handler</refname>
45376 <refpurpose>
45377     unregister handler
45378 </refpurpose>
45379</refnamediv>
45380<refsynopsisdiv>
45381 <title>Synopsis</title>
45382  <funcsynopsis><funcprototype>
45383   <funcdef>void <function>vga_switcheroo_unregister_handler </function></funcdef>
45384   <paramdef> <parameter>void</parameter></paramdef>
45385  </funcprototype></funcsynopsis>
45386</refsynopsisdiv>
45387<refsect1>
45388 <title>Arguments</title>
45389 <variablelist>
45390  <varlistentry>
45391   <term><parameter>void</parameter></term>
45392   <listitem>
45393    <para>
45394     no arguments
45395    </para>
45396   </listitem>
45397  </varlistentry>
45398 </variablelist>
45399</refsect1>
45400<refsect1>
45401<title>Description</title>
45402<para>
45403   </para><para>
45404
45405   Unregister handler. Disable vga_switcheroo.
45406</para>
45407</refsect1>
45408</refentry>
45409
45410<refentry id="API-vga-switcheroo-register-client">
45411<refentryinfo>
45412 <title>LINUX</title>
45413 <productname>Kernel Hackers Manual</productname>
45414 <date>July 2017</date>
45415</refentryinfo>
45416<refmeta>
45417 <refentrytitle><phrase>vga_switcheroo_register_client</phrase></refentrytitle>
45418 <manvolnum>9</manvolnum>
45419 <refmiscinfo class="version">4.4.14</refmiscinfo>
45420</refmeta>
45421<refnamediv>
45422 <refname>vga_switcheroo_register_client</refname>
45423 <refpurpose>
45424     register vga client
45425 </refpurpose>
45426</refnamediv>
45427<refsynopsisdiv>
45428 <title>Synopsis</title>
45429  <funcsynopsis><funcprototype>
45430   <funcdef>int <function>vga_switcheroo_register_client </function></funcdef>
45431   <paramdef>struct pci_dev * <parameter>pdev</parameter></paramdef>
45432   <paramdef>const struct vga_switcheroo_client_ops * <parameter>ops</parameter></paramdef>
45433   <paramdef>bool <parameter>driver_power_control</parameter></paramdef>
45434  </funcprototype></funcsynopsis>
45435</refsynopsisdiv>
45436<refsect1>
45437 <title>Arguments</title>
45438 <variablelist>
45439  <varlistentry>
45440   <term><parameter>pdev</parameter></term>
45441   <listitem>
45442    <para>
45443     client pci device
45444    </para>
45445   </listitem>
45446  </varlistentry>
45447  <varlistentry>
45448   <term><parameter>ops</parameter></term>
45449   <listitem>
45450    <para>
45451     client callbacks
45452    </para>
45453   </listitem>
45454  </varlistentry>
45455  <varlistentry>
45456   <term><parameter>driver_power_control</parameter></term>
45457   <listitem>
45458    <para>
45459     whether power state is controlled by the driver's
45460     runtime pm
45461    </para>
45462   </listitem>
45463  </varlistentry>
45464 </variablelist>
45465</refsect1>
45466<refsect1>
45467<title>Description</title>
45468<para>
45469   Register vga client (GPU). Enable vga_switcheroo if another GPU and a
45470   handler have already registered. The power state of the client is assumed
45471   to be ON.
45472</para>
45473</refsect1>
45474<refsect1>
45475<title>Return</title>
45476<para>
45477   0 on success, -ENOMEM on memory allocation error.
45478</para>
45479</refsect1>
45480</refentry>
45481
45482<refentry id="API-vga-switcheroo-register-audio-client">
45483<refentryinfo>
45484 <title>LINUX</title>
45485 <productname>Kernel Hackers Manual</productname>
45486 <date>July 2017</date>
45487</refentryinfo>
45488<refmeta>
45489 <refentrytitle><phrase>vga_switcheroo_register_audio_client</phrase></refentrytitle>
45490 <manvolnum>9</manvolnum>
45491 <refmiscinfo class="version">4.4.14</refmiscinfo>
45492</refmeta>
45493<refnamediv>
45494 <refname>vga_switcheroo_register_audio_client</refname>
45495 <refpurpose>
45496     register audio client
45497 </refpurpose>
45498</refnamediv>
45499<refsynopsisdiv>
45500 <title>Synopsis</title>
45501  <funcsynopsis><funcprototype>
45502   <funcdef>int <function>vga_switcheroo_register_audio_client </function></funcdef>
45503   <paramdef>struct pci_dev * <parameter>pdev</parameter></paramdef>
45504   <paramdef>const struct vga_switcheroo_client_ops * <parameter>ops</parameter></paramdef>
45505   <paramdef>enum vga_switcheroo_client_id <parameter>id</parameter></paramdef>
45506  </funcprototype></funcsynopsis>
45507</refsynopsisdiv>
45508<refsect1>
45509 <title>Arguments</title>
45510 <variablelist>
45511  <varlistentry>
45512   <term><parameter>pdev</parameter></term>
45513   <listitem>
45514    <para>
45515     client pci device
45516    </para>
45517   </listitem>
45518  </varlistentry>
45519  <varlistentry>
45520   <term><parameter>ops</parameter></term>
45521   <listitem>
45522    <para>
45523     client callbacks
45524    </para>
45525   </listitem>
45526  </varlistentry>
45527  <varlistentry>
45528   <term><parameter>id</parameter></term>
45529   <listitem>
45530    <para>
45531     client identifier
45532    </para>
45533   </listitem>
45534  </varlistentry>
45535 </variablelist>
45536</refsect1>
45537<refsect1>
45538<title>Description</title>
45539<para>
45540   Register audio client (audio device on a GPU). The power state of the
45541   client is assumed to be ON.
45542</para>
45543</refsect1>
45544<refsect1>
45545<title>Return</title>
45546<para>
45547   0 on success, -ENOMEM on memory allocation error.
45548</para>
45549</refsect1>
45550</refentry>
45551
45552<refentry id="API-vga-switcheroo-get-client-state">
45553<refentryinfo>
45554 <title>LINUX</title>
45555 <productname>Kernel Hackers Manual</productname>
45556 <date>July 2017</date>
45557</refentryinfo>
45558<refmeta>
45559 <refentrytitle><phrase>vga_switcheroo_get_client_state</phrase></refentrytitle>
45560 <manvolnum>9</manvolnum>
45561 <refmiscinfo class="version">4.4.14</refmiscinfo>
45562</refmeta>
45563<refnamediv>
45564 <refname>vga_switcheroo_get_client_state</refname>
45565 <refpurpose>
45566     obtain power state of a given client
45567 </refpurpose>
45568</refnamediv>
45569<refsynopsisdiv>
45570 <title>Synopsis</title>
45571  <funcsynopsis><funcprototype>
45572   <funcdef>enum vga_switcheroo_state <function>vga_switcheroo_get_client_state </function></funcdef>
45573   <paramdef>struct pci_dev * <parameter>pdev</parameter></paramdef>
45574  </funcprototype></funcsynopsis>
45575</refsynopsisdiv>
45576<refsect1>
45577 <title>Arguments</title>
45578 <variablelist>
45579  <varlistentry>
45580   <term><parameter>pdev</parameter></term>
45581   <listitem>
45582    <para>
45583     client pci device
45584    </para>
45585   </listitem>
45586  </varlistentry>
45587 </variablelist>
45588</refsect1>
45589<refsect1>
45590<title>Description</title>
45591<para>
45592   Obtain power state of a given client as seen from vga_switcheroo.
45593   The function is only called from hda_intel.c.
45594</para>
45595</refsect1>
45596<refsect1>
45597<title>Return</title>
45598<para>
45599   Power state.
45600</para>
45601</refsect1>
45602</refentry>
45603
45604<refentry id="API-vga-switcheroo-unregister-client">
45605<refentryinfo>
45606 <title>LINUX</title>
45607 <productname>Kernel Hackers Manual</productname>
45608 <date>July 2017</date>
45609</refentryinfo>
45610<refmeta>
45611 <refentrytitle><phrase>vga_switcheroo_unregister_client</phrase></refentrytitle>
45612 <manvolnum>9</manvolnum>
45613 <refmiscinfo class="version">4.4.14</refmiscinfo>
45614</refmeta>
45615<refnamediv>
45616 <refname>vga_switcheroo_unregister_client</refname>
45617 <refpurpose>
45618     unregister client
45619 </refpurpose>
45620</refnamediv>
45621<refsynopsisdiv>
45622 <title>Synopsis</title>
45623  <funcsynopsis><funcprototype>
45624   <funcdef>void <function>vga_switcheroo_unregister_client </function></funcdef>
45625   <paramdef>struct pci_dev * <parameter>pdev</parameter></paramdef>
45626  </funcprototype></funcsynopsis>
45627</refsynopsisdiv>
45628<refsect1>
45629 <title>Arguments</title>
45630 <variablelist>
45631  <varlistentry>
45632   <term><parameter>pdev</parameter></term>
45633   <listitem>
45634    <para>
45635     client pci device
45636    </para>
45637   </listitem>
45638  </varlistentry>
45639 </variablelist>
45640</refsect1>
45641<refsect1>
45642<title>Description</title>
45643<para>
45644   Unregister client. Disable vga_switcheroo if this is a vga client (GPU).
45645</para>
45646</refsect1>
45647</refentry>
45648
45649<refentry id="API-vga-switcheroo-client-fb-set">
45650<refentryinfo>
45651 <title>LINUX</title>
45652 <productname>Kernel Hackers Manual</productname>
45653 <date>July 2017</date>
45654</refentryinfo>
45655<refmeta>
45656 <refentrytitle><phrase>vga_switcheroo_client_fb_set</phrase></refentrytitle>
45657 <manvolnum>9</manvolnum>
45658 <refmiscinfo class="version">4.4.14</refmiscinfo>
45659</refmeta>
45660<refnamediv>
45661 <refname>vga_switcheroo_client_fb_set</refname>
45662 <refpurpose>
45663     set framebuffer of a given client
45664 </refpurpose>
45665</refnamediv>
45666<refsynopsisdiv>
45667 <title>Synopsis</title>
45668  <funcsynopsis><funcprototype>
45669   <funcdef>void <function>vga_switcheroo_client_fb_set </function></funcdef>
45670   <paramdef>struct pci_dev * <parameter>pdev</parameter></paramdef>
45671   <paramdef>struct fb_info * <parameter>info</parameter></paramdef>
45672  </funcprototype></funcsynopsis>
45673</refsynopsisdiv>
45674<refsect1>
45675 <title>Arguments</title>
45676 <variablelist>
45677  <varlistentry>
45678   <term><parameter>pdev</parameter></term>
45679   <listitem>
45680    <para>
45681     client pci device
45682    </para>
45683   </listitem>
45684  </varlistentry>
45685  <varlistentry>
45686   <term><parameter>info</parameter></term>
45687   <listitem>
45688    <para>
45689     framebuffer
45690    </para>
45691   </listitem>
45692  </varlistentry>
45693 </variablelist>
45694</refsect1>
45695<refsect1>
45696<title>Description</title>
45697<para>
45698   Set framebuffer of a given client. The console will be remapped to this
45699   on switching.
45700</para>
45701</refsect1>
45702</refentry>
45703
45704<refentry id="API-vga-switcheroo-process-delayed-switch">
45705<refentryinfo>
45706 <title>LINUX</title>
45707 <productname>Kernel Hackers Manual</productname>
45708 <date>July 2017</date>
45709</refentryinfo>
45710<refmeta>
45711 <refentrytitle><phrase>vga_switcheroo_process_delayed_switch</phrase></refentrytitle>
45712 <manvolnum>9</manvolnum>
45713 <refmiscinfo class="version">4.4.14</refmiscinfo>
45714</refmeta>
45715<refnamediv>
45716 <refname>vga_switcheroo_process_delayed_switch</refname>
45717 <refpurpose>
45718     helper for delayed switching
45719 </refpurpose>
45720</refnamediv>
45721<refsynopsisdiv>
45722 <title>Synopsis</title>
45723  <funcsynopsis><funcprototype>
45724   <funcdef>int <function>vga_switcheroo_process_delayed_switch </function></funcdef>
45725   <paramdef> <parameter>void</parameter></paramdef>
45726  </funcprototype></funcsynopsis>
45727</refsynopsisdiv>
45728<refsect1>
45729 <title>Arguments</title>
45730 <variablelist>
45731  <varlistentry>
45732   <term><parameter>void</parameter></term>
45733   <listitem>
45734    <para>
45735     no arguments
45736    </para>
45737   </listitem>
45738  </varlistentry>
45739 </variablelist>
45740</refsect1>
45741<refsect1>
45742<title>Manual switching and manual power control</title>
45743<para>
45744   </para><para>
45745
45746   Process a delayed switch if one is pending. DRM drivers should call this
45747   from their -&gt;lastclose callback.
45748</para>
45749</refsect1>
45750<refsect1>
45751<title>Return</title>
45752<para>
45753   0 on success. -EINVAL if no delayed switch is pending, if the client
45754   has unregistered in the meantime or if there are other clients blocking the
45755   switch. If the actual switch fails, an error is reported and 0 is returned.
45756</para>
45757</refsect1>
45758</refentry>
45759
45760<refentry id="API-vga-switcheroo-set-dynamic-switch">
45761<refentryinfo>
45762 <title>LINUX</title>
45763 <productname>Kernel Hackers Manual</productname>
45764 <date>July 2017</date>
45765</refentryinfo>
45766<refmeta>
45767 <refentrytitle><phrase>vga_switcheroo_set_dynamic_switch</phrase></refentrytitle>
45768 <manvolnum>9</manvolnum>
45769 <refmiscinfo class="version">4.4.14</refmiscinfo>
45770</refmeta>
45771<refnamediv>
45772 <refname>vga_switcheroo_set_dynamic_switch</refname>
45773 <refpurpose>
45774     helper for driver power control
45775 </refpurpose>
45776</refnamediv>
45777<refsynopsisdiv>
45778 <title>Synopsis</title>
45779  <funcsynopsis><funcprototype>
45780   <funcdef>void <function>vga_switcheroo_set_dynamic_switch </function></funcdef>
45781   <paramdef>struct pci_dev * <parameter>pdev</parameter></paramdef>
45782   <paramdef>enum vga_switcheroo_state <parameter>dynamic</parameter></paramdef>
45783  </funcprototype></funcsynopsis>
45784</refsynopsisdiv>
45785<refsect1>
45786 <title>Arguments</title>
45787 <variablelist>
45788  <varlistentry>
45789   <term><parameter>pdev</parameter></term>
45790   <listitem>
45791    <para>
45792     client pci device
45793    </para>
45794   </listitem>
45795  </varlistentry>
45796  <varlistentry>
45797   <term><parameter>dynamic</parameter></term>
45798   <listitem>
45799    <para>
45800     new power state
45801    </para>
45802   </listitem>
45803  </varlistentry>
45804 </variablelist>
45805</refsect1>
45806<refsect1>
45807<title>Description</title>
45808<para>
45809   Helper for GPUs whose power state is controlled by the driver's runtime pm.
45810   When the driver decides to power up or down, it notifies vga_switcheroo
45811   thereof using this helper so that it can (a) power the audio device on
45812   the GPU up or down, and (b) update its internal power state representation
45813   for the device.
45814</para>
45815</refsect1>
45816</refentry>
45817
45818<refentry id="API-vga-switcheroo-init-domain-pm-ops">
45819<refentryinfo>
45820 <title>LINUX</title>
45821 <productname>Kernel Hackers Manual</productname>
45822 <date>July 2017</date>
45823</refentryinfo>
45824<refmeta>
45825 <refentrytitle><phrase>vga_switcheroo_init_domain_pm_ops</phrase></refentrytitle>
45826 <manvolnum>9</manvolnum>
45827 <refmiscinfo class="version">4.4.14</refmiscinfo>
45828</refmeta>
45829<refnamediv>
45830 <refname>vga_switcheroo_init_domain_pm_ops</refname>
45831 <refpurpose>
45832     helper for driver power control
45833 </refpurpose>
45834</refnamediv>
45835<refsynopsisdiv>
45836 <title>Synopsis</title>
45837  <funcsynopsis><funcprototype>
45838   <funcdef>int <function>vga_switcheroo_init_domain_pm_ops </function></funcdef>
45839   <paramdef>struct device * <parameter>dev</parameter></paramdef>
45840   <paramdef>struct dev_pm_domain * <parameter>domain</parameter></paramdef>
45841  </funcprototype></funcsynopsis>
45842</refsynopsisdiv>
45843<refsect1>
45844 <title>Arguments</title>
45845 <variablelist>
45846  <varlistentry>
45847   <term><parameter>dev</parameter></term>
45848   <listitem>
45849    <para>
45850     vga client device
45851    </para>
45852   </listitem>
45853  </varlistentry>
45854  <varlistentry>
45855   <term><parameter>domain</parameter></term>
45856   <listitem>
45857    <para>
45858     power domain
45859    </para>
45860   </listitem>
45861  </varlistentry>
45862 </variablelist>
45863</refsect1>
45864<refsect1>
45865<title>Description</title>
45866<para>
45867   Helper for GPUs whose power state is controlled by the driver's runtime pm.
45868   After the GPU has been suspended, the handler needs to be called to cut
45869   power to the GPU. Likewise it needs to reinstate power before the GPU
45870   can resume. To this end, this helper augments the suspend/resume functions
45871   by the requisite calls to the handler. It needs only be called on platforms
45872   where the power switch is separate to the device being powered down.
45873</para>
45874</refsect1>
45875</refentry>
45876
45877<refentry id="API-vga-switcheroo-init-domain-pm-optimus-hdmi-audio">
45878<refentryinfo>
45879 <title>LINUX</title>
45880 <productname>Kernel Hackers Manual</productname>
45881 <date>July 2017</date>
45882</refentryinfo>
45883<refmeta>
45884 <refentrytitle><phrase>vga_switcheroo_init_domain_pm_optimus_hdmi_audio</phrase></refentrytitle>
45885 <manvolnum>9</manvolnum>
45886 <refmiscinfo class="version">4.4.14</refmiscinfo>
45887</refmeta>
45888<refnamediv>
45889 <refname>vga_switcheroo_init_domain_pm_optimus_hdmi_audio</refname>
45890 <refpurpose>
45891     helper for driver power control
45892 </refpurpose>
45893</refnamediv>
45894<refsynopsisdiv>
45895 <title>Synopsis</title>
45896  <funcsynopsis><funcprototype>
45897   <funcdef>int <function>vga_switcheroo_init_domain_pm_optimus_hdmi_audio </function></funcdef>
45898   <paramdef>struct device * <parameter>dev</parameter></paramdef>
45899   <paramdef>struct dev_pm_domain * <parameter>domain</parameter></paramdef>
45900  </funcprototype></funcsynopsis>
45901</refsynopsisdiv>
45902<refsect1>
45903 <title>Arguments</title>
45904 <variablelist>
45905  <varlistentry>
45906   <term><parameter>dev</parameter></term>
45907   <listitem>
45908    <para>
45909     audio client device
45910    </para>
45911   </listitem>
45912  </varlistentry>
45913  <varlistentry>
45914   <term><parameter>domain</parameter></term>
45915   <listitem>
45916    <para>
45917     power domain
45918    </para>
45919   </listitem>
45920  </varlistentry>
45921 </variablelist>
45922</refsect1>
45923<refsect1>
45924<title>Description</title>
45925<para>
45926   Helper for GPUs whose power state is controlled by the driver's runtime pm.
45927   When the audio device resumes, the GPU needs to be woken. This helper
45928   augments the audio device's resume function to do that.
45929</para>
45930</refsect1>
45931<refsect1>
45932<title>Return</title>
45933<para>
45934   0 on success, -EINVAL if no power management operations are
45935   defined for this device.
45936</para>
45937</refsect1>
45938</refentry>
45939
45940  </chapter>
45941
45942  <chapter id="pubstructures">
45943    <title>Public structures</title>
45944<refentry id="API-struct-vga-switcheroo-handler">
45945<refentryinfo>
45946 <title>LINUX</title>
45947 <productname>Kernel Hackers Manual</productname>
45948 <date>July 2017</date>
45949</refentryinfo>
45950<refmeta>
45951 <refentrytitle><phrase>struct vga_switcheroo_handler</phrase></refentrytitle>
45952 <manvolnum>9</manvolnum>
45953 <refmiscinfo class="version">4.4.14</refmiscinfo>
45954</refmeta>
45955<refnamediv>
45956 <refname>struct vga_switcheroo_handler</refname>
45957 <refpurpose>
45958  handler callbacks
45959 </refpurpose>
45960</refnamediv>
45961<refsynopsisdiv>
45962 <title>Synopsis</title>
45963  <programlisting>
45964struct vga_switcheroo_handler {
45965  int (* init) (void);
45966  int (* switchto) (enum vga_switcheroo_client_id id);
45967  int (* power_state) (enum vga_switcheroo_client_id id,enum vga_switcheroo_state state);
45968  enum vga_switcheroo_client_id (* get_client_id) (struct pci_dev *pdev);
45969};  </programlisting>
45970</refsynopsisdiv>
45971 <refsect1>
45972  <title>Members</title>
45973  <variablelist>
45974    <varlistentry>      <term>init</term>
45975      <listitem><para>
45976initialize handler.
45977Optional. This gets called when vga_switcheroo is enabled, i.e. when
45978two vga clients have registered. It allows the handler to perform
45979some delayed initialization that depends on the existence of the
45980vga clients. Currently only the radeon and amdgpu drivers use this.
45981The return value is ignored
45982      </para></listitem>
45983    </varlistentry>
45984    <varlistentry>      <term>switchto</term>
45985      <listitem><para>
45986switch outputs to given client.
45987Mandatory. For muxless machines this should be a no-op. Returning 0
45988denotes success, anything else failure (in which case the switch is
45989aborted)
45990      </para></listitem>
45991    </varlistentry>
45992    <varlistentry>      <term>power_state</term>
45993      <listitem><para>
45994cut or reinstate power of given client.
45995Optional. The return value is ignored
45996      </para></listitem>
45997    </varlistentry>
45998    <varlistentry>      <term>get_client_id</term>
45999      <listitem><para>
46000determine if given pci device is integrated or discrete GPU.
46001Mandatory
46002      </para></listitem>
46003    </varlistentry>
46004  </variablelist>
46005 </refsect1>
46006<refsect1>
46007<title>Description</title>
46008<para>
46009   Handler callbacks. The multiplexer itself. The <parameter>switchto</parameter> and <parameter>get_client_id</parameter>
46010   methods are mandatory, all others may be set to NULL.
46011</para>
46012</refsect1>
46013</refentry>
46014
46015<refentry id="API-struct-vga-switcheroo-client-ops">
46016<refentryinfo>
46017 <title>LINUX</title>
46018 <productname>Kernel Hackers Manual</productname>
46019 <date>July 2017</date>
46020</refentryinfo>
46021<refmeta>
46022 <refentrytitle><phrase>struct vga_switcheroo_client_ops</phrase></refentrytitle>
46023 <manvolnum>9</manvolnum>
46024 <refmiscinfo class="version">4.4.14</refmiscinfo>
46025</refmeta>
46026<refnamediv>
46027 <refname>struct vga_switcheroo_client_ops</refname>
46028 <refpurpose>
46029  client callbacks
46030 </refpurpose>
46031</refnamediv>
46032<refsynopsisdiv>
46033 <title>Synopsis</title>
46034  <programlisting>
46035struct vga_switcheroo_client_ops {
46036  void (* set_gpu_state) (struct pci_dev *dev, enum vga_switcheroo_state);
46037  void (* reprobe) (struct pci_dev *dev);
46038  bool (* can_switch) (struct pci_dev *dev);
46039};  </programlisting>
46040</refsynopsisdiv>
46041 <refsect1>
46042  <title>Members</title>
46043  <variablelist>
46044    <varlistentry>      <term>set_gpu_state</term>
46045      <listitem><para>
46046do the equivalent of suspend/resume for the card.
46047Mandatory. This should not cut power to the discrete GPU,
46048which is the job of the handler
46049      </para></listitem>
46050    </varlistentry>
46051    <varlistentry>      <term>reprobe</term>
46052      <listitem><para>
46053poll outputs.
46054Optional. This gets called after waking the GPU and switching
46055the outputs to it
46056      </para></listitem>
46057    </varlistentry>
46058    <varlistentry>      <term>can_switch</term>
46059      <listitem><para>
46060check if the device is in a position to switch now.
46061Mandatory. The client should return false if a user space process
46062has one of its device files open
46063      </para></listitem>
46064    </varlistentry>
46065  </variablelist>
46066 </refsect1>
46067<refsect1>
46068<title>Description</title>
46069<para>
46070   Client callbacks. A client can be either a GPU or an audio device on a GPU.
46071   The <parameter>set_gpu_state</parameter> and <parameter>can_switch</parameter> methods are mandatory, <parameter>reprobe</parameter> may be
46072   set to NULL. For audio clients, the <parameter>reprobe</parameter> member is bogus.
46073</para>
46074</refsect1>
46075</refentry>
46076
46077  </chapter>
46078
46079  <chapter id="pubconstants">
46080    <title>Public constants</title>
46081<refentry id="API-enum-vga-switcheroo-client-id">
46082<refentryinfo>
46083 <title>LINUX</title>
46084 <productname>Kernel Hackers Manual</productname>
46085 <date>July 2017</date>
46086</refentryinfo>
46087<refmeta>
46088 <refentrytitle><phrase>enum vga_switcheroo_client_id</phrase></refentrytitle>
46089 <manvolnum>9</manvolnum>
46090 <refmiscinfo class="version">4.4.14</refmiscinfo>
46091</refmeta>
46092<refnamediv>
46093 <refname>enum vga_switcheroo_client_id</refname>
46094 <refpurpose>
46095  client identifier
46096 </refpurpose>
46097</refnamediv>
46098<refsynopsisdiv>
46099 <title>Synopsis</title>
46100  <programlisting>
46101enum vga_switcheroo_client_id {
46102  VGA_SWITCHEROO_UNKNOWN_ID,
46103  VGA_SWITCHEROO_IGD,
46104  VGA_SWITCHEROO_DIS,
46105  VGA_SWITCHEROO_MAX_CLIENTS
46106};  </programlisting>
46107</refsynopsisdiv>
46108<refsect1>
46109 <title>Constants</title>
46110  <variablelist>
46111    <varlistentry>      <term>VGA_SWITCHEROO_UNKNOWN_ID</term>
46112      <listitem><para>
46113initial identifier assigned to vga clients.
46114Determining the id requires the handler, so GPUs are given their
46115true id in a delayed fashion in <function>vga_switcheroo_enable</function>
46116      </para></listitem>
46117    </varlistentry>
46118    <varlistentry>      <term>VGA_SWITCHEROO_IGD</term>
46119      <listitem><para>
46120integrated graphics device
46121      </para></listitem>
46122    </varlistentry>
46123    <varlistentry>      <term>VGA_SWITCHEROO_DIS</term>
46124      <listitem><para>
46125discrete graphics device
46126      </para></listitem>
46127    </varlistentry>
46128    <varlistentry>      <term>VGA_SWITCHEROO_MAX_CLIENTS</term>
46129      <listitem><para>
46130currently no more than two GPUs are supported
46131      </para></listitem>
46132    </varlistentry>
46133  </variablelist>
46134</refsect1>
46135<refsect1>
46136<title>Description</title>
46137<para>
46138   Client identifier. Audio clients use the same identifier &amp; 0x100.
46139</para>
46140</refsect1>
46141</refentry>
46142
46143<refentry id="API-enum-vga-switcheroo-state">
46144<refentryinfo>
46145 <title>LINUX</title>
46146 <productname>Kernel Hackers Manual</productname>
46147 <date>July 2017</date>
46148</refentryinfo>
46149<refmeta>
46150 <refentrytitle><phrase>enum vga_switcheroo_state</phrase></refentrytitle>
46151 <manvolnum>9</manvolnum>
46152 <refmiscinfo class="version">4.4.14</refmiscinfo>
46153</refmeta>
46154<refnamediv>
46155 <refname>enum vga_switcheroo_state</refname>
46156 <refpurpose>
46157  client power state
46158 </refpurpose>
46159</refnamediv>
46160<refsynopsisdiv>
46161 <title>Synopsis</title>
46162  <programlisting>
46163enum vga_switcheroo_state {
46164  VGA_SWITCHEROO_OFF,
46165  VGA_SWITCHEROO_ON,
46166  VGA_SWITCHEROO_NOT_FOUND
46167};  </programlisting>
46168</refsynopsisdiv>
46169<refsect1>
46170 <title>Constants</title>
46171  <variablelist>
46172    <varlistentry>      <term>VGA_SWITCHEROO_OFF</term>
46173      <listitem><para>
46174off
46175      </para></listitem>
46176    </varlistentry>
46177    <varlistentry>      <term>VGA_SWITCHEROO_ON</term>
46178      <listitem><para>
46179on
46180      </para></listitem>
46181    </varlistentry>
46182    <varlistentry>      <term>VGA_SWITCHEROO_NOT_FOUND</term>
46183      <listitem><para>
46184client has not registered with vga_switcheroo.
46185Only used in <function>vga_switcheroo_get_client_state</function> which in turn is only
46186called from hda_intel.c
46187      </para></listitem>
46188    </varlistentry>
46189  </variablelist>
46190</refsect1>
46191<refsect1>
46192<title>Description</title>
46193<para>
46194   Client power state.
46195</para>
46196</refsect1>
46197</refentry>
46198
46199  </chapter>
46200
46201  <chapter id="privstructures">
46202    <title>Private structures</title>
46203<refentry id="API-struct-vgasr-priv">
46204<refentryinfo>
46205 <title>LINUX</title>
46206 <productname>Kernel Hackers Manual</productname>
46207 <date>July 2017</date>
46208</refentryinfo>
46209<refmeta>
46210 <refentrytitle><phrase>struct vgasr_priv</phrase></refentrytitle>
46211 <manvolnum>9</manvolnum>
46212 <refmiscinfo class="version">4.4.14</refmiscinfo>
46213</refmeta>
46214<refnamediv>
46215 <refname>struct vgasr_priv</refname>
46216 <refpurpose>
46217  vga_switcheroo private data
46218 </refpurpose>
46219</refnamediv>
46220<refsynopsisdiv>
46221 <title>Synopsis</title>
46222  <programlisting>
46223struct vgasr_priv {
46224  bool active;
46225  bool delayed_switch_active;
46226  enum vga_switcheroo_client_id delayed_client_id;
46227  struct dentry * debugfs_root;
46228  struct dentry * switch_file;
46229  int registered_clients;
46230  struct list_head clients;
46231  const struct vga_switcheroo_handler * handler;
46232};  </programlisting>
46233</refsynopsisdiv>
46234 <refsect1>
46235  <title>Members</title>
46236  <variablelist>
46237    <varlistentry>      <term>active</term>
46238      <listitem><para>
46239whether vga_switcheroo is enabled.
46240Prerequisite is the registration of two GPUs and a handler
46241      </para></listitem>
46242    </varlistentry>
46243    <varlistentry>      <term>delayed_switch_active</term>
46244      <listitem><para>
46245whether a delayed switch is pending
46246      </para></listitem>
46247    </varlistentry>
46248    <varlistentry>      <term>delayed_client_id</term>
46249      <listitem><para>
46250client to which a delayed switch is pending
46251      </para></listitem>
46252    </varlistentry>
46253    <varlistentry>      <term>debugfs_root</term>
46254      <listitem><para>
46255directory for vga_switcheroo debugfs interface
46256      </para></listitem>
46257    </varlistentry>
46258    <varlistentry>      <term>switch_file</term>
46259      <listitem><para>
46260file for vga_switcheroo debugfs interface
46261      </para></listitem>
46262    </varlistentry>
46263    <varlistentry>      <term>registered_clients</term>
46264      <listitem><para>
46265number of registered GPUs
46266(counting only vga clients, not audio clients)
46267      </para></listitem>
46268    </varlistentry>
46269    <varlistentry>      <term>clients</term>
46270      <listitem><para>
46271list of registered clients
46272      </para></listitem>
46273    </varlistentry>
46274    <varlistentry>      <term>handler</term>
46275      <listitem><para>
46276registered handler
46277      </para></listitem>
46278    </varlistentry>
46279  </variablelist>
46280 </refsect1>
46281<refsect1>
46282<title>Description</title>
46283<para>
46284   vga_switcheroo private data. Currently only one vga_switcheroo instance
46285   per system is supported.
46286</para>
46287</refsect1>
46288</refentry>
46289
46290<refentry id="API-struct-vga-switcheroo-client">
46291<refentryinfo>
46292 <title>LINUX</title>
46293 <productname>Kernel Hackers Manual</productname>
46294 <date>July 2017</date>
46295</refentryinfo>
46296<refmeta>
46297 <refentrytitle><phrase>struct vga_switcheroo_client</phrase></refentrytitle>
46298 <manvolnum>9</manvolnum>
46299 <refmiscinfo class="version">4.4.14</refmiscinfo>
46300</refmeta>
46301<refnamediv>
46302 <refname>struct vga_switcheroo_client</refname>
46303 <refpurpose>
46304  registered client
46305 </refpurpose>
46306</refnamediv>
46307<refsynopsisdiv>
46308 <title>Synopsis</title>
46309  <programlisting>
46310struct vga_switcheroo_client {
46311  struct pci_dev * pdev;
46312  struct fb_info * fb_info;
46313  enum vga_switcheroo_state pwr_state;
46314  const struct vga_switcheroo_client_ops * ops;
46315  enum vga_switcheroo_client_id id;
46316  bool active;
46317  bool driver_power_control;
46318  struct list_head list;
46319};  </programlisting>
46320</refsynopsisdiv>
46321 <refsect1>
46322  <title>Members</title>
46323  <variablelist>
46324    <varlistentry>      <term>pdev</term>
46325      <listitem><para>
46326client pci device
46327      </para></listitem>
46328    </varlistentry>
46329    <varlistentry>      <term>fb_info</term>
46330      <listitem><para>
46331framebuffer to which console is remapped on switching
46332      </para></listitem>
46333    </varlistentry>
46334    <varlistentry>      <term>pwr_state</term>
46335      <listitem><para>
46336current power state
46337      </para></listitem>
46338    </varlistentry>
46339    <varlistentry>      <term>ops</term>
46340      <listitem><para>
46341client callbacks
46342      </para></listitem>
46343    </varlistentry>
46344    <varlistentry>      <term>id</term>
46345      <listitem><para>
46346client identifier. Determining the id requires the handler,
46347so gpus are initially assigned VGA_SWITCHEROO_UNKNOWN_ID
46348and later given their true id in <function>vga_switcheroo_enable</function>
46349      </para></listitem>
46350    </varlistentry>
46351    <varlistentry>      <term>active</term>
46352      <listitem><para>
46353whether the outputs are currently switched to this client
46354      </para></listitem>
46355    </varlistentry>
46356    <varlistentry>      <term>driver_power_control</term>
46357      <listitem><para>
46358whether power state is controlled by the driver's
46359runtime pm. If true, writing ON and OFF to the vga_switcheroo debugfs
46360interface is a no-op so as not to interfere with runtime pm
46361      </para></listitem>
46362    </varlistentry>
46363    <varlistentry>      <term>list</term>
46364      <listitem><para>
46365client list
46366      </para></listitem>
46367    </varlistentry>
46368  </variablelist>
46369 </refsect1>
46370<refsect1>
46371<title>Description</title>
46372<para>
46373   Registered client. A client can be either a GPU or an audio device on a GPU.
46374   For audio clients, the <parameter>fb_info</parameter>, <parameter>active</parameter> and <parameter>driver_power_control</parameter> members
46375   are bogus.
46376</para>
46377</refsect1>
46378</refentry>
46379
46380  </chapter>
46381
46382</part>
46383
46384</book>
46385