← Documents Documentation/gpu/tegra.rst GitHub 원문 ↗

Linux 6.18.37 · GPU·DRM

drm/tegra NVIDIA Tegra GPU and display driver

Tegra host1x infrastructure, KMS hardware와 userspace submission을 설명합니다.

Source pathDocumentation/gpu/tegra.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

요약·해설

tegra.rst:1-178

Tegra host1x infrastructure, KMS hardware와 userspace submission을 설명합니다.

문서 위치
항목
SourceDocumentation/gpu/tegra.rst
분량178 source lines
관련include/linux/host1x.h · drm/nouveau

Source와 관련 구현입니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 ===============================================
2 drm/tegra NVIDIA Tegra GPU and display driver
3 ===============================================
4
5 NVIDIA Tegra SoCs support a set of display, graphics and video functions via
6 the host1x controller. host1x supplies command streams, gathered from a push
7 buffer provided directly by the CPU, to its clients via channels. Software,
8 or blocks amongst themselves, can use syncpoints for synchronization.
9
10 Up until, but not including, Tegra124 (aka Tegra K1) the drm/tegra driver
11 supports the built-in GPU, comprised of the gr2d and gr3d engines. Starting
12 with Tegra124 the GPU is based on the NVIDIA desktop GPU architecture and
13 supported by the drm/nouveau driver.
14
15 The drm/tegra driver supports NVIDIA Tegra SoC generations since Tegra20. It
16 has three parts:
17
18 - A host1x driver that provides infrastructure and access to the host1x
19 services.
20
21 - A KMS driver that supports the display controllers as well as a number of
22 outputs, such as RGB, HDMI, DSI, and DisplayPort.
23
24 - A set of custom userspace IOCTLs that can be used to submit jobs to the
25 GPU and video engines via host1x.
26
27 Driver Infrastructure
28 =====================
29
30 The various host1x clients need to be bound together into a logical device in
31 order to expose their functionality to users. The infrastructure that supports
32 this is implemented in the host1x driver. When a driver is registered with the
33 infrastructure it provides a list of compatible strings specifying the devices
34 that it needs. The infrastructure creates a logical device and scan the device
35 tree for matching device nodes, adding the required clients to a list. Drivers
36 for individual clients register with the infrastructure as well and are added
37 to the logical host1x device.
38
39 Once all clients are available, the infrastructure will initialize the logical
40 device using a driver-provided function which will set up the bits specific to
41 the subsystem and in turn initialize each of its clients.
42
43 Similarly, when one of the clients is unregistered, the infrastructure will
44 destroy the logical device by calling back into the driver, which ensures that
45 the subsystem specific bits are torn down and the clients destroyed in turn.
46
47 Host1x Infrastructure Reference
48 -------------------------------
49
50 .. kernel-doc:: include/linux/host1x.h
51
52 .. kernel-doc:: drivers/gpu/host1x/bus.c
53 :export:
54
55 Host1x Syncpoint Reference
56 --------------------------
57
58 .. kernel-doc:: drivers/gpu/host1x/syncpt.c
59 :export:
60
61 KMS driver
62 ==========
63
64 The display hardware has remained mostly backwards compatible over the various
65 Tegra SoC generations, up until Tegra186 which introduces several changes that
66 make it difficult to support with a parameterized driver.
67
68 Display Controllers
69 -------------------
70
71 Tegra SoCs have two display controllers, each of which can be associated with
72 zero or more outputs. Outputs can also share a single display controller, but
73 only if they run with compatible display timings. Two display controllers can
74 also share a single framebuffer, allowing cloned configurations even if modes
75 on two outputs don't match. A display controller is modelled as a CRTC in KMS
76 terms.
77
78 On Tegra186, the number of display controllers has been increased to three. A
79 display controller can no longer drive all of the outputs. While two of these
80 controllers can drive both DSI outputs and both SOR outputs, the third cannot
81 drive any DSI.
82
83 Windows
84 ~~~~~~~
85
86 A display controller controls a set of windows that can be used to composite
87 multiple buffers onto the screen. While it is possible to assign arbitrary Z
88 ordering to individual windows (by programming the corresponding blending
89 registers), this is currently not supported by the driver. Instead, it will
90 assume a fixed Z ordering of the windows (window A is the root window, that
91 is, the lowest, while windows B and C are overlaid on top of window A). The
92 overlay windows support multiple pixel formats and can automatically convert
93 from YUV to RGB at scanout time. This makes them useful for displaying video
94 content. In KMS, each window is modelled as a plane. Each display controller
95 has a hardware cursor that is exposed as a cursor plane.
96
97 Outputs
98 -------
99
100 The type and number of supported outputs varies between Tegra SoC generations.
101 All generations support at least HDMI. While earlier generations supported the
102 very simple RGB interfaces (one per display controller), recent generations no
103 longer do and instead provide standard interfaces such as DSI and eDP/DP.
104
105 Outputs are modelled as a composite encoder/connector pair.
106
107 RGB/LVDS
108 ~~~~~~~~
109
110 This interface is no longer available since Tegra124. It has been replaced by
111 the more standard DSI and eDP interfaces.
112
113 HDMI
114 ~~~~
115
116 HDMI is supported on all Tegra SoCs. Starting with Tegra210, HDMI is provided
117 by the versatile SOR output, which supports eDP, DP and HDMI. The SOR is able
118 to support HDMI 2.0, though support for this is currently not merged.
119
120 DSI
121 ~~~
122
123 Although Tegra has supported DSI since Tegra30, the controller has changed in
124 several ways in Tegra114. Since none of the publicly available development
125 boards prior to Dalmore (Tegra114) have made use of DSI, only Tegra114 and
126 later are supported by the drm/tegra driver.
127
128 eDP/DP
129 ~~~~~~
130
131 eDP was first introduced in Tegra124 where it was used to drive the display
132 panel for notebook form factors. Tegra210 added support for full DisplayPort
133 support, though this is currently not implemented in the drm/tegra driver.
134
135 Userspace Interface
136 ===================
137
138 The userspace interface provided by drm/tegra allows applications to create
139 GEM buffers, access and control syncpoints as well as submit command streams
140 to host1x.
141
142 GEM Buffers
143 -----------
144
145 The ``DRM_IOCTL_TEGRA_GEM_CREATE`` IOCTL is used to create a GEM buffer object
146 with Tegra-specific flags. This is useful for buffers that should be tiled, or
147 that are to be scanned out upside down (useful for 3D content).
148
149 After a GEM buffer object has been created, its memory can be mapped by an
150 application using the mmap offset returned by the ``DRM_IOCTL_TEGRA_GEM_MMAP``
151 IOCTL.
152
153 Syncpoints
154 ----------
155
156 The current value of a syncpoint can be obtained by executing the
157 ``DRM_IOCTL_TEGRA_SYNCPT_READ`` IOCTL. Incrementing the syncpoint is achieved
158 using the ``DRM_IOCTL_TEGRA_SYNCPT_INCR`` IOCTL.
159
160 Userspace can also request blocking on a syncpoint. To do so, it needs to
161 execute the ``DRM_IOCTL_TEGRA_SYNCPT_WAIT`` IOCTL, specifying the value of
162 the syncpoint to wait for. The kernel will release the application when the
163 syncpoint reaches that value or after a specified timeout.
164
165 Command Stream Submission
166 -------------------------
167
168 Before an application can submit command streams to host1x it needs to open a
169 channel to an engine using the ``DRM_IOCTL_TEGRA_OPEN_CHANNEL`` IOCTL. Client
170 IDs are used to identify the target of the channel. When a channel is no
171 longer needed, it can be closed using the ``DRM_IOCTL_TEGRA_CLOSE_CHANNEL``
172 IOCTL. To retrieve the syncpoint associated with a channel, an application
173 can use the ``DRM_IOCTL_TEGRA_GET_SYNCPT``.
174
175 After opening a channel, submitting command streams is easy. The application
176 writes commands into the memory backing a GEM buffer object and passes these
177 to the ``DRM_IOCTL_TEGRA_SUBMIT`` IOCTL along with various other parameters,
178 such as the syncpoints or relocations used in the job submission.
179

