blob: 795a5ec309e2c01961cfe49215769d0aecdf02e2 [file] [log] [blame]
Jani Nikulacb597fc2016-06-21 14:48:57 +03001==================================
2Linux GPU Driver Developer's Guide
3==================================
4
5:Author: Jesse Barnes Initial version
6:Author: Laurent Pinchart Driver internals
7:Author: Daniel Vetter Contributions all over the place
8:Author: Lukas Wunner vga_switcheroo documentation
9:Date: 2015-10-11
10
11This first part of the GPU Driver Developer's Guide documents core DRM
12code, helper libraries for writing drivers and generic userspace
13interfaces exposed by DRM drivers.
14
15Introduction
16============
17
18The Linux DRM layer contains code intended to support the needs of
19complex graphics devices, usually containing programmable pipelines well
20suited to 3D graphics acceleration. Graphics drivers in the kernel may
21make use of DRM functions to make tasks like memory management,
22interrupt handling and DMA easier, and provide a uniform interface to
23applications.
24
25A note on versions: this guide covers features found in the DRM tree,
26including the TTM memory manager, output configuration and mode setting,
27and the new vblank internals, in addition to all the regular features
28found in current kernels.
29
30[Insert diagram of typical DRM stack here]
31
32Style Guidelines
33----------------
34
35For consistency this documentation uses American English. Abbreviations
36are written as all-uppercase, for example: DRM, KMS, IOCTL, CRTC, and so
37on. To aid in reading, documentations make full use of the markup
38characters kerneldoc provides: @parameter for function parameters,
39@member for structure members, &structure to reference structures and
40function() for functions. These all get automatically hyperlinked if
41kerneldoc for the referenced objects exists. When referencing entries in
42function vtables please use ->vfunc(). Note that kerneldoc does not
43support referencing struct members directly, so please add a reference
44to the vtable struct somewhere in the same paragraph or at least
45section.
46
47Except in special situations (to separate locked from unlocked variants)
48locking requirements for functions aren't documented in the kerneldoc.
49Instead locking should be check at runtime using e.g.
50``WARN_ON(!mutex_is_locked(...));``. Since it's much easier to ignore
51documentation than runtime noise this provides more value. And on top of
52that runtime checks do need to be updated when the locking rules change,
53increasing the chances that they're correct. Within the documentation
54the locking rules should be explained in the relevant structures: Either
55in the comment for the lock explaining what it protects, or data fields
56need a note about which lock protects them, or both.
57
58Functions which have a non-\ ``void`` return value should have a section
59called "Returns" explaining the expected return values in different
60cases and their meanings. Currently there's no consensus whether that
61section name should be all upper-case or not, and whether it should end
62in a colon or not. Go with the file-local style. Other common section
63names are "Notes" with information for dangerous or tricky corner cases,
64and "FIXME" where the interface could be cleaned up.
65
66DRM Internals
67=============
68
69This chapter documents DRM internals relevant to driver authors and
70developers working to add support for the latest features to existing
71drivers.
72
73First, we go over some typical driver initialization requirements, like
74setting up command buffers, creating an initial output configuration,
75and initializing core services. Subsequent sections cover core internals
76in more detail, providing implementation notes and examples.
77
78The DRM layer provides several services to graphics drivers, many of
79them driven by the application interfaces it provides through libdrm,
80the library that wraps most of the DRM ioctls. These include vblank
81event handling, memory management, output management, framebuffer
82management, command submission & fencing, suspend/resume support, and
83DMA services.
84
85Driver Initialization
86---------------------
87
88At the core of every DRM driver is a :c:type:`struct drm_driver
89<drm_driver>` structure. Drivers typically statically initialize
90a drm_driver structure, and then pass it to
91:c:func:`drm_dev_alloc()` to allocate a device instance. After the
92device instance is fully initialized it can be registered (which makes
93it accessible from userspace) using :c:func:`drm_dev_register()`.
94
95The :c:type:`struct drm_driver <drm_driver>` structure
96contains static information that describes the driver and features it
97supports, and pointers to methods that the DRM core will call to
98implement the DRM API. We will first go through the :c:type:`struct
99drm_driver <drm_driver>` static information fields, and will
100then describe individual operations in details as they get used in later
101sections.
102
103Driver Information
104~~~~~~~~~~~~~~~~~~
105
106Driver Features
107^^^^^^^^^^^^^^^
108
109Drivers inform the DRM core about their requirements and supported
110features by setting appropriate flags in the driver_features field.
111Since those flags influence the DRM core behaviour since registration
112time, most of them must be set to registering the :c:type:`struct
113drm_driver <drm_driver>` instance.
114
115u32 driver_features;
116
117DRIVER_USE_AGP
118 Driver uses AGP interface, the DRM core will manage AGP resources.
119
120DRIVER_REQUIRE_AGP
121 Driver needs AGP interface to function. AGP initialization failure
122 will become a fatal error.
123
124DRIVER_PCI_DMA
125 Driver is capable of PCI DMA, mapping of PCI DMA buffers to
126 userspace will be enabled. Deprecated.
127
128DRIVER_SG
129 Driver can perform scatter/gather DMA, allocation and mapping of
130 scatter/gather buffers will be enabled. Deprecated.
131
132DRIVER_HAVE_DMA
133 Driver supports DMA, the userspace DMA API will be supported.
134 Deprecated.
135
136DRIVER_HAVE_IRQ; DRIVER_IRQ_SHARED
137 DRIVER_HAVE_IRQ indicates whether the driver has an IRQ handler
138 managed by the DRM Core. The core will support simple IRQ handler
139 installation when the flag is set. The installation process is
140 described in ?.
141
142 DRIVER_IRQ_SHARED indicates whether the device & handler support
143 shared IRQs (note that this is required of PCI drivers).
144
145DRIVER_GEM
146 Driver use the GEM memory manager.
147
148DRIVER_MODESET
149 Driver supports mode setting interfaces (KMS).
150
151DRIVER_PRIME
152 Driver implements DRM PRIME buffer sharing.
153
154DRIVER_RENDER
155 Driver supports dedicated render nodes.
156
157DRIVER_ATOMIC
158 Driver supports atomic properties. In this case the driver must
159 implement appropriate obj->atomic_get_property() vfuncs for any
160 modeset objects with driver specific properties.
161
162Major, Minor and Patchlevel
163^^^^^^^^^^^^^^^^^^^^^^^^^^^
164
165int major; int minor; int patchlevel;
166The DRM core identifies driver versions by a major, minor and patch
167level triplet. The information is printed to the kernel log at
168initialization time and passed to userspace through the
169DRM_IOCTL_VERSION ioctl.
170
171The major and minor numbers are also used to verify the requested driver
172API version passed to DRM_IOCTL_SET_VERSION. When the driver API
173changes between minor versions, applications can call
174DRM_IOCTL_SET_VERSION to select a specific version of the API. If the
175requested major isn't equal to the driver major, or the requested minor
176is larger than the driver minor, the DRM_IOCTL_SET_VERSION call will
177return an error. Otherwise the driver's set_version() method will be
178called with the requested version.
179
180Name, Description and Date
181^^^^^^^^^^^^^^^^^^^^^^^^^^
182
183char \*name; char \*desc; char \*date;
184The driver name is printed to the kernel log at initialization time,
185used for IRQ registration and passed to userspace through
186DRM_IOCTL_VERSION.
187
188The driver description is a purely informative string passed to
189userspace through the DRM_IOCTL_VERSION ioctl and otherwise unused by
190the kernel.
191
192The driver date, formatted as YYYYMMDD, is meant to identify the date of
193the latest modification to the driver. However, as most drivers fail to
194update it, its value is mostly useless. The DRM core prints it to the
195kernel log at initialization time and passes it to userspace through the
196DRM_IOCTL_VERSION ioctl.
197
198Device Instance and Driver Handling
199~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
200
201.. kernel-doc:: drivers/gpu/drm/drm_drv.c
202 :doc: driver instance overview
203
204.. kernel-doc:: drivers/gpu/drm/drm_drv.c
205 :export:
206
207Driver Load
208~~~~~~~~~~~
209
210IRQ Registration
211^^^^^^^^^^^^^^^^
212
213The DRM core tries to facilitate IRQ handler registration and
214unregistration by providing :c:func:`drm_irq_install()` and
215:c:func:`drm_irq_uninstall()` functions. Those functions only
216support a single interrupt per device, devices that use more than one
217IRQs need to be handled manually.
218
219Managed IRQ Registration
220''''''''''''''''''''''''
221
222:c:func:`drm_irq_install()` starts by calling the irq_preinstall
223driver operation. The operation is optional and must make sure that the
224interrupt will not get fired by clearing all pending interrupt flags or
225disabling the interrupt.
226
227The passed-in IRQ will then be requested by a call to
228:c:func:`request_irq()`. If the DRIVER_IRQ_SHARED driver feature
229flag is set, a shared (IRQF_SHARED) IRQ handler will be requested.
230
231The IRQ handler function must be provided as the mandatory irq_handler
232driver operation. It will get passed directly to
233:c:func:`request_irq()` and thus has the same prototype as all IRQ
234handlers. It will get called with a pointer to the DRM device as the
235second argument.
236
237Finally the function calls the optional irq_postinstall driver
238operation. The operation usually enables interrupts (excluding the
239vblank interrupt, which is enabled separately), but drivers may choose
240to enable/disable interrupts at a different time.
241
242:c:func:`drm_irq_uninstall()` is similarly used to uninstall an
243IRQ handler. It starts by waking up all processes waiting on a vblank
244interrupt to make sure they don't hang, and then calls the optional
245irq_uninstall driver operation. The operation must disable all hardware
246interrupts. Finally the function frees the IRQ by calling
247:c:func:`free_irq()`.
248
249Manual IRQ Registration
250'''''''''''''''''''''''
251
252Drivers that require multiple interrupt handlers can't use the managed
253IRQ registration functions. In that case IRQs must be registered and
254unregistered manually (usually with the :c:func:`request_irq()` and
255:c:func:`free_irq()` functions, or their devm_\* equivalent).
256
257When manually registering IRQs, drivers must not set the
258DRIVER_HAVE_IRQ driver feature flag, and must not provide the
259irq_handler driver operation. They must set the :c:type:`struct
260drm_device <drm_device>` irq_enabled field to 1 upon
261registration of the IRQs, and clear it to 0 after unregistering the
262IRQs.
263
264Memory Manager Initialization
265^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
266
267Every DRM driver requires a memory manager which must be initialized at
268load time. DRM currently contains two memory managers, the Translation
269Table Manager (TTM) and the Graphics Execution Manager (GEM). This
270document describes the use of the GEM memory manager only. See ? for
271details.
272
273Miscellaneous Device Configuration
274^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
275
276Another task that may be necessary for PCI devices during configuration
277is mapping the video BIOS. On many devices, the VBIOS describes device
278configuration, LCD panel timings (if any), and contains flags indicating
279device state. Mapping the BIOS can be done using the pci_map_rom()
280call, a convenience function that takes care of mapping the actual ROM,
281whether it has been shadowed into memory (typically at address 0xc0000)
282or exists on the PCI device in the ROM BAR. Note that after the ROM has
283been mapped and any necessary information has been extracted, it should
284be unmapped; on many devices, the ROM address decoder is shared with
285other BARs, so leaving it mapped could cause undesired behaviour like
286hangs or memory corruption.
287
288Bus-specific Device Registration and PCI Support
289~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
290
291A number of functions are provided to help with device registration. The
292functions deal with PCI and platform devices respectively and are only
293provided for historical reasons. These are all deprecated and shouldn't
294be used in new drivers. Besides that there's a few helpers for pci
295drivers.
296
297.. kernel-doc:: drivers/gpu/drm/drm_pci.c
298 :export:
299
300.. kernel-doc:: drivers/gpu/drm/drm_platform.c
301 :export:
302
303Memory management
304-----------------
305
306Modern Linux systems require large amount of graphics memory to store
307frame buffers, textures, vertices and other graphics-related data. Given
308the very dynamic nature of many of that data, managing graphics memory
309efficiently is thus crucial for the graphics stack and plays a central
310role in the DRM infrastructure.
311
312The DRM core includes two memory managers, namely Translation Table Maps
313(TTM) and Graphics Execution Manager (GEM). TTM was the first DRM memory
314manager to be developed and tried to be a one-size-fits-them all
315solution. It provides a single userspace API to accommodate the need of
316all hardware, supporting both Unified Memory Architecture (UMA) devices
317and devices with dedicated video RAM (i.e. most discrete video cards).
318This resulted in a large, complex piece of code that turned out to be
319hard to use for driver development.
320
321GEM started as an Intel-sponsored project in reaction to TTM's
322complexity. Its design philosophy is completely different: instead of
323providing a solution to every graphics memory-related problems, GEM
324identified common code between drivers and created a support library to
325share it. GEM has simpler initialization and execution requirements than
326TTM, but has no video RAM management capabilities and is thus limited to
327UMA devices.
328
329The Translation Table Manager (TTM)
330~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
331
332TTM design background and information belongs here.
333
334TTM initialization
335^^^^^^^^^^^^^^^^^^
336
337 **Warning**
338
339 This section is outdated.
340
341Drivers wishing to support TTM must fill out a drm_bo_driver
342structure. The structure contains several fields with function pointers
343for initializing the TTM, allocating and freeing memory, waiting for
344command completion and fence synchronization, and memory migration. See
345the radeon_ttm.c file for an example of usage.
346
347The ttm_global_reference structure is made up of several fields:
348
349::
350
351 struct ttm_global_reference {
352 enum ttm_global_types global_type;
353 size_t size;
354 void *object;
355 int (*init) (struct ttm_global_reference *);
356 void (*release) (struct ttm_global_reference *);
357 };
358
359
360There should be one global reference structure for your memory manager
361as a whole, and there will be others for each object created by the
362memory manager at runtime. Your global TTM should have a type of
363TTM_GLOBAL_TTM_MEM. The size field for the global object should be
364sizeof(struct ttm_mem_global), and the init and release hooks should
365point at your driver-specific init and release routines, which probably
366eventually call ttm_mem_global_init and ttm_mem_global_release,
367respectively.
368
369Once your global TTM accounting structure is set up and initialized by
370calling ttm_global_item_ref() on it, you need to create a buffer
371object TTM to provide a pool for buffer object allocation by clients and
372the kernel itself. The type of this object should be
373TTM_GLOBAL_TTM_BO, and its size should be sizeof(struct
374ttm_bo_global). Again, driver-specific init and release functions may
375be provided, likely eventually calling ttm_bo_global_init() and
376ttm_bo_global_release(), respectively. Also, like the previous
377object, ttm_global_item_ref() is used to create an initial reference
378count for the TTM, which will call your initialization function.
379
380The Graphics Execution Manager (GEM)
381~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
382
383The GEM design approach has resulted in a memory manager that doesn't
384provide full coverage of all (or even all common) use cases in its
385userspace or kernel API. GEM exposes a set of standard memory-related
386operations to userspace and a set of helper functions to drivers, and
387let drivers implement hardware-specific operations with their own
388private API.
389
390The GEM userspace API is described in the `GEM - the Graphics Execution
391Manager <http://lwn.net/Articles/283798/>`__ article on LWN. While
392slightly outdated, the document provides a good overview of the GEM API
393principles. Buffer allocation and read and write operations, described
394as part of the common GEM API, are currently implemented using
395driver-specific ioctls.
396
397GEM is data-agnostic. It manages abstract buffer objects without knowing
398what individual buffers contain. APIs that require knowledge of buffer
399contents or purpose, such as buffer allocation or synchronization
400primitives, are thus outside of the scope of GEM and must be implemented
401using driver-specific ioctls.
402
403On a fundamental level, GEM involves several operations:
404
405- Memory allocation and freeing
406- Command execution
407- Aperture management at command execution time
408
409Buffer object allocation is relatively straightforward and largely
410provided by Linux's shmem layer, which provides memory to back each
411object.
412
413Device-specific operations, such as command execution, pinning, buffer
414read & write, mapping, and domain ownership transfers are left to
415driver-specific ioctls.
416
417GEM Initialization
418^^^^^^^^^^^^^^^^^^
419
420Drivers that use GEM must set the DRIVER_GEM bit in the struct
421:c:type:`struct drm_driver <drm_driver>` driver_features
422field. The DRM core will then automatically initialize the GEM core
423before calling the load operation. Behind the scene, this will create a
424DRM Memory Manager object which provides an address space pool for
425object allocation.
426
427In a KMS configuration, drivers need to allocate and initialize a
428command ring buffer following core GEM initialization if required by the
429hardware. UMA devices usually have what is called a "stolen" memory
430region, which provides space for the initial framebuffer and large,
431contiguous memory regions required by the device. This space is
432typically not managed by GEM, and must be initialized separately into
433its own DRM MM object.
434
435GEM Objects Creation
436^^^^^^^^^^^^^^^^^^^^
437
438GEM splits creation of GEM objects and allocation of the memory that
439backs them in two distinct operations.
440
441GEM objects are represented by an instance of struct :c:type:`struct
442drm_gem_object <drm_gem_object>`. Drivers usually need to
443extend GEM objects with private information and thus create a
444driver-specific GEM object structure type that embeds an instance of
445struct :c:type:`struct drm_gem_object <drm_gem_object>`.
446
447To create a GEM object, a driver allocates memory for an instance of its
448specific GEM object type and initializes the embedded struct
449:c:type:`struct drm_gem_object <drm_gem_object>` with a call
450to :c:func:`drm_gem_object_init()`. The function takes a pointer
451to the DRM device, a pointer to the GEM object and the buffer object
452size in bytes.
453
454GEM uses shmem to allocate anonymous pageable memory.
455:c:func:`drm_gem_object_init()` will create an shmfs file of the
456requested size and store it into the struct :c:type:`struct
457drm_gem_object <drm_gem_object>` filp field. The memory is
458used as either main storage for the object when the graphics hardware
459uses system memory directly or as a backing store otherwise.
460
461Drivers are responsible for the actual physical pages allocation by
462calling :c:func:`shmem_read_mapping_page_gfp()` for each page.
463Note that they can decide to allocate pages when initializing the GEM
464object, or to delay allocation until the memory is needed (for instance
465when a page fault occurs as a result of a userspace memory access or
466when the driver needs to start a DMA transfer involving the memory).
467
468Anonymous pageable memory allocation is not always desired, for instance
469when the hardware requires physically contiguous system memory as is
470often the case in embedded devices. Drivers can create GEM objects with
471no shmfs backing (called private GEM objects) by initializing them with
472a call to :c:func:`drm_gem_private_object_init()` instead of
473:c:func:`drm_gem_object_init()`. Storage for private GEM objects
474must be managed by drivers.
475
476GEM Objects Lifetime
477^^^^^^^^^^^^^^^^^^^^
478
479All GEM objects are reference-counted by the GEM core. References can be
480acquired and release by :c:func:`calling
481drm_gem_object_reference()` and
482:c:func:`drm_gem_object_unreference()` respectively. The caller
483must hold the :c:type:`struct drm_device <drm_device>`
484struct_mutex lock when calling
485:c:func:`drm_gem_object_reference()`. As a convenience, GEM
486provides :c:func:`drm_gem_object_unreference_unlocked()`
487functions that can be called without holding the lock.
488
489When the last reference to a GEM object is released the GEM core calls
490the :c:type:`struct drm_driver <drm_driver>` gem_free_object
491operation. That operation is mandatory for GEM-enabled drivers and must
492free the GEM object and all associated resources.
493
494void (\*gem_free_object) (struct drm_gem_object \*obj); Drivers are
495responsible for freeing all GEM object resources. This includes the
496resources created by the GEM core, which need to be released with
497:c:func:`drm_gem_object_release()`.
498
499GEM Objects Naming
500^^^^^^^^^^^^^^^^^^
501
502Communication between userspace and the kernel refers to GEM objects
503using local handles, global names or, more recently, file descriptors.
504All of those are 32-bit integer values; the usual Linux kernel limits
505apply to the file descriptors.
506
507GEM handles are local to a DRM file. Applications get a handle to a GEM
508object through a driver-specific ioctl, and can use that handle to refer
509to the GEM object in other standard or driver-specific ioctls. Closing a
510DRM file handle frees all its GEM handles and dereferences the
511associated GEM objects.
512
513To create a handle for a GEM object drivers call
514:c:func:`drm_gem_handle_create()`. The function takes a pointer
515to the DRM file and the GEM object and returns a locally unique handle.
516When the handle is no longer needed drivers delete it with a call to
517:c:func:`drm_gem_handle_delete()`. Finally the GEM object
518associated with a handle can be retrieved by a call to
519:c:func:`drm_gem_object_lookup()`.
520
521Handles don't take ownership of GEM objects, they only take a reference
522to the object that will be dropped when the handle is destroyed. To
523avoid leaking GEM objects, drivers must make sure they drop the
524reference(s) they own (such as the initial reference taken at object
525creation time) as appropriate, without any special consideration for the
526handle. For example, in the particular case of combined GEM object and
527handle creation in the implementation of the dumb_create operation,
528drivers must drop the initial reference to the GEM object before
529returning the handle.
530
531GEM names are similar in purpose to handles but are not local to DRM
532files. They can be passed between processes to reference a GEM object
533globally. Names can't be used directly to refer to objects in the DRM
534API, applications must convert handles to names and names to handles
535using the DRM_IOCTL_GEM_FLINK and DRM_IOCTL_GEM_OPEN ioctls
536respectively. The conversion is handled by the DRM core without any
537driver-specific support.
538
539GEM also supports buffer sharing with dma-buf file descriptors through
540PRIME. GEM-based drivers must use the provided helpers functions to
541implement the exporting and importing correctly. See ?. Since sharing
542file descriptors is inherently more secure than the easily guessable and
543global GEM names it is the preferred buffer sharing mechanism. Sharing
544buffers through GEM names is only supported for legacy userspace.
545Furthermore PRIME also allows cross-device buffer sharing since it is
546based on dma-bufs.
547
548GEM Objects Mapping
549^^^^^^^^^^^^^^^^^^^
550
551Because mapping operations are fairly heavyweight GEM favours
552read/write-like access to buffers, implemented through driver-specific
553ioctls, over mapping buffers to userspace. However, when random access
554to the buffer is needed (to perform software rendering for instance),
555direct access to the object can be more efficient.
556
557The mmap system call can't be used directly to map GEM objects, as they
558don't have their own file handle. Two alternative methods currently
559co-exist to map GEM objects to userspace. The first method uses a
560driver-specific ioctl to perform the mapping operation, calling
561:c:func:`do_mmap()` under the hood. This is often considered
562dubious, seems to be discouraged for new GEM-enabled drivers, and will
563thus not be described here.
564
565The second method uses the mmap system call on the DRM file handle. void
566\*mmap(void \*addr, size_t length, int prot, int flags, int fd, off_t
567offset); DRM identifies the GEM object to be mapped by a fake offset
568passed through the mmap offset argument. Prior to being mapped, a GEM
569object must thus be associated with a fake offset. To do so, drivers
570must call :c:func:`drm_gem_create_mmap_offset()` on the object.
571
572Once allocated, the fake offset value must be passed to the application
573in a driver-specific way and can then be used as the mmap offset
574argument.
575
576The GEM core provides a helper method :c:func:`drm_gem_mmap()` to
577handle object mapping. The method can be set directly as the mmap file
578operation handler. It will look up the GEM object based on the offset
579value and set the VMA operations to the :c:type:`struct drm_driver
580<drm_driver>` gem_vm_ops field. Note that
581:c:func:`drm_gem_mmap()` doesn't map memory to userspace, but
582relies on the driver-provided fault handler to map pages individually.
583
584To use :c:func:`drm_gem_mmap()`, drivers must fill the struct
585:c:type:`struct drm_driver <drm_driver>` gem_vm_ops field
586with a pointer to VM operations.
587
588struct vm_operations_struct \*gem_vm_ops struct
589vm_operations_struct { void (\*open)(struct vm_area_struct \* area);
590void (\*close)(struct vm_area_struct \* area); int (\*fault)(struct
591vm_area_struct \*vma, struct vm_fault \*vmf); };
592
593The open and close operations must update the GEM object reference
594count. Drivers can use the :c:func:`drm_gem_vm_open()` and
595:c:func:`drm_gem_vm_close()` helper functions directly as open
596and close handlers.
597
598The fault operation handler is responsible for mapping individual pages
599to userspace when a page fault occurs. Depending on the memory
600allocation scheme, drivers can allocate pages at fault time, or can
601decide to allocate memory for the GEM object at the time the object is
602created.
603
604Drivers that want to map the GEM object upfront instead of handling page
605faults can implement their own mmap file operation handler.
606
607Memory Coherency
608^^^^^^^^^^^^^^^^
609
610When mapped to the device or used in a command buffer, backing pages for
611an object are flushed to memory and marked write combined so as to be
612coherent with the GPU. Likewise, if the CPU accesses an object after the
613GPU has finished rendering to the object, then the object must be made
614coherent with the CPU's view of memory, usually involving GPU cache
615flushing of various kinds. This core CPU<->GPU coherency management is
616provided by a device-specific ioctl, which evaluates an object's current
617domain and performs any necessary flushing or synchronization to put the
618object into the desired coherency domain (note that the object may be
619busy, i.e. an active render target; in that case, setting the domain
620blocks the client and waits for rendering to complete before performing
621any necessary flushing operations).
622
623Command Execution
624^^^^^^^^^^^^^^^^^
625
626Perhaps the most important GEM function for GPU devices is providing a
627command execution interface to clients. Client programs construct
628command buffers containing references to previously allocated memory
629objects, and then submit them to GEM. At that point, GEM takes care to
630bind all the objects into the GTT, execute the buffer, and provide
631necessary synchronization between clients accessing the same buffers.
632This often involves evicting some objects from the GTT and re-binding
633others (a fairly expensive operation), and providing relocation support
634which hides fixed GTT offsets from clients. Clients must take care not
635to submit command buffers that reference more objects than can fit in
636the GTT; otherwise, GEM will reject them and no rendering will occur.
637Similarly, if several objects in the buffer require fence registers to
638be allocated for correct rendering (e.g. 2D blits on pre-965 chips),
639care must be taken not to require more fence registers than are
640available to the client. Such resource management should be abstracted
641from the client in libdrm.
642
643GEM Function Reference
644~~~~~~~~~~~~~~~~~~~~~~
645
646.. kernel-doc:: drivers/gpu/drm/drm_gem.c
647 :export:
648
649.. kernel-doc:: include/drm/drm_gem.h
650 :internal:
651
652VMA Offset Manager
653~~~~~~~~~~~~~~~~~~
654
655.. kernel-doc:: drivers/gpu/drm/drm_vma_manager.c
656 :doc: vma offset manager
657
658.. kernel-doc:: drivers/gpu/drm/drm_vma_manager.c
659 :export:
660
661.. kernel-doc:: include/drm/drm_vma_manager.h
662 :internal:
663
664PRIME Buffer Sharing
665~~~~~~~~~~~~~~~~~~~~
666
667PRIME is the cross device buffer sharing framework in drm, originally
668created for the OPTIMUS range of multi-gpu platforms. To userspace PRIME
669buffers are dma-buf based file descriptors.
670
671Overview and Driver Interface
672^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
673
674Similar to GEM global names, PRIME file descriptors are also used to
675share buffer objects across processes. They offer additional security:
676as file descriptors must be explicitly sent over UNIX domain sockets to
677be shared between applications, they can't be guessed like the globally
678unique GEM names.
679
680Drivers that support the PRIME API must set the DRIVER_PRIME bit in the
681struct :c:type:`struct drm_driver <drm_driver>`
682driver_features field, and implement the prime_handle_to_fd and
683prime_fd_to_handle operations.
684
685int (\*prime_handle_to_fd)(struct drm_device \*dev, struct drm_file
686\*file_priv, uint32_t handle, uint32_t flags, int \*prime_fd); int
687(\*prime_fd_to_handle)(struct drm_device \*dev, struct drm_file
688\*file_priv, int prime_fd, uint32_t \*handle); Those two operations
689convert a handle to a PRIME file descriptor and vice versa. Drivers must
690use the kernel dma-buf buffer sharing framework to manage the PRIME file
691descriptors. Similar to the mode setting API PRIME is agnostic to the
692underlying buffer object manager, as long as handles are 32bit unsigned
693integers.
694
695While non-GEM drivers must implement the operations themselves, GEM
696drivers must use the :c:func:`drm_gem_prime_handle_to_fd()` and
697:c:func:`drm_gem_prime_fd_to_handle()` helper functions. Those
698helpers rely on the driver gem_prime_export and gem_prime_import
699operations to create a dma-buf instance from a GEM object (dma-buf
700exporter role) and to create a GEM object from a dma-buf instance
701(dma-buf importer role).
702
703struct dma_buf \* (\*gem_prime_export)(struct drm_device \*dev,
704struct drm_gem_object \*obj, int flags); struct drm_gem_object \*
705(\*gem_prime_import)(struct drm_device \*dev, struct dma_buf
706\*dma_buf); These two operations are mandatory for GEM drivers that
707support PRIME.
708
709PRIME Helper Functions
710^^^^^^^^^^^^^^^^^^^^^^
711
712.. kernel-doc:: drivers/gpu/drm/drm_prime.c
713 :doc: PRIME Helpers
714
715PRIME Function References
716~~~~~~~~~~~~~~~~~~~~~~~~~
717
718.. kernel-doc:: drivers/gpu/drm/drm_prime.c
719 :export:
720
721DRM MM Range Allocator
722~~~~~~~~~~~~~~~~~~~~~~
723
724Overview
725^^^^^^^^
726
727.. kernel-doc:: drivers/gpu/drm/drm_mm.c
728 :doc: Overview
729
730LRU Scan/Eviction Support
731^^^^^^^^^^^^^^^^^^^^^^^^^
732
733.. kernel-doc:: drivers/gpu/drm/drm_mm.c
734 :doc: lru scan roaster
735
736DRM MM Range Allocator Function References
737~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
738
739.. kernel-doc:: drivers/gpu/drm/drm_mm.c
740 :export:
741
742.. kernel-doc:: include/drm/drm_mm.h
743 :internal:
744
745CMA Helper Functions Reference
746~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
747
748.. kernel-doc:: drivers/gpu/drm/drm_gem_cma_helper.c
749 :doc: cma helpers
750
751.. kernel-doc:: drivers/gpu/drm/drm_gem_cma_helper.c
752 :export:
753
754.. kernel-doc:: include/drm/drm_gem_cma_helper.h
755 :internal:
756
757Mode Setting
758------------
759
760Drivers must initialize the mode setting core by calling
761:c:func:`drm_mode_config_init()` on the DRM device. The function
762initializes the :c:type:`struct drm_device <drm_device>`
763mode_config field and never fails. Once done, mode configuration must
764be setup by initializing the following fields.
765
766- int min_width, min_height; int max_width, max_height;
767 Minimum and maximum width and height of the frame buffers in pixel
768 units.
769
770- struct drm_mode_config_funcs \*funcs;
771 Mode setting functions.
772
773Display Modes Function Reference
774~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
775
776.. kernel-doc:: include/drm/drm_modes.h
777 :internal:
778
779.. kernel-doc:: drivers/gpu/drm/drm_modes.c
780 :export:
781
782Atomic Mode Setting Function Reference
783~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
784
785.. kernel-doc:: drivers/gpu/drm/drm_atomic.c
786 :export:
787
788.. kernel-doc:: drivers/gpu/drm/drm_atomic.c
789 :internal:
790
791Frame Buffer Abstraction
792~~~~~~~~~~~~~~~~~~~~~~~~
793
794Frame buffers are abstract memory objects that provide a source of
795pixels to scanout to a CRTC. Applications explicitly request the
796creation of frame buffers through the DRM_IOCTL_MODE_ADDFB(2) ioctls
797and receive an opaque handle that can be passed to the KMS CRTC control,
798plane configuration and page flip functions.
799
800Frame buffers rely on the underneath memory manager for low-level memory
801operations. When creating a frame buffer applications pass a memory
802handle (or a list of memory handles for multi-planar formats) through
803the ``drm_mode_fb_cmd2`` argument. For drivers using GEM as their
804userspace buffer management interface this would be a GEM handle.
805Drivers are however free to use their own backing storage object
806handles, e.g. vmwgfx directly exposes special TTM handles to userspace
807and so expects TTM handles in the create ioctl and not GEM handles.
808
809The lifetime of a drm framebuffer is controlled with a reference count,
810drivers can grab additional references with
811:c:func:`drm_framebuffer_reference()`and drop them again with
812:c:func:`drm_framebuffer_unreference()`. For driver-private
813framebuffers for which the last reference is never dropped (e.g. for the
814fbdev framebuffer when the struct :c:type:`struct drm_framebuffer
815<drm_framebuffer>` is embedded into the fbdev helper struct)
816drivers can manually clean up a framebuffer at module unload time with
817:c:func:`drm_framebuffer_unregister_private()`.
818
819DRM Format Handling
820~~~~~~~~~~~~~~~~~~~
821
822.. kernel-doc:: include/drm/drm_fourcc.h
823 :internal:
824
825.. kernel-doc:: drivers/gpu/drm/drm_fourcc.c
826 :export:
827
828Dumb Buffer Objects
829~~~~~~~~~~~~~~~~~~~
830
831The KMS API doesn't standardize backing storage object creation and
832leaves it to driver-specific ioctls. Furthermore actually creating a
833buffer object even for GEM-based drivers is done through a
834driver-specific ioctl - GEM only has a common userspace interface for
835sharing and destroying objects. While not an issue for full-fledged
836graphics stacks that include device-specific userspace components (in
837libdrm for instance), this limit makes DRM-based early boot graphics
838unnecessarily complex.
839
840Dumb objects partly alleviate the problem by providing a standard API to
841create dumb buffers suitable for scanout, which can then be used to
842create KMS frame buffers.
843
844To support dumb objects drivers must implement the dumb_create,
845dumb_destroy and dumb_map_offset operations.
846
847- int (\*dumb_create)(struct drm_file \*file_priv, struct
848 drm_device \*dev, struct drm_mode_create_dumb \*args);
849 The dumb_create operation creates a driver object (GEM or TTM
850 handle) suitable for scanout based on the width, height and depth
851 from the struct :c:type:`struct drm_mode_create_dumb
852 <drm_mode_create_dumb>` argument. It fills the argument's
853 handle, pitch and size fields with a handle for the newly created
854 object and its line pitch and size in bytes.
855
856- int (\*dumb_destroy)(struct drm_file \*file_priv, struct
857 drm_device \*dev, uint32_t handle);
858 The dumb_destroy operation destroys a dumb object created by
859 dumb_create.
860
861- int (\*dumb_map_offset)(struct drm_file \*file_priv, struct
862 drm_device \*dev, uint32_t handle, uint64_t \*offset);
863 The dumb_map_offset operation associates an mmap fake offset with
864 the object given by the handle and returns it. Drivers must use the
865 :c:func:`drm_gem_create_mmap_offset()` function to associate
866 the fake offset as described in ?.
867
868Note that dumb objects may not be used for gpu acceleration, as has been
869attempted on some ARM embedded platforms. Such drivers really must have
870a hardware-specific ioctl to allocate suitable buffer objects.
871
872Output Polling
873~~~~~~~~~~~~~~
874
875void (\*output_poll_changed)(struct drm_device \*dev);
876This operation notifies the driver that the status of one or more
877connectors has changed. Drivers that use the fb helper can just call the
878:c:func:`drm_fb_helper_hotplug_event()` function to handle this
879operation.
880
881KMS Initialization and Cleanup
882------------------------------
883
884A KMS device is abstracted and exposed as a set of planes, CRTCs,
885encoders and connectors. KMS drivers must thus create and initialize all
886those objects at load time after initializing mode setting.
887
888CRTCs (:c:type:`struct drm_crtc <drm_crtc>`)
889~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
890
891A CRTC is an abstraction representing a part of the chip that contains a
892pointer to a scanout buffer. Therefore, the number of CRTCs available
893determines how many independent scanout buffers can be active at any
894given time. The CRTC structure contains several fields to support this:
895a pointer to some video memory (abstracted as a frame buffer object), a
896display mode, and an (x, y) offset into the video memory to support
897panning or configurations where one piece of video memory spans multiple
898CRTCs.
899
900CRTC Initialization
901^^^^^^^^^^^^^^^^^^^
902
903A KMS device must create and register at least one struct
904:c:type:`struct drm_crtc <drm_crtc>` instance. The instance is
905allocated and zeroed by the driver, possibly as part of a larger
906structure, and registered with a call to :c:func:`drm_crtc_init()`
907with a pointer to CRTC functions.
908
909Planes (:c:type:`struct drm_plane <drm_plane>`)
910~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
911
912A plane represents an image source that can be blended with or overlayed
913on top of a CRTC during the scanout process. Planes are associated with
914a frame buffer to crop a portion of the image memory (source) and
915optionally scale it to a destination size. The result is then blended
916with or overlayed on top of a CRTC.
917
918The DRM core recognizes three types of planes:
919
920- DRM_PLANE_TYPE_PRIMARY represents a "main" plane for a CRTC.
921 Primary planes are the planes operated upon by CRTC modesetting and
922 flipping operations described in the page_flip hook in
923 :c:type:`struct drm_crtc_funcs <drm_crtc_funcs>`.
924- DRM_PLANE_TYPE_CURSOR represents a "cursor" plane for a CRTC.
925 Cursor planes are the planes operated upon by the
926 DRM_IOCTL_MODE_CURSOR and DRM_IOCTL_MODE_CURSOR2 ioctls.
927- DRM_PLANE_TYPE_OVERLAY represents all non-primary, non-cursor
928 planes. Some drivers refer to these types of planes as "sprites"
929 internally.
930
931For compatibility with legacy userspace, only overlay planes are made
932available to userspace by default. Userspace clients may set the
933DRM_CLIENT_CAP_UNIVERSAL_PLANES client capability bit to indicate
934that they wish to receive a universal plane list containing all plane
935types.
936
937Plane Initialization
938^^^^^^^^^^^^^^^^^^^^
939
940To create a plane, a KMS drivers allocates and zeroes an instances of
941:c:type:`struct drm_plane <drm_plane>` (possibly as part of a
942larger structure) and registers it with a call to
943:c:func:`drm_universal_plane_init()`. The function takes a
944bitmask of the CRTCs that can be associated with the plane, a pointer to
945the plane functions, a list of format supported formats, and the type of
946plane (primary, cursor, or overlay) being initialized.
947
948Cursor and overlay planes are optional. All drivers should provide one
949primary plane per CRTC (although this requirement may change in the
950future); drivers that do not wish to provide special handling for
951primary planes may make use of the helper functions described in ? to
952create and register a primary plane with standard capabilities.
953
954Encoders (:c:type:`struct drm_encoder <drm_encoder>`)
955~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
956
957An encoder takes pixel data from a CRTC and converts it to a format
958suitable for any attached connectors. On some devices, it may be
959possible to have a CRTC send data to more than one encoder. In that
960case, both encoders would receive data from the same scanout buffer,
961resulting in a "cloned" display configuration across the connectors
962attached to each encoder.
963
964Encoder Initialization
965^^^^^^^^^^^^^^^^^^^^^^
966
967As for CRTCs, a KMS driver must create, initialize and register at least
968one :c:type:`struct drm_encoder <drm_encoder>` instance. The
969instance is allocated and zeroed by the driver, possibly as part of a
970larger structure.
971
972Drivers must initialize the :c:type:`struct drm_encoder
973<drm_encoder>` possible_crtcs and possible_clones fields before
974registering the encoder. Both fields are bitmasks of respectively the
975CRTCs that the encoder can be connected to, and sibling encoders
976candidate for cloning.
977
978After being initialized, the encoder must be registered with a call to
979:c:func:`drm_encoder_init()`. The function takes a pointer to the
980encoder functions and an encoder type. Supported types are
981
982- DRM_MODE_ENCODER_DAC for VGA and analog on DVI-I/DVI-A
983- DRM_MODE_ENCODER_TMDS for DVI, HDMI and (embedded) DisplayPort
984- DRM_MODE_ENCODER_LVDS for display panels
985- DRM_MODE_ENCODER_TVDAC for TV output (Composite, S-Video,
986 Component, SCART)
987- DRM_MODE_ENCODER_VIRTUAL for virtual machine displays
988
989Encoders must be attached to a CRTC to be used. DRM drivers leave
990encoders unattached at initialization time. Applications (or the fbdev
991compatibility layer when implemented) are responsible for attaching the
992encoders they want to use to a CRTC.
993
994Connectors (:c:type:`struct drm_connector <drm_connector>`)
995~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
996
997A connector is the final destination for pixel data on a device, and
998usually connects directly to an external display device like a monitor
999or laptop panel. A connector can only be attached to one encoder at a
1000time. The connector is also the structure where information about the
1001attached display is kept, so it contains fields for display data, EDID
1002data, DPMS & connection status, and information about modes supported on
1003the attached displays.
1004
1005Connector Initialization
1006^^^^^^^^^^^^^^^^^^^^^^^^
1007
1008Finally a KMS driver must create, initialize, register and attach at
1009least one :c:type:`struct drm_connector <drm_connector>`
1010instance. The instance is created as other KMS objects and initialized
1011by setting the following fields.
1012
1013interlace_allowed
1014 Whether the connector can handle interlaced modes.
1015
1016doublescan_allowed
1017 Whether the connector can handle doublescan.
1018
1019display_info
1020 Display information is filled from EDID information when a display
1021 is detected. For non hot-pluggable displays such as flat panels in
1022 embedded systems, the driver should initialize the
1023 display_info.width_mm and display_info.height_mm fields with the
1024 physical size of the display.
1025
1026polled
1027 Connector polling mode, a combination of
1028
1029 DRM_CONNECTOR_POLL_HPD
1030 The connector generates hotplug events and doesn't need to be
1031 periodically polled. The CONNECT and DISCONNECT flags must not
1032 be set together with the HPD flag.
1033
1034 DRM_CONNECTOR_POLL_CONNECT
1035 Periodically poll the connector for connection.
1036
1037 DRM_CONNECTOR_POLL_DISCONNECT
1038 Periodically poll the connector for disconnection.
1039
1040 Set to 0 for connectors that don't support connection status
1041 discovery.
1042
1043The connector is then registered with a call to
1044:c:func:`drm_connector_init()` with a pointer to the connector
1045functions and a connector type, and exposed through sysfs with a call to
1046:c:func:`drm_connector_register()`.
1047
1048Supported connector types are
1049
1050- DRM_MODE_CONNECTOR_VGA
1051- DRM_MODE_CONNECTOR_DVII
1052- DRM_MODE_CONNECTOR_DVID
1053- DRM_MODE_CONNECTOR_DVIA
1054- DRM_MODE_CONNECTOR_Composite
1055- DRM_MODE_CONNECTOR_SVIDEO
1056- DRM_MODE_CONNECTOR_LVDS
1057- DRM_MODE_CONNECTOR_Component
1058- DRM_MODE_CONNECTOR_9PinDIN
1059- DRM_MODE_CONNECTOR_DisplayPort
1060- DRM_MODE_CONNECTOR_HDMIA
1061- DRM_MODE_CONNECTOR_HDMIB
1062- DRM_MODE_CONNECTOR_TV
1063- DRM_MODE_CONNECTOR_eDP
1064- DRM_MODE_CONNECTOR_VIRTUAL
1065
1066Connectors must be attached to an encoder to be used. For devices that
1067map connectors to encoders 1:1, the connector should be attached at
1068initialization time with a call to
1069:c:func:`drm_mode_connector_attach_encoder()`. The driver must
1070also set the :c:type:`struct drm_connector <drm_connector>`
1071encoder field to point to the attached encoder.
1072
1073Finally, drivers must initialize the connectors state change detection
1074with a call to :c:func:`drm_kms_helper_poll_init()`. If at least
1075one connector is pollable but can't generate hotplug interrupts
1076(indicated by the DRM_CONNECTOR_POLL_CONNECT and
1077DRM_CONNECTOR_POLL_DISCONNECT connector flags), a delayed work will
1078automatically be queued to periodically poll for changes. Connectors
1079that can generate hotplug interrupts must be marked with the
1080DRM_CONNECTOR_POLL_HPD flag instead, and their interrupt handler must
1081call :c:func:`drm_helper_hpd_irq_event()`. The function will
1082queue a delayed work to check the state of all connectors, but no
1083periodic polling will be done.
1084
1085Connector Operations
1086^^^^^^^^^^^^^^^^^^^^
1087
1088 **Note**
1089
1090 Unless otherwise state, all operations are mandatory.
1091
1092DPMS
1093''''
1094
1095void (\*dpms)(struct drm_connector \*connector, int mode);
1096The DPMS operation sets the power state of a connector. The mode
1097argument is one of
1098
1099- DRM_MODE_DPMS_ON
1100
1101- DRM_MODE_DPMS_STANDBY
1102
1103- DRM_MODE_DPMS_SUSPEND
1104
1105- DRM_MODE_DPMS_OFF
1106
1107In all but DPMS_ON mode the encoder to which the connector is attached
1108should put the display in low-power mode by driving its signals
1109appropriately. If more than one connector is attached to the encoder
1110care should be taken not to change the power state of other displays as
1111a side effect. Low-power mode should be propagated to the encoders and
1112CRTCs when all related connectors are put in low-power mode.
1113
1114Modes
1115'''''
1116
1117int (\*fill_modes)(struct drm_connector \*connector, uint32_t
1118max_width, uint32_t max_height);
1119Fill the mode list with all supported modes for the connector. If the
1120``max_width`` and ``max_height`` arguments are non-zero, the
1121implementation must ignore all modes wider than ``max_width`` or higher
1122than ``max_height``.
1123
1124The connector must also fill in this operation its display_info
1125width_mm and height_mm fields with the connected display physical size
1126in millimeters. The fields should be set to 0 if the value isn't known
1127or is not applicable (for instance for projector devices).
1128
1129Connection Status
1130'''''''''''''''''
1131
1132The connection status is updated through polling or hotplug events when
1133supported (see ?). The status value is reported to userspace through
1134ioctls and must not be used inside the driver, as it only gets
1135initialized by a call to :c:func:`drm_mode_getconnector()` from
1136userspace.
1137
1138enum drm_connector_status (\*detect)(struct drm_connector
1139\*connector, bool force);
1140Check to see if anything is attached to the connector. The ``force``
1141parameter is set to false whilst polling or to true when checking the
1142connector due to user request. ``force`` can be used by the driver to
1143avoid expensive, destructive operations during automated probing.
1144
1145Return connector_status_connected if something is connected to the
1146connector, connector_status_disconnected if nothing is connected and
1147connector_status_unknown if the connection state isn't known.
1148
1149Drivers should only return connector_status_connected if the
1150connection status has really been probed as connected. Connectors that
1151can't detect the connection status, or failed connection status probes,
1152should return connector_status_unknown.
1153
1154Cleanup
1155~~~~~~~
1156
1157The DRM core manages its objects' lifetime. When an object is not needed
1158anymore the core calls its destroy function, which must clean up and
1159free every resource allocated for the object. Every
1160:c:func:`drm_\*_init()` call must be matched with a corresponding
1161:c:func:`drm_\*_cleanup()` call to cleanup CRTCs
1162(:c:func:`drm_crtc_cleanup()`), planes
1163(:c:func:`drm_plane_cleanup()`), encoders
1164(:c:func:`drm_encoder_cleanup()`) and connectors
1165(:c:func:`drm_connector_cleanup()`). Furthermore, connectors that
1166have been added to sysfs must be removed by a call to
1167:c:func:`drm_connector_unregister()` before calling
1168:c:func:`drm_connector_cleanup()`.
1169
1170Connectors state change detection must be cleanup up with a call to
1171:c:func:`drm_kms_helper_poll_fini()`.
1172
1173Output discovery and initialization example
1174~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1175
1176::
1177
1178 void intel_crt_init(struct drm_device *dev)
1179 {
1180 struct drm_connector *connector;
1181 struct intel_output *intel_output;
1182
1183 intel_output = kzalloc(sizeof(struct intel_output), GFP_KERNEL);
1184 if (!intel_output)
1185 return;
1186
1187 connector = &intel_output->base;
1188 drm_connector_init(dev, &intel_output->base,
1189 &intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA);
1190
1191 drm_encoder_init(dev, &intel_output->enc, &intel_crt_enc_funcs,
1192 DRM_MODE_ENCODER_DAC);
1193
1194 drm_mode_connector_attach_encoder(&intel_output->base,
1195 &intel_output->enc);
1196
1197 /* Set up the DDC bus. */
1198 intel_output->ddc_bus = intel_i2c_create(dev, GPIOA, "CRTDDC_A");
1199 if (!intel_output->ddc_bus) {
1200 dev_printk(KERN_ERR, &dev->pdev->dev, "DDC bus registration "
1201 "failed.\n");
1202 return;
1203 }
1204
1205 intel_output->type = INTEL_OUTPUT_ANALOG;
1206 connector->interlace_allowed = 0;
1207 connector->doublescan_allowed = 0;
1208
1209 drm_encoder_helper_add(&intel_output->enc, &intel_crt_helper_funcs);
1210 drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs);
1211
1212 drm_connector_register(connector);
1213 }
1214
1215In the example above (taken from the i915 driver), a CRTC, connector and
1216encoder combination is created. A device-specific i2c bus is also
1217created for fetching EDID data and performing monitor detection. Once
1218the process is complete, the new connector is registered with sysfs to
1219make its properties available to applications.
1220
1221KMS API Functions
1222~~~~~~~~~~~~~~~~~
1223
1224.. kernel-doc:: drivers/gpu/drm/drm_crtc.c
1225 :export:
1226
1227KMS Data Structures
1228~~~~~~~~~~~~~~~~~~~
1229
1230.. kernel-doc:: include/drm/drm_crtc.h
1231 :internal:
1232
1233KMS Locking
1234~~~~~~~~~~~
1235
1236.. kernel-doc:: drivers/gpu/drm/drm_modeset_lock.c
1237 :doc: kms locking
1238
1239.. kernel-doc:: include/drm/drm_modeset_lock.h
1240 :internal:
1241
1242.. kernel-doc:: drivers/gpu/drm/drm_modeset_lock.c
1243 :export:
1244
1245Mode Setting Helper Functions
1246-----------------------------
1247
1248The plane, CRTC, encoder and connector functions provided by the drivers
1249implement the DRM API. They're called by the DRM core and ioctl handlers
1250to handle device state changes and configuration request. As
1251implementing those functions often requires logic not specific to
1252drivers, mid-layer helper functions are available to avoid duplicating
1253boilerplate code.
1254
1255The DRM core contains one mid-layer implementation. The mid-layer
1256provides implementations of several plane, CRTC, encoder and connector
1257functions (called from the top of the mid-layer) that pre-process
1258requests and call lower-level functions provided by the driver (at the
1259bottom of the mid-layer). For instance, the
1260:c:func:`drm_crtc_helper_set_config()` function can be used to
1261fill the :c:type:`struct drm_crtc_funcs <drm_crtc_funcs>`
1262set_config field. When called, it will split the set_config operation
1263in smaller, simpler operations and call the driver to handle them.
1264
1265To use the mid-layer, drivers call
1266:c:func:`drm_crtc_helper_add()`,
1267:c:func:`drm_encoder_helper_add()` and
1268:c:func:`drm_connector_helper_add()` functions to install their
1269mid-layer bottom operations handlers, and fill the :c:type:`struct
1270drm_crtc_funcs <drm_crtc_funcs>`, :c:type:`struct
1271drm_encoder_funcs <drm_encoder_funcs>` and :c:type:`struct
1272drm_connector_funcs <drm_connector_funcs>` structures with
1273pointers to the mid-layer top API functions. Installing the mid-layer
1274bottom operation handlers is best done right after registering the
1275corresponding KMS object.
1276
1277The mid-layer is not split between CRTC, encoder and connector
1278operations. To use it, a driver must provide bottom functions for all of
1279the three KMS entities.
1280
1281Atomic Modeset Helper Functions Reference
1282~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1283
1284Overview
1285^^^^^^^^
1286
1287.. kernel-doc:: drivers/gpu/drm/drm_atomic_helper.c
1288 :doc: overview
1289
1290Implementing Asynchronous Atomic Commit
1291^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1292
1293.. kernel-doc:: drivers/gpu/drm/drm_atomic_helper.c
1294 :doc: implementing nonblocking commit
1295
1296Atomic State Reset and Initialization
1297^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1298
1299.. kernel-doc:: drivers/gpu/drm/drm_atomic_helper.c
1300 :doc: atomic state reset and initialization
1301
1302.. kernel-doc:: include/drm/drm_atomic_helper.h
1303 :internal:
1304
1305.. kernel-doc:: drivers/gpu/drm/drm_atomic_helper.c
1306 :export:
1307
1308Modeset Helper Reference for Common Vtables
1309~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1310
1311.. kernel-doc:: include/drm/drm_modeset_helper_vtables.h
1312 :internal:
1313
1314.. kernel-doc:: include/drm/drm_modeset_helper_vtables.h
1315 :doc: overview
1316
1317Legacy CRTC/Modeset Helper Functions Reference
1318~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1319
1320.. kernel-doc:: drivers/gpu/drm/drm_crtc_helper.c
1321 :export:
1322
1323.. kernel-doc:: drivers/gpu/drm/drm_crtc_helper.c
1324 :doc: overview
1325
1326Output Probing Helper Functions Reference
1327~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1328
1329.. kernel-doc:: drivers/gpu/drm/drm_probe_helper.c
1330 :doc: output probing helper overview
1331
1332.. kernel-doc:: drivers/gpu/drm/drm_probe_helper.c
1333 :export:
1334
1335fbdev Helper Functions Reference
1336~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1337
1338.. kernel-doc:: drivers/gpu/drm/drm_fb_helper.c
1339 :doc: fbdev helpers
1340
1341.. kernel-doc:: drivers/gpu/drm/drm_fb_helper.c
1342 :export:
1343
1344.. kernel-doc:: include/drm/drm_fb_helper.h
1345 :internal:
1346
1347Framebuffer CMA Helper Functions Reference
1348~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1349
1350.. kernel-doc:: drivers/gpu/drm/drm_fb_cma_helper.c
1351 :doc: framebuffer cma helper functions
1352
1353.. kernel-doc:: drivers/gpu/drm/drm_fb_cma_helper.c
1354 :export:
1355
1356Display Port Helper Functions Reference
1357~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1358
1359.. kernel-doc:: drivers/gpu/drm/drm_dp_helper.c
1360 :doc: dp helpers
1361
1362.. kernel-doc:: include/drm/drm_dp_helper.h
1363 :internal:
1364
1365.. kernel-doc:: drivers/gpu/drm/drm_dp_helper.c
1366 :export:
1367
1368Display Port Dual Mode Adaptor Helper Functions Reference
1369~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1370
1371.. kernel-doc:: drivers/gpu/drm/drm_dp_dual_mode_helper.c
1372 :doc: dp dual mode helpers
1373
1374.. kernel-doc:: include/drm/drm_dp_dual_mode_helper.h
1375 :internal:
1376
1377.. kernel-doc:: drivers/gpu/drm/drm_dp_dual_mode_helper.c
1378 :export:
1379
1380Display Port MST Helper Functions Reference
1381~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1382
1383.. kernel-doc:: drivers/gpu/drm/drm_dp_mst_topology.c
1384 :doc: dp mst helper
1385
1386.. kernel-doc:: include/drm/drm_dp_mst_helper.h
1387 :internal:
1388
1389.. kernel-doc:: drivers/gpu/drm/drm_dp_mst_topology.c
1390 :export:
1391
1392MIPI DSI Helper Functions Reference
1393~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1394
1395.. kernel-doc:: drivers/gpu/drm/drm_mipi_dsi.c
1396 :doc: dsi helpers
1397
1398.. kernel-doc:: include/drm/drm_mipi_dsi.h
1399 :internal:
1400
1401.. kernel-doc:: drivers/gpu/drm/drm_mipi_dsi.c
1402 :export:
1403
1404EDID Helper Functions Reference
1405~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1406
1407.. kernel-doc:: drivers/gpu/drm/drm_edid.c
1408 :export:
1409
1410Rectangle Utilities Reference
1411~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1412
1413.. kernel-doc:: include/drm/drm_rect.h
1414 :doc: rect utils
1415
1416.. kernel-doc:: include/drm/drm_rect.h
1417 :internal:
1418
1419.. kernel-doc:: drivers/gpu/drm/drm_rect.c
1420 :export:
1421
1422Flip-work Helper Reference
1423~~~~~~~~~~~~~~~~~~~~~~~~~~
1424
1425.. kernel-doc:: include/drm/drm_flip_work.h
1426 :doc: flip utils
1427
1428.. kernel-doc:: include/drm/drm_flip_work.h
1429 :internal:
1430
1431.. kernel-doc:: drivers/gpu/drm/drm_flip_work.c
1432 :export:
1433
1434HDMI Infoframes Helper Reference
1435~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1436
1437Strictly speaking this is not a DRM helper library but generally useable
1438by any driver interfacing with HDMI outputs like v4l or alsa drivers.
1439But it nicely fits into the overall topic of mode setting helper
1440libraries and hence is also included here.
1441
1442.. kernel-doc:: include/linux/hdmi.h
1443 :internal:
1444
1445.. kernel-doc:: drivers/video/hdmi.c
1446 :export:
1447
1448Plane Helper Reference
1449~~~~~~~~~~~~~~~~~~~~~~
1450
1451.. kernel-doc:: drivers/gpu/drm/drm_plane_helper.c
1452 :export:
1453
1454.. kernel-doc:: drivers/gpu/drm/drm_plane_helper.c
1455 :doc: overview
1456
1457Tile group
1458~~~~~~~~~~
1459
1460.. kernel-doc:: drivers/gpu/drm/drm_crtc.c
1461 :doc: Tile group
1462
1463Bridges
1464~~~~~~~
1465
1466Overview
1467^^^^^^^^
1468
1469.. kernel-doc:: drivers/gpu/drm/drm_bridge.c
1470 :doc: overview
1471
1472Default bridge callback sequence
1473^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1474
1475.. kernel-doc:: drivers/gpu/drm/drm_bridge.c
1476 :doc: bridge callbacks
1477
1478.. kernel-doc:: drivers/gpu/drm/drm_bridge.c
1479 :export:
1480
1481Panel Helper Reference
1482~~~~~~~~~~~~~~~~~~~~~~
1483
1484.. kernel-doc:: include/drm/drm_panel.h
1485 :internal:
1486
1487.. kernel-doc:: drivers/gpu/drm/drm_panel.c
1488 :export:
1489
1490.. kernel-doc:: drivers/gpu/drm/drm_panel.c
1491 :doc: drm panel
1492
1493Simple KMS Helper Reference
1494~~~~~~~~~~~~~~~~~~~~~~~~~~~
1495
1496.. kernel-doc:: include/drm/drm_simple_kms_helper.h
1497 :internal:
1498
1499.. kernel-doc:: drivers/gpu/drm/drm_simple_kms_helper.c
1500 :export:
1501
1502.. kernel-doc:: drivers/gpu/drm/drm_simple_kms_helper.c
1503 :doc: overview
1504
1505KMS Properties
1506--------------
1507
1508Drivers may need to expose additional parameters to applications than
1509those described in the previous sections. KMS supports attaching
1510properties to CRTCs, connectors and planes and offers a userspace API to
1511list, get and set the property values.
1512
1513Properties are identified by a name that uniquely defines the property
1514purpose, and store an associated value. For all property types except
1515blob properties the value is a 64-bit unsigned integer.
1516
1517KMS differentiates between properties and property instances. Drivers
1518first create properties and then create and associate individual
1519instances of those properties to objects. A property can be instantiated
1520multiple times and associated with different objects. Values are stored
1521in property instances, and all other property information are stored in
1522the property and shared between all instances of the property.
1523
1524Every property is created with a type that influences how the KMS core
1525handles the property. Supported property types are
1526
1527DRM_MODE_PROP_RANGE
1528 Range properties report their minimum and maximum admissible values.
1529 The KMS core verifies that values set by application fit in that
1530 range.
1531
1532DRM_MODE_PROP_ENUM
1533 Enumerated properties take a numerical value that ranges from 0 to
1534 the number of enumerated values defined by the property minus one,
1535 and associate a free-formed string name to each value. Applications
1536 can retrieve the list of defined value-name pairs and use the
1537 numerical value to get and set property instance values.
1538
1539DRM_MODE_PROP_BITMASK
1540 Bitmask properties are enumeration properties that additionally
1541 restrict all enumerated values to the 0..63 range. Bitmask property
1542 instance values combine one or more of the enumerated bits defined
1543 by the property.
1544
1545DRM_MODE_PROP_BLOB
1546 Blob properties store a binary blob without any format restriction.
1547 The binary blobs are created as KMS standalone objects, and blob
1548 property instance values store the ID of their associated blob
1549 object.
1550
1551 Blob properties are only used for the connector EDID property and
1552 cannot be created by drivers.
1553
1554To create a property drivers call one of the following functions
1555depending on the property type. All property creation functions take
1556property flags and name, as well as type-specific arguments.
1557
1558- struct drm_property \*drm_property_create_range(struct
1559 drm_device \*dev, int flags, const char \*name, uint64_t min,
1560 uint64_t max);
1561 Create a range property with the given minimum and maximum values.
1562
1563- struct drm_property \*drm_property_create_enum(struct drm_device
1564 \*dev, int flags, const char \*name, const struct
1565 drm_prop_enum_list \*props, int num_values);
1566 Create an enumerated property. The ``props`` argument points to an
1567 array of ``num_values`` value-name pairs.
1568
1569- struct drm_property \*drm_property_create_bitmask(struct
1570 drm_device \*dev, int flags, const char \*name, const struct
1571 drm_prop_enum_list \*props, int num_values);
1572 Create a bitmask property. The ``props`` argument points to an array
1573 of ``num_values`` value-name pairs.
1574
1575Properties can additionally be created as immutable, in which case they
1576will be read-only for applications but can be modified by the driver. To
1577create an immutable property drivers must set the
1578DRM_MODE_PROP_IMMUTABLE flag at property creation time.
1579
1580When no array of value-name pairs is readily available at property
1581creation time for enumerated or range properties, drivers can create the
1582property using the :c:func:`drm_property_create()` function and
1583manually add enumeration value-name pairs by calling the
1584:c:func:`drm_property_add_enum()` function. Care must be taken to
1585properly specify the property type through the ``flags`` argument.
1586
1587After creating properties drivers can attach property instances to CRTC,
1588connector and plane objects by calling the
1589:c:func:`drm_object_attach_property()`. The function takes a
1590pointer to the target object, a pointer to the previously created
1591property and an initial instance value.
1592
1593Existing KMS Properties
1594~~~~~~~~~~~~~~~~~~~~~~~
1595
1596The following table gives description of drm properties exposed by
1597various modules/drivers.
1598
1599+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1600| Owner Module/Drivers | Group | Property Name | Type | Property Values | Object attached | Description/Restrictions |
1601+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1602| DRM | Generic | “rotation” | BITMASK | { 0, "rotate-0" }, { 1, "rotate-90" }, { 2, "rotate-180" }, { 3, "rotate-270" }, { 4, "reflect-x" }, { 5, "reflect-y" } | CRTC, Plane | rotate-(degrees) rotates the image by the specified amount in degrees in counter clockwise direction. reflect-x and reflect-y reflects the image along the specified axis prior to rotation |
1603+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1604| “scaling mode” | ENUM | { "None", "Full", "Center", "Full aspect" } | Connector | Supported by: amdgpu, gma500, i915, nouveau and radeon. |
1605+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1606| Connector | “EDID” | BLOB \| IMMUTABLE | 0 | Connector | Contains id of edid blob ptr object. |
1607+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1608| “DPMS” | ENUM | { “On”, “Standby”, “Suspend”, “Off” } | Connector | Contains DPMS operation mode value. |
1609+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1610| “PATH” | BLOB \| IMMUTABLE | 0 | Connector | Contains topology path to a connector. |
1611+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1612| “TILE” | BLOB \| IMMUTABLE | 0 | Connector | Contains tiling information for a connector. |
1613+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1614| “CRTC_ID” | OBJECT | DRM_MODE_OBJECT_CRTC | Connector | CRTC that connector is attached to (atomic) |
1615+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1616| Plane | “type” | ENUM \| IMMUTABLE | { "Overlay", "Primary", "Cursor" } | Plane | Plane type |
1617+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1618| “SRC_X” | RANGE | Min=0, Max=UINT_MAX | Plane | Scanout source x coordinate in 16.16 fixed point (atomic) |
1619+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1620| “SRC_Y” | RANGE | Min=0, Max=UINT_MAX | Plane | Scanout source y coordinate in 16.16 fixed point (atomic) |
1621+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1622| “SRC_W” | RANGE | Min=0, Max=UINT_MAX | Plane | Scanout source width in 16.16 fixed point (atomic) |
1623+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1624| “SRC_H” | RANGE | Min=0, Max=UINT_MAX | Plane | Scanout source height in 16.16 fixed point (atomic) |
1625+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1626| “CRTC_X” | SIGNED_RANGE | Min=INT_MIN, Max=INT_MAX | Plane | Scanout CRTC (destination) x coordinate (atomic) |
1627+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1628| “CRTC_Y” | SIGNED_RANGE | Min=INT_MIN, Max=INT_MAX | Plane | Scanout CRTC (destination) y coordinate (atomic) |
1629+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1630| “CRTC_W” | RANGE | Min=0, Max=UINT_MAX | Plane | Scanout CRTC (destination) width (atomic) |
1631+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1632| “CRTC_H” | RANGE | Min=0, Max=UINT_MAX | Plane | Scanout CRTC (destination) height (atomic) |
1633+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1634| “FB_ID” | OBJECT | DRM_MODE_OBJECT_FB | Plane | Scanout framebuffer (atomic) |
1635+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1636| “CRTC_ID” | OBJECT | DRM_MODE_OBJECT_CRTC | Plane | CRTC that plane is attached to (atomic) |
1637+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1638| DVI-I | “subconnector” | ENUM | { “Unknown”, “DVI-D”, “DVI-A” } | Connector | TBD |
1639+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1640| “select subconnector” | ENUM | { “Automatic”, “DVI-D”, “DVI-A” } | Connector | TBD |
1641+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1642| TV | “subconnector” | ENUM | { "Unknown", "Composite", "SVIDEO", "Component", "SCART" } | Connector | TBD |
1643+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1644| “select subconnector” | ENUM | { "Automatic", "Composite", "SVIDEO", "Component", "SCART" } | Connector | TBD |
1645+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1646| “mode” | ENUM | { "NTSC_M", "NTSC_J", "NTSC_443", "PAL_B" } etc. | Connector | TBD |
1647+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1648| “left margin” | RANGE | Min=0, Max=100 | Connector | TBD |
1649+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1650| “right margin” | RANGE | Min=0, Max=100 | Connector | TBD |
1651+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1652| “top margin” | RANGE | Min=0, Max=100 | Connector | TBD |
1653+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1654| “bottom margin” | RANGE | Min=0, Max=100 | Connector | TBD |
1655+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1656| “brightness” | RANGE | Min=0, Max=100 | Connector | TBD |
1657+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1658| “contrast” | RANGE | Min=0, Max=100 | Connector | TBD |
1659+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1660| “flicker reduction” | RANGE | Min=0, Max=100 | Connector | TBD |
1661+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1662| “overscan” | RANGE | Min=0, Max=100 | Connector | TBD |
1663+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1664| “saturation” | RANGE | Min=0, Max=100 | Connector | TBD |
1665+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1666| “hue” | RANGE | Min=0, Max=100 | Connector | TBD |
1667+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1668| Virtual GPU | “suggested X” | RANGE | Min=0, Max=0xffffffff | Connector | property to suggest an X offset for a connector |
1669+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1670| “suggested Y” | RANGE | Min=0, Max=0xffffffff | Connector | property to suggest an Y offset for a connector |
1671+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1672| Optional | "aspect ratio" | ENUM | { "None", "4:3", "16:9" } | Connector | TDB |
1673+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1674| “dirty” | ENUM \| IMMUTABLE | { "Off", "On", "Annotate" } | Connector | TBD |
1675+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1676| “DEGAMMA_LUT” | BLOB | 0 | CRTC | DRM property to set the degamma lookup table (LUT) mapping pixel data from the framebuffer before it is given to the transformation matrix. The data is an interpreted as an array of struct drm_color_lut elements. Hardware might choose not to use the full precision of the LUT elements nor use all the elements of the LUT (for example the hardware might choose to interpolate between LUT[0] and LUT[4]). |
1677+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1678| “DEGAMMA_LUT_SIZE” | RANGE \| IMMUTABLE | Min=0, Max=UINT_MAX | CRTC | DRM property to gives the size of the lookup table to be set on the DEGAMMA_LUT property (the size depends on the underlying hardware). |
1679+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1680| “CTM” | BLOB | 0 | CRTC | DRM property to set the current transformation matrix (CTM) apply to pixel data after the lookup through the degamma LUT and before the lookup through the gamma LUT. The data is an interpreted as a struct drm_color_ctm. |
1681+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1682| “GAMMA_LUT” | BLOB | 0 | CRTC | DRM property to set the gamma lookup table (LUT) mapping pixel data after to the transformation matrix to data sent to the connector. The data is an interpreted as an array of struct drm_color_lut elements. Hardware might choose not to use the full precision of the LUT elements nor use all the elements of the LUT (for example the hardware might choose to interpolate between LUT[0] and LUT[4]). |
1683+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1684| “GAMMA_LUT_SIZE” | RANGE \| IMMUTABLE | Min=0, Max=UINT_MAX | CRTC | DRM property to gives the size of the lookup table to be set on the GAMMA_LUT property (the size depends on the underlying hardware). |
1685+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1686| i915 | Generic | "Broadcast RGB" | ENUM | { "Automatic", "Full", "Limited 16:235" } | Connector | When this property is set to Limited 16:235 and CTM is set, the hardware will be programmed with the result of the multiplication of CTM by the limited range matrix to ensure the pixels normaly in the range 0..1.0 are remapped to the range 16/255..235/255. |
1687+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1688| “audio” | ENUM | { "force-dvi", "off", "auto", "on" } | Connector | TBD |
1689+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1690| SDVO-TV | “mode” | ENUM | { "NTSC_M", "NTSC_J", "NTSC_443", "PAL_B" } etc. | Connector | TBD |
1691+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1692| "left_margin" | RANGE | Min=0, Max= SDVO dependent | Connector | TBD |
1693+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1694| "right_margin" | RANGE | Min=0, Max= SDVO dependent | Connector | TBD |
1695+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1696| "top_margin" | RANGE | Min=0, Max= SDVO dependent | Connector | TBD |
1697+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1698| "bottom_margin" | RANGE | Min=0, Max= SDVO dependent | Connector | TBD |
1699+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1700| “hpos” | RANGE | Min=0, Max= SDVO dependent | Connector | TBD |
1701+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1702| “vpos” | RANGE | Min=0, Max= SDVO dependent | Connector | TBD |
1703+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1704| “contrast” | RANGE | Min=0, Max= SDVO dependent | Connector | TBD |
1705+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1706| “saturation” | RANGE | Min=0, Max= SDVO dependent | Connector | TBD |
1707+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1708| “hue” | RANGE | Min=0, Max= SDVO dependent | Connector | TBD |
1709+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1710| “sharpness” | RANGE | Min=0, Max= SDVO dependent | Connector | TBD |
1711+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1712| “flicker_filter” | RANGE | Min=0, Max= SDVO dependent | Connector | TBD |
1713+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1714| “flicker_filter_adaptive” | RANGE | Min=0, Max= SDVO dependent | Connector | TBD |
1715+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1716| “flicker_filter_2d” | RANGE | Min=0, Max= SDVO dependent | Connector | TBD |
1717+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1718| “tv_chroma_filter” | RANGE | Min=0, Max= SDVO dependent | Connector | TBD |
1719+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1720| “tv_luma_filter” | RANGE | Min=0, Max= SDVO dependent | Connector | TBD |
1721+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1722| “dot_crawl” | RANGE | Min=0, Max=1 | Connector | TBD |
1723+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1724| SDVO-TV/LVDS | “brightness” | RANGE | Min=0, Max= SDVO dependent | Connector | TBD |
1725+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1726| CDV gma-500 | Generic | "Broadcast RGB" | ENUM | { “Full”, “Limited 16:235” } | Connector | TBD |
1727+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1728| "Broadcast RGB" | ENUM | { “off”, “auto”, “on” } | Connector | TBD |
1729+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1730| Poulsbo | Generic | “backlight” | RANGE | Min=0, Max=100 | Connector | TBD |
1731+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1732| SDVO-TV | “mode” | ENUM | { "NTSC_M", "NTSC_J", "NTSC_443", "PAL_B" } etc. | Connector | TBD |
1733+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1734| "left_margin" | RANGE | Min=0, Max= SDVO dependent | Connector | TBD |
1735+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1736| "right_margin" | RANGE | Min=0, Max= SDVO dependent | Connector | TBD |
1737+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1738| "top_margin" | RANGE | Min=0, Max= SDVO dependent | Connector | TBD |
1739+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1740| "bottom_margin" | RANGE | Min=0, Max= SDVO dependent | Connector | TBD |
1741+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1742| “hpos” | RANGE | Min=0, Max= SDVO dependent | Connector | TBD |
1743+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1744| “vpos” | RANGE | Min=0, Max= SDVO dependent | Connector | TBD |
1745+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1746| “contrast” | RANGE | Min=0, Max= SDVO dependent | Connector | TBD |
1747+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1748| “saturation” | RANGE | Min=0, Max= SDVO dependent | Connector | TBD |
1749+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1750| “hue” | RANGE | Min=0, Max= SDVO dependent | Connector | TBD |
1751+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1752| “sharpness” | RANGE | Min=0, Max= SDVO dependent | Connector | TBD |
1753+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1754| “flicker_filter” | RANGE | Min=0, Max= SDVO dependent | Connector | TBD |
1755+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1756| “flicker_filter_adaptive” | RANGE | Min=0, Max= SDVO dependent | Connector | TBD |
1757+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1758| “flicker_filter_2d” | RANGE | Min=0, Max= SDVO dependent | Connector | TBD |
1759+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1760| “tv_chroma_filter” | RANGE | Min=0, Max= SDVO dependent | Connector | TBD |
1761+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1762| “tv_luma_filter” | RANGE | Min=0, Max= SDVO dependent | Connector | TBD |
1763+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1764| “dot_crawl” | RANGE | Min=0, Max=1 | Connector | TBD |
1765+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1766| SDVO-TV/LVDS | “brightness” | RANGE | Min=0, Max= SDVO dependent | Connector | TBD |
1767+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1768| armada | CRTC | "CSC_YUV" | ENUM | { "Auto" , "CCIR601", "CCIR709" } | CRTC | TBD |
1769+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1770| "CSC_RGB" | ENUM | { "Auto", "Computer system", "Studio" } | CRTC | TBD |
1771+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1772| Overlay | "colorkey" | RANGE | Min=0, Max=0xffffff | Plane | TBD |
1773+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1774| "colorkey_min" | RANGE | Min=0, Max=0xffffff | Plane | TBD |
1775+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1776| "colorkey_max" | RANGE | Min=0, Max=0xffffff | Plane | TBD |
1777+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1778| "colorkey_val" | RANGE | Min=0, Max=0xffffff | Plane | TBD |
1779+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1780| "colorkey_alpha" | RANGE | Min=0, Max=0xffffff | Plane | TBD |
1781+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1782| "colorkey_mode" | ENUM | { "disabled", "Y component", "U component" , "V component", "RGB", “R component", "G component", "B component" } | Plane | TBD |
1783+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1784| "brightness" | RANGE | Min=0, Max=256 + 255 | Plane | TBD |
1785+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1786| "contrast" | RANGE | Min=0, Max=0x7fff | Plane | TBD |
1787+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1788| "saturation" | RANGE | Min=0, Max=0x7fff | Plane | TBD |
1789+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1790| exynos | CRTC | “mode” | ENUM | { "normal", "blank" } | CRTC | TBD |
1791+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1792| Overlay | “zpos” | RANGE | Min=0, Max=MAX_PLANE-1 | Plane | TBD |
1793+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1794| i2c/ch7006_drv | Generic | “scale” | RANGE | Min=0, Max=2 | Connector | TBD |
1795+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1796| TV | “mode” | ENUM | { "PAL", "PAL-M","PAL-N"}, ”PAL-Nc" , "PAL-60", "NTSC-M", "NTSC-J" } | Connector | TBD |
1797+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1798| nouveau | NV10 Overlay | "colorkey" | RANGE | Min=0, Max=0x01ffffff | Plane | TBD |
1799+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1800| “contrast” | RANGE | Min=0, Max=8192-1 | Plane | TBD |
1801+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1802| “brightness” | RANGE | Min=0, Max=1024 | Plane | TBD |
1803+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1804| “hue” | RANGE | Min=0, Max=359 | Plane | TBD |
1805+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1806| “saturation” | RANGE | Min=0, Max=8192-1 | Plane | TBD |
1807+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1808| “iturbt_709” | RANGE | Min=0, Max=1 | Plane | TBD |
1809+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1810| Nv04 Overlay | “colorkey” | RANGE | Min=0, Max=0x01ffffff | Plane | TBD |
1811+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1812| “brightness” | RANGE | Min=0, Max=1024 | Plane | TBD |
1813+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1814| Display | “dithering mode” | ENUM | { "auto", "off", "on" } | Connector | TBD |
1815+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1816| “dithering depth” | ENUM | { "auto", "off", "on", "static 2x2", "dynamic 2x2", "temporal" } | Connector | TBD |
1817+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1818| “underscan” | ENUM | { "auto", "6 bpc", "8 bpc" } | Connector | TBD |
1819+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1820| “underscan hborder” | RANGE | Min=0, Max=128 | Connector | TBD |
1821+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1822| “underscan vborder” | RANGE | Min=0, Max=128 | Connector | TBD |
1823+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1824| “vibrant hue” | RANGE | Min=0, Max=180 | Connector | TBD |
1825+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1826| “color vibrance” | RANGE | Min=0, Max=200 | Connector | TBD |
1827+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1828| omap | Generic | “zorder” | RANGE | Min=0, Max=3 | CRTC, Plane | TBD |
1829+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1830| qxl | Generic | “hotplug_mode_update" | RANGE | Min=0, Max=1 | Connector | TBD |
1831+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1832| radeon | DVI-I | “coherent” | RANGE | Min=0, Max=1 | Connector | TBD |
1833+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1834| DAC enable load detect | “load detection” | RANGE | Min=0, Max=1 | Connector | TBD |
1835+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1836| TV Standard | "tv standard" | ENUM | { "ntsc", "pal", "pal-m", "pal-60", "ntsc-j" , "scart-pal", "pal-cn", "secam" } | Connector | TBD |
1837+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1838| legacy TMDS PLL detect | "tmds_pll" | ENUM | { "driver", "bios" } | - | TBD |
1839+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1840| Underscan | "underscan" | ENUM | { "off", "on", "auto" } | Connector | TBD |
1841+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1842| "underscan hborder" | RANGE | Min=0, Max=128 | Connector | TBD |
1843+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1844| "underscan vborder" | RANGE | Min=0, Max=128 | Connector | TBD |
1845+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1846| Audio | “audio” | ENUM | { "off", "on", "auto" } | Connector | TBD |
1847+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1848| FMT Dithering | “dither” | ENUM | { "off", "on" } | Connector | TBD |
1849+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1850| rcar-du | Generic | "alpha" | RANGE | Min=0, Max=255 | Plane | TBD |
1851+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1852| "colorkey" | RANGE | Min=0, Max=0x01ffffff | Plane | TBD |
1853+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1854| "zpos" | RANGE | Min=1, Max=7 | Plane | TBD |
1855+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1856
1857Vertical Blanking
1858-----------------
1859
1860Vertical blanking plays a major role in graphics rendering. To achieve
1861tear-free display, users must synchronize page flips and/or rendering to
1862vertical blanking. The DRM API offers ioctls to perform page flips
1863synchronized to vertical blanking and wait for vertical blanking.
1864
1865The DRM core handles most of the vertical blanking management logic,
1866which involves filtering out spurious interrupts, keeping race-free
1867blanking counters, coping with counter wrap-around and resets and
1868keeping use counts. It relies on the driver to generate vertical
1869blanking interrupts and optionally provide a hardware vertical blanking
1870counter. Drivers must implement the following operations.
1871
1872- int (\*enable_vblank) (struct drm_device \*dev, int crtc); void
1873 (\*disable_vblank) (struct drm_device \*dev, int crtc);
1874 Enable or disable vertical blanking interrupts for the given CRTC.
1875
1876- u32 (\*get_vblank_counter) (struct drm_device \*dev, int crtc);
1877 Retrieve the value of the vertical blanking counter for the given
1878 CRTC. If the hardware maintains a vertical blanking counter its value
1879 should be returned. Otherwise drivers can use the
1880 :c:func:`drm_vblank_count()` helper function to handle this
1881 operation.
1882
1883Drivers must initialize the vertical blanking handling core with a call
1884to :c:func:`drm_vblank_init()` in their load operation.
1885
1886Vertical blanking interrupts can be enabled by the DRM core or by
1887drivers themselves (for instance to handle page flipping operations).
1888The DRM core maintains a vertical blanking use count to ensure that the
1889interrupts are not disabled while a user still needs them. To increment
1890the use count, drivers call :c:func:`drm_vblank_get()`. Upon
1891return vertical blanking interrupts are guaranteed to be enabled.
1892
1893To decrement the use count drivers call
1894:c:func:`drm_vblank_put()`. Only when the use count drops to zero
1895will the DRM core disable the vertical blanking interrupts after a delay
1896by scheduling a timer. The delay is accessible through the
1897vblankoffdelay module parameter or the ``drm_vblank_offdelay`` global
1898variable and expressed in milliseconds. Its default value is 5000 ms.
1899Zero means never disable, and a negative value means disable
1900immediately. Drivers may override the behaviour by setting the
1901:c:type:`struct drm_device <drm_device>`
1902vblank_disable_immediate flag, which when set causes vblank interrupts
1903to be disabled immediately regardless of the drm_vblank_offdelay
1904value. The flag should only be set if there's a properly working
1905hardware vblank counter present.
1906
1907When a vertical blanking interrupt occurs drivers only need to call the
1908:c:func:`drm_handle_vblank()` function to account for the
1909interrupt.
1910
1911Resources allocated by :c:func:`drm_vblank_init()` must be freed
1912with a call to :c:func:`drm_vblank_cleanup()` in the driver unload
1913operation handler.
1914
1915Vertical Blanking and Interrupt Handling Functions Reference
1916~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1917
1918.. kernel-doc:: drivers/gpu/drm/drm_irq.c
1919 :export:
1920
1921.. kernel-doc:: include/drm/drmP.h
1922 :functions: drm_crtc_vblank_waitqueue
1923
1924Open/Close, File Operations and IOCTLs
1925--------------------------------------
1926
1927Open and Close
1928~~~~~~~~~~~~~~
1929
1930int (\*firstopen) (struct drm_device \*); void (\*lastclose) (struct
1931drm_device \*); int (\*open) (struct drm_device \*, struct drm_file
1932\*); void (\*preclose) (struct drm_device \*, struct drm_file \*);
1933void (\*postclose) (struct drm_device \*, struct drm_file \*);
1934 Open and close handlers. None of those methods are mandatory.
1935
1936The firstopen method is called by the DRM core for legacy UMS (User Mode
1937Setting) drivers only when an application opens a device that has no
1938other opened file handle. UMS drivers can implement it to acquire device
1939resources. KMS drivers can't use the method and must acquire resources
1940in the load method instead.
1941
1942Similarly the lastclose method is called when the last application
1943holding a file handle opened on the device closes it, for both UMS and
1944KMS drivers. Additionally, the method is also called at module unload
1945time or, for hot-pluggable devices, when the device is unplugged. The
1946firstopen and lastclose calls can thus be unbalanced.
1947
1948The open method is called every time the device is opened by an
1949application. Drivers can allocate per-file private data in this method
1950and store them in the struct :c:type:`struct drm_file
1951<drm_file>` driver_priv field. Note that the open method is
1952called before firstopen.
1953
1954The close operation is split into preclose and postclose methods.
1955Drivers must stop and cleanup all per-file operations in the preclose
1956method. For instance pending vertical blanking and page flip events must
1957be cancelled. No per-file operation is allowed on the file handle after
1958returning from the preclose method.
1959
1960Finally the postclose method is called as the last step of the close
1961operation, right before calling the lastclose method if no other open
1962file handle exists for the device. Drivers that have allocated per-file
1963private data in the open method should free it here.
1964
1965The lastclose method should restore CRTC and plane properties to default
1966value, so that a subsequent open of the device will not inherit state
1967from the previous user. It can also be used to execute delayed power
1968switching state changes, e.g. in conjunction with the vga_switcheroo
1969infrastructure (see ?). Beyond that KMS drivers should not do any
1970further cleanup. Only legacy UMS drivers might need to clean up device
1971state so that the vga console or an independent fbdev driver could take
1972over.
1973
1974File Operations
1975~~~~~~~~~~~~~~~
1976
1977.. kernel-doc:: drivers/gpu/drm/drm_fops.c
1978 :doc: file operations
1979
1980.. kernel-doc:: drivers/gpu/drm/drm_fops.c
1981 :export:
1982
1983IOCTLs
1984~~~~~~
1985
1986struct drm_ioctl_desc \*ioctls; int num_ioctls;
1987 Driver-specific ioctls descriptors table.
1988
1989Driver-specific ioctls numbers start at DRM_COMMAND_BASE. The ioctls
1990descriptors table is indexed by the ioctl number offset from the base
1991value. Drivers can use the DRM_IOCTL_DEF_DRV() macro to initialize
1992the table entries.
1993
1994::
1995
1996 DRM_IOCTL_DEF_DRV(ioctl, func, flags)
1997
1998``ioctl`` is the ioctl name. Drivers must define the DRM_##ioctl and
1999DRM_IOCTL_##ioctl macros to the ioctl number offset from
2000DRM_COMMAND_BASE and the ioctl number respectively. The first macro is
2001private to the device while the second must be exposed to userspace in a
2002public header.
2003
2004``func`` is a pointer to the ioctl handler function compatible with the
2005``drm_ioctl_t`` type.
2006
2007::
2008
2009 typedef int drm_ioctl_t(struct drm_device *dev, void *data,
2010 struct drm_file *file_priv);
2011
2012``flags`` is a bitmask combination of the following values. It restricts
2013how the ioctl is allowed to be called.
2014
2015- DRM_AUTH - Only authenticated callers allowed
2016
2017- DRM_MASTER - The ioctl can only be called on the master file handle
2018
2019- DRM_ROOT_ONLY - Only callers with the SYSADMIN capability allowed
2020
2021- DRM_CONTROL_ALLOW - The ioctl can only be called on a control
2022 device
2023
2024- DRM_UNLOCKED - The ioctl handler will be called without locking the
2025 DRM global mutex. This is the enforced default for kms drivers (i.e.
2026 using the DRIVER_MODESET flag) and hence shouldn't be used any more
2027 for new drivers.
2028
2029.. kernel-doc:: drivers/gpu/drm/drm_ioctl.c
2030 :export:
2031
2032Legacy Support Code
2033-------------------
2034
2035The section very briefly covers some of the old legacy support code
2036which is only used by old DRM drivers which have done a so-called
2037shadow-attach to the underlying device instead of registering as a real
2038driver. This also includes some of the old generic buffer management and
2039command submission code. Do not use any of this in new and modern
2040drivers.
2041
2042Legacy Suspend/Resume
2043~~~~~~~~~~~~~~~~~~~~~
2044
2045The DRM core provides some suspend/resume code, but drivers wanting full
2046suspend/resume support should provide save() and restore() functions.
2047These are called at suspend, hibernate, or resume time, and should
2048perform any state save or restore required by your device across suspend
2049or hibernate states.
2050
2051int (\*suspend) (struct drm_device \*, pm_message_t state); int
2052(\*resume) (struct drm_device \*);
2053Those are legacy suspend and resume methods which *only* work with the
2054legacy shadow-attach driver registration functions. New driver should
2055use the power management interface provided by their bus type (usually
2056through the :c:type:`struct device_driver <device_driver>`
2057dev_pm_ops) and set these methods to NULL.
2058
2059Legacy DMA Services
2060~~~~~~~~~~~~~~~~~~~
2061
2062This should cover how DMA mapping etc. is supported by the core. These
2063functions are deprecated and should not be used.
2064
2065Userland interfaces
2066===================
2067
2068The DRM core exports several interfaces to applications, generally
2069intended to be used through corresponding libdrm wrapper functions. In
2070addition, drivers export device-specific interfaces for use by userspace
2071drivers & device-aware applications through ioctls and sysfs files.
2072
2073External interfaces include: memory mapping, context management, DMA
2074operations, AGP management, vblank control, fence management, memory
2075management, and output management.
2076
2077Cover generic ioctls and sysfs layout here. We only need high-level
2078info, since man pages should cover the rest.
2079
2080Render nodes
2081------------
2082
2083DRM core provides multiple character-devices for user-space to use.
2084Depending on which device is opened, user-space can perform a different
2085set of operations (mainly ioctls). The primary node is always created
2086and called card<num>. Additionally, a currently unused control node,
2087called controlD<num> is also created. The primary node provides all
2088legacy operations and historically was the only interface used by
2089userspace. With KMS, the control node was introduced. However, the
2090planned KMS control interface has never been written and so the control
2091node stays unused to date.
2092
2093With the increased use of offscreen renderers and GPGPU applications,
2094clients no longer require running compositors or graphics servers to
2095make use of a GPU. But the DRM API required unprivileged clients to
2096authenticate to a DRM-Master prior to getting GPU access. To avoid this
2097step and to grant clients GPU access without authenticating, render
2098nodes were introduced. Render nodes solely serve render clients, that
2099is, no modesetting or privileged ioctls can be issued on render nodes.
2100Only non-global rendering commands are allowed. If a driver supports
2101render nodes, it must advertise it via the DRIVER_RENDER DRM driver
2102capability. If not supported, the primary node must be used for render
2103clients together with the legacy drmAuth authentication procedure.
2104
2105If a driver advertises render node support, DRM core will create a
2106separate render node called renderD<num>. There will be one render node
2107per device. No ioctls except PRIME-related ioctls will be allowed on
2108this node. Especially GEM_OPEN will be explicitly prohibited. Render
2109nodes are designed to avoid the buffer-leaks, which occur if clients
2110guess the flink names or mmap offsets on the legacy interface.
2111Additionally to this basic interface, drivers must mark their
2112driver-dependent render-only ioctls as DRM_RENDER_ALLOW so render
2113clients can use them. Driver authors must be careful not to allow any
2114privileged ioctls on render nodes.
2115
2116With render nodes, user-space can now control access to the render node
2117via basic file-system access-modes. A running graphics server which
2118authenticates clients on the privileged primary/legacy node is no longer
2119required. Instead, a client can open the render node and is immediately
2120granted GPU access. Communication between clients (or servers) is done
2121via PRIME. FLINK from render node to legacy node is not supported. New
2122clients must not use the insecure FLINK interface.
2123
2124Besides dropping all modeset/global ioctls, render nodes also drop the
2125DRM-Master concept. There is no reason to associate render clients with
2126a DRM-Master as they are independent of any graphics server. Besides,
2127they must work without any running master, anyway. Drivers must be able
2128to run without a master object if they support render nodes. If, on the
2129other hand, a driver requires shared state between clients which is
2130visible to user-space and accessible beyond open-file boundaries, they
2131cannot support render nodes.
2132
2133VBlank event handling
2134---------------------
2135
2136The DRM core exposes two vertical blank related ioctls:
2137
2138DRM_IOCTL_WAIT_VBLANK
2139 This takes a struct drm_wait_vblank structure as its argument, and
2140 it is used to block or request a signal when a specified vblank
2141 event occurs.
2142
2143DRM_IOCTL_MODESET_CTL
2144 This was only used for user-mode-settind drivers around modesetting
2145 changes to allow the kernel to update the vblank interrupt after
2146 mode setting, since on many devices the vertical blank counter is
2147 reset to 0 at some point during modeset. Modern drivers should not
2148 call this any more since with kernel mode setting it is a no-op.
2149
2150This second part of the GPU Driver Developer's Guide documents driver
2151code, implementation details and also all the driver-specific userspace
2152interfaces. Especially since all hardware-acceleration interfaces to
2153userspace are driver specific for efficiency and other reasons these
2154interfaces can be rather substantial. Hence every driver has its own
2155chapter.
2156
2157drm/i915 Intel GFX Driver
2158=========================
2159
2160The drm/i915 driver supports all (with the exception of some very early
2161models) integrated GFX chipsets with both Intel display and rendering
2162blocks. This excludes a set of SoC platforms with an SGX rendering unit,
2163those have basic support through the gma500 drm driver.
2164
2165Core Driver Infrastructure
2166--------------------------
2167
2168This section covers core driver infrastructure used by both the display
2169and the GEM parts of the driver.
2170
2171Runtime Power Management
2172~~~~~~~~~~~~~~~~~~~~~~~~
2173
2174.. kernel-doc:: drivers/gpu/drm/i915/intel_runtime_pm.c
2175 :doc: runtime pm
2176
2177.. kernel-doc:: drivers/gpu/drm/i915/intel_runtime_pm.c
2178 :internal:
2179
2180.. kernel-doc:: drivers/gpu/drm/i915/intel_uncore.c
2181 :internal:
2182
2183Interrupt Handling
2184~~~~~~~~~~~~~~~~~~
2185
2186.. kernel-doc:: drivers/gpu/drm/i915/i915_irq.c
2187 :doc: interrupt handling
2188
2189.. kernel-doc:: drivers/gpu/drm/i915/i915_irq.c
2190 :functions: intel_irq_init intel_irq_init_hw intel_hpd_init
2191
2192.. kernel-doc:: drivers/gpu/drm/i915/i915_irq.c
2193 :functions: intel_runtime_pm_disable_interrupts
2194
2195.. kernel-doc:: drivers/gpu/drm/i915/i915_irq.c
2196 :functions: intel_runtime_pm_enable_interrupts
2197
2198Intel GVT-g Guest Support(vGPU)
2199~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2200
2201.. kernel-doc:: drivers/gpu/drm/i915/i915_vgpu.c
2202 :doc: Intel GVT-g guest support
2203
2204.. kernel-doc:: drivers/gpu/drm/i915/i915_vgpu.c
2205 :internal:
2206
2207Display Hardware Handling
2208-------------------------
2209
2210This section covers everything related to the display hardware including
2211the mode setting infrastructure, plane, sprite and cursor handling and
2212display, output probing and related topics.
2213
2214Mode Setting Infrastructure
2215~~~~~~~~~~~~~~~~~~~~~~~~~~~
2216
2217The i915 driver is thus far the only DRM driver which doesn't use the
2218common DRM helper code to implement mode setting sequences. Thus it has
2219its own tailor-made infrastructure for executing a display configuration
2220change.
2221
2222Frontbuffer Tracking
2223~~~~~~~~~~~~~~~~~~~~
2224
2225.. kernel-doc:: drivers/gpu/drm/i915/intel_frontbuffer.c
2226 :doc: frontbuffer tracking
2227
2228.. kernel-doc:: drivers/gpu/drm/i915/intel_frontbuffer.c
2229 :internal:
2230
2231.. kernel-doc:: drivers/gpu/drm/i915/i915_gem.c
2232 :functions: i915_gem_track_fb
2233
2234Display FIFO Underrun Reporting
2235~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2236
2237.. kernel-doc:: drivers/gpu/drm/i915/intel_fifo_underrun.c
2238 :doc: fifo underrun handling
2239
2240.. kernel-doc:: drivers/gpu/drm/i915/intel_fifo_underrun.c
2241 :internal:
2242
2243Plane Configuration
2244~~~~~~~~~~~~~~~~~~~
2245
2246This section covers plane configuration and composition with the primary
2247plane, sprites, cursors and overlays. This includes the infrastructure
2248to do atomic vsync'ed updates of all this state and also tightly coupled
2249topics like watermark setup and computation, framebuffer compression and
2250panel self refresh.
2251
2252Atomic Plane Helpers
2253~~~~~~~~~~~~~~~~~~~~
2254
2255.. kernel-doc:: drivers/gpu/drm/i915/intel_atomic_plane.c
2256 :doc: atomic plane helpers
2257
2258.. kernel-doc:: drivers/gpu/drm/i915/intel_atomic_plane.c
2259 :internal:
2260
2261Output Probing
2262~~~~~~~~~~~~~~
2263
2264This section covers output probing and related infrastructure like the
2265hotplug interrupt storm detection and mitigation code. Note that the
2266i915 driver still uses most of the common DRM helper code for output
2267probing, so those sections fully apply.
2268
2269Hotplug
2270~~~~~~~
2271
2272.. kernel-doc:: drivers/gpu/drm/i915/intel_hotplug.c
2273 :doc: Hotplug
2274
2275.. kernel-doc:: drivers/gpu/drm/i915/intel_hotplug.c
2276 :internal:
2277
2278High Definition Audio
2279~~~~~~~~~~~~~~~~~~~~~
2280
2281.. kernel-doc:: drivers/gpu/drm/i915/intel_audio.c
2282 :doc: High Definition Audio over HDMI and Display Port
2283
2284.. kernel-doc:: drivers/gpu/drm/i915/intel_audio.c
2285 :internal:
2286
2287.. kernel-doc:: include/drm/i915_component.h
2288 :internal:
2289
2290Panel Self Refresh PSR (PSR/SRD)
2291~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2292
2293.. kernel-doc:: drivers/gpu/drm/i915/intel_psr.c
2294 :doc: Panel Self Refresh (PSR/SRD)
2295
2296.. kernel-doc:: drivers/gpu/drm/i915/intel_psr.c
2297 :internal:
2298
2299Frame Buffer Compression (FBC)
2300~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2301
2302.. kernel-doc:: drivers/gpu/drm/i915/intel_fbc.c
2303 :doc: Frame Buffer Compression (FBC)
2304
2305.. kernel-doc:: drivers/gpu/drm/i915/intel_fbc.c
2306 :internal:
2307
2308Display Refresh Rate Switching (DRRS)
2309~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2310
2311.. kernel-doc:: drivers/gpu/drm/i915/intel_dp.c
2312 :doc: Display Refresh Rate Switching (DRRS)
2313
2314.. kernel-doc:: drivers/gpu/drm/i915/intel_dp.c
2315 :functions: intel_dp_set_drrs_state
2316
2317.. kernel-doc:: drivers/gpu/drm/i915/intel_dp.c
2318 :functions: intel_edp_drrs_enable
2319
2320.. kernel-doc:: drivers/gpu/drm/i915/intel_dp.c
2321 :functions: intel_edp_drrs_disable
2322
2323.. kernel-doc:: drivers/gpu/drm/i915/intel_dp.c
2324 :functions: intel_edp_drrs_invalidate
2325
2326.. kernel-doc:: drivers/gpu/drm/i915/intel_dp.c
2327 :functions: intel_edp_drrs_flush
2328
2329.. kernel-doc:: drivers/gpu/drm/i915/intel_dp.c
2330 :functions: intel_dp_drrs_init
2331
2332DPIO
2333~~~~
2334
2335.. kernel-doc:: drivers/gpu/drm/i915/i915_reg.h
2336 :doc: DPIO
2337
2338CSR firmware support for DMC
2339~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2340
2341.. kernel-doc:: drivers/gpu/drm/i915/intel_csr.c
2342 :doc: csr support for dmc
2343
2344.. kernel-doc:: drivers/gpu/drm/i915/intel_csr.c
2345 :internal:
2346
2347Video BIOS Table (VBT)
2348~~~~~~~~~~~~~~~~~~~~~~
2349
2350.. kernel-doc:: drivers/gpu/drm/i915/intel_bios.c
2351 :doc: Video BIOS Table (VBT)
2352
2353.. kernel-doc:: drivers/gpu/drm/i915/intel_bios.c
2354 :internal:
2355
2356.. kernel-doc:: drivers/gpu/drm/i915/intel_vbt_defs.h
2357 :internal:
2358
2359Memory Management and Command Submission
2360----------------------------------------
2361
2362This sections covers all things related to the GEM implementation in the
2363i915 driver.
2364
2365Batchbuffer Parsing
2366~~~~~~~~~~~~~~~~~~~
2367
2368.. kernel-doc:: drivers/gpu/drm/i915/i915_cmd_parser.c
2369 :doc: batch buffer command parser
2370
2371.. kernel-doc:: drivers/gpu/drm/i915/i915_cmd_parser.c
2372 :internal:
2373
2374Batchbuffer Pools
2375~~~~~~~~~~~~~~~~~
2376
2377.. kernel-doc:: drivers/gpu/drm/i915/i915_gem_batch_pool.c
2378 :doc: batch pool
2379
2380.. kernel-doc:: drivers/gpu/drm/i915/i915_gem_batch_pool.c
2381 :internal:
2382
2383Logical Rings, Logical Ring Contexts and Execlists
2384~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2385
2386.. kernel-doc:: drivers/gpu/drm/i915/intel_lrc.c
2387 :doc: Logical Rings, Logical Ring Contexts and Execlists
2388
2389.. kernel-doc:: drivers/gpu/drm/i915/intel_lrc.c
2390 :internal:
2391
2392Global GTT views
2393~~~~~~~~~~~~~~~~
2394
2395.. kernel-doc:: drivers/gpu/drm/i915/i915_gem_gtt.c
2396 :doc: Global GTT views
2397
2398.. kernel-doc:: drivers/gpu/drm/i915/i915_gem_gtt.c
2399 :internal:
2400
2401GTT Fences and Swizzling
2402~~~~~~~~~~~~~~~~~~~~~~~~
2403
2404.. kernel-doc:: drivers/gpu/drm/i915/i915_gem_fence.c
2405 :internal:
2406
2407Global GTT Fence Handling
2408^^^^^^^^^^^^^^^^^^^^^^^^^
2409
2410.. kernel-doc:: drivers/gpu/drm/i915/i915_gem_fence.c
2411 :doc: fence register handling
2412
2413Hardware Tiling and Swizzling Details
2414^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2415
2416.. kernel-doc:: drivers/gpu/drm/i915/i915_gem_fence.c
2417 :doc: tiling swizzling details
2418
2419Object Tiling IOCTLs
2420~~~~~~~~~~~~~~~~~~~~
2421
2422.. kernel-doc:: drivers/gpu/drm/i915/i915_gem_tiling.c
2423 :internal:
2424
2425.. kernel-doc:: drivers/gpu/drm/i915/i915_gem_tiling.c
2426 :doc: buffer object tiling
2427
2428Buffer Object Eviction
2429~~~~~~~~~~~~~~~~~~~~~~
2430
2431This section documents the interface functions for evicting buffer
2432objects to make space available in the virtual gpu address spaces. Note
2433that this is mostly orthogonal to shrinking buffer objects caches, which
2434has the goal to make main memory (shared with the gpu through the
2435unified memory architecture) available.
2436
2437.. kernel-doc:: drivers/gpu/drm/i915/i915_gem_evict.c
2438 :internal:
2439
2440Buffer Object Memory Shrinking
2441~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2442
2443This section documents the interface function for shrinking memory usage
2444of buffer object caches. Shrinking is used to make main memory
2445available. Note that this is mostly orthogonal to evicting buffer
2446objects, which has the goal to make space in gpu virtual address spaces.
2447
2448.. kernel-doc:: drivers/gpu/drm/i915/i915_gem_shrinker.c
2449 :internal:
2450
2451GuC
2452---
2453
2454GuC-specific firmware loader
2455~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2456
2457.. kernel-doc:: drivers/gpu/drm/i915/intel_guc_loader.c
2458 :doc: GuC-specific firmware loader
2459
2460.. kernel-doc:: drivers/gpu/drm/i915/intel_guc_loader.c
2461 :internal:
2462
2463GuC-based command submission
2464~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2465
2466.. kernel-doc:: drivers/gpu/drm/i915/i915_guc_submission.c
2467 :doc: GuC-based command submission
2468
2469.. kernel-doc:: drivers/gpu/drm/i915/i915_guc_submission.c
2470 :internal:
2471
2472GuC Firmware Layout
2473~~~~~~~~~~~~~~~~~~~
2474
2475.. kernel-doc:: drivers/gpu/drm/i915/intel_guc_fwif.h
2476 :doc: GuC Firmware Layout
2477
2478Tracing
2479-------
2480
2481This sections covers all things related to the tracepoints implemented
2482in the i915 driver.
2483
2484i915_ppgtt_create and i915_ppgtt_release
2485~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2486
2487.. kernel-doc:: drivers/gpu/drm/i915/i915_trace.h
2488 :doc: i915_ppgtt_create and i915_ppgtt_release tracepoints
2489
2490i915_context_create and i915_context_free
2491~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2492
2493.. kernel-doc:: drivers/gpu/drm/i915/i915_trace.h
2494 :doc: i915_context_create and i915_context_free tracepoints
2495
2496switch_mm
2497~~~~~~~~~~
2498
2499.. kernel-doc:: drivers/gpu/drm/i915/i915_trace.h
2500 :doc: switch_mm tracepoint
2501
2502.. WARNING: DOCPROC directive not supported: !Cdrivers/gpu/drm/i915/i915_irq.c
2503
2504.. kernel-doc:: drivers/gpu/vga/vga_switcheroo.c
2505 :doc: Overview
2506
2507Modes of Use
2508============
2509
2510Manual switching and manual power control
2511-----------------------------------------
2512
2513.. kernel-doc:: drivers/gpu/vga/vga_switcheroo.c
2514 :doc: Manual switching and manual power control
2515
2516Driver power control
2517--------------------
2518
2519.. kernel-doc:: drivers/gpu/vga/vga_switcheroo.c
2520 :doc: Driver power control
2521
2522API
2523===
2524
2525Public functions
2526----------------
2527
2528.. kernel-doc:: drivers/gpu/vga/vga_switcheroo.c
2529 :export:
2530
2531Public structures
2532-----------------
2533
2534.. kernel-doc:: include/linux/vga_switcheroo.h
2535 :functions: vga_switcheroo_handler
2536
2537.. kernel-doc:: include/linux/vga_switcheroo.h
2538 :functions: vga_switcheroo_client_ops
2539
2540Public constants
2541----------------
2542
2543.. kernel-doc:: include/linux/vga_switcheroo.h
2544 :functions: vga_switcheroo_handler_flags_t
2545
2546.. kernel-doc:: include/linux/vga_switcheroo.h
2547 :functions: vga_switcheroo_client_id
2548
2549.. kernel-doc:: include/linux/vga_switcheroo.h
2550 :functions: vga_switcheroo_state
2551
2552Private structures
2553------------------
2554
2555.. kernel-doc:: drivers/gpu/vga/vga_switcheroo.c
2556 :functions: vgasr_priv
2557
2558.. kernel-doc:: drivers/gpu/vga/vga_switcheroo.c
2559 :functions: vga_switcheroo_client
2560
2561Handlers
2562========
2563
2564apple-gmux Handler
2565------------------
2566
2567.. kernel-doc:: drivers/platform/x86/apple-gmux.c
2568 :doc: Overview
2569
2570.. kernel-doc:: drivers/platform/x86/apple-gmux.c
2571 :doc: Interrupt
2572
2573Graphics mux
2574~~~~~~~~~~~~
2575
2576.. kernel-doc:: drivers/platform/x86/apple-gmux.c
2577 :doc: Graphics mux
2578
2579Power control
2580~~~~~~~~~~~~~
2581
2582.. kernel-doc:: drivers/platform/x86/apple-gmux.c
2583 :doc: Power control
2584
2585Backlight control
2586~~~~~~~~~~~~~~~~~
2587
2588.. kernel-doc:: drivers/platform/x86/apple-gmux.c
2589 :doc: Backlight control
2590
2591Public functions
2592~~~~~~~~~~~~~~~~
2593
2594.. kernel-doc:: include/linux/apple-gmux.h
2595 :internal:
2596
2597.. WARNING: DOCPROC directive not supported: !Cdrivers/gpu/vga/vga_switcheroo.c
2598
2599.. WARNING: DOCPROC directive not supported: !Cinclude/linux/vga_switcheroo.h
2600
2601.. WARNING: DOCPROC directive not supported: !Cdrivers/platform/x86/apple-gmux.c