~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/gpu/drm-uapi.rst

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /Documentation/gpu/drm-uapi.rst (Version linux-6.11.5) and /Documentation/gpu/drm-uapi.rst (Version linux-4.17.19)


  1 .. Copyright 2020 DisplayLink (UK) Ltd.        << 
  2                                                << 
  3 ===================                                 1 ===================
  4 Userland interfaces                                 2 Userland interfaces
  5 ===================                                 3 ===================
  6                                                     4 
  7 The DRM core exports several interfaces to app      5 The DRM core exports several interfaces to applications, generally
  8 intended to be used through corresponding libd      6 intended to be used through corresponding libdrm wrapper functions. In
  9 addition, drivers export device-specific inter      7 addition, drivers export device-specific interfaces for use by userspace
 10 drivers & device-aware applications through io      8 drivers & device-aware applications through ioctls and sysfs files.
 11                                                     9 
 12 External interfaces include: memory mapping, c     10 External interfaces include: memory mapping, context management, DMA
 13 operations, AGP management, vblank control, fe     11 operations, AGP management, vblank control, fence management, memory
 14 management, and output management.                 12 management, and output management.
 15                                                    13 
 16 Cover generic ioctls and sysfs layout here. We     14 Cover generic ioctls and sysfs layout here. We only need high-level
 17 info, since man pages should cover the rest.       15 info, since man pages should cover the rest.
 18                                                    16 
 19 libdrm Device Lookup                               17 libdrm Device Lookup
 20 ====================                               18 ====================
 21                                                    19 
 22 .. kernel-doc:: drivers/gpu/drm/drm_ioctl.c        20 .. kernel-doc:: drivers/gpu/drm/drm_ioctl.c
 23    :doc: getunique and setversion story            21    :doc: getunique and setversion story
 24                                                    22 
 25                                                    23 
 26 .. _drm_primary_node:                              24 .. _drm_primary_node:
 27                                                    25 
 28 Primary Nodes, DRM Master and Authentication       26 Primary Nodes, DRM Master and Authentication
 29 ============================================       27 ============================================
 30                                                    28 
 31 .. kernel-doc:: drivers/gpu/drm/drm_auth.c         29 .. kernel-doc:: drivers/gpu/drm/drm_auth.c
 32    :doc: master and authentication                 30    :doc: master and authentication
 33                                                    31 
 34 .. kernel-doc:: drivers/gpu/drm/drm_auth.c         32 .. kernel-doc:: drivers/gpu/drm/drm_auth.c
 35    :export:                                        33    :export:
 36                                                    34 
 37 .. kernel-doc:: include/drm/drm_auth.h             35 .. kernel-doc:: include/drm/drm_auth.h
 38    :internal:                                      36    :internal:
 39                                                    37 
 40                                                << 
 41 .. _drm_leasing:                               << 
 42                                                << 
 43 DRM Display Resource Leasing                   << 
 44 ============================                   << 
 45                                                << 
 46 .. kernel-doc:: drivers/gpu/drm/drm_lease.c    << 
 47    :doc: drm leasing                           << 
 48                                                << 
 49 Open-Source Userspace Requirements                 38 Open-Source Userspace Requirements
 50 ==================================                 39 ==================================
 51                                                    40 
 52 The DRM subsystem has stricter requirements th     41 The DRM subsystem has stricter requirements than most other kernel subsystems on
 53 what the userspace side for new uAPI needs to      42 what the userspace side for new uAPI needs to look like. This section here
 54 explains what exactly those requirements are,      43 explains what exactly those requirements are, and why they exist.
 55                                                    44 
 56 The short summary is that any addition of DRM      45 The short summary is that any addition of DRM uAPI requires corresponding
 57 open-sourced userspace patches, and those patc     46 open-sourced userspace patches, and those patches must be reviewed and ready for
 58 merging into a suitable and canonical upstream     47 merging into a suitable and canonical upstream project.
 59                                                    48 
 60 GFX devices (both display and render/GPU side)     49 GFX devices (both display and render/GPU side) are really complex bits of
 61 hardware, with userspace and kernel by necessi     50 hardware, with userspace and kernel by necessity having to work together really
 62 closely.  The interfaces, for rendering and mo     51 closely.  The interfaces, for rendering and modesetting, must be extremely wide
 63 and flexible, and therefore it is almost alway     52 and flexible, and therefore it is almost always impossible to precisely define
 64 them for every possible corner case. This in t     53 them for every possible corner case. This in turn makes it really practically
 65 infeasible to differentiate between behaviour      54 infeasible to differentiate between behaviour that's required by userspace, and
 66 which must not be changed to avoid regressions     55 which must not be changed to avoid regressions, and behaviour which is only an
 67 accidental artifact of the current implementat     56 accidental artifact of the current implementation.
 68                                                    57 
 69 Without access to the full source code of all      58 Without access to the full source code of all userspace users that means it
 70 becomes impossible to change the implementatio     59 becomes impossible to change the implementation details, since userspace could
 71 depend upon the accidental behaviour of the cu     60 depend upon the accidental behaviour of the current implementation in minute
 72 details. And debugging such regressions withou     61 details. And debugging such regressions without access to source code is pretty
 73 much impossible. As a consequence this means:      62 much impossible. As a consequence this means:
 74                                                    63 
 75 - The Linux kernel's "no regression" policy ho     64 - The Linux kernel's "no regression" policy holds in practice only for
 76   open-source userspace of the DRM subsystem.      65   open-source userspace of the DRM subsystem. DRM developers are perfectly fine
 77   if closed-source blob drivers in userspace u     66   if closed-source blob drivers in userspace use the same uAPI as the open
 78   drivers, but they must do so in the exact sa     67   drivers, but they must do so in the exact same way as the open drivers.
 79   Creative (ab)use of the interfaces will, and     68   Creative (ab)use of the interfaces will, and in the past routinely has, lead
 80   to breakage.                                     69   to breakage.
 81                                                    70 
 82 - Any new userspace interface must have an ope     71 - Any new userspace interface must have an open-source implementation as
 83   demonstration vehicle.                           72   demonstration vehicle.
 84                                                    73 
 85 The other reason for requiring open-source use     74 The other reason for requiring open-source userspace is uAPI review. Since the
 86 kernel and userspace parts of a GFX stack must     75 kernel and userspace parts of a GFX stack must work together so closely, code
 87 review can only assess whether a new interface     76 review can only assess whether a new interface achieves its goals by looking at
 88 both sides. Making sure that the interface ind     77 both sides. Making sure that the interface indeed covers the use-case fully
 89 leads to a few additional requirements:            78 leads to a few additional requirements:
 90                                                    79 
 91 - The open-source userspace must not be a toy/     80 - The open-source userspace must not be a toy/test application, but the real
 92   thing. Specifically it needs to handle all t     81   thing. Specifically it needs to handle all the usual error and corner cases.
 93   These are often the places where new uAPI fa     82   These are often the places where new uAPI falls apart and hence essential to
 94   assess the fitness of a proposed interface.      83   assess the fitness of a proposed interface.
 95                                                    84 
 96 - The userspace side must be fully reviewed an     85 - The userspace side must be fully reviewed and tested to the standards of that
 97   userspace project. For e.g. mesa this means      86   userspace project. For e.g. mesa this means piglit testcases and review on the
 98   mailing list. This is again to ensure that t     87   mailing list. This is again to ensure that the new interface actually gets the
 99   job done.  The userspace-side reviewer shoul !!  88   job done.
