]>
Commit | Line | Data |
---|---|---|
2d2ef822 JB |
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 | ||
7f817074 | 5 | <book id="gpuDevelopersGuide"> |
2d2ef822 | 6 | <bookinfo> |
3a4579b4 | 7 | <title>Linux GPU Driver Developer's Guide</title> |
2d2ef822 | 8 | |
9cad9c95 LP |
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> | |
3a05700d DV |
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> | |
6648f487 LW |
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> | |
9cad9c95 LP |
53 | </authorgroup> |
54 | ||
2d2ef822 JB |
55 | <copyright> |
56 | <year>2008-2009</year> | |
3a05700d | 57 | <year>2013-2014</year> |
9cad9c95 | 58 | <holder>Intel Corporation</holder> |
3a05700d DV |
59 | </copyright> |
60 | <copyright> | |
61 | <year>2012</year> | |
9cad9c95 | 62 | <holder>Laurent Pinchart</holder> |
2d2ef822 | 63 | </copyright> |
6648f487 LW |
64 | <copyright> |
65 | <year>2015</year> | |
66 | <holder>Lukas Wunner</holder> | |
67 | </copyright> | |
2d2ef822 JB |
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> | |
9cad9c95 LP |
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> | |
6648f487 LW |
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> | |
9cad9c95 | 93 | </revhistory> |
2d2ef822 JB |
94 | </bookinfo> |
95 | ||
96 | <toc></toc> | |
97 | ||
3519f70e DV |
98 | <part id="drmCore"> |
99 | <title>DRM Core</title> | |
100 | <partintro> | |
101 | <para> | |
7f817074 LW |
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. | |
3519f70e DV |
105 | </para> |
106 | </partintro> | |
2d2ef822 JB |
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 | |
f11aca04 | 114 | drivers in the kernel may make use of DRM functions to make |
2d2ef822 JB |
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> | |
a78f6787 | 139 | First, we go over some typical driver initialization |
2d2ef822 JB |
140 | requirements, like setting up command buffers, creating an |
141 | initial output configuration, and initializing core services. | |
a78f6787 | 142 | Subsequent sections cover core internals in more detail, |
2d2ef822 JB |
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 & fencing, suspend/resume support, and DMA | |
152 | services. | |
153 | </para> | |
2d2ef822 JB |
154 | |
155 | <!-- Internals: driver init --> | |
156 | ||
157 | <sect1> | |
9cad9c95 LP |
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, | |
6e3f797c DV |
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>. | |
b528ae71 | 166 | </para> |
9cad9c95 LP |
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. | |
2d2ef822 | 174 | </para> |
2d2ef822 | 175 | <sect2> |
9cad9c95 LP |
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> | |
9cad9c95 LP |
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> | |
02b62985 LP |
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 & handler | |
232 | support shared IRQs (note that this is required of PCI drivers). | |
9cad9c95 LP |
233 | </para></listitem> |
234 | </varlistentry> | |
9cad9c95 LP |
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> | |
1793126f DH |
253 | <varlistentry> |
254 | <term>DRIVER_RENDER</term> | |
255 | <listitem><para> | |
256 | Driver supports dedicated render nodes. | |
257 | </para></listitem> | |
258 | </varlistentry> | |
88a48e29 RC |
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> | |
9cad9c95 LP |
267 | </variablelist> |
268 | </sect3> | |
269 | <sect3> | |
270 | <title>Major, Minor and Patchlevel</title> | |
271 | <synopsis>int major; | |
272 | int minor; | |
273 | int 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; | |
294 | char *desc; | |
295 | char *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> | |
c6a1af8a | 315 | <sect2> |
6e3f797c DV |
316 | <title>Device Instance and Driver Handling</title> |
317 | !Pdrivers/gpu/drm/drm_drv.c driver instance overview | |
25196484 | 318 | !Edrivers/gpu/drm/drm_drv.c |
c6a1af8a | 319 | </sect2> |
9cad9c95 LP |
320 | <sect2> |
321 | <title>Driver Load</title> | |
9cad9c95 LP |
322 | <sect3 id="drm-irq-registration"> |
323 | <title>IRQ Registration</title> | |
324 | <para> | |
325 | The DRM core tries to facilitate IRQ handler registration and | |
326 | unregistration by providing <function>drm_irq_install</function> and | |
327 | <function>drm_irq_uninstall</function> functions. Those functions only | |
02b62985 LP |
328 | support a single interrupt per device, devices that use more than one |
329 | IRQs need to be handled manually. | |
9cad9c95 | 330 | </para> |
02b62985 LP |
331 | <sect4> |
332 | <title>Managed IRQ Registration</title> | |
02b62985 LP |
333 | <para> |
334 | <function>drm_irq_install</function> starts by calling the | |
335 | <methodname>irq_preinstall</methodname> driver operation. The operation | |
336 | is optional and must make sure that the interrupt will not get fired by | |
337 | clearing all pending interrupt flags or disabling the interrupt. | |
338 | </para> | |
339 | <para> | |
bb0f1b5c | 340 | The passed-in IRQ will then be requested by a call to |
02b62985 LP |
341 | <function>request_irq</function>. If the DRIVER_IRQ_SHARED driver |
342 | feature flag is set, a shared (IRQF_SHARED) IRQ handler will be | |
343 | requested. | |
344 | </para> | |
345 | <para> | |
346 | The IRQ handler function must be provided as the mandatory irq_handler | |
347 | driver operation. It will get passed directly to | |
348 | <function>request_irq</function> and thus has the same prototype as all | |
349 | IRQ handlers. It will get called with a pointer to the DRM device as the | |
350 | second argument. | |
351 | </para> | |
352 | <para> | |
353 | Finally the function calls the optional | |
354 | <methodname>irq_postinstall</methodname> driver operation. The operation | |
355 | usually enables interrupts (excluding the vblank interrupt, which is | |
356 | enabled separately), but drivers may choose to enable/disable interrupts | |
357 | at a different time. | |
358 | </para> | |
359 | <para> | |
360 | <function>drm_irq_uninstall</function> is similarly used to uninstall an | |
361 | IRQ handler. It starts by waking up all processes waiting on a vblank | |
362 | interrupt to make sure they don't hang, and then calls the optional | |
363 | <methodname>irq_uninstall</methodname> driver operation. The operation | |
364 | must disable all hardware interrupts. Finally the function frees the IRQ | |
365 | by calling <function>free_irq</function>. | |
366 | </para> | |
367 | </sect4> | |
368 | <sect4> | |
369 | <title>Manual IRQ Registration</title> | |
370 | <para> | |
371 | Drivers that require multiple interrupt handlers can't use the managed | |
372 | IRQ registration functions. In that case IRQs must be registered and | |
373 | unregistered manually (usually with the <function>request_irq</function> | |
374 | and <function>free_irq</function> functions, or their devm_* equivalent). | |
375 | </para> | |
376 | <para> | |
377 | When manually registering IRQs, drivers must not set the DRIVER_HAVE_IRQ | |
378 | driver feature flag, and must not provide the | |
379 | <methodname>irq_handler</methodname> driver operation. They must set the | |
380 | <structname>drm_device</structname> <structfield>irq_enabled</structfield> | |
381 | field to 1 upon registration of the IRQs, and clear it to 0 after | |
382 | unregistering the IRQs. | |
383 | </para> | |
384 | </sect4> | |
9cad9c95 LP |
385 | </sect3> |
386 | <sect3> | |
387 | <title>Memory Manager Initialization</title> | |
388 | <para> | |
389 | Every DRM driver requires a memory manager which must be initialized at | |
390 | load time. DRM currently contains two memory managers, the Translation | |
391 | Table Manager (TTM) and the Graphics Execution Manager (GEM). | |
392 | This document describes the use of the GEM memory manager only. See | |
393 | <xref linkend="drm-memory-management"/> for details. | |
394 | </para> | |
395 | </sect3> | |
396 | <sect3> | |
397 | <title>Miscellaneous Device Configuration</title> | |
398 | <para> | |
399 | Another task that may be necessary for PCI devices during configuration | |
400 | is mapping the video BIOS. On many devices, the VBIOS describes device | |
401 | configuration, LCD panel timings (if any), and contains flags indicating | |
402 | device state. Mapping the BIOS can be done using the pci_map_rom() call, | |
403 | a convenience function that takes care of mapping the actual ROM, | |
404 | whether it has been shadowed into memory (typically at address 0xc0000) | |
405 | or exists on the PCI device in the ROM BAR. Note that after the ROM has | |
406 | been mapped and any necessary information has been extracted, it should | |
407 | be unmapped; on many devices, the ROM address decoder is shared with | |
408 | other BARs, so leaving it mapped could cause undesired behaviour like | |
409 | hangs or memory corruption. | |
410 | <!--!Fdrivers/pci/rom.c pci_map_rom--> | |
411 | </para> | |
412 | </sect3> | |
2d2ef822 | 413 | </sect2> |
6e3f797c DV |
414 | <sect2> |
415 | <title>Bus-specific Device Registration and PCI Support</title> | |
416 | <para> | |
417 | A number of functions are provided to help with device registration. | |
418 | The functions deal with PCI and platform devices respectively and are | |
419 | only provided for historical reasons. These are all deprecated and | |
420 | shouldn't be used in new drivers. Besides that there's a few | |
421 | helpers for pci drivers. | |
422 | </para> | |
423 | !Edrivers/gpu/drm/drm_pci.c | |
424 | !Edrivers/gpu/drm/drm_platform.c | |
425 | </sect2> | |
9cad9c95 | 426 | </sect1> |
2d2ef822 | 427 | |
9cad9c95 | 428 | <!-- Internals: memory management --> |
2d2ef822 | 429 | |
9cad9c95 LP |
430 | <sect1 id="drm-memory-management"> |
431 | <title>Memory management</title> | |
432 | <para> | |
433 | Modern Linux systems require large amount of graphics memory to store | |
434 | frame buffers, textures, vertices and other graphics-related data. Given | |
435 | the very dynamic nature of many of that data, managing graphics memory | |
436 | efficiently is thus crucial for the graphics stack and plays a central | |
437 | role in the DRM infrastructure. | |
438 | </para> | |
439 | <para> | |
440 | The DRM core includes two memory managers, namely Translation Table Maps | |
441 | (TTM) and Graphics Execution Manager (GEM). TTM was the first DRM memory | |
442 | manager to be developed and tried to be a one-size-fits-them all | |
f884ab15 | 443 | solution. It provides a single userspace API to accommodate the need of |
9cad9c95 LP |
444 | all hardware, supporting both Unified Memory Architecture (UMA) devices |
445 | and devices with dedicated video RAM (i.e. most discrete video cards). | |
446 | This resulted in a large, complex piece of code that turned out to be | |
447 | hard to use for driver development. | |
448 | </para> | |
449 | <para> | |
450 | GEM started as an Intel-sponsored project in reaction to TTM's | |
451 | complexity. Its design philosophy is completely different: instead of | |
452 | providing a solution to every graphics memory-related problems, GEM | |
453 | identified common code between drivers and created a support library to | |
454 | share it. GEM has simpler initialization and execution requirements than | |
9a6594fc | 455 | TTM, but has no video RAM management capabilities and is thus limited to |
9cad9c95 LP |
456 | UMA devices. |
457 | </para> | |
2d2ef822 | 458 | <sect2> |
9cad9c95 | 459 | <title>The Translation Table Manager (TTM)</title> |
2d2ef822 | 460 | <para> |
79058100 | 461 | TTM design background and information belongs here. |
2d2ef822 JB |
462 | </para> |
463 | <sect3> | |
79058100 | 464 | <title>TTM initialization</title> |
9cad9c95 LP |
465 | <warning><para>This section is outdated.</para></warning> |
466 | <para> | |
467 | Drivers wishing to support TTM must fill out a drm_bo_driver | |
468 | structure. The structure contains several fields with function | |
469 | pointers for initializing the TTM, allocating and freeing memory, | |
470 | waiting for command completion and fence synchronization, and memory | |
471 | migration. See the radeon_ttm.c file for an example of usage. | |
79058100 TR |
472 | </para> |
473 | <para> | |
474 | The ttm_global_reference structure is made up of several fields: | |
475 | </para> | |
476 | <programlisting> | |
477 | struct ttm_global_reference { | |
478 | enum ttm_global_types global_type; | |
479 | size_t size; | |
480 | void *object; | |
481 | int (*init) (struct ttm_global_reference *); | |
482 | void (*release) (struct ttm_global_reference *); | |
483 | }; | |
484 | </programlisting> | |
485 | <para> | |
486 | There should be one global reference structure for your memory | |
487 | manager as a whole, and there will be others for each object | |
488 | created by the memory manager at runtime. Your global TTM should | |
489 | have a type of TTM_GLOBAL_TTM_MEM. The size field for the global | |
490 | object should be sizeof(struct ttm_mem_global), and the init and | |
491 | release hooks should point at your driver-specific init and | |
492 | release routines, which probably eventually call | |
493 | ttm_mem_global_init and ttm_mem_global_release, respectively. | |
494 | </para> | |
495 | <para> | |
496 | Once your global TTM accounting structure is set up and initialized | |
497 | by calling ttm_global_item_ref() on it, | |
498 | you need to create a buffer object TTM to | |
499 | provide a pool for buffer object allocation by clients and the | |
500 | kernel itself. The type of this object should be TTM_GLOBAL_TTM_BO, | |
501 | and its size should be sizeof(struct ttm_bo_global). Again, | |
502 | driver-specific init and release functions may be provided, | |
503 | likely eventually calling ttm_bo_global_init() and | |
504 | ttm_bo_global_release(), respectively. Also, like the previous | |
505 | object, ttm_global_item_ref() is used to create an initial reference | |
506 | count for the TTM, which will call your initialization function. | |
507 | </para> | |
2d2ef822 | 508 | </sect3> |
9cad9c95 LP |
509 | </sect2> |
510 | <sect2 id="drm-gem"> | |
511 | <title>The Graphics Execution Manager (GEM)</title> | |
512 | <para> | |
513 | The GEM design approach has resulted in a memory manager that doesn't | |
514 | provide full coverage of all (or even all common) use cases in its | |
515 | userspace or kernel API. GEM exposes a set of standard memory-related | |
516 | operations to userspace and a set of helper functions to drivers, and let | |
517 | drivers implement hardware-specific operations with their own private API. | |
518 | </para> | |
519 | <para> | |
520 | The GEM userspace API is described in the | |
521 | <ulink url="http://lwn.net/Articles/283798/"><citetitle>GEM - the Graphics | |
522 | Execution Manager</citetitle></ulink> article on LWN. While slightly | |
523 | outdated, the document provides a good overview of the GEM API principles. | |
524 | Buffer allocation and read and write operations, described as part of the | |
525 | common GEM API, are currently implemented using driver-specific ioctls. | |
526 | </para> | |
527 | <para> | |
528 | GEM is data-agnostic. It manages abstract buffer objects without knowing | |
529 | what individual buffers contain. APIs that require knowledge of buffer | |
530 | contents or purpose, such as buffer allocation or synchronization | |
531 | primitives, are thus outside of the scope of GEM and must be implemented | |
532 | using driver-specific ioctls. | |
533 | </para> | |
534 | <para> | |
79058100 TR |
535 | On a fundamental level, GEM involves several operations: |
536 | <itemizedlist> | |
537 | <listitem>Memory allocation and freeing</listitem> | |
538 | <listitem>Command execution</listitem> | |
539 | <listitem>Aperture management at command execution time</listitem> | |
540 | </itemizedlist> | |
541 | Buffer object allocation is relatively straightforward and largely | |
9cad9c95 LP |
542 | provided by Linux's shmem layer, which provides memory to back each |
543 | object. | |
544 | </para> | |
545 | <para> | |
546 | Device-specific operations, such as command execution, pinning, buffer | |
79058100 | 547 | read & write, mapping, and domain ownership transfers are left to |
9cad9c95 LP |
548 | driver-specific ioctls. |
549 | </para> | |
550 | <sect3> | |
551 | <title>GEM Initialization</title> | |
552 | <para> | |
553 | Drivers that use GEM must set the DRIVER_GEM bit in the struct | |
554 | <structname>drm_driver</structname> | |
555 | <structfield>driver_features</structfield> field. The DRM core will | |
556 | then automatically initialize the GEM core before calling the | |
557 | <methodname>load</methodname> operation. Behind the scene, this will | |
558 | create a DRM Memory Manager object which provides an address space | |
559 | pool for object allocation. | |
560 | </para> | |
561 | <para> | |
562 | In a KMS configuration, drivers need to allocate and initialize a | |
563 | command ring buffer following core GEM initialization if required by | |
564 | the hardware. UMA devices usually have what is called a "stolen" | |
565 | memory region, which provides space for the initial framebuffer and | |
566 | large, contiguous memory regions required by the device. This space is | |
567 | typically not managed by GEM, and must be initialized separately into | |
568 | its own DRM MM object. | |
569 | </para> | |
570 | </sect3> | |
2d2ef822 | 571 | <sect3> |
9cad9c95 LP |
572 | <title>GEM Objects Creation</title> |
573 | <para> | |
574 | GEM splits creation of GEM objects and allocation of the memory that | |
575 | backs them in two distinct operations. | |
576 | </para> | |
577 | <para> | |
578 | GEM objects are represented by an instance of struct | |
579 | <structname>drm_gem_object</structname>. Drivers usually need to extend | |
580 | GEM objects with private information and thus create a driver-specific | |
581 | GEM object structure type that embeds an instance of struct | |
582 | <structname>drm_gem_object</structname>. | |
583 | </para> | |
584 | <para> | |
585 | To create a GEM object, a driver allocates memory for an instance of its | |
586 | specific GEM object type and initializes the embedded struct | |
587 | <structname>drm_gem_object</structname> with a call to | |
588 | <function>drm_gem_object_init</function>. The function takes a pointer to | |
589 | the DRM device, a pointer to the GEM object and the buffer object size | |
590 | in bytes. | |
591 | </para> | |
592 | <para> | |
593 | GEM uses shmem to allocate anonymous pageable memory. | |
594 | <function>drm_gem_object_init</function> will create an shmfs file of | |
595 | the requested size and store it into the struct | |
596 | <structname>drm_gem_object</structname> <structfield>filp</structfield> | |
597 | field. The memory is used as either main storage for the object when the | |
598 | graphics hardware uses system memory directly or as a backing store | |
599 | otherwise. | |
600 | </para> | |
601 | <para> | |
602 | Drivers are responsible for the actual physical pages allocation by | |
603 | calling <function>shmem_read_mapping_page_gfp</function> for each page. | |
604 | Note that they can decide to allocate pages when initializing the GEM | |
605 | object, or to delay allocation until the memory is needed (for instance | |
606 | when a page fault occurs as a result of a userspace memory access or | |
607 | when the driver needs to start a DMA transfer involving the memory). | |
608 | </para> | |
609 | <para> | |
610 | Anonymous pageable memory allocation is not always desired, for instance | |
611 | when the hardware requires physically contiguous system memory as is | |
612 | often the case in embedded devices. Drivers can create GEM objects with | |
613 | no shmfs backing (called private GEM objects) by initializing them with | |
614 | a call to <function>drm_gem_private_object_init</function> instead of | |
615 | <function>drm_gem_object_init</function>. Storage for private GEM | |
616 | objects must be managed by drivers. | |
617 | </para> | |
9cad9c95 LP |
618 | </sect3> |
619 | <sect3> | |
620 | <title>GEM Objects Lifetime</title> | |
621 | <para> | |
622 | All GEM objects are reference-counted by the GEM core. References can be | |
623 | acquired and release by <function>calling drm_gem_object_reference</function> | |
624 | and <function>drm_gem_object_unreference</function> respectively. The | |
625 | caller must hold the <structname>drm_device</structname> | |
decc60bf DV |
626 | <structfield>struct_mutex</structfield> lock when calling |
627 | <function>drm_gem_object_reference</function>. As a convenience, GEM | |
628 | provides <function>drm_gem_object_unreference_unlocked</function> | |
629 | functions that can be called without holding the lock. | |
9cad9c95 LP |
630 | </para> |
631 | <para> | |
632 | When the last reference to a GEM object is released the GEM core calls | |
633 | the <structname>drm_driver</structname> | |
634 | <methodname>gem_free_object</methodname> operation. That operation is | |
635 | mandatory for GEM-enabled drivers and must free the GEM object and all | |
636 | associated resources. | |
637 | </para> | |
638 | <para> | |
639 | <synopsis>void (*gem_free_object) (struct drm_gem_object *obj);</synopsis> | |
df2e0900 DV |
640 | Drivers are responsible for freeing all GEM object resources. This includes |
641 | the resources created by the GEM core, which need to be released with | |
642 | <function>drm_gem_object_release</function>. | |
9cad9c95 LP |
643 | </para> |
644 | </sect3> | |
645 | <sect3> | |
646 | <title>GEM Objects Naming</title> | |
647 | <para> | |
648 | Communication between userspace and the kernel refers to GEM objects | |
649 | using local handles, global names or, more recently, file descriptors. | |
650 | All of those are 32-bit integer values; the usual Linux kernel limits | |
651 | apply to the file descriptors. | |
652 | </para> | |
653 | <para> | |
654 | GEM handles are local to a DRM file. Applications get a handle to a GEM | |
655 | object through a driver-specific ioctl, and can use that handle to refer | |
656 | to the GEM object in other standard or driver-specific ioctls. Closing a | |
657 | DRM file handle frees all its GEM handles and dereferences the | |
658 | associated GEM objects. | |
659 | </para> | |
660 | <para> | |
661 | To create a handle for a GEM object drivers call | |
662 | <function>drm_gem_handle_create</function>. The function takes a pointer | |
663 | to the DRM file and the GEM object and returns a locally unique handle. | |
664 | When the handle is no longer needed drivers delete it with a call to | |
665 | <function>drm_gem_handle_delete</function>. Finally the GEM object | |
666 | associated with a handle can be retrieved by a call to | |
667 | <function>drm_gem_object_lookup</function>. | |
668 | </para> | |
669 | <para> | |
670 | Handles don't take ownership of GEM objects, they only take a reference | |
671 | to the object that will be dropped when the handle is destroyed. To | |
672 | avoid leaking GEM objects, drivers must make sure they drop the | |
673 | reference(s) they own (such as the initial reference taken at object | |
674 | creation time) as appropriate, without any special consideration for the | |
675 | handle. For example, in the particular case of combined GEM object and | |
676 | handle creation in the implementation of the | |
677 | <methodname>dumb_create</methodname> operation, drivers must drop the | |
678 | initial reference to the GEM object before returning the handle. | |
679 | </para> | |
680 | <para> | |
681 | GEM names are similar in purpose to handles but are not local to DRM | |
682 | files. They can be passed between processes to reference a GEM object | |
683 | globally. Names can't be used directly to refer to objects in the DRM | |
684 | API, applications must convert handles to names and names to handles | |
685 | using the DRM_IOCTL_GEM_FLINK and DRM_IOCTL_GEM_OPEN ioctls | |
686 | respectively. The conversion is handled by the DRM core without any | |
687 | driver-specific support. | |
688 | </para> | |
79058100 TR |
689 | <para> |
690 | GEM also supports buffer sharing with dma-buf file descriptors through | |
691 | PRIME. GEM-based drivers must use the provided helpers functions to | |
692 | implement the exporting and importing correctly. See <xref linkend="drm-prime-support" />. | |
693 | Since sharing file descriptors is inherently more secure than the | |
694 | easily guessable and global GEM names it is the preferred buffer | |
695 | sharing mechanism. Sharing buffers through GEM names is only supported | |
696 | for legacy userspace. Furthermore PRIME also allows cross-device | |
697 | buffer sharing since it is based on dma-bufs. | |
698 | </para> | |
9cad9c95 LP |
699 | </sect3> |
700 | <sect3 id="drm-gem-objects-mapping"> | |
701 | <title>GEM Objects Mapping</title> | |
702 | <para> | |
703 | Because mapping operations are fairly heavyweight GEM favours | |
704 | read/write-like access to buffers, implemented through driver-specific | |
705 | ioctls, over mapping buffers to userspace. However, when random access | |
706 | to the buffer is needed (to perform software rendering for instance), | |
707 | direct access to the object can be more efficient. | |
708 | </para> | |
709 | <para> | |
710 | The mmap system call can't be used directly to map GEM objects, as they | |
711 | don't have their own file handle. Two alternative methods currently | |
712 | co-exist to map GEM objects to userspace. The first method uses a | |
713 | driver-specific ioctl to perform the mapping operation, calling | |
714 | <function>do_mmap</function> under the hood. This is often considered | |
715 | dubious, seems to be discouraged for new GEM-enabled drivers, and will | |
716 | thus not be described here. | |
717 | </para> | |
718 | <para> | |
719 | The second method uses the mmap system call on the DRM file handle. | |
720 | <synopsis>void *mmap(void *addr, size_t length, int prot, int flags, int fd, | |
721 | off_t offset);</synopsis> | |
722 | DRM identifies the GEM object to be mapped by a fake offset passed | |
723 | through the mmap offset argument. Prior to being mapped, a GEM object | |
724 | must thus be associated with a fake offset. To do so, drivers must call | |
df2e0900 | 725 | <function>drm_gem_create_mmap_offset</function> on the object. |
9cad9c95 LP |
726 | </para> |
727 | <para> | |
728 | Once allocated, the fake offset value | |
9cad9c95 LP |
729 | must be passed to the application in a driver-specific way and can then |
730 | be used as the mmap offset argument. | |
731 | </para> | |
732 | <para> | |
733 | The GEM core provides a helper method <function>drm_gem_mmap</function> | |
734 | to handle object mapping. The method can be set directly as the mmap | |
735 | file operation handler. It will look up the GEM object based on the | |
736 | offset value and set the VMA operations to the | |
737 | <structname>drm_driver</structname> <structfield>gem_vm_ops</structfield> | |
738 | field. Note that <function>drm_gem_mmap</function> doesn't map memory to | |
739 | userspace, but relies on the driver-provided fault handler to map pages | |
740 | individually. | |
741 | </para> | |
742 | <para> | |
743 | To use <function>drm_gem_mmap</function>, drivers must fill the struct | |
744 | <structname>drm_driver</structname> <structfield>gem_vm_ops</structfield> | |
745 | field with a pointer to VM operations. | |
746 | </para> | |
747 | <para> | |
748 | <synopsis>struct vm_operations_struct *gem_vm_ops | |
749 | ||
750 | struct vm_operations_struct { | |
751 | void (*open)(struct vm_area_struct * area); | |
752 | void (*close)(struct vm_area_struct * area); | |
753 | int (*fault)(struct vm_area_struct *vma, struct vm_fault *vmf); | |
754 | };</synopsis> | |
755 | </para> | |
756 | <para> | |
757 | The <methodname>open</methodname> and <methodname>close</methodname> | |
758 | operations must update the GEM object reference count. Drivers can use | |
759 | the <function>drm_gem_vm_open</function> and | |
760 | <function>drm_gem_vm_close</function> helper functions directly as open | |
761 | and close handlers. | |
762 | </para> | |
763 | <para> | |
764 | The fault operation handler is responsible for mapping individual pages | |
765 | to userspace when a page fault occurs. Depending on the memory | |
766 | allocation scheme, drivers can allocate pages at fault time, or can | |
767 | decide to allocate memory for the GEM object at the time the object is | |
768 | created. | |
769 | </para> | |
770 | <para> | |
771 | Drivers that want to map the GEM object upfront instead of handling page | |
772 | faults can implement their own mmap file operation handler. | |
773 | </para> | |
774 | </sect3> | |
9cad9c95 LP |
775 | <sect3> |
776 | <title>Memory Coherency</title> | |
777 | <para> | |
778 | When mapped to the device or used in a command buffer, backing pages | |
779 | for an object are flushed to memory and marked write combined so as to | |
780 | be coherent with the GPU. Likewise, if the CPU accesses an object | |
781 | after the GPU has finished rendering to the object, then the object | |
782 | must be made coherent with the CPU's view of memory, usually involving | |
783 | GPU cache flushing of various kinds. This core CPU<->GPU | |
784 | coherency management is provided by a device-specific ioctl, which | |
785 | evaluates an object's current domain and performs any necessary | |
786 | flushing or synchronization to put the object into the desired | |
787 | coherency domain (note that the object may be busy, i.e. an active | |
788 | render target; in that case, setting the domain blocks the client and | |
789 | waits for rendering to complete before performing any necessary | |
790 | flushing operations). | |
791 | </para> | |
792 | </sect3> | |
793 | <sect3> | |
794 | <title>Command Execution</title> | |
795 | <para> | |
79058100 | 796 | Perhaps the most important GEM function for GPU devices is providing a |
9cad9c95 LP |
797 | command execution interface to clients. Client programs construct |
798 | command buffers containing references to previously allocated memory | |
799 | objects, and then submit them to GEM. At that point, GEM takes care to | |
800 | bind all the objects into the GTT, execute the buffer, and provide | |
801 | necessary synchronization between clients accessing the same buffers. | |
802 | This often involves evicting some objects from the GTT and re-binding | |
803 | others (a fairly expensive operation), and providing relocation | |
804 | support which hides fixed GTT offsets from clients. Clients must take | |
805 | care not to submit command buffers that reference more objects than | |
806 | can fit in the GTT; otherwise, GEM will reject them and no rendering | |
807 | will occur. Similarly, if several objects in the buffer require fence | |
808 | registers to be allocated for correct rendering (e.g. 2D blits on | |
809 | pre-965 chips), care must be taken not to require more fence registers | |
810 | than are available to the client. Such resource management should be | |
811 | abstracted from the client in libdrm. | |
812 | </para> | |
2d2ef822 | 813 | </sect3> |
decc60bf DV |
814 | </sect2> |
815 | <sect2> | |
816 | <title>GEM Function Reference</title> | |
89d61fc0 | 817 | !Edrivers/gpu/drm/drm_gem.c |
decc60bf | 818 | !Iinclude/drm/drm_gem.h |
79058100 TR |
819 | </sect2> |
820 | <sect2> | |
821 | <title>VMA Offset Manager</title> | |
4c5acf3c DV |
822 | !Pdrivers/gpu/drm/drm_vma_manager.c vma offset manager |
823 | !Edrivers/gpu/drm/drm_vma_manager.c | |
824 | !Iinclude/drm/drm_vma_manager.h | |
79058100 TR |
825 | </sect2> |
826 | <sect2 id="drm-prime-support"> | |
827 | <title>PRIME Buffer Sharing</title> | |
828 | <para> | |
829 | PRIME is the cross device buffer sharing framework in drm, originally | |
830 | created for the OPTIMUS range of multi-gpu platforms. To userspace | |
831 | PRIME buffers are dma-buf based file descriptors. | |
832 | </para> | |
833 | <sect3> | |
834 | <title>Overview and Driver Interface</title> | |
835 | <para> | |
836 | Similar to GEM global names, PRIME file descriptors are | |
837 | also used to share buffer objects across processes. They offer | |
838 | additional security: as file descriptors must be explicitly sent over | |
839 | UNIX domain sockets to be shared between applications, they can't be | |
840 | guessed like the globally unique GEM names. | |
841 | </para> | |
842 | <para> | |
843 | Drivers that support the PRIME | |
844 | API must set the DRIVER_PRIME bit in the struct | |
845 | <structname>drm_driver</structname> | |
846 | <structfield>driver_features</structfield> field, and implement the | |
847 | <methodname>prime_handle_to_fd</methodname> and | |
848 | <methodname>prime_fd_to_handle</methodname> operations. | |
849 | </para> | |
850 | <para> | |
851 | <synopsis>int (*prime_handle_to_fd)(struct drm_device *dev, | |
852 | struct drm_file *file_priv, uint32_t handle, | |
853 | uint32_t flags, int *prime_fd); | |
251261db | 854 | int (*prime_fd_to_handle)(struct drm_device *dev, |
79058100 TR |
855 | struct drm_file *file_priv, int prime_fd, |
856 | uint32_t *handle);</synopsis> | |
857 | Those two operations convert a handle to a PRIME file descriptor and | |
858 | vice versa. Drivers must use the kernel dma-buf buffer sharing framework | |
859 | to manage the PRIME file descriptors. Similar to the mode setting | |
860 | API PRIME is agnostic to the underlying buffer object manager, as | |
861 | long as handles are 32bit unsigned integers. | |
862 | </para> | |
863 | <para> | |
864 | While non-GEM drivers must implement the operations themselves, GEM | |
865 | drivers must use the <function>drm_gem_prime_handle_to_fd</function> | |
866 | and <function>drm_gem_prime_fd_to_handle</function> helper functions. | |
867 | Those helpers rely on the driver | |
868 | <methodname>gem_prime_export</methodname> and | |
869 | <methodname>gem_prime_import</methodname> operations to create a dma-buf | |
870 | instance from a GEM object (dma-buf exporter role) and to create a GEM | |
871 | object from a dma-buf instance (dma-buf importer role). | |
872 | </para> | |
873 | <para> | |
874 | <synopsis>struct dma_buf * (*gem_prime_export)(struct drm_device *dev, | |
875 | struct drm_gem_object *obj, | |
876 | int flags); | |
251261db | 877 | struct drm_gem_object * (*gem_prime_import)(struct drm_device *dev, |
79058100 TR |
878 | struct dma_buf *dma_buf);</synopsis> |
879 | These two operations are mandatory for GEM drivers that support | |
880 | PRIME. | |
881 | </para> | |
251261db | 882 | </sect3> |
79058100 TR |
883 | <sect3> |
884 | <title>PRIME Helper Functions</title> | |
885 | !Pdrivers/gpu/drm/drm_prime.c PRIME Helpers | |
886 | </sect3> | |
887 | </sect2> | |
888 | <sect2> | |
889 | <title>PRIME Function References</title> | |
39cc344a | 890 | !Edrivers/gpu/drm/drm_prime.c |
79058100 TR |
891 | </sect2> |
892 | <sect2> | |
893 | <title>DRM MM Range Allocator</title> | |
894 | <sect3> | |
895 | <title>Overview</title> | |
93110be6 | 896 | !Pdrivers/gpu/drm/drm_mm.c Overview |
79058100 TR |
897 | </sect3> |
898 | <sect3> | |
899 | <title>LRU Scan/Eviction Support</title> | |
93110be6 | 900 | !Pdrivers/gpu/drm/drm_mm.c lru scan roaster |
79058100 | 901 | </sect3> |
93110be6 | 902 | </sect2> |
79058100 TR |
903 | <sect2> |
904 | <title>DRM MM Range Allocator Function References</title> | |
e18c0412 DV |
905 | !Edrivers/gpu/drm/drm_mm.c |
906 | !Iinclude/drm/drm_mm.h | |
79058100 | 907 | </sect2> |
d7883f87 TR |
908 | <sect2> |
909 | <title>CMA Helper Functions Reference</title> | |
910 | !Pdrivers/gpu/drm/drm_gem_cma_helper.c cma helpers | |
911 | !Edrivers/gpu/drm/drm_gem_cma_helper.c | |
912 | !Iinclude/drm/drm_gem_cma_helper.h | |
913 | </sect2> | |
9cad9c95 LP |
914 | </sect1> |
915 | ||
916 | <!-- Internals: mode setting --> | |
2d2ef822 | 917 | |
9cad9c95 LP |
918 | <sect1 id="drm-mode-setting"> |
919 | <title>Mode Setting</title> | |
920 | <para> | |
921 | Drivers must initialize the mode setting core by calling | |
922 | <function>drm_mode_config_init</function> on the DRM device. The function | |
923 | initializes the <structname>drm_device</structname> | |
924 | <structfield>mode_config</structfield> field and never fails. Once done, | |
925 | mode configuration must be setup by initializing the following fields. | |
926 | </para> | |
927 | <itemizedlist> | |
928 | <listitem> | |
929 | <synopsis>int min_width, min_height; | |
930 | int max_width, max_height;</synopsis> | |
931 | <para> | |
932 | Minimum and maximum width and height of the frame buffers in pixel | |
933 | units. | |
934 | </para> | |
935 | </listitem> | |
936 | <listitem> | |
937 | <synopsis>struct drm_mode_config_funcs *funcs;</synopsis> | |
938 | <para>Mode setting functions.</para> | |
939 | </listitem> | |
940 | </itemizedlist> | |
3ec0db81 DV |
941 | <sect2> |
942 | <title>Display Modes Function Reference</title> | |
f5aabb97 | 943 | !Iinclude/drm/drm_modes.h |
3ec0db81 | 944 | !Edrivers/gpu/drm/drm_modes.c |
cc4ceb48 DV |
945 | </sect2> |
946 | <sect2> | |
947 | <title>Atomic Mode Setting Function Reference</title> | |
948 | !Edrivers/gpu/drm/drm_atomic.c | |
c0714fc9 | 949 | !Idrivers/gpu/drm/drm_atomic.c |
3ec0db81 | 950 | </sect2> |
2d2ef822 | 951 | <sect2> |
9cad9c95 LP |
952 | <title>Frame Buffer Creation</title> |
953 | <synopsis>struct drm_framebuffer *(*fb_create)(struct drm_device *dev, | |
954 | struct drm_file *file_priv, | |
955 | struct drm_mode_fb_cmd2 *mode_cmd);</synopsis> | |
2d2ef822 | 956 | <para> |
9cad9c95 LP |
957 | Frame buffers are abstract memory objects that provide a source of |
958 | pixels to scanout to a CRTC. Applications explicitly request the | |
959 | creation of frame buffers through the DRM_IOCTL_MODE_ADDFB(2) ioctls and | |
960 | receive an opaque handle that can be passed to the KMS CRTC control, | |
961 | plane configuration and page flip functions. | |
962 | </para> | |
963 | <para> | |
964 | Frame buffers rely on the underneath memory manager for low-level memory | |
965 | operations. When creating a frame buffer applications pass a memory | |
966 | handle (or a list of memory handles for multi-planar formats) through | |
065a5027 DV |
967 | the <parameter>drm_mode_fb_cmd2</parameter> argument. For drivers using |
968 | GEM as their userspace buffer management interface this would be a GEM | |
969 | handle. Drivers are however free to use their own backing storage object | |
970 | handles, e.g. vmwgfx directly exposes special TTM handles to userspace | |
971 | and so expects TTM handles in the create ioctl and not GEM handles. | |
9cad9c95 LP |
972 | </para> |
973 | <para> | |
974 | Drivers must first validate the requested frame buffer parameters passed | |
975 | through the mode_cmd argument. In particular this is where invalid | |
976 | sizes, pixel formats or pitches can be caught. | |
977 | </para> | |
978 | <para> | |
979 | If the parameters are deemed valid, drivers then create, initialize and | |
980 | return an instance of struct <structname>drm_framebuffer</structname>. | |
981 | If desired the instance can be embedded in a larger driver-specific | |
5d7a9515 DV |
982 | structure. Drivers must fill its <structfield>width</structfield>, |
983 | <structfield>height</structfield>, <structfield>pitches</structfield>, | |
984 | <structfield>offsets</structfield>, <structfield>depth</structfield>, | |
985 | <structfield>bits_per_pixel</structfield> and | |
986 | <structfield>pixel_format</structfield> fields from the values passed | |
987 | through the <parameter>drm_mode_fb_cmd2</parameter> argument. They | |
988 | should call the <function>drm_helper_mode_fill_fb_struct</function> | |
989 | helper function to do so. | |
990 | </para> | |
991 | ||
992 | <para> | |
065a5027 | 993 | The initialization of the new framebuffer instance is finalized with a |
5d7a9515 DV |
994 | call to <function>drm_framebuffer_init</function> which takes a pointer |
995 | to DRM frame buffer operations (struct | |
996 | <structname>drm_framebuffer_funcs</structname>). Note that this function | |
997 | publishes the framebuffer and so from this point on it can be accessed | |
998 | concurrently from other threads. Hence it must be the last step in the | |
999 | driver's framebuffer initialization sequence. Frame buffer operations | |
1000 | are | |
9cad9c95 LP |
1001 | <itemizedlist> |
1002 | <listitem> | |
1003 | <synopsis>int (*create_handle)(struct drm_framebuffer *fb, | |
1004 | struct drm_file *file_priv, unsigned int *handle);</synopsis> | |
1005 | <para> | |
1006 | Create a handle to the frame buffer underlying memory object. If | |
1007 | the frame buffer uses a multi-plane format, the handle will | |
1008 | reference the memory object associated with the first plane. | |
1009 | </para> | |
1010 | <para> | |
1011 | Drivers call <function>drm_gem_handle_create</function> to create | |
1012 | the handle. | |
1013 | </para> | |
1014 | </listitem> | |
1015 | <listitem> | |
1016 | <synopsis>void (*destroy)(struct drm_framebuffer *framebuffer);</synopsis> | |
1017 | <para> | |
1018 | Destroy the frame buffer object and frees all associated | |
1019 | resources. Drivers must call | |
1020 | <function>drm_framebuffer_cleanup</function> to free resources | |
1021 | allocated by the DRM core for the frame buffer object, and must | |
1022 | make sure to unreference all memory objects associated with the | |
1023 | frame buffer. Handles created by the | |
1024 | <methodname>create_handle</methodname> operation are released by | |
1025 | the DRM core. | |
1026 | </para> | |
1027 | </listitem> | |
1028 | <listitem> | |
1029 | <synopsis>int (*dirty)(struct drm_framebuffer *framebuffer, | |
1030 | struct drm_file *file_priv, unsigned flags, unsigned color, | |
1031 | struct drm_clip_rect *clips, unsigned num_clips);</synopsis> | |
1032 | <para> | |
1033 | This optional operation notifies the driver that a region of the | |
1034 | frame buffer has changed in response to a DRM_IOCTL_MODE_DIRTYFB | |
1035 | ioctl call. | |
1036 | </para> | |
1037 | </listitem> | |
1038 | </itemizedlist> | |
1039 | </para> | |
1040 | <para> | |
5d7a9515 DV |
1041 | The lifetime of a drm framebuffer is controlled with a reference count, |
1042 | drivers can grab additional references with | |
9ee984a5 | 1043 | <function>drm_framebuffer_reference</function>and drop them |
5d7a9515 DV |
1044 | again with <function>drm_framebuffer_unreference</function>. For |
1045 | driver-private framebuffers for which the last reference is never | |
1046 | dropped (e.g. for the fbdev framebuffer when the struct | |
1047 | <structname>drm_framebuffer</structname> is embedded into the fbdev | |
1048 | helper struct) drivers can manually clean up a framebuffer at module | |
1049 | unload time with | |
1050 | <function>drm_framebuffer_unregister_private</function>. | |
9ee984a5 | 1051 | </para> |
9cad9c95 | 1052 | </sect2> |
065a5027 DV |
1053 | <sect2> |
1054 | <title>Dumb Buffer Objects</title> | |
1055 | <para> | |
1056 | The KMS API doesn't standardize backing storage object creation and | |
1057 | leaves it to driver-specific ioctls. Furthermore actually creating a | |
1058 | buffer object even for GEM-based drivers is done through a | |
1059 | driver-specific ioctl - GEM only has a common userspace interface for | |
1060 | sharing and destroying objects. While not an issue for full-fledged | |
1061 | graphics stacks that include device-specific userspace components (in | |
1062 | libdrm for instance), this limit makes DRM-based early boot graphics | |
1063 | unnecessarily complex. | |
1064 | </para> | |
1065 | <para> | |
1066 | Dumb objects partly alleviate the problem by providing a standard | |
1067 | API to create dumb buffers suitable for scanout, which can then be used | |
1068 | to create KMS frame buffers. | |
1069 | </para> | |
1070 | <para> | |
1071 | To support dumb objects drivers must implement the | |
1072 | <methodname>dumb_create</methodname>, | |
1073 | <methodname>dumb_destroy</methodname> and | |
1074 | <methodname>dumb_map_offset</methodname> operations. | |
1075 | </para> | |
1076 | <itemizedlist> | |
1077 | <listitem> | |
1078 | <synopsis>int (*dumb_create)(struct drm_file *file_priv, struct drm_device *dev, | |
1079 | struct drm_mode_create_dumb *args);</synopsis> | |
1080 | <para> | |
1081 | The <methodname>dumb_create</methodname> operation creates a driver | |
1082 | object (GEM or TTM handle) suitable for scanout based on the | |
1083 | width, height and depth from the struct | |
1084 | <structname>drm_mode_create_dumb</structname> argument. It fills the | |
1085 | argument's <structfield>handle</structfield>, | |
1086 | <structfield>pitch</structfield> and <structfield>size</structfield> | |
1087 | fields with a handle for the newly created object and its line | |
1088 | pitch and size in bytes. | |
1089 | </para> | |
1090 | </listitem> | |
1091 | <listitem> | |
1092 | <synopsis>int (*dumb_destroy)(struct drm_file *file_priv, struct drm_device *dev, | |
1093 | uint32_t handle);</synopsis> | |
1094 | <para> | |
1095 | The <methodname>dumb_destroy</methodname> operation destroys a dumb | |
1096 | object created by <methodname>dumb_create</methodname>. | |
1097 | </para> | |
1098 | </listitem> | |
1099 | <listitem> | |
1100 | <synopsis>int (*dumb_map_offset)(struct drm_file *file_priv, struct drm_device *dev, | |
1101 | uint32_t handle, uint64_t *offset);</synopsis> | |
1102 | <para> | |
1103 | The <methodname>dumb_map_offset</methodname> operation associates an | |
1104 | mmap fake offset with the object given by the handle and returns | |
1105 | it. Drivers must use the | |
1106 | <function>drm_gem_create_mmap_offset</function> function to | |
1107 | associate the fake offset as described in | |
1108 | <xref linkend="drm-gem-objects-mapping"/>. | |
1109 | </para> | |
1110 | </listitem> | |
1111 | </itemizedlist> | |
1112 | <para> | |
1113 | Note that dumb objects may not be used for gpu acceleration, as has been | |
1114 | attempted on some ARM embedded platforms. Such drivers really must have | |
1115 | a hardware-specific ioctl to allocate suitable buffer objects. | |
1116 | </para> | |
1117 | </sect2> | |
9cad9c95 LP |
1118 | <sect2> |
1119 | <title>Output Polling</title> | |
1120 | <synopsis>void (*output_poll_changed)(struct drm_device *dev);</synopsis> | |
1121 | <para> | |
1122 | This operation notifies the driver that the status of one or more | |
1123 | connectors has changed. Drivers that use the fb helper can just call the | |
1124 | <function>drm_fb_helper_hotplug_event</function> function to handle this | |
1125 | operation. | |
1126 | </para> | |
1127 | </sect2> | |
5d7a9515 DV |
1128 | <sect2> |
1129 | <title>Locking</title> | |
1130 | <para> | |
1131 | Beside some lookup structures with their own locking (which is hidden | |
1132 | behind the interface functions) most of the modeset state is protected | |
1133 | by the <code>dev-<mode_config.lock</code> mutex and additionally | |
1134 | per-crtc locks to allow cursor updates, pageflips and similar operations | |
1135 | to occur concurrently with background tasks like output detection. | |
1136 | Operations which cross domains like a full modeset always grab all | |
1137 | locks. Drivers there need to protect resources shared between crtcs with | |
1138 | additional locking. They also need to be careful to always grab the | |
1139 | relevant crtc locks if a modset functions touches crtc state, e.g. for | |
1140 | load detection (which does only grab the <code>mode_config.lock</code> | |
1141 | to allow concurrent screen updates on live crtcs). | |
1142 | </para> | |
1143 | </sect2> | |
9cad9c95 LP |
1144 | </sect1> |
1145 | ||
1146 | <!-- Internals: kms initialization and cleanup --> | |
1147 | ||
1148 | <sect1 id="drm-kms-init"> | |
1149 | <title>KMS Initialization and Cleanup</title> | |
1150 | <para> | |
1151 | A KMS device is abstracted and exposed as a set of planes, CRTCs, encoders | |
1152 | and connectors. KMS drivers must thus create and initialize all those | |
1153 | objects at load time after initializing mode setting. | |
1154 | </para> | |
1155 | <sect2> | |
1156 | <title>CRTCs (struct <structname>drm_crtc</structname>)</title> | |
1157 | <para> | |
1158 | A CRTC is an abstraction representing a part of the chip that contains a | |
1159 | pointer to a scanout buffer. Therefore, the number of CRTCs available | |
1160 | determines how many independent scanout buffers can be active at any | |
1161 | given time. The CRTC structure contains several fields to support this: | |
1162 | a pointer to some video memory (abstracted as a frame buffer object), a | |
1163 | display mode, and an (x, y) offset into the video memory to support | |
1164 | panning or configurations where one piece of video memory spans multiple | |
1165 | CRTCs. | |
2d2ef822 JB |
1166 | </para> |
1167 | <sect3> | |
9cad9c95 LP |
1168 | <title>CRTC Initialization</title> |
1169 | <para> | |
1170 | A KMS device must create and register at least one struct | |
1171 | <structname>drm_crtc</structname> instance. The instance is allocated | |
1172 | and zeroed by the driver, possibly as part of a larger structure, and | |
1173 | registered with a call to <function>drm_crtc_init</function> with a | |
1174 | pointer to CRTC functions. | |
1175 | </para> | |
1176 | </sect3> | |
9cad9c95 LP |
1177 | </sect2> |
1178 | <sect2> | |
1179 | <title>Planes (struct <structname>drm_plane</structname>)</title> | |
1180 | <para> | |
1181 | A plane represents an image source that can be blended with or overlayed | |
1182 | on top of a CRTC during the scanout process. Planes are associated with | |
1183 | a frame buffer to crop a portion of the image memory (source) and | |
1184 | optionally scale it to a destination size. The result is then blended | |
1185 | with or overlayed on top of a CRTC. | |
1186 | </para> | |
6efa1f2f MR |
1187 | <para> |
1188 | The DRM core recognizes three types of planes: | |
1189 | <itemizedlist> | |
1190 | <listitem> | |
1191 | DRM_PLANE_TYPE_PRIMARY represents a "main" plane for a CRTC. Primary | |
ef21bf73 | 1192 | planes are the planes operated upon by CRTC modesetting and flipping |
f6da8c6e | 1193 | operations described in the page_flip hook in <structname>drm_crtc_funcs</structname>. |
6efa1f2f MR |
1194 | </listitem> |
1195 | <listitem> | |
1196 | DRM_PLANE_TYPE_CURSOR represents a "cursor" plane for a CRTC. Cursor | |
1197 | planes are the planes operated upon by the DRM_IOCTL_MODE_CURSOR and | |
1198 | DRM_IOCTL_MODE_CURSOR2 ioctls. | |
1199 | </listitem> | |
1200 | <listitem> | |
1201 | DRM_PLANE_TYPE_OVERLAY represents all non-primary, non-cursor planes. | |
1202 | Some drivers refer to these types of planes as "sprites" internally. | |
1203 | </listitem> | |
1204 | </itemizedlist> | |
1205 | For compatibility with legacy userspace, only overlay planes are made | |
1206 | available to userspace by default. Userspace clients may set the | |
1207 | DRM_CLIENT_CAP_UNIVERSAL_PLANES client capability bit to indicate that | |
1208 | they wish to receive a universal plane list containing all plane types. | |
1209 | </para> | |
9cad9c95 LP |
1210 | <sect3> |
1211 | <title>Plane Initialization</title> | |
1212 | <para> | |
6efa1f2f | 1213 | To create a plane, a KMS drivers allocates and |
9cad9c95 LP |
1214 | zeroes an instances of struct <structname>drm_plane</structname> |
1215 | (possibly as part of a larger structure) and registers it with a call | |
6efa1f2f | 1216 | to <function>drm_universal_plane_init</function>. The function takes a bitmask |
9cad9c95 | 1217 | of the CRTCs that can be associated with the plane, a pointer to the |
6efa1f2f MR |
1218 | plane functions, a list of format supported formats, and the type of |
1219 | plane (primary, cursor, or overlay) being initialized. | |
1220 | </para> | |
1221 | <para> | |
1222 | Cursor and overlay planes are optional. All drivers should provide | |
1223 | one primary plane per CRTC (although this requirement may change in | |
1224 | the future); drivers that do not wish to provide special handling for | |
1225 | primary planes may make use of the helper functions described in | |
1226 | <xref linkend="drm-kms-planehelpers"/> to create and register a | |
1227 | primary plane with standard capabilities. | |
9cad9c95 LP |
1228 | </para> |
1229 | </sect3> | |
9cad9c95 LP |
1230 | </sect2> |
1231 | <sect2> | |
1232 | <title>Encoders (struct <structname>drm_encoder</structname>)</title> | |
1233 | <para> | |
1234 | An encoder takes pixel data from a CRTC and converts it to a format | |
1235 | suitable for any attached connectors. On some devices, it may be | |
1236 | possible to have a CRTC send data to more than one encoder. In that | |
1237 | case, both encoders would receive data from the same scanout buffer, | |
1238 | resulting in a "cloned" display configuration across the connectors | |
1239 | attached to each encoder. | |
1240 | </para> | |
1241 | <sect3> | |
1242 | <title>Encoder Initialization</title> | |
1243 | <para> | |
1244 | As for CRTCs, a KMS driver must create, initialize and register at | |
1245 | least one struct <structname>drm_encoder</structname> instance. The | |
1246 | instance is allocated and zeroed by the driver, possibly as part of a | |
1247 | larger structure. | |
1248 | </para> | |
1249 | <para> | |
1250 | Drivers must initialize the struct <structname>drm_encoder</structname> | |
1251 | <structfield>possible_crtcs</structfield> and | |
1252 | <structfield>possible_clones</structfield> fields before registering the | |
1253 | encoder. Both fields are bitmasks of respectively the CRTCs that the | |
1254 | encoder can be connected to, and sibling encoders candidate for cloning. | |
1255 | </para> | |
1256 | <para> | |
1257 | After being initialized, the encoder must be registered with a call to | |
1258 | <function>drm_encoder_init</function>. The function takes a pointer to | |
1259 | the encoder functions and an encoder type. Supported types are | |
1260 | <itemizedlist> | |
1261 | <listitem> | |
1262 | DRM_MODE_ENCODER_DAC for VGA and analog on DVI-I/DVI-A | |
1263 | </listitem> | |
1264 | <listitem> | |
1265 | DRM_MODE_ENCODER_TMDS for DVI, HDMI and (embedded) DisplayPort | |
1266 | </listitem> | |
1267 | <listitem> | |
1268 | DRM_MODE_ENCODER_LVDS for display panels | |
1269 | </listitem> | |
1270 | <listitem> | |
1271 | DRM_MODE_ENCODER_TVDAC for TV output (Composite, S-Video, Component, | |
1272 | SCART) | |
1273 | </listitem> | |
1274 | <listitem> | |
1275 | DRM_MODE_ENCODER_VIRTUAL for virtual machine displays | |
1276 | </listitem> | |
1277 | </itemizedlist> | |
1278 | </para> | |
1279 | <para> | |
1280 | Encoders must be attached to a CRTC to be used. DRM drivers leave | |
1281 | encoders unattached at initialization time. Applications (or the fbdev | |
1282 | compatibility layer when implemented) are responsible for attaching the | |
1283 | encoders they want to use to a CRTC. | |
1284 | </para> | |
1285 | </sect3> | |
9cad9c95 LP |
1286 | </sect2> |
1287 | <sect2> | |
1288 | <title>Connectors (struct <structname>drm_connector</structname>)</title> | |
1289 | <para> | |
1290 | A connector is the final destination for pixel data on a device, and | |
1291 | usually connects directly to an external display device like a monitor | |
1292 | or laptop panel. A connector can only be attached to one encoder at a | |
1293 | time. The connector is also the structure where information about the | |
1294 | attached display is kept, so it contains fields for display data, EDID | |
1295 | data, DPMS & connection status, and information about modes | |
1296 | supported on the attached displays. | |
1297 | </para> | |
1298 | <sect3> | |
1299 | <title>Connector Initialization</title> | |
1300 | <para> | |
1301 | Finally a KMS driver must create, initialize, register and attach at | |
1302 | least one struct <structname>drm_connector</structname> instance. The | |
1303 | instance is created as other KMS objects and initialized by setting the | |
1304 | following fields. | |
1305 | </para> | |
1306 | <variablelist> | |
1307 | <varlistentry> | |
1308 | <term><structfield>interlace_allowed</structfield></term> | |
1309 | <listitem><para> | |
1310 | Whether the connector can handle interlaced modes. | |
1311 | </para></listitem> | |
1312 | </varlistentry> | |
1313 | <varlistentry> | |
1314 | <term><structfield>doublescan_allowed</structfield></term> | |
1315 | <listitem><para> | |
1316 | Whether the connector can handle doublescan. | |
1317 | </para></listitem> | |
1318 | </varlistentry> | |
1319 | <varlistentry> | |
1320 | <term><structfield>display_info | |
1321 | </structfield></term> | |
1322 | <listitem><para> | |
1323 | Display information is filled from EDID information when a display | |
1324 | is detected. For non hot-pluggable displays such as flat panels in | |
1325 | embedded systems, the driver should initialize the | |
1326 | <structfield>display_info</structfield>.<structfield>width_mm</structfield> | |
1327 | and | |
1328 | <structfield>display_info</structfield>.<structfield>height_mm</structfield> | |
1329 | fields with the physical size of the display. | |
1330 | </para></listitem> | |
1331 | </varlistentry> | |
1332 | <varlistentry> | |
1333 | <term id="drm-kms-connector-polled"><structfield>polled</structfield></term> | |
1334 | <listitem><para> | |
1335 | Connector polling mode, a combination of | |
1336 | <variablelist> | |
1337 | <varlistentry> | |
1338 | <term>DRM_CONNECTOR_POLL_HPD</term> | |
1339 | <listitem><para> | |
1340 | The connector generates hotplug events and doesn't need to be | |
1341 | periodically polled. The CONNECT and DISCONNECT flags must not | |
1342 | be set together with the HPD flag. | |
1343 | </para></listitem> | |
1344 | </varlistentry> | |
1345 | <varlistentry> | |
1346 | <term>DRM_CONNECTOR_POLL_CONNECT</term> | |
1347 | <listitem><para> | |
1348 | Periodically poll the connector for connection. | |
1349 | </para></listitem> | |
1350 | </varlistentry> | |
1351 | <varlistentry> | |
1352 | <term>DRM_CONNECTOR_POLL_DISCONNECT</term> | |
1353 | <listitem><para> | |
1354 | Periodically poll the connector for disconnection. | |
1355 | </para></listitem> | |
1356 | </varlistentry> | |
1357 | </variablelist> | |
1358 | Set to 0 for connectors that don't support connection status | |
1359 | discovery. | |
1360 | </para></listitem> | |
1361 | </varlistentry> | |
1362 | </variablelist> | |
1363 | <para> | |
1364 | The connector is then registered with a call to | |
1365 | <function>drm_connector_init</function> with a pointer to the connector | |
1366 | functions and a connector type, and exposed through sysfs with a call to | |
34ea3d38 | 1367 | <function>drm_connector_register</function>. |
9cad9c95 LP |
1368 | </para> |
1369 | <para> | |
1370 | Supported connector types are | |
1371 | <itemizedlist> | |
1372 | <listitem>DRM_MODE_CONNECTOR_VGA</listitem> | |
1373 | <listitem>DRM_MODE_CONNECTOR_DVII</listitem> | |
1374 | <listitem>DRM_MODE_CONNECTOR_DVID</listitem> | |
1375 | <listitem>DRM_MODE_CONNECTOR_DVIA</listitem> | |
1376 | <listitem>DRM_MODE_CONNECTOR_Composite</listitem> | |
1377 | <listitem>DRM_MODE_CONNECTOR_SVIDEO</listitem> | |
1378 | <listitem>DRM_MODE_CONNECTOR_LVDS</listitem> | |
1379 | <listitem>DRM_MODE_CONNECTOR_Component</listitem> | |
1380 | <listitem>DRM_MODE_CONNECTOR_9PinDIN</listitem> | |
1381 | <listitem>DRM_MODE_CONNECTOR_DisplayPort</listitem> | |
1382 | <listitem>DRM_MODE_CONNECTOR_HDMIA</listitem> | |
1383 | <listitem>DRM_MODE_CONNECTOR_HDMIB</listitem> | |
1384 | <listitem>DRM_MODE_CONNECTOR_TV</listitem> | |
1385 | <listitem>DRM_MODE_CONNECTOR_eDP</listitem> | |
1386 | <listitem>DRM_MODE_CONNECTOR_VIRTUAL</listitem> | |
1387 | </itemizedlist> | |
1388 | </para> | |
1389 | <para> | |
1390 | Connectors must be attached to an encoder to be used. For devices that | |
1391 | map connectors to encoders 1:1, the connector should be attached at | |
1392 | initialization time with a call to | |
1393 | <function>drm_mode_connector_attach_encoder</function>. The driver must | |
1394 | also set the <structname>drm_connector</structname> | |
1395 | <structfield>encoder</structfield> field to point to the attached | |
1396 | encoder. | |
1397 | </para> | |
1398 | <para> | |
1399 | Finally, drivers must initialize the connectors state change detection | |
1400 | with a call to <function>drm_kms_helper_poll_init</function>. If at | |
1401 | least one connector is pollable but can't generate hotplug interrupts | |
1402 | (indicated by the DRM_CONNECTOR_POLL_CONNECT and | |
1403 | DRM_CONNECTOR_POLL_DISCONNECT connector flags), a delayed work will | |
1404 | automatically be queued to periodically poll for changes. Connectors | |
1405 | that can generate hotplug interrupts must be marked with the | |
1406 | DRM_CONNECTOR_POLL_HPD flag instead, and their interrupt handler must | |
1407 | call <function>drm_helper_hpd_irq_event</function>. The function will | |
1408 | queue a delayed work to check the state of all connectors, but no | |
1409 | periodic polling will be done. | |
1410 | </para> | |
1411 | </sect3> | |
1412 | <sect3> | |
1413 | <title>Connector Operations</title> | |
1414 | <note><para> | |
1415 | Unless otherwise state, all operations are mandatory. | |
1416 | </para></note> | |
1417 | <sect4> | |
1418 | <title>DPMS</title> | |
1419 | <synopsis>void (*dpms)(struct drm_connector *connector, int mode);</synopsis> | |
1420 | <para> | |
1421 | The DPMS operation sets the power state of a connector. The mode | |
1422 | argument is one of | |
1423 | <itemizedlist> | |
1424 | <listitem><para>DRM_MODE_DPMS_ON</para></listitem> | |
1425 | <listitem><para>DRM_MODE_DPMS_STANDBY</para></listitem> | |
1426 | <listitem><para>DRM_MODE_DPMS_SUSPEND</para></listitem> | |
1427 | <listitem><para>DRM_MODE_DPMS_OFF</para></listitem> | |
1428 | </itemizedlist> | |
1429 | </para> | |
1430 | <para> | |
1431 | In all but DPMS_ON mode the encoder to which the connector is attached | |
1432 | should put the display in low-power mode by driving its signals | |
1433 | appropriately. If more than one connector is attached to the encoder | |
1434 | care should be taken not to change the power state of other displays as | |
1435 | a side effect. Low-power mode should be propagated to the encoders and | |
1436 | CRTCs when all related connectors are put in low-power mode. | |
1437 | </para> | |
1438 | </sect4> | |
1439 | <sect4> | |
1440 | <title>Modes</title> | |
1441 | <synopsis>int (*fill_modes)(struct drm_connector *connector, uint32_t max_width, | |
1442 | uint32_t max_height);</synopsis> | |
1443 | <para> | |
1444 | Fill the mode list with all supported modes for the connector. If the | |
1445 | <parameter>max_width</parameter> and <parameter>max_height</parameter> | |
1446 | arguments are non-zero, the implementation must ignore all modes wider | |
1447 | than <parameter>max_width</parameter> or higher than | |
1448 | <parameter>max_height</parameter>. | |
1449 | </para> | |
1450 | <para> | |
1451 | The connector must also fill in this operation its | |
1452 | <structfield>display_info</structfield> | |
1453 | <structfield>width_mm</structfield> and | |
1454 | <structfield>height_mm</structfield> fields with the connected display | |
1455 | physical size in millimeters. The fields should be set to 0 if the value | |
1456 | isn't known or is not applicable (for instance for projector devices). | |
1457 | </para> | |
1458 | </sect4> | |
1459 | <sect4> | |
1460 | <title>Connection Status</title> | |
1461 | <para> | |
1462 | The connection status is updated through polling or hotplug events when | |
1463 | supported (see <xref linkend="drm-kms-connector-polled"/>). The status | |
1464 | value is reported to userspace through ioctls and must not be used | |
1465 | inside the driver, as it only gets initialized by a call to | |
1466 | <function>drm_mode_getconnector</function> from userspace. | |
1467 | </para> | |
1468 | <synopsis>enum drm_connector_status (*detect)(struct drm_connector *connector, | |
1469 | bool force);</synopsis> | |
1470 | <para> | |
1471 | Check to see if anything is attached to the connector. The | |
1472 | <parameter>force</parameter> parameter is set to false whilst polling or | |
1473 | to true when checking the connector due to user request. | |
1474 | <parameter>force</parameter> can be used by the driver to avoid | |
1475 | expensive, destructive operations during automated probing. | |
1476 | </para> | |
1477 | <para> | |
1478 | Return connector_status_connected if something is connected to the | |
1479 | connector, connector_status_disconnected if nothing is connected and | |
1480 | connector_status_unknown if the connection state isn't known. | |
1481 | </para> | |
1482 | <para> | |
1483 | Drivers should only return connector_status_connected if the connection | |
1484 | status has really been probed as connected. Connectors that can't detect | |
1485 | the connection status, or failed connection status probes, should return | |
1486 | connector_status_unknown. | |
1487 | </para> | |
1488 | </sect4> | |
9cad9c95 LP |
1489 | </sect3> |
1490 | </sect2> | |
1491 | <sect2> | |
1492 | <title>Cleanup</title> | |
1493 | <para> | |
1494 | The DRM core manages its objects' lifetime. When an object is not needed | |
1495 | anymore the core calls its destroy function, which must clean up and | |
1496 | free every resource allocated for the object. Every | |
1497 | <function>drm_*_init</function> call must be matched with a | |
1498 | corresponding <function>drm_*_cleanup</function> call to cleanup CRTCs | |
1499 | (<function>drm_crtc_cleanup</function>), planes | |
1500 | (<function>drm_plane_cleanup</function>), encoders | |
1501 | (<function>drm_encoder_cleanup</function>) and connectors | |
1502 | (<function>drm_connector_cleanup</function>). Furthermore, connectors | |
1503 | that have been added to sysfs must be removed by a call to | |
34ea3d38 | 1504 | <function>drm_connector_unregister</function> before calling |
9cad9c95 LP |
1505 | <function>drm_connector_cleanup</function>. |
1506 | </para> | |
1507 | <para> | |
1508 | Connectors state change detection must be cleanup up with a call to | |
1509 | <function>drm_kms_helper_poll_fini</function>. | |
1510 | </para> | |
1511 | </sect2> | |
1512 | <sect2> | |
1513 | <title>Output discovery and initialization example</title> | |
1514 | <programlisting><![CDATA[ | |
2d2ef822 JB |
1515 | void intel_crt_init(struct drm_device *dev) |
1516 | { | |
1517 | struct drm_connector *connector; | |
1518 | struct intel_output *intel_output; | |
1519 | ||
1520 | intel_output = kzalloc(sizeof(struct intel_output), GFP_KERNEL); | |
1521 | if (!intel_output) | |
1522 | return; | |
1523 | ||
1524 | connector = &intel_output->base; | |
1525 | drm_connector_init(dev, &intel_output->base, | |
1526 | &intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA); | |
1527 | ||
1528 | drm_encoder_init(dev, &intel_output->enc, &intel_crt_enc_funcs, | |
1529 | DRM_MODE_ENCODER_DAC); | |
1530 | ||
1531 | drm_mode_connector_attach_encoder(&intel_output->base, | |
1532 | &intel_output->enc); | |
1533 | ||
1534 | /* Set up the DDC bus. */ | |
1535 | intel_output->ddc_bus = intel_i2c_create(dev, GPIOA, "CRTDDC_A"); | |
1536 | if (!intel_output->ddc_bus) { | |
1537 | dev_printk(KERN_ERR, &dev->pdev->dev, "DDC bus registration " | |
1538 | "failed.\n"); | |
1539 | return; | |
1540 | } | |
1541 | ||
1542 | intel_output->type = INTEL_OUTPUT_ANALOG; | |
1543 | connector->interlace_allowed = 0; | |
1544 | connector->doublescan_allowed = 0; | |
1545 | ||
1546 | drm_encoder_helper_add(&intel_output->enc, &intel_crt_helper_funcs); | |
1547 | drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs); | |
1548 | ||
34ea3d38 | 1549 | drm_connector_register(connector); |
9cad9c95 LP |
1550 | }]]></programlisting> |
1551 | <para> | |
1552 | In the example above (taken from the i915 driver), a CRTC, connector and | |
1553 | encoder combination is created. A device-specific i2c bus is also | |
1554 | created for fetching EDID data and performing monitor detection. Once | |
1555 | the process is complete, the new connector is registered with sysfs to | |
1556 | make its properties available to applications. | |
1557 | </para> | |
2d2ef822 | 1558 | </sect2> |
065a50ed DV |
1559 | <sect2> |
1560 | <title>KMS API Functions</title> | |
1561 | !Edrivers/gpu/drm/drm_crtc.c | |
3bf0401c DV |
1562 | </sect2> |
1563 | <sect2> | |
1564 | <title>KMS Data Structures</title> | |
1565 | !Iinclude/drm/drm_crtc.h | |
065a50ed | 1566 | </sect2> |
51fd371b RC |
1567 | <sect2> |
1568 | <title>KMS Locking</title> | |
1569 | !Pdrivers/gpu/drm/drm_modeset_lock.c kms locking | |
1570 | !Iinclude/drm/drm_modeset_lock.h | |
1571 | !Edrivers/gpu/drm/drm_modeset_lock.c | |
1572 | </sect2> | |
2d2ef822 JB |
1573 | </sect1> |
1574 | ||
e4949f29 | 1575 | <!-- Internals: kms helper functions --> |
2d2ef822 JB |
1576 | |
1577 | <sect1> | |
e4949f29 | 1578 | <title>Mode Setting Helper Functions</title> |
2d2ef822 | 1579 | <para> |
6efa1f2f | 1580 | The plane, CRTC, encoder and connector functions provided by the drivers |
9cad9c95 LP |
1581 | implement the DRM API. They're called by the DRM core and ioctl handlers |
1582 | to handle device state changes and configuration request. As implementing | |
1583 | those functions often requires logic not specific to drivers, mid-layer | |
1584 | helper functions are available to avoid duplicating boilerplate code. | |
1585 | </para> | |
1586 | <para> | |
1587 | The DRM core contains one mid-layer implementation. The mid-layer provides | |
6efa1f2f MR |
1588 | implementations of several plane, CRTC, encoder and connector functions |
1589 | (called from the top of the mid-layer) that pre-process requests and call | |
9cad9c95 LP |
1590 | lower-level functions provided by the driver (at the bottom of the |
1591 | mid-layer). For instance, the | |
1592 | <function>drm_crtc_helper_set_config</function> function can be used to | |
1593 | fill the struct <structname>drm_crtc_funcs</structname> | |
1594 | <structfield>set_config</structfield> field. When called, it will split | |
1595 | the <methodname>set_config</methodname> operation in smaller, simpler | |
1596 | operations and call the driver to handle them. | |
2d2ef822 | 1597 | </para> |
2d2ef822 | 1598 | <para> |
9cad9c95 LP |
1599 | To use the mid-layer, drivers call <function>drm_crtc_helper_add</function>, |
1600 | <function>drm_encoder_helper_add</function> and | |
1601 | <function>drm_connector_helper_add</function> functions to install their | |
1602 | mid-layer bottom operations handlers, and fill the | |
1603 | <structname>drm_crtc_funcs</structname>, | |
1604 | <structname>drm_encoder_funcs</structname> and | |
1605 | <structname>drm_connector_funcs</structname> structures with pointers to | |
1606 | the mid-layer top API functions. Installing the mid-layer bottom operation | |
1607 | handlers is best done right after registering the corresponding KMS object. | |
2d2ef822 JB |
1608 | </para> |
1609 | <para> | |
9cad9c95 LP |
1610 | The mid-layer is not split between CRTC, encoder and connector operations. |
1611 | To use it, a driver must provide bottom functions for all of the three KMS | |
1612 | entities. | |
2d2ef822 | 1613 | </para> |
9cad9c95 | 1614 | <sect2> |
2be94971 | 1615 | <title>Legacy CRTC Helper Operations</title> |
9cad9c95 LP |
1616 | <itemizedlist> |
1617 | <listitem id="drm-helper-crtc-mode-fixup"> | |
1618 | <synopsis>bool (*mode_fixup)(struct drm_crtc *crtc, | |
1619 | const struct drm_display_mode *mode, | |
1620 | struct drm_display_mode *adjusted_mode);</synopsis> | |
1621 | <para> | |
1622 | Let CRTCs adjust the requested mode or reject it completely. This | |
1623 | operation returns true if the mode is accepted (possibly after being | |
1624 | adjusted) or false if it is rejected. | |
1625 | </para> | |
1626 | <para> | |
1627 | The <methodname>mode_fixup</methodname> operation should reject the | |
1628 | mode if it can't reasonably use it. The definition of "reasonable" | |
1629 | is currently fuzzy in this context. One possible behaviour would be | |
1630 | to set the adjusted mode to the panel timings when a fixed-mode | |
1631 | panel is used with hardware capable of scaling. Another behaviour | |
1632 | would be to accept any input mode and adjust it to the closest mode | |
1633 | supported by the hardware (FIXME: This needs to be clarified). | |
1634 | </para> | |
1635 | </listitem> | |
1636 | <listitem> | |
1637 | <synopsis>int (*mode_set_base)(struct drm_crtc *crtc, int x, int y, | |
1638 | struct drm_framebuffer *old_fb)</synopsis> | |
1639 | <para> | |
1640 | Move the CRTC on the current frame buffer (stored in | |
1641 | <literal>crtc->fb</literal>) to position (x,y). Any of the frame | |
1642 | buffer, x position or y position may have been modified. | |
1643 | </para> | |
1644 | <para> | |
1645 | This helper operation is optional. If not provided, the | |
1646 | <function>drm_crtc_helper_set_config</function> function will fall | |
1647 | back to the <methodname>mode_set</methodname> helper operation. | |
1648 | </para> | |
1649 | <note><para> | |
1650 | FIXME: Why are x and y passed as arguments, as they can be accessed | |
1651 | through <literal>crtc->x</literal> and | |
1652 | <literal>crtc->y</literal>? | |
1653 | </para></note> | |
1654 | </listitem> | |
1655 | <listitem> | |
1656 | <synopsis>void (*prepare)(struct drm_crtc *crtc);</synopsis> | |
1657 | <para> | |
1658 | Prepare the CRTC for mode setting. This operation is called after | |
1659 | validating the requested mode. Drivers use it to perform | |
1660 | device-specific operations required before setting the new mode. | |
1661 | </para> | |
1662 | </listitem> | |
1663 | <listitem> | |
1664 | <synopsis>int (*mode_set)(struct drm_crtc *crtc, struct drm_display_mode *mode, | |
1665 | struct drm_display_mode *adjusted_mode, int x, int y, | |
1666 | struct drm_framebuffer *old_fb);</synopsis> | |
1667 | <para> | |
1668 | Set a new mode, position and frame buffer. Depending on the device | |
1669 | requirements, the mode can be stored internally by the driver and | |
1670 | applied in the <methodname>commit</methodname> operation, or | |
1671 | programmed to the hardware immediately. | |
1672 | </para> | |
1673 | <para> | |
1674 | The <methodname>mode_set</methodname> operation returns 0 on success | |
1675 | or a negative error code if an error occurs. | |
1676 | </para> | |
1677 | </listitem> | |
1678 | <listitem> | |
1679 | <synopsis>void (*commit)(struct drm_crtc *crtc);</synopsis> | |
1680 | <para> | |
1681 | Commit a mode. This operation is called after setting the new mode. | |
1682 | Upon return the device must use the new mode and be fully | |
1683 | operational. | |
1684 | </para> | |
1685 | </listitem> | |
1686 | </itemizedlist> | |
1687 | </sect2> | |
1688 | <sect2> | |
1689 | <title>Encoder Helper Operations</title> | |
1690 | <itemizedlist> | |
1691 | <listitem> | |
1692 | <synopsis>bool (*mode_fixup)(struct drm_encoder *encoder, | |
1693 | const struct drm_display_mode *mode, | |
1694 | struct drm_display_mode *adjusted_mode);</synopsis> | |
9cad9c95 LP |
1695 | <para> |
1696 | Let encoders adjust the requested mode or reject it completely. This | |
1697 | operation returns true if the mode is accepted (possibly after being | |
1698 | adjusted) or false if it is rejected. See the | |
1699 | <link linkend="drm-helper-crtc-mode-fixup">mode_fixup CRTC helper | |
1700 | operation</link> for an explanation of the allowed adjustments. | |
1701 | </para> | |
1702 | </listitem> | |
1703 | <listitem> | |
1704 | <synopsis>void (*prepare)(struct drm_encoder *encoder);</synopsis> | |
1705 | <para> | |
1706 | Prepare the encoder for mode setting. This operation is called after | |
1707 | validating the requested mode. Drivers use it to perform | |
1708 | device-specific operations required before setting the new mode. | |
1709 | </para> | |
1710 | </listitem> | |
1711 | <listitem> | |
1712 | <synopsis>void (*mode_set)(struct drm_encoder *encoder, | |
1713 | struct drm_display_mode *mode, | |
1714 | struct drm_display_mode *adjusted_mode);</synopsis> | |
1715 | <para> | |
1716 | Set a new mode. Depending on the device requirements, the mode can | |
1717 | be stored internally by the driver and applied in the | |
1718 | <methodname>commit</methodname> operation, or programmed to the | |
1719 | hardware immediately. | |
1720 | </para> | |
1721 | </listitem> | |
1722 | <listitem> | |
1723 | <synopsis>void (*commit)(struct drm_encoder *encoder);</synopsis> | |
1724 | <para> | |
1725 | Commit a mode. This operation is called after setting the new mode. | |
1726 | Upon return the device must use the new mode and be fully | |
1727 | operational. | |
1728 | </para> | |
1729 | </listitem> | |
1730 | </itemizedlist> | |
1731 | </sect2> | |
1732 | <sect2> | |
1733 | <title>Connector Helper Operations</title> | |
1734 | <itemizedlist> | |
1735 | <listitem> | |
1736 | <synopsis>struct drm_encoder *(*best_encoder)(struct drm_connector *connector);</synopsis> | |
1737 | <para> | |
1738 | Return a pointer to the best encoder for the connecter. Device that | |
1739 | map connectors to encoders 1:1 simply return the pointer to the | |
1740 | associated encoder. This operation is mandatory. | |
1741 | </para> | |
1742 | </listitem> | |
1743 | <listitem> | |
1744 | <synopsis>int (*get_modes)(struct drm_connector *connector);</synopsis> | |
1745 | <para> | |
1746 | Fill the connector's <structfield>probed_modes</structfield> list | |
f41c2581 LP |
1747 | by parsing EDID data with <function>drm_add_edid_modes</function>, |
1748 | adding standard VESA DMT modes with <function>drm_add_modes_noedid</function>, | |
1749 | or calling <function>drm_mode_probed_add</function> directly for every | |
9cad9c95 LP |
1750 | supported mode and return the number of modes it has detected. This |
1751 | operation is mandatory. | |
1752 | </para> | |
f41c2581 LP |
1753 | <para> |
1754 | Note that the caller function will automatically add standard VESA | |
1755 | DMT modes up to 1024x768 if the <methodname>get_modes</methodname> | |
1756 | helper operation returns no mode and if the connector status is | |
1757 | connector_status_connected. There is no need to call | |
1758 | <function>drm_add_edid_modes</function> manually in that case. | |
1759 | </para> | |
9cad9c95 LP |
1760 | <para> |
1761 | When adding modes manually the driver creates each mode with a call to | |
1762 | <function>drm_mode_create</function> and must fill the following fields. | |
1763 | <itemizedlist> | |
1764 | <listitem> | |
1765 | <synopsis>__u32 type;</synopsis> | |
1766 | <para> | |
1767 | Mode type bitmask, a combination of | |
1768 | <variablelist> | |
1769 | <varlistentry> | |
1770 | <term>DRM_MODE_TYPE_BUILTIN</term> | |
1771 | <listitem><para>not used?</para></listitem> | |
1772 | </varlistentry> | |
1773 | <varlistentry> | |
1774 | <term>DRM_MODE_TYPE_CLOCK_C</term> | |
1775 | <listitem><para>not used?</para></listitem> | |
1776 | </varlistentry> | |
1777 | <varlistentry> | |
1778 | <term>DRM_MODE_TYPE_CRTC_C</term> | |
1779 | <listitem><para>not used?</para></listitem> | |
1780 | </varlistentry> | |
1781 | <varlistentry> | |
1782 | <term> | |
1783 | DRM_MODE_TYPE_PREFERRED - The preferred mode for the connector | |
1784 | </term> | |
1785 | <listitem> | |
1786 | <para>not used?</para> | |
1787 | </listitem> | |
1788 | </varlistentry> | |
1789 | <varlistentry> | |
1790 | <term>DRM_MODE_TYPE_DEFAULT</term> | |
1791 | <listitem><para>not used?</para></listitem> | |
1792 | </varlistentry> | |
1793 | <varlistentry> | |
1794 | <term>DRM_MODE_TYPE_USERDEF</term> | |
1795 | <listitem><para>not used?</para></listitem> | |
1796 | </varlistentry> | |
1797 | <varlistentry> | |
1798 | <term>DRM_MODE_TYPE_DRIVER</term> | |
1799 | <listitem> | |
1800 | <para> | |
1801 | The mode has been created by the driver (as opposed to | |
1802 | to user-created modes). | |
1803 | </para> | |
1804 | </listitem> | |
1805 | </varlistentry> | |
1806 | </variablelist> | |
1807 | Drivers must set the DRM_MODE_TYPE_DRIVER bit for all modes they | |
1808 | create, and set the DRM_MODE_TYPE_PREFERRED bit for the preferred | |
1809 | mode. | |
1810 | </para> | |
1811 | </listitem> | |
1812 | <listitem> | |
1813 | <synopsis>__u32 clock;</synopsis> | |
1814 | <para>Pixel clock frequency in kHz unit</para> | |
1815 | </listitem> | |
1816 | <listitem> | |
1817 | <synopsis>__u16 hdisplay, hsync_start, hsync_end, htotal; | |
1818 | __u16 vdisplay, vsync_start, vsync_end, vtotal;</synopsis> | |
1819 | <para>Horizontal and vertical timing information</para> | |
1820 | <screen><![CDATA[ | |
1821 | Active Front Sync Back | |
1822 | Region Porch Porch | |
1823 | <-----------------------><----------------><-------------><--------------> | |
1824 | ||
1825 | //////////////////////| | |
1826 | ////////////////////// | | |
1827 | ////////////////////// |.................. ................ | |
1828 | _______________ | |
1829 | ||
1830 | <----- [hv]display -----> | |
1831 | <------------- [hv]sync_start ------------> | |
1832 | <--------------------- [hv]sync_end ---------------------> | |
1833 | <-------------------------------- [hv]total -----------------------------> | |
1834 | ]]></screen> | |
1835 | </listitem> | |
1836 | <listitem> | |
1837 | <synopsis>__u16 hskew; | |
1838 | __u16 vscan;</synopsis> | |
1839 | <para>Unknown</para> | |
1840 | </listitem> | |
1841 | <listitem> | |
1842 | <synopsis>__u32 flags;</synopsis> | |
1843 | <para> | |
1844 | Mode flags, a combination of | |
1845 | <variablelist> | |
1846 | <varlistentry> | |
1847 | <term>DRM_MODE_FLAG_PHSYNC</term> | |
1848 | <listitem><para> | |
1849 | Horizontal sync is active high | |
1850 | </para></listitem> | |
1851 | </varlistentry> | |
1852 | <varlistentry> | |
1853 | <term>DRM_MODE_FLAG_NHSYNC</term> | |
1854 | <listitem><para> | |
1855 | Horizontal sync is active low | |
1856 | </para></listitem> | |
1857 | </varlistentry> | |
1858 | <varlistentry> | |
1859 | <term>DRM_MODE_FLAG_PVSYNC</term> | |
1860 | <listitem><para> | |
1861 | Vertical sync is active high | |
1862 | </para></listitem> | |
1863 | </varlistentry> | |
1864 | <varlistentry> | |
1865 | <term>DRM_MODE_FLAG_NVSYNC</term> | |
1866 | <listitem><para> | |
1867 | Vertical sync is active low | |
1868 | </para></listitem> | |
1869 | </varlistentry> | |
1870 | <varlistentry> | |
1871 | <term>DRM_MODE_FLAG_INTERLACE</term> | |
1872 | <listitem><para> | |
1873 | Mode is interlaced | |
1874 | </para></listitem> | |
1875 | </varlistentry> | |
1876 | <varlistentry> | |
1877 | <term>DRM_MODE_FLAG_DBLSCAN</term> | |
1878 | <listitem><para> | |
1879 | Mode uses doublescan | |
1880 | </para></listitem> | |
1881 | </varlistentry> | |
1882 | <varlistentry> | |
1883 | <term>DRM_MODE_FLAG_CSYNC</term> | |
1884 | <listitem><para> | |
1885 | Mode uses composite sync | |
1886 | </para></listitem> | |
1887 | </varlistentry> | |
1888 | <varlistentry> | |
1889 | <term>DRM_MODE_FLAG_PCSYNC</term> | |
1890 | <listitem><para> | |
1891 | Composite sync is active high | |
1892 | </para></listitem> | |
1893 | </varlistentry> | |
1894 | <varlistentry> | |
1895 | <term>DRM_MODE_FLAG_NCSYNC</term> | |
1896 | <listitem><para> | |
1897 | Composite sync is active low | |
1898 | </para></listitem> | |
1899 | </varlistentry> | |
1900 | <varlistentry> | |
1901 | <term>DRM_MODE_FLAG_HSKEW</term> | |
1902 | <listitem><para> | |
1903 | hskew provided (not used?) | |
1904 | </para></listitem> | |
1905 | </varlistentry> | |
1906 | <varlistentry> | |
1907 | <term>DRM_MODE_FLAG_BCAST</term> | |
1908 | <listitem><para> | |
1909 | not used? | |
1910 | </para></listitem> | |
1911 | </varlistentry> | |
1912 | <varlistentry> | |
1913 | <term>DRM_MODE_FLAG_PIXMUX</term> | |
1914 | <listitem><para> | |
1915 | not used? | |
1916 | </para></listitem> | |
1917 | </varlistentry> | |
1918 | <varlistentry> | |
1919 | <term>DRM_MODE_FLAG_DBLCLK</term> | |
1920 | <listitem><para> | |
1921 | not used? | |
1922 | </para></listitem> | |
1923 | </varlistentry> | |
1924 | <varlistentry> | |
1925 | <term>DRM_MODE_FLAG_CLKDIV2</term> | |
1926 | <listitem><para> | |
1927 | ? | |
1928 | </para></listitem> | |
1929 | </varlistentry> | |
1930 | </variablelist> | |
1931 | </para> | |
1932 | <para> | |
1933 | Note that modes marked with the INTERLACE or DBLSCAN flags will be | |
1934 | filtered out by | |
1935 | <function>drm_helper_probe_single_connector_modes</function> if | |
1936 | the connector's <structfield>interlace_allowed</structfield> or | |
1937 | <structfield>doublescan_allowed</structfield> field is set to 0. | |
1938 | </para> | |
1939 | </listitem> | |
1940 | <listitem> | |
1941 | <synopsis>char name[DRM_DISPLAY_MODE_LEN];</synopsis> | |
1942 | <para> | |
1943 | Mode name. The driver must call | |
1944 | <function>drm_mode_set_name</function> to fill the mode name from | |
1945 | <structfield>hdisplay</structfield>, | |
1946 | <structfield>vdisplay</structfield> and interlace flag after | |
1947 | filling the corresponding fields. | |
1948 | </para> | |
1949 | </listitem> | |
1950 | </itemizedlist> | |
1951 | </para> | |
1952 | <para> | |
1953 | The <structfield>vrefresh</structfield> value is computed by | |
1954 | <function>drm_helper_probe_single_connector_modes</function>. | |
1955 | </para> | |
1956 | <para> | |
f41c2581 | 1957 | When parsing EDID data, <function>drm_add_edid_modes</function> fills the |
9cad9c95 LP |
1958 | connector <structfield>display_info</structfield> |
1959 | <structfield>width_mm</structfield> and | |
1960 | <structfield>height_mm</structfield> fields. When creating modes | |
1961 | manually the <methodname>get_modes</methodname> helper operation must | |
1962 | set the <structfield>display_info</structfield> | |
1963 | <structfield>width_mm</structfield> and | |
1964 | <structfield>height_mm</structfield> fields if they haven't been set | |
065a5027 | 1965 | already (for instance at initialization time when a fixed-size panel is |
9cad9c95 LP |
1966 | attached to the connector). The mode <structfield>width_mm</structfield> |
1967 | and <structfield>height_mm</structfield> fields are only used internally | |
1968 | during EDID parsing and should not be set when creating modes manually. | |
1969 | </para> | |
1970 | </listitem> | |
1971 | <listitem> | |
1972 | <synopsis>int (*mode_valid)(struct drm_connector *connector, | |
1973 | struct drm_display_mode *mode);</synopsis> | |
1974 | <para> | |
1975 | Verify whether a mode is valid for the connector. Return MODE_OK for | |
1976 | supported modes and one of the enum drm_mode_status values (MODE_*) | |
f9b0e251 | 1977 | for unsupported modes. This operation is optional. |
9cad9c95 LP |
1978 | </para> |
1979 | <para> | |
1980 | As the mode rejection reason is currently not used beside for | |
1981 | immediately removing the unsupported mode, an implementation can | |
1982 | return MODE_BAD regardless of the exact reason why the mode is not | |
1983 | valid. | |
1984 | </para> | |
1985 | <note><para> | |
1986 | Note that the <methodname>mode_valid</methodname> helper operation is | |
1987 | only called for modes detected by the device, and | |
1988 | <emphasis>not</emphasis> for modes set by the user through the CRTC | |
1989 | <methodname>set_config</methodname> operation. | |
1990 | </para></note> | |
1991 | </listitem> | |
1992 | </itemizedlist> | |
1993 | </sect2> | |
3150c7d0 DV |
1994 | <sect2> |
1995 | <title>Atomic Modeset Helper Functions Reference</title> | |
1996 | <sect3> | |
1997 | <title>Overview</title> | |
1998 | !Pdrivers/gpu/drm/drm_atomic_helper.c overview | |
1999 | </sect3> | |
2000 | <sect3> | |
2001 | <title>Implementing Asynchronous Atomic Commit</title> | |
2002 | !Pdrivers/gpu/drm/drm_atomic_helper.c implementing async commit | |
2003 | </sect3> | |
2004 | <sect3> | |
2005 | <title>Atomic State Reset and Initialization</title> | |
2006 | !Pdrivers/gpu/drm/drm_atomic_helper.c atomic state reset and initialization | |
2007 | </sect3> | |
dd275956 | 2008 | !Iinclude/drm/drm_atomic_helper.h |
3150c7d0 | 2009 | !Edrivers/gpu/drm/drm_atomic_helper.c |
092d01da DV |
2010 | </sect2> |
2011 | <sect2> | |
2012 | <title>Modeset Helper Reference for Common Vtables</title> | |
2013 | !Iinclude/drm/drm_modeset_helper_vtables.h | |
2014 | !Pinclude/drm/drm_modeset_helper_vtables.h overview | |
3150c7d0 | 2015 | </sect2> |
0d4ed4c8 | 2016 | <sect2> |
2be94971 | 2017 | <title>Legacy CRTC/Modeset Helper Functions Reference</title> |
0d4ed4c8 | 2018 | !Edrivers/gpu/drm/drm_crtc_helper.c |
3150c7d0 | 2019 | !Pdrivers/gpu/drm/drm_crtc_helper.c overview |
8d754544 DV |
2020 | </sect2> |
2021 | <sect2> | |
2022 | <title>Output Probing Helper Functions Reference</title> | |
2023 | !Pdrivers/gpu/drm/drm_probe_helper.c output probing helper overview | |
2024 | !Edrivers/gpu/drm/drm_probe_helper.c | |
0d4ed4c8 | 2025 | </sect2> |
d0ddc033 DV |
2026 | <sect2> |
2027 | <title>fbdev Helper Functions Reference</title> | |
2028 | !Pdrivers/gpu/drm/drm_fb_helper.c fbdev helpers | |
2029 | !Edrivers/gpu/drm/drm_fb_helper.c | |
207fd329 | 2030 | !Iinclude/drm/drm_fb_helper.h |
d0ddc033 | 2031 | </sect2> |
28164fda DV |
2032 | <sect2> |
2033 | <title>Display Port Helper Functions Reference</title> | |
2034 | !Pdrivers/gpu/drm/drm_dp_helper.c dp helpers | |
2035 | !Iinclude/drm/drm_dp_helper.h | |
2036 | !Edrivers/gpu/drm/drm_dp_helper.c | |
ad7f8a1f DA |
2037 | </sect2> |
2038 | <sect2> | |
2039 | <title>Display Port MST Helper Functions Reference</title> | |
2040 | !Pdrivers/gpu/drm/drm_dp_mst_topology.c dp mst helper | |
2041 | !Iinclude/drm/drm_dp_mst_helper.h | |
2042 | !Edrivers/gpu/drm/drm_dp_mst_topology.c | |
009081e0 TR |
2043 | </sect2> |
2044 | <sect2> | |
2045 | <title>MIPI DSI Helper Functions Reference</title> | |
2046 | !Pdrivers/gpu/drm/drm_mipi_dsi.c dsi helpers | |
2047 | !Iinclude/drm/drm_mipi_dsi.h | |
2048 | !Edrivers/gpu/drm/drm_mipi_dsi.c | |
28164fda | 2049 | </sect2> |
5e308591 TR |
2050 | <sect2> |
2051 | <title>EDID Helper Functions Reference</title> | |
2052 | !Edrivers/gpu/drm/drm_edid.c | |
2053 | </sect2> | |
03973536 VS |
2054 | <sect2> |
2055 | <title>Rectangle Utilities Reference</title> | |
2056 | !Pinclude/drm/drm_rect.h rect utils | |
2057 | !Iinclude/drm/drm_rect.h | |
2058 | !Edrivers/gpu/drm/drm_rect.c | |
cabaafc7 RC |
2059 | </sect2> |
2060 | <sect2> | |
2061 | <title>Flip-work Helper Reference</title> | |
2062 | !Pinclude/drm/drm_flip_work.h flip utils | |
2063 | !Iinclude/drm/drm_flip_work.h | |
2064 | !Edrivers/gpu/drm/drm_flip_work.c | |
03973536 | 2065 | </sect2> |
2d123f46 DV |
2066 | <sect2> |
2067 | <title>HDMI Infoframes Helper Reference</title> | |
2068 | <para> | |
2069 | Strictly speaking this is not a DRM helper library but generally useable | |
2070 | by any driver interfacing with HDMI outputs like v4l or alsa drivers. | |
2071 | But it nicely fits into the overall topic of mode setting helper | |
2072 | libraries and hence is also included here. | |
2073 | </para> | |
2074 | !Iinclude/linux/hdmi.h | |
2075 | !Edrivers/video/hdmi.c | |
2076 | </sect2> | |
6efa1f2f MR |
2077 | <sect2> |
2078 | <title id="drm-kms-planehelpers">Plane Helper Reference</title> | |
3150c7d0 DV |
2079 | !Edrivers/gpu/drm/drm_plane_helper.c |
2080 | !Pdrivers/gpu/drm/drm_plane_helper.c overview | |
6efa1f2f | 2081 | </sect2> |
138f9ebb DA |
2082 | <sect2> |
2083 | <title>Tile group</title> | |
2084 | !Pdrivers/gpu/drm/drm_crtc.c Tile group | |
2085 | </sect2> | |
2331b4e4 AT |
2086 | <sect2> |
2087 | <title>Bridges</title> | |
2088 | <sect3> | |
2089 | <title>Overview</title> | |
2090 | !Pdrivers/gpu/drm/drm_bridge.c overview | |
2091 | </sect3> | |
2092 | <sect3> | |
2093 | <title>Default bridge callback sequence</title> | |
2094 | !Pdrivers/gpu/drm/drm_bridge.c bridge callbacks | |
2095 | </sect3> | |
2096 | !Edrivers/gpu/drm/drm_bridge.c | |
2097 | </sect2> | |
2d2ef822 JB |
2098 | </sect1> |
2099 | ||
421cda3e LP |
2100 | <!-- Internals: kms properties --> |
2101 | ||
2102 | <sect1 id="drm-kms-properties"> | |
2103 | <title>KMS Properties</title> | |
2104 | <para> | |
2105 | Drivers may need to expose additional parameters to applications than | |
2106 | those described in the previous sections. KMS supports attaching | |
2107 | properties to CRTCs, connectors and planes and offers a userspace API to | |
2108 | list, get and set the property values. | |
2109 | </para> | |
2110 | <para> | |
2111 | Properties are identified by a name that uniquely defines the property | |
2112 | purpose, and store an associated value. For all property types except blob | |
2113 | properties the value is a 64-bit unsigned integer. | |
2114 | </para> | |
2115 | <para> | |
2116 | KMS differentiates between properties and property instances. Drivers | |
2117 | first create properties and then create and associate individual instances | |
2118 | of those properties to objects. A property can be instantiated multiple | |
2119 | times and associated with different objects. Values are stored in property | |
9a6594fc | 2120 | instances, and all other property information are stored in the property |
421cda3e LP |
2121 | and shared between all instances of the property. |
2122 | </para> | |
2123 | <para> | |
2124 | Every property is created with a type that influences how the KMS core | |
2125 | handles the property. Supported property types are | |
2126 | <variablelist> | |
2127 | <varlistentry> | |
2128 | <term>DRM_MODE_PROP_RANGE</term> | |
2129 | <listitem><para>Range properties report their minimum and maximum | |
2130 | admissible values. The KMS core verifies that values set by | |
2131 | application fit in that range.</para></listitem> | |
2132 | </varlistentry> | |
2133 | <varlistentry> | |
2134 | <term>DRM_MODE_PROP_ENUM</term> | |
2135 | <listitem><para>Enumerated properties take a numerical value that | |
2136 | ranges from 0 to the number of enumerated values defined by the | |
2137 | property minus one, and associate a free-formed string name to each | |
2138 | value. Applications can retrieve the list of defined value-name pairs | |
2139 | and use the numerical value to get and set property instance values. | |
2140 | </para></listitem> | |
2141 | </varlistentry> | |
2142 | <varlistentry> | |
2143 | <term>DRM_MODE_PROP_BITMASK</term> | |
2144 | <listitem><para>Bitmask properties are enumeration properties that | |
2145 | additionally restrict all enumerated values to the 0..63 range. | |
2146 | Bitmask property instance values combine one or more of the | |
2147 | enumerated bits defined by the property.</para></listitem> | |
2148 | </varlistentry> | |
2149 | <varlistentry> | |
2150 | <term>DRM_MODE_PROP_BLOB</term> | |
2151 | <listitem><para>Blob properties store a binary blob without any format | |
2152 | restriction. The binary blobs are created as KMS standalone objects, | |
2153 | and blob property instance values store the ID of their associated | |
2154 | blob object.</para> | |
2155 | <para>Blob properties are only used for the connector EDID property | |
2156 | and cannot be created by drivers.</para></listitem> | |
2157 | </varlistentry> | |
2158 | </variablelist> | |
2159 | </para> | |
2160 | <para> | |
2161 | To create a property drivers call one of the following functions depending | |
2162 | on the property type. All property creation functions take property flags | |
2163 | and name, as well as type-specific arguments. | |
2164 | <itemizedlist> | |
2165 | <listitem> | |
2166 | <synopsis>struct drm_property *drm_property_create_range(struct drm_device *dev, int flags, | |
2167 | const char *name, | |
2168 | uint64_t min, uint64_t max);</synopsis> | |
2169 | <para>Create a range property with the given minimum and maximum | |
2170 | values.</para> | |
2171 | </listitem> | |
2172 | <listitem> | |
2173 | <synopsis>struct drm_property *drm_property_create_enum(struct drm_device *dev, int flags, | |
2174 | const char *name, | |
2175 | const struct drm_prop_enum_list *props, | |
2176 | int num_values);</synopsis> | |
2177 | <para>Create an enumerated property. The <parameter>props</parameter> | |
2178 | argument points to an array of <parameter>num_values</parameter> | |
2179 | value-name pairs.</para> | |
2180 | </listitem> | |
2181 | <listitem> | |
2182 | <synopsis>struct drm_property *drm_property_create_bitmask(struct drm_device *dev, | |
2183 | int flags, const char *name, | |
2184 | const struct drm_prop_enum_list *props, | |
2185 | int num_values);</synopsis> | |
2186 | <para>Create a bitmask property. The <parameter>props</parameter> | |
2187 | argument points to an array of <parameter>num_values</parameter> | |
2188 | value-name pairs.</para> | |
2189 | </listitem> | |
2190 | </itemizedlist> | |
2191 | </para> | |
2192 | <para> | |
2193 | Properties can additionally be created as immutable, in which case they | |
2194 | will be read-only for applications but can be modified by the driver. To | |
2195 | create an immutable property drivers must set the DRM_MODE_PROP_IMMUTABLE | |
2196 | flag at property creation time. | |
2197 | </para> | |
2198 | <para> | |
2199 | When no array of value-name pairs is readily available at property | |
2200 | creation time for enumerated or range properties, drivers can create | |
2201 | the property using the <function>drm_property_create</function> function | |
2202 | and manually add enumeration value-name pairs by calling the | |
2203 | <function>drm_property_add_enum</function> function. Care must be taken to | |
2204 | properly specify the property type through the <parameter>flags</parameter> | |
2205 | argument. | |
2206 | </para> | |
2207 | <para> | |
2208 | After creating properties drivers can attach property instances to CRTC, | |
2209 | connector and plane objects by calling the | |
2210 | <function>drm_object_attach_property</function>. The function takes a | |
2211 | pointer to the target object, a pointer to the previously created property | |
2212 | and an initial instance value. | |
2213 | </para> | |
6c6a3996 SK |
2214 | <sect2> |
2215 | <title>Existing KMS Properties</title> | |
2216 | <para> | |
2217 | The following table gives description of drm properties exposed by various | |
2218 | modules/drivers. | |
2219 | </para> | |
2220 | <table border="1" cellpadding="0" cellspacing="0"> | |
2221 | <tbody> | |
2222 | <tr style="font-weight: bold;"> | |
2223 | <td valign="top" >Owner Module/Drivers</td> | |
2224 | <td valign="top" >Group</td> | |
2225 | <td valign="top" >Property Name</td> | |
2226 | <td valign="top" >Type</td> | |
2227 | <td valign="top" >Property Values</td> | |
2228 | <td valign="top" >Object attached</td> | |
2229 | <td valign="top" >Description/Restrictions</td> | |
2230 | </tr> | |
2231 | <tr> | |
712a0dd9 SJ |
2232 | <td rowspan="37" valign="top" >DRM</td> |
2233 | <td valign="top" >Generic</td> | |
2234 | <td valign="top" >“rotation”</td> | |
2235 | <td valign="top" >BITMASK</td> | |
2236 | <td valign="top" >{ 0, "rotate-0" }, | |
2237 | { 1, "rotate-90" }, | |
2238 | { 2, "rotate-180" }, | |
2239 | { 3, "rotate-270" }, | |
2240 | { 4, "reflect-x" }, | |
2241 | { 5, "reflect-y" }</td> | |
2242 | <td valign="top" >CRTC, Plane</td> | |
2243 | <td valign="top" >rotate-(degrees) rotates the image by the specified amount in degrees | |
2244 | in counter clockwise direction. reflect-x and reflect-y reflects the | |
2245 | image along the specified axis prior to rotation</td> | |
2246 | </tr> | |
2247 | <tr> | |
ae16c597 | 2248 | <td rowspan="5" valign="top" >Connector</td> |
6c6a3996 SK |
2249 | <td valign="top" >“EDID”</td> |
2250 | <td valign="top" >BLOB | IMMUTABLE</td> | |
2251 | <td valign="top" >0</td> | |
2252 | <td valign="top" >Connector</td> | |
2253 | <td valign="top" >Contains id of edid blob ptr object.</td> | |
2254 | </tr> | |
2255 | <tr> | |
2256 | <td valign="top" >“DPMS”</td> | |
2257 | <td valign="top" >ENUM</td> | |
2258 | <td valign="top" >{ “On”, “Standby”, “Suspend”, “Off” }</td> | |
2259 | <td valign="top" >Connector</td> | |
2260 | <td valign="top" >Contains DPMS operation mode value.</td> | |
2261 | </tr> | |
2262 | <tr> | |
cc7096fb DA |
2263 | <td valign="top" >“PATH”</td> |
2264 | <td valign="top" >BLOB | IMMUTABLE</td> | |
2265 | <td valign="top" >0</td> | |
2266 | <td valign="top" >Connector</td> | |
2267 | <td valign="top" >Contains topology path to a connector.</td> | |
2268 | </tr> | |
2269 | <tr> | |
6f134d7b DA |
2270 | <td valign="top" >“TILE”</td> |
2271 | <td valign="top" >BLOB | IMMUTABLE</td> | |
2272 | <td valign="top" >0</td> | |
2273 | <td valign="top" >Connector</td> | |
2274 | <td valign="top" >Contains tiling information for a connector.</td> | |
2275 | </tr> | |
2276 | <tr> | |
ae16c597 RC |
2277 | <td valign="top" >“CRTC_ID”</td> |
2278 | <td valign="top" >OBJECT</td> | |
2279 | <td valign="top" >DRM_MODE_OBJECT_CRTC</td> | |
2280 | <td valign="top" >Connector</td> | |
2281 | <td valign="top" >CRTC that connector is attached to (atomic)</td> | |
2282 | </tr> | |
2283 | <tr> | |
6b4959f4 | 2284 | <td rowspan="11" valign="top" >Plane</td> |
59748616 DL |
2285 | <td valign="top" >“type”</td> |
2286 | <td valign="top" >ENUM | IMMUTABLE</td> | |
2287 | <td valign="top" >{ "Overlay", "Primary", "Cursor" }</td> | |
2288 | <td valign="top" >Plane</td> | |
2289 | <td valign="top" >Plane type</td> | |
2290 | </tr> | |
2291 | <tr> | |
6b4959f4 RC |
2292 | <td valign="top" >“SRC_X”</td> |
2293 | <td valign="top" >RANGE</td> | |
2294 | <td valign="top" >Min=0, Max=UINT_MAX</td> | |
2295 | <td valign="top" >Plane</td> | |
2296 | <td valign="top" >Scanout source x coordinate in 16.16 fixed point (atomic)</td> | |
2297 | </tr> | |
2298 | <tr> | |
2299 | <td valign="top" >“SRC_Y”</td> | |
2300 | <td valign="top" >RANGE</td> | |
2301 | <td valign="top" >Min=0, Max=UINT_MAX</td> | |
2302 | <td valign="top" >Plane</td> | |
2303 | <td valign="top" >Scanout source y coordinate in 16.16 fixed point (atomic)</td> | |
2304 | </tr> | |
2305 | <tr> | |
2306 | <td valign="top" >“SRC_W”</td> | |
2307 | <td valign="top" >RANGE</td> | |
2308 | <td valign="top" >Min=0, Max=UINT_MAX</td> | |
2309 | <td valign="top" >Plane</td> | |
2310 | <td valign="top" >Scanout source width in 16.16 fixed point (atomic)</td> | |
2311 | </tr> | |
2312 | <tr> | |
2313 | <td valign="top" >“SRC_H”</td> | |
2314 | <td valign="top" >RANGE</td> | |
2315 | <td valign="top" >Min=0, Max=UINT_MAX</td> | |
2316 | <td valign="top" >Plane</td> | |
2317 | <td valign="top" >Scanout source height in 16.16 fixed point (atomic)</td> | |
2318 | </tr> | |
2319 | <tr> | |
2320 | <td valign="top" >“CRTC_X”</td> | |
2321 | <td valign="top" >SIGNED_RANGE</td> | |
2322 | <td valign="top" >Min=INT_MIN, Max=INT_MAX</td> | |
2323 | <td valign="top" >Plane</td> | |
2324 | <td valign="top" >Scanout CRTC (destination) x coordinate (atomic)</td> | |
2325 | </tr> | |
2326 | <tr> | |
2327 | <td valign="top" >“CRTC_Y”</td> | |
2328 | <td valign="top" >SIGNED_RANGE</td> | |
2329 | <td valign="top" >Min=INT_MIN, Max=INT_MAX</td> | |
2330 | <td valign="top" >Plane</td> | |
2331 | <td valign="top" >Scanout CRTC (destination) y coordinate (atomic)</td> | |
2332 | </tr> | |
2333 | <tr> | |
2334 | <td valign="top" >“CRTC_W”</td> | |
2335 | <td valign="top" >RANGE</td> | |
2336 | <td valign="top" >Min=0, Max=UINT_MAX</td> | |
2337 | <td valign="top" >Plane</td> | |
2338 | <td valign="top" >Scanout CRTC (destination) width (atomic)</td> | |
2339 | </tr> | |
2340 | <tr> | |
2341 | <td valign="top" >“CRTC_H”</td> | |
2342 | <td valign="top" >RANGE</td> | |
2343 | <td valign="top" >Min=0, Max=UINT_MAX</td> | |
2344 | <td valign="top" >Plane</td> | |
2345 | <td valign="top" >Scanout CRTC (destination) height (atomic)</td> | |
2346 | </tr> | |
2347 | <tr> | |
2348 | <td valign="top" >“FB_ID”</td> | |
2349 | <td valign="top" >OBJECT</td> | |
2350 | <td valign="top" >DRM_MODE_OBJECT_FB</td> | |
2351 | <td valign="top" >Plane</td> | |
2352 | <td valign="top" >Scanout framebuffer (atomic)</td> | |
2353 | </tr> | |
2354 | <tr> | |
2355 | <td valign="top" >“CRTC_ID”</td> | |
2356 | <td valign="top" >OBJECT</td> | |
2357 | <td valign="top" >DRM_MODE_OBJECT_CRTC</td> | |
2358 | <td valign="top" >Plane</td> | |
2359 | <td valign="top" >CRTC that plane is attached to (atomic)</td> | |
2360 | </tr> | |
2361 | <tr> | |
6c6a3996 SK |
2362 | <td rowspan="2" valign="top" >DVI-I</td> |
2363 | <td valign="top" >“subconnector”</td> | |
2364 | <td valign="top" >ENUM</td> | |
2365 | <td valign="top" >{ “Unknown”, “DVI-D”, “DVI-A” }</td> | |
2366 | <td valign="top" >Connector</td> | |
2367 | <td valign="top" >TBD</td> | |
2368 | </tr> | |
2369 | <tr> | |
2370 | <td valign="top" >“select subconnector”</td> | |
2371 | <td valign="top" >ENUM</td> | |
2372 | <td valign="top" >{ “Automatic”, “DVI-D”, “DVI-A” }</td> | |
2373 | <td valign="top" >Connector</td> | |
2374 | <td valign="top" >TBD</td> | |
2375 | </tr> | |
2376 | <tr> | |
2377 | <td rowspan="13" valign="top" >TV</td> | |
2378 | <td valign="top" >“subconnector”</td> | |
2379 | <td valign="top" >ENUM</td> | |
2380 | <td valign="top" >{ "Unknown", "Composite", "SVIDEO", "Component", "SCART" }</td> | |
2381 | <td valign="top" >Connector</td> | |
2382 | <td valign="top" >TBD</td> | |
2383 | </tr> | |
2384 | <tr> | |
2385 | <td valign="top" >“select subconnector”</td> | |
2386 | <td valign="top" >ENUM</td> | |
2387 | <td valign="top" >{ "Automatic", "Composite", "SVIDEO", "Component", "SCART" }</td> | |
2388 | <td valign="top" >Connector</td> | |
2389 | <td valign="top" >TBD</td> | |
2390 | </tr> | |
2391 | <tr> | |
2392 | <td valign="top" >“mode”</td> | |
2393 | <td valign="top" >ENUM</td> | |
2394 | <td valign="top" >{ "NTSC_M", "NTSC_J", "NTSC_443", "PAL_B" } etc.</td> | |
2395 | <td valign="top" >Connector</td> | |
2396 | <td valign="top" >TBD</td> | |
2397 | </tr> | |
2398 | <tr> | |
2399 | <td valign="top" >“left margin”</td> | |
2400 | <td valign="top" >RANGE</td> | |
2401 | <td valign="top" >Min=0, Max=100</td> | |
2402 | <td valign="top" >Connector</td> | |
2403 | <td valign="top" >TBD</td> | |
2404 | </tr> | |
2405 | <tr> | |
2406 | <td valign="top" >“right margin”</td> | |
2407 | <td valign="top" >RANGE</td> | |
2408 | <td valign="top" >Min=0, Max=100</td> | |
2409 | <td valign="top" >Connector</td> | |
2410 | <td valign="top" >TBD</td> | |
2411 | </tr> | |
2412 | <tr> | |
2413 | <td valign="top" >“top margin”</td> | |
2414 | <td valign="top" >RANGE</td> | |
2415 | <td valign="top" >Min=0, Max=100</td> | |
2416 | <td valign="top" >Connector</td> | |
2417 | <td valign="top" >TBD</td> | |
2418 | </tr> | |
2419 | <tr> | |
2420 | <td valign="top" >“bottom margin”</td> | |
2421 | <td valign="top" >RANGE</td> | |
2422 | <td valign="top" >Min=0, Max=100</td> | |
2423 | <td valign="top" >Connector</td> | |
2424 | <td valign="top" >TBD</td> | |
2425 | </tr> | |
2426 | <tr> | |
2427 | <td valign="top" >“brightness”</td> | |
2428 | <td valign="top" >RANGE</td> | |
2429 | <td valign="top" >Min=0, Max=100</td> | |
2430 | <td valign="top" >Connector</td> | |
2431 | <td valign="top" >TBD</td> | |
2432 | </tr> | |
2433 | <tr> | |
2434 | <td valign="top" >“contrast”</td> | |
2435 | <td valign="top" >RANGE</td> | |
2436 | <td valign="top" >Min=0, Max=100</td> | |
2437 | <td valign="top" >Connector</td> | |
2438 | <td valign="top" >TBD</td> | |
2439 | </tr> | |
2440 | <tr> | |
2441 | <td valign="top" >“flicker reduction”</td> | |
2442 | <td valign="top" >RANGE</td> | |
2443 | <td valign="top" >Min=0, Max=100</td> | |
2444 | <td valign="top" >Connector</td> | |
2445 | <td valign="top" >TBD</td> | |
2446 | </tr> | |
2447 | <tr> | |
2448 | <td valign="top" >“overscan”</td> | |
2449 | <td valign="top" >RANGE</td> | |
2450 | <td valign="top" >Min=0, Max=100</td> | |
2451 | <td valign="top" >Connector</td> | |
2452 | <td valign="top" >TBD</td> | |
2453 | </tr> | |
2454 | <tr> | |
2455 | <td valign="top" >“saturation”</td> | |
2456 | <td valign="top" >RANGE</td> | |
2457 | <td valign="top" >Min=0, Max=100</td> | |
2458 | <td valign="top" >Connector</td> | |
2459 | <td valign="top" >TBD</td> | |
2460 | </tr> | |
2461 | <tr> | |
2462 | <td valign="top" >“hue”</td> | |
2463 | <td valign="top" >RANGE</td> | |
2464 | <td valign="top" >Min=0, Max=100</td> | |
2465 | <td valign="top" >Connector</td> | |
2466 | <td valign="top" >TBD</td> | |
2467 | </tr> | |
2468 | <tr> | |
5bb2bbf5 DA |
2469 | <td rowspan="2" valign="top" >Virtual GPU</td> |
2470 | <td valign="top" >“suggested X”</td> | |
2471 | <td valign="top" >RANGE</td> | |
2472 | <td valign="top" >Min=0, Max=0xffffffff</td> | |
2473 | <td valign="top" >Connector</td> | |
2474 | <td valign="top" >property to suggest an X offset for a connector</td> | |
2475 | </tr> | |
2476 | <tr> | |
2477 | <td valign="top" >“suggested Y”</td> | |
2478 | <td valign="top" >RANGE</td> | |
2479 | <td valign="top" >Min=0, Max=0xffffffff</td> | |
2480 | <td valign="top" >Connector</td> | |
2481 | <td valign="top" >property to suggest an Y offset for a connector</td> | |
2482 | </tr> | |
2483 | <tr> | |
726a280d | 2484 | <td rowspan="3" valign="top" >Optional</td> |
6c6a3996 SK |
2485 | <td valign="top" >“scaling mode”</td> |
2486 | <td valign="top" >ENUM</td> | |
2487 | <td valign="top" >{ "None", "Full", "Center", "Full aspect" }</td> | |
2488 | <td valign="top" >Connector</td> | |
2489 | <td valign="top" >TBD</td> | |
2490 | </tr> | |
2491 | <tr> | |
726a280d VK |
2492 | <td valign="top" >"aspect ratio"</td> |
2493 | <td valign="top" >ENUM</td> | |
2494 | <td valign="top" >{ "None", "4:3", "16:9" }</td> | |
2495 | <td valign="top" >Connector</td> | |
2496 | <td valign="top" >DRM property to set aspect ratio from user space app. | |
2497 | This enum is made generic to allow addition of custom aspect | |
2498 | ratios.</td> | |
2499 | </tr> | |
2500 | <tr> | |
6c6a3996 SK |
2501 | <td valign="top" >“dirty”</td> |
2502 | <td valign="top" >ENUM | IMMUTABLE</td> | |
2503 | <td valign="top" >{ "Off", "On", "Annotate" }</td> | |
2504 | <td valign="top" >Connector</td> | |
2505 | <td valign="top" >TBD</td> | |
2506 | </tr> | |
2507 | <tr> | |
712a0dd9 | 2508 | <td rowspan="20" valign="top" >i915</td> |
4ba08faa | 2509 | <td rowspan="2" valign="top" >Generic</td> |
6c6a3996 SK |
2510 | <td valign="top" >"Broadcast RGB"</td> |
2511 | <td valign="top" >ENUM</td> | |
2512 | <td valign="top" >{ "Automatic", "Full", "Limited 16:235" }</td> | |
2513 | <td valign="top" >Connector</td> | |
2514 | <td valign="top" >TBD</td> | |
2515 | </tr> | |
2516 | <tr> | |
2517 | <td valign="top" >“audio”</td> | |
2518 | <td valign="top" >ENUM</td> | |
2519 | <td valign="top" >{ "force-dvi", "off", "auto", "on" }</td> | |
2520 | <td valign="top" >Connector</td> | |
2521 | <td valign="top" >TBD</td> | |
2522 | </tr> | |
2523 | <tr> | |
6c6a3996 SK |
2524 | <td rowspan="17" valign="top" >SDVO-TV</td> |
2525 | <td valign="top" >“mode”</td> | |
2526 | <td valign="top" >ENUM</td> | |
2527 | <td valign="top" >{ "NTSC_M", "NTSC_J", "NTSC_443", "PAL_B" } etc.</td> | |
2528 | <td valign="top" >Connector</td> | |
2529 | <td valign="top" >TBD</td> | |
2530 | </tr> | |
2531 | <tr> | |
2532 | <td valign="top" >"left_margin"</td> | |
2533 | <td valign="top" >RANGE</td> | |
2534 | <td valign="top" >Min=0, Max= SDVO dependent</td> | |
2535 | <td valign="top" >Connector</td> | |
2536 | <td valign="top" >TBD</td> | |
2537 | </tr> | |
2538 | <tr> | |
2539 | <td valign="top" >"right_margin"</td> | |
2540 | <td valign="top" >RANGE</td> | |
2541 | <td valign="top" >Min=0, Max= SDVO dependent</td> | |
2542 | <td valign="top" >Connector</td> | |
2543 | <td valign="top" >TBD</td> | |
2544 | </tr> | |
2545 | <tr> | |
2546 | <td valign="top" >"top_margin"</td> | |
2547 | <td valign="top" >RANGE</td> | |
2548 | <td valign="top" >Min=0, Max= SDVO dependent</td> | |
2549 | <td valign="top" >Connector</td> | |
2550 | <td valign="top" >TBD</td> | |
2551 | </tr> | |
2552 | <tr> | |
2553 | <td valign="top" >"bottom_margin"</td> | |
2554 | <td valign="top" >RANGE</td> | |
2555 | <td valign="top" >Min=0, Max= SDVO dependent</td> | |
2556 | <td valign="top" >Connector</td> | |
2557 | <td valign="top" >TBD</td> | |
2558 | </tr> | |
2559 | <tr> | |
2560 | <td valign="top" >“hpos”</td> | |
2561 | <td valign="top" >RANGE</td> | |
2562 | <td valign="top" >Min=0, Max= SDVO dependent</td> | |
2563 | <td valign="top" >Connector</td> | |
2564 | <td valign="top" >TBD</td> | |
2565 | </tr> | |
2566 | <tr> | |
2567 | <td valign="top" >“vpos”</td> | |
2568 | <td valign="top" >RANGE</td> | |
2569 | <td valign="top" >Min=0, Max= SDVO dependent</td> | |
2570 | <td valign="top" >Connector</td> | |
2571 | <td valign="top" >TBD</td> | |
2572 | </tr> | |
2573 | <tr> | |
2574 | <td valign="top" >“contrast”</td> | |
2575 | <td valign="top" >RANGE</td> | |
2576 | <td valign="top" >Min=0, Max= SDVO dependent</td> | |
2577 | <td valign="top" >Connector</td> | |
2578 | <td valign="top" >TBD</td> | |
2579 | </tr> | |
2580 | <tr> | |
2581 | <td valign="top" >“saturation”</td> | |
2582 | <td valign="top" >RANGE</td> | |
2583 | <td valign="top" >Min=0, Max= SDVO dependent</td> | |
2584 | <td valign="top" >Connector</td> | |
2585 | <td valign="top" >TBD</td> | |
2586 | </tr> | |
2587 | <tr> | |
2588 | <td valign="top" >“hue”</td> | |
2589 | <td valign="top" >RANGE</td> | |
2590 | <td valign="top" >Min=0, Max= SDVO dependent</td> | |
2591 | <td valign="top" >Connector</td> | |
2592 | <td valign="top" >TBD</td> | |
2593 | </tr> | |
2594 | <tr> | |
2595 | <td valign="top" >“sharpness”</td> | |
2596 | <td valign="top" >RANGE</td> | |
2597 | <td valign="top" >Min=0, Max= SDVO dependent</td> | |
2598 | <td valign="top" >Connector</td> | |
2599 | <td valign="top" >TBD</td> | |
2600 | </tr> | |
2601 | <tr> | |
2602 | <td valign="top" >“flicker_filter”</td> | |
2603 | <td valign="top" >RANGE</td> | |
2604 | <td valign="top" >Min=0, Max= SDVO dependent</td> | |
2605 | <td valign="top" >Connector</td> | |
2606 | <td valign="top" >TBD</td> | |
2607 | </tr> | |
2608 | <tr> | |
2609 | <td valign="top" >“flicker_filter_adaptive”</td> | |
2610 | <td valign="top" >RANGE</td> | |
2611 | <td valign="top" >Min=0, Max= SDVO dependent</td> | |
2612 | <td valign="top" >Connector</td> | |
2613 | <td valign="top" >TBD</td> | |
2614 | </tr> | |
2615 | <tr> | |
2616 | <td valign="top" >“flicker_filter_2d”</td> | |
2617 | <td valign="top" >RANGE</td> | |
2618 | <td valign="top" >Min=0, Max= SDVO dependent</td> | |
2619 | <td valign="top" >Connector</td> | |
2620 | <td valign="top" >TBD</td> | |
2621 | </tr> | |
2622 | <tr> | |
2623 | <td valign="top" >“tv_chroma_filter”</td> | |
2624 | <td valign="top" >RANGE</td> | |
2625 | <td valign="top" >Min=0, Max= SDVO dependent</td> | |
2626 | <td valign="top" >Connector</td> | |
2627 | <td valign="top" >TBD</td> | |
2628 | </tr> | |
2629 | <tr> | |
2630 | <td valign="top" >“tv_luma_filter”</td> | |
2631 | <td valign="top" >RANGE</td> | |
2632 | <td valign="top" >Min=0, Max= SDVO dependent</td> | |
2633 | <td valign="top" >Connector</td> | |
2634 | <td valign="top" >TBD</td> | |
2635 | </tr> | |
2636 | <tr> | |
2637 | <td valign="top" >“dot_crawl”</td> | |
2638 | <td valign="top" >RANGE</td> | |
2639 | <td valign="top" >Min=0, Max=1</td> | |
2640 | <td valign="top" >Connector</td> | |
2641 | <td valign="top" >TBD</td> | |
2642 | </tr> | |
2643 | <tr> | |
2644 | <td valign="top" >SDVO-TV/LVDS</td> | |
2645 | <td valign="top" >“brightness”</td> | |
2646 | <td valign="top" >RANGE</td> | |
2647 | <td valign="top" >Min=0, Max= SDVO dependent</td> | |
2648 | <td valign="top" >Connector</td> | |
2649 | <td valign="top" >TBD</td> | |
2650 | </tr> | |
2651 | <tr> | |
4ba08faa SK |
2652 | <td rowspan="2" valign="top" >CDV gma-500</td> |
2653 | <td rowspan="2" valign="top" >Generic</td> | |
6c6a3996 SK |
2654 | <td valign="top" >"Broadcast RGB"</td> |
2655 | <td valign="top" >ENUM</td> | |
2656 | <td valign="top" >{ “Full”, “Limited 16:235” }</td> | |
2657 | <td valign="top" >Connector</td> | |
2658 | <td valign="top" >TBD</td> | |
2659 | </tr> | |
2660 | <tr> | |
2661 | <td valign="top" >"Broadcast RGB"</td> | |
2662 | <td valign="top" >ENUM</td> | |
2663 | <td valign="top" >{ “off”, “auto”, “on” }</td> | |
2664 | <td valign="top" >Connector</td> | |
2665 | <td valign="top" >TBD</td> | |
2666 | </tr> | |
2667 | <tr> | |
4ba08faa SK |
2668 | <td rowspan="19" valign="top" >Poulsbo</td> |
2669 | <td rowspan="1" valign="top" >Generic</td> | |
6c6a3996 SK |
2670 | <td valign="top" >“backlight”</td> |
2671 | <td valign="top" >RANGE</td> | |
2672 | <td valign="top" >Min=0, Max=100</td> | |
2673 | <td valign="top" >Connector</td> | |
2674 | <td valign="top" >TBD</td> | |
2675 | </tr> | |
2676 | <tr> | |
6c6a3996 SK |
2677 | <td rowspan="17" valign="top" >SDVO-TV</td> |
2678 | <td valign="top" >“mode”</td> | |
2679 | <td valign="top" >ENUM</td> | |
2680 | <td valign="top" >{ "NTSC_M", "NTSC_J", "NTSC_443", "PAL_B" } etc.</td> | |
2681 | <td valign="top" >Connector</td> | |
2682 | <td valign="top" >TBD</td> | |
2683 | </tr> | |
2684 | <tr> | |
2685 | <td valign="top" >"left_margin"</td> | |
2686 | <td valign="top" >RANGE</td> | |
2687 | <td valign="top" >Min=0, Max= SDVO dependent</td> | |
2688 | <td valign="top" >Connector</td> | |
2689 | <td valign="top" >TBD</td> | |
2690 | </tr> | |
2691 | <tr> | |
2692 | <td valign="top" >"right_margin"</td> | |
2693 | <td valign="top" >RANGE</td> | |
2694 | <td valign="top" >Min=0, Max= SDVO dependent</td> | |
2695 | <td valign="top" >Connector</td> | |
2696 | <td valign="top" >TBD</td> | |
2697 | </tr> | |
2698 | <tr> | |
2699 | <td valign="top" >"top_margin"</td> | |
2700 | <td valign="top" >RANGE</td> | |
2701 | <td valign="top" >Min=0, Max= SDVO dependent</td> | |
2702 | <td valign="top" >Connector</td> | |
2703 | <td valign="top" >TBD</td> | |
2704 | </tr> | |
2705 | <tr> | |
2706 | <td valign="top" >"bottom_margin"</td> | |
2707 | <td valign="top" >RANGE</td> | |
2708 | <td valign="top" >Min=0, Max= SDVO dependent</td> | |
2709 | <td valign="top" >Connector</td> | |
2710 | <td valign="top" >TBD</td> | |
2711 | </tr> | |
2712 | <tr> | |
2713 | <td valign="top" >“hpos”</td> | |
2714 | <td valign="top" >RANGE</td> | |
2715 | <td valign="top" >Min=0, Max= SDVO dependent</td> | |
2716 | <td valign="top" >Connector</td> | |
2717 | <td valign="top" >TBD</td> | |
2718 | </tr> | |
2719 | <tr> | |
2720 | <td valign="top" >“vpos”</td> | |
2721 | <td valign="top" >RANGE</td> | |
2722 | <td valign="top" >Min=0, Max= SDVO dependent</td> | |
2723 | <td valign="top" >Connector</td> | |
2724 | <td valign="top" >TBD</td> | |
2725 | </tr> | |
2726 | <tr> | |
2727 | <td valign="top" >“contrast”</td> | |
2728 | <td valign="top" >RANGE</td> | |
2729 | <td valign="top" >Min=0, Max= SDVO dependent</td> | |
2730 | <td valign="top" >Connector</td> | |
2731 | <td valign="top" >TBD</td> | |
2732 | </tr> | |
2733 | <tr> | |
2734 | <td valign="top" >“saturation”</td> | |
2735 | <td valign="top" >RANGE</td> | |
2736 | <td valign="top" >Min=0, Max= SDVO dependent</td> | |
2737 | <td valign="top" >Connector</td> | |
2738 | <td valign="top" >TBD</td> | |
2739 | </tr> | |
2740 | <tr> | |
2741 | <td valign="top" >“hue”</td> | |
2742 | <td valign="top" >RANGE</td> | |
2743 | <td valign="top" >Min=0, Max= SDVO dependent</td> | |
2744 | <td valign="top" >Connector</td> | |
2745 | <td valign="top" >TBD</td> | |
2746 | </tr> | |
2747 | <tr> | |
2748 | <td valign="top" >“sharpness”</td> | |
2749 | <td valign="top" >RANGE</td> | |
2750 | <td valign="top" >Min=0, Max= SDVO dependent</td> | |
2751 | <td valign="top" >Connector</td> | |
2752 | <td valign="top" >TBD</td> | |
2753 | </tr> | |
2754 | <tr> | |
2755 | <td valign="top" >“flicker_filter”</td> | |
2756 | <td valign="top" >RANGE</td> | |
2757 | <td valign="top" >Min=0, Max= SDVO dependent</td> | |
2758 | <td valign="top" >Connector</td> | |
2759 | <td valign="top" >TBD</td> | |
2760 | </tr> | |
2761 | <tr> | |
2762 | <td valign="top" >“flicker_filter_adaptive”</td> | |
2763 | <td valign="top" >RANGE</td> | |
2764 | <td valign="top" >Min=0, Max= SDVO dependent</td> | |
2765 | <td valign="top" >Connector</td> | |
2766 | <td valign="top" >TBD</td> | |
2767 | </tr> | |
2768 | <tr> | |
2769 | <td valign="top" >“flicker_filter_2d”</td> | |
2770 | <td valign="top" >RANGE</td> | |
2771 | <td valign="top" >Min=0, Max= SDVO dependent</td> | |
2772 | <td valign="top" >Connector</td> | |
2773 | <td valign="top" >TBD</td> | |
2774 | </tr> | |
2775 | <tr> | |
2776 | <td valign="top" >“tv_chroma_filter”</td> | |
2777 | <td valign="top" >RANGE</td> | |
2778 | <td valign="top" >Min=0, Max= SDVO dependent</td> | |
2779 | <td valign="top" >Connector</td> | |
2780 | <td valign="top" >TBD</td> | |
2781 | </tr> | |
2782 | <tr> | |
2783 | <td valign="top" >“tv_luma_filter”</td> | |
2784 | <td valign="top" >RANGE</td> | |
2785 | <td valign="top" >Min=0, Max= SDVO dependent</td> | |
2786 | <td valign="top" >Connector</td> | |
2787 | <td valign="top" >TBD</td> | |
2788 | </tr> | |
2789 | <tr> | |
2790 | <td valign="top" >“dot_crawl”</td> | |
2791 | <td valign="top" >RANGE</td> | |
2792 | <td valign="top" >Min=0, Max=1</td> | |
2793 | <td valign="top" >Connector</td> | |
2794 | <td valign="top" >TBD</td> | |
2795 | </tr> | |
2796 | <tr> | |
2797 | <td valign="top" >SDVO-TV/LVDS</td> | |
2798 | <td valign="top" >“brightness”</td> | |
2799 | <td valign="top" >RANGE</td> | |
2800 | <td valign="top" >Min=0, Max= SDVO dependent</td> | |
2801 | <td valign="top" >Connector</td> | |
2802 | <td valign="top" >TBD</td> | |
2803 | </tr> | |
2804 | <tr> | |
2805 | <td rowspan="11" valign="top" >armada</td> | |
2806 | <td rowspan="2" valign="top" >CRTC</td> | |
2807 | <td valign="top" >"CSC_YUV"</td> | |
2808 | <td valign="top" >ENUM</td> | |
2809 | <td valign="top" >{ "Auto" , "CCIR601", "CCIR709" }</td> | |
2810 | <td valign="top" >CRTC</td> | |
2811 | <td valign="top" >TBD</td> | |
2812 | </tr> | |
2813 | <tr> | |
2814 | <td valign="top" >"CSC_RGB"</td> | |
2815 | <td valign="top" >ENUM</td> | |
2816 | <td valign="top" >{ "Auto", "Computer system", "Studio" }</td> | |
2817 | <td valign="top" >CRTC</td> | |
2818 | <td valign="top" >TBD</td> | |
2819 | </tr> | |
2820 | <tr> | |
2821 | <td rowspan="9" valign="top" >Overlay</td> | |
2822 | <td valign="top" >"colorkey"</td> | |
2823 | <td valign="top" >RANGE</td> | |
2824 | <td valign="top" >Min=0, Max=0xffffff</td> | |
2825 | <td valign="top" >Plane</td> | |
2826 | <td valign="top" >TBD</td> | |
2827 | </tr> | |
2828 | <tr> | |
2829 | <td valign="top" >"colorkey_min"</td> | |
2830 | <td valign="top" >RANGE</td> | |
2831 | <td valign="top" >Min=0, Max=0xffffff</td> | |
2832 | <td valign="top" >Plane</td> | |
2833 | <td valign="top" >TBD</td> | |
2834 | </tr> | |
2835 | <tr> | |
2836 | <td valign="top" >"colorkey_max"</td> | |
2837 | <td valign="top" >RANGE</td> | |
2838 | <td valign="top" >Min=0, Max=0xffffff</td> | |
2839 | <td valign="top" >Plane</td> | |
2840 | <td valign="top" >TBD</td> | |
2841 | </tr> | |
2842 | <tr> | |
2843 | <td valign="top" >"colorkey_val"</td> | |
2844 | <td valign="top" >RANGE</td> | |
2845 | <td valign="top" >Min=0, Max=0xffffff</td> | |
2846 | <td valign="top" >Plane</td> | |
2847 | <td valign="top" >TBD</td> | |
2848 | </tr> | |
2849 | <tr> | |
2850 | <td valign="top" >"colorkey_alpha"</td> | |
2851 | <td valign="top" >RANGE</td> | |
2852 | <td valign="top" >Min=0, Max=0xffffff</td> | |
2853 | <td valign="top" >Plane</td> | |
2854 | <td valign="top" >TBD</td> | |
2855 | </tr> | |
2856 | <tr> | |
2857 | <td valign="top" >"colorkey_mode"</td> | |
2858 | <td valign="top" >ENUM</td> | |
2859 | <td valign="top" >{ "disabled", "Y component", "U component" | |
2860 | , "V component", "RGB", “R component", "G component", "B component" }</td> | |
2861 | <td valign="top" >Plane</td> | |
2862 | <td valign="top" >TBD</td> | |
2863 | </tr> | |
2864 | <tr> | |
2865 | <td valign="top" >"brightness"</td> | |
2866 | <td valign="top" >RANGE</td> | |
2867 | <td valign="top" >Min=0, Max=256 + 255</td> | |
2868 | <td valign="top" >Plane</td> | |
2869 | <td valign="top" >TBD</td> | |
2870 | </tr> | |
2871 | <tr> | |
2872 | <td valign="top" >"contrast"</td> | |
2873 | <td valign="top" >RANGE</td> | |
2874 | <td valign="top" >Min=0, Max=0x7fff</td> | |
2875 | <td valign="top" >Plane</td> | |
2876 | <td valign="top" >TBD</td> | |
2877 | </tr> | |
2878 | <tr> | |
2879 | <td valign="top" >"saturation"</td> | |
2880 | <td valign="top" >RANGE</td> | |
2881 | <td valign="top" >Min=0, Max=0x7fff</td> | |
2882 | <td valign="top" >Plane</td> | |
2883 | <td valign="top" >TBD</td> | |
2884 | </tr> | |
2885 | <tr> | |
2886 | <td rowspan="2" valign="top" >exynos</td> | |
2887 | <td valign="top" >CRTC</td> | |
2888 | <td valign="top" >“mode”</td> | |
2889 | <td valign="top" >ENUM</td> | |
2890 | <td valign="top" >{ "normal", "blank" }</td> | |
2891 | <td valign="top" >CRTC</td> | |
2892 | <td valign="top" >TBD</td> | |
2893 | </tr> | |
2894 | <tr> | |
2895 | <td valign="top" >Overlay</td> | |
2896 | <td valign="top" >“zpos”</td> | |
2897 | <td valign="top" >RANGE</td> | |
2898 | <td valign="top" >Min=0, Max=MAX_PLANE-1</td> | |
2899 | <td valign="top" >Plane</td> | |
2900 | <td valign="top" >TBD</td> | |
2901 | </tr> | |
2902 | <tr> | |
4ba08faa | 2903 | <td rowspan="2" valign="top" >i2c/ch7006_drv</td> |
6c6a3996 SK |
2904 | <td valign="top" >Generic</td> |
2905 | <td valign="top" >“scale”</td> | |
2906 | <td valign="top" >RANGE</td> | |
2907 | <td valign="top" >Min=0, Max=2</td> | |
2908 | <td valign="top" >Connector</td> | |
2909 | <td valign="top" >TBD</td> | |
2910 | </tr> | |
2911 | <tr> | |
4ba08faa | 2912 | <td rowspan="1" valign="top" >TV</td> |
6c6a3996 SK |
2913 | <td valign="top" >“mode”</td> |
2914 | <td valign="top" >ENUM</td> | |
2915 | <td valign="top" >{ "PAL", "PAL-M","PAL-N"}, ”PAL-Nc" | |
2916 | , "PAL-60", "NTSC-M", "NTSC-J" }</td> | |
2917 | <td valign="top" >Connector</td> | |
2918 | <td valign="top" >TBD</td> | |
2919 | </tr> | |
2920 | <tr> | |
4ba08faa | 2921 | <td rowspan="15" valign="top" >nouveau</td> |
6c6a3996 SK |
2922 | <td rowspan="6" valign="top" >NV10 Overlay</td> |
2923 | <td valign="top" >"colorkey"</td> | |
2924 | <td valign="top" >RANGE</td> | |
2925 | <td valign="top" >Min=0, Max=0x01ffffff</td> | |
2926 | <td valign="top" >Plane</td> | |
2927 | <td valign="top" >TBD</td> | |
2928 | </tr> | |
2929 | <tr> | |
2930 | <td valign="top" >“contrast”</td> | |
2931 | <td valign="top" >RANGE</td> | |
2932 | <td valign="top" >Min=0, Max=8192-1</td> | |
2933 | <td valign="top" >Plane</td> | |
2934 | <td valign="top" >TBD</td> | |
2935 | </tr> | |
2936 | <tr> | |
2937 | <td valign="top" >“brightness”</td> | |
2938 | <td valign="top" >RANGE</td> | |
2939 | <td valign="top" >Min=0, Max=1024</td> | |
2940 | <td valign="top" >Plane</td> | |
2941 | <td valign="top" >TBD</td> | |
2942 | </tr> | |
2943 | <tr> | |
2944 | <td valign="top" >“hue”</td> | |
2945 | <td valign="top" >RANGE</td> | |
2946 | <td valign="top" >Min=0, Max=359</td> | |
2947 | <td valign="top" >Plane</td> | |
2948 | <td valign="top" >TBD</td> | |
2949 | </tr> | |
2950 | <tr> | |
2951 | <td valign="top" >“saturation”</td> | |
2952 | <td valign="top" >RANGE</td> | |
2953 | <td valign="top" >Min=0, Max=8192-1</td> | |
2954 | <td valign="top" >Plane</td> | |
2955 | <td valign="top" >TBD</td> | |
2956 | </tr> | |
2957 | <tr> | |
2958 | <td valign="top" >“iturbt_709”</td> | |
2959 | <td valign="top" >RANGE</td> | |
2960 | <td valign="top" >Min=0, Max=1</td> | |
2961 | <td valign="top" >Plane</td> | |
2962 | <td valign="top" >TBD</td> | |
2963 | </tr> | |
2964 | <tr> | |
2965 | <td rowspan="2" valign="top" >Nv04 Overlay</td> | |
2966 | <td valign="top" >“colorkey”</td> | |
2967 | <td valign="top" >RANGE</td> | |
2968 | <td valign="top" >Min=0, Max=0x01ffffff</td> | |
2969 | <td valign="top" >Plane</td> | |
2970 | <td valign="top" >TBD</td> | |
2971 | </tr> | |
2972 | <tr> | |
2973 | <td valign="top" >“brightness”</td> | |
2974 | <td valign="top" >RANGE</td> | |
2975 | <td valign="top" >Min=0, Max=1024</td> | |
2976 | <td valign="top" >Plane</td> | |
2977 | <td valign="top" >TBD</td> | |
2978 | </tr> | |
2979 | <tr> | |
2980 | <td rowspan="7" valign="top" >Display</td> | |
2981 | <td valign="top" >“dithering mode”</td> | |
2982 | <td valign="top" >ENUM</td> | |
2983 | <td valign="top" >{ "auto", "off", "on" }</td> | |
2984 | <td valign="top" >Connector</td> | |
2985 | <td valign="top" >TBD</td> | |
2986 | </tr> | |
2987 | <tr> | |
2988 | <td valign="top" >“dithering depth”</td> | |
2989 | <td valign="top" >ENUM</td> | |
2990 | <td valign="top" >{ "auto", "off", "on", "static 2x2", "dynamic 2x2", "temporal" }</td> | |
2991 | <td valign="top" >Connector</td> | |
2992 | <td valign="top" >TBD</td> | |
2993 | </tr> | |
2994 | <tr> | |
2995 | <td valign="top" >“underscan”</td> | |
2996 | <td valign="top" >ENUM</td> | |
2997 | <td valign="top" >{ "auto", "6 bpc", "8 bpc" }</td> | |
2998 | <td valign="top" >Connector</td> | |
2999 | <td valign="top" >TBD</td> | |
3000 | </tr> | |
3001 | <tr> | |
3002 | <td valign="top" >“underscan hborder”</td> | |
3003 | <td valign="top" >RANGE</td> | |
3004 | <td valign="top" >Min=0, Max=128</td> | |
3005 | <td valign="top" >Connector</td> | |
3006 | <td valign="top" >TBD</td> | |
3007 | </tr> | |
3008 | <tr> | |
3009 | <td valign="top" >“underscan vborder”</td> | |
3010 | <td valign="top" >RANGE</td> | |
3011 | <td valign="top" >Min=0, Max=128</td> | |
3012 | <td valign="top" >Connector</td> | |
3013 | <td valign="top" >TBD</td> | |
3014 | </tr> | |
3015 | <tr> | |
3016 | <td valign="top" >“vibrant hue”</td> | |
3017 | <td valign="top" >RANGE</td> | |
3018 | <td valign="top" >Min=0, Max=180</td> | |
3019 | <td valign="top" >Connector</td> | |
3020 | <td valign="top" >TBD</td> | |
3021 | </tr> | |
3022 | <tr> | |
3023 | <td valign="top" >“color vibrance”</td> | |
3024 | <td valign="top" >RANGE</td> | |
3025 | <td valign="top" >Min=0, Max=200</td> | |
3026 | <td valign="top" >Connector</td> | |
3027 | <td valign="top" >TBD</td> | |
3028 | </tr> | |
3029 | <tr> | |
d4acc165 | 3030 | <td valign="top" >omap</td> |
712a0dd9 | 3031 | <td valign="top" >Generic</td> |
6c6a3996 SK |
3032 | <td valign="top" >“zorder”</td> |
3033 | <td valign="top" >RANGE</td> | |
3034 | <td valign="top" >Min=0, Max=3</td> | |
3035 | <td valign="top" >CRTC, Plane</td> | |
3036 | <td valign="top" >TBD</td> | |
3037 | </tr> | |
3038 | <tr> | |
3039 | <td valign="top" >qxl</td> | |
3040 | <td valign="top" >Generic</td> | |
3041 | <td valign="top" >“hotplug_mode_update"</td> | |
3042 | <td valign="top" >RANGE</td> | |
3043 | <td valign="top" >Min=0, Max=1</td> | |
3044 | <td valign="top" >Connector</td> | |
3045 | <td valign="top" >TBD</td> | |
3046 | </tr> | |
3047 | <tr> | |
4ba08faa | 3048 | <td rowspan="9" valign="top" >radeon</td> |
6c6a3996 SK |
3049 | <td valign="top" >DVI-I</td> |
3050 | <td valign="top" >“coherent”</td> | |
3051 | <td valign="top" >RANGE</td> | |
3052 | <td valign="top" >Min=0, Max=1</td> | |
3053 | <td valign="top" >Connector</td> | |
3054 | <td valign="top" >TBD</td> | |
3055 | </tr> | |
3056 | <tr> | |
3057 | <td valign="top" >DAC enable load detect</td> | |
3058 | <td valign="top" >“load detection”</td> | |
3059 | <td valign="top" >RANGE</td> | |
3060 | <td valign="top" >Min=0, Max=1</td> | |
3061 | <td valign="top" >Connector</td> | |
3062 | <td valign="top" >TBD</td> | |
3063 | </tr> | |
3064 | <tr> | |
3065 | <td valign="top" >TV Standard</td> | |
3066 | <td valign="top" >"tv standard"</td> | |
3067 | <td valign="top" >ENUM</td> | |
3068 | <td valign="top" >{ "ntsc", "pal", "pal-m", "pal-60", "ntsc-j" | |
3069 | , "scart-pal", "pal-cn", "secam" }</td> | |
3070 | <td valign="top" >Connector</td> | |
3071 | <td valign="top" >TBD</td> | |
3072 | </tr> | |
3073 | <tr> | |
3074 | <td valign="top" >legacy TMDS PLL detect</td> | |
3075 | <td valign="top" >"tmds_pll"</td> | |
3076 | <td valign="top" >ENUM</td> | |
3077 | <td valign="top" >{ "driver", "bios" }</td> | |
3078 | <td valign="top" >-</td> | |
3079 | <td valign="top" >TBD</td> | |
3080 | </tr> | |
3081 | <tr> | |
3082 | <td rowspan="3" valign="top" >Underscan</td> | |
3083 | <td valign="top" >"underscan"</td> | |
3084 | <td valign="top" >ENUM</td> | |
3085 | <td valign="top" >{ "off", "on", "auto" }</td> | |
3086 | <td valign="top" >Connector</td> | |
3087 | <td valign="top" >TBD</td> | |
3088 | </tr> | |
3089 | <tr> | |
3090 | <td valign="top" >"underscan hborder"</td> | |
3091 | <td valign="top" >RANGE</td> | |
3092 | <td valign="top" >Min=0, Max=128</td> | |
3093 | <td valign="top" >Connector</td> | |
3094 | <td valign="top" >TBD</td> | |
3095 | </tr> | |
3096 | <tr> | |
3097 | <td valign="top" >"underscan vborder"</td> | |
3098 | <td valign="top" >RANGE</td> | |
3099 | <td valign="top" >Min=0, Max=128</td> | |
3100 | <td valign="top" >Connector</td> | |
3101 | <td valign="top" >TBD</td> | |
3102 | </tr> | |
3103 | <tr> | |
3104 | <td valign="top" >Audio</td> | |
3105 | <td valign="top" >“audio”</td> | |
3106 | <td valign="top" >ENUM</td> | |
3107 | <td valign="top" >{ "off", "on", "auto" }</td> | |
3108 | <td valign="top" >Connector</td> | |
3109 | <td valign="top" >TBD</td> | |
3110 | </tr> | |
3111 | <tr> | |
3112 | <td valign="top" >FMT Dithering</td> | |
3113 | <td valign="top" >“dither”</td> | |
3114 | <td valign="top" >ENUM</td> | |
3115 | <td valign="top" >{ "off", "on" }</td> | |
3116 | <td valign="top" >Connector</td> | |
3117 | <td valign="top" >TBD</td> | |
3118 | </tr> | |
3119 | <tr> | |
6c6a3996 SK |
3120 | <td rowspan="3" valign="top" >rcar-du</td> |
3121 | <td rowspan="3" valign="top" >Generic</td> | |
3122 | <td valign="top" >"alpha"</td> | |
3123 | <td valign="top" >RANGE</td> | |
3124 | <td valign="top" >Min=0, Max=255</td> | |
3125 | <td valign="top" >Plane</td> | |
3126 | <td valign="top" >TBD</td> | |
3127 | </tr> | |
3128 | <tr> | |
3129 | <td valign="top" >"colorkey"</td> | |
3130 | <td valign="top" >RANGE</td> | |
3131 | <td valign="top" >Min=0, Max=0x01ffffff</td> | |
3132 | <td valign="top" >Plane</td> | |
3133 | <td valign="top" >TBD</td> | |
3134 | </tr> | |
3135 | <tr> | |
3136 | <td valign="top" >"zpos"</td> | |
3137 | <td valign="top" >RANGE</td> | |
3138 | <td valign="top" >Min=1, Max=7</td> | |
3139 | <td valign="top" >Plane</td> | |
3140 | <td valign="top" >TBD</td> | |
3141 | </tr> | |
3142 | </tbody> | |
3143 | </table> | |
3144 | </sect2> | |
2d2ef822 JB |
3145 | </sect1> |
3146 | ||
9cad9c95 LP |
3147 | <!-- Internals: vertical blanking --> |
3148 | ||
3149 | <sect1 id="drm-vertical-blank"> | |
3150 | <title>Vertical Blanking</title> | |
3151 | <para> | |
3152 | Vertical blanking plays a major role in graphics rendering. To achieve | |
3153 | tear-free display, users must synchronize page flips and/or rendering to | |
3154 | vertical blanking. The DRM API offers ioctls to perform page flips | |
3155 | synchronized to vertical blanking and wait for vertical blanking. | |
3156 | </para> | |
3157 | <para> | |
3158 | The DRM core handles most of the vertical blanking management logic, which | |
3159 | involves filtering out spurious interrupts, keeping race-free blanking | |
3160 | counters, coping with counter wrap-around and resets and keeping use | |
3161 | counts. It relies on the driver to generate vertical blanking interrupts | |
3162 | and optionally provide a hardware vertical blanking counter. Drivers must | |
3163 | implement the following operations. | |
3164 | </para> | |
3165 | <itemizedlist> | |
3166 | <listitem> | |
3167 | <synopsis>int (*enable_vblank) (struct drm_device *dev, int crtc); | |
3168 | void (*disable_vblank) (struct drm_device *dev, int crtc);</synopsis> | |
3169 | <para> | |
3170 | Enable or disable vertical blanking interrupts for the given CRTC. | |
3171 | </para> | |
3172 | </listitem> | |
3173 | <listitem> | |
3174 | <synopsis>u32 (*get_vblank_counter) (struct drm_device *dev, int crtc);</synopsis> | |
3175 | <para> | |
3176 | Retrieve the value of the vertical blanking counter for the given | |
3177 | CRTC. If the hardware maintains a vertical blanking counter its value | |
3178 | should be returned. Otherwise drivers can use the | |
3179 | <function>drm_vblank_count</function> helper function to handle this | |
3180 | operation. | |
3181 | </para> | |
3182 | </listitem> | |
3183 | </itemizedlist> | |
2d2ef822 | 3184 | <para> |
9cad9c95 LP |
3185 | Drivers must initialize the vertical blanking handling core with a call to |
3186 | <function>drm_vblank_init</function> in their | |
3187 | <methodname>load</methodname> operation. The function will set the struct | |
3188 | <structname>drm_device</structname> | |
3189 | <structfield>vblank_disable_allowed</structfield> field to 0. This will | |
3190 | keep vertical blanking interrupts enabled permanently until the first mode | |
3191 | set operation, where <structfield>vblank_disable_allowed</structfield> is | |
3192 | set to 1. The reason behind this is not clear. Drivers can set the field | |
3193 | to 1 after <function>calling drm_vblank_init</function> to make vertical | |
3194 | blanking interrupts dynamically managed from the beginning. | |
2d2ef822 | 3195 | </para> |
9cad9c95 LP |
3196 | <para> |
3197 | Vertical blanking interrupts can be enabled by the DRM core or by drivers | |
3198 | themselves (for instance to handle page flipping operations). The DRM core | |
3199 | maintains a vertical blanking use count to ensure that the interrupts are | |
3200 | not disabled while a user still needs them. To increment the use count, | |
3201 | drivers call <function>drm_vblank_get</function>. Upon return vertical | |
3202 | blanking interrupts are guaranteed to be enabled. | |
3203 | </para> | |
3204 | <para> | |
3205 | To decrement the use count drivers call | |
3206 | <function>drm_vblank_put</function>. Only when the use count drops to zero | |
3207 | will the DRM core disable the vertical blanking interrupts after a delay | |
3208 | by scheduling a timer. The delay is accessible through the vblankoffdelay | |
3209 | module parameter or the <varname>drm_vblank_offdelay</varname> global | |
3210 | variable and expressed in milliseconds. Its default value is 5000 ms. | |
4ed0ce3d | 3211 | Zero means never disable, and a negative value means disable immediately. |
00185e66 VS |
3212 | Drivers may override the behaviour by setting the |
3213 | <structname>drm_device</structname> | |
3214 | <structfield>vblank_disable_immediate</structfield> flag, which when set | |
3215 | causes vblank interrupts to be disabled immediately regardless of the | |
3216 | drm_vblank_offdelay value. The flag should only be set if there's a | |
3217 | properly working hardware vblank counter present. | |
9cad9c95 LP |
3218 | </para> |
3219 | <para> | |
3220 | When a vertical blanking interrupt occurs drivers only need to call the | |
3221 | <function>drm_handle_vblank</function> function to account for the | |
3222 | interrupt. | |
3223 | </para> | |
3224 | <para> | |
3225 | Resources allocated by <function>drm_vblank_init</function> must be freed | |
3226 | with a call to <function>drm_vblank_cleanup</function> in the driver | |
3227 | <methodname>unload</methodname> operation handler. | |
3228 | </para> | |
f5752b38 DV |
3229 | <sect2> |
3230 | <title>Vertical Blanking and Interrupt Handling Functions Reference</title> | |
3231 | !Edrivers/gpu/drm/drm_irq.c | |
d743ecf3 | 3232 | !Finclude/drm/drmP.h drm_crtc_vblank_waitqueue |
f5752b38 | 3233 | </sect2> |
9cad9c95 LP |
3234 | </sect1> |
3235 | ||
3236 | <!-- Internals: open/close, file operations and ioctls --> | |
2d2ef822 | 3237 | |
9cad9c95 LP |
3238 | <sect1> |
3239 | <title>Open/Close, File Operations and IOCTLs</title> | |
2d2ef822 | 3240 | <sect2> |
9cad9c95 LP |
3241 | <title>Open and Close</title> |
3242 | <synopsis>int (*firstopen) (struct drm_device *); | |
3243 | void (*lastclose) (struct drm_device *); | |
3244 | int (*open) (struct drm_device *, struct drm_file *); | |
3245 | void (*preclose) (struct drm_device *, struct drm_file *); | |
3246 | void (*postclose) (struct drm_device *, struct drm_file *);</synopsis> | |
3247 | <abstract>Open and close handlers. None of those methods are mandatory. | |
3248 | </abstract> | |
2d2ef822 | 3249 | <para> |
9cad9c95 | 3250 | The <methodname>firstopen</methodname> method is called by the DRM core |
7d14bb6b DV |
3251 | for legacy UMS (User Mode Setting) drivers only when an application |
3252 | opens a device that has no other opened file handle. UMS drivers can | |
3253 | implement it to acquire device resources. KMS drivers can't use the | |
3254 | method and must acquire resources in the <methodname>load</methodname> | |
3255 | method instead. | |
2d2ef822 JB |
3256 | </para> |
3257 | <para> | |
7d14bb6b DV |
3258 | Similarly the <methodname>lastclose</methodname> method is called when |
3259 | the last application holding a file handle opened on the device closes | |
3260 | it, for both UMS and KMS drivers. Additionally, the method is also | |
3261 | called at module unload time or, for hot-pluggable devices, when the | |
3262 | device is unplugged. The <methodname>firstopen</methodname> and | |
9cad9c95 | 3263 | <methodname>lastclose</methodname> calls can thus be unbalanced. |
2d2ef822 JB |
3264 | </para> |
3265 | <para> | |
9cad9c95 LP |
3266 | The <methodname>open</methodname> method is called every time the device |
3267 | is opened by an application. Drivers can allocate per-file private data | |
3268 | in this method and store them in the struct | |
3269 | <structname>drm_file</structname> <structfield>driver_priv</structfield> | |
3270 | field. Note that the <methodname>open</methodname> method is called | |
3271 | before <methodname>firstopen</methodname>. | |
3272 | </para> | |
3273 | <para> | |
3274 | The close operation is split into <methodname>preclose</methodname> and | |
3275 | <methodname>postclose</methodname> methods. Drivers must stop and | |
3276 | cleanup all per-file operations in the <methodname>preclose</methodname> | |
3277 | method. For instance pending vertical blanking and page flip events must | |
3278 | be cancelled. No per-file operation is allowed on the file handle after | |
3279 | returning from the <methodname>preclose</methodname> method. | |
3280 | </para> | |
3281 | <para> | |
3282 | Finally the <methodname>postclose</methodname> method is called as the | |
3283 | last step of the close operation, right before calling the | |
3284 | <methodname>lastclose</methodname> method if no other open file handle | |
3285 | exists for the device. Drivers that have allocated per-file private data | |
3286 | in the <methodname>open</methodname> method should free it here. | |
3287 | </para> | |
3288 | <para> | |
3289 | The <methodname>lastclose</methodname> method should restore CRTC and | |
3290 | plane properties to default value, so that a subsequent open of the | |
7d14bb6b DV |
3291 | device will not inherit state from the previous user. It can also be |
3292 | used to execute delayed power switching state changes, e.g. in | |
6648f487 LW |
3293 | conjunction with the vga_switcheroo infrastructure (see |
3294 | <xref linkend="vga_switcheroo"/>). Beyond that KMS drivers should not | |
3295 | do any further cleanup. Only legacy UMS drivers might need to clean up | |
3296 | device state so that the vga console or an independent fbdev driver | |
3297 | could take over. | |
2d2ef822 JB |
3298 | </para> |
3299 | </sect2> | |
2d2ef822 | 3300 | <sect2> |
9cad9c95 LP |
3301 | <title>File Operations</title> |
3302 | <synopsis>const struct file_operations *fops</synopsis> | |
3303 | <abstract>File operations for the DRM device node.</abstract> | |
2d2ef822 | 3304 | <para> |
9cad9c95 LP |
3305 | Drivers must define the file operations structure that forms the DRM |
3306 | userspace API entry point, even though most of those operations are | |
3307 | implemented in the DRM core. The <methodname>open</methodname>, | |
3308 | <methodname>release</methodname> and <methodname>ioctl</methodname> | |
3309 | operations are handled by | |
3310 | <programlisting> | |
3311 | .owner = THIS_MODULE, | |
3312 | .open = drm_open, | |
3313 | .release = drm_release, | |
3314 | .unlocked_ioctl = drm_ioctl, | |
3315 | #ifdef CONFIG_COMPAT | |
3316 | .compat_ioctl = drm_compat_ioctl, | |
3317 | #endif | |
3318 | </programlisting> | |
2d2ef822 JB |
3319 | </para> |
3320 | <para> | |
9cad9c95 LP |
3321 | Drivers that implement private ioctls that requires 32/64bit |
3322 | compatibility support must provide their own | |
3323 | <methodname>compat_ioctl</methodname> handler that processes private | |
3324 | ioctls and calls <function>drm_compat_ioctl</function> for core ioctls. | |
2d2ef822 JB |
3325 | </para> |
3326 | <para> | |
9cad9c95 LP |
3327 | The <methodname>read</methodname> and <methodname>poll</methodname> |
3328 | operations provide support for reading DRM events and polling them. They | |
3329 | are implemented by | |
3330 | <programlisting> | |
3331 | .poll = drm_poll, | |
3332 | .read = drm_read, | |
9cad9c95 LP |
3333 | .llseek = no_llseek, |
3334 | </programlisting> | |
3335 | </para> | |
3336 | <para> | |
3337 | The memory mapping implementation varies depending on how the driver | |
3338 | manages memory. Pre-GEM drivers will use <function>drm_mmap</function>, | |
3339 | while GEM-aware drivers will use <function>drm_gem_mmap</function>. See | |
3340 | <xref linkend="drm-gem"/>. | |
3341 | <programlisting> | |
3342 | .mmap = drm_gem_mmap, | |
3343 | </programlisting> | |
3344 | </para> | |
3345 | <para> | |
3346 | No other file operation is supported by the DRM API. | |
3347 | </para> | |
3348 | </sect2> | |
3349 | <sect2> | |
3350 | <title>IOCTLs</title> | |
3351 | <synopsis>struct drm_ioctl_desc *ioctls; | |
3352 | int num_ioctls;</synopsis> | |
3353 | <abstract>Driver-specific ioctls descriptors table.</abstract> | |
3354 | <para> | |
3355 | Driver-specific ioctls numbers start at DRM_COMMAND_BASE. The ioctls | |
3356 | descriptors table is indexed by the ioctl number offset from the base | |
3357 | value. Drivers can use the DRM_IOCTL_DEF_DRV() macro to initialize the | |
3358 | table entries. | |
3359 | </para> | |
3360 | <para> | |
3361 | <programlisting>DRM_IOCTL_DEF_DRV(ioctl, func, flags)</programlisting> | |
3362 | <para> | |
3363 | <parameter>ioctl</parameter> is the ioctl name. Drivers must define | |
3364 | the DRM_##ioctl and DRM_IOCTL_##ioctl macros to the ioctl number | |
3365 | offset from DRM_COMMAND_BASE and the ioctl number respectively. The | |
3366 | first macro is private to the device while the second must be exposed | |
3367 | to userspace in a public header. | |
3368 | </para> | |
3369 | <para> | |
3370 | <parameter>func</parameter> is a pointer to the ioctl handler function | |
3371 | compatible with the <type>drm_ioctl_t</type> type. | |
3372 | <programlisting>typedef int drm_ioctl_t(struct drm_device *dev, void *data, | |
3373 | struct drm_file *file_priv);</programlisting> | |
3374 | </para> | |
3375 | <para> | |
3376 | <parameter>flags</parameter> is a bitmask combination of the following | |
3377 | values. It restricts how the ioctl is allowed to be called. | |
3378 | <itemizedlist> | |
3379 | <listitem><para> | |
3380 | DRM_AUTH - Only authenticated callers allowed | |
3381 | </para></listitem> | |
3382 | <listitem><para> | |
3383 | DRM_MASTER - The ioctl can only be called on the master file | |
3384 | handle | |
3385 | </para></listitem> | |
3386 | <listitem><para> | |
3387 | DRM_ROOT_ONLY - Only callers with the SYSADMIN capability allowed | |
3388 | </para></listitem> | |
3389 | <listitem><para> | |
3390 | DRM_CONTROL_ALLOW - The ioctl can only be called on a control | |
3391 | device | |
3392 | </para></listitem> | |
3393 | <listitem><para> | |
3394 | DRM_UNLOCKED - The ioctl handler will be called without locking | |
ea487835 DV |
3395 | the DRM global mutex. This is the enforced default for kms drivers |
3396 | (i.e. using the DRIVER_MODESET flag) and hence shouldn't be used | |
3397 | any more for new drivers. | |
9cad9c95 LP |
3398 | </para></listitem> |
3399 | </itemizedlist> | |
3400 | </para> | |
2d2ef822 | 3401 | </para> |
0aaf20cf | 3402 | !Edrivers/gpu/drm/drm_ioctl.c |
2d2ef822 | 3403 | </sect2> |
2d2ef822 | 3404 | </sect1> |
2d2ef822 | 3405 | <sect1> |
4c6e2dfe | 3406 | <title>Legacy Support Code</title> |
2d2ef822 | 3407 | <para> |
9a6594fc | 3408 | The section very briefly covers some of the old legacy support code which |
4c6e2dfe DV |
3409 | is only used by old DRM drivers which have done a so-called shadow-attach |
3410 | to the underlying device instead of registering as a real driver. This | |
9a6594fc | 3411 | also includes some of the old generic buffer management and command |
4c6e2dfe | 3412 | submission code. Do not use any of this in new and modern drivers. |
2d2ef822 | 3413 | </para> |
2d2ef822 | 3414 | |
4c6e2dfe DV |
3415 | <sect2> |
3416 | <title>Legacy Suspend/Resume</title> | |
3417 | <para> | |
3418 | The DRM core provides some suspend/resume code, but drivers wanting full | |
3419 | suspend/resume support should provide save() and restore() functions. | |
3420 | These are called at suspend, hibernate, or resume time, and should perform | |
3421 | any state save or restore required by your device across suspend or | |
3422 | hibernate states. | |
3423 | </para> | |
3424 | <synopsis>int (*suspend) (struct drm_device *, pm_message_t state); | |
3425 | int (*resume) (struct drm_device *);</synopsis> | |
3426 | <para> | |
3427 | Those are legacy suspend and resume methods which | |
3428 | <emphasis>only</emphasis> work with the legacy shadow-attach driver | |
3429 | registration functions. New driver should use the power management | |
3430 | interface provided by their bus type (usually through | |
3431 | the struct <structname>device_driver</structname> dev_pm_ops) and set | |
3432 | these methods to NULL. | |
3433 | </para> | |
3434 | </sect2> | |
3435 | ||
3436 | <sect2> | |
3437 | <title>Legacy DMA Services</title> | |
3438 | <para> | |
3439 | This should cover how DMA mapping etc. is supported by the core. | |
3440 | These functions are deprecated and should not be used. | |
3441 | </para> | |
3442 | </sect2> | |
2d2ef822 JB |
3443 | </sect1> |
3444 | </chapter> | |
3445 | ||
9cad9c95 LP |
3446 | <!-- TODO |
3447 | ||
3448 | - Add a glossary | |
3449 | - Document the struct_mutex catch-all lock | |
3450 | - Document connector properties | |
3451 | ||
3452 | - Why is the load method optional? | |
3453 | - What are drivers supposed to set the initial display state to, and how? | |
3454 | Connector's DPMS states are not initialized and are thus equal to | |
3455 | DRM_MODE_DPMS_ON. The fbcon compatibility layer calls | |
3456 | drm_helper_disable_unused_functions(), which disables unused encoders and | |
3457 | CRTCs, but doesn't touch the connectors' DPMS state, and | |
3458 | drm_helper_connector_dpms() in reaction to fbdev blanking events. Do drivers | |
3459 | that don't implement (or just don't use) fbcon compatibility need to call | |
3460 | those functions themselves? | |
3461 | - KMS drivers must call drm_vblank_pre_modeset() and drm_vblank_post_modeset() | |
3462 | around mode setting. Should this be done in the DRM core? | |
3463 | - vblank_disable_allowed is set to 1 in the first drm_vblank_post_modeset() | |
3464 | call and never set back to 0. It seems to be safe to permanently set it to 1 | |
3465 | in drm_vblank_init() for KMS driver, and it might be safe for UMS drivers as | |
3466 | well. This should be investigated. | |
3467 | - crtc and connector .save and .restore operations are only used internally in | |
3468 | drivers, should they be removed from the core? | |
3469 | - encoder mid-layer .save and .restore operations are only used internally in | |
3470 | drivers, should they be removed from the core? | |
3471 | - encoder mid-layer .detect operation is only used internally in drivers, | |
3472 | should it be removed from the core? | |
3473 | --> | |
3474 | ||
2d2ef822 JB |
3475 | <!-- External interfaces --> |
3476 | ||
3477 | <chapter id="drmExternals"> | |
3478 | <title>Userland interfaces</title> | |
3479 | <para> | |
3480 | The DRM core exports several interfaces to applications, | |
3481 | generally intended to be used through corresponding libdrm | |
a5294e01 | 3482 | wrapper functions. In addition, drivers export device-specific |
7f0925ac | 3483 | interfaces for use by userspace drivers & device-aware |
2d2ef822 JB |
3484 | applications through ioctls and sysfs files. |
3485 | </para> | |
3486 | <para> | |
3487 | External interfaces include: memory mapping, context management, | |
3488 | DMA operations, AGP management, vblank control, fence | |
3489 | management, memory management, and output management. | |
3490 | </para> | |
3491 | <para> | |
bcd3cfc1 MW |
3492 | Cover generic ioctls and sysfs layout here. We only need high-level |
3493 | info, since man pages should cover the rest. | |
2d2ef822 | 3494 | </para> |
9cad9c95 | 3495 | |
1793126f DH |
3496 | <!-- External: render nodes --> |
3497 | ||
3498 | <sect1> | |
3499 | <title>Render nodes</title> | |
3500 | <para> | |
3501 | DRM core provides multiple character-devices for user-space to use. | |
3502 | Depending on which device is opened, user-space can perform a different | |
3503 | set of operations (mainly ioctls). The primary node is always created | |
00153aeb DV |
3504 | and called card<num>. Additionally, a currently |
3505 | unused control node, called controlD<num> is also | |
1793126f DH |
3506 | created. The primary node provides all legacy operations and |
3507 | historically was the only interface used by userspace. With KMS, the | |
3508 | control node was introduced. However, the planned KMS control interface | |
3509 | has never been written and so the control node stays unused to date. | |
3510 | </para> | |
3511 | <para> | |
3512 | With the increased use of offscreen renderers and GPGPU applications, | |
3513 | clients no longer require running compositors or graphics servers to | |
3514 | make use of a GPU. But the DRM API required unprivileged clients to | |
3515 | authenticate to a DRM-Master prior to getting GPU access. To avoid this | |
3516 | step and to grant clients GPU access without authenticating, render | |
3517 | nodes were introduced. Render nodes solely serve render clients, that | |
3518 | is, no modesetting or privileged ioctls can be issued on render nodes. | |
3519 | Only non-global rendering commands are allowed. If a driver supports | |
00153aeb | 3520 | render nodes, it must advertise it via the DRIVER_RENDER |
1793126f DH |
3521 | DRM driver capability. If not supported, the primary node must be used |
3522 | for render clients together with the legacy drmAuth authentication | |
3523 | procedure. | |
3524 | </para> | |
3525 | <para> | |
3526 | If a driver advertises render node support, DRM core will create a | |
00153aeb | 3527 | separate render node called renderD<num>. There will |
1793126f | 3528 | be one render node per device. No ioctls except PRIME-related ioctls |
00153aeb | 3529 | will be allowed on this node. Especially GEM_OPEN will be |
1793126f DH |
3530 | explicitly prohibited. Render nodes are designed to avoid the |
3531 | buffer-leaks, which occur if clients guess the flink names or mmap | |
3532 | offsets on the legacy interface. Additionally to this basic interface, | |
3533 | drivers must mark their driver-dependent render-only ioctls as | |
00153aeb | 3534 | DRM_RENDER_ALLOW so render clients can use them. Driver |
1793126f DH |
3535 | authors must be careful not to allow any privileged ioctls on render |
3536 | nodes. | |
3537 | </para> | |
3538 | <para> | |
3539 | With render nodes, user-space can now control access to the render node | |
3540 | via basic file-system access-modes. A running graphics server which | |
3541 | authenticates clients on the privileged primary/legacy node is no longer | |
3542 | required. Instead, a client can open the render node and is immediately | |
3543 | granted GPU access. Communication between clients (or servers) is done | |
3544 | via PRIME. FLINK from render node to legacy node is not supported. New | |
3545 | clients must not use the insecure FLINK interface. | |
3546 | </para> | |
3547 | <para> | |
3548 | Besides dropping all modeset/global ioctls, render nodes also drop the | |
3549 | DRM-Master concept. There is no reason to associate render clients with | |
3550 | a DRM-Master as they are independent of any graphics server. Besides, | |
3551 | they must work without any running master, anyway. | |
3552 | Drivers must be able to run without a master object if they support | |
3553 | render nodes. If, on the other hand, a driver requires shared state | |
3554 | between clients which is visible to user-space and accessible beyond | |
3555 | open-file boundaries, they cannot support render nodes. | |
3556 | </para> | |
3557 | </sect1> | |
3558 | ||
9cad9c95 LP |
3559 | <!-- External: vblank handling --> |
3560 | ||
3561 | <sect1> | |
3562 | <title>VBlank event handling</title> | |
3563 | <para> | |
3564 | The DRM core exposes two vertical blank related ioctls: | |
3565 | <variablelist> | |
3566 | <varlistentry> | |
3567 | <term>DRM_IOCTL_WAIT_VBLANK</term> | |
3568 | <listitem> | |
3569 | <para> | |
3570 | This takes a struct drm_wait_vblank structure as its argument, | |
3571 | and it is used to block or request a signal when a specified | |
3572 | vblank event occurs. | |
3573 | </para> | |
3574 | </listitem> | |
3575 | </varlistentry> | |
3576 | <varlistentry> | |
3577 | <term>DRM_IOCTL_MODESET_CTL</term> | |
3578 | <listitem> | |
3579 | <para> | |
8edffbb9 DV |
3580 | This was only used for user-mode-settind drivers around |
3581 | modesetting changes to allow the kernel to update the vblank | |
3582 | interrupt after mode setting, since on many devices the vertical | |
3583 | blank counter is reset to 0 at some point during modeset. Modern | |
3584 | drivers should not call this any more since with kernel mode | |
3585 | setting it is a no-op. | |
9cad9c95 LP |
3586 | </para> |
3587 | </listitem> | |
3588 | </varlistentry> | |
3589 | </variablelist> | |
9cad9c95 LP |
3590 | </para> |
3591 | </sect1> | |
3592 | ||
2d2ef822 | 3593 | </chapter> |
3519f70e DV |
3594 | </part> |
3595 | <part id="drmDrivers"> | |
3596 | <title>DRM Drivers</title> | |
2d2ef822 | 3597 | |
3519f70e DV |
3598 | <partintro> |
3599 | <para> | |
7f817074 LW |
3600 | This second part of the GPU Driver Developer's Guide documents driver |
3601 | code, implementation details and also all the driver-specific userspace | |
3519f70e DV |
3602 | interfaces. Especially since all hardware-acceleration interfaces to |
3603 | userspace are driver specific for efficiency and other reasons these | |
3604 | interfaces can be rather substantial. Hence every driver has its own | |
3605 | chapter. | |
3606 | </para> | |
3607 | </partintro> | |
2d2ef822 | 3608 | |
3519f70e DV |
3609 | <chapter id="drmI915"> |
3610 | <title>drm/i915 Intel GFX Driver</title> | |
2d2ef822 | 3611 | <para> |
3519f70e DV |
3612 | The drm/i915 driver supports all (with the exception of some very early |
3613 | models) integrated GFX chipsets with both Intel display and rendering | |
3614 | blocks. This excludes a set of SoC platforms with an SGX rendering unit, | |
3615 | those have basic support through the gma500 drm driver. | |
2d2ef822 | 3616 | </para> |
e4e7684f DV |
3617 | <sect1> |
3618 | <title>Core Driver Infrastructure</title> | |
3619 | <para> | |
3620 | This section covers core driver infrastructure used by both the display | |
3621 | and the GEM parts of the driver. | |
3622 | </para> | |
3623 | <sect2> | |
3624 | <title>Runtime Power Management</title> | |
3625 | !Pdrivers/gpu/drm/i915/intel_runtime_pm.c runtime pm | |
3626 | !Idrivers/gpu/drm/i915/intel_runtime_pm.c | |
397f6fa6 | 3627 | !Idrivers/gpu/drm/i915/intel_uncore.c |
e4e7684f | 3628 | </sect2> |
fca52a55 DV |
3629 | <sect2> |
3630 | <title>Interrupt Handling</title> | |
3631 | !Pdrivers/gpu/drm/i915/i915_irq.c interrupt handling | |
3632 | !Fdrivers/gpu/drm/i915/i915_irq.c intel_irq_init intel_irq_init_hw intel_hpd_init | |
fca52a55 DV |
3633 | !Fdrivers/gpu/drm/i915/i915_irq.c intel_runtime_pm_disable_interrupts |
3634 | !Fdrivers/gpu/drm/i915/i915_irq.c intel_runtime_pm_enable_interrupts | |
3635 | </sect2> | |
cf9d2890 YZ |
3636 | <sect2> |
3637 | <title>Intel GVT-g Guest Support(vGPU)</title> | |
3638 | !Pdrivers/gpu/drm/i915/i915_vgpu.c Intel GVT-g guest support | |
3639 | !Idrivers/gpu/drm/i915/i915_vgpu.c | |
3640 | </sect2> | |
e4e7684f | 3641 | </sect1> |
3519f70e DV |
3642 | <sect1> |
3643 | <title>Display Hardware Handling</title> | |
3644 | <para> | |
3645 | This section covers everything related to the display hardware including | |
3646 | the mode setting infrastructure, plane, sprite and cursor handling and | |
3647 | display, output probing and related topics. | |
3648 | </para> | |
3649 | <sect2> | |
3650 | <title>Mode Setting Infrastructure</title> | |
3651 | <para> | |
3652 | The i915 driver is thus far the only DRM driver which doesn't use the | |
3653 | common DRM helper code to implement mode setting sequences. Thus it | |
3654 | has its own tailor-made infrastructure for executing a display | |
3655 | configuration change. | |
3656 | </para> | |
3657 | </sect2> | |
b680c37a DV |
3658 | <sect2> |
3659 | <title>Frontbuffer Tracking</title> | |
3660 | !Pdrivers/gpu/drm/i915/intel_frontbuffer.c frontbuffer tracking | |
3661 | !Idrivers/gpu/drm/i915/intel_frontbuffer.c | |
b680c37a | 3662 | !Fdrivers/gpu/drm/i915/i915_gem.c i915_gem_track_fb |
ef07388e DV |
3663 | </sect2> |
3664 | <sect2> | |
3665 | <title>Display FIFO Underrun Reporting</title> | |
3666 | !Pdrivers/gpu/drm/i915/intel_fifo_underrun.c fifo underrun handling | |
3667 | !Idrivers/gpu/drm/i915/intel_fifo_underrun.c | |
b680c37a | 3668 | </sect2> |
3519f70e DV |
3669 | <sect2> |
3670 | <title>Plane Configuration</title> | |
3671 | <para> | |
3672 | This section covers plane configuration and composition with the | |
3673 | primary plane, sprites, cursors and overlays. This includes the | |
3674 | infrastructure to do atomic vsync'ed updates of all this state and | |
3675 | also tightly coupled topics like watermark setup and computation, | |
3676 | framebuffer compression and panel self refresh. | |
3677 | </para> | |
3678 | </sect2> | |
ea2c67bb MR |
3679 | <sect2> |
3680 | <title>Atomic Plane Helpers</title> | |
3681 | !Pdrivers/gpu/drm/i915/intel_atomic_plane.c atomic plane helpers | |
3682 | !Idrivers/gpu/drm/i915/intel_atomic_plane.c | |
3683 | </sect2> | |
3519f70e DV |
3684 | <sect2> |
3685 | <title>Output Probing</title> | |
3686 | <para> | |
3687 | This section covers output probing and related infrastructure like the | |
3688 | hotplug interrupt storm detection and mitigation code. Note that the | |
3689 | i915 driver still uses most of the common DRM helper code for output | |
3690 | probing, so those sections fully apply. | |
3691 | </para> | |
3692 | </sect2> | |
856974a4 JN |
3693 | <sect2> |
3694 | <title>Hotplug</title> | |
3695 | !Pdrivers/gpu/drm/i915/intel_hotplug.c Hotplug | |
3696 | !Idrivers/gpu/drm/i915/intel_hotplug.c | |
3697 | </sect2> | |
28855d2a JN |
3698 | <sect2> |
3699 | <title>High Definition Audio</title> | |
3700 | !Pdrivers/gpu/drm/i915/intel_audio.c High Definition Audio over HDMI and Display Port | |
3701 | !Idrivers/gpu/drm/i915/intel_audio.c | |
cb422619 | 3702 | !Iinclude/drm/i915_component.h |
b2b89f55 RV |
3703 | </sect2> |
3704 | <sect2> | |
3705 | <title>Panel Self Refresh PSR (PSR/SRD)</title> | |
3706 | !Pdrivers/gpu/drm/i915/intel_psr.c Panel Self Refresh (PSR/SRD) | |
3707 | !Idrivers/gpu/drm/i915/intel_psr.c | |
94b83957 RV |
3708 | </sect2> |
3709 | <sect2> | |
3710 | <title>Frame Buffer Compression (FBC)</title> | |
3711 | !Pdrivers/gpu/drm/i915/intel_fbc.c Frame Buffer Compression (FBC) | |
3712 | !Idrivers/gpu/drm/i915/intel_fbc.c | |
b33a2815 VK |
3713 | </sect2> |
3714 | <sect2> | |
3715 | <title>Display Refresh Rate Switching (DRRS)</title> | |
3716 | !Pdrivers/gpu/drm/i915/intel_dp.c Display Refresh Rate Switching (DRRS) | |
3717 | !Fdrivers/gpu/drm/i915/intel_dp.c intel_dp_set_drrs_state | |
3718 | !Fdrivers/gpu/drm/i915/intel_dp.c intel_edp_drrs_enable | |
3719 | !Fdrivers/gpu/drm/i915/intel_dp.c intel_edp_drrs_disable | |
3720 | !Fdrivers/gpu/drm/i915/intel_dp.c intel_edp_drrs_invalidate | |
3721 | !Fdrivers/gpu/drm/i915/intel_dp.c intel_edp_drrs_flush | |
3722 | !Fdrivers/gpu/drm/i915/intel_dp.c intel_dp_drrs_init | |
3723 | ||
28855d2a | 3724 | </sect2> |
0e767189 VS |
3725 | <sect2> |
3726 | <title>DPIO</title> | |
3727 | !Pdrivers/gpu/drm/i915/i915_reg.h DPIO | |
111a9c14 | 3728 | <table id="dpiox2"> |
eee21566 | 3729 | <title>Dual channel PHY (VLV/CHV/BXT)</title> |
111a9c14 VS |
3730 | <tgroup cols="8"> |
3731 | <colspec colname="c0" /> | |
3732 | <colspec colname="c1" /> | |
3733 | <colspec colname="c2" /> | |
3734 | <colspec colname="c3" /> | |
3735 | <colspec colname="c4" /> | |
3736 | <colspec colname="c5" /> | |
3737 | <colspec colname="c6" /> | |
3738 | <colspec colname="c7" /> | |
3739 | <spanspec spanname="ch0" namest="c0" nameend="c3" /> | |
3740 | <spanspec spanname="ch1" namest="c4" nameend="c7" /> | |
3741 | <spanspec spanname="ch0pcs01" namest="c0" nameend="c1" /> | |
3742 | <spanspec spanname="ch0pcs23" namest="c2" nameend="c3" /> | |
3743 | <spanspec spanname="ch1pcs01" namest="c4" nameend="c5" /> | |
3744 | <spanspec spanname="ch1pcs23" namest="c6" nameend="c7" /> | |
3745 | <thead> | |
3746 | <row> | |
3747 | <entry spanname="ch0">CH0</entry> | |
3748 | <entry spanname="ch1">CH1</entry> | |
3749 | </row> | |
3750 | </thead> | |
3751 | <tbody valign="top" align="center"> | |
3752 | <row> | |
3753 | <entry spanname="ch0">CMN/PLL/REF</entry> | |
3754 | <entry spanname="ch1">CMN/PLL/REF</entry> | |
3755 | </row> | |
3756 | <row> | |
3757 | <entry spanname="ch0pcs01">PCS01</entry> | |
3758 | <entry spanname="ch0pcs23">PCS23</entry> | |
3759 | <entry spanname="ch1pcs01">PCS01</entry> | |
3760 | <entry spanname="ch1pcs23">PCS23</entry> | |
3761 | </row> | |
3762 | <row> | |
3763 | <entry>TX0</entry> | |
3764 | <entry>TX1</entry> | |
3765 | <entry>TX2</entry> | |
3766 | <entry>TX3</entry> | |
3767 | <entry>TX0</entry> | |
3768 | <entry>TX1</entry> | |
3769 | <entry>TX2</entry> | |
3770 | <entry>TX3</entry> | |
3771 | </row> | |
3772 | <row> | |
3773 | <entry spanname="ch0">DDI0</entry> | |
3774 | <entry spanname="ch1">DDI1</entry> | |
3775 | </row> | |
3776 | </tbody> | |
3777 | </tgroup> | |
3778 | </table> | |
3779 | <table id="dpiox1"> | |
eee21566 | 3780 | <title>Single channel PHY (CHV/BXT)</title> |
111a9c14 VS |
3781 | <tgroup cols="4"> |
3782 | <colspec colname="c0" /> | |
3783 | <colspec colname="c1" /> | |
3784 | <colspec colname="c2" /> | |
3785 | <colspec colname="c3" /> | |
3786 | <spanspec spanname="ch0" namest="c0" nameend="c3" /> | |
3787 | <spanspec spanname="ch0pcs01" namest="c0" nameend="c1" /> | |
3788 | <spanspec spanname="ch0pcs23" namest="c2" nameend="c3" /> | |
3789 | <thead> | |
3790 | <row> | |
3791 | <entry spanname="ch0">CH0</entry> | |
3792 | </row> | |
3793 | </thead> | |
3794 | <tbody valign="top" align="center"> | |
3795 | <row> | |
3796 | <entry spanname="ch0">CMN/PLL/REF</entry> | |
3797 | </row> | |
3798 | <row> | |
3799 | <entry spanname="ch0pcs01">PCS01</entry> | |
3800 | <entry spanname="ch0pcs23">PCS23</entry> | |
3801 | </row> | |
3802 | <row> | |
3803 | <entry>TX0</entry> | |
3804 | <entry>TX1</entry> | |
3805 | <entry>TX2</entry> | |
3806 | <entry>TX3</entry> | |
3807 | </row> | |
3808 | <row> | |
3809 | <entry spanname="ch0">DDI2</entry> | |
3810 | </row> | |
3811 | </tbody> | |
3812 | </tgroup> | |
3813 | </table> | |
0e767189 | 3814 | </sect2> |
aa9145c4 AM |
3815 | |
3816 | <sect2> | |
3817 | <title>CSR firmware support for DMC</title> | |
3818 | !Pdrivers/gpu/drm/i915/intel_csr.c csr support for dmc | |
3819 | !Idrivers/gpu/drm/i915/intel_csr.c | |
3820 | </sect2> | |
3519f70e | 3821 | </sect1> |
2d2ef822 | 3822 | |
3519f70e DV |
3823 | <sect1> |
3824 | <title>Memory Management and Command Submission</title> | |
3825 | <para> | |
3826 | This sections covers all things related to the GEM implementation in the | |
3827 | i915 driver. | |
3828 | </para> | |
122b2505 DV |
3829 | <sect2> |
3830 | <title>Batchbuffer Parsing</title> | |
3831 | !Pdrivers/gpu/drm/i915/i915_cmd_parser.c batch buffer command parser | |
3832 | !Idrivers/gpu/drm/i915/i915_cmd_parser.c | |
493018dc BV |
3833 | </sect2> |
3834 | <sect2> | |
3835 | <title>Batchbuffer Pools</title> | |
3836 | !Pdrivers/gpu/drm/i915/i915_gem_batch_pool.c batch pool | |
3837 | !Idrivers/gpu/drm/i915/i915_gem_batch_pool.c | |
122b2505 | 3838 | </sect2> |
73e4d07f OM |
3839 | <sect2> |
3840 | <title>Logical Rings, Logical Ring Contexts and Execlists</title> | |
3841 | !Pdrivers/gpu/drm/i915/intel_lrc.c Logical Rings, Logical Ring Contexts and Execlists | |
3842 | !Idrivers/gpu/drm/i915/intel_lrc.c | |
3843 | </sect2> | |
45f8f69a TU |
3844 | <sect2> |
3845 | <title>Global GTT views</title> | |
3846 | !Pdrivers/gpu/drm/i915/i915_gem_gtt.c Global GTT views | |
3847 | !Idrivers/gpu/drm/i915/i915_gem_gtt.c | |
a794f62a DV |
3848 | </sect2> |
3849 | <sect2> | |
3271dca4 | 3850 | <title>GTT Fences and Swizzling</title> |
a794f62a | 3851 | !Idrivers/gpu/drm/i915/i915_gem_fence.c |
3271dca4 DV |
3852 | <sect3> |
3853 | <title>Global GTT Fence Handling</title> | |
3854 | !Pdrivers/gpu/drm/i915/i915_gem_fence.c fence register handling | |
3855 | </sect3> | |
3856 | <sect3> | |
3857 | <title>Hardware Tiling and Swizzling Details</title> | |
3858 | !Pdrivers/gpu/drm/i915/i915_gem_fence.c tiling swizzling details | |
3859 | </sect3> | |
3860 | </sect2> | |
3861 | <sect2> | |
3862 | <title>Object Tiling IOCTLs</title> | |
3863 | !Idrivers/gpu/drm/i915/i915_gem_tiling.c | |
3864 | !Pdrivers/gpu/drm/i915/i915_gem_tiling.c buffer object tiling | |
45f8f69a | 3865 | </sect2> |
7838a63a DV |
3866 | <sect2> |
3867 | <title>Buffer Object Eviction</title> | |
3868 | <para> | |
eb0b44ad | 3869 | This section documents the interface functions for evicting buffer |
7838a63a DV |
3870 | objects to make space available in the virtual gpu address spaces. |
3871 | Note that this is mostly orthogonal to shrinking buffer objects | |
3872 | caches, which has the goal to make main memory (shared with the gpu | |
3873 | through the unified memory architecture) available. | |
3874 | </para> | |
3875 | !Idrivers/gpu/drm/i915/i915_gem_evict.c | |
3876 | </sect2> | |
eb0b44ad DV |
3877 | <sect2> |
3878 | <title>Buffer Object Memory Shrinking</title> | |
3879 | <para> | |
3880 | This section documents the interface function for shrinking memory | |
3881 | usage of buffer object caches. Shrinking is used to make main memory | |
3882 | available. Note that this is mostly orthogonal to evicting buffer | |
3883 | objects, which has the goal to make space in gpu virtual address | |
3884 | spaces. | |
3885 | </para> | |
3886 | !Idrivers/gpu/drm/i915/i915_gem_shrinker.c | |
3887 | </sect2> | |
3519f70e | 3888 | </sect1> |
d1675198 | 3889 | <sect1> |
feda33ef | 3890 | <title>GuC</title> |
d1675198 | 3891 | <sect2> |
feda33ef | 3892 | <title>GuC-specific firmware loader</title> |
d1675198 AD |
3893 | !Pdrivers/gpu/drm/i915/intel_guc_loader.c GuC-specific firmware loader |
3894 | !Idrivers/gpu/drm/i915/intel_guc_loader.c | |
3895 | </sect2> | |
3896 | <sect2> | |
feda33ef AD |
3897 | <title>GuC-based command submission</title> |
3898 | !Pdrivers/gpu/drm/i915/i915_guc_submission.c GuC-based command submission | |
cff4f55b | 3899 | !Idrivers/gpu/drm/i915/i915_guc_submission.c |
d1675198 | 3900 | </sect2> |
feda33ef AD |
3901 | <sect2> |
3902 | <title>GuC Firmware Layout</title> | |
3903 | !Pdrivers/gpu/drm/i915/intel_guc_fwif.h GuC Firmware Layout | |
3904 | </sect2> | |
d1675198 AD |
3905 | </sect1> |
3906 | ||
198c974d DCS |
3907 | <sect1> |
3908 | <title> Tracing </title> | |
3909 | <para> | |
3910 | This sections covers all things related to the tracepoints implemented in | |
3911 | the i915 driver. | |
3912 | </para> | |
3913 | <sect2> | |
3914 | <title> i915_ppgtt_create and i915_ppgtt_release </title> | |
3915 | !Pdrivers/gpu/drm/i915/i915_trace.h i915_ppgtt_create and i915_ppgtt_release tracepoints | |
3916 | </sect2> | |
3917 | <sect2> | |
3918 | <title> i915_context_create and i915_context_free </title> | |
3919 | !Pdrivers/gpu/drm/i915/i915_trace.h i915_context_create and i915_context_free tracepoints | |
3920 | </sect2> | |
3921 | <sect2> | |
3922 | <title> switch_mm </title> | |
3923 | !Pdrivers/gpu/drm/i915/i915_trace.h switch_mm tracepoint | |
3924 | </sect2> | |
3925 | </sect1> | |
3926 | ||
3519f70e | 3927 | </chapter> |
fca52a55 | 3928 | !Cdrivers/gpu/drm/i915/i915_irq.c |
3519f70e | 3929 | </part> |
6648f487 LW |
3930 | |
3931 | <part id="vga_switcheroo"> | |
3932 | <title>vga_switcheroo</title> | |
3933 | <partintro> | |
3934 | !Pdrivers/gpu/vga/vga_switcheroo.c Overview | |
3935 | </partintro> | |
3936 | ||
3937 | <chapter id="modes_of_use"> | |
3938 | <title>Modes of Use</title> | |
3939 | <sect1> | |
3940 | <title>Manual switching and manual power control</title> | |
3941 | !Pdrivers/gpu/vga/vga_switcheroo.c Manual switching and manual power control | |
3942 | </sect1> | |
3943 | <sect1> | |
3944 | <title>Driver power control</title> | |
3945 | !Pdrivers/gpu/vga/vga_switcheroo.c Driver power control | |
3946 | </sect1> | |
3947 | </chapter> | |
3948 | ||
3949 | <chapter id="pubfunctions"> | |
3950 | <title>Public functions</title> | |
3951 | !Edrivers/gpu/vga/vga_switcheroo.c | |
3952 | </chapter> | |
3953 | ||
3954 | <chapter id="pubstructures"> | |
3955 | <title>Public structures</title> | |
3956 | !Finclude/linux/vga_switcheroo.h vga_switcheroo_handler | |
3957 | !Finclude/linux/vga_switcheroo.h vga_switcheroo_client_ops | |
3958 | </chapter> | |
3959 | ||
3960 | <chapter id="pubconstants"> | |
3961 | <title>Public constants</title> | |
3962 | !Finclude/linux/vga_switcheroo.h vga_switcheroo_client_id | |
3963 | !Finclude/linux/vga_switcheroo.h vga_switcheroo_state | |
3964 | </chapter> | |
3965 | ||
3966 | <chapter id="privstructures"> | |
3967 | <title>Private structures</title> | |
3968 | !Fdrivers/gpu/vga/vga_switcheroo.c vgasr_priv | |
3969 | !Fdrivers/gpu/vga/vga_switcheroo.c vga_switcheroo_client | |
3970 | </chapter> | |
3971 | ||
3972 | !Cdrivers/gpu/vga/vga_switcheroo.c | |
3973 | !Cinclude/linux/vga_switcheroo.h | |
3974 | </part> | |
3975 | ||
2d2ef822 | 3976 | </book> |