3. 한국어 전문 번역

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

Tegra host1x·GPU·display 구성

1-25

NVIDIA Tegra SoC는 `host1x` controller를 통해 display, graphics, video 기능을 제공합니다. Host1x는 CPU가 직접 제공한 push buffer에서 command stream을 모아 channel을 통해 client에 전달합니다. Software와 hardware block 사이의 synchronization에는 syncpoint를 사용합니다.

Tegra124(Tegra K1) 이전까지 `drm/tegra`는 내장 `gr2d`·`gr3d` GPU engine을 지원합니다. Tegra124부터 GPU는 NVIDIA desktop GPU architecture를 사용하므로 `drm/nouveau`가 지원합니다.

Drm/tegra는 Tegra20 이후 SoC generation을 지원하고 세 부분으로 구성됩니다. Host1x driver는 host1x service의 infrastructure와 access를 제공하고, KMS driver는 display controller와 RGB·HDMI·DSI·DisplayPort output을 지원합니다. Custom userspace IOCTL은 host1x를 통해 GPU·video engine job을 제출합니다.

drm/tegra 구성
부분책임
host1x driverChannel·syncpoint·client infrastructure
KMS driverDisplay controller·RGB·HDMI·DSI·DisplayPort
Custom IOCTLGPU·video engine job submission

