Use linuxkpi in DRM

Currently, our DRM uses a small Linux wrapper in sys/dev/drm2/drm_os_freebsd.[ch]. Now that we have a centralized Linux shim (moved out of OFED), we want to use it. It will avoid duplicate efforts. In DRM, it will further reduce the diff with Linux.

This branch will be used for the update to Linux 3.9 just after this task.

  • Move DRM headers to a similar location as Linux
  • Use kmalloc() instead of malloc(9)
  • Use kref
  • Use idr and get rid of drm_gem_names.c
  • Use PCI API
  • Use Linux locking primitives

The project just started with a contribution from Conrad Meyer: he changed all calls to FreeBSD's malloc(9) to Linux kmalloc() calls.

Whether it works or not, we are interested in the output of dmesg and, in case of a kernel crash, the corresponding /var/crash/core.txt.* files. Please send them to the freebsd-x11 mailing list.

At this time, we aren't providing user support. However, if you have patches, they are very much welcome!

Thank you for your help!

  1. Make sure you have everything setup to have kernel dumps:
# In /etc/rc.conf
dumpdev="AUTO"
ddb_enable="YES"

Additionally, it helps to have the following sysctl:

# In /etc/sysctl.conf
debug.debugger_on_panic=0
  1. Enable DRM debug messages:
# In /boot/loader.conf
drm.debug=7
  1. You need to clone the repository and switch to the drm-next-3.9 branch:
git clone -b drm-next-3.9 \
 https://github.com/freebsd/freebsd-base-graphics.git
  1. Build and install a kernel from this clone; I suggest you install the kernel with a non-default name:
cd freebsd-base-graphics
sudo make kernel INSTKERNNAME=kernel.39
  1. Select the new kernel for the next boot and reboot:
sudo nextboot -k kernel.39
sudo reboot
  1. Try to load the appropriate driver:
sudo kldload i915kms
}}} or {{{
sudo kldload radeonkms
  1. Try to start an X.Org server and use it!
  1. Send feedback! Post on the freebsd-x11 mailing list

  • jeansebastienpedron/linuxkpiindrm.txt
  • Last modified: 2021/04/10 04:49
  • by KubilayKocak