aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/gpu/drm-kms.rst96
1 files changed, 0 insertions, 96 deletions
diff --git a/Documentation/gpu/drm-kms.rst b/Documentation/gpu/drm-kms.rst
index 75c882e09fee..23a3c986ef6d 100644
--- a/Documentation/gpu/drm-kms.rst
+++ b/Documentation/gpu/drm-kms.rst
@@ -410,102 +410,6 @@ Encoder Functions Reference
410.. kernel-doc:: drivers/gpu/drm/drm_encoder.c 410.. kernel-doc:: drivers/gpu/drm/drm_encoder.c
411 :export: 411 :export:
412 412
413KMS Initialization and Cleanup
414==============================
415
416A KMS device is abstracted and exposed as a set of planes, CRTCs,
417encoders and connectors. KMS drivers must thus create and initialize all
418those objects at load time after initializing mode setting.
419
420CRTCs (:c:type:`struct drm_crtc <drm_crtc>`)
421--------------------------------------------
422
423A CRTC is an abstraction representing a part of the chip that contains a
424pointer to a scanout buffer. Therefore, the number of CRTCs available
425determines how many independent scanout buffers can be active at any
426given time. The CRTC structure contains several fields to support this:
427a pointer to some video memory (abstracted as a frame buffer object), a
428display mode, and an (x, y) offset into the video memory to support
429panning or configurations where one piece of video memory spans multiple
430CRTCs.
431
432CRTC Initialization
433~~~~~~~~~~~~~~~~~~~
434
435A KMS device must create and register at least one struct
436:c:type:`struct drm_crtc <drm_crtc>` instance. The instance is
437allocated and zeroed by the driver, possibly as part of a larger
438structure, and registered with a call to :c:func:`drm_crtc_init()`
439with a pointer to CRTC functions.
440
441
442Cleanup
443-------
444
445The DRM core manages its objects' lifetime. When an object is not needed
446anymore the core calls its destroy function, which must clean up and
447free every resource allocated for the object. Every
448:c:func:`drm_\*_init()` call must be matched with a corresponding
449:c:func:`drm_\*_cleanup()` call to cleanup CRTCs
450(:c:func:`drm_crtc_cleanup()`), planes
451(:c:func:`drm_plane_cleanup()`), encoders
452(:c:func:`drm_encoder_cleanup()`) and connectors
453(:c:func:`drm_connector_cleanup()`). Furthermore, connectors that
454have been added to sysfs must be removed by a call to
455:c:func:`drm_connector_unregister()` before calling
456:c:func:`drm_connector_cleanup()`.
457
458Connectors state change detection must be cleanup up with a call to
459:c:func:`drm_kms_helper_poll_fini()`.
460
461Output discovery and initialization example
462-------------------------------------------
463
464.. code-block:: c
465
466 void intel_crt_init(struct drm_device *dev)
467 {
468 struct drm_connector *connector;
469 struct intel_output *intel_output;
470
471 intel_output = kzalloc(sizeof(struct intel_output), GFP_KERNEL);
472 if (!intel_output)
473 return;
474
475 connector = &intel_output->base;
476 drm_connector_init(dev, &intel_output->base,
477 &intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA);
478
479 drm_encoder_init(dev, &intel_output->enc, &intel_crt_enc_funcs,
480 DRM_MODE_ENCODER_DAC);
481
482 drm_connector_attach_encoder(&intel_output->base,
483 &intel_output->enc);
484
485 /* Set up the DDC bus. */
486 intel_output->ddc_bus = intel_i2c_create(dev, GPIOA, "CRTDDC_A");
487 if (!intel_output->ddc_bus) {
488 dev_printk(KERN_ERR, &dev->pdev->dev, "DDC bus registration "
489 "failed.\n");
490 return;
491 }
492
493 intel_output->type = INTEL_OUTPUT_ANALOG;
494 connector->interlace_allowed = 0;
495 connector->doublescan_allowed = 0;
496
497 drm_encoder_helper_add(&intel_output->enc, &intel_crt_helper_funcs);
498 drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs);
499
500 drm_connector_register(connector);
501 }
502
503In the example above (taken from the i915 driver), a CRTC, connector and
504encoder combination is created. A device-specific i2c bus is also
505created for fetching EDID data and performing monitor detection. Once
506the process is complete, the new connector is registered with sysfs to
507make its properties available to applications.
508
509KMS Locking 413KMS Locking
510=========== 414===========
511 415