Host service, display와 userspace submission을 분리합니다.

Host1x command path
CPU가 GEM-backed push buffer 작성Host1x channel에 command stream 제출Target GPU·video client가 command 실행Syncpoint로 software·block 간 완료 동기화

CPU push buffer에서 engine 실행까지의 경로입니다.

===============================================
 drm/tegra NVIDIA Tegra GPU and display driver
===============================================

NVIDIA Tegra SoCs support a set of display, graphics and video functions via
the host1x controller. host1x supplies command streams, gathered from a push
buffer provided directly by the CPU, to its clients via channels. Software,
or blocks amongst themselves, can use syncpoints for synchronization.

Up until, but not including, Tegra124 (aka Tegra K1) the drm/tegra driver
supports the built-in GPU, comprised of the gr2d and gr3d engines. Starting
with Tegra124 the GPU is based on the NVIDIA desktop GPU architecture and
supported by the drm/nouveau driver.

The drm/tegra driver supports NVIDIA Tegra SoC generations since Tegra20. It
has three parts:

  - A host1x driver that provides infrastructure and access to the host1x
    services.

  - A KMS driver that supports the display controllers as well as a number of
    outputs, such as RGB, HDMI, DSI, and DisplayPort.

  - A set of custom userspace IOCTLs that can be used to submit jobs to the
    GPU and video engines via host1x.

Host1x logical-device infrastructure

26-63

여러 host1x client의 기능을 user에게 노출하려면 하나의 logical device로 묶어야 합니다. Host1x driver가 이 infrastructure를 구현합니다.

Subsystem driver는 필요한 device를 나타내는 compatible string list와 함께 infrastructure에 등록합니다. Infrastructure는 logical device를 만들고 device tree에서 matching node를 scan하여 필요한 client list를 구성합니다. 개별 client driver도 infrastructure에 등록되어 같은 logical host1x device에 추가됩니다.

모든 client가 준비되면 infrastructure는 driver가 제공한 callback으로 logical device를 초기화합니다. Callback은 subsystem-specific 부분을 설정하고 각 client를 순서대로 초기화합니다.

Client 하나가 unregister되면 반대 순서로 driver callback을 호출해 logical device를 destroy하고 subsystem-specific state와 client를 해제합니다.

Host1x infrastructure API는 `include/linux/host1x.h`와 `drivers/gpu/host1x/bus.c`의 exported kernel-doc에서, syncpoint API는 `drivers/gpu/host1x/syncpt.c`에서 가져옵니다.

