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

Linux 6.18.37 · GPU

Multiplane Overlay (MPO)

DRM atomic MPO, PIP underlay, cursor와 multi-display pipe 제한의 전문 번역입니다.

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

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

1. 요약·해설

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

요약·해설

mpo-overview.rst:1-242

MPO가 shader composition을 display controller의 fixed-function hardware로 옮겨 전력을 줄이는 원리부터 DRM atomic plane model, AMD cursor 연결, PIP underlay, IGT 검증과 multi-display pipe 한계까지 설명합니다. 네 원본 SVG의 관계와 모든 수치·property·test 이름을 구조화해 전문 번역과 함께 보존했습니다.

MPO configuration 핵심 점검표
단계확인 항목핵심 조건
1ASIC resource사용 가능한 pipe, plane, CRTC와 connector 수
2Plane 유형과 formatYUV primary, ARGB8888/XRGB8888 overlay
3위치와 scaleCRTC rectangle 내부, 0.25x-16x
4Underlay compositionNative-size overlay와 alpha 0 cutout
5CursorParent plane scale·color 상속, legacy API 회피
6Multiple displayVideo가 경계를 넘을 때 추가 MPO pipe와 compositor policy

Atomic commit을 만들기 전에 resource와 property를 이 순서로 확인합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 ========================
2 Multiplane Overlay (MPO)
3 ========================
4
5 .. note:: You will get more from this page if you have already read the
6 'Documentation/gpu/amdgpu/display/dcn-overview.rst'.
7
8
9 Multiplane Overlay (MPO) allows for multiple framebuffers to be composited via
10 fixed-function hardware in the display controller rather than using graphics or
11 compute shaders for composition. This can yield some power savings if it means
12 the graphics/compute pipelines can be put into low-power states. In summary,
13 MPO can bring the following benefits:
14
15 * Decreased GPU and CPU workload - no composition shaders needed, no extra
16 buffer copy needed, GPU can remain idle.
17 * Plane independent page flips - No need to be tied to global compositor
18 page-flip present rate, reduced latency, independent timing.
19
20 .. note:: Keep in mind that MPO is all about power-saving; if you want to learn
21 more about power-save in the display context, check the link:
22 `Power <https://gitlab.freedesktop.org/pq/color-and-hdr/-/blob/main/doc/power.rst>`__.
23
24 Multiplane Overlay is only available using the DRM atomic model. The atomic
25 model only uses a single userspace IOCTL for configuring the display hardware
26 (modesetting, page-flipping, etc) - drmModeAtomicCommit. To query hardware
27 resources and limitations userspace also calls into drmModeGetResources which
28 reports back the number of planes, CRTCs, and connectors. There are three types
29 of DRM planes that the driver can register and work with:
30
31 * ``DRM_PLANE_TYPE_PRIMARY``: Primary planes represent a "main" plane for a
32 CRTC, primary planes are the planes operated upon by CRTC modesetting and
33 flipping operations.
34 * ``DRM_PLANE_TYPE_CURSOR``: Cursor planes represent a "cursor" plane for a
35 CRTC. Cursor planes are the planes operated upon by the cursor IOCTLs
36 * ``DRM_PLANE_TYPE_OVERLAY``: Overlay planes represent all non-primary,
37 non-cursor planes. Some drivers refer to these types of planes as "sprites"
38 internally.
39
40 To illustrate how it works, let's take a look at a device that exposes the
41 following planes to userspace:
42
43 * 4 Primary planes (1 per CRTC).
44 * 4 Cursor planes (1 per CRTC).
45 * 1 Overlay plane (shared among CRTCs).
46
47 .. note:: Keep in mind that different ASICs might expose other numbers of
48 planes.
49
50 For this hardware example, we have 4 pipes (if you don't know what AMD pipe
51 means, look at 'Documentation/gpu/amdgpu/display/dcn-overview.rst', section
52 "AMD Hardware Pipeline"). Typically most AMD devices operate in a pipe-split
53 configuration for optimal single display output (e.g., 2 pipes per plane).
54
55 A typical MPO configuration from userspace - 1 primary + 1 overlay on a single
56 display - will see 4 pipes in use, 2 per plane.
57
58 At least 1 pipe must be used per plane (primary and overlay), so for this
59 hypothetical hardware that we are using as an example, we have an absolute
60 limit of 4 planes across all CRTCs. Atomic commits will be rejected for display
61 configurations using more than 4 planes. Again, it is important to stress that
62 every DCN has different restrictions; here, we are just trying to provide the
63 concept idea.
64
65 Plane Restrictions
66 ==================
67
68 AMDGPU imposes restrictions on the use of DRM planes in the driver.
69
70 Atomic commits will be rejected for commits which do not follow these
71 restrictions:
72
73 * Overlay planes must be in ARGB8888 or XRGB8888 format
74 * Planes cannot be placed outside of the CRTC destination rectangle
75 * Planes cannot be downscaled more than 1/4x of their original size
76 * Planes cannot be upscaled more than 16x of their original size
77
78 Not every property is available on every plane:
79
80 * Only primary planes have color-space and non-RGB format support
81 * Only overlay planes have alpha blending support
82
83 Cursor Restrictions
84 ===================
85
86 Before we start to describe some restrictions around cursor and MPO, see the
87 below image:
88
89 .. kernel-figure:: mpo-cursor.svg
90
91 The image on the left side represents how DRM expects the cursor and planes to
92 be blended. However, AMD hardware handles cursors differently, as you can see
93 on the right side; basically, our cursor cannot be drawn outside its associated
94 plane as it is being treated as part of the plane. Another consequence of that
95 is that cursors inherit the color and scale from the plane.
96
97 As a result of the above behavior, do not use legacy API to set up the cursor
98 plane when working with MPO; otherwise, you might encounter unexpected
99 behavior.
100
101 In short, AMD HW has no dedicated cursor planes. A cursor is attached to
102 another plane and therefore inherits any scaling or color processing from its
103 parent plane.
104
105 Use Cases
106 =========
107
108 Picture-in-Picture (PIP) playback - Underlay strategy
109 -----------------------------------------------------
110
111 Video playback should be done using the "primary plane as underlay" MPO
112 strategy. This is a 2 planes configuration:
113
114 * 1 YUV DRM Primary Plane (e.g. NV12 Video)
115 * 1 RGBA DRM Overlay Plane (e.g. ARGB8888 desktop). The compositor should
116 prepare the framebuffers for the planes as follows:
117 - The overlay plane contains general desktop UI, video player controls, and video subtitles
118 - Primary plane contains one or more videos
119
120 .. note:: Keep in mind that we could extend this configuration to more planes,
121 but that is currently not supported by our driver yet (maybe if we have a
122 userspace request in the future, we can change that).
123
124 See below a single-video example:
125
126 .. kernel-figure:: single-display-mpo.svg
127
128 .. note:: We could extend this behavior to more planes, but that is currently
129 not supported by our driver.
130
131 The video buffer should be used directly for the primary plane. The video can
132 be scaled and positioned for the desktop using the properties: CRTC_X, CRTC_Y,
133 CRTC_W, and CRTC_H. The primary plane should also have the color encoding and
134 color range properties set based on the source content:
135
136 * ``COLOR_RANGE``, ``COLOR_ENCODING``
137
138 The overlay plane should be the native size of the CRTC. The compositor must
139 draw a transparent cutout for where the video should be placed on the desktop
140 (i.e., set the alpha to zero). The primary plane video will be visible through
141 the underlay. The overlay plane's buffer may remain static while the primary
142 plane's framebuffer is used for standard double-buffered playback.
143
144 The compositor should create a YUV buffer matching the native size of the CRTC.
145 Each video buffer should be composited onto this YUV buffer for direct YUV
146 scanout. The primary plane should have the color encoding and color range
147 properties set based on the source content: ``COLOR_RANGE``,
148 ``COLOR_ENCODING``. However, be mindful that the source color space and
149 encoding match for each video since it affect the entire plane.
150
151 The overlay plane should be the native size of the CRTC. The compositor must
152 draw a transparent cutout for where each video should be placed on the desktop
153 (i.e., set the alpha to zero). The primary plane videos will be visible through
154 the underlay. The overlay plane's buffer may remain static while compositing
155 operations for video playback will be done on the video buffer.
156
157 This kernel interface is validated using IGT GPU Tools. The following tests can
158 be run to validate positioning, blending, scaling under a variety of sequences
159 and interactions with operations such as DPMS and S3:
160
161 - ``kms_plane@plane-panning-bottom-right-pipe-*-planes``
162 - ``kms_plane@plane-panning-bottom-right-suspend-pipe-*-``
163 - ``kms_plane@plane-panning-top-left-pipe-*-``
164 - ``kms_plane@plane-position-covered-pipe-*-``
165 - ``kms_plane@plane-position-hole-dpms-pipe-*-``
166 - ``kms_plane@plane-position-hole-pipe-*-``
167 - ``kms_plane_multiple@atomic-pipe-*-tiling-``
168 - ``kms_plane_scaling@pipe-*-plane-scaling``
169 - ``kms_plane_alpha_blend@pipe-*-alpha-basic``
170 - ``kms_plane_alpha_blend@pipe-*-alpha-transparant-fb``
171 - ``kms_plane_alpha_blend@pipe-*-alpha-opaque-fb``
172 - ``kms_plane_alpha_blend@pipe-*-constant-alpha-min``
173 - ``kms_plane_alpha_blend@pipe-*-constant-alpha-mid``
174 - ``kms_plane_alpha_blend@pipe-*-constant-alpha-max``
175
176 Multiple Display MPO
177 --------------------
178
179 AMDGPU supports display MPO when using multiple displays; however, this feature
180 behavior heavily relies on the compositor implementation. Keep in mind that
181 userspace can define different policies. For example, some OSes can use MPO to
182 protect the plane that handles the video playback; notice that we don't have
183 many limitations for a single display. Nonetheless, this manipulation can have
184 many more restrictions for a multi-display scenario. The below example shows a
185 video playback in the middle of two displays, and it is up to the compositor to
186 define a policy on how to handle it:
187
188 .. kernel-figure:: multi-display-hdcp-mpo.svg
189
190 Let's discuss some of the hardware limitations we have when dealing with
191 multi-display with MPO.
192
193 Limitations
194 ~~~~~~~~~~~
195
196 For simplicity's sake, for discussing the hardware limitation, this
197 documentation supposes an example where we have two displays and video playback
198 that will be moved around different displays.
199
200 * **Hardware limitations**
201
202 From the DCN overview page, each display requires at least one pipe and each
203 MPO plane needs another pipe. As a result, when the video is in the middle of
204 the two displays, we need to use 2 pipes. See the example below where we avoid
205 pipe split:
206
207 - 1 display (1 pipe) + MPO (1 pipe), we will use two pipes
208 - 2 displays (2 pipes) + MPO (1-2 pipes); we will use 4 pipes. MPO in the
209 middle of both displays needs 2 pipes.
210 - 3 Displays (3 pipes) + MPO (1-2 pipes), we need 5 pipes.
211
212 If we use MPO with multiple displays, the userspace has to decide to enable
213 multiple MPO by the price of limiting the number of external displays supported
214 or disable it in favor of multiple displays; it is a policy decision. For
215 example:
216
217 * When ASIC has 3 pipes, AMD hardware can NOT support 2 displays with MPO
218 * When ASIC has 4 pipes, AMD hardware can NOT support 3 displays with MPO
219
220 Let's briefly explore how userspace can handle these two display configurations
221 on an ASIC that only supports three pipes. We can have:
222
223 .. kernel-figure:: multi-display-hdcp-mpo-less-pipe-ex.svg
224
225 - Total pipes are 3
226 - User lights up 2 displays (2 out of 3 pipes are used)
227 - User launches video (1 pipe used for MPO)
228 - Now, if the user moves the video in the middle of 2 displays, one part of the
229 video won't be MPO since we have used 3/3 pipes.
230
231 * **Scaling limitation**
232
233 MPO cannot handle scaling less than 0.25 and more than x16. For example:
234
235 If 4k video (3840x2160) is playing in windowed mode, the physical size of the
236 window cannot be smaller than (960x540).
237
238 .. note:: These scaling limitations might vary from ASIC to ASIC.
239
240 * **Size Limitation**
241
242 The minimum MPO size is 12px.
243

