← Documents Documentation/gpu/amdgpu/display/display-manager.rst GitHub 원문 ↗

Linux 6.18.37 · GPU

AMDgpu Display Manager

DRM/KMS와 DC를 연결하는 DM lifecycle, atomic, color와 blend mapping의 전문 번역입니다.

Source pathDocumentation/gpu/amdgpu/display/display-manager.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

display-manager.rst:1-180

AMDGPU Display Manager의 lifecycle, interrupt, atomic path와 DRM color/blend property를 DCN hardware에 mapping하는 과정을 설명합니다. 두 DCN color SVG와 alpha equation, symbol, source path를 보존한 전문 번역입니다.

Display Manager 조사 지도
영역Source 또는 symbol핵심 질문
Lifecycledm_hw_init, dm_hw_finiResource init/fini 순서가 맞는가
Interruptamdgpu_dm_irq.c, HPD/CRTC/pflip handlersHardware event가 DRM event로 전달되는가
Atomicamdgpu_dm_atomic_check, amdgpu_dm_atomic_commit_tailState validation과 commit ordering이 맞는가
Coloramdgpu_dm_color.c, dc.h color-management-capsDRM property가 지원 DCN stage에 mapping되는가
Blendmpcc_blnd_cfg, mpcc_alpha_blend_modePixel alpha, plane alpha와 premultiplication이 일치하는가

증상 또는 변경 유형에 따른 핵심 source와 symbol입니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

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

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

Display Manager의 계층과 핵심 경로

1-43

AMDGPU Display Manager(DM)는 Linux DRM/KMS object와 atomic state를 AMD의 OS-agnostic Display Core(DC) interface로 연결하는 계층입니다. 이 RST 문서는 긴 implementation을 복제하지 않고 `amdgpu_dm.c`, `amdgpu_dm.h`, `amdgpu_dm_irq.c`의 kernel-doc overview, internal symbol과 선택된 function 문서를 조합합니다.

DRM/KMS에서 DC hardware까지
DRM/KMS connector, CRTC, plane과 atomic stateAMDGPU Display Manager가 validation과 state mapping 수행OS-agnostic Display Core가 DCN resource와 configuration 계산ASIC별 DCN block programming과 interrupt 처리Page flip, vblank, HPD event를 DRM/KMS 쪽에 전달

DM은 framework state를 DC 표현으로 바꾸고 hardware programming 결과를 다시 DRM event로 연결합니다.

Overview kernel-doc source
Source지시문포함 내용
amdgpu_dm/amdgpu_dm.c:doc: overviewDM의 전체 목적과 DRM/DC 연결 설명
amdgpu_dm/amdgpu_dm.h:internal:DM internal data structure와 interface
amdgpu_dm/amdgpu_dm.c:doc: DM LifecycleDM component의 생성, 초기화와 종료 lifecycle
amdgpu_dm/amdgpu_dm.c:doc: atomicDRM atomic validation과 commit implementation

문서 생성 범위와 source ownership을 구분합니다.

Lifecycle 절은 `dm_hw_init`와 `dm_hw_fini`를 직접 지정합니다. 두 function은 DM hardware-facing resource의 시작과 종료 경계를 이루므로 init failure unwind와 suspend/resume 또는 teardown 순서를 함께 봐야 합니다.

DM lifecycle 경계
AMDGPU device와 DM state 준비dm_hw_init에서 display hardware와 DRM-facing resource 초기화Runtime 동안 atomic commit, interrupt와 link event 처리Suspend, unload 또는 error cleanup 진입dm_hw_fini에서 등록한 resource와 hardware state 정리

세부 call order는 amdgpu_dm.c의 kernel-doc와 현재 implementation을 기준으로 확인합니다.

Interrupt 절은 `amdgpu_dm_irq.c`의 overview와 internal symbol을 포함하고, `register_hpd_handlers`, `dm_crtc_high_irq`, `dm_pflip_high_irq`를 별도로 문서화합니다. HPD는 connector 상태 변화, CRTC high IRQ는 timing event, pflip high IRQ는 page-flip completion 경로와 연결됩니다.

DM interrupt entry
Function관심 event검토할 연결
register_hpd_handlersHot-plug detectionConnector HPD source 등록과 link detect
dm_crtc_high_irqCRTC high-priority interruptVBlank/timing 처리와 CRTC event
dm_pflip_high_irqPage flip high-priority interruptFlip completion, event 전달과 pending state

Interrupt source와 DRM-visible 결과를 조사할 때의 시작점입니다.

