← Documents Documentation/gpu/amdgpu/display/programming-model-dcn.rst GitHub 원문 ↗

Linux 6.18.37 · GPU

DC Programming Model

DC service layer, object model과 hardware initialization·validation 흐름의 전문 번역입니다.

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

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

1. 요약·해설

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

요약·해설

programming-model-dcn.rst:1-162

DC를 `amdgpu_dm`이 사용하는 공유 display service로 보고, policy와 DML, software layer, 기본 object와 initialization·validation·plane update 순서를 설명합니다. 두 원본 SVG의 layer와 object 관계, 모든 function·structure·source path를 원문 줄 좌표와 함께 보존했습니다.

DC code를 읽는 핵심 질문
질문확인 대상판단 기준
OS policy인가?amdgpu_dmDRM atomic request와 monitor configuration
DC policy인가?Core, DML, pipe_ctxResource 안정성, power와 capability 선택
어떤 state인가?dc_state, dc_stream, dc_planePost/pre-blending 구성과 logical hardware state
언제 hardware를 만지는가?dc_hardware_init 이후dc_create는 software-only
왜 화면이 검은가?Stream과 plane 연결Stream만 활성화되고 plane이 아직 없는지 확인

문제를 조사할 때 object, 책임과 hardware access 시점을 먼저 구분합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 ====================
2 DC Programming Model
3 ====================
4
5 In the :ref:`Display Core Next (DCN) <dcn_overview>` and :ref:`DCN Block
6 <dcn_blocks>` pages, you learned about the hardware components and how they
7 interact with each other. On this page, the focus is shifted to the display
8 code architecture. Hence, it is reasonable to remind the reader that the code
9 in DC is shared with other OSes; for this reason, DC provides a set of
10 abstractions and operations to connect different APIs with the hardware
11 configuration. See DC as a service available for a Display Manager (amdgpu_dm)
12 to access and configure DCN/DCE hardware (DCE is also part of DC, but for
13 simplicity's sake, this documentation only examines DCN).
14
15 .. note::
16 For this page, we will use the term GPU to refers to dGPU and APU.
17
18 Overview
19 ========
20
21 From the display hardware perspective, it is plausible to expect that if a
22 problem is well-defined, it will probably be implemented at the hardware level.
23 On the other hand, when there are multiple ways of achieving something without
24 a very well-defined scope, the solution is usually implemented as a policy at
25 the DC level. In other words, some policies are defined in the DC core
26 (resource management, power optimization, image quality, etc.), and the others
27 implemented in hardware are enabled via DC configuration.
28
29 In terms of hardware management, DCN has multiple instances of the same block
30 (e.g., HUBP, DPP, MPC, etc), and during the driver execution, it might be
31 necessary to use some of these instances. The core has policies in place for
32 handling those instances. Regarding resource management, the DC objective is
33 quite simple: minimize the hardware shuffle when the driver performs some
34 actions. When the state changes from A to B, the transition is considered
35 easier to maneuver if the hardware resource is still used for the same set of
36 driver objects. Usually, adding and removing a resource to a `pipe_ctx` (more
37 details below) is not a problem; however, moving a resource from one `pipe_ctx`
38 to another should be avoided.
39
40 Another area of influence for DC is power optimization, which has a myriad of
41 arrangement possibilities. In some way, just displaying an image via DCN should
42 be relatively straightforward; however, showing it with the best power
43 footprint is more desirable, but it has many associated challenges.
44 Unfortunately, there is no straight-forward analytic way to determine if a
45 configuration is the best one for the context due to the enormous variety of
46 variables related to this problem (e.g., many different DCN/DCE hardware
47 versions, different displays configurations, etc.) for this reason DC
48 implements a dedicated library for trying some configuration and verify if it
49 is possible to support it or not. This type of policy is extremely complex to
50 create and maintain, and amdgpu driver relies on Display Mode Library (DML) to
51 generate the best decisions.
52
53 In summary, DC must deal with the complexity of handling multiple scenarios and
54 determine policies to manage them. All of the above information is conveyed to
55 give the reader some idea about the complexity of driving a display from the
56 driver's perspective. This page hopes to allow the reader to better navigate
57 over the amdgpu display code.
58
59 Display Driver Architecture Overview
60 ====================================
61
62 The diagram below provides an overview of the display driver architecture;
63 notice it illustrates the software layers adopted by DC:
64
65 .. kernel-figure:: dc-components.svg
66
67 The first layer of the diagram is the high-level DC API represented by the
68 `dc.h` file; below it are two big blocks represented by Core and Link. Next is
69 the hardware configuration block; the main file describing it is
70 the`hw_sequencer.h`, where the implementation of the callbacks can be found in
71 the hardware sequencer folder. Almost at the end, you can see the block level
72 API (`dc/inc/hw`), which represents each DCN low-level block, such as HUBP,
73 DPP, MPC, OPTC, etc. Notice on the left side of the diagram that we have a
74 different set of layers representing the interaction with the DMUB
75 microcontroller.
76
77 Basic Objects
78 -------------
79
80 The below diagram outlines the basic display objects. In particular, pay
81 attention to the names in the boxes since they represent a data structure in
82 the driver:
83
84 .. kernel-figure:: dc-arch-overview.svg
85
86 Let's start with the central block in the image, `dc`. The `dc` struct is
87 initialized per GPU; for example, one GPU has one `dc` instance, two GPUs have
88 two `dc` instances, and so forth. In other words we have one 'dc' per 'amdgpu'
89 instance. In some ways, this object behaves like the `Singleton` pattern.
90
91 After the `dc` block in the diagram, you can see the `dc_link` component, which
92 is a low-level abstraction for the connector. One interesting aspect of the
93 image is that connectors are not part of the DCN block; they are defined by the
94 platform/board and not by the SoC. The `dc_link` struct is the high-level data
95 container with information such as connected sinks, connection status, signal
96 types, etc. After `dc_link`, there is the `dc_sink`, which is the object that
97 represents the connected display.
98
99 .. note::
100 For historical reasons, we used the name `dc_link`, which gives the
101 wrong impression that this abstraction only deals with physical connections
102 that the developer can easily manipulate. However, this also covers
103 connections like eDP or cases where the output is connected to other devices.
104
105 There are two structs that are not represented in the diagram since they were
106 elaborated in the DCN overview page (check the DCN block diagram :ref:`Display
107 Core Next (DCN) <dcn_overview>`); still, it is worth bringing back for this
108 overview which is `dc_stream` and `dc_state`. The `dc_stream` stores many
109 properties associated with the data transmission, but most importantly, it
110 represents the data flow from the connector to the display. Next we have
111 `dc_state`, which represents the logic state within the hardware at the moment;
112 `dc_state` is composed of `dc_stream` and `dc_plane`. The `dc_stream` is the DC
113 version of `drm_crtc` and represents the post-blending pipeline.
114
115 Speaking of the `dc_plane` data structure (first part of the diagram), you can
116 think about it as an abstraction similar to `drm_plane` that represents the
117 pre-blending portion of the pipeline. This image was probably processed by GFX
118 and is ready to be composited under a `dc_stream`. Normally, the driver may
119 have one or more `dc_plane` connected to the same `dc_stream`, which defines a
120 composition at the DC level.
121
122 Basic Operations
123 ----------------
124
125 Now that we have covered the basic objects, it is time to examine some of the
126 basic hardware/software operations. Let's start with the `dc_create()`
127 function, which directly works with the `dc` data struct; this function behaves
128 like a constructor responsible for the basic software initialization and
129 preparing for enabling other parts of the API. It is important to highlight
130 that this operation does not touch any hardware configuration; it is only a
131 software initialization.
132
133 Next, we have the `dc_hardware_init()`, which also relies on the `dc` data
134 struct. Its main function is to put the hardware in a valid state. It is worth
135 highlighting that the hardware might initialize in an unknown state, and it is
136 a requirement to put it in a valid state; this function has multiple callbacks
137 for the hardware-specific initialization, whereas `dc_hardware_init` does the
138 hardware initialization and is the first point where we touch hardware.
139
140 The `dc_get_link_at_index` is an operation that depends on the `dc_link` data
141 structure. This function retrieves and enumerates all the `dc_links` available
142 on the device; this is required since this information is not part of the SoC
143 definition but depends on the board configuration. As soon as the `dc_link` is
144 initialized, it is useful to figure out if any of them are already connected to
145 the display by using the `dc_link_detect()` function. After the driver figures
146 out if any display is connected to the device, the challenging phase starts:
147 configuring the monitor to show something. Nonetheless, dealing with the ideal
148 configuration is not a DC task since this is the Display Manager (`amdgpu_dm`)
149 responsibility which in turn is responsible for dealing with the atomic
150 commits. The only interface DC provides to the configuration phase is the
151 function `dc_validate_with_context` that receives the configuration information
152 and, based on that, validates whether the hardware can support it or not. It is
153 important to add that even if the display supports some specific configuration,
154 it does not mean the DCN hardware can support it.
155
156 After the DM and DC agree upon the configuration, the stream configuration
157 phase starts. This task activates one or more `dc_stream` at this phase, and in
158 the best-case scenario, you might be able to turn the display on with a black
159 screen (it does not show anything yet since it does not have any plane
160 associated with it). The final step would be to call the
161 `dc_update_planes_and_stream,` which will add or remove planes.
162
163

3. 한국어 전문 번역

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

DC service와 Display Manager의 경계

1-17

DCN overview와 DCN block 문서가 hardware component와 상호작용을 설명했다면, 이 문서는 display code architecture에 초점을 맞춥니다. DC code는 여러 operating system이 공유하므로 서로 다른 OS API를 DCN/DCE hardware configuration에 연결하는 abstraction과 operation을 제공합니다.

DC programming model의 역할 구분
영역주체책임
OS integrationDisplay Manager, amdgpu_dmLinux DRM atomic commit과 userspace request 처리
공유 display serviceDisplay Core, DCPolicy, abstraction, validation과 DCN/DCE configuration
Hardware executionDCN/DCE와 DMUBBlock별 register programming과 실제 display 동작

Display Manager는 OS와 atomic API를 담당하고, DC는 공유 가능한 display service로 hardware를 제어합니다.

API에서 hardware까지
Linux DRM과 userspace가 Display Manager에 configuration 전달amdgpu_dm이 OS object를 DC abstraction으로 변환DC가 resource와 power policy를 적용하고 configuration 검증Hardware sequencer와 block API가 DCN/DCE program필요한 operation은 DMUB microcontroller service와 연동

이 문서에서 GPU라는 말은 dGPU와 APU를 모두 가리킵니다.

====================
DC Programming Model
====================

In the :ref:`Display Core Next (DCN) <dcn_overview>` and :ref:`DCN Block
<dcn_blocks>` pages, you learned about the hardware components and how they
interact with each other. On this page, the focus is shifted to the display
code architecture. Hence, it is reasonable to remind the reader that the code
in DC is shared with other OSes; for this reason, DC provides a set of
abstractions and operations to connect different APIs with the hardware
configuration. See DC as a service available for a Display Manager (amdgpu_dm)
to access and configure DCN/DCE hardware (DCE is also part of DC, but for
simplicity's sake, this documentation only examines DCN).

.. note::
   For this page, we will use the term GPU to refers to dGPU and APU.

DC policy, resource 안정성과 DML

18-58

범위와 해법이 명확한 문제는 hardware에 구현되는 경우가 많고, 여러 해결 방법이 있어 상황별 판단이 필요한 문제는 DC level의 policy로 구현됩니다. Resource management, power optimization과 image quality는 DC core의 policy이며, hardware가 제공하는 기능은 DC configuration을 통해 활성화합니다.

정책과 hardware configuration
문제 유형구현 위치
잘 정의된 고정 동작Hardware blockHUBP, DPP, MPC의 구체적 processing capability
여러 배치 중 선택DC core policyResource management와 hardware instance assignment
전력과 품질 trade-offDC policy + DMLDisplay topology와 clock/bandwidth를 고려한 configuration 선택
선택된 기능 적용DC configurationHardware가 구현한 capability enable

문제의 성격에 따라 책임 위치가 달라집니다.

DCN에는 HUBP, DPP, MPC 같은 block instance가 여러 개 있습니다. DC의 resource policy는 state A에서 B로 바뀔 때 hardware shuffle을 최소화하려 합니다. 같은 driver object 집합이 기존 hardware resource를 계속 사용하면 transition이 단순해집니다. `pipe_ctx`에 resource를 추가하거나 제거하는 것은 보통 문제가 아니지만, resource를 한 `pipe_ctx`에서 다른 `pipe_ctx`로 옮기는 일은 피해야 합니다.

State A에서 B로 바뀔 때의 resource 원칙
현재 state A의 pipe_ctx와 block instance assignment 확인새 state B가 요구하는 stream과 plane resource 계산같은 driver object에 기존 HUBP/DPP/MPC를 가능한 한 유지필요한 resource만 해당 pipe_ctx에 추가하거나 제거Pipe_ctx 사이 resource 이동은 마지막 선택으로 제한Hardware shuffle과 transition risk를 줄인 state 채택

기능만 만족시키는 것이 아니라 기존 assignment의 안정성을 함께 평가합니다.

Image를 표시하는 기본 configuration 자체는 비교적 단순하지만, 가장 낮은 power footprint를 얻는 configuration은 DCN/DCE version, display 수와 mode 등 변수가 너무 많아 간단한 analytic formula로 결정하기 어렵습니다. AMDGPU는 여러 configuration을 시도하고 지원 가능성을 검증하는 Display Mode Library(DML)에 이 복잡한 결정을 맡깁니다.

DML을 이용한 power configuration 판단
DC가 stream, plane, mode와 hardware version 입력 구성가능한 resource, clock과 bandwidth arrangement 후보 생성DML이 후보 configuration의 hardware 지원 가능성 평가Power와 resource policy에 맞는 결정 반환DC가 선택한 configuration을 validation과 programming에 사용

DML은 하나의 보편 규칙 대신 topology와 hardware generation에 맞는 후보를 검증합니다.

따라서 DC는 다양한 display scenario를 hardware capability에 맞추고 지속 가능한 policy를 선택하는 계층입니다. 이 관점을 가지면 AMDGPU display code에서 policy와 low-level programming이 섞여 보이는 복잡성을 더 정확히 탐색할 수 있습니다.

Overview
========

From the display hardware perspective, it is plausible to expect that if a
problem is well-defined, it will probably be implemented at the hardware level.
On the other hand, when there are multiple ways of achieving something without
a very well-defined scope, the solution is usually implemented as a policy at
the DC level. In other words, some policies are defined in the DC core
(resource management, power optimization, image quality, etc.), and the others
implemented in hardware are enabled via DC configuration.

In terms of hardware management, DCN has multiple instances of the same block
(e.g., HUBP, DPP, MPC, etc), and during the driver execution, it might be
necessary to use some of these instances. The core has policies in place for
handling those instances. Regarding resource management, the DC objective is
quite simple: minimize the hardware shuffle when the driver performs some
actions. When the state changes from A to B, the transition is considered
easier to maneuver if the hardware resource is still used for the same set of
driver objects. Usually, adding and removing a resource to a `pipe_ctx` (more
details below) is not a problem; however, moving a resource from one `pipe_ctx`
to another should be avoided.

Another area of influence for DC is power optimization, which has a myriad of
arrangement possibilities. In some way, just displaying an image via DCN should
be relatively straightforward; however, showing it with the best power
footprint is more desirable, but it has many associated challenges.
Unfortunately, there is no straight-forward analytic way to determine if a
configuration is the best one for the context due to the enormous variety of
variables related to this problem (e.g., many different DCN/DCE hardware
versions, different displays configurations, etc.) for this reason DC
implements a dedicated library for trying some configuration and verify if it
is possible to support it or not. This type of policy is extremely complex to
create and maintain, and amdgpu driver relies on Display Mode Library (DML) to
generate the best decisions.

In summary, DC must deal with the complexity of handling multiple scenarios and
determine policies to manage them. All of the above information is conveyed to
give the reader some idea about the complexity of driving a display from the
driver's perspective. This page hopes to allow the reader to better navigate
over the amdgpu display code.

Display driver software layer

59-76

`dc-components.svg`는 DC software layer를 일반 display path와 DMUB microcontroller path로 나눕니다. 가장 위에는 `dc/dc.h`가 제공하는 high-level Display Core API가 있고, Core와 Link를 지나 hardware sequencer와 block-level API로 내려갑니다.

dc-components.svg의 일반 DC 경로
Display Core API (dc/dc.h)Core와 LinkHardware Sequencer API (dc/inc/hw_sequence.h)Hardware Sequencer, 구현 callback은 hardware sequencer folderBlock Level API (dc/inc/hw)DCHUB, HUBP, DPP, MPC와 기타 low-level DCN blockHardware Registers

원본 SVG의 layer 이름과 source path를 위에서 아래 순서로 보존했습니다.

dc-components.svg의 DMUB 경로
DC의 DMUB 사용 지점DMUB Service API (dc/dc_dmub_srv.h)DMUB ServiceDMUB Hardware API (dmub/dmub_srv.h)DMUB BlockDMUB hardware와 microcontroller operation

DMUB는 왼쪽의 별도 service stack을 통해 microcontroller hardware와 통신합니다.

Layer별 주요 file과 역할
LayerSource 또는 API역할
High-level DC APIdc/dc.hDisplay Manager가 사용하는 public DC operation
Policy와 linkCore, LinkResource policy와 connector/link abstraction
Hardware configurationhw_sequencer.h / dc/inc/hw_sequence.hASIC별 callback과 programming sequence
Low-level blockdc/inc/hwHUBP, DPP, MPC, OPTC 등 block interface
DMUB servicedc/dc_dmub_srv.hDC와 DMUB service 연결
DMUB hardware APIdmub/dmub_srv.hDMUB microcontroller low-level access

본문의 `hw_sequencer.h` 이름과 그림의 `hw_sequence.h` path를 모두 보존합니다.

Display Driver Architecture Overview
====================================

The diagram below provides an overview of the display driver architecture;
notice it illustrates the software layers adopted by DC:

.. kernel-figure:: dc-components.svg

The first layer of the diagram is the high-level DC API represented by the
`dc.h` file; below it are two big blocks represented by Core and Link. Next is
the hardware configuration block; the main file describing it is
the`hw_sequencer.h`, where the implementation of the callbacks can be found in
the hardware sequencer folder. Almost at the end, you can see the block level
API (`dc/inc/hw`), which represents each DCN low-level block, such as HUBP,
DPP, MPC, OPTC, etc. Notice on the left side of the diagram that we have a
different set of layers representing the interaction with the DMUB
microcontroller.

GPU·board·stream을 잇는 기본 object

77-121

`dc-arch-overview.svg`의 box 이름은 driver data structure와 architecture boundary를 나타냅니다. 중심 object인 `dc`는 GPU마다 하나씩 초기화됩니다. GPU 한 개에는 `dc` instance 하나, GPU 두 개에는 두 instance가 있으므로 각 `amdgpu` instance 안에서 Singleton과 비슷하게 동작합니다.

dc-arch-overview.svg 구조화 도식
DRAM의 GFX-processed surface -> 하나 이상의 dc_planedc_plane -> GPU별 하나의 DC objectDC -> SoC 내부 DCN hardwareDC -> board가 정의한 하나 이상의 dc_linkdc_link -> Board/Platform의 ConnectorConnector -> connected Display를 나타내는 dc_sink

SoC 내부 DCN과 Board/Platform connector를 DC object가 어떻게 연결하는지 나타냅니다.

DC 기본 object
Object범위핵심 의미
dcGPU 또는 amdgpu instance당 1개DC service의 중심 context, Singleton과 유사
dc_linkBoard/Platform connector별Connected sink, connection status, signal type 등 link 정보
dc_sink연결된 display별실제 connected display abstraction
dc_streamConnector에서 display로 가는 data flowPost-blending pipeline, DC의 drm_crtc 대응
dc_planeGFX 처리 뒤 blend 전 surfacePre-blending pipeline, drm_plane과 유사
dc_state현재 hardware logical statedc_stream과 dc_plane으로 구성된 configuration context

각 structure가 소유하는 정보와 DRM 대응을 구분했습니다.

Connector는 DCN SoC block의 일부가 아니라 platform 또는 board가 정의합니다. `dc_link`는 단순히 사용자가 조작하는 외부 physical connector만 뜻하지 않습니다. 역사적으로 붙은 이름이며 eDP처럼 내부 연결이거나 output이 다른 device를 거치는 경우도 포함합니다.

Plane composition과 stream 관계
GFX가 image surface를 rendering각 surface를 dc_plane으로 표현하나 이상의 dc_plane을 같은 dc_stream에 연결DC level에서 plane composition 정의dc_stream이 post-blending data flow와 timing 보유dc_link와 dc_sink를 거쳐 display로 전송

하나의 post-blending stream 아래 여러 pre-blending plane을 연결할 수 있습니다.

DC와 DRM object 대응
DC objectDRM analogyPipeline 위치
dc_planedrm_planePre-blending
dc_streamdrm_crtcPost-blending
dc_linkConnector/link abstractionSoC 밖 board connection 경계
dc_sinkConnected displayLink 반대편의 display endpoint

완전히 같은 structure는 아니지만 pipeline 위치를 이해하는 기준입니다.

Basic Objects
-------------

The below diagram outlines the basic display objects. In particular, pay
attention to the names in the boxes since they represent a data structure in
the driver:

.. kernel-figure:: dc-arch-overview.svg

Let's start with the central block in the image, `dc`. The `dc` struct is
initialized per GPU; for example, one GPU has one `dc` instance, two GPUs have
two `dc` instances, and so forth. In other words we have one 'dc' per 'amdgpu'
instance. In some ways, this object behaves like the `Singleton` pattern.

After the `dc` block in the diagram, you can see the `dc_link` component, which
is a low-level abstraction for the connector. One interesting aspect of the
image is that connectors are not part of the DCN block; they are defined by the
platform/board and not by the SoC. The `dc_link` struct is the high-level data
container with information such as connected sinks, connection status, signal
types, etc. After `dc_link`, there is the `dc_sink`, which is the object that
represents the connected display.

.. note::
   For historical reasons, we used the name `dc_link`, which gives the
   wrong impression that this abstraction only deals with physical connections
   that the developer can easily manipulate. However, this also covers
   connections like eDP or cases where the output is connected to other devices.

There are two structs that are not represented in the diagram since they were
elaborated in the DCN overview page  (check the DCN block diagram :ref:`Display
Core Next (DCN) <dcn_overview>`); still, it is worth bringing back for this
overview which is `dc_stream` and `dc_state`. The `dc_stream` stores many
properties associated with the data transmission, but most importantly, it
represents the data flow from the connector to the display. Next we have
`dc_state`, which represents the logic state within the hardware at the moment;
`dc_state` is composed of `dc_stream` and `dc_plane`. The `dc_stream` is the DC
version of `drm_crtc` and represents the post-blending pipeline.

Speaking of the `dc_plane` data structure (first part of the diagram), you can
think about it as an abstraction similar to `drm_plane` that represents the
pre-blending portion of the pipeline. This image was probably processed by GFX
and is ready to be composited under a `dc_stream`. Normally, the driver may
have one or more `dc_plane` connected to the same `dc_stream`, which defines a
composition at the DC level.

Software 생성부터 plane update까지

122-162

`dc_create()`는 `dc` data structure에 대한 constructor 역할을 하며 기본 software initialization과 다른 API를 사용할 준비를 합니다. 이 단계는 hardware configuration을 전혀 건드리지 않습니다. 반면 `dc_hardware_init()`은 unknown state일 수 있는 hardware를 valid state로 만들며 hardware-specific callback을 호출하는 최초의 hardware access 지점입니다.

기본 DC operation의 계약
Operation주요 object책임Hardware access
dc_create()dcSoftware context 생성과 API 준비없음
dc_hardware_init()dcUnknown hardware를 valid state로 초기화최초 접근
dc_get_link_at_indexdc_linkBoard configuration 기반 link 조회·열거Link inventory 접근
dc_link_detect()dc_link, dc_sinkDisplay 연결 여부와 sink 탐지Connector detection
dc_validate_with_contextdc_state context요청 configuration의 DCN 지원 가능성 검증적용 전 validation
dc_update_planes_and_streamdc_stream, dc_planePlane 추가·제거와 stream update검증된 state 적용

어떤 object를 사용하고 hardware에 언제 접근하는지 구분합니다.

DC 초기화와 display 활성화 순서
dc_create(): software-only initializationdc_hardware_init(): hardware-specific callback으로 valid state 확립dc_get_link_at_index: board가 제공하는 dc_link 열거dc_link_detect(): 연결된 display와 dc_sink 탐지amdgpu_dm이 DRM atomic commit에서 이상적인 configuration 결정dc_validate_with_context가 DCN hardware 지원 여부 검증DM과 DC가 동의하면 하나 이상의 dc_stream 활성화dc_update_planes_and_stream으로 dc_plane 추가 또는 제거

Software object 생성, hardware valid state, board link 탐지, validation과 scanout을 분리합니다.

Link 정보는 SoC definition이 아니라 board configuration에 달려 있으므로 `dc_get_link_at_index`로 device의 `dc_link`를 열거해야 합니다. 각 link가 준비되면 `dc_link_detect()`로 display 연결 여부를 확인합니다.

DM과 DC의 configuration 책임
단계책임 주체결정
Userspace request와 atomic stateDisplay Manager, amdgpu_dm원하는 monitor mode, stream과 plane configuration
Hardware feasibilityDisplay Coredc_validate_with_context로 DCN capability와 resource 검증
Agreement 이후 streamDM + DC하나 이상의 dc_stream 활성화
Visible contentDC plane updatedc_update_planes_and_stream으로 plane을 stream에 연결

Display가 mode를 지원한다는 사실만으로 DCN hardware가 그 조합을 처리할 수 있다고 볼 수 없습니다.

Black screen에서 visible plane까지
검증된 configuration으로 dc_stream 활성화Timing과 link가 켜져 display가 on 상태가 될 수 있음연결된 dc_plane이 없으므로 화면은 blackdc_update_planes_and_stream 호출Plane을 stream에 추가하고 framebuffer content scanoutPlane 제거 시 해당 composition layer를 stream에서 해제

Stream만 켠 상태와 실제 image가 있는 상태를 구분합니다.

Basic Operations
----------------

Now that we have covered the basic objects, it is time to examine some of the
basic hardware/software operations. Let's start with the `dc_create()`
function, which directly works with the `dc` data struct; this function behaves
like a constructor responsible for the basic software initialization and
preparing for enabling other parts of the API. It is important to highlight
that this operation does not touch any hardware configuration; it is only a
software initialization.

Next, we have the `dc_hardware_init()`, which also relies on the `dc` data
struct. Its main function is to put the hardware in a valid state. It is worth
highlighting that the hardware might initialize in an unknown state, and it is
a requirement to put it in a valid state; this function has multiple callbacks
for the hardware-specific initialization, whereas `dc_hardware_init` does the
hardware initialization and is the first point where we touch hardware.

The `dc_get_link_at_index` is an operation that depends on the `dc_link` data
structure. This function retrieves and enumerates all the `dc_links` available
on the device; this is required since this information is not part of the SoC
definition but depends on the board configuration. As soon as the `dc_link` is
initialized, it is useful to figure out if any of them are already connected to
the display by using the `dc_link_detect()` function. After the driver figures
out if any display is connected to the device, the challenging phase starts:
configuring the monitor to show something. Nonetheless, dealing with the ideal
configuration is not a DC task since this is the Display Manager (`amdgpu_dm`)
responsibility which in turn is responsible for dealing with the atomic
commits. The only interface DC provides to the configuration phase is the
function `dc_validate_with_context` that receives the configuration information
and, based on that, validates whether the hardware can support it or not. It is
important to add that even if the display supports some specific configuration,
it does not mean the DCN hardware can support it.

After the DM and DC agree upon the configuration, the stream configuration
phase starts. This task activates one or more `dc_stream` at this phase, and in
the best-case scenario, you might be able to turn the display on with a black
screen (it does not show anything yet since it does not have any plane
associated with it). The final step would be to call the
`dc_update_planes_and_stream,` which will add or remove planes.