freebsd / drm-kmod

drm driver for FreeBSD
155 stars 69 forks source link

Update to Linux 5.16 drivers #232

Closed dumbbell closed 1 year ago

dumbbell commented 1 year ago

This is the backport of the DRM drivers from Linux 5.16.

Progress:

Changes in Linux 5.16

You can read this Phoronix article to learn about the changes in the DRM drivers in Linux 5.16: https://www.phoronix.com/news/Linux-5.16-Graphics-Drivers

Patches to linuxkpi

This update depends on the following patches to linuxkpi in FreeBSD:

All patches are merged into main.

How to test

You need to run a recent FreeBSD 14-CURRENT to test it.

Here are some instructions:

  1. You need to checkout the FreeBSD main src branch, and compile a kernel from that branch:

    git clone https://github.com/freebsd/freebsd-src.git
    cd freebsd-src
    make -j8 buildkernel DEBUG_FLAGS=-g
    
    # This installs the kernel under another name, `kernel.drm`. Thus, you keep the default kernel
    # in case of trouble.
    sudo make installkernel DEBUG_FLAGS=-g INSTKERNNAME=kernel.drm
  2. You need to checkout the branch referenced in this pull request and compile it:

    git clone -b update-to-v5.16 https://github.com/dumbbell/drm-kmod.git
    cd drm-kmod
    make -j8 DEBUG_FLAGS=-g
    sudo make install DEBUG_FLAGS=-g KMODDIR=/boot/kernel.drm

    This will need access to the FreeBSD src tree cloned above. I don't remember the name of the variable to point the build to it. You can link /usr/src to your clone and it will be enough.

  3. You will need GPU firmwares in the kernel.drm directory as well (drm-kmod-firmware#26). To compile and install them:

    git clone -b drm-5.14 https://github.com/dumbbell/drm-kmod-firmware.git
    cd drm-kmod-firmware
    make -j8 DEBUG_FLAGS=-g OSVERSION=1400000
    sudo make install DEBUG_FLAGS=-g KMODDIR=/boot/kernel.drm OSVERSION=1400000
  4. Load the relevant driver(s) as you usually do.

orbitz commented 1 year ago

I tried this on 12gen laptop, I know support is not stable or much is expected. I get a black screen and then the fans kick in once the driver is loaded.

dumbbell commented 1 year ago

I tried this on 12gen laptop, I know support is not stable or much is expected. I get a black screen and then the fans kick in once the driver is loaded.

It depends on the generation, an Alder Lake S is supposed to be stable with Linux 5.16. I suppose you have an Alder Lake P instead.

The fans makes me think of an infinite loop in the driver, perhaps a bug in my backport, not something from the upstream code.

ko56 commented 11 months ago

Is there any chance that this work will make it into 14.0-RELEASE? (I have Intel Alderlake-S graphics.)

dumbbell commented 11 months ago

Doesn't drm-kmod 5.15 from ports work for you?

ko56 commented 11 months ago

I'm not clear about the whole thing. Maybe you can clarify. I have 14.0-RC4. Is there a package for the latest version of the port? I see the port is dated Oct. 26.
If there is no package, in order to compile the port, do I need src for the whole system, or is the port enough? That is, do I have to build a whole new kernel?

dumbbell commented 11 months ago

The drm-515-kmod package/port is likely to support your Intel GPU. It is available for FreeBSD 13.x and 14.x.

If you want to compile the drivers yourself, you will need a copy of freebsd-src that matches the installed kernel. However, you don't need to recompile the kernel itself, just the driver.

The instructions in the description of this pull request talked about recompiling the kernel because at the time, the drivers required changes in the kernel that were not merged in the main branch yet.

ko56 commented 11 months ago

OK, with 14.0-RC4, I tried the package drm-515-kmod, version 5.15.118.
I did not explicitly load i915kms in /etc/rc.conf. The result is that the system froze at the end of booting. Totally unresponsive, had to turn off the power. I believe others have reported very similar problems.

decke commented 11 months ago

@ko56 probably you are facing #252 ?

ko56 commented 11 months ago

@ko56 probably you are facing #252 ?

Yes, I think so. I had seen your post in #252 before, but I was hoping that what @dumbbell said above would fix the problem ...