~ [ 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.10.17)


  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:                          << 
 27                                                << 
 28 Primary Nodes, DRM Master and Authentication       24 Primary Nodes, DRM Master and Authentication
 29 ============================================       25 ============================================
 30                                                    26 
 31 .. kernel-doc:: drivers/gpu/drm/drm_auth.c         27 .. kernel-doc:: drivers/gpu/drm/drm_auth.c
 32    :doc: master and authentication                 28    :doc: master and authentication
 33                                                    29 
 34 .. kernel-doc:: drivers/gpu/drm/drm_auth.c         30 .. kernel-doc:: drivers/gpu/drm/drm_auth.c
 35    :export:                                        31    :export:
 36                                                    32 
 37 .. kernel-doc:: include/drm/drm_auth.h             33 .. kernel-doc:: include/drm/drm_auth.h
 38    :internal:                                      34    :internal:
 39                                                    35 
 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                 36 Open-Source Userspace Requirements
 50 ==================================                 37 ==================================
 51                                                    38 
 52 The DRM subsystem has stricter requirements th     39 The DRM subsystem has stricter requirements than most other kernel subsystems on
 53 what the userspace side for new uAPI needs to      40 what the userspace side for new uAPI needs to look like. This section here
 54 explains what exactly those requirements are,      41 explains what exactly those requirements are, and why they exist.
 55                                                    42 
 56 The short summary is that any addition of DRM      43 The short summary is that any addition of DRM uAPI requires corresponding
 57 open-sourced userspace patches, and those patc     44 open-sourced userspace patches, and those patches must be reviewed and ready for
 58 merging into a suitable and canonical upstream     45 merging into a suitable and canonical upstream project.
 59                                                    46 
 60 GFX devices (both display and render/GPU side)     47 GFX devices (both display and render/GPU side) are really complex bits of
 61 hardware, with userspace and kernel by necessi     48 hardware, with userspace and kernel by necessity having to work together really
 62 closely.  The interfaces, for rendering and mo     49 closely.  The interfaces, for rendering and modesetting, must be extremely wide
 63 and flexible, and therefore it is almost alway     50 and flexible, and therefore it is almost always impossible to precisely define
 64 them for every possible corner case. This in t     51 them for every possible corner case. This in turn makes it really practically
 65 infeasible to differentiate between behaviour      52 infeasible to differentiate between behaviour that's required by userspace, and
 66 which must not be changed to avoid regressions     53 which must not be changed to avoid regressions, and behaviour which is only an
 67 accidental artifact of the current implementat     54 accidental artifact of the current implementation.
 68                                                    55 
 69 Without access to the full source code of all      56 Without access to the full source code of all userspace users that means it
 70 becomes impossible to change the implementatio     57 becomes impossible to change the implementation details, since userspace could
 71 depend upon the accidental behaviour of the cu     58 depend upon the accidental behaviour of the current implementation in minute
 72 details. And debugging such regressions withou     59 details. And debugging such regressions without access to source code is pretty
 73 much impossible. As a consequence this means:      60 much impossible. As a consequence this means:
 74                                                    61 
 75 - The Linux kernel's "no regression" policy ho     62 - The Linux kernel's "no regression" policy holds in practice only for
 76   open-source userspace of the DRM subsystem.      63   open-source userspace of the DRM subsystem. DRM developers are perfectly fine
 77   if closed-source blob drivers in userspace u     64   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     65   drivers, but they must do so in the exact same way as the open drivers.
 79   Creative (ab)use of the interfaces will, and     66   Creative (ab)use of the interfaces will, and in the past routinely has, lead
 80   to breakage.                                     67   to breakage.
 81                                                    68 
 82 - Any new userspace interface must have an ope     69 - Any new userspace interface must have an open-source implementation as
 83   demonstration vehicle.                           70   demonstration vehicle.
 84                                                    71 
 85 The other reason for requiring open-source use     72 The other reason for requiring open-source userspace is uAPI review. Since the
 86 kernel and userspace parts of a GFX stack must     73 kernel and userspace parts of a GFX stack must work together so closely, code
 87 review can only assess whether a new interface     74 review can only assess whether a new interface achieves its goals by looking at
 88 both sides. Making sure that the interface ind     75 both sides. Making sure that the interface indeed covers the use-case fully
 89 leads to a few additional requirements:            76 leads to a few additional requirements:
 90                                                    77 
 91 - The open-source userspace must not be a toy/     78 - The open-source userspace must not be a toy/test application, but the real
 92   thing. Specifically it needs to handle all t     79   thing. Specifically it needs to handle all the usual error and corner cases.
 93   These are often the places where new uAPI fa     80   These are often the places where new uAPI falls apart and hence essential to
 94   assess the fitness of a proposed interface.      81   assess the fitness of a proposed interface.
 95                                                    82 
 96 - The userspace side must be fully reviewed an     83 - The userspace side must be fully reviewed and tested to the standards of that
 97   userspace project. For e.g. mesa this means      84   userspace project. For e.g. mesa this means piglit testcases and review on the
 98   mailing list. This is again to ensure that t     85   mailing list. This is again to ensure that the new interface actually gets the
 99   job done.  The userspace-side reviewer shoul !!  86   job done.