3. 한국어 전문 번역

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

MPO 목적과 DRM atomic model

1-64

Multiplane Overlay(MPO)는 여러 framebuffer를 graphics 또는 compute shader로 합성하지 않고 display controller의 fixed-function hardware에서 합성합니다. 그 결과 별도 composition shader와 buffer copy가 필요하지 않아 GPU와 CPU 부하가 줄고, graphics/compute pipeline을 저전력 상태에 둘 수 있습니다. 각 plane은 global compositor의 page-flip present rate에 묶이지 않고 독립적인 timing으로 page flip할 수 있으므로 latency도 줄일 수 있습니다.

MPO가 제공하는 두 이점
이점제거되는 작업동작 효과
GPU·CPU workload 감소Composition shader와 추가 buffer copyGPU idle 유지와 pipeline 저전력 진입 가능
Plane 독립 page flipGlobal compositor present rate 종속독립 timing과 낮은 latency

MPO의 중심 목적은 기능 추가보다 display 경로의 전력 절감입니다.

MPO는 DRM atomic model에서만 사용할 수 있습니다. Userspace는 `drmModeAtomicCommit` 한 번으로 modesetting, page-flipping 등 display hardware configuration을 제출하고, `drmModeGetResources`로 plane, CRTC, connector의 개수와 resource 제한을 조회합니다.

