AMD's Modern Graphics Driver In Linux 5.14 Exceeds 3.3 Million Lines Of Code

Written by Michael Larabel in Radeon on 15 July 2021 at 06:33 AM EDT. 53 Comments
RADEON
It was just four years ago the AMDGPU kernel driver was nearly one million lines of code and earlier this year began nearing three million lines. Now with Linux 5.14-rc1 released this week it is at over 3.3 million lines for this kernel graphics driver.

Curiosity got the best of me with the ballooning size of AMDGPU so when running cloc on the "drivers/gpu/drm/amd" off Linux 5.14-rc1, it's now measuring in at 3.32 million lines of code. AMDGPU continues to by far be the largest driver within the mainline Linux kernel. That 3.3 million lines is made up of 2.86 million lines of "code", 332k lines of comments, and some 127k blank lines across 1,715 files.

Of course, as longtime Phoronix readers will know, much of the ballooning size of AMDGPU is due to automated register header files that are added to the tree with each new GPU being supported. Those automatically generated header files based on AMD's internal documentation lead to the explosive growth and is sort of AMD's form of public documentation these days. Thankfully unused portions of these header files are eliminated by the compiler at build time. As measured by cloc, within the gpu/drm/amd code there is some 2.4 million lines of header files and then 427k lines of code detected C code.

Meanwhile there is also the "Radeon" DRM driver within the kernel too for the older graphics processors. That Radeon DRM driver amounts to just under 200k lines of code in total.

As another comparison metric, Intel's current DRM kernel graphics driver (i915) comes in at roughly 313k lines of code.

The entire size of the Linux 5.14-rc1 source tree comes in at roughly 29.7 million lines via some 22 million lines of detected code, another 3.7 million lines of comments, and 3.9 million blank lines. Or in other words, more than 10% of the Linux kernel source tree amounts to within the AMD Direct Rendering Manager graphics/display code.

For those wondering what is new with this forthcoming kernel, see my Linux 5.14 feature overview. On the AMDGPU front the increasing size is due to the additions for the Yellow Carp and Beige Goby GPUs. AMDGPU also has hot unplugging code now working well, PCIe ASPM being enabled by default, AMD Smart Shift support, and various other AMD graphics improvements. Linux 5.14 stable should be out by early September.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week