From c076aeb865fcfec15928f2470563d37643518e82 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 9 Jun 2022 09:03:23 -0400 Subject: [PATCH] docs/asahi: Document drm-shim Explain how to build drm-shim and how to use it for shader-db. Signed-off-by: Alyssa Rosenzweig Part-of: --- docs/drivers/asahi.rst | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/drivers/asahi.rst b/docs/drivers/asahi.rst index 633b8d1fe4b..7e848f083d7 100644 --- a/docs/drivers/asahi.rst +++ b/docs/drivers/asahi.rst @@ -277,3 +277,24 @@ logically. These extra levels pad out layers of 3D images to the size of the first layer, simplifying layout calculations for both software and hardware. Although the padding is logically unnecessary, it wastes little space compared to the sizes of large mipmapped 3D textures. + +drm-shim (Linux only) +--------------------- + +Mesa includes a library that mocks out the DRM UABI used by the Asahi driver +stack, allowing the Mesa driver to run on non-M1 Linux hardware. This can be +useful for exercising the compiler. To build, use options: + + -Dgallium-drivers=asahi -Dtools=drm-shim + +Then run an OpenGL workload with environment variable: + + LD_PRELOAD=~/mesa/build/src/asahi/drm-shim/libasahi_noop_drm_shim.so + +For example to compile a shader with shaderdb and print some statistics along +with the IR: + + ~/shader-db$ AGX_MESA_DEBUG=shaders,shaderdb ASAHI_MESA_DEBUG=precompile LIBGL_DRIVERS_PATH=~/lib/dri/ LD_PRELOAD=~/mesa/build/src/asahi/drm-shim/libasahi_noop_drm_shim.so ./run shaders/glmark/1-12.shader_test + +The drm-shim implementation for Asahi is located in ``src/asahi/drm-shim``. The +drm-shim implementation there should be updated as new UABI is added.