The Direct Rendering Manager is developed within the Linux kernel, and its source code resides in the /drivers/gpu/drm directory of the Linux source code.
For historical reasons, the source code of the libdrm library is maintained under the umbrella of the Mesa project.