Atomic Implementation 절은 `amdgpu_dm_atomic_check`와 `amdgpu_dm_atomic_commit_tail`을 지정합니다. 전자는 proposed DRM state가 DC resource와 bandwidth 제약을 만족하는지 검사하고, 후자는 승인된 state를 hardware에 적용하고 event 및 cleanup을 이어가는 핵심 경로입니다.

======================
AMDgpu Display Manager
======================

.. contents:: Table of Contents
    :depth: 3

.. kernel-doc:: drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
   :doc: overview

.. kernel-doc:: drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
   :internal:

Lifecycle
=========

.. kernel-doc:: drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
   :doc: DM Lifecycle

.. kernel-doc:: drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
   :functions: dm_hw_init dm_hw_fini

Interrupts
==========

.. kernel-doc:: drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c
   :doc: overview

.. kernel-doc:: drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c
   :internal:

.. kernel-doc:: drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
   :functions: register_hpd_handlers dm_crtc_high_irq dm_pflip_high_irq

Atomic Implementation
=====================

.. kernel-doc:: drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
   :doc: atomic

.. kernel-doc:: drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
   :functions: amdgpu_dm_atomic_check amdgpu_dm_atomic_commit_tail

Color Management와 DCN 세대별 mapping

44-86

Color Management 절은 `amdgpu_dm_color.c`의 overview와 internal symbol을 포함합니다. DRM/KMS는 CRTC color correction property로 degamma, color transformation matrix(CTM), gamma를 정의하고 degamma LUT와 gamma LUT의 size property도 제공합니다. 그러나 DRM/KMS에는 이 원문 시점에 per-plane color correction property가 없습니다.

일반 mapping에서 CRTC degamma는 blending 전에, CRTC gamma는 blending 뒤에 DC로 program됩니다. CTM은 DRM 관점에서는 blending 뒤 property이지만 현재 AMD DC mapping은 pre-blending DPP hardware block을 사용합니다. Hardware가 가진 다른 color capability 중 DRM interface로 노출되지 않은 기능은 bypass됩니다.

DRM CRTC color property mapping
DRM property의도한 위치DC mapping
Degamma LUTPre-blendingDPP의 input transfer/degamma 경로
CTMPost-blending CRTC transform현재 DPP pre-blending matrix block에 mapping
Gamma LUTPost-blendingMPC/OPP 쪽 output transfer 경로
Degamma/Gamma LUT sizeLUT capability 표현지원 hardware size를 DRM property로 보고
기타 hardware color capsDRM property 없음현재 bypass

DRM semantic 위치와 현재 DC hardware mapping을 함께 표시합니다.

`dc.h`의 `color-management-caps` 문서와 internal symbol은 DC가 세대별 color capability를 표현하는 방식을 설명합니다. Pre-blend와 post-blend에서 가능한 operation은 DCN generation의 hardware block에 따라 크게 달라집니다.

DCN 2.0 color pipeline
drm_framebuffer format -> drm_plane color_encoding, pixel_blend_mode, color_rangeDPP CNVC와 Input CSC: bias_and_scale, color space matrixDeGamma RAM/ROM -> HDR Multiply -> Gamut RemapShaper LUT RAM -> 3D LUT RAM -> Blend GammaMPC Blender에서 plane compositionGamma RAM -> OCSC -> bit depth/clamping/output_color_space

dcn2_cm_drm_current.svg의 주요 label을 DRM object에서 output까지 정리했습니다.

DCN 3.0 color pipeline
CNVC와 Input CSC -> 확장된 DeGamma ROM(sRGB, BT2020, Gamma 2.2, PQ, HLG)Post CSC와 Gamma CorrectionHDR Multiply -> Gamut Remap -> Shaper LUT RAM -> 3D LUT RAMBlend Gamma -> MPC BlenderPost-blend Gamut Remap -> Shaper LUT RAM -> 3D LUT RAMGamma RAM -> OCSC -> integer output formatting

dcn3_cm_drm_current.svg에서 확장된 pre/post-blend stage를 표시합니다.

DCN 2.0과 3.0 schema 차이
영역DCN 2.0 familyDCN 3.0 family
DegammaDeGamma RAM and ROM더 많은 transfer function을 표시한 DeGamma ROM
Pre-blend matrix/correctionInput CSC 중심Post CSC와 Gamma Correction stage 추가 표시
Pre-blend advanced colorGamut Remap, Shaper LUT, 3D LUT동일 계열 stage를 확장된 pipeline에 배치
Post-blend advanced colorGamma RAM, OCSC 중심Gamut Remap, Shaper LUT, 3D LUT 뒤 Gamma RAM/OCSC