DRM atomic MPO 설정 흐름
drmModeGetResources로 plane, CRTC, connector inventory 조회Primary, cursor, overlay plane의 framebuffer와 property 구성drmModeAtomicCommit으로 하나의 atomic transaction 제출AMDGPU가 format, rectangle, scaling, pipe resource를 함께 검증모든 조건을 만족하면 DCN hardware state로 적용조건 하나라도 위반하면 atomic commit 전체 거부

Userspace가 resource를 확인한 뒤 하나의 atomic state로 여러 plane을 제출합니다.

DRM plane 유형
상수의미주요 조작
DRM_PLANE_TYPE_PRIMARYCRTC의 main planeCRTC modesetting과 flipping operation
DRM_PLANE_TYPE_CURSORCRTC의 cursor planeCursor IOCTL
DRM_PLANE_TYPE_OVERLAYPrimary와 cursor가 아닌 모든 plane일부 driver 내부에서는 sprite라고 부름

Driver가 등록하고 userspace가 atomic state에 배치하는 세 plane 유형입니다.

원문 예시 ASIC은 CRTC마다 primary 1개와 cursor 1개를 제공해 각각 4개이며, 모든 CRTC가 공유하는 overlay 1개를 제공합니다. 실제 plane 개수는 ASIC마다 달라집니다. 예시 hardware에는 pipe 4개가 있고 일반적인 AMD single-display configuration은 plane 하나에 pipe 2개를 쓰는 pipe-split을 사용할 수 있습니다.