Host1x reference
범위Source
Public definitionsinclude/linux/host1x.h
Bus infrastructuredrivers/gpu/host1x/bus.c
Syncpointsdrivers/gpu/host1x/syncpt.c

Infrastructure와 synchronization의 source path입니다.

Logical device 생명주기
Subsystem driver가 compatible list로 등록Device tree scan·matching client list 생성개별 client driver 등록모든 client 준비 시 logical device callback 초기화Client unregister 시 subsystem·client 역순 teardown

Device-tree matching에서 teardown까지의 순서입니다.


Driver Infrastructure
=====================

The various host1x clients need to be bound together into a logical device in
order to expose their functionality to users. The infrastructure that supports
this is implemented in the host1x driver. When a driver is registered with the
infrastructure it provides a list of compatible strings specifying the devices
that it needs. The infrastructure creates a logical device and scan the device
tree for matching device nodes, adding the required clients to a list. Drivers
for individual clients register with the infrastructure as well and are added
to the logical host1x device.

Once all clients are available, the infrastructure will initialize the logical
device using a driver-provided function which will set up the bits specific to
the subsystem and in turn initialize each of its clients.

Similarly, when one of the clients is unregistered, the infrastructure will
destroy the logical device by calling back into the driver, which ensures that
the subsystem specific bits are torn down and the clients destroyed in turn.

Host1x Infrastructure Reference
-------------------------------

.. kernel-doc:: include/linux/host1x.h

.. kernel-doc:: drivers/gpu/host1x/bus.c
   :export:

Host1x Syncpoint Reference
--------------------------

.. kernel-doc:: drivers/gpu/host1x/syncpt.c
   :export:

KMS driver
==========

Tegra KMS controller·window·output

64-127

Display hardware는 Tegra generation 사이에 대체로 backward compatible했지만 Tegra186은 parameterized driver로 지원하기 어려운 여러 변경을 도입했습니다.

기존 Tegra SoC에는 display controller 두 개가 있고 각각 output 0개 이상에 연결할 수 있습니다. Compatible timing이면 output 여러 개가 controller 하나를 공유할 수 있습니다. Controller 두 개가 framebuffer 하나를 공유하면 두 output mode가 달라도 clone configuration을 만들 수 있습니다. KMS에서는 controller를 CRTC로 모델링합니다.

Tegra186은 controller가 세 개로 늘고 모든 controller가 모든 output을 구동할 수 없게 됩니다. 두 controller는 DSI 둘과 SOR output 둘을 구동할 수 있지만 세 번째는 DSI를 구동할 수 없습니다.

Controller의 window는 여러 buffer를 screen에 합성합니다. Hardware는 blending register로 arbitrary Z order를 지원하지만 driver는 고정 order를 가정합니다. Window A가 root·lowest이고 B와 C가 위에 overlay됩니다.

Overlay window는 여러 pixel format과 scanout 시 YUV→RGB 자동 변환을 지원해 video content에 유용합니다. KMS에서는 window를 plane으로 모델링하고 각 controller의 hardware cursor는 cursor plane으로 노출합니다.

Output type과 수는 generation마다 다르지만 모두 HDMI를 지원합니다. 초기 generation의 simple RGB interface는 controller마다 하나씩 있었으나 최신 generation은 DSI·eDP/DP 같은 표준 interface를 사용합니다. Output은 encoder/connector composite pair로 모델링합니다.

RGB/LVDS는 Tegra124부터 없어지고 DSI·eDP로 대체됩니다. HDMI는 모든 SoC에서 지원하며 Tegra210부터 eDP·DP·HDMI를 지원하는 SOR가 제공합니다. SOR는 HDMI 2.0 capability가 있지만 driver support는 아직 merge되지 않았습니다.

