AMDGPU: Solution to reduce the size of ASIC headers in the kernel repository
Motivation
The apparent size (du -hsc *
) of the drivers/gpu/drm/amd/include
directory is 32.7% of the whole git tree (excluding .git
), and it's not going to stop growing. The directory only contains hw register definitions ("ASIC headers") that are mostly unused.
This presents a solution to:
- reduce the source code size of those ASIC headers by 98% (estimate)
- keep it low in the future
- allow developers to use all register definitions despite that
Solution
- Move ASIC headers to a separate repository. The kernel tree will only contain necessary definitions. (see step 2 for how that's achieved)
- If more definitions are needed:
- Copy the header files that you need from the ASIC header repository into
drivers/gpu/drm/amd/include
. - Make driver changes.
- Run a python script that will trim all header files in
drivers/gpu/drm/amd/include
and keep only the definitions that are used by the source code. (the python script can be in the kernel repository or in the ASIC header repository) - Make a commit with the trimmed definitions.
- Copy the header files that you need from the ASIC header repository into
How the python script will work is up to the implementer.
External projects that use the ASIC headers (Mesa, AMD tools) will switch to using the ASIC header repository instead of the kernel repository.
This is not a thread about Plymouth or slow boot times.