그림은 family-level capability mapping이며 세부 ASIC support는 별도로 확인해야 합니다.

Color Management Properties
===========================

.. kernel-doc:: drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
   :doc: overview

.. kernel-doc:: drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
   :internal:


DC Color Capabilities between DCN generations
---------------------------------------------

DRM/KMS framework defines three CRTC color correction properties: degamma,
color transformation matrix (CTM) and gamma, and two properties for degamma and
gamma LUT sizes. AMD DC programs some of the color correction features
pre-blending but DRM/KMS has not per-plane color correction properties.

In general, the DRM CRTC color properties are programmed to DC, as follows:
CRTC gamma after blending, and CRTC degamma pre-blending. Although CTM is
programmed after blending, it is mapped to DPP hw blocks (pre-blending). Other
color caps available in the hw is not currently exposed by DRM interface and
are bypassed.

.. kernel-doc:: drivers/gpu/drm/amd/display/dc/dc.h
   :doc: color-management-caps

.. kernel-doc:: drivers/gpu/drm/amd/display/dc/dc.h
   :internal:

The color pipeline has undergone major changes between DCN hardware
generations. What's possible to do before and after blending depends on
hardware capabilities, as illustrated below by the DCN 2.0 and DCN 3.0 families
schemas.

**DCN 2.0 family color caps and mapping**

.. kernel-figure:: dcn2_cm_drm_current.svg

**DCN 3.0 family color caps and mapping**

.. kernel-figure:: dcn3_cm_drm_current.svg

DRM plane blend mode와 alpha equation

87-128

Pixel blend mode는 `drm_plane`의 plane composition property이며 foreground plane(fg)과 background plane(bg)의 pixel을 어떻게 합성할지 정합니다. 정확한 DRM property와 alpha equation은 `DRM Plane Composition Properties <plane_composition_properties>` 참조 절이 기준입니다.

Alpha equation 요소
요소의미
fg.rgbForeground pixel의 R, G, B component
fg.alphaForeground pixel에 저장된 per-pixel alpha component
bg.rgbBackground pixel의 R, G, B component
plane_alphaPlane의 alpha property로 설정한 global plane alpha

원문 기호와 DRM property의 의미입니다.

기본 alpha blending equation은 다음과 같습니다.

out.rgb = alpha * fg.rgb + (1 - alpha) * bg.rgb

어떤 alpha 값을 식의 `alpha`에 사용할지는 blend mode가 결정합니다. Pixel alpha를 무시하는 mode에서는 plane alpha만 결과 color에 영향을 줍니다.

Alpha blend 계산의 개념
Foreground color fg.rgb와 background color bg.rgb 준비Blend mode에 따라 pixel alpha와 plane_alpha 결합 방식 선택Foreground contribution = alpha * fg.rgbBackground contribution = (1 - alpha) * bg.rgb두 contribution을 더해 out.rgb 생성

실제 fixed-point precision과 rounding은 DRM/DC hardware implementation을 따릅니다.

DRM pixel blend mode
ModePixel alpha 처리Color value 전제
NonePixel alpha 무시Plane alpha로 foreground/background 비율 결정
Pre-multipliedPixel alpha 사용저장 전에 pixel color가 자신의 alpha와 이미 곱해짐
CoveragePixel alpha 사용저장된 pixel color는 alpha와 미리 곱해지지 않음

Pre-multiplied가 property를 만들지 않았을 때의 default입니다.

IGT GPU tools의 `kms_plane_alpha_blend` test는 plane alpha와 blend mode property를 검증하는 subtest 집합을 제공합니다. Mode mapping을 바꿀 때에는 equation만 확인하지 말고 실제 plane format과 alpha property 조합을 함께 검증해야 합니다.

Blend Mode Properties
=====================

Pixel blend mode is a DRM plane composition property of :c:type:`drm_plane` used to
describes how pixels from a foreground plane (fg) are composited with the
background plane (bg). Here, we present main concepts of DRM blend mode to help
to understand how this property is mapped to AMD DC interface. See more about
this DRM property and the alpha blending equations in :ref:`DRM Plane
Composition Properties <plane_composition_properties>`.

Basically, a blend mode sets the alpha blending equation for plane
composition that fits the mode in which the alpha channel affects the state of
pixel color values and, therefore, the resulted pixel color. For
example, consider the following elements of the alpha blending equation:

- *fg.rgb*: Each of the RGB component values from the foreground's pixel.
- *fg.alpha*: Alpha component value from the foreground's pixel.
- *bg.rgb*: Each of the RGB component values from the background.
- *plane_alpha*: Plane alpha value set by the **plane "alpha" property**, see
  more in :ref:`DRM Plane Composition Properties <plane_composition_properties>`.

in the basic alpha blending equation::

   out.rgb = alpha * fg.rgb + (1 - alpha) * bg.rgb

the alpha channel value of each pixel in a plane is ignored and only the plane
alpha affects the resulted pixel color values.

DRM has three blend mode to define the blend formula in the plane composition:

* **None**: Blend formula that ignores the pixel alpha.

* **Pre-multiplied**: Blend formula that assumes the pixel color values in a
  plane was already pre-multiplied by its own alpha channel before storage.

* **Coverage**: Blend formula that assumes the pixel color values were not
  pre-multiplied with the alpha channel values.

and pre-multiplied is the default pixel blend mode, that means, when no blend
mode property is created or defined, DRM considers the plane's pixels has
pre-multiplied color values. On IGT GPU tools, the kms_plane_alpha_blend test
provides a set of subtests to verify plane alpha and blend mode properties.

DM에서 MPC blend structure로

129-148

AMDGPU Display Manager는 DRM blend mode와 alpha 요소를 Multiple Pipe/Plane Combined(MPC)의 blending configuration으로 mapping합니다. `mpc.h`의 kernel-doc는 먼저 `mpcc_blnd_cfg`, 이어서 `mpcc_alpha_blend_mode` identifier를 선택해 문서화합니다.

MPC blending data structure
Symbol역할Hardware mode
mpcc_blnd_cfgMPCC 하나의 alpha blending configurationMPC tree instance programming
pre_multiplied_alphaPixel RGB가 alpha와 미리 곱해졌는지 나타내는 flagMPCC_ALPHA_MULTIPLIED_MODE
mpcc_alpha_blend_modePixel alpha와 plane alpha의 조합 방식MPCC_ALPHA_BLND_MODE의 세 mode 중 하나

Single MPCC instance의 configuration을 구성하는 핵심 field입니다.

`pre_multiplied_alpha`는 DRM Pre-multiplied mode에서만 true가 되며 `MPCC_ALPHA_MULTIPLIED_MODE`를 설정합니다. `mpcc_alpha_blend_mode`는 pixel alpha와 global alpha를 식에 넣는 방식을 선택합니다.

DRM blend property에서 MPCC register mode까지
drm_plane의 pixel_blend_mode와 alpha property 읽기DM이 pixel alpha 사용 여부와 premultiplication 상태 해석mpcc_blnd_cfg.pre_multiplied_alpha 설정enum mpcc_alpha_blend_mode 선택MPCC_ALPHA_MULTIPLIED_MODE와 MPCC_ALPHA_BLND_MODE programming

DM이 DRM semantic을 DC의 OS-agnostic structure로 번역합니다.


The DRM blend mode and its elements are then mapped by AMDGPU display manager
(DM) to program the blending configuration of the Multiple Pipe/Plane Combined
(MPC), as follows:

.. kernel-doc:: drivers/gpu/drm/amd/display/dc/inc/hw/mpc.h
   :identifiers: mpcc_blnd_cfg

Therefore, the blending configuration for a single MPCC instance on the MPC
tree is defined by :c:type:`mpcc_blnd_cfg`, where
:c:type:`pre_multiplied_alpha` is the alpha pre-multiplied mode flag used to
set :c:type:`MPCC_ALPHA_MULTIPLIED_MODE`. It controls whether alpha is
multiplied (true/false), being only true for DRM pre-multiplied blend mode.
:c:type:`mpcc_alpha_blend_mode` defines the alpha blend mode regarding pixel
alpha and plane alpha values. It sets one of the three modes for
:c:type:`MPCC_ALPHA_BLND_MODE`, as described below.

.. kernel-doc:: drivers/gpu/drm/amd/display/dc/inc/hw/mpc.h
   :identifiers: mpcc_alpha_blend_mode

Pixel alpha, global alpha와 global gain

149-165

MPC pixel alpha는 DRM의 `fg.alpha`와 같습니다. MPC global alpha는 pixel alpha를 무시하고 pixel value가 pre-multiplied되지 않은 경우 DRM `plane_alpha`에 대응합니다. DRM `fg.alpha`와 `plane_alpha`가 모두 blend equation에 참여하면 MPC global gain이 global alpha 값을 사용합니다.