DSI hardware는 Tegra30부터 있지만 Tegra114에서 크게 바뀌었고 초기 공개 board가 DSI를 쓰지 않아 driver는 Tegra114 이후만 지원합니다. eDP는 Tegra124 notebook panel에 처음 도입됐고 Tegra210은 full DisplayPort를 추가했지만 drm/tegra에는 아직 구현되지 않았습니다.

KMS object mapping
HardwareKMS object
Display controllerCRTC
Window A/B/CPrimary·overlay plane
Hardware cursorCursor plane
Physical outputEncoder/connector pair

Tegra display hardware를 DRM object로 표현합니다.

Display scanout
Window A root bufferWindow B·C overlay·YUV→RGBDisplay controller/CRTC 합성Encoder/connectorRGB·HDMI·DSI·eDP/DP output

Buffer 합성에서 physical output까지의 흐름입니다.

The display hardware has remained mostly backwards compatible over the various
Tegra SoC generations, up until Tegra186 which introduces several changes that
make it difficult to support with a parameterized driver.

Display Controllers
-------------------

Tegra SoCs have two display controllers, each of which can be associated with
zero or more outputs. Outputs can also share a single display controller, but
only if they run with compatible display timings. Two display controllers can
also share a single framebuffer, allowing cloned configurations even if modes
on two outputs don't match. A display controller is modelled as a CRTC in KMS
terms.

On Tegra186, the number of display controllers has been increased to three. A
display controller can no longer drive all of the outputs. While two of these
controllers can drive both DSI outputs and both SOR outputs, the third cannot
drive any DSI.

Windows
~~~~~~~

A display controller controls a set of windows that can be used to composite
multiple buffers onto the screen. While it is possible to assign arbitrary Z
ordering to individual windows (by programming the corresponding blending
registers), this is currently not supported by the driver. Instead, it will
assume a fixed Z ordering of the windows (window A is the root window, that
is, the lowest, while windows B and C are overlaid on top of window A). The
overlay windows support multiple pixel formats and can automatically convert
from YUV to RGB at scanout time. This makes them useful for displaying video
content. In KMS, each window is modelled as a plane. Each display controller
has a hardware cursor that is exposed as a cursor plane.

Outputs
-------

The type and number of supported outputs varies between Tegra SoC generations.
All generations support at least HDMI. While earlier generations supported the
very simple RGB interfaces (one per display controller), recent generations no
longer do and instead provide standard interfaces such as DSI and eDP/DP.

Outputs are modelled as a composite encoder/connector pair.

RGB/LVDS
~~~~~~~~

This interface is no longer available since Tegra124. It has been replaced by
the more standard DSI and eDP interfaces.

HDMI
~~~~

HDMI is supported on all Tegra SoCs. Starting with Tegra210, HDMI is provided
by the versatile SOR output, which supports eDP, DP and HDMI. The SOR is able
to support HDMI 2.0, though support for this is currently not merged.

DSI
~~~

Although Tegra has supported DSI since Tegra30, the controller has changed in
several ways in Tegra114. Since none of the publicly available development
boards prior to Dalmore (Tegra114) have made use of DSI, only Tegra114 and
later are supported by the drm/tegra driver.

GEM·syncpoint·command submission IOCTL

128-178

Drm/tegra userspace interface는 application이 GEM buffer를 만들고 syncpoint를 access·control하며 host1x에 command stream을 제출하게 합니다.

`DRM_IOCTL_TEGRA_GEM_CREATE`는 Tegra-specific flag가 있는 GEM BO를 생성합니다. Tiled buffer나 3D content용 upside-down scanout buffer에 유용합니다. 생성 뒤 `DRM_IOCTL_TEGRA_GEM_MMAP`이 반환한 mmap offset으로 application이 memory를 mapping합니다.

`DRM_IOCTL_TEGRA_SYNCPT_READ`는 syncpoint 현재 값을 읽고 `DRM_IOCTL_TEGRA_SYNCPT_INCR`은 값을 증가시킵니다. `DRM_IOCTL_TEGRA_SYNCPT_WAIT`은 지정 value 또는 timeout까지 application을 block하고 kernel이 조건 충족 시 깨웁니다.

