- C 99.9%
In order to support page_pools and further changes there is a plan to migrate 'struct page' away from vm_page_t to Linux-native struct page. The change introduces a conditional (PAGE_IS_LKPI_PAGE), which is also used for the migration in LinuxKPI, to allow for a smooth transition. Adding the conditionals here upfront serves two goals: (i) prepare drm-kmod for the LinuxKPI changes to come, so that drm-kmod will not break, and (ii) allow people trying out PAGE_IS_LKPI_PAGE for page_pools/the mt76 wireless driver to also be able to use drm-kmod. In the long-term once LinuxKPI transitioned, this will also help to redice FreeBSD-specific code in drm-kmod. Sponsored by: The FreeBSD Foundation Co-authored-by: Bjoern A. Zeeb <bz@FreeBSD.org> |
||
|---|---|---|
| .github/ISSUE_TEMPLATE | ||
| amd | ||
| dmabuf | ||
| drivers | ||
| drm | ||
| dummygfx | ||
| i915 | ||
| include | ||
| linuxkpi | ||
| linuxkpi_video | ||
| radeon | ||
| scripts | ||
| ttm | ||
| .cirrus.yml | ||
| .gitignore | ||
| kconfig.mk | ||
| linuxkpi_version.mk | ||
| Makefile | ||
| README.md | ||
drm-kmod
The DRM drivers ported from Linux to FreeBSD using linuxkpi.
Installing from sources
Requirements
You need to have the sources of FreeBSD kernel available and they MUST correspond to the installed version of FreeBSD.
There are several ways to get them:
- by using the FreeBSD installer
- by using the
FreeBSD-src-syspackage if you use PkgBase - by cloning the Git repository from https://git.FreeBSD.org/src.git or any mirror
By default, Makefiles expect the sources of the kernel to be in /usr/src/sys.
The installer and the PkgBase package will install them in that directory. If
you clone from Git, you can set SYSDIR=/path/to/FreeBSD/src/sys on the
make(1) command line or in the environment when compiling the drivers and their
firmwares.
Building
make -j12 DEBUG_FLAGS=-g SYSDIR=/usr/src/sys
As stated in the requirements section, set SYSDIR to the location where you
put the FreeBSD kernel sources. The example above shows the default value.
Installing
sudo make install DEBUG_FLAGS=-g SYSDIR=/usr/src/sys KMODDIR=/boot/modules
As stated in the requirements section, set SYSDIR to the location where you
put the FreeBSD kernel sources. The example above shows the default value.
Likewise, set KMODDIR to the location of the kernel you want to install the
drivers for. The example above shows the default value which is the global
directory, used by all installed kernels
Important
The DRM drivers MUST be compiled against the kernel sources corresponding to the installed kernel you want to use them with.
GPU firmwares
DRM drivers depend on binary firmwares. They are maintained in a separate Git repository at https://github.com/freebsd/drm-kmod-firmware.
The binary firmwares are packaged into kernel modules and loaded automatically by the DRM drivers when needed.
The kernel modules can be compiled by following the same instructions as the DRM drivers. The same constraint applies: use the matching kernel sources.
Contributing
Tip
This part is a TL;DR version of the porting process. For the full version, please visit https://github.com/freebsd/drm-kmod/wiki/Porting-a-new-version-of-DRM-drivers-from-Linux.
-
Clone Linux:
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git /path/to/linux-src -
Extract Linux patches:
./scripts/drmgeneratepatch \ /path/to/linux-src \ /path/to/patches-6.7 \ v6.6..v6.7 -
Filter out already applied patches:
./scripts/drmcheckapplied /path/to/patches-6.7 -
Apply patches to
drm-kmod:./scripts/drmpatch /path/to/patches-6.7