Commit c8c27c955ac633c0d783ec65f65176c82809f04d
Exists in
master
and in
6 other branches
Merge branch 'docs-move' of git://git.kernel.org/pub/scm/linux/kernel/git/rdunlap/linux-docs
* 'docs-move' of git://git.kernel.org/pub/scm/linux/kernel/git/rdunlap/linux-docs: (45 commits) DocBook/drm: Clean up a todo-note DocBook/drm: `device aware' -> `device-aware' DocBook/drm: `(device|driver) specific' -> `(device|driver)-specific' DocBook/drm: Clean up the paragraph on framebuffer objects DocBook/drm: Use `; otherwise,' DocBook/drm: Better flow with `, and then' DocBook/drm: Refer to the domain-setting function as a device-specific ioctl DocBook/drm: Improve flow of GPU/CPU coherence sentence DocBook/drm: Use an <itemizelist> for fundamental GEM operations DocBook/drm: Insert a comma DocBook/drm: Use a <variablelist> for vblank ioctls DocBook/drm: Use an itemizedlist for what an encoder needs to provide DocBook/drm: Insert `the' for readability, and change `set' to `setting' DocBook/drm: Remove extraneous commas DocBook/drm: Use a colon DocBook/drm: Clarify `final initialization' via better formatting DocBook/drm: Remove redundancy DocBook/drm: Insert `it' for smooth reading DocBook/drm: The word `so-called'; I do not think it connotes what you think it connotes DocBook/drm: Use a singular subject for grammatical cleanliness ...
Showing 2 changed files Side-by-side Diff
Documentation/DocBook/drm.tmpl
... | ... | @@ -32,7 +32,7 @@ |
32 | 32 | The Linux DRM layer contains code intended to support the needs |
33 | 33 | of complex graphics devices, usually containing programmable |
34 | 34 | pipelines well suited to 3D graphics acceleration. Graphics |
35 | - drivers in the kernel can make use of DRM functions to make | |
35 | + drivers in the kernel may make use of DRM functions to make | |
36 | 36 | tasks like memory management, interrupt handling and DMA easier, |
37 | 37 | and provide a uniform interface to applications. |
38 | 38 | </para> |
39 | 39 | |
... | ... | @@ -57,10 +57,10 @@ |
57 | 57 | existing drivers. |
58 | 58 | </para> |
59 | 59 | <para> |
60 | - First, we'll go over some typical driver initialization | |
60 | + First, we go over some typical driver initialization | |
61 | 61 | requirements, like setting up command buffers, creating an |
62 | 62 | initial output configuration, and initializing core services. |
63 | - Subsequent sections will cover core internals in more detail, | |
63 | + Subsequent sections cover core internals in more detail, | |
64 | 64 | providing implementation notes and examples. |
65 | 65 | </para> |
66 | 66 | <para> |
... | ... | @@ -74,7 +74,7 @@ |
74 | 74 | </para> |
75 | 75 | <para> |
76 | 76 | The core of every DRM driver is struct drm_driver. Drivers |
77 | - will typically statically initialize a drm_driver structure, | |
77 | + typically statically initialize a drm_driver structure, | |
78 | 78 | then pass it to drm_init() at load time. |
79 | 79 | </para> |
80 | 80 | |
... | ... | @@ -88,8 +88,8 @@ |
88 | 88 | </para> |
89 | 89 | <programlisting> |
90 | 90 | static struct drm_driver driver = { |
91 | - /* don't use mtrr's here, the Xserver or user space app should | |
92 | - * deal with them for intel hardware. | |
91 | + /* Don't use MTRRs here; the Xserver or userspace app should | |
92 | + * deal with them for Intel hardware. | |
93 | 93 | */ |
94 | 94 | .driver_features = |
95 | 95 | DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | |
... | ... | @@ -154,8 +154,8 @@ |
154 | 154 | </programlisting> |
155 | 155 | <para> |
156 | 156 | In the example above, taken from the i915 DRM driver, the driver |
157 | - sets several flags indicating what core features it supports. | |
158 | - We'll go over the individual callbacks in later sections. Since | |
157 | + sets several flags indicating what core features it supports; | |
158 | + we go over the individual callbacks in later sections. Since | |
159 | 159 | flags indicate which features your driver supports to the DRM |
160 | 160 | core, you need to set most of them prior to calling drm_init(). Some, |
161 | 161 | like DRIVER_MODESET can be set later based on user supplied parameters, |
... | ... | @@ -203,8 +203,8 @@ |
203 | 203 | <term>DRIVER_HAVE_IRQ</term><term>DRIVER_IRQ_SHARED</term> |
204 | 204 | <listitem> |
205 | 205 | <para> |
206 | - DRIVER_HAVE_IRQ indicates whether the driver has a IRQ | |
207 | - handler, DRIVER_IRQ_SHARED indicates whether the device & | |
206 | + DRIVER_HAVE_IRQ indicates whether the driver has an IRQ | |
207 | + handler. DRIVER_IRQ_SHARED indicates whether the device & | |
208 | 208 | handler support shared IRQs (note that this is required of |
209 | 209 | PCI drivers). |
210 | 210 | </para> |
... | ... | @@ -214,8 +214,8 @@ |
214 | 214 | <term>DRIVER_DMA_QUEUE</term> |
215 | 215 | <listitem> |
216 | 216 | <para> |
217 | - If the driver queues DMA requests and completes them | |
218 | - asynchronously, this flag should be set. Deprecated. | |
217 | + Should be set if the driver queues DMA requests and completes them | |
218 | + asynchronously. Deprecated. | |
219 | 219 | </para> |
220 | 220 | </listitem> |
221 | 221 | </varlistentry> |
... | ... | @@ -238,7 +238,7 @@ |
238 | 238 | </variablelist> |
239 | 239 | <para> |
240 | 240 | In this specific case, the driver requires AGP and supports |
241 | - IRQs. DMA, as we'll see, is handled by device specific ioctls | |
241 | + IRQs. DMA, as discussed later, is handled by device-specific ioctls | |
242 | 242 | in this case. It also supports the kernel mode setting APIs, though |
243 | 243 | unlike in the actual i915 driver source, this example unconditionally |
244 | 244 | exports KMS capability. |
245 | 245 | |
246 | 246 | |
247 | 247 | |
248 | 248 | |
249 | 249 | |
250 | 250 | |
... | ... | @@ -269,36 +269,34 @@ |
269 | 269 | initial output configuration. |
270 | 270 | </para> |
271 | 271 | <para> |
272 | - Note that the tasks performed at driver load time must not | |
273 | - conflict with DRM client requirements. For instance, if user | |
272 | + If compatibility is a concern (e.g. with drivers converted over | |
273 | + to the new interfaces from the old ones), care must be taken to | |
274 | + prevent device initialization and control that is incompatible with | |
275 | + currently active userspace drivers. For instance, if user | |
274 | 276 | level mode setting drivers are in use, it would be problematic |
275 | 277 | to perform output discovery & configuration at load time. |
276 | - Likewise, if pre-memory management aware user level drivers are | |
278 | + Likewise, if user-level drivers unaware of memory management are | |
277 | 279 | in use, memory management and command buffer setup may need to |
278 | - be omitted. These requirements are driver specific, and care | |
280 | + be omitted. These requirements are driver-specific, and care | |
279 | 281 | needs to be taken to keep both old and new applications and |
280 | 282 | libraries working. The i915 driver supports the "modeset" |
281 | 283 | module parameter to control whether advanced features are |
282 | - enabled at load time or in legacy fashion. If compatibility is | |
283 | - a concern (e.g. with drivers converted over to the new interfaces | |
284 | - from the old ones), care must be taken to prevent incompatible | |
285 | - device initialization and control with the currently active | |
286 | - userspace drivers. | |
284 | + enabled at load time or in legacy fashion. | |
287 | 285 | </para> |
288 | 286 | |
289 | 287 | <sect2> |
290 | 288 | <title>Driver private & performance counters</title> |
291 | 289 | <para> |
292 | 290 | The driver private hangs off the main drm_device structure and |
293 | - can be used for tracking various device specific bits of | |
291 | + can be used for tracking various device-specific bits of | |
294 | 292 | information, like register offsets, command buffer status, |
295 | 293 | register state for suspend/resume, etc. At load time, a |
296 | - driver can simply allocate one and set drm_device.dev_priv | |
297 | - appropriately; at unload the driver can free it and set | |
298 | - drm_device.dev_priv to NULL. | |
294 | + driver may simply allocate one and set drm_device.dev_priv | |
295 | + appropriately; it should be freed and drm_device.dev_priv set | |
296 | + to NULL when the driver is unloaded. | |
299 | 297 | </para> |
300 | 298 | <para> |
301 | - The DRM supports several counters which can be used for rough | |
299 | + The DRM supports several counters which may be used for rough | |
302 | 300 | performance characterization. Note that the DRM stat counter |
303 | 301 | system is not often used by applications, and supporting |
304 | 302 | additional counters is completely optional. |
305 | 303 | |
... | ... | @@ -307,15 +305,15 @@ |
307 | 305 | These interfaces are deprecated and should not be used. If performance |
308 | 306 | monitoring is desired, the developer should investigate and |
309 | 307 | potentially enhance the kernel perf and tracing infrastructure to export |
310 | - GPU related performance information to performance monitoring | |
311 | - tools and applications. | |
308 | + GPU related performance information for consumption by performance | |
309 | + monitoring tools and applications. | |
312 | 310 | </para> |
313 | 311 | </sect2> |
314 | 312 | |
315 | 313 | <sect2> |
316 | 314 | <title>Configuring the device</title> |
317 | 315 | <para> |
318 | - Obviously, device configuration will be device specific. | |
316 | + Obviously, device configuration is device-specific. | |
319 | 317 | However, there are several common operations: finding a |
320 | 318 | device's PCI resources, mapping them, and potentially setting |
321 | 319 | up an IRQ handler. |
322 | 320 | |
... | ... | @@ -323,10 +321,10 @@ |
323 | 321 | <para> |
324 | 322 | Finding & mapping resources is fairly straightforward. The |
325 | 323 | DRM wrapper functions, drm_get_resource_start() and |
326 | - drm_get_resource_len() can be used to find BARs on the given | |
324 | + drm_get_resource_len(), may be used to find BARs on the given | |
327 | 325 | drm_device struct. Once those values have been retrieved, the |
328 | 326 | driver load function can call drm_addmap() to create a new |
329 | - mapping for the BAR in question. Note you'll probably want a | |
327 | + mapping for the BAR in question. Note that you probably want a | |
330 | 328 | drm_local_map_t in your driver private structure to track any |
331 | 329 | mappings you create. |
332 | 330 | <!-- !Fdrivers/gpu/drm/drm_bufs.c drm_get_resource_* --> |
333 | 331 | |
334 | 332 | |
335 | 333 | |
... | ... | @@ -335,20 +333,20 @@ |
335 | 333 | <para> |
336 | 334 | if compatibility with other operating systems isn't a concern |
337 | 335 | (DRM drivers can run under various BSD variants and OpenSolaris), |
338 | - native Linux calls can be used for the above, e.g. pci_resource_* | |
336 | + native Linux calls may be used for the above, e.g. pci_resource_* | |
339 | 337 | and iomap*/iounmap. See the Linux device driver book for more |
340 | 338 | info. |
341 | 339 | </para> |
342 | 340 | <para> |
343 | - Once you have a register map, you can use the DRM_READn() and | |
341 | + Once you have a register map, you may use the DRM_READn() and | |
344 | 342 | DRM_WRITEn() macros to access the registers on your device, or |
345 | - use driver specific versions to offset into your MMIO space | |
346 | - relative to a driver specific base pointer (see I915_READ for | |
347 | - example). | |
343 | + use driver-specific versions to offset into your MMIO space | |
344 | + relative to a driver-specific base pointer (see I915_READ for | |
345 | + an example). | |
348 | 346 | </para> |
349 | 347 | <para> |
350 | 348 | If your device supports interrupt generation, you may want to |
351 | - setup an interrupt handler at driver load time as well. This | |
349 | + set up an interrupt handler when the driver is loaded. This | |
352 | 350 | is done using the drm_irq_install() function. If your device |
353 | 351 | supports vertical blank interrupts, it should call |
354 | 352 | drm_vblank_init() to initialize the core vblank handling code before |
... | ... | @@ -357,7 +355,7 @@ |
357 | 355 | </para> |
358 | 356 | <!--!Fdrivers/char/drm/drm_irq.c drm_irq_install--> |
359 | 357 | <para> |
360 | - Once your interrupt handler is registered (it'll use your | |
358 | + Once your interrupt handler is registered (it uses your | |
361 | 359 | drm_driver.irq_handler as the actual interrupt handling |
362 | 360 | function), you can safely enable interrupts on your device, |
363 | 361 | assuming any other state your interrupt handler uses is also |
... | ... | @@ -371,10 +369,10 @@ |
371 | 369 | using the pci_map_rom() call, a convenience function that |
372 | 370 | takes care of mapping the actual ROM, whether it has been |
373 | 371 | shadowed into memory (typically at address 0xc0000) or exists |
374 | - on the PCI device in the ROM BAR. Note that once you've | |
375 | - mapped the ROM and extracted any necessary information, be | |
376 | - sure to unmap it; on many devices the ROM address decoder is | |
377 | - shared with other BARs, so leaving it mapped can cause | |
372 | + on the PCI device in the ROM BAR. Note that after the ROM | |
373 | + has been mapped and any necessary information has been extracted, | |
374 | + it should be unmapped; on many devices, the ROM address decoder is | |
375 | + shared with other BARs, so leaving it mapped could cause | |
378 | 376 | undesired behavior like hangs or memory corruption. |
379 | 377 | <!--!Fdrivers/pci/rom.c pci_map_rom--> |
380 | 378 | </para> |
381 | 379 | |
... | ... | @@ -389,9 +387,9 @@ |
389 | 387 | should support a memory manager. |
390 | 388 | </para> |
391 | 389 | <para> |
392 | - If your driver supports memory management (it should!), you'll | |
390 | + If your driver supports memory management (it should!), you | |
393 | 391 | need to set that up at load time as well. How you initialize |
394 | - it depends on which memory manager you're using, TTM or GEM. | |
392 | + it depends on which memory manager you're using: TTM or GEM. | |
395 | 393 | </para> |
396 | 394 | <sect3> |
397 | 395 | <title>TTM initialization</title> |
... | ... | @@ -401,7 +399,7 @@ |
401 | 399 | and devices with dedicated video RAM (VRAM), i.e. most discrete |
402 | 400 | graphics devices. If your device has dedicated RAM, supporting |
403 | 401 | TTM is desirable. TTM also integrates tightly with your |
404 | - driver specific buffer execution function. See the radeon | |
402 | + driver-specific buffer execution function. See the radeon | |
405 | 403 | driver for examples. |
406 | 404 | </para> |
407 | 405 | <para> |
408 | 406 | |
409 | 407 | |
... | ... | @@ -429,21 +427,21 @@ |
429 | 427 | created by the memory manager at runtime. Your global TTM should |
430 | 428 | have a type of TTM_GLOBAL_TTM_MEM. The size field for the global |
431 | 429 | object should be sizeof(struct ttm_mem_global), and the init and |
432 | - release hooks should point at your driver specific init and | |
433 | - release routines, which will probably eventually call | |
434 | - ttm_mem_global_init and ttm_mem_global_release respectively. | |
430 | + release hooks should point at your driver-specific init and | |
431 | + release routines, which probably eventually call | |
432 | + ttm_mem_global_init and ttm_mem_global_release, respectively. | |
435 | 433 | </para> |
436 | 434 | <para> |
437 | 435 | Once your global TTM accounting structure is set up and initialized |
438 | - (done by calling ttm_global_item_ref on the global object you | |
439 | - just created), you'll need to create a buffer object TTM to | |
436 | + by calling ttm_global_item_ref() on it, | |
437 | + you need to create a buffer object TTM to | |
440 | 438 | provide a pool for buffer object allocation by clients and the |
441 | 439 | kernel itself. The type of this object should be TTM_GLOBAL_TTM_BO, |
442 | 440 | and its size should be sizeof(struct ttm_bo_global). Again, |
443 | - driver specific init and release functions can be provided, | |
444 | - likely eventually calling ttm_bo_global_init and | |
445 | - ttm_bo_global_release, respectively. Also like the previous | |
446 | - object, ttm_global_item_ref is used to create an initial reference | |
441 | + driver-specific init and release functions may be provided, | |
442 | + likely eventually calling ttm_bo_global_init() and | |
443 | + ttm_bo_global_release(), respectively. Also, like the previous | |
444 | + object, ttm_global_item_ref() is used to create an initial reference | |
447 | 445 | count for the TTM, which will call your initialization function. |
448 | 446 | </para> |
449 | 447 | </sect3> |
450 | 448 | |
451 | 449 | |
452 | 450 | |
453 | 451 | |
454 | 452 | |
... | ... | @@ -453,27 +451,26 @@ |
453 | 451 | GEM is an alternative to TTM, designed specifically for UMA |
454 | 452 | devices. It has simpler initialization and execution requirements |
455 | 453 | than TTM, but has no VRAM management capability. Core GEM |
456 | - initialization is comprised of a basic drm_mm_init call to create | |
454 | + is initialized by calling drm_mm_init() to create | |
457 | 455 | a GTT DRM MM object, which provides an address space pool for |
458 | - object allocation. In a KMS configuration, the driver will | |
459 | - need to allocate and initialize a command ring buffer following | |
460 | - basic GEM initialization. Most UMA devices have a so-called | |
456 | + object allocation. In a KMS configuration, the driver | |
457 | + needs to allocate and initialize a command ring buffer following | |
458 | + core GEM initialization. A UMA device usually has what is called a | |
461 | 459 | "stolen" memory region, which provides space for the initial |
462 | 460 | framebuffer and large, contiguous memory regions required by the |
463 | - device. This space is not typically managed by GEM, and must | |
461 | + device. This space is not typically managed by GEM, and it must | |
464 | 462 | be initialized separately into its own DRM MM object. |
465 | 463 | </para> |
466 | 464 | <para> |
467 | - Initialization will be driver specific, and will depend on | |
468 | - the architecture of the device. In the case of Intel | |
465 | + Initialization is driver-specific. In the case of Intel | |
469 | 466 | integrated graphics chips like 965GM, GEM initialization can |
470 | 467 | be done by calling the internal GEM init function, |
471 | 468 | i915_gem_do_init(). Since the 965GM is a UMA device |
472 | - (i.e. it doesn't have dedicated VRAM), GEM will manage | |
469 | + (i.e. it doesn't have dedicated VRAM), GEM manages | |
473 | 470 | making regular RAM available for GPU operations. Memory set |
474 | 471 | aside by the BIOS (called "stolen" memory by the i915 |
475 | - driver) will be managed by the DRM memrange allocator; the | |
476 | - rest of the aperture will be managed by GEM. | |
472 | + driver) is managed by the DRM memrange allocator; the | |
473 | + rest of the aperture is managed by GEM. | |
477 | 474 | <programlisting> |
478 | 475 | /* Basic memrange allocator for stolen space (aka vram) */ |
479 | 476 | drm_memrange_init(&dev_priv->vram, 0, prealloc_size); |
... | ... | @@ -483,7 +480,7 @@ |
483 | 480 | <!--!Edrivers/char/drm/drm_memrange.c--> |
484 | 481 | </para> |
485 | 482 | <para> |
486 | - Once the memory manager has been set up, we can allocate the | |
483 | + Once the memory manager has been set up, we may allocate the | |
487 | 484 | command buffer. In the i915 case, this is also done with a |
488 | 485 | GEM function, i915_gem_init_ringbuffer(). |
489 | 486 | </para> |
490 | 487 | |
... | ... | @@ -493,16 +490,25 @@ |
493 | 490 | <sect2> |
494 | 491 | <title>Output configuration</title> |
495 | 492 | <para> |
496 | - The final initialization task is output configuration. This involves | |
497 | - finding and initializing the CRTCs, encoders and connectors | |
498 | - for your device, creating an initial configuration and | |
499 | - registering a framebuffer console driver. | |
493 | + The final initialization task is output configuration. This involves: | |
494 | + <itemizedlist> | |
495 | + <listitem> | |
496 | + Finding and initializing the CRTCs, encoders, and connectors | |
497 | + for the device. | |
498 | + </listitem> | |
499 | + <listitem> | |
500 | + Creating an initial configuration. | |
501 | + </listitem> | |
502 | + <listitem> | |
503 | + Registering a framebuffer console driver. | |
504 | + </listitem> | |
505 | + </itemizedlist> | |
500 | 506 | </para> |
501 | 507 | <sect3> |
502 | 508 | <title>Output discovery and initialization</title> |
503 | 509 | <para> |
504 | - Several core functions exist to create CRTCs, encoders and | |
505 | - connectors, namely drm_crtc_init(), drm_connector_init() and | |
510 | + Several core functions exist to create CRTCs, encoders, and | |
511 | + connectors, namely: drm_crtc_init(), drm_connector_init(), and | |
506 | 512 | drm_encoder_init(), along with several "helper" functions to |
507 | 513 | perform common tasks. |
508 | 514 | </para> |
509 | 515 | |
... | ... | @@ -555,10 +561,10 @@ |
555 | 561 | </programlisting> |
556 | 562 | <para> |
557 | 563 | In the example above (again, taken from the i915 driver), a |
558 | - CRT connector and encoder combination is created. A device | |
559 | - specific i2c bus is also created, for fetching EDID data and | |
564 | + CRT connector and encoder combination is created. A device-specific | |
565 | + i2c bus is also created for fetching EDID data and | |
560 | 566 | performing monitor detection. Once the process is complete, |
561 | - the new connector is registered with sysfs, to make its | |
567 | + the new connector is registered with sysfs to make its | |
562 | 568 | properties available to applications. |
563 | 569 | </para> |
564 | 570 | <sect4> |
565 | 571 | |
... | ... | @@ -567,12 +573,12 @@ |
567 | 573 | Since many PC-class graphics devices have similar display output |
568 | 574 | designs, the DRM provides a set of helper functions to make |
569 | 575 | output management easier. The core helper routines handle |
570 | - encoder re-routing and disabling of unused functions following | |
571 | - mode set. Using the helpers is optional, but recommended for | |
576 | + encoder re-routing and the disabling of unused functions following | |
577 | + mode setting. Using the helpers is optional, but recommended for | |
572 | 578 | devices with PC-style architectures (i.e. a set of display planes |
573 | 579 | for feeding pixels to encoders which are in turn routed to |
574 | 580 | connectors). Devices with more complex requirements needing |
575 | - finer grained management can opt to use the core callbacks | |
581 | + finer grained management may opt to use the core callbacks | |
576 | 582 | directly. |
577 | 583 | </para> |
578 | 584 | <para> |
... | ... | @@ -580,17 +586,25 @@ |
580 | 586 | </para> |
581 | 587 | </sect4> |
582 | 588 | <para> |
583 | - For each encoder, CRTC and connector, several functions must | |
584 | - be provided, depending on the object type. Encoder objects | |
585 | - need to provide a DPMS (basically on/off) function, mode fixup | |
586 | - (for converting requested modes into native hardware timings), | |
587 | - and prepare, set and commit functions for use by the core DRM | |
588 | - helper functions. Connector helpers need to provide mode fetch and | |
589 | - validity functions as well as an encoder matching function for | |
590 | - returning an ideal encoder for a given connector. The core | |
591 | - connector functions include a DPMS callback, (deprecated) | |
592 | - save/restore routines, detection, mode probing, property handling, | |
593 | - and cleanup functions. | |
589 | + Each encoder object needs to provide: | |
590 | + <itemizedlist> | |
591 | + <listitem> | |
592 | + A DPMS (basically on/off) function. | |
593 | + </listitem> | |
594 | + <listitem> | |
595 | + A mode-fixup function (for converting requested modes into | |
596 | + native hardware timings). | |
597 | + </listitem> | |
598 | + <listitem> | |
599 | + Functions (prepare, set, and commit) for use by the core DRM | |
600 | + helper functions. | |
601 | + </listitem> | |
602 | + </itemizedlist> | |
603 | + Connector helpers need to provide functions (mode-fetch, validity, | |
604 | + and encoder-matching) for returning an ideal encoder for a given | |
605 | + connector. The core connector functions include a DPMS callback, | |
606 | + save/restore routines (deprecated), detection, mode probing, | |
607 | + property handling, and cleanup functions. | |
594 | 608 | </para> |
595 | 609 | <!--!Edrivers/char/drm/drm_crtc.h--> |
596 | 610 | <!--!Edrivers/char/drm/drm_crtc.c--> |
597 | 611 | |
... | ... | @@ -605,23 +619,34 @@ |
605 | 619 | <title>VBlank event handling</title> |
606 | 620 | <para> |
607 | 621 | The DRM core exposes two vertical blank related ioctls: |
608 | - DRM_IOCTL_WAIT_VBLANK and DRM_IOCTL_MODESET_CTL. | |
622 | + <variablelist> | |
623 | + <varlistentry> | |
624 | + <term>DRM_IOCTL_WAIT_VBLANK</term> | |
625 | + <listitem> | |
626 | + <para> | |
627 | + This takes a struct drm_wait_vblank structure as its argument, | |
628 | + and it is used to block or request a signal when a specified | |
629 | + vblank event occurs. | |
630 | + </para> | |
631 | + </listitem> | |
632 | + </varlistentry> | |
633 | + <varlistentry> | |
634 | + <term>DRM_IOCTL_MODESET_CTL</term> | |
635 | + <listitem> | |
636 | + <para> | |
637 | + This should be called by application level drivers before and | |
638 | + after mode setting, since on many devices the vertical blank | |
639 | + counter is reset at that time. Internally, the DRM snapshots | |
640 | + the last vblank count when the ioctl is called with the | |
641 | + _DRM_PRE_MODESET command, so that the counter won't go backwards | |
642 | + (which is dealt with when _DRM_POST_MODESET is used). | |
643 | + </para> | |
644 | + </listitem> | |
645 | + </varlistentry> | |
646 | + </variablelist> | |
609 | 647 | <!--!Edrivers/char/drm/drm_irq.c--> |
610 | 648 | </para> |
611 | 649 | <para> |
612 | - DRM_IOCTL_WAIT_VBLANK takes a struct drm_wait_vblank structure | |
613 | - as its argument, and is used to block or request a signal when a | |
614 | - specified vblank event occurs. | |
615 | - </para> | |
616 | - <para> | |
617 | - DRM_IOCTL_MODESET_CTL should be called by application level | |
618 | - drivers before and after mode setting, since on many devices the | |
619 | - vertical blank counter will be reset at that time. Internally, | |
620 | - the DRM snapshots the last vblank count when the ioctl is called | |
621 | - with the _DRM_PRE_MODESET command so that the counter won't go | |
622 | - backwards (which is dealt with when _DRM_POST_MODESET is used). | |
623 | - </para> | |
624 | - <para> | |
625 | 650 | To support the functions above, the DRM core provides several |
626 | 651 | helper functions for tracking vertical blank counters, and |
627 | 652 | requires drivers to provide several callbacks: |
628 | 653 | |
629 | 654 | |
630 | 655 | |
... | ... | @@ -632,24 +657,24 @@ |
632 | 657 | register. The enable and disable vblank callbacks should enable |
633 | 658 | and disable vertical blank interrupts, respectively. In the |
634 | 659 | absence of DRM clients waiting on vblank events, the core DRM |
635 | - code will use the disable_vblank() function to disable | |
636 | - interrupts, which saves power. They'll be re-enabled again when | |
660 | + code uses the disable_vblank() function to disable | |
661 | + interrupts, which saves power. They are re-enabled again when | |
637 | 662 | a client calls the vblank wait ioctl above. |
638 | 663 | </para> |
639 | 664 | <para> |
640 | - Devices that don't provide a count register can simply use an | |
665 | + A device that doesn't provide a count register may simply use an | |
641 | 666 | internal atomic counter incremented on every vertical blank |
642 | - interrupt, and can make their enable and disable vblank | |
643 | - functions into no-ops. | |
667 | + interrupt (and then treat the enable_vblank() and disable_vblank() | |
668 | + callbacks as no-ops). | |
644 | 669 | </para> |
645 | 670 | </sect1> |
646 | 671 | |
647 | 672 | <sect1> |
648 | 673 | <title>Memory management</title> |
649 | 674 | <para> |
650 | - The memory manager lies at the heart of many DRM operations, and | |
651 | - is also required to support advanced client features like OpenGL | |
652 | - pbuffers. The DRM currently contains two memory managers, TTM | |
675 | + The memory manager lies at the heart of many DRM operations; it | |
676 | + is required to support advanced client features like OpenGL | |
677 | + pbuffers. The DRM currently contains two memory managers: TTM | |
653 | 678 | and GEM. |
654 | 679 | </para> |
655 | 680 | |
656 | 681 | |
657 | 682 | |
658 | 683 | |
659 | 684 | |
660 | 685 | |
661 | 686 | |
... | ... | @@ -679,41 +704,46 @@ |
679 | 704 | <para> |
680 | 705 | GEM-enabled drivers must provide gem_init_object() and |
681 | 706 | gem_free_object() callbacks to support the core memory |
682 | - allocation routines. They should also provide several driver | |
683 | - specific ioctls to support command execution, pinning, buffer | |
707 | + allocation routines. They should also provide several driver-specific | |
708 | + ioctls to support command execution, pinning, buffer | |
684 | 709 | read & write, mapping, and domain ownership transfers. |
685 | 710 | </para> |
686 | 711 | <para> |
687 | - On a fundamental level, GEM involves several operations: memory | |
688 | - allocation and freeing, command execution, and aperture management | |
689 | - at command execution time. Buffer object allocation is relatively | |
712 | + On a fundamental level, GEM involves several operations: | |
713 | + <itemizedlist> | |
714 | + <listitem>Memory allocation and freeing</listitem> | |
715 | + <listitem>Command execution</listitem> | |
716 | + <listitem>Aperture management at command execution time</listitem> | |
717 | + </itemizedlist> | |
718 | + Buffer object allocation is relatively | |
690 | 719 | straightforward and largely provided by Linux's shmem layer, which |
691 | 720 | provides memory to back each object. When mapped into the GTT |
692 | 721 | or used in a command buffer, the backing pages for an object are |
693 | 722 | flushed to memory and marked write combined so as to be coherent |
694 | - with the GPU. Likewise, when the GPU finishes rendering to an object, | |
695 | - if the CPU accesses it, it must be made coherent with the CPU's view | |
723 | + with the GPU. Likewise, if the CPU accesses an object after the GPU | |
724 | + has finished rendering to the object, then the object must be made | |
725 | + coherent with the CPU's view | |
696 | 726 | of memory, usually involving GPU cache flushing of various kinds. |
697 | - This core CPU<->GPU coherency management is provided by the GEM | |
698 | - set domain function, which evaluates an object's current domain and | |
727 | + This core CPU<->GPU coherency management is provided by a | |
728 | + device-specific ioctl, which evaluates an object's current domain and | |
699 | 729 | performs any necessary flushing or synchronization to put the object |
700 | 730 | into the desired coherency domain (note that the object may be busy, |
701 | - i.e. an active render target; in that case the set domain function | |
702 | - will block the client and wait for rendering to complete before | |
731 | + i.e. an active render target; in that case, setting the domain | |
732 | + blocks the client and waits for rendering to complete before | |
703 | 733 | performing any necessary flushing operations). |
704 | 734 | </para> |
705 | 735 | <para> |
706 | 736 | Perhaps the most important GEM function is providing a command |
707 | 737 | execution interface to clients. Client programs construct command |
708 | - buffers containing references to previously allocated memory objects | |
709 | - and submit them to GEM. At that point, GEM will take care to bind | |
738 | + buffers containing references to previously allocated memory objects, | |
739 | + and then submit them to GEM. At that point, GEM takes care to bind | |
710 | 740 | all the objects into the GTT, execute the buffer, and provide |
711 | 741 | necessary synchronization between clients accessing the same buffers. |
712 | 742 | This often involves evicting some objects from the GTT and re-binding |
713 | 743 | others (a fairly expensive operation), and providing relocation |
714 | 744 | support which hides fixed GTT offsets from clients. Clients must |
715 | 745 | take care not to submit command buffers that reference more objects |
716 | - than can fit in the GTT or GEM will reject them and no rendering | |
746 | + than can fit in the GTT; otherwise, GEM will reject them and no rendering | |
717 | 747 | will occur. Similarly, if several objects in the buffer require |
718 | 748 | fence registers to be allocated for correct rendering (e.g. 2D blits |
719 | 749 | on pre-965 chips), care must be taken not to require more fence |
... | ... | @@ -729,7 +759,7 @@ |
729 | 759 | <title>Output management</title> |
730 | 760 | <para> |
731 | 761 | At the core of the DRM output management code is a set of |
732 | - structures representing CRTCs, encoders and connectors. | |
762 | + structures representing CRTCs, encoders, and connectors. | |
733 | 763 | </para> |
734 | 764 | <para> |
735 | 765 | A CRTC is an abstraction representing a part of the chip that |
736 | 766 | |
... | ... | @@ -765,21 +795,19 @@ |
765 | 795 | <sect1> |
766 | 796 | <title>Framebuffer management</title> |
767 | 797 | <para> |
768 | - In order to set a mode on a given CRTC, encoder and connector | |
769 | - configuration, clients need to provide a framebuffer object which | |
770 | - will provide a source of pixels for the CRTC to deliver to the encoder(s) | |
771 | - and ultimately the connector(s) in the configuration. A framebuffer | |
772 | - is fundamentally a driver specific memory object, made into an opaque | |
773 | - handle by the DRM addfb function. Once an fb has been created this | |
774 | - way it can be passed to the KMS mode setting routines for use in | |
775 | - a configuration. | |
798 | + Clients need to provide a framebuffer object which provides a source | |
799 | + of pixels for a CRTC to deliver to the encoder(s) and ultimately the | |
800 | + connector(s). A framebuffer is fundamentally a driver-specific memory | |
801 | + object, made into an opaque handle by the DRM's addfb() function. | |
802 | + Once a framebuffer has been created this way, it may be passed to the | |
803 | + KMS mode setting routines for use in a completed configuration. | |
776 | 804 | </para> |
777 | 805 | </sect1> |
778 | 806 | |
779 | 807 | <sect1> |
780 | 808 | <title>Command submission & fencing</title> |
781 | 809 | <para> |
782 | - This should cover a few device specific command submission | |
810 | + This should cover a few device-specific command submission | |
783 | 811 | implementations. |
784 | 812 | </para> |
785 | 813 | </sect1> |
... | ... | @@ -789,7 +817,7 @@ |
789 | 817 | <para> |
790 | 818 | The DRM core provides some suspend/resume code, but drivers |
791 | 819 | wanting full suspend/resume support should provide save() and |
792 | - restore() functions. These will be called at suspend, | |
820 | + restore() functions. These are called at suspend, | |
793 | 821 | hibernate, or resume time, and should perform any state save or |
794 | 822 | restore required by your device across suspend or hibernate |
795 | 823 | states. |
... | ... | @@ -812,8 +840,8 @@ |
812 | 840 | <para> |
813 | 841 | The DRM core exports several interfaces to applications, |
814 | 842 | generally intended to be used through corresponding libdrm |
815 | - wrapper functions. In addition, drivers export device specific | |
816 | - interfaces for use by userspace drivers & device aware | |
843 | + wrapper functions. In addition, drivers export device-specific | |
844 | + interfaces for use by userspace drivers & device-aware | |
817 | 845 | applications through ioctls and sysfs files. |
818 | 846 | </para> |
819 | 847 | <para> |
... | ... | @@ -822,8 +850,8 @@ |
822 | 850 | management, memory management, and output management. |
823 | 851 | </para> |
824 | 852 | <para> |
825 | - Cover generic ioctls and sysfs layout here. Only need high | |
826 | - level info, since man pages will cover the rest. | |
853 | + Cover generic ioctls and sysfs layout here. We only need high-level | |
854 | + info, since man pages should cover the rest. | |
827 | 855 | </para> |
828 | 856 | </chapter> |
829 | 857 |
drivers/gpu/drm/i915/i915_drv.c
... | ... | @@ -789,8 +789,8 @@ |
789 | 789 | }; |
790 | 790 | |
791 | 791 | static struct drm_driver driver = { |
792 | - /* don't use mtrr's here, the Xserver or user space app should | |
793 | - * deal with them for intel hardware. | |
792 | + /* Don't use MTRRs here; the Xserver or userspace app should | |
793 | + * deal with them for Intel hardware. | |
794 | 794 | */ |
795 | 795 | .driver_features = |
796 | 796 | DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | /* DRIVER_USE_MTRR |*/ |