예시 ASIC의 resource와 절대 한계
항목노출 또는 사용량해석
Primary plane4개, CRTC당 1개Main scanout plane
Cursor plane4개, CRTC당 1개DRM object로 노출되지만 AMD HW 연결 제약 존재
Overlay plane1개, CRTC 사이 공유MPO 추가 layer
Hardware pipe총 4개모든 CRTC를 합쳐 동시에 쓸 수 있는 plane의 절대 상한 4개
일반적인 single-display MPOPrimary 2 pipes + overlay 2 pipesPipe-split이면 4개 pipe 모두 사용

Plane 개수와 실제 동시 사용 가능 plane 수는 같지 않으며, pipe budget이 최종 한계를 정합니다.

각 primary 또는 overlay plane은 최소 pipe 1개를 필요로 합니다. 따라서 이 가상 hardware에서는 모든 CRTC를 합쳐 최대 4개 plane만 활성화할 수 있고, 이를 넘는 atomic commit은 거부됩니다. 이 숫자는 개념 예시일 뿐이며 실제 제한은 DCN 세대와 ASIC마다 다릅니다.

========================
Multiplane Overlay (MPO)
========================

.. note:: You will get more from this page if you have already read the
   'Documentation/gpu/amdgpu/display/dcn-overview.rst'.


Multiplane Overlay (MPO) allows for multiple framebuffers to be composited via
fixed-function hardware in the display controller rather than using graphics or
compute shaders for composition. This can yield some power savings if it means
the graphics/compute pipelines can be put into low-power states. In summary,
MPO can bring the following benefits:

* Decreased GPU and CPU workload - no composition shaders needed, no extra
  buffer copy needed, GPU can remain idle.
* Plane independent page flips - No need to be tied to global compositor
  page-flip present rate, reduced latency, independent timing.

.. note:: Keep in mind that MPO is all about power-saving; if you want to learn
   more about power-save in the display context, check the link:
   `Power <https://gitlab.freedesktop.org/pq/color-and-hdr/-/blob/main/doc/power.rst>`__.

Multiplane Overlay is only available using the DRM atomic model. The atomic
model only uses a single userspace IOCTL for configuring the display hardware
(modesetting, page-flipping, etc) - drmModeAtomicCommit. To query hardware
resources and limitations userspace also calls into drmModeGetResources which
reports back the number of planes, CRTCs, and connectors. There are three types
of DRM planes that the driver can register and work with:

* ``DRM_PLANE_TYPE_PRIMARY``: Primary planes represent a "main" plane for a
  CRTC, primary planes are the planes operated upon by CRTC modesetting and
  flipping operations.
* ``DRM_PLANE_TYPE_CURSOR``: Cursor planes represent a "cursor" plane for a
  CRTC. Cursor planes are the planes operated upon by the cursor IOCTLs
* ``DRM_PLANE_TYPE_OVERLAY``: Overlay planes represent all non-primary,
  non-cursor planes. Some drivers refer to these types of planes as "sprites"
  internally.

To illustrate how it works, let's take a look at a device that exposes the
following planes to userspace:

* 4 Primary planes (1 per CRTC).
* 4 Cursor planes (1 per CRTC).
* 1 Overlay plane (shared among CRTCs).

.. note:: Keep in mind that different ASICs might expose other numbers of
   planes.

For this hardware example, we have 4 pipes (if you don't know what AMD pipe
means, look at 'Documentation/gpu/amdgpu/display/dcn-overview.rst', section
"AMD Hardware Pipeline"). Typically most AMD devices operate in a pipe-split
configuration for optimal single display output (e.g., 2 pipes per plane).

