The Size Of Different DRM Graphics Drivers In Linux 4.7

Written by Michael Larabel in Linux Kernel on 24 July 2016 at 12:29 PM EDT. 7 Comments
LINUX KERNEL
Last October I looked at The Size Of The Different Open-Source Linux DRM/Mesa Graphics Drivers, but with it being nearly one year since then and Linux 4.7 due out today, I decided to run some fresh L.O.C. measurements on the popular DRM/KMS drivers to see their current sizes.

This lines-of-code counting was mostly done out of a curiosity factor. In this article I'm just looking at the in-kernel DRM code and not the Mesa drivers, DDX drivers, LLVM back-ends, or anything else in user-space related to the open-source graphics drivers.

All of these cloc measurements were done on the Linux mainline kernel Git code as of this morning. First up was the Intel DRM (i915) driver.
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
C                               79          18416          15443          80757
C/C++ Header                    23           2262           3178          13730

Basically about 94.5k lines of code across 103 files. 18.6k lines of comments if you are wondering how well documented the code is...

Next is a look at Nouveau:
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
C                              535          12802          16385          88078
C/C++ Header                   276           1874           2639          27542

A total of 115.6k lines of code across 811 files... And 19k lines of documentation.

The AMDGPU/Radeon DRM is a bit more difficult to get a firm look at since some code is shared between the two drivers. In the AMDGPU driver directory they also have the AMDKFD driver code and more. So first up is a look at the radeon/ directory.
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
C                              111          17644          13065         120312
C/C++ Header                    83           4042           5648          39420

The Radeon driver is around 159k lines of code across 195 files but even though this driver is larger than the others there is just 18k lines of comments.

And then the AMDGPU directory that also includes AMDKFD and other shared code with it:
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
C/C++ Header                   248           6412          10419         440630
C                              148          20526          14909         102460

Damn! AMDGPU loves the header files at 440k lines of code while the detected C code by cloc comes in at just 102k lines of code. If looking at just amd/amdgpu it amounts to:
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
C                               86          12279           9856          69476
C/C++ Header                    66           1727           3393           9991

The AMDGPU driver gained a lot of weight this year when it came to adding the Polaris hardware support. There's also a lot more code yet to be merged in the form of the DAL display abstraction layer that isn't being merged until at least Linux 4.9.

For those wondering about the size of fully-capable of ARM DRM drivers, VC4 for Raspberry Pi comes in at just under 7k lines of code.
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
C                               16           1258           1012           5586
C/C++ Header                     5            260            361           1304

Or the Freedreno MSM DRM driver is around 35k lines of code:
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
C                               67           4939           2867          20574
C/C++ Header                    37           3405           1114          14723
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