Command stream 제출 전 `DRM_IOCTL_TEGRA_OPEN_CHANNEL`로 engine channel을 열고 client ID로 target을 지정합니다. 더 이상 필요 없으면 `DRM_IOCTL_TEGRA_CLOSE_CHANNEL`로 닫고 `DRM_IOCTL_TEGRA_GET_SYNCPT`로 channel 연관 syncpoint를 얻습니다.

Channel을 연 뒤 application은 GEM BO backing memory에 command를 쓰고 `DRM_IOCTL_TEGRA_SUBMIT`에 syncpoint·relocation 등 job parameter와 함께 넘깁니다.

Tegra userspace IOCTL
IOCTL역할
DRM_IOCTL_TEGRA_GEM_CREATETegra flag가 있는 GEM BO 생성
DRM_IOCTL_TEGRA_GEM_MMAPBO mmap offset 반환
DRM_IOCTL_TEGRA_SYNCPT_READ/INCR/WAITSyncpoint query·signal·wait
DRM_IOCTL_TEGRA_OPEN/CLOSE_CHANNELEngine channel 생명주기
DRM_IOCTL_TEGRA_GET_SYNCPTChannel syncpoint 조회
DRM_IOCTL_TEGRA_SUBMITCommand stream·relocation 제출

Buffer·syncpoint·channel·submission API입니다.

Userspace job submission
GEM_CREATE로 push buffer 생성·GEM_MMAP으로 mappingOPEN_CHANNEL에 target client ID 지정Command와 relocation을 BO에 작성GET_SYNCPT로 synchronization point 획득TEGRA_SUBMIT 호출SYNCPT_WAIT으로 완료 대기 후 CLOSE_CHANNEL

GEM command buffer를 host1x channel로 실행합니다.

eDP/DP
~~~~~~

eDP was first introduced in Tegra124 where it was used to drive the display
panel for notebook form factors. Tegra210 added support for full DisplayPort
support, though this is currently not implemented in the drm/tegra driver.

Userspace Interface
===================

The userspace interface provided by drm/tegra allows applications to create
GEM buffers, access and control syncpoints as well as submit command streams
to host1x.

GEM Buffers
-----------

The ``DRM_IOCTL_TEGRA_GEM_CREATE`` IOCTL is used to create a GEM buffer object
with Tegra-specific flags. This is useful for buffers that should be tiled, or
that are to be scanned out upside down (useful for 3D content).

After a GEM buffer object has been created, its memory can be mapped by an
application using the mmap offset returned by the ``DRM_IOCTL_TEGRA_GEM_MMAP``
IOCTL.

Syncpoints
----------

The current value of a syncpoint can be obtained by executing the
``DRM_IOCTL_TEGRA_SYNCPT_READ`` IOCTL. Incrementing the syncpoint is achieved
using the ``DRM_IOCTL_TEGRA_SYNCPT_INCR`` IOCTL.

Userspace can also request blocking on a syncpoint. To do so, it needs to
execute the ``DRM_IOCTL_TEGRA_SYNCPT_WAIT`` IOCTL, specifying the value of
the syncpoint to wait for. The kernel will release the application when the
syncpoint reaches that value or after a specified timeout.

Command Stream Submission
-------------------------

Before an application can submit command streams to host1x it needs to open a
channel to an engine using the ``DRM_IOCTL_TEGRA_OPEN_CHANNEL`` IOCTL. Client
IDs are used to identify the target of the channel. When a channel is no
longer needed, it can be closed using the ``DRM_IOCTL_TEGRA_CLOSE_CHANNEL``
IOCTL. To retrieve the syncpoint associated with a channel, an application
can use the ``DRM_IOCTL_TEGRA_GET_SYNCPT``.

After opening a channel, submitting command streams is easy. The application
writes commands into the memory backing a GEM buffer object and passes these
to the ``DRM_IOCTL_TEGRA_SUBMIT`` IOCTL along with various other parameters,
such as the syncpoints or relocations used in the job submission.