freebsd / drm-kmod

drm driver for FreeBSD
148 stars 68 forks source link

Update to Linux 5.18 drivers #267

Closed dumbbell closed 6 months ago

dumbbell commented 7 months ago

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

Progress:

Changes in Linux 5.18

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

Patches to linuxkpi

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

Checked patches were merged into freebsd-src's main branches.

These patches are maintained in the following repository and branch: https://github.com/dumbbell/freebsd-src/tree/linuxkpi-updates-for-drm

Firmware updates

This update makes use of new firmwares. See freebsd/drm-kmod-firmware#28.

How to test

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

Here are some instructions:

  1. You need to checkout the FreeBSD src branch I mentionned, linuxkpi-updates-for-drm, and compile a kernel from that branch:

    git clone -b linuxkpi-updates-for-drm https://github.com/dumbbell/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.18 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. To compile and install them:

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

dumbbell commented 6 months ago

All patches from Linux 5.18 were backported.

The next steps are:

And of course, testing!

lin72h commented 6 months ago

The progress is amazing, Hopefully the AMD RDNA3 GPU can works on FreeBSD very soon

orbitz commented 6 months ago

@dumbbell I just want to say: Thank you! Because of you I am able to use my Framework laptop. Suspend/resume even mostly works! Pretty fantastic.

lin72h commented 6 months ago

@dumbbell thank you for working on this, just curious the latest master branch already have Linux 6.1 support, are you gonna merge your work with master or start working working on master?

dumbbell commented 6 months ago

@dumbbell I just want to say: Thank you! Because of you I am able to use my Framework laptop. Suspend/resume even mostly works! Pretty fantastic.

Thank you very much! I'm really happy I could help :-)

dumbbell commented 6 months ago

@dumbbell thank you for working on this, just curious the latest master branch already have Linux 6.1 support, are you gonna merge your work with master or start working working on master?

You're welcome!

This branch/pull request will be closed and abandoned unfortunately because of the concurrent and unexpected merge of the 6.1 version. I don't plan to work on DRM updates until we solve that communication problem.

lin72h commented 6 months ago

yeah that 6.1 version surprises me too, since I'm following your drm porting progress for quite a while. thanks for your effort again. I'm trying to import new AMD RDNA3 firmware and to see if I can make it works on the Linux 6.1 master branch.

mekanix commented 6 months ago

If you do something for RDNA3 firmware, please announce it somewhere. I have CURRENT running on one of the boxes with RDNA3 card and I'd like help testing if I can.

@dumbbell I follow your work for more than I year, now, and I have nothing but respect and admiration! Thank you for pushing it so far and I hope the communication problem will be solved quickly.

lin72h commented 6 months ago

@mekanix Very exciting you already have a FreeBSD15-Current running on RDNA3 card, I have a 7900 XT card and want to make it work, but I'm very new to the low level drm driver stuff, I'll post on the discussion section on this Repo if I make any progress

orbitz commented 6 months ago

@dumbbell Anything those of us who depend on these new drivers can do to help motivate better communication? I'd hate to see it stalled, I'm really looking forward to getting new updates and I have no idea how to do it myself.