nomadlogic edited this page Oct 11, 2017 · 41 revisions

Welcome to FreeBSD Desktop

Providing better kernel support for desktop users

Deprecation Notice

This instructions and work contained in this Wiki has been supplanted by the creation and import of the "drm-next-kmod" port and package. And while this repository will remain active for future drm-next development, it is recommended that users instead use the port/pkg. Briefly the instructions for this are:

  1. Ensure you have a recent (i.e. a checkout post 09/2017) 12-CURRENT image installed on your system.
  2. Install either the graphics/drm-next-kmod port or the official pre-built package. To install the package one could do the following: $ sudo pkg install drm-next-kmod
  3. Be sure to read the message that will be displayed after installation succeeds closely.

It is also suggested that you do not install the xf86-video-intel port/pkg. While it will work, the upstream Xorg team is putting their efforts behind the modesetting Xorg driver and Glamor for GL acceleration. As such it is most likely any bugs encountered in Xorg will be patched first in the modesetting codebase. The modesetting driver is installed by default via the xorg-server port/pkg.

If you would like more information on debugging, testing or hacking on the drm-next code please read on.


Background

This wiki will walk you through enabling newer Intel i915 based GPU's on FreeBSD. This code is currently a fork of FreeBSD-CURRENT and has brought Linux KBI compatibility inline with the current Linux-4.7 Kernel. Support for Haswell and newer Intel supports is working, and bug reports and testing are highly encouraged.

There are multiple branches in this repository under active development. While the drm-next branch tracks upstream, it is not guaranteed to work at any point in time, as such Intel GPU users should track the drm-next branch. This guide covers getting the source-code and building it on your system.

Once your system is able to load the updated i915kms.ko you can install Xorg and any other applications using the default upstream 12-CURRENT pkg repository.


Building Kernel From Scratch

The drm-next branch contains updates to support Linux-4.7 Kernel ABI calls, and as such allows us to import the latest Intel supplied Linux graphics drivers. To make this happen you'll need to build and install an updated kernel as well as world.

First, you will need to clone the drm-next branch from the freebsd-base-graphics repo like so:

git clone https://github.com/FreeBSDDesktop/freebsd-base-graphics.git -b drm-next

You can follow the instructions in the Handbook located here for building and installing your new world and kernel. A brief example may look like:

pkg install llvm40
cd <path to drm-next checkout>
make -j<ncpus> buildworld -s
make -j<ncpus> buildkernel -s
sudo make -j<ncpus> installkernel -s
sudo mergemaster -p -m <path to drm-next checkout>
sudo make installworld -s
sudo mergemaster -m <path to drm-next checkout>

Loading Kernel Module

After building and installing the kernel from the drm-next repository the module can be loaded in multiple ways. After X has been installed you can run "starx" and Xorg will take care of loading the i915kms.ko. Alternatively you can append the following to rc.conf:

kld_list="i915kms"

It is also possible to load the module via /boot/loader.conf this is necessary, and is most likely slower than the methods mentioned above.

Another critical step is to add your local user to the video group, this will allow your user to access the critical /dev/drm devices for X to operate.


Installing Required Userland Components

The upstream FreeBSD 12-CURRENT pkg repository contains recent enough Xorg drivers that we no longer need to build patched versions of Xorg and friends. The updated packages also allow us to run a fully accelerated X without having to manually configure xorg.conf itself. Here we install Xorg and launch twm to verify things are working as expected:

$ pkg install xorg xorg-server
$ startx

YMMV for the above, but the basic gist is that there are no special steps required to run X with the drm-next world installed. X should detect the i915 GPU and load it's "modesetting" driver, which offers good acceleration support as well as stability.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.