Debian Codegraph @

docs/drivers/lima.rst

raw
1 Lima
2 ====
3
4 Lima is an open source graphics driver which supports Mali Utgard
5 (Mali-4xx) embedded GPUs from ARM. It’s a reverse-engineered,
6 community-developed driver, and is not endorsed by ARM. Lima was
7 upstreamed in Mesa 19.1 and Linux kernel 5.2.
8
9 ======== ============ ===========
10 Product Architecture Status
11 ======== ============ ===========
12 Mali-400 Utgard Supported
13 Mali-450 Utgard Supported
14 Mali-470 Utgard Unsupported
15 ======== ============ ===========
16
17 Newer Mali chips based on the Midgard/Bifrost architectures (Mali T or G
18 series) are handled by the :doc:`Panfrost <panfrost>` driver, not Lima.
19
20 Note that the Mali GPU is only for rendering: the GPU does not control a
21 display and has little to do with display-related issues.
22 Each SoC has its own separate display engine to control the display
23 output. To display the contents rendered by the Mali GPU to a screen, a
24 separate `display driver <#display-drivers>`__ is also required, which
25 is able to share buffers with the GPU. In Mesa, this is handled by
26 ``kmsro``.
27
28 Supported APIs
29 --------------
30
31 Lima mainly targets **OpenGL ES 2.0**, as well as **OpenGL 2.1**
32 (desktop) to some extent.
33
34 The OpenGL (desktop) implementation is enabled by Mesa and Gallium,
35 where it is possible to reuse the same implementation backend. That way,
36 it is possible to support running a majority of Linux desktop
37 applications designed for OpenGL. It is not possible to fully support
38 OpenGL (desktop), though, due to hardware limitations. Some (but not
39 all) features of OpenGL 2.1 that are not supported directly in hardware
40 are enabled by internal shader transformations.
41 Check the `known hardware limitations <#known-hardware-limitations>`__
42 list for additional information.
43
44 **OpenGL ES 1.1** and **OpenGL 1.x** are also provided by Mesa and
45 similarly supported to some extent in Lima.
46
47 Display drivers
48 ---------------
49
50 These are some display drivers that have been tested with Lima:
51
52 - Allwinner: ``sun4i-drm``
53 - Amlogic: ``meson``
54 - Ericsson MCDE: ``mcde``
55 - Exynos: ``exynos``
56 - Rockchip: ``rockchip``
57 - Tiny DRM: ``tinydrm``
58 - Xilinx ZynqMP: ``zynqmp-dpsub``
59
60 Environment variables
61 ---------------------
62
63 These are some Lima-specific environment variables that may aid in
64 debugging. None of this is required for normal use.
65
66 .. envvar:: LIMA_DEBUG
67
68 accepts the following comma-separated list of flags:
69
70 ``bocache``
71 print debug info for BO cache
72 ``diskcache``
73 print debug info for shader disk cache
74 ``dump``
75 dump GPU command stream to ``$PWD/lima.dump``
76 ``gp``
77 print GP shader compiler result of each stage
78 ``noblit``
79 use generic u_blitter instead of Lima-specific
80 ``nobocache``
81 disable BO cache
82 ``nogrowheap``
83 disable growable heap buffer
84 ``notiling``
85 don’t use tiled buffers
86 ``pp``
87 print PP shader compiler result of each stage
88 ``precompile``
89 precompile shaders for shader-db
90 ``shaderdb``
91 print shader information for shaderdb
92 ``singlejob``
93 disable multi job optimization
94
95
96 .. envvar:: LIMA_CTX_NUM_PLB
97
98 set number of PLB per context (used for development purposes)
99
100 .. envvar:: LIMA_PLB_MAX_BLK
101
102 set PLB max block (used for development purposes)
103
104 .. envvar:: LIMA_PPIR_FORCE_SPILLING
105
106 force spilling of variables in PPIR (used for development purposes)
107
108 .. envvar:: LIMA_PLB_PP_STREAM_CACHE_SIZE
109
110 set PP stream cache size (used for development purposes)
111
112 Known hardware limitations
113 --------------------------
114
115 Here are some known caveats in OpenGL support:
116
117 - ``glPolygonMode()`` with ``GL_LINE`` is not supported. This is not part of
118 OpenGL ES 2.0 and so it is not possible to reverse engineer.
119
120 - Precision limitations in fragment shaders:
121
122 - In general, only
123 `FP16 <https://en.wikipedia.org/wiki/Half-precision_floating-point_format>`__
124 precision is supported in fragment shaders. Specifying ``highp``
125 will have no effect.
126 - Integers are not supported in hardware, they are lowered down to
127 FP16.
128 - There is a higher precision (FP24) path for texture lookups, if
129 there is *no* math performed on texture coordinates obtained from
130 varyings. If there is *any* calculation done in the texture
131 coordinates, the texture coordinates will fall back to FP16 and
132 that may affect the quality of the texture lookup.
133
134 - Lima supports FP16 textures in OpenGL ES (through
135 :ext:`GL_OES_texture_half_float<GL_OES_texture_float>`), but not in OpenGL.
136 This is because it would require :ext:`GL_ARB_texture_float` which would
137 also require 32-bit float textures, that the Mali-4xx does not support.
138 - Rendering to FP16 is possible, but the result is clamped to the
139 [0.0,1.0] range.
140
141 Bug Reporting
142 -------------
143
144 Please try the latest Mesa development branch or at least Mesa latest
145 release before reporting issues. Please review the
146 :doc:`Mesa bug report guidelines <../bugs>`.
147
148 Issues should be filed as a `Mesa issue`_.
149 Lima tags will be added accordingly by the developers.
150
151 `apitrace <https://github.com/apitrace/apitrace>`__ traces are very
152 welcome in issue reports and significantly ease the debug and fix
153 process.
154
155 FAQ
156 ---
157
158 Will Lima support OpenGL 3.x+ / OpenGL ES 3.x+ / OpenCL / Vulkan ?
159 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
160
161 **No.** The Mali-4xx was designed to implement OpenGL ES 2.0 and OpenGL
162 ES 1.1. The hardware lacks features to properly implement some features
163 required by newer APIs.
164
165 How complete is Lima? Is reverse engineering complete?
166 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
167
168 At the time of writing, with local runs of the
169 `OpenGL ES Conformance Tests <https://github.com/KhronosGroup/VK-GL-CTS/>`__
170 (dEQP) for OpenGL ES 2.0, Lima reports **97%** pass rate.
171 This coverage is on par with coverage provided by the ARM Mali driver.
172 Some tests that pass with Lima fail on Mali and vice versa. Some of
173 these issues are related to precision limitations which likely don’t
174 affect end user applications.
175
176 The work being done in Lima at this stage is largely decoupled from
177 reverse engineering. Reverse engineering is still useful sometimes to
178 obtain details on how to implement low level features (e.g. how to
179 enable some missing legacy OpenGL ES 1.1 feature to support an
180 additional application), but with the current information Lima is
181 already able to cover most of OpenGL ES 2.0.
182
183 Much of the work to be done is related to plumbing features within the
184 frameworks provided by Mesa, fixing bugs (e.g. artifacts or crashes in
185 specific applications), shader compiler improvements, which are not
186 necessarily related to new hardware bits and not related at all to the
187 Mali driver.
188
189 When will Feature XYZ be supported? Is there a roadmap for features implementation?
190 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
191
192 There is no established roadmap for features implementation.
193 Development is driven by improving coverage in existing OpenGL test
194 frameworks, adding support to features that enable more existing Linux
195 applications, and fixing issues reported by users in their applications.
196 Development is fully based on community contributions.
197
198 If some desired feature is missing or there is an OpenGL-related bug
199 while running some application, please do file a `Mesa issue`_.
200 Issues that are not reproduced by an existing test suite or common
201 application and are also not reported by users are just likely not going
202 to be noticed and fixed.
203
204 How does Lima compare to Mali (blob)? How is performance?
205 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
206
207 By the fact that Lima is a fully open source driver and leverages a lot
208 of Mesa and Linux functionality, feature-wise Lima is able to support
209 many things that Mali does not. As already mentioned, supporting OpenGL
210 2.1 is one of them. This allows Lima to support many more Linux desktop
211 applications out of the box. Through the abstractions implemented in
212 Mesa, Lima supports a number of OpenGL and OpenGL ES extensions that
213 originally the Mali did not support. Lima is also aligned with the
214 current status of the Linux graphics stack and is therefore able to
215 leverage modern features (such as zero copy pipelines) much more
216 seamlessly. Finally, Lima continues to gain improvements as the Linux
217 graphics ecosystem evolves.
218
219 The entire software stack of the Mali driver and the software stack with
220 Lima are significantly different which makes it hard to offer a single
221 number comparison for performance of the GPU driver. The difference
222 really depends on the type of application. Keep in mind that hardware
223 containing a Mali-4xx is usually quite limited for modern standards and
224 it might not perform as well as hoped. For example: while it is now
225 technically possible to run full GL modern desktop environments at 1080p
226 (which might not have been even possible before due to limited GL
227 support), that might not be very performant due to memory bandwidth, CPU
228 and GPU limitations of the SoC with a Mali-4xx.
229
230 Overall performance with Lima is good for many applications where the
231 Mali-4xx would be a suitable target GPU.
232 But bottom line for a performance evaluation, you need to try with your
233 target application. If performance with Lima does not seem right in some
234 application where it should reasonably perform better, please file a
235 `Mesa issue`_ (in which case some indication on why Lima in particular
236 seems to be the bottleneck would also be helpful).
237
238 Communication channels
239 ----------------------
240
241 - `#lima channel <irc://irc.oftc.net/lima>`__ on `irc.oftc.net <https://webchat.oftc.net/>`__
242 - `lima mailing list <https://lists.freedesktop.org/mailman/listinfo/lima>`__
243 - `dri-devel mailing list <https://lists.freedesktop.org/mailman/listinfo/dri-devel>`__
244
245 Dump tool
246 ---------
247
248 A tool to dump the runtime of the closed source Mali driver for
249 reverse engineering is available at:
250 https://gitlab.freedesktop.org/lima/mali-syscall-tracker
251
252 Reference
253 ---------
254
255 Luc Verhaegen’s original Lima site:
256 https://web.archive.org/web/20180101212947/http://limadriver.org/
257
258 .. _Mesa issue: https://gitlab.freedesktop.org/mesa/mesa/-/issues?label_name%5B%5D=lima