Porting Intel's igt-gpu-tools to FreeBSD
By Jake Freeland on June 25, 2022
The Beginning
It wasn't long ago that I reached out to FreeBSD's mailing lists in hopes of receiving an opportunity to work under the FreeBSD Foundation. It is a few months later and I successfully landed a summer job at FreeBSD under their Google Summer of Code Program. My task is to develop a feature complete port of Intel’s igt-gpu-tools with Joseph Mingrone, FreeBSD Foundation Project Coordinator, and Emmanuel Vadot, a member of FreeBSD's Core Team. I see this as an excellent opportunity to write some documentation and share my experience here on cdaemon.
igt-gpu-tools
Intel’s igt-gpu-tools serves as a generic testing suite for drm drivers on Linux. The igt-gpu-tools suite is separated into tests and tools that target kms, memory management, and command submission. The utility provides low-level reporting for transparent tracking of kernel changes and efficient debugging of modern drm drivers.
Why Bother?
Porting the project to FreeBSD could introduce greater stability in future releases of FreeBSD’s LinuxKPI-driven drm drivers. A proper kms-driven testing suite could also increase code output and bring the FreeBSD desktop experience up to speed with the Linux codebase. I often find myself lost in documentation about the inner workings of drm and graphics drivers. I love the idea of translating code into something that you can see on a monitor. This project marks my debut into the world of graphics development.
The Porting Process
The first step in porting igt-gpu-tools is getting the source code to compile on a FreeBSD system. Correcting compilation errors will give me a good idea of what portions of the program need to be rewritten. After non-FreeBSD compatible code has been removed, I plan on rewriting these components in a POSIX compliant matter. Some immediate notable incompatibilities are the absence of debugfs, libkmod, libprocps, Linux performance events, and Linux userfaultfd.
The Aftermath
Once the FreeBSD compatible code is complete, I will run the modified igt tests using a host of graphics processors on FreeBSD 14.0-CURRENT. If all is well, the project's diff will be submitted as a port in the FreeBSD ports tree. With some experience under by belt, I can hopefully continue my FreeBSD journey by contributing to the drm-kmod project. I've fallen in love with FreeBSD over the course of time, but my desktop's hardware is holding me back from properly running FreeBSD on my main work machine. I would love to change that.
The next gsoc2022 update will share my discoveries and difficulties around getting igt-gpu-tools to compile on FreeBSD. If you're interested in following along, see the "gsoc2022" tag below.