100   kernel uAPI patch indicating that they belie << 
101   sufficiently documented and validated for us << 
102                                                    87 
103 - The userspace patches must be against the ca     88 - The userspace patches must be against the canonical upstream, not some vendor
104   fork. This is to make sure that no one cheat     89   fork. This is to make sure that no one cheats on the review and testing
105   requirements by doing a quick fork.              90   requirements by doing a quick fork.
106                                                    91 
107 - The kernel patch can only be merged after al     92 - The kernel patch can only be merged after all the above requirements are met,
108   but it **must** be merged to either drm-next !!  93   but it **must** be merged **before** the userspace patches land. uAPI always flows
109   userspace patches land. uAPI always flows fr !!  94   from the kernel, doing things the other way round risks divergence of the uAPI
110   other way round risks divergence of the uAPI !!  95   definitions and header files.
111                                                    96 
112 These are fairly steep requirements, but have      97 These are fairly steep requirements, but have grown out from years of shared
113 pain and experience with uAPI added hastily, a     98 pain and experience with uAPI added hastily, and almost always regretted about
114 just as fast. GFX devices change really fast,      99 just as fast. GFX devices change really fast, requiring a paradigm shift and
115 entire new set of uAPI interfaces every few ye    100 entire new set of uAPI interfaces every few years at least. Together with the
116 Linux kernel's guarantee to keep existing user    101 Linux kernel's guarantee to keep existing userspace running for 10+ years this
117 is already rather painful for the DRM subsyste    102 is already rather painful for the DRM subsystem, with multiple different uAPIs
118 for the same thing co-existing. If we add a fe    103 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    104 mix every year it would be entirely unmanageable.
120                                                   105 
121 .. _drm_render_node:                           << 
122                                                << 
123 Render nodes                                      106 Render nodes
124 ============                                      107 ============
125                                                   108 
126 DRM core provides multiple character-devices f    109 DRM core provides multiple character-devices for user-space to use.
127 Depending on which device is opened, user-spac    110 Depending on which device is opened, user-space can perform a different
128 set of operations (mainly ioctls). The primary    111 set of operations (mainly ioctls). The primary node is always created
129 and called card<num>. Additionally, a currentl    112 and called card<num>. Additionally, a currently unused control node,
130 called controlD<num> is also created. The prim    113 called controlD<num> is also created. The primary node provides all
131 legacy operations and historically was the onl    114 legacy operations and historically was the only interface used by
132 userspace. With KMS, the control node was intr    115 userspace. With KMS, the control node was introduced. However, the
133 planned KMS control interface has never been w    116 planned KMS control interface has never been written and so the control
134 node stays unused to date.                        117 node stays unused to date.
135                                                   118 
136 With the increased use of offscreen renderers     119 With the increased use of offscreen renderers and GPGPU applications,
137 clients no longer require running compositors     120 clients no longer require running compositors or graphics servers to
138 make use of a GPU. But the DRM API required un    121 make use of a GPU. But the DRM API required unprivileged clients to
139 authenticate to a DRM-Master prior to getting     122 authenticate to a DRM-Master prior to getting GPU access. To avoid this
140 step and to grant clients GPU access without a    123 step and to grant clients GPU access without authenticating, render
141 nodes were introduced. Render nodes solely ser    124 nodes were introduced. Render nodes solely serve render clients, that
142 is, no modesetting or privileged ioctls can be    125 is, no modesetting or privileged ioctls can be issued on render nodes.
143 Only non-global rendering commands are allowed    126 Only non-global rendering commands are allowed. If a driver supports
144 render nodes, it must advertise it via the DRI    127 render nodes, it must advertise it via the DRIVER_RENDER DRM driver
145 capability. If not supported, the primary node    128 capability. If not supported, the primary node must be used for render
146 clients together with the legacy drmAuth authe    129 clients together with the legacy drmAuth authentication procedure.
147                                                   130 
148 If a driver advertises render node support, DR    131 If a driver advertises render node support, DRM core will create a
149 separate render node called renderD<num>. Ther    132 separate render node called renderD<num>. There will be one render node
150 per device. No ioctls except PRIME-related ioc    133 per device. No ioctls except PRIME-related ioctls will be allowed on
151 this node. Especially GEM_OPEN will be explici !! 134 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,     135 nodes are designed to avoid the buffer-leaks, which occur if clients
155 guess the flink names or mmap offsets on the l    136 guess the flink names or mmap offsets on the legacy interface.
156 Additionally to this basic interface, drivers     137 Additionally to this basic interface, drivers must mark their
157 driver-dependent render-only ioctls as DRM_REN    138 driver-dependent render-only ioctls as DRM_RENDER_ALLOW so render
158 clients can use them. Driver authors must be c    139 clients can use them. Driver authors must be careful not to allow any
159 privileged ioctls on render nodes.                140 privileged ioctls on render nodes.
160                                                   141 
161 With render nodes, user-space can now control     142 With render nodes, user-space can now control access to the render node
162 via basic file-system access-modes. A running     143 via basic file-system access-modes. A running graphics server which
163 authenticates clients on the privileged primar    144 authenticates clients on the privileged primary/legacy node is no longer
164 required. Instead, a client can open the rende    145 required. Instead, a client can open the render node and is immediately
165 granted GPU access. Communication between clie    146 granted GPU access. Communication between clients (or servers) is done
166 via PRIME. FLINK from render node to legacy no    147 via PRIME. FLINK from render node to legacy node is not supported. New
167 clients must not use the insecure FLINK interf    148 clients must not use the insecure FLINK interface.
168                                                   149 
169 Besides dropping all modeset/global ioctls, re    150 Besides dropping all modeset/global ioctls, render nodes also drop the
170 DRM-Master concept. There is no reason to asso    151 DRM-Master concept. There is no reason to associate render clients with
171 a DRM-Master as they are independent of any gr    152 a DRM-Master as they are independent of any graphics server. Besides,
172 they must work without any running master, any    153 they must work without any running master, anyway. Drivers must be able
173 to run without a master object if they support    154 to run without a master object if they support render nodes. If, on the
174 other hand, a driver requires shared state bet    155 other hand, a driver requires shared state between clients which is
175 visible to user-space and accessible beyond op    156 visible to user-space and accessible beyond open-file boundaries, they
176 cannot support render nodes.                      157 cannot support render nodes.
177                                                   158 
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:                          << 
366                                                << 
367 IOCTL Support on Device Nodes                  << 
368 =============================                  << 
369                                                << 
370 .. kernel-doc:: drivers/gpu/drm/drm_ioctl.c    << 
371    :doc: driver specific ioctls                << 
372                                                << 
373 Recommended IOCTL Return Values                << 
374 -------------------------------                << 
375                                                << 
376 In theory a driver's IOCTL callback is only al << 
377 codes. In practice it's good to abuse a few mo << 
378 practice within the DRM subsystem:             << 
379                                                << 
380 ENOENT:                                        << 
381         Strictly this should only be used when << 
382         calling the open() syscall. We reuse t << 
383         lookup failure, e.g. for unknown GEM b << 
384         object handles and similar cases.      << 
385                                                << 
386 ENOSPC:                                        << 
387         Some drivers use this to differentiate << 
388         of VRAM". Sometimes also applies to ot << 
389         rendering (e.g. when you have a specia << 
390         Sometimes resource allocation/reservat << 
391         IOCTLs are also signalled through EDEA << 
392                                                << 
393         Simply running out of kernel/system me << 
394                                                << 
395 EPERM/EACCES:                                  << 
396         Returned for an operation that is vali << 
397         E.g. root-only or much more common, DR << 
398         this when called by unpriviledged clie << 
399         difference between EACCES and EPERM.   << 
400                                                << 
401 ENODEV:                                        << 
402         The device is not present anymore or i << 
403                                                << 
404 EOPNOTSUPP:                                    << 
405         Feature (like PRIME, modesetting, GEM) << 
406                                                << 
407 ENXIO:                                         << 
408         Remote failure, either a hardware tran << 
409         when the exporting driver of a shared  << 
410         feature needed.                        << 
411                                                << 
412 EINTR:                                         << 
413         DRM drivers assume that userspace rest << 
414         return EINTR and in such a case should << 
415         parameters left unchanged.             << 
416                                                << 
417 EIO:                                           << 
418         The GPU died and couldn't be resurrect << 
419         hardware failures are signalled throug << 
420         property.                              << 
421                                                << 
422 EINVAL:                                        << 
423         Catch-all for anything that is an inva << 
424         cannot work.                           << 
425                                                << 
426 IOCTL also use other error codes like ETIME, E << 
427 usage is in line with the common meanings. The << 
428 DRM specific patterns. Note that ENOTTY has th << 
429 "this IOCTL does not exist", and is used exact << 
430                                                << 
431 .. kernel-doc:: include/drm/drm_ioctl.h        << 
432    :internal:                                  << 
433                                                << 
434 .. kernel-doc:: drivers/gpu/drm/drm_ioctl.c    << 
435    :export:                                    << 
436                                                << 
437 .. kernel-doc:: drivers/gpu/drm/drm_ioc32.c    << 
438    :export:                                    << 
439                                                << 
440 Testing and validation                         << 
441 ======================                         << 
442                                                << 
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                       159 Validating changes with IGT
452 ---------------------------                    !! 160 ===========================
453                                                   161 
454 There's a collection of tests that aims to cov    162 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    163 DRM drivers and that can be used to check that changes to DRM drivers or the
456 core don't regress existing functionality. Thi    164 core don't regress existing functionality. This test suite is called IGT and
457 its code and instructions to build and run can !! 165 its code can be found in https://cgit.freedesktop.org/drm/igt-gpu-tools/.
458 https://gitlab.freedesktop.org/drm/igt-gpu-too << 
459                                                << 
460 Using VKMS to test DRM API                     << 
461 --------------------------                     << 
462                                                << 
463 VKMS is a software-only model of a KMS driver  << 
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                                                << 
471 To Validate changes in DRM API with VKMS, star << 
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                                                   166 
477 It's possible to run the IGT-tests in a VM in  !! 167 To build IGT, start by installing its build dependencies. In Debian-based
                                                   >> 168 systems::
478                                                   169 
479         1. Use IGT inside a VM                 !! 170         # apt-get build-dep intel-gpu-tools
480         2. Use IGT from the host machine and w << 
481                                                   171 
482 Following is an example of using a VM with a s !! 172 And in Fedora-based systems::
483 the host machine to run igt-tests. This exampl << 
484                                                   173 
485         $ virtme-run --rwdir /path/for/shared_ !! 174         # dnf builddep intel-gpu-tools
486                                                   175 
487 Run the igt-tests in the guest machine. This e !! 176 Then clone the repository::
488 tests::                                        << 
489                                                   177 
490         $ /path/for/igt-gpu-tools/scripts/run- !! 178         $ git clone git://anongit.freedesktop.org/drm/igt-gpu-tools
491                                                   179 
492 In this example, instead of building the igt_r !! 180 Configure the build system and start the build::
493 (-p option). It creates an HTML summary of the << 
494 them in the folder "igt-gpu-tools/results". It << 
495 matching the -t option.                        << 
496                                                   181 
497 Display CRC Support                            !! 182         $ cd igt-gpu-tools && ./autogen.sh && make -j6
498 -------------------                            << 
499                                                   183 
500 .. kernel-doc:: drivers/gpu/drm/drm_debugfs_cr !! 184 Download the piglit dependency::
501    :doc: CRC ABI                               << 
502                                                   185 
503 .. kernel-doc:: drivers/gpu/drm/drm_debugfs_cr !! 186         $ ./scripts/run-tests.sh -d
504    :export:                                    << 
505                                                   187 
506 Debugfs Support                                !! 188 And run the tests::
507 ---------------                                << 
508                                                   189 
509 .. kernel-doc:: include/drm/drm_debugfs.h      !! 190         $ ./scripts/run-tests.sh -t kms -t core -s
510    :internal:                                  << 
511                                                << 
512 .. kernel-doc:: drivers/gpu/drm/drm_debugfs.c  << 
513    :export:                                    << 
514                                                << 
515 Sysfs Support                                  << 
516 =============                                  << 
517                                                << 
518 .. kernel-doc:: drivers/gpu/drm/drm_sysfs.c    << 
519    :doc: overview                              << 
520                                                << 
521 .. kernel-doc:: drivers/gpu/drm/drm_sysfs.c    << 
522    :export:                                    << 
523                                                   191 
                                                   >> 192 run-tests.sh is a wrapper around piglit that will execute the tests matching
                                                   >> 193 the -t options. A report in HTML format will be available in
                                                   >> 194 ./results/html/index.html. Results can be compared with piglit.
524                                                   195 
525 VBlank event handling                             196 VBlank event handling
526 =====================                             197 =====================
527                                                   198 
528 The DRM core exposes two vertical blank relate    199 The DRM core exposes two vertical blank related ioctls:
529                                                   200 
530 :c:macro:`DRM_IOCTL_WAIT_VBLANK`               !! 201 DRM_IOCTL_WAIT_VBLANK
531     This takes a struct drm_wait_vblank struct    202     This takes a struct drm_wait_vblank structure as its argument, and
532     it is used to block or request a signal wh    203     it is used to block or request a signal when a specified vblank
533     event occurs.                                 204     event occurs.
534                                                   205 
535 :c:macro:`DRM_IOCTL_MODESET_CTL`               !! 206 DRM_IOCTL_MODESET_CTL
536     This was only used for user-mode-settind d    207     This was only used for user-mode-settind drivers around modesetting
537     changes to allow the kernel to update the     208     changes to allow the kernel to update the vblank interrupt after
538     mode setting, since on many devices the ve    209     mode setting, since on many devices the vertical blank counter is
539     reset to 0 at some point during modeset. M    210     reset to 0 at some point during modeset. Modern drivers should not
540     call this any more since with kernel mode     211     call this any more since with kernel mode setting it is a no-op.
541                                                   212 
542 Userspace API Structures                       !! 213 This second part of the GPU Driver Developer's Guide documents driver
543 ========================                       !! 214 code, implementation details and also all the driver-specific userspace
                                                   >> 215 interfaces. Especially since all hardware-acceleration interfaces to
                                                   >> 216 userspace are driver specific for efficiency and other reasons these
                                                   >> 217 interfaces can be rather substantial. Hence every driver has its own
                                                   >> 218 chapter.
544                                                   219 
545 .. kernel-doc:: include/uapi/drm/drm_mode.h    !! 220 Testing and validation
546    :doc: overview                              !! 221 ======================
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                                                   222 
571 Please see Documentation/userspace-api/dma-buf !! 223 .. kernel-doc:: drivers/gpu/drm/drm_debugfs_crc.c
572 information on how dma-buf is integrated and e !! 224    :doc: CRC ABI
                                                      

~ [ 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