xref: /third_party/mesa3d/docs/drivers/asahi.rst (revision bf215546)
1bf215546Sopenharmony_ciAsahi
2bf215546Sopenharmony_ci=====
3bf215546Sopenharmony_ci
4bf215546Sopenharmony_ciThe Asahi driver aims to provide an OpenGL implementation for the Apple M1.
5bf215546Sopenharmony_ci
6bf215546Sopenharmony_ciTesting on macOS
7bf215546Sopenharmony_ci-----------------
8bf215546Sopenharmony_ci
9bf215546Sopenharmony_ciOn macOS, the experimental Asahi driver may built with options:
10bf215546Sopenharmony_ci
11bf215546Sopenharmony_ci    -Dosmesa=true -Dglx=xlib -Dgallium-drivers=asahi,swrast
12bf215546Sopenharmony_ci
13bf215546Sopenharmony_ciTo use, set the ``DYLD_LIBRARY_PATH`` environment variable:
14bf215546Sopenharmony_ci
15bf215546Sopenharmony_ci   DYLD_LIBRARY_PATH=/Users/nobody/mesa/build/src/gallium/targets/libgl-xlib/ glmark2 --reuse-context
16bf215546Sopenharmony_ci
17bf215546Sopenharmony_ciOnly X11 apps are supported. XQuartz must be setup separately.
18bf215546Sopenharmony_ci
19bf215546Sopenharmony_ciWrap (macOS only)
20bf215546Sopenharmony_ci-----------------
21bf215546Sopenharmony_ci
22bf215546Sopenharmony_ciMesa includes a library that wraps the key IOKit entrypoints used in the macOS
23bf215546Sopenharmony_ciUABI for AGX. The wrapped routines print information about the kernel calls made
24bf215546Sopenharmony_ciand dump work submitted to the GPU using agxdecode.
25bf215546Sopenharmony_ci
26bf215546Sopenharmony_ciThis library allows debugging Mesa, particularly around the undocumented macOS
27bf215546Sopenharmony_ciuser-kernel interface. Logs from Mesa may compared to Metal to check that the
28bf215546Sopenharmony_ciUABI is being used correcrly.
29bf215546Sopenharmony_ci
30bf215546Sopenharmony_ciFurthermore, it allows reverse-engineering the hardware, as glue to get at the
31bf215546Sopenharmony_ci"interesting" GPU memory.
32bf215546Sopenharmony_ci
33bf215546Sopenharmony_ciThe library is only built if ``-Dtools=asahi`` is passed. It builds a single
34bf215546Sopenharmony_ci``wrap.dylib`` file, which should be inserted into a process with the
35bf215546Sopenharmony_ci``DYLD_INSERT_LIBRARIES`` environment variable.
36bf215546Sopenharmony_ci
37bf215546Sopenharmony_ciFor example, to trace an app ``./app``, run:
38bf215546Sopenharmony_ci
39bf215546Sopenharmony_ci    DYLD_INSERT_LIBRARIES=~/mesa/build/src/asahi/lib/libwrap.dylib ./app
40