A typical MPO configuration from userspace - 1 primary + 1 overlay on a single
display - will see 4 pipes in use, 2 per plane.

At least 1 pipe must be used per plane (primary and overlay), so for this
hypothetical hardware that we are using as an example, we have an absolute
limit of 4 planes across all CRTCs. Atomic commits will be rejected for display
configurations using more than 4 planes. Again, it is important to stress that
every DCN has different restrictions; here, we are just trying to provide the
concept idea.

Plane format, 위치와 scaling 제한

65-82

AMDGPU는 atomic commit 단계에서 plane format, destination rectangle과 scaling ratio를 검증합니다. 제한을 따르지 않는 commit은 부분 적용되지 않고 전체가 거부됩니다.

Atomic commit을 거부하는 plane 조건
검사 항목허용 조건거부 예
Overlay formatARGB8888 또는 XRGB8888다른 pixel format의 overlay
Destination 위치CRTC destination rectangle 내부Plane 일부 또는 전체가 CRTC rectangle 밖에 위치
Downscale원래 크기의 1/4x 이상0.25x보다 작은 결과
Upscale원래 크기의 16x 이하16x를 넘는 결과

원문의 수치와 format 이름을 그대로 보존했습니다.

Plane별 property 범위
Plane지원 property제약 의미
PrimaryColor-space와 non-RGB formatYUV video 및 source color property를 primary에 배치
OverlayAlpha blendingDesktop UI에 transparent cutout을 만들 수 있음
Cursor독립 color/scale processing이 아님AMD hardware에서 parent plane 처리를 상속

모든 property가 모든 plane에 제공되지는 않습니다.

Plane Restrictions
==================

AMDGPU imposes restrictions on the use of DRM planes in the driver.

Atomic commits will be rejected for commits which do not follow these
restrictions:

* Overlay planes must be in ARGB8888 or XRGB8888 format
* Planes cannot be placed outside of the CRTC destination rectangle
* Planes cannot be downscaled more than 1/4x of their original size
* Planes cannot be upscaled more than 16x of their original size

Not every property is available on every plane:

* Only primary planes have color-space and non-RGB format support
* Only overlay planes have alpha blending support

AMD cursor 연결 제약

83-104

`mpo-cursor.svg`의 왼쪽은 DRM이 cursor와 Plane 1, Plane 2를 독립 object로 합성해 CRTC로 보내는 모델을 나타냅니다. 오른쪽 AMD hardware에서는 cursor가 독립 hardware plane이 아니라 다른 plane에 붙고, 그 parent plane이 CRTC로 연결됩니다.

mpo-cursor.svg 구조화 도식
DRM 기대: Cursor -> CRTCDRM 기대: Plane 1 -> CRTCDRM 기대: Plane 2 -> CRTCAMD Hardware: Cursor -> associated Plane 1AMD Hardware: Plane 1 -> CRTCAMD Hardware: Plane 2 -> CRTC

원본 그림의 DRM 모델과 AMD Hardware 모델을 나란히 비교한 관계입니다.

Cursor가 parent plane에서 상속하는 동작
제약원인영향
Parent plane 밖에 cursor를 그릴 수 없음Cursor가 plane 일부로 처리됨Plane boundary를 넘는 cursor가 잘리거나 예상과 다르게 표시될 수 있음
Scaling 상속Dedicated cursor plane 부재Parent plane scale이 cursor에도 적용
Color processing 상속Cursor가 parent processing path를 공유Parent의 color 변환 결과가 cursor에 반영
Legacy cursor API 회피MPO atomic 관계를 표현하지 못할 수 있음MPO 사용 시 unexpected behavior 가능

Cursor가 associated plane 밖으로 독립 이동하거나 별도 처리된다고 가정하면 결과가 달라집니다.

따라서 MPO 구성에서는 legacy API로 cursor plane을 설정하지 않아야 합니다. AMD hardware에는 dedicated cursor plane이 없으며 cursor는 parent plane의 scaling과 color processing을 상속한다는 사실이 핵심입니다.

Cursor Restrictions
===================

Before we start to describe some restrictions around cursor and MPO, see the
below image:

.. kernel-figure:: mpo-cursor.svg

The image on the left side represents how DRM expects the cursor and planes to
be blended. However, AMD hardware handles cursors differently, as you can see
on the right side; basically, our cursor cannot be drawn outside its associated
plane as it is being treated as part of the plane. Another consequence of that
is that cursors inherit the color and scale from the plane.

As a result of the above behavior, do not use legacy API to set up the cursor
plane when working with MPO; otherwise, you might encounter unexpected
behavior.