100   kernel uAPI patch indicating that they belie << 
101   sufficiently documented and validated for us << 
102                                                    89 
103 - The userspace patches must be against the ca     90 - The userspace patches must be against the canonical upstream, not some vendor
104   fork. This is to make sure that no one cheat     91   fork. This is to make sure that no one cheats on the review and testing
105   requirements by doing a quick fork.              92   requirements by doing a quick fork.
106                                                    93 
107 - The kernel patch can only be merged after al     94 - The kernel patch can only be merged after all the above requirements are met,
108   but it **must** be merged to either drm-next !!  95   but it **must** be merged **before** the userspace patches land. uAPI always flows
109   userspace patches land. uAPI always flows fr !!  96   from the kernel, doing things the other way round risks divergence of the uAPI
110   other way round risks divergence of the uAPI !!  97   definitions and header files.
111                                                    98 
112 These are fairly steep requirements, but have      99 These are fairly steep requirements, but have grown out from years of shared
113 pain and experience with uAPI added hastily, a    100 pain and experience with uAPI added hastily, and almost always regretted about
114 just as fast. GFX devices change really fast,     101 just as fast. GFX devices change really fast, requiring a paradigm shift and
115 entire new set of uAPI interfaces every few ye    102 entire new set of uAPI interfaces every few years at least. Together with the
116 Linux kernel's guarantee to keep existing user    103 Linux kernel's guarantee to keep existing userspace running for 10+ years this
117 is already rather painful for the DRM subsyste    104 is already rather painful for the DRM subsystem, with multiple different uAPIs
118 for the same thing co-existing. If we add a fe    105 for the same thing co-existing. If we add a few more complete mistakes into the
119 mix every year it would be entirely unmanageab    106 mix every year it would be entirely unmanageable.
120                                                   107 
121 .. _drm_render_node:                              108 .. _drm_render_node:
122                                                   109 
123 Render nodes                                      110 Render nodes
124 ============                                      111 ============
125                                                   112 
126 DRM core provides multiple character-devices f    113 DRM core provides multiple character-devices for user-space to use.
127 Depending on which device is opened, user-spac    114 Depending on which device is opened, user-space can perform a different
128 set of operations (mainly ioctls). The primary    115 set of operations (mainly ioctls). The primary node is always created
129 and called card<num>. Additionally, a currentl    116 and called card<num>. Additionally, a currently unused control node,
130 called controlD<num> is also created. The prim    117 called controlD<num> is also created. The primary node provides all
131 legacy operations and historically was the onl    118 legacy operations and historically was the only interface used by
132 userspace. With KMS, the control node was intr    119 userspace. With KMS, the control node was introduced. However, the
133 planned KMS control interface has never been w    120 planned KMS control interface has never been written and so the control
134 node stays unused to date.                        121 node stays unused to date.
135                                                   122 
136 With the increased use of offscreen renderers     123 With the increased use of offscreen renderers and GPGPU applications,
137 clients no longer require running compositors     124 clients no longer require running compositors or graphics servers to
138 make use of a GPU. But the DRM API required un    125 make use of a GPU. But the DRM API required unprivileged clients to
139 authenticate to a DRM-Master prior to getting     126 authenticate to a DRM-Master prior to getting GPU access. To avoid this
140 step and to grant clients GPU access without a    127 step and to grant clients GPU access without authenticating, render
141 nodes were introduced. Render nodes solely ser    128 nodes were introduced. Render nodes solely serve render clients, that
142 is, no modesetting or privileged ioctls can be    129 is, no modesetting or privileged ioctls can be issued on render nodes.
143 Only non-global rendering commands are allowed    130 Only non-global rendering commands are allowed. If a driver supports
144 render nodes, it must advertise it via the DRI    131 render nodes, it must advertise it via the DRIVER_RENDER DRM driver
145 capability. If not supported, the primary node    132 capability. If not supported, the primary node must be used for render
146 clients together with the legacy drmAuth authe    133 clients together with the legacy drmAuth authentication procedure.
147                                                   134 
148 If a driver advertises render node support, DR    135 If a driver advertises render node support, DRM core will create a
149 separate render node called renderD<num>. Ther    136 separate render node called renderD<num>. There will be one render node
150 per device. No ioctls except PRIME-related ioc    137 per device. No ioctls except PRIME-related ioctls will be allowed on
151 this node. Especially GEM_OPEN will be explici !! 138 this node. Especially GEM_OPEN will be explicitly prohibited. Render
152 complete list of driver-independent ioctls tha << 
153 nodes, see the ioctls marked DRM_RENDER_ALLOW  << 
154 nodes are designed to avoid the buffer-leaks,     139 nodes are designed to avoid the buffer-leaks, which occur if clients
155 guess the flink names or mmap offsets on the l    140 guess the flink names or mmap offsets on the legacy interface.
156 Additionally to this basic interface, drivers     141 Additionally to this basic interface, drivers must mark their
157 driver-dependent render-only ioctls as DRM_REN    142 driver-dependent render-only ioctls as DRM_RENDER_ALLOW so render
158 clients can use them. Driver authors must be c    143 clients can use them. Driver authors must be careful not to allow any
159 privileged ioctls on render nodes.                144 privileged ioctls on render nodes.
160                                                   145 
161 With render nodes, user-space can now control     146 With render nodes, user-space can now control access to the render node
162 via basic file-system access-modes. A running     147 via basic file-system access-modes. A running graphics server which
163 authenticates clients on the privileged primar    148 authenticates clients on the privileged primary/legacy node is no longer
164 required. Instead, a client can open the rende    149 required. Instead, a client can open the render node and is immediately
165 granted GPU access. Communication between clie    150 granted GPU access. Communication between clients (or servers) is done
166 via PRIME. FLINK from render node to legacy no    151 via PRIME. FLINK from render node to legacy node is not supported. New
167 clients must not use the insecure FLINK interf    152 clients must not use the insecure FLINK interface.
168                                                   153 
169 Besides dropping all modeset/global ioctls, re    154 Besides dropping all modeset/global ioctls, render nodes also drop the
170 DRM-Master concept. There is no reason to asso    155 DRM-Master concept. There is no reason to associate render clients with
171 a DRM-Master as they are independent of any gr    156 a DRM-Master as they are independent of any graphics server. Besides,
172 they must work without any running master, any    157 they must work without any running master, anyway. Drivers must be able
173 to run without a master object if they support    158 to run without a master object if they support render nodes. If, on the
174 other hand, a driver requires shared state bet    159 other hand, a driver requires shared state between clients which is
175 visible to user-space and accessible beyond op    160 visible to user-space and accessible beyond open-file boundaries, they
176 cannot support render nodes.                      161 cannot support render nodes.
177                                                   162 
178 Device Hot-Unplug                              << 
179 =================                              << 
180                                                << 
181 .. note::                                      << 
182    The following is the plan. Implementation i << 
183    (2020 May).                                 << 
184                                                << 
185 Graphics devices (display and/or render) may b << 
186 display adapters or docking stations) or Thund << 
187 user is able to hot-unplug this kind of device << 
188 used, and expects that the very least the mach << 
189 damage from hot-unplugging a DRM device needs  << 
190 possible and userspace must be given the chanc << 
191 to. Ideally, unplugging a DRM device still let << 
192 run, but that is going to need explicit suppor << 
193 graphics stack: from kernel and userspace driv << 
194 servers, via window system protocols, and in a << 
195                                                << 
196 Other scenarios that should lead to the same a << 
197 crash, PCI device disappearing off the bus, or << 
198 from the physical device.                      << 
199                                                << 
200 In other words, from userspace perspective eve << 
201 working more or less, until userspace stops us << 
202 device and closes it completely. Userspace wil << 
203 disappearance from the device removed uevent,  << 
204 (or driver-specific ioctls returning driver-sp << 
205 returning ENXIO.                               << 
206                                                << 
207 Only after userspace has closed all relevant D << 
208 descriptors and removed all mmaps, the DRM dri << 
209 instance for the device that no longer exists. << 
210 device somehow comes back in the mean time, it << 
211 device.                                        << 
212                                                << 
213 Similar to PIDs, chardev minor numbers are not << 
214 new DRM device always picks the next free mino << 
215 previous one allocated, and wraps around when  << 
216 exhausted.                                     << 
217                                                << 
218 The goal raises at least the following require << 
219 drivers.                                       << 
220                                                << 
221 Requirements for KMS UAPI                      << 
222 -------------------------                      << 
223                                                << 
224 - KMS connectors must change their status to d << 
225                                                << 
226 - Legacy modesets and pageflips, and atomic co << 
227   TEST_ONLY, and any other ioctls either fail  << 
228   success.                                     << 
229                                                << 
230 - Pending non-blocking KMS operations deliver  << 
231   is expecting. This applies also to ioctls th << 
232                                                << 
233 - open() on a device node whose underlying dev << 
234   fail with ENXIO.                             << 
235                                                << 
236 - Attempting to create a DRM lease on a disapp << 
237   fail with ENODEV. Existing DRM leases remain << 
238   above.                                       << 
239                                                << 
240 Requirements for Render and Cross-Device UAPI  << 
241 ---------------------------------------------  << 
242                                                << 
243 - All GPU jobs that can no longer run must hav << 
244   force-signalled to avoid inflicting hangs on << 
245   The associated error code is ENODEV.         << 
246                                                << 
247 - Some userspace APIs already define what shou << 
248   disappears (OpenGL, GL ES: `GL_KHR_robustnes << 
249   VK_ERROR_DEVICE_LOST; etc.). DRM drivers are << 
250   behaviour the way they see best, e.g. return << 
251   driver-specific ioctls and handling those in << 
252   rely on uevents, and so on.                  << 
253                                                << 
254 - dmabuf which point to memory that has disapp << 
255   import with ENODEV or continue to be success << 
256   have succeeded before the disappearance. See << 
257   below for already imported dmabufs.          << 
258                                                << 
259 - Attempting to import a dmabuf to a disappear << 
260   with ENODEV or succeed if it would have succ << 
261   disappearance.                               << 
262                                                << 
263 - open() on a device node whose underlying dev << 
264   fail with ENXIO.                             << 
265                                                << 
266 .. _GL_KHR_robustness: https://www.khronos.org << 
267 .. _Vulkan: https://www.khronos.org/vulkan/    << 
268                                                << 
269 Requirements for Memory Maps                   << 
270 ----------------------------                   << 
271                                                << 
272 Memory maps have further requirements that app << 
273 and maps created after the device has disappea << 
274 memory disappears, the map is created or modif << 
275 writes will still complete successfully but th << 
276 This applies to both userspace mmap()'d memory << 
277 dmabuf which might be mapped to other devices  << 
278 imports).                                      << 
279                                                << 
280 Raising SIGBUS is not an option, because users << 
281 handle it. Signal handlers are global, which m << 
282 difficult to use correctly from libraries like << 
283 Signal handlers are not composable, you can't  << 
284 for GPU1 and GPU2 from different vendors, and  << 
285 mmapped regular files. Threads cause additiona << 
286 handling as well.                              << 
287                                                << 
288 Device reset                                   << 
289 ============                                   << 
290                                                << 
291 The GPU stack is really complex and is prone t << 
292 faulty applications and everything in between  << 
293 require resetting the device in order to make  << 
294 section describes the expectations for DRM and << 
295 device resets and how to propagate the reset s << 
296                                                << 
297 Device resets can not be disabled without tain << 
298 hanging the entire kernel through shrinkers/mm << 
299 device resets is to propagate the message to t << 
300 special policy for blocking guilty application << 
301 debugging a hung GPU context require hardware  << 
302 a GPU context while it's stopped.              << 
303                                                << 
304 Kernel Mode Driver                             << 
305 ------------------                             << 
306                                                << 
307 The KMD is responsible for checking if the dev << 
308 it as needed. Usually a hang is detected when  << 
309 should keep track of resets, because userspace << 
310 reset status for a specific context. This is n << 
311 the stack that a reset has happened. Currently << 
312 driver separately, with no common DRM interfac << 
313 integrated at DRM scheduler to provide a commo << 
314 reset, KMD should reject new command submissio << 
315                                                << 
316 User Mode Driver                               << 
317 ----------------                               << 
318                                                << 
319 After command submission, UMD should check if  << 
320 rejected. After a reset, KMD should reject sub << 
321 ioctl to the KMD to check the reset status, an << 
322 if the UMD requires it. After detecting a rese << 
323 it to the application using the appropriate AP << 
324 section below about robustness.                << 
325                                                << 
326 Robustness                                     << 
327 ----------                                     << 
328                                                << 
329 The only way to try to keep a graphical API co << 
330 it complies with the robustness aspects of the << 
331                                                << 
332 Graphical APIs provide ways to applications to << 
333 there is no guarantee that the app will use su << 
334 userspace that doesn't support robust interfac << 
335 OpenGL context or API without any robustness s << 
336 robustness handling entirely to the userspace  << 
337 community consensus on what the userspace driv << 
338 since all reasonable approaches have some clea << 
339                                                << 
340 OpenGL                                         << 
341 ~~~~~~                                         << 
342                                                << 
343 Apps using OpenGL should use the available rob << 
344 extension ``GL_ARB_robustness`` (or ``GL_EXT_r << 
345 interface tells if a reset has happened, and i << 
346 considered lost and the app proceeds by creati << 
347 on what to do to if robustness is not in use.  << 
348                                                << 
349 Vulkan                                         << 
350 ~~~~~~                                         << 
351                                                << 
352 Apps using Vulkan should check for ``VK_ERROR_ << 
353 This error code means, among other things, tha << 
354 it needs to recreate the contexts to keep goin << 
355                                                << 
356 Reporting causes of resets                     << 
357 --------------------------                     << 
358                                                << 
359 Apart from propagating the reset through the s << 
360 really useful for driver developers to learn m << 
361 the first place. DRM devices should make use o << 
362 information about the reset, so this informati << 
363 reports.                                       << 
364                                                << 
365 .. _drm_driver_ioctl:                             163 .. _drm_driver_ioctl:
366                                                   164 
367 IOCTL Support on Device Nodes                     165 IOCTL Support on Device Nodes
368 =============================                     166 =============================
369                                                   167 
370 .. kernel-doc:: drivers/gpu/drm/drm_ioctl.c       168 .. kernel-doc:: drivers/gpu/drm/drm_ioctl.c
371    :doc: driver specific ioctls                   169    :doc: driver specific ioctls
372                                                   170 
373 Recommended IOCTL Return Values                   171 Recommended IOCTL Return Values
374 -------------------------------                   172 -------------------------------
375                                                   173 
376 In theory a driver's IOCTL callback is only al    174 In theory a driver's IOCTL callback is only allowed to return very few error
377 codes. In practice it's good to abuse a few mo    175 codes. In practice it's good to abuse a few more. This section documents common
378 practice within the DRM subsystem:                176 practice within the DRM subsystem:
379                                                   177 
380 ENOENT:                                           178 ENOENT:
381         Strictly this should only be used when    179         Strictly this should only be used when a file doesn't exist e.g. when
382         calling the open() syscall. We reuse t    180         calling the open() syscall. We reuse that to signal any kind of object
383         lookup failure, e.g. for unknown GEM b    181         lookup failure, e.g. for unknown GEM buffer object handles, unknown KMS
384         object handles and similar cases.         182         object handles and similar cases.
385                                                   183 
386 ENOSPC:                                           184 ENOSPC:
387         Some drivers use this to differentiate    185         Some drivers use this to differentiate "out of kernel memory" from "out
388         of VRAM". Sometimes also applies to ot    186         of VRAM". Sometimes also applies to other limited gpu resources used for
389         rendering (e.g. when you have a specia    187         rendering (e.g. when you have a special limited compression buffer).
390         Sometimes resource allocation/reservat    188         Sometimes resource allocation/reservation issues in command submission
391         IOCTLs are also signalled through EDEA    189         IOCTLs are also signalled through EDEADLK.
392                                                   190 
393         Simply running out of kernel/system me    191         Simply running out of kernel/system memory is signalled through ENOMEM.
394                                                   192 
395 EPERM/EACCES:                                  !! 193 EPERM/EACCESS:
396         Returned for an operation that is vali    194         Returned for an operation that is valid, but needs more privileges.
397         E.g. root-only or much more common, DR    195         E.g. root-only or much more common, DRM master-only operations return
398         this when called by unpriviledged clie !! 196         this when when called by unpriviledged clients. There's no clear
399         difference between EACCES and EPERM.   !! 197         difference between EACCESS and EPERM.
400                                                   198 
401 ENODEV:                                           199 ENODEV:
402         The device is not present anymore or i << 
403                                                << 
404 EOPNOTSUPP:                                    << 
405         Feature (like PRIME, modesetting, GEM)    200         Feature (like PRIME, modesetting, GEM) is not supported by the driver.
406                                                   201 
407 ENXIO:                                            202 ENXIO:
408         Remote failure, either a hardware tran    203         Remote failure, either a hardware transaction (like i2c), but also used
409         when the exporting driver of a shared     204         when the exporting driver of a shared dma-buf or fence doesn't support a
410         feature needed.                           205         feature needed.
411                                                   206 
412 EINTR:                                            207 EINTR:
413         DRM drivers assume that userspace rest    208         DRM drivers assume that userspace restarts all IOCTLs. Any DRM IOCTL can
414         return EINTR and in such a case should    209         return EINTR and in such a case should be restarted with the IOCTL
415         parameters left unchanged.                210         parameters left unchanged.
416                                                   211 
417 EIO:                                              212 EIO:
418         The GPU died and couldn't be resurrect    213         The GPU died and couldn't be resurrected through a reset. Modesetting
419         hardware failures are signalled throug    214         hardware failures are signalled through the "link status" connector
420         property.                                 215         property.
421                                                   216 
422 EINVAL:                                           217 EINVAL:
423         Catch-all for anything that is an inva    218         Catch-all for anything that is an invalid argument combination which
424         cannot work.                              219         cannot work.
425                                                   220 
426 IOCTL also use other error codes like ETIME, E    221 IOCTL also use other error codes like ETIME, EFAULT, EBUSY, ENOTTY but their
427 usage is in line with the common meanings. The    222 usage is in line with the common meanings. The above list tries to just document
428 DRM specific patterns. Note that ENOTTY has th    223 DRM specific patterns. Note that ENOTTY has the slightly unintuitive meaning of
429 "this IOCTL does not exist", and is used exact    224 "this IOCTL does not exist", and is used exactly as such in DRM.
430                                                   225 
431 .. kernel-doc:: include/drm/drm_ioctl.h           226 .. kernel-doc:: include/drm/drm_ioctl.h
432    :internal:                                     227    :internal:
433                                                   228 
434 .. kernel-doc:: drivers/gpu/drm/drm_ioctl.c       229 .. kernel-doc:: drivers/gpu/drm/drm_ioctl.c
435    :export:                                       230    :export:
436                                                   231 
437 .. kernel-doc:: drivers/gpu/drm/drm_ioc32.c       232 .. kernel-doc:: drivers/gpu/drm/drm_ioc32.c
438    :export:                                       233    :export:
439                                                   234 
440 Testing and validation                            235 Testing and validation
441 ======================                            236 ======================
442                                                   237 
443 Testing Requirements for userspace API         << 
444 --------------------------------------         << 
445                                                << 
446 New cross-driver userspace interface extension << 
447 properties, new files in sysfs or anything els << 
448 should have driver-agnostic testcases in IGT f << 
449 can be reasonably made using IGT for the targe << 
450                                                << 
451 Validating changes with IGT                       238 Validating changes with IGT
452 ---------------------------                       239 ---------------------------
453                                                   240 
454 There's a collection of tests that aims to cov    241 There's a collection of tests that aims to cover the whole functionality of
455 DRM drivers and that can be used to check that    242 DRM drivers and that can be used to check that changes to DRM drivers or the
456 core don't regress existing functionality. Thi    243 core don't regress existing functionality. This test suite is called IGT and
457 its code and instructions to build and run can !! 244 its code can be found in https://cgit.freedesktop.org/drm/igt-gpu-tools/.
458 https://gitlab.freedesktop.org/drm/igt-gpu-too !! 245 
                                                   >> 246 To build IGT, start by installing its build dependencies. In Debian-based
                                                   >> 247 systems::
                                                   >> 248 
                                                   >> 249         # apt-get build-dep intel-gpu-tools
459                                                   250 
460 Using VKMS to test DRM API                     !! 251 And in Fedora-based systems::
461 --------------------------                     << 
462                                                   252 
463 VKMS is a software-only model of a KMS driver  !! 253         # dnf builddep intel-gpu-tools
464 and for running compositors. VKMS aims to enab << 
465 the need for a hardware display capability. Th << 
466 a perfect tool for validating the DRM core beh << 
467 compositor developer. VKMS makes it possible t << 
468 virtual machine without display, simplifying t << 
469 core changes.                                  << 
470                                                   254 
471 To Validate changes in DRM API with VKMS, star !! 255 Then clone the repository::
472 sure to enable VKMS module; compile the kernel << 
473 install it in the target machine. VKMS can be  << 
474 (QEMU, virtme or similar). It's recommended th << 
475 of 1GB of RAM and four cores.                  << 
476                                                   256 
477 It's possible to run the IGT-tests in a VM in  !! 257         $ git clone git://anongit.freedesktop.org/drm/igt-gpu-tools
478                                                   258 
479         1. Use IGT inside a VM                 !! 259 Configure the build system and start the build::
480         2. Use IGT from the host machine and w << 
481                                                   260 
482 Following is an example of using a VM with a s !! 261         $ cd igt-gpu-tools && ./autogen.sh && make -j6
483 the host machine to run igt-tests. This exampl << 
484                                                   262 
485         $ virtme-run --rwdir /path/for/shared_ !! 263 Download the piglit dependency::
486                                                   264 
487 Run the igt-tests in the guest machine. This e !! 265         $ ./scripts/run-tests.sh -d
488 tests::                                        << 
489                                                   266 
490         $ /path/for/igt-gpu-tools/scripts/run- !! 267 And run the tests::
491                                                   268 
492 In this example, instead of building the igt_r !! 269         $ ./scripts/run-tests.sh -t kms -t core -s
493 (-p option). It creates an HTML summary of the !! 270 
494 them in the folder "igt-gpu-tools/results". It !! 271 run-tests.sh is a wrapper around piglit that will execute the tests matching
495 matching the -t option.                        !! 272 the -t options. A report in HTML format will be available in
                                                   >> 273 ./results/html/index.html. Results can be compared with piglit.
496                                                   274 
497 Display CRC Support                               275 Display CRC Support
498 -------------------                               276 -------------------
499                                                   277 
500 .. kernel-doc:: drivers/gpu/drm/drm_debugfs_cr    278 .. kernel-doc:: drivers/gpu/drm/drm_debugfs_crc.c
501    :doc: CRC ABI                                  279    :doc: CRC ABI
502                                                   280 
503 .. kernel-doc:: drivers/gpu/drm/drm_debugfs_cr    281 .. kernel-doc:: drivers/gpu/drm/drm_debugfs_crc.c
504    :export:                                       282    :export:
505                                                   283 
506 Debugfs Support                                   284 Debugfs Support
507 ---------------                                   285 ---------------
508                                                   286 
509 .. kernel-doc:: include/drm/drm_debugfs.h         287 .. kernel-doc:: include/drm/drm_debugfs.h
510    :internal:                                     288    :internal:
511                                                   289 
512 .. kernel-doc:: drivers/gpu/drm/drm_debugfs.c     290 .. kernel-doc:: drivers/gpu/drm/drm_debugfs.c
513    :export:                                       291    :export:
514                                                   292 
515 Sysfs Support                                     293 Sysfs Support
516 =============                                     294 =============
517                                                   295 
518 .. kernel-doc:: drivers/gpu/drm/drm_sysfs.c       296 .. kernel-doc:: drivers/gpu/drm/drm_sysfs.c
519    :doc: overview                                 297    :doc: overview
520                                                   298 
521 .. kernel-doc:: drivers/gpu/drm/drm_sysfs.c       299 .. kernel-doc:: drivers/gpu/drm/drm_sysfs.c
522    :export:                                       300    :export:
523                                                   301 
524                                                   302 
525 VBlank event handling                             303 VBlank event handling
526 =====================                             304 =====================
527                                                   305 
528 The DRM core exposes two vertical blank relate    306 The DRM core exposes two vertical blank related ioctls:
529                                                   307 
530 :c:macro:`DRM_IOCTL_WAIT_VBLANK`               !! 308 DRM_IOCTL_WAIT_VBLANK
531     This takes a struct drm_wait_vblank struct    309     This takes a struct drm_wait_vblank structure as its argument, and
532     it is used to block or request a signal wh    310     it is used to block or request a signal when a specified vblank
533     event occurs.                                 311     event occurs.
534                                                   312 
535 :c:macro:`DRM_IOCTL_MODESET_CTL`               !! 313 DRM_IOCTL_MODESET_CTL
536     This was only used for user-mode-settind d    314     This was only used for user-mode-settind drivers around modesetting
537     changes to allow the kernel to update the     315     changes to allow the kernel to update the vblank interrupt after
538     mode setting, since on many devices the ve    316     mode setting, since on many devices the vertical blank counter is
539     reset to 0 at some point during modeset. M    317     reset to 0 at some point during modeset. Modern drivers should not
540     call this any more since with kernel mode     318     call this any more since with kernel mode setting it is a no-op.
541                                                << 
542 Userspace API Structures                       << 
543 ========================                       << 
544                                                << 
545 .. kernel-doc:: include/uapi/drm/drm_mode.h    << 
546    :doc: overview                              << 
547                                                << 
548 .. _crtc_index:                                << 
549                                                << 
550 CRTC index                                     << 
551 ----------                                     << 
552                                                << 
553 CRTC's have both an object ID and an index, an << 
554 The index is used in cases where a densely pac << 
555 needed, for instance a bitmask of CRTC's. The  << 
556 drm_mode_get_plane is an example.              << 
557                                                << 
558 :c:macro:`DRM_IOCTL_MODE_GETRESOURCES` populat << 
559 CRTC ID's, and the CRTC index is its position  << 
560                                                << 
561 .. kernel-doc:: include/uapi/drm/drm.h         << 
562    :internal:                                  << 
563                                                << 
564 .. kernel-doc:: include/uapi/drm/drm_mode.h    << 
565    :internal:                                  << 
566                                                << 
567                                                << 
568 dma-buf interoperability                       << 
569 ========================                       << 
570                                                << 
571 Please see Documentation/userspace-api/dma-buf << 
572 information on how dma-buf is integrated and e << 
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php