+=============
DRM Internals
=============
DMA services.
Driver Initialization
----------------------
+=====================
At the core of every DRM driver is a :c:type:`struct drm_driver
<drm_driver>` structure. Drivers typically statically initialize
sections.
Driver Information
-~~~~~~~~~~~~~~~~~~
+------------------
Driver Features
^^^^^^^^^^^^^^^
DRM_IOCTL_VERSION ioctl.
Device Instance and Driver Handling
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-----------------------------------
.. kernel-doc:: drivers/gpu/drm/drm_drv.c
:doc: driver instance overview
:export:
Driver Load
-~~~~~~~~~~~
+-----------
IRQ Registration
^^^^^^^^^^^^^^^^
hangs or memory corruption.
Bus-specific Device Registration and PCI Support
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+------------------------------------------------
A number of functions are provided to help with device registration. The
functions deal with PCI and platform devices respectively and are only
:export:
Memory management
------------------
+=================
Modern Linux systems require large amount of graphics memory to store
frame buffers, textures, vertices and other graphics-related data. Given
UMA devices.
The Translation Table Manager (TTM)
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-----------------------------------
TTM design background and information belongs here.
count for the TTM, which will call your initialization function.
The Graphics Execution Manager (GEM)
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+------------------------------------
The GEM design approach has resulted in a memory manager that doesn't
provide full coverage of all (or even all common) use cases in its
from the client in libdrm.
GEM Function Reference
-~~~~~~~~~~~~~~~~~~~~~~
+----------------------
.. kernel-doc:: drivers/gpu/drm/drm_gem.c
:export:
:internal:
VMA Offset Manager
-~~~~~~~~~~~~~~~~~~
+------------------
.. kernel-doc:: drivers/gpu/drm/drm_vma_manager.c
:doc: vma offset manager
:internal:
PRIME Buffer Sharing
-~~~~~~~~~~~~~~~~~~~~
+--------------------
PRIME is the cross device buffer sharing framework in drm, originally
created for the OPTIMUS range of multi-gpu platforms. To userspace PRIME
:doc: PRIME Helpers
PRIME Function References
-~~~~~~~~~~~~~~~~~~~~~~~~~
+-------------------------
.. kernel-doc:: drivers/gpu/drm/drm_prime.c
:export:
DRM MM Range Allocator
-~~~~~~~~~~~~~~~~~~~~~~
+----------------------
Overview
^^^^^^^^
:doc: lru scan roaster
DRM MM Range Allocator Function References
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+------------------------------------------
.. kernel-doc:: drivers/gpu/drm/drm_mm.c
:export:
:internal:
CMA Helper Functions Reference
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+------------------------------
.. kernel-doc:: drivers/gpu/drm/drm_gem_cma_helper.c
:doc: cma helpers
:internal:
Mode Setting
-------------
+============
Drivers must initialize the mode setting core by calling
:c:func:`drm_mode_config_init()` on the DRM device. The function
Mode setting functions.
Display Modes Function Reference
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+--------------------------------
.. kernel-doc:: include/drm/drm_modes.h
:internal:
:export:
Atomic Mode Setting Function Reference
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+--------------------------------------
.. kernel-doc:: drivers/gpu/drm/drm_atomic.c
:export:
:internal:
Frame Buffer Abstraction
-~~~~~~~~~~~~~~~~~~~~~~~~
+------------------------
Frame buffers are abstract memory objects that provide a source of
pixels to scanout to a CRTC. Applications explicitly request the
:c:func:`drm_framebuffer_unregister_private()`.
DRM Format Handling
-~~~~~~~~~~~~~~~~~~~
+-------------------
.. kernel-doc:: include/drm/drm_fourcc.h
:internal:
:export:
Dumb Buffer Objects
-~~~~~~~~~~~~~~~~~~~
+-------------------
The KMS API doesn't standardize backing storage object creation and
leaves it to driver-specific ioctls. Furthermore actually creating a
a hardware-specific ioctl to allocate suitable buffer objects.
Output Polling
-~~~~~~~~~~~~~~
+--------------
void (\*output_poll_changed)(struct drm_device \*dev);
This operation notifies the driver that the status of one or more
operation.
KMS Initialization and Cleanup
-------------------------------
+==============================
A KMS device is abstracted and exposed as a set of planes, CRTCs,
encoders and connectors. KMS drivers must thus create and initialize all
those objects at load time after initializing mode setting.
CRTCs (:c:type:`struct drm_crtc <drm_crtc>`)
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+--------------------------------------------
A CRTC is an abstraction representing a part of the chip that contains a
pointer to a scanout buffer. Therefore, the number of CRTCs available
with a pointer to CRTC functions.
Planes (:c:type:`struct drm_plane <drm_plane>`)
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-----------------------------------------------
A plane represents an image source that can be blended with or overlayed
on top of a CRTC during the scanout process. Planes are associated with
create and register a primary plane with standard capabilities.
Encoders (:c:type:`struct drm_encoder <drm_encoder>`)
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-----------------------------------------------------
An encoder takes pixel data from a CRTC and converts it to a format
suitable for any attached connectors. On some devices, it may be
encoders they want to use to a CRTC.
Connectors (:c:type:`struct drm_connector <drm_connector>`)
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-----------------------------------------------------------
A connector is the final destination for pixel data on a device, and
usually connects directly to an external display device like a monitor
should return connector_status_unknown.
Cleanup
-~~~~~~~
+-------
The DRM core manages its objects' lifetime. When an object is not needed
anymore the core calls its destroy function, which must clean up and
:c:func:`drm_kms_helper_poll_fini()`.
Output discovery and initialization example
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-------------------------------------------
::
make its properties available to applications.
KMS API Functions
-~~~~~~~~~~~~~~~~~
+-----------------
.. kernel-doc:: drivers/gpu/drm/drm_crtc.c
:export:
KMS Data Structures
-~~~~~~~~~~~~~~~~~~~
+-------------------
.. kernel-doc:: include/drm/drm_crtc.h
:internal:
KMS Locking
-~~~~~~~~~~~
+-----------
.. kernel-doc:: drivers/gpu/drm/drm_modeset_lock.c
:doc: kms locking
:export:
Mode Setting Helper Functions
------------------------------
+=============================
The plane, CRTC, encoder and connector functions provided by the drivers
implement the DRM API. They're called by the DRM core and ioctl handlers
the three KMS entities.
Atomic Modeset Helper Functions Reference
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-----------------------------------------
Overview
^^^^^^^^
:export:
Modeset Helper Reference for Common Vtables
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-------------------------------------------
.. kernel-doc:: include/drm/drm_modeset_helper_vtables.h
:internal:
:doc: overview
Legacy CRTC/Modeset Helper Functions Reference
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+----------------------------------------------
.. kernel-doc:: drivers/gpu/drm/drm_crtc_helper.c
:export:
:doc: overview
Output Probing Helper Functions Reference
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-----------------------------------------
.. kernel-doc:: drivers/gpu/drm/drm_probe_helper.c
:doc: output probing helper overview
:export:
fbdev Helper Functions Reference
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+--------------------------------
.. kernel-doc:: drivers/gpu/drm/drm_fb_helper.c
:doc: fbdev helpers
:internal:
Framebuffer CMA Helper Functions Reference
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+------------------------------------------
.. kernel-doc:: drivers/gpu/drm/drm_fb_cma_helper.c
:doc: framebuffer cma helper functions
:export:
Display Port Helper Functions Reference
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+---------------------------------------
.. kernel-doc:: drivers/gpu/drm/drm_dp_helper.c
:doc: dp helpers
:export:
Display Port Dual Mode Adaptor Helper Functions Reference
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+---------------------------------------------------------
.. kernel-doc:: drivers/gpu/drm/drm_dp_dual_mode_helper.c
:doc: dp dual mode helpers
:export:
Display Port MST Helper Functions Reference
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-------------------------------------------
.. kernel-doc:: drivers/gpu/drm/drm_dp_mst_topology.c
:doc: dp mst helper
:export:
MIPI DSI Helper Functions Reference
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-----------------------------------
.. kernel-doc:: drivers/gpu/drm/drm_mipi_dsi.c
:doc: dsi helpers
:export:
EDID Helper Functions Reference
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-------------------------------
.. kernel-doc:: drivers/gpu/drm/drm_edid.c
:export:
Rectangle Utilities Reference
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-----------------------------
.. kernel-doc:: include/drm/drm_rect.h
:doc: rect utils
:export:
Flip-work Helper Reference
-~~~~~~~~~~~~~~~~~~~~~~~~~~
+--------------------------
.. kernel-doc:: include/drm/drm_flip_work.h
:doc: flip utils
:export:
HDMI Infoframes Helper Reference
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+--------------------------------
Strictly speaking this is not a DRM helper library but generally useable
by any driver interfacing with HDMI outputs like v4l or alsa drivers.
:export:
Plane Helper Reference
-~~~~~~~~~~~~~~~~~~~~~~
+----------------------
.. kernel-doc:: drivers/gpu/drm/drm_plane_helper.c
:export:
:doc: overview
Tile group
-~~~~~~~~~~
+----------
.. kernel-doc:: drivers/gpu/drm/drm_crtc.c
:doc: Tile group
Bridges
-~~~~~~~
+-------
Overview
^^^^^^^^
:export:
Panel Helper Reference
-~~~~~~~~~~~~~~~~~~~~~~
+----------------------
.. kernel-doc:: include/drm/drm_panel.h
:internal:
:doc: drm panel
Simple KMS Helper Reference
-~~~~~~~~~~~~~~~~~~~~~~~~~~~
+---------------------------
.. kernel-doc:: include/drm/drm_simple_kms_helper.h
:internal:
:doc: overview
KMS Properties
---------------
+==============
Drivers may need to expose additional parameters to applications than
those described in the previous sections. KMS supports attaching
property and an initial instance value.
Existing KMS Properties
-~~~~~~~~~~~~~~~~~~~~~~~
+-----------------------
The following table gives description of drm properties exposed by
various modules/drivers.
+-------------------------------+----------------------+--------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Vertical Blanking
------------------
+=================
Vertical blanking plays a major role in graphics rendering. To achieve
tear-free display, users must synchronize page flips and/or rendering to
operation handler.
Vertical Blanking and Interrupt Handling Functions Reference
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+------------------------------------------------------------
.. kernel-doc:: drivers/gpu/drm/drm_irq.c
:export:
:functions: drm_crtc_vblank_waitqueue
Open/Close, File Operations and IOCTLs
---------------------------------------
+======================================
Open and Close
-~~~~~~~~~~~~~~
+--------------
int (\*firstopen) (struct drm_device \*); void (\*lastclose) (struct
drm_device \*); int (\*open) (struct drm_device \*, struct drm_file
over.
File Operations
-~~~~~~~~~~~~~~~
+---------------
.. kernel-doc:: drivers/gpu/drm/drm_fops.c
:doc: file operations
:export:
IOCTLs
-~~~~~~
+------
struct drm_ioctl_desc \*ioctls; int num_ioctls;
Driver-specific ioctls descriptors table.
:export:
Legacy Support Code
--------------------
+===================
The section very briefly covers some of the old legacy support code
which is only used by old DRM drivers which have done a so-called
drivers.
Legacy Suspend/Resume
-~~~~~~~~~~~~~~~~~~~~~
+---------------------
The DRM core provides some suspend/resume code, but drivers wanting full
suspend/resume support should provide save() and restore() functions.
dev_pm_ops) and set these methods to NULL.
Legacy DMA Services
-~~~~~~~~~~~~~~~~~~~
+-------------------
This should cover how DMA mapping etc. is supported by the core. These
functions are deprecated and should not be used.
-drm/i915 Intel GFX Driver
-=========================
+===========================
+ drm/i915 Intel GFX Driver
+===========================
The drm/i915 driver supports all (with the exception of some very early
models) integrated GFX chipsets with both Intel display and rendering
those have basic support through the gma500 drm driver.
Core Driver Infrastructure
---------------------------
+==========================
This section covers core driver infrastructure used by both the display
and the GEM parts of the driver.
Runtime Power Management
-~~~~~~~~~~~~~~~~~~~~~~~~
+------------------------
.. kernel-doc:: drivers/gpu/drm/i915/intel_runtime_pm.c
:doc: runtime pm
:internal:
Interrupt Handling
-~~~~~~~~~~~~~~~~~~
+------------------
.. kernel-doc:: drivers/gpu/drm/i915/i915_irq.c
:doc: interrupt handling
:functions: intel_runtime_pm_enable_interrupts
Intel GVT-g Guest Support(vGPU)
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-------------------------------
.. kernel-doc:: drivers/gpu/drm/i915/i915_vgpu.c
:doc: Intel GVT-g guest support
:internal:
Display Hardware Handling
--------------------------
+=========================
This section covers everything related to the display hardware including
the mode setting infrastructure, plane, sprite and cursor handling and
display, output probing and related topics.
Mode Setting Infrastructure
-~~~~~~~~~~~~~~~~~~~~~~~~~~~
+---------------------------
The i915 driver is thus far the only DRM driver which doesn't use the
common DRM helper code to implement mode setting sequences. Thus it has
change.
Frontbuffer Tracking
-~~~~~~~~~~~~~~~~~~~~
+--------------------
.. kernel-doc:: drivers/gpu/drm/i915/intel_frontbuffer.c
:doc: frontbuffer tracking
:functions: i915_gem_track_fb
Display FIFO Underrun Reporting
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-------------------------------
.. kernel-doc:: drivers/gpu/drm/i915/intel_fifo_underrun.c
:doc: fifo underrun handling
:internal:
Plane Configuration
-~~~~~~~~~~~~~~~~~~~
+-------------------
This section covers plane configuration and composition with the primary
plane, sprites, cursors and overlays. This includes the infrastructure
panel self refresh.
Atomic Plane Helpers
-~~~~~~~~~~~~~~~~~~~~
+--------------------
.. kernel-doc:: drivers/gpu/drm/i915/intel_atomic_plane.c
:doc: atomic plane helpers
:internal:
Output Probing
-~~~~~~~~~~~~~~
+--------------
This section covers output probing and related infrastructure like the
hotplug interrupt storm detection and mitigation code. Note that the
probing, so those sections fully apply.
Hotplug
-~~~~~~~
+-------
.. kernel-doc:: drivers/gpu/drm/i915/intel_hotplug.c
:doc: Hotplug
:internal:
High Definition Audio
-~~~~~~~~~~~~~~~~~~~~~
+---------------------
.. kernel-doc:: drivers/gpu/drm/i915/intel_audio.c
:doc: High Definition Audio over HDMI and Display Port
:internal:
Panel Self Refresh PSR (PSR/SRD)
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+--------------------------------
.. kernel-doc:: drivers/gpu/drm/i915/intel_psr.c
:doc: Panel Self Refresh (PSR/SRD)
:internal:
Frame Buffer Compression (FBC)
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+------------------------------
.. kernel-doc:: drivers/gpu/drm/i915/intel_fbc.c
:doc: Frame Buffer Compression (FBC)
:internal:
Display Refresh Rate Switching (DRRS)
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-------------------------------------
.. kernel-doc:: drivers/gpu/drm/i915/intel_dp.c
:doc: Display Refresh Rate Switching (DRRS)
:functions: intel_dp_drrs_init
DPIO
-~~~~
+----
.. kernel-doc:: drivers/gpu/drm/i915/i915_reg.h
:doc: DPIO
CSR firmware support for DMC
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+----------------------------
.. kernel-doc:: drivers/gpu/drm/i915/intel_csr.c
:doc: csr support for dmc
:internal:
Video BIOS Table (VBT)
-~~~~~~~~~~~~~~~~~~~~~~
+----------------------
.. kernel-doc:: drivers/gpu/drm/i915/intel_bios.c
:doc: Video BIOS Table (VBT)
:internal:
Memory Management and Command Submission
-----------------------------------------
+========================================
This sections covers all things related to the GEM implementation in the
i915 driver.
Batchbuffer Parsing
-~~~~~~~~~~~~~~~~~~~
+-------------------
.. kernel-doc:: drivers/gpu/drm/i915/i915_cmd_parser.c
:doc: batch buffer command parser
:internal:
Batchbuffer Pools
-~~~~~~~~~~~~~~~~~
+-----------------
.. kernel-doc:: drivers/gpu/drm/i915/i915_gem_batch_pool.c
:doc: batch pool
:internal:
Logical Rings, Logical Ring Contexts and Execlists
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+--------------------------------------------------
.. kernel-doc:: drivers/gpu/drm/i915/intel_lrc.c
:doc: Logical Rings, Logical Ring Contexts and Execlists
:internal:
Global GTT views
-~~~~~~~~~~~~~~~~
+----------------
.. kernel-doc:: drivers/gpu/drm/i915/i915_gem_gtt.c
:doc: Global GTT views
:internal:
GTT Fences and Swizzling
-~~~~~~~~~~~~~~~~~~~~~~~~
+------------------------
.. kernel-doc:: drivers/gpu/drm/i915/i915_gem_fence.c
:internal:
Global GTT Fence Handling
-^^^^^^^^^^^^^^^^^^^^^^^^^
+~~~~~~~~~~~~~~~~~~~~~~~~~
.. kernel-doc:: drivers/gpu/drm/i915/i915_gem_fence.c
:doc: fence register handling
Hardware Tiling and Swizzling Details
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. kernel-doc:: drivers/gpu/drm/i915/i915_gem_fence.c
:doc: tiling swizzling details
Object Tiling IOCTLs
-~~~~~~~~~~~~~~~~~~~~
+--------------------
.. kernel-doc:: drivers/gpu/drm/i915/i915_gem_tiling.c
:internal:
:doc: buffer object tiling
Buffer Object Eviction
-~~~~~~~~~~~~~~~~~~~~~~
+----------------------
This section documents the interface functions for evicting buffer
objects to make space available in the virtual gpu address spaces. Note
:internal:
Buffer Object Memory Shrinking
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+------------------------------
This section documents the interface function for shrinking memory usage
of buffer object caches. Shrinking is used to make main memory
:internal:
GuC
----
+===
GuC-specific firmware loader
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+----------------------------
.. kernel-doc:: drivers/gpu/drm/i915/intel_guc_loader.c
:doc: GuC-specific firmware loader
:internal:
GuC-based command submission
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+----------------------------
.. kernel-doc:: drivers/gpu/drm/i915/i915_guc_submission.c
:doc: GuC-based command submission
:internal:
GuC Firmware Layout
-~~~~~~~~~~~~~~~~~~~
+-------------------
.. kernel-doc:: drivers/gpu/drm/i915/intel_guc_fwif.h
:doc: GuC Firmware Layout
Tracing
--------
+=======
This sections covers all things related to the tracepoints implemented
in the i915 driver.
i915_ppgtt_create and i915_ppgtt_release
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+----------------------------------------
.. kernel-doc:: drivers/gpu/drm/i915/i915_trace.h
:doc: i915_ppgtt_create and i915_ppgtt_release tracepoints
i915_context_create and i915_context_free
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-----------------------------------------
.. kernel-doc:: drivers/gpu/drm/i915/i915_trace.h
:doc: i915_context_create and i915_context_free tracepoints
switch_mm
-~~~~~~~~~~
+---------
.. kernel-doc:: drivers/gpu/drm/i915/i915_trace.h
:doc: switch_mm tracepoint