DRM과 MPC alpha 요소 mapping
DRM 요소MPC 요소사용 조건
fg.alphaMPC pixel alphaPlane pixel마다 저장된 alpha를 blend에 사용
plane_alphaMPC global alphaPixel alpha를 무시하는 global plane opacity
plane_alpha와 fg.alphaMPC global gain + pixel alpha두 값을 함께 곱해 per-pixel contribution 조정

같은 alpha라는 이름이 pixel, plane, gain 위치에서 다르게 쓰입니다.

MPCC mode 선택 결과
선택결과
MPCC_ALPHA_BLEND_MODE_GLOBAL_ALPHAfg.alpha를 무시하고 global alpha 사용
MPCC_ALPHA_BLEND_MODE_PER_PIXEL_ALPHA_COMBINED_GLOBAL_GAINplane_alpha * fg.alpha component 사용
MPCC_ALPHA_MULTIPLIED_MODEPixel color가 alpha로 pre-multiplied되었는지 정의

원문이 명시한 두 alpha mode와 premultiplication flag입니다.

따라서 blend mode mapping은 alpha source 선택과 RGB premultiplication 여부를 별도로 정해야 합니다. 이 둘을 혼동하면 같은 alpha 값에서도 foreground color contribution이 달라집니다.

DM then maps the elements of `enum mpcc_alpha_blend_mode` to those in the DRM
blend formula, as follows:

* *MPC pixel alpha* matches *DRM fg.alpha* as the alpha component value
  from the plane's pixel
* *MPC global alpha* matches *DRM plane_alpha* when the pixel alpha should
  be ignored and, therefore, pixel values are not pre-multiplied
* *MPC global gain* assumes *MPC global alpha* value when both *DRM
  fg.alpha* and *DRM plane_alpha* participate in the blend equation

In short, *fg.alpha* is ignored by selecting
:c:type:`MPCC_ALPHA_BLEND_MODE_GLOBAL_ALPHA`. On the other hand, (plane_alpha *
fg.alpha) component becomes available by selecting
:c:type:`MPCC_ALPHA_BLEND_MODE_PER_PIXEL_ALPHA_COMBINED_GLOBAL_GAIN`. And the
:c:type:`MPCC_ALPHA_MULTIPLIED_MODE` defines if the pixel color values are
pre-multiplied by alpha or not.

Blend configuration flow

166-180

Alpha blending equation은 DRM plane state에서 DM을 거쳐 DC interface의 MPCC configuration으로 전달됩니다. 이 경로에서는 Linux-specific `drm_plane_state`를 OS-agnostic `dc_plane_info`로 바꾸는 경계가 핵심입니다.

DRM에서 DC까지 blend configuration
drm_plane_state update에 pixel_blend_mode, alpha와 format 저장DM이 amdgpu_dm_plane_fill_blending_from_plane_state() 호출drm_plane_state attribute를 dc_plane_info로 mappingOS-agnostic DC가 DPP input의 dc_plane_info 처리struct mpcc_blnd_cfg가 MPCC blend configuration 생성MPC tree의 해당 MPCC instance를 program

원문의 두 단계를 호출과 structure 단위로 펼쳤습니다.

Blend state ownership 경계
Structure/function계층책임
drm_plane_stateDRM/KMSUserspace atomic property와 plane state 보유
amdgpu_dm_plane_fill_blending_from_plane_state()AMDGPU DMDRM attribute를 DC representation으로 변환
dc_plane_infoDisplay CoreOS-agnostic plane format과 blending input
mpcc_blnd_cfgDC hardware abstractionMPCC alpha mode와 premultiplication programming

각 structure가 속한 계층과 다음 전달 대상을 구분합니다.

Blend configuration flow
------------------------

The alpha blending equation is configured from DRM to DC interface by the
following path:

1. When updating a :c:type:`drm_plane_state <drm_plane_state>`, DM calls
   :c:type:`amdgpu_dm_plane_fill_blending_from_plane_state()` that maps
   :c:type:`drm_plane_state <drm_plane_state>` attributes to
   :c:type:`dc_plane_info <dc_plane_info>` struct to be handled in the
   OS-agnostic component (DC).

2. On DC interface, :c:type:`struct mpcc_blnd_cfg <mpcc_blnd_cfg>` programs the
   MPCC blend configuration considering the :c:type:`dc_plane_info
   <dc_plane_info>` input from DPP.