In short, AMD HW has no dedicated cursor planes. A cursor is attached to
another plane and therefore inherits any scaling or color processing from its
parent plane.

PIP primary-underlay 구성과 IGT 검증

105-175

Picture-in-Picture(PIP) video playback은 `primary plane as underlay` 전략을 사용합니다. YUV primary plane이 video를 직접 scanout하고, RGBA overlay plane이 desktop UI, player control과 subtitle을 담습니다. 현재 driver는 이 기본 2-plane 구성을 지원하며 더 많은 plane으로의 확장은 아직 지원하지 않습니다.

PIP 2-plane framebuffer 구성
Plane예시 formatBuffer 내용처리
DRM Primary PlaneYUV, 예: NV12하나 이상의 videoDirect YUV scanout, source에 맞춘 COLOR_RANGE와 COLOR_ENCODING
DRM Overlay PlaneRGBA, 예: ARGB8888Desktop UI, video control, subtitleVideo 위치의 alpha를 0으로 만든 transparent cutout

Video와 desktop을 어느 plane에 배치하는지가 format과 property 지원 범위에 맞아야 합니다.

single-display-mpo.svg의 underlay 경로
Video Buffer (YUV) -> DRM PRIMARY PLANEDesktop Buffer (ARGB) -> DRM OVERLAY PLANEOverlay에서 video rectangle alpha를 0으로 설정Hardware Composition이 primary video를 transparent cutout 아래에서 합성합성 결과 -> CRTC Output

원본 SVG의 label과 hardware composition 관계를 순서대로 보존했습니다.

Single-video에서는 video buffer를 primary plane에 직접 사용하고 `CRTC_X`, `CRTC_Y`, `CRTC_W`, `CRTC_H`로 desktop 안의 위치와 크기를 정합니다. Primary에는 source content에 맞춘 `COLOR_RANGE`, `COLOR_ENCODING`도 설정해야 합니다. Overlay는 CRTC native size여야 하며, desktop buffer는 정적으로 유지하면서 primary framebuffer만 standard double buffering으로 교체할 수 있습니다.

여러 video를 한 primary plane에 담을 때 compositor는 CRTC native size의 YUV buffer를 만들고 각 video buffer를 여기에 합성해 direct YUV scanout합니다. Plane 전체가 하나의 `COLOR_RANGE`와 `COLOR_ENCODING`을 사용하므로 모든 source의 color space와 encoding이 서로 맞아야 합니다. Overlay 역시 CRTC native size를 사용하고 각 video 위치에 transparent cutout을 만듭니다.

PIP atomic property 점검
대상Property 또는 조건역할
Primary 위치·크기CRTC_X, CRTC_Y, CRTC_W, CRTC_HVideo를 desktop 좌표에 배치하고 scale
Primary colorCOLOR_RANGE, COLOR_ENCODINGYUV source의 range와 encoding 지정
Overlay 크기CRTC native sizeDesktop 전체를 덮는 RGBA surface
Overlay video 영역Alpha = 0아래 primary video가 보이는 transparent cutout
여러 video동일한 source color space와 encodingPlane 전체 color property와 충돌 방지

좌표, color와 overlay transparency를 함께 맞춰야 underlay가 올바르게 보입니다.

IGT GPU Tools 검증 목록
범주Test
Panningkms_plane@plane-panning-bottom-right-pipe-*-planes
Panning + suspendkms_plane@plane-panning-bottom-right-suspend-pipe-*-
Panningkms_plane@plane-panning-top-left-pipe-*-
Positionkms_plane@plane-position-covered-pipe-*-
Position + DPMSkms_plane@plane-position-hole-dpms-pipe-*-
Positionkms_plane@plane-position-hole-pipe-*-
Multiple planekms_plane_multiple@atomic-pipe-*-tiling-
Scalingkms_plane_scaling@pipe-*-plane-scaling
Alphakms_plane_alpha_blend@pipe-*-alpha-basic
Alphakms_plane_alpha_blend@pipe-*-alpha-transparant-fb
Alphakms_plane_alpha_blend@pipe-*-alpha-opaque-fb
Constant alphakms_plane_alpha_blend@pipe-*-constant-alpha-min
Constant alphakms_plane_alpha_blend@pipe-*-constant-alpha-mid
Constant alphakms_plane_alpha_blend@pipe-*-constant-alpha-max

Positioning, blending, scaling, DPMS와 S3 상호작용을 검증하는 원문 test 14개입니다.

Use Cases
=========

Picture-in-Picture (PIP) playback - Underlay strategy
-----------------------------------------------------

Video playback should be done using the "primary plane as underlay" MPO
strategy. This is a 2 planes configuration:

