| 1 | ======================
|
| 2 | AMDgpu Display Manager
|
| 3 | ======================
|
| 4 |
|
| 5 | .. contents:: Table of Contents
|
| 6 | :depth: 3
|
| 7 |
|
| 8 | .. kernel-doc:: drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
|
| 9 | :doc: overview
|
| 10 |
|
| 11 | .. kernel-doc:: drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
|
| 12 | :internal:
|
| 13 |
|
| 14 | Lifecycle
|
| 15 | =========
|
| 16 |
|
| 17 | .. kernel-doc:: drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
|
| 18 | :doc: DM Lifecycle
|
| 19 |
|
| 20 | .. kernel-doc:: drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
|
| 21 | :functions: dm_hw_init dm_hw_fini
|
| 22 |
|
| 23 | Interrupts
|
| 24 | ==========
|
| 25 |
|
| 26 | .. kernel-doc:: drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c
|
| 27 | :doc: overview
|
| 28 |
|
| 29 | .. kernel-doc:: drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c
|
| 30 | :internal:
|
| 31 |
|
| 32 | .. kernel-doc:: drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
|
| 33 | :functions: register_hpd_handlers dm_crtc_high_irq dm_pflip_high_irq
|
| 34 |
|
| 35 | .. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
|
| 36 | :functions: amdgpu_display_hotplug_work_func
|
| 37 |
|
| 38 | Atomic Implementation
|
| 39 | =====================
|
| 40 |
|
| 41 | .. kernel-doc:: drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
|
| 42 | :doc: atomic
|
| 43 |
|
| 44 | .. kernel-doc:: drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
|
| 45 | :functions: amdgpu_dm_atomic_check amdgpu_dm_atomic_commit_tail
|
| 46 |
|
| 47 | Color Management Properties
|
| 48 | ===========================
|
| 49 |
|
| 50 | .. kernel-doc:: drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
|
| 51 | :doc: overview
|
| 52 |
|
| 53 | .. kernel-doc:: drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
|
| 54 | :internal:
|
| 55 |
|
| 56 |
|
| 57 | DC Color Capabilities between DCN generations
|
| 58 | ---------------------------------------------
|
| 59 |
|
| 60 | DRM/KMS framework defines three CRTC color correction properties: degamma,
|
| 61 | color transformation matrix (CTM) and gamma, and two properties for degamma and
|
| 62 | gamma LUT sizes. AMD DC programs some of the color correction features
|
| 63 | pre-blending but DRM/KMS has not per-plane color correction properties.
|
| 64 |
|
| 65 | In general, the DRM CRTC color properties are programmed to DC, as follows:
|
| 66 | CRTC gamma after blending, and CRTC degamma pre-blending. Although CTM is
|
| 67 | programmed after blending, it is mapped to DPP hw blocks (pre-blending). Other
|
| 68 | color caps available in the hw is not currently exposed by DRM interface and
|
| 69 | are bypassed.
|
| 70 |
|
| 71 | .. kernel-doc:: drivers/gpu/drm/amd/display/dc/dc.h
|
| 72 | :doc: color-management-caps
|
| 73 |
|
| 74 | .. kernel-doc:: drivers/gpu/drm/amd/display/dc/dc.h
|
| 75 | :internal:
|
| 76 |
|
| 77 | The color pipeline has undergone major changes between DCN hardware
|
| 78 | generations. What's possible to do before and after blending depends on
|
| 79 | hardware capabilities, as illustrated below by the DCN 2.0 and DCN 3.0 families
|
| 80 | schemas.
|
| 81 |
|
| 82 | **DCN 2.0 family color caps and mapping**
|
| 83 |
|
| 84 | .. kernel-figure:: dcn2_cm_drm_current.svg
|
| 85 |
|
| 86 | **DCN 3.0 family color caps and mapping**
|
| 87 |
|
| 88 | .. kernel-figure:: dcn3_cm_drm_current.svg
|
| 89 |
|
| 90 | Blend Mode Properties
|
| 91 | =====================
|
| 92 |
|
| 93 | Pixel blend mode is a DRM plane composition property of :c:type:`drm_plane` used to
|
| 94 | describes how pixels from a foreground plane (fg) are composited with the
|
| 95 | background plane (bg). Here, we present main concepts of DRM blend mode to help
|
| 96 | to understand how this property is mapped to AMD DC interface. See more about
|
| 97 | this DRM property and the alpha blending equations in :ref:`DRM Plane
|
| 98 | Composition Properties <plane_composition_properties>`.
|
| 99 |
|
| 100 | Basically, a blend mode sets the alpha blending equation for plane
|
| 101 | composition that fits the mode in which the alpha channel affects the state of
|
| 102 | pixel color values and, therefore, the resulted pixel color. For
|
| 103 | example, consider the following elements of the alpha blending equation:
|
| 104 |
|
| 105 | - *fg.rgb*: Each of the RGB component values from the foreground's pixel.
|
| 106 | - *fg.alpha*: Alpha component value from the foreground's pixel.
|
| 107 | - *bg.rgb*: Each of the RGB component values from the background.
|
| 108 | - *plane_alpha*: Plane alpha value set by the **plane "alpha" property**, see
|
| 109 | more in :ref:`DRM Plane Composition Properties <plane_composition_properties>`.
|
| 110 |
|
| 111 | in the basic alpha blending equation::
|
| 112 |
|
| 113 | out.rgb = alpha * fg.rgb + (1 - alpha) * bg.rgb
|
| 114 |
|
| 115 | the alpha channel value of each pixel in a plane is ignored and only the plane
|
| 116 | alpha affects the resulted pixel color values.
|
| 117 |
|
| 118 | DRM has three blend mode to define the blend formula in the plane composition:
|
| 119 |
|
| 120 | * **None**: Blend formula that ignores the pixel alpha.
|
| 121 |
|
| 122 | * **Pre-multiplied**: Blend formula that assumes the pixel color values in a
|
| 123 | plane was already pre-multiplied by its own alpha channel before storage.
|
| 124 |
|
| 125 | * **Coverage**: Blend formula that assumes the pixel color values were not
|
| 126 | pre-multiplied with the alpha channel values.
|
| 127 |
|
| 128 | and pre-multiplied is the default pixel blend mode, that means, when no blend
|
| 129 | mode property is created or defined, DRM considers the plane's pixels has
|
| 130 | pre-multiplied color values. On IGT GPU tools, the kms_plane_alpha_blend test
|
| 131 | provides a set of subtests to verify plane alpha and blend mode properties.
|
| 132 |
|
| 133 | The DRM blend mode and its elements are then mapped by AMDGPU display manager
|
| 134 | (DM) to program the blending configuration of the Multiple Pipe/Plane Combined
|
| 135 | (MPC), as follows:
|
| 136 |
|
| 137 | .. kernel-doc:: drivers/gpu/drm/amd/display/dc/inc/hw/mpc.h
|
| 138 | :identifiers: mpcc_blnd_cfg
|
| 139 |
|
| 140 | Therefore, the blending configuration for a single MPCC instance on the MPC
|
| 141 | tree is defined by :c:type:`mpcc_blnd_cfg`, where
|
| 142 | :c:type:`pre_multiplied_alpha` is the alpha pre-multiplied mode flag used to
|
| 143 | set :c:type:`MPCC_ALPHA_MULTIPLIED_MODE`. It controls whether alpha is
|
| 144 | multiplied (true/false), being only true for DRM pre-multiplied blend mode.
|
| 145 | :c:type:`mpcc_alpha_blend_mode` defines the alpha blend mode regarding pixel
|
| 146 | alpha and plane alpha values. It sets one of the three modes for
|
| 147 | :c:type:`MPCC_ALPHA_BLND_MODE`, as described below.
|
| 148 |
|
| 149 | .. kernel-doc:: drivers/gpu/drm/amd/display/dc/inc/hw/mpc.h
|
| 150 | :identifiers: mpcc_alpha_blend_mode
|
| 151 |
|
| 152 | DM then maps the elements of `enum mpcc_alpha_blend_mode` to those in the DRM
|
| 153 | blend formula, as follows:
|
| 154 |
|
| 155 | * *MPC pixel alpha* matches *DRM fg.alpha* as the alpha component value
|
| 156 | from the plane's pixel
|
| 157 | * *MPC global alpha* matches *DRM plane_alpha* when the pixel alpha should
|
| 158 | be ignored and, therefore, pixel values are not pre-multiplied
|
| 159 | * *MPC global gain* assumes *MPC global alpha* value when both *DRM
|
| 160 | fg.alpha* and *DRM plane_alpha* participate in the blend equation
|
| 161 |
|
| 162 | In short, *fg.alpha* is ignored by selecting
|
| 163 | :c:type:`MPCC_ALPHA_BLEND_MODE_GLOBAL_ALPHA`. On the other hand, (plane_alpha *
|
| 164 | fg.alpha) component becomes available by selecting
|
| 165 | :c:type:`MPCC_ALPHA_BLEND_MODE_PER_PIXEL_ALPHA_COMBINED_GLOBAL_GAIN`. And the
|
| 166 | :c:type:`MPCC_ALPHA_MULTIPLIED_MODE` defines if the pixel color values are
|
| 167 | pre-multiplied by alpha or not.
|
| 168 |
|
| 169 | Blend configuration flow
|
| 170 | ------------------------
|
| 171 |
|
| 172 | The alpha blending equation is configured from DRM to DC interface by the
|
| 173 | following path:
|
| 174 |
|
| 175 | 1. When updating a :c:type:`drm_plane_state <drm_plane_state>`, DM calls
|
| 176 | :c:type:`amdgpu_dm_plane_fill_blending_from_plane_state()` that maps
|
| 177 | :c:type:`drm_plane_state <drm_plane_state>` attributes to
|
| 178 | :c:type:`dc_plane_info <dc_plane_info>` struct to be handled in the
|
| 179 | OS-agnostic component (DC).
|
| 180 |
|
| 181 | 2. On DC interface, :c:type:`struct mpcc_blnd_cfg <mpcc_blnd_cfg>` programs the
|
| 182 | MPCC blend configuration considering the :c:type:`dc_plane_info
|
| 183 | <dc_plane_info>` input from DPP.
|
| 184 |
|
| 185 | Display Properties
|
| 186 | ==================
|
| 187 |
|
| 188 | .. kernel-doc:: drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
|
| 189 | :doc: property for adaptive backlight modulation
|