0001 ===============================================
0002 drm/tegra NVIDIA Tegra GPU and display driver
0003 ===============================================
0004
0005 NVIDIA Tegra SoCs support a set of display, graphics and video functions via
0006 the host1x controller. host1x supplies command streams, gathered from a push
0007 buffer provided directly by the CPU, to its clients via channels. Software,
0008 or blocks amongst themselves, can use syncpoints for synchronization.
0009
0010 Up until, but not including, Tegra124 (aka Tegra K1) the drm/tegra driver
0011 supports the built-in GPU, comprised of the gr2d and gr3d engines. Starting
0012 with Tegra124 the GPU is based on the NVIDIA desktop GPU architecture and
0013 supported by the drm/nouveau driver.
0014
0015 The drm/tegra driver supports NVIDIA Tegra SoC generations since Tegra20. It
0016 has three parts:
0017
0018 - A host1x driver that provides infrastructure and access to the host1x
0019 services.
0020
0021 - A KMS driver that supports the display controllers as well as a number of
0022 outputs, such as RGB, HDMI, DSI, and DisplayPort.
0023
0024 - A set of custom userspace IOCTLs that can be used to submit jobs to the
0025 GPU and video engines via host1x.
0026
0027 Driver Infrastructure
0028 =====================
0029
0030 The various host1x clients need to be bound together into a logical device in
0031 order to expose their functionality to users. The infrastructure that supports
0032 this is implemented in the host1x driver. When a driver is registered with the
0033 infrastructure it provides a list of compatible strings specifying the devices
0034 that it needs. The infrastructure creates a logical device and scan the device
0035 tree for matching device nodes, adding the required clients to a list. Drivers
0036 for individual clients register with the infrastructure as well and are added
0037 to the logical host1x device.
0038
0039 Once all clients are available, the infrastructure will initialize the logical
0040 device using a driver-provided function which will set up the bits specific to
0041 the subsystem and in turn initialize each of its clients.
0042
0043 Similarly, when one of the clients is unregistered, the infrastructure will
0044 destroy the logical device by calling back into the driver, which ensures that
0045 the subsystem specific bits are torn down and the clients destroyed in turn.
0046
0047 Host1x Infrastructure Reference
0048 -------------------------------
0049
0050 .. kernel-doc:: include/linux/host1x.h
0051
0052 .. kernel-doc:: drivers/gpu/host1x/bus.c
0053 :export:
0054
0055 Host1x Syncpoint Reference
0056 --------------------------
0057
0058 .. kernel-doc:: drivers/gpu/host1x/syncpt.c
0059 :export:
0060
0061 KMS driver
0062 ==========
0063
0064 The display hardware has remained mostly backwards compatible over the various
0065 Tegra SoC generations, up until Tegra186 which introduces several changes that
0066 make it difficult to support with a parameterized driver.
0067
0068 Display Controllers
0069 -------------------
0070
0071 Tegra SoCs have two display controllers, each of which can be associated with
0072 zero or more outputs. Outputs can also share a single display controller, but
0073 only if they run with compatible display timings. Two display controllers can
0074 also share a single framebuffer, allowing cloned configurations even if modes
0075 on two outputs don't match. A display controller is modelled as a CRTC in KMS
0076 terms.
0077
0078 On Tegra186, the number of display controllers has been increased to three. A
0079 display controller can no longer drive all of the outputs. While two of these
0080 controllers can drive both DSI outputs and both SOR outputs, the third cannot
0081 drive any DSI.
0082
0083 Windows
0084 ~~~~~~~
0085
0086 A display controller controls a set of windows that can be used to composite
0087 multiple buffers onto the screen. While it is possible to assign arbitrary Z
0088 ordering to individual windows (by programming the corresponding blending
0089 registers), this is currently not supported by the driver. Instead, it will
0090 assume a fixed Z ordering of the windows (window A is the root window, that
0091 is, the lowest, while windows B and C are overlaid on top of window A). The
0092 overlay windows support multiple pixel formats and can automatically convert
0093 from YUV to RGB at scanout time. This makes them useful for displaying video
0094 content. In KMS, each window is modelled as a plane. Each display controller
0095 has a hardware cursor that is exposed as a cursor plane.
0096
0097 Outputs
0098 -------
0099
0100 The type and number of supported outputs varies between Tegra SoC generations.
0101 All generations support at least HDMI. While earlier generations supported the
0102 very simple RGB interfaces (one per display controller), recent generations no
0103 longer do and instead provide standard interfaces such as DSI and eDP/DP.
0104
0105 Outputs are modelled as a composite encoder/connector pair.
0106
0107 RGB/LVDS
0108 ~~~~~~~~
0109
0110 This interface is no longer available since Tegra124. It has been replaced by
0111 the more standard DSI and eDP interfaces.
0112
0113 HDMI
0114 ~~~~
0115
0116 HDMI is supported on all Tegra SoCs. Starting with Tegra210, HDMI is provided
0117 by the versatile SOR output, which supports eDP, DP and HDMI. The SOR is able
0118 to support HDMI 2.0, though support for this is currently not merged.
0119
0120 DSI
0121 ~~~
0122
0123 Although Tegra has supported DSI since Tegra30, the controller has changed in
0124 several ways in Tegra114. Since none of the publicly available development
0125 boards prior to Dalmore (Tegra114) have made use of DSI, only Tegra114 and
0126 later are supported by the drm/tegra driver.
0127
0128 eDP/DP
0129 ~~~~~~
0130
0131 eDP was first introduced in Tegra124 where it was used to drive the display
0132 panel for notebook form factors. Tegra210 added support for full DisplayPort
0133 support, though this is currently not implemented in the drm/tegra driver.
0134
0135 Userspace Interface
0136 ===================
0137
0138 The userspace interface provided by drm/tegra allows applications to create
0139 GEM buffers, access and control syncpoints as well as submit command streams
0140 to host1x.
0141
0142 GEM Buffers
0143 -----------
0144
0145 The ``DRM_IOCTL_TEGRA_GEM_CREATE`` IOCTL is used to create a GEM buffer object
0146 with Tegra-specific flags. This is useful for buffers that should be tiled, or
0147 that are to be scanned out upside down (useful for 3D content).
0148
0149 After a GEM buffer object has been created, its memory can be mapped by an
0150 application using the mmap offset returned by the ``DRM_IOCTL_TEGRA_GEM_MMAP``
0151 IOCTL.
0152
0153 Syncpoints
0154 ----------
0155
0156 The current value of a syncpoint can be obtained by executing the
0157 ``DRM_IOCTL_TEGRA_SYNCPT_READ`` IOCTL. Incrementing the syncpoint is achieved
0158 using the ``DRM_IOCTL_TEGRA_SYNCPT_INCR`` IOCTL.
0159
0160 Userspace can also request blocking on a syncpoint. To do so, it needs to
0161 execute the ``DRM_IOCTL_TEGRA_SYNCPT_WAIT`` IOCTL, specifying the value of
0162 the syncpoint to wait for. The kernel will release the application when the
0163 syncpoint reaches that value or after a specified timeout.
0164
0165 Command Stream Submission
0166 -------------------------
0167
0168 Before an application can submit command streams to host1x it needs to open a
0169 channel to an engine using the ``DRM_IOCTL_TEGRA_OPEN_CHANNEL`` IOCTL. Client
0170 IDs are used to identify the target of the channel. When a channel is no
0171 longer needed, it can be closed using the ``DRM_IOCTL_TEGRA_CLOSE_CHANNEL``
0172 IOCTL. To retrieve the syncpoint associated with a channel, an application
0173 can use the ``DRM_IOCTL_TEGRA_GET_SYNCPT``.
0174
0175 After opening a channel, submitting command streams is easy. The application
0176 writes commands into the memory backing a GEM buffer object and passes these
0177 to the ``DRM_IOCTL_TEGRA_SUBMIT`` IOCTL along with various other parameters,
0178 such as the syncpoints or relocations used in the job submission.