* 1 YUV DRM Primary Plane (e.g. NV12 Video)
* 1 RGBA DRM Overlay Plane (e.g. ARGB8888 desktop). The compositor should
  prepare the framebuffers for the planes as follows:
  - The overlay plane contains general desktop UI, video player controls, and video subtitles
  - Primary plane contains one or more videos

.. note:: Keep in mind that we could extend this configuration to more planes,
   but that is currently not supported by our driver yet (maybe if we have a
   userspace request in the future, we can change that).

See below a single-video example:

.. kernel-figure:: single-display-mpo.svg

.. note:: We could extend this behavior to more planes, but that is currently
   not supported by our driver.

The video buffer should be used directly for the primary plane. The video can
be scaled and positioned for the desktop using the properties: CRTC_X, CRTC_Y,
CRTC_W, and CRTC_H. The primary plane should also have the color encoding and
color range properties set based on the source content:

* ``COLOR_RANGE``, ``COLOR_ENCODING``

The overlay plane should be the native size of the CRTC. The compositor must
draw a transparent cutout for where the video should be placed on the desktop
(i.e., set the alpha to zero). The primary plane video will be visible through
the underlay. The overlay plane's buffer may remain static while the primary
plane's framebuffer is used for standard double-buffered playback.

The compositor should create a YUV buffer matching the native size of the CRTC.
Each video buffer should be composited onto this YUV buffer for direct YUV
scanout. The primary plane should have the color encoding and color range
properties set based on the source content: ``COLOR_RANGE``,
``COLOR_ENCODING``. However, be mindful that the source color space and
encoding match for each video since it affect the entire plane.

The overlay plane should be the native size of the CRTC. The compositor must
draw a transparent cutout for where each video should be placed on the desktop
(i.e., set the alpha to zero). The primary plane videos will be visible through
the underlay. The overlay plane's buffer may remain static while compositing
operations for video playback will be done on the video buffer.

This kernel interface is validated using IGT GPU Tools. The following tests can
be run to validate positioning, blending, scaling under a variety of sequences
and interactions with operations such as DPMS and S3:

- ``kms_plane@plane-panning-bottom-right-pipe-*-planes``
- ``kms_plane@plane-panning-bottom-right-suspend-pipe-*-``
- ``kms_plane@plane-panning-top-left-pipe-*-``
- ``kms_plane@plane-position-covered-pipe-*-``
- ``kms_plane@plane-position-hole-dpms-pipe-*-``
- ``kms_plane@plane-position-hole-pipe-*-``
- ``kms_plane_multiple@atomic-pipe-*-tiling-``
- ``kms_plane_scaling@pipe-*-plane-scaling``
- ``kms_plane_alpha_blend@pipe-*-alpha-basic``
- ``kms_plane_alpha_blend@pipe-*-alpha-transparant-fb``
- ``kms_plane_alpha_blend@pipe-*-alpha-opaque-fb``
- ``kms_plane_alpha_blend@pipe-*-constant-alpha-min``
- ``kms_plane_alpha_blend@pipe-*-constant-alpha-mid``
- ``kms_plane_alpha_blend@pipe-*-constant-alpha-max``

Multiple-display MPO와 compositor policy

176-191

AMDGPU는 multiple-display MPO를 지원하지만 실제 동작은 compositor policy에 크게 의존합니다. Userspace는 video playback plane 보호 같은 정책을 정할 수 있으며, single display에서는 적었던 제약이 video가 여러 display에 걸치면 크게 늘어납니다.

multi-display-hdcp-mpo.svg 구조화 도식
왼쪽 Desktop과 오른쪽 Desktop을 각각 CRTC가 scanoutVideo가 두 display 경계에 걸쳐 위치각 display가 담당하는 video 조각에 Protected MPO plane 필요충분한 pipe가 있으면 양쪽 조각을 hardware MPO로 표시Pipe가 부족하면 userspace가 MPO 범위 축소, software composition 또는 display 수 제한 중 정책 선택

두 desktop 경계에 걸친 protected video를 어떻게 처리할지는 compositor가 결정합니다.

`multi-display-hdcp-mpo.svg`는 video가 두 display 중앙에 걸친 경우를 보여 줍니다. Kernel이 하나의 보편 정책을 강제하는 것이 아니라 compositor가 보호 plane, 사용 가능한 pipe와 display topology를 고려해 처리 방법을 결정해야 합니다.

Multiple Display MPO
--------------------

AMDGPU supports display MPO when using multiple displays; however, this feature
behavior heavily relies on the compositor implementation. Keep in mind that
userspace can define different policies. For example, some OSes can use MPO to
protect the plane that handles the video playback; notice that we don't have
many limitations for a single display. Nonetheless, this manipulation can have
many more restrictions for a multi-display scenario. The below example shows a
video playback in the middle of two displays, and it is up to the compositor to
define a policy on how to handle it:

.. kernel-figure:: multi-display-hdcp-mpo.svg

Let's discuss some of the hardware limitations we have when dealing with
multi-display with MPO.

Pipe budget, scaling과 최소 크기

192-242

Hardware 제한을 설명하기 위해 원문은 두 display 사이를 이동하는 video를 가정합니다. Display 하나마다 최소 pipe 1개가 필요하고 MPO plane에도 추가 pipe가 필요합니다. Video가 두 display에 걸치면 양쪽에 MPO 처리가 필요해 MPO가 pipe 2개를 소비할 수 있습니다.

Pipe split을 피한 resource 계산
구성Display pipesMPO pipes총 필요
1 display + MPO112 pipes
2 displays + MPO21-2경계에 걸치면 4 pipes
3 displays + MPO31-2최대 5 pipes

Display 수와 MPO가 요구하는 최소 pipe를 단순 합산한 원문 예시입니다.

ASIC pipe 수에 따른 불가능한 구성
ASIC resource지원할 수 없는 구성가능한 정책
3 pipes2 displays에서 video가 양쪽에 MPO로 걸치는 구성한쪽을 software composition하거나 MPO 제한
4 pipes3 displays와 MPO를 동시에 모두 hardware 처리외부 display 수 또는 MPO 사용 범위 제한

Userspace는 MPO와 외부 display 수 사이에서 policy를 선택해야 합니다.

multi-display-hdcp-mpo-less-pipe-ex.svg 구조화 도식
Pipe #1과 #2로 두 Desktop 활성화Pipe #3으로 왼쪽의 Protected MPO plane video 처리사용 가능한 pipe가 3/3으로 소진Video를 두 display 중앙으로 이동오른쪽 video 조각은 추가 MPO pipe를 얻지 못함Compositor가 Software Composited Video로 전환하지 않으면 해당 video 조각은 표시되지 않음

3개 pipe가 모두 사용된 뒤 video를 두 display 경계로 이동하는 사례입니다.

MPO scaling ratio는 0.25x 미만과 16x 초과를 처리할 수 없습니다. 예를 들어 3840x2160 4K video의 window는 1/4 크기인 960x540보다 작아질 수 없습니다. 이 scaling 제한은 ASIC마다 달라질 수 있습니다.

MPO 최종 수치 제한
제한예시 또는 의미
Downscale 하한0.25x3840x2160 -> 최소 960x540
Upscale 상한16x원본의 16배를 초과하면 거부
최소 MPO 크기12pxMPO plane의 최소 dimension
Pipe resourceASIC별Plane이 format 조건을 만족해도 pipe가 부족하면 적용 불가

Atomic configuration과 userspace layout에서 함께 확인해야 하는 하한·상한입니다.


Limitations
~~~~~~~~~~~

For simplicity's sake, for discussing the hardware limitation, this
documentation supposes an example where we have two displays and video playback
that will be moved around different displays.

* **Hardware limitations**

From the DCN overview page, each display requires at least one pipe and each
MPO plane needs another pipe. As a result, when the video is in the middle of
the two displays, we need to use 2 pipes. See the example below where we avoid
pipe split:

- 1 display (1 pipe) + MPO (1 pipe), we will use two pipes
- 2 displays (2 pipes) + MPO (1-2 pipes); we will use 4 pipes. MPO in the
  middle of both displays needs 2 pipes.
- 3 Displays (3 pipes) + MPO (1-2 pipes), we need 5 pipes.

If we use MPO with multiple displays, the userspace has to decide to enable
multiple MPO by the price of limiting the number of external displays supported
or disable it in favor of multiple displays; it is a policy decision. For
example:

* When ASIC has 3 pipes, AMD hardware can NOT support 2 displays with MPO
* When ASIC has 4 pipes, AMD hardware can NOT support 3 displays with MPO

Let's briefly explore how userspace can handle these two display configurations
on an ASIC that only supports three pipes. We can have:

.. kernel-figure:: multi-display-hdcp-mpo-less-pipe-ex.svg

- Total pipes are 3
- User lights up 2 displays (2 out of 3 pipes are used)
- User launches video (1 pipe used for MPO)
- Now, if the user moves the video in the middle of 2 displays, one part of the
  video won't be MPO since we have used 3/3 pipes.

* **Scaling limitation**

MPO cannot handle scaling less than 0.25 and more than x16. For example:

If 4k video (3840x2160) is playing in windowed mode, the physical size of the
window cannot be smaller than (960x540).

.. note:: These scaling limitations might vary from ASIC to ASIC.

* **Size Limitation**

The minimum MPO size is 12px.