Problems with drm-kmod on RX560

Hello! I'm on FreeBSD 14.1-RELEASE-p3 (updated from fresh FreeBSD 14.0-RELEASE) and I am using an AMD RX560.

Now, I have two problems!

1. First (which I'm going to open a bug report, in case someone has news or knows something more), drm-515-kmod will NOT work and I have to use drm-510-kmod instead. I learned that here and at first, it worked until I rebooted (see below). But still, I don't want to stay with an older DRM because of a bug so, it's a problem ??

2. And finally, while drm-510-kmod worked at first, when I rebooted, it stopped working and now when I try to start drm manually, I got the result shown in the attached image.

Ironically enough, I saw this thread where, people recommend RX570 and RX590 as cards that work out of the box and I wonder what happens with mine...
 

Attachments

  • IMG_20240906_162141.jpg
    IMG_20240906_162141.jpg
    635.3 KB · Views: 82
You should try to compile drm-515-kmod via the ports system on your machine.
The current version you get via packages is for 14.0-RELEASE.
 
1. First (which I'm going to open a bug report, in case someone has news or knows something more), drm-515-kmod will NOT work and I have to use drm-510-kmod instead. I learned that here and at first, it worked until I rebooted (see below). But still, I don't want to stay with an older DRM because of a bug so, it's a problem ??
I have graphics/drm-61-kmod on 14.1 and is working perfectly. The card is different, but I think you have probably issue with this version.
 
From your screenshot:
Code:
amdgpu: mc: Failed to load firmware "amdgpu/polaris11_mc.bin"
Is the firmware graphics/gpu-firmware-amd-kmod-polaris11 (flavor of the port graphics/gpu-firmware-amd-kmod) installed on your system? Maybe it needs compilation on your machine too like Emrion mentioned for the drm port.
I have graphics/drm-61-kmod on 14.1 and is working perfectly. The card is different, but I think you have probably issue with this version.
Thank you both! I compiled it manually and now.... It hangs at "loading kernel modules" at boot ???
 
Nevermind my other 2 replies! It doesn't compile...
It compiles.
Code:
awk -f /usr/src/sys/conf/kmod_syms.awk i915kms.ko  export_syms | xargs -J% objcopy % i915kms.ko
objcopy --strip-debug i915kms.ko
===>  Staging for drm-61-kmod-6.1.92
===>   Generating temporary packing list
===> dmabuf (install)
install -T release -o root -g wheel -m 444   dmabuf.ko /usr/ports/graphics/drm-61-kmod/work/stage/boot/modules/
===> ttm (install)
install -T release -o root -g wheel -m 444   ttm.ko /usr/ports/graphics/drm-61-kmod/work/stage/boot/modules/
===> drm (install)
install -T release -o root -g wheel -m 444   drm.ko /usr/ports/graphics/drm-61-kmod/work/stage/boot/modules/
===> linuxkpi_video (install)
install -T release -o root -g wheel -m 444   linuxkpi_video.ko /usr/ports/graphics/drm-61-kmod/work/stage/boot/modules/
===> amd (install)
===> amd/amdgpu (install)
install -T release -o root -g wheel -m 444   amdgpu.ko /usr/ports/graphics/drm-61-kmod/work/stage/boot/modules/
===> radeon (install)
install -T release -o root -g wheel -m 444   radeonkms.ko /usr/ports/graphics/drm-61-kmod/work/stage/boot/modules/
===> i915 (install)
install -T release -o root -g wheel -m 444   i915kms.ko /usr/ports/graphics/drm-61-kmod/work/stage/boot/modules/
====> Compressing man pages (compress-man)

Just tried. No problem. I think you need to have system source also in this machine.
 
OP needs to stay away from specific flavors.

I have an RX 550, RX 6900 XT and a Green Sardine iGPU - they all worked fine once I compiled graphics/drm-kmod and graphics/gpu-firmware-amd-kmod allowed it to install all the available firmwares for AMD.

Just compile those two, tell /etc/rc.conf to load amdgpu.ko, and OP will be good to go after a reboot. ?
Did you follow 4.5.1. Installing the Ports Collection and did you download the latest sources from the ports tree?
I updated the latest port tree (I hadn't before, oopsie!) and installed both the ports mentioned and loading it still hangs the system. I didn't tired to load it automatically so I don't have to use a rescue USB later but, I don't think it's any different than loading it manually and in that case, it still hangs...
 
It compiles.
Code:
awk -f /usr/src/sys/conf/kmod_syms.awk i915kms.ko  export_syms | xargs -J% objcopy % i915kms.ko
objcopy --strip-debug i915kms.ko
===>  Staging for drm-61-kmod-6.1.92
===>   Generating temporary packing list
===> dmabuf (install)
install -T release -o root -g wheel -m 444   dmabuf.ko /usr/ports/graphics/drm-61-kmod/work/stage/boot/modules/
===> ttm (install)
install -T release -o root -g wheel -m 444   ttm.ko /usr/ports/graphics/drm-61-kmod/work/stage/boot/modules/
===> drm (install)
install -T release -o root -g wheel -m 444   drm.ko /usr/ports/graphics/drm-61-kmod/work/stage/boot/modules/
===> linuxkpi_video (install)
install -T release -o root -g wheel -m 444   linuxkpi_video.ko /usr/ports/graphics/drm-61-kmod/work/stage/boot/modules/
===> amd (install)
===> amd/amdgpu (install)
install -T release -o root -g wheel -m 444   amdgpu.ko /usr/ports/graphics/drm-61-kmod/work/stage/boot/modules/
===> radeon (install)
install -T release -o root -g wheel -m 444   radeonkms.ko /usr/ports/graphics/drm-61-kmod/work/stage/boot/modules/
===> i915 (install)
install -T release -o root -g wheel -m 444   i915kms.ko /usr/ports/graphics/drm-61-kmod/work/stage/boot/modules/
====> Compressing man pages (compress-man)

Just tried. No problem. I think you need to have system source also in this machine.
Hmmm... I have it installed but it's from 14.0 and I don't know if it gets automatically updated when updating the OS itself. I removed and now re-download it again from GIT and I'll switch to the "stable/14" branch

Update:

I did it and still the same error. Specifically:

pkg-static: open(/usr/ports/graphics/drm-61-kmod/work/.metadir.drm-61-kmod): No such file or directory
 
I'm on FreeBSD 14.1-RELEASE-p3
If you haven't done so use freebsd-update(8) to update the latest patches; I have:
Code:
# freebsd-version -kru
14.1-RELEASE-p4
14.1-RELEASE-p4
14.1-RELEASE-p4
In and of itself that probably won't make much of a difference, but then we can all reference the exact same version.

Hmmm... I have it installed but it's from 14.0 and I don't know if it gets automatically updated when updating the OS itself. I removed and now re-download it again from GIT and I'll switch to the "stable/14.1" branch
I'm not sure what you are referring to. All the "drm-*-kmod" (like graphics/drm-61-kmod) port sources are in the repository from the ports tree.
"stable/14.1" branch refers to a certain branch of the source tree for the base-install of FreeBSD. Why would you want to switch?

[....] installed both the ports mentioned and loading it still hangs the system
Please post the output of pkg info drm-61-kmod and kldload -v amdgpu
 
If you haven't done so use freebsd-update(8) to update the latest patches; I have:
Code:
# freebsd-version -kru
14.1-RELEASE-p4
14.1-RELEASE-p4
14.1-RELEASE-p4
In and of itself that probably won't make much of a difference, but then we can all reference the exact same version.
Thank you, I did it and rebooted and I confirmed the version.

I'm not sure what you are referring to. All the "drm-*-kmod" (like graphics/drm-61-kmod) port sources are in the repositories from the ports tree.
"stable/14.1" branch refers to a certain branch of the source tree for the base-install of FreeBSD. Why would you want to do that?
I'm also not sure. I'm trying to understand. I tried to install everything from the ports tree, as told. "drm-515-kmod" get installed but doesn't work (system hangs) and "drm-61-kmod" gives the following installation error:

pkg-static: open(/usr/ports/graphics/drm-61-kmod/work/.metadir.drm-61-kmod): No such file or directory

Please post the output of pkg info drm-61-kmod and kldload -v amdgpu
No info for "drm-61-kmod" as the package isn't installed. No info for "kldload -v amdgpu" (using "drm-515-kmod") as, the system hangs and shows nothing more.
 
Concentrate for the moment on drm-61-kmod (instead of drm-515-kmod).

Building/compiling drm-61-kmod from source results in the installation of the package drm-61-kmod.

From the example of the Handbook in 4.5.1. Installing the Ports Collection
  1. "install lsof from ports" or "install the port lsof" means build it from source code
    Code:
    # cd /usr/ports/sysutils/lsof
    # make install
  2. install the package lsof means pkg install lsof
Each results in an installed package, like you can see afterwards by pkg info lsof. Do both as a practice example.

Now try building drm-61-kmod yourself.

So, should I install them from ports or there is no point and it's the same with "pkg"? I got confused...
There is no point to install from ports graphics/gpu-firmware-amd-kmod since this is just a set of binary files.
This means you can just install the package with pkg install gpu-firmware-amd-kmod. Verify that you're on the "latest" branch and not on "quarterly"; see 4.4.2. Quarterly and Latest Ports Branches
 
Concentrate for the moment on drm-61-kmod (instead of drm-515-kmod).

Building/compiling drm-61-kmod from source results in the installation of the package drm-61-kmod.

From the example of the Handbook in 4.5.1. Installing the Ports Collection
  1. "install lsof from ports" or "install the port lsof" means build it from source code
    Code:
    # cd /usr/ports/sysutils/lsof
    # make install
  2. install the package lsof means pkg install lsof
Each results in an installed package, like you can see afterwards by pkg info lsof. Do both as a practice example.

Now try building drm-61-kmod yourself.

This means you can just install the package with pkg install gpu-firmware-amd-kmod. Verify that you're on the "latest" branch and not on "quarterly"; see 4.4.2. Quarterly and Latest Ports Branches
Thank for all that detailed explanation! I knew all that (including the latest and quarterly branches) and I was trying to build everything from the ports tree as I was instructed. "drm-61-kmod" does not install (again, from ports tree), giving me the error message I posted.

Now, the confusion happened because Argentum, said " I think you need to have system source". The words "system source" made me think of the OS source code and because it's a a module that I build, I thought that I may need the OS source code additionally of the PORT source code.

I hope everything is clear now.
 
"drm-61-kmod" does not install (again, from ports tree), giving me the error message I posted.
After an appropriate make deinstall, post ( cat /usr/ports/graphics/drm-61-kmod/out.txt | nc termbin.com 9999 - post the resulting url) the output of:
Code:
# cd /usr/ports/graphics/drm-61-kmod
# make install
Code:
# sh
# cd /usr/ports/graphics/drm-61-kmod
# make clean
# make install >out.txt 2>&1
and pkg info drm-61-kmod
 
It's precisely that. You need these sources in /usr/src and in sync with the current OS (which is automatic if you had them before to upgrade).
Can you elaborate on that? Why would you need the base-source tree?
Building drm-61-kmod without /usr/src available (moved to /usr/srcBACK) looks fine here:
Rich (BB code):
root@q210: /usr/ports/graphics/drm-61-kmod # pkg info | grep drm
drm_info-2.6.0_1               Small utility to dump info about DRM devices
gpu-firmware-kmod-20240401,1   Firmware modules for the drm-kmod drivers
libdrm-2.4.122,1               Direct Rendering Manager library and headers
root@q210: /usr/ports/graphics/drm-61-kmod # ls /usr/
bin     home    include lib     lib32   libdata libexec local   obj     ports   sbin    share   srcBACK tests
root@q210: /usr/ports/graphics/drm-61-kmod # make install
===>  Installing for drm-61-kmod-6.1.92
===>  Checking if drm-61-kmod is already installed
===>   Registering installation for drm-61-kmod-6.1.92
Installing drm-61-kmod-6.1.92...
The drm-61-kmod port can be enabled for amdgpu (for AMD
GPUs starting with the HD7000 series / Tahiti) or i915kms (for Intel
APUs starting with HD3000 / Sandy Bridge) through kld_list in
/etc/rc.conf. radeonkms for older AMD GPUs can be loaded and there are
some positive reports if EFI boot is NOT enabled.

For amdgpu: kld_list="amdgpu"
For Intel: kld_list="i915kms"
For radeonkms: kld_list="radeonkms"

Please ensure that all users requiring graphics are members of the
"video" group.

root@q210: /usr/ports/graphics/drm-61-kmod # pkg info drm-61-kmod                                                                                                  [0] pts/1
drm-61-kmod-6.1.92
Name           : drm-61-kmod
Version        : 6.1.92
Installed on   : Sun Sep  8 15:09:31 2024 CEST
Origin         : graphics/drm-61-kmod
Architecture   : FreeBSD:14:amd64
Prefix         : /usr/local
Categories     : kld graphics
Licenses       : MIT and GPLv2 and BSD2CLAUSE
Maintainer     : x11@FreeBSD.org
WWW            : https://github.com/freebsd/drm-kmod/
Comment        : DRM drivers modules
Annotations    :
        FreeBSD_version: 1401000
Flat size      : 17.0MiB
Description    :
amdgpu, i915, and radeon DRM drivers modules.
Currently corresponding to Linux 6.1 DRM.
This version is for FreeBSD 14-STABLE 1400508
and above.

root@q210: /usr/ports/graphics/drm-61-kmod #
 
Can you elaborate on that? Why would you need the base-source tree?
If you build a kernel module, you need the sources of this kernel. In your example, you didn't do make clean before to make install, so no compilation took place. I guess you previously compiled it and the resulting files remained.

See what happens here:
Code:
# zfs rename zroot/usr/src zroot/usr/no-source
# cd /usr/ports/graphics/drm-61-kmod/
# make clean
===>  Cleaning for drm-61-kmod-6.1.92
# make install
(...)
make[1]: "/usr/ports/graphics/drm-61-kmod/work/drm-kmod-drm_v6.1.92_0/Makefile" line 4: Cannot open /usr/src/sys/conf/kern.opts.mk
make[1]: Fatal errors encountered -- cannot continue
make[1]: stopped in /usr/ports/graphics/drm-61-kmod/work/drm-kmod-drm_v6.1.92_0
*** Error code 1
--> Cannot open /usr/src/sys/conf/kern.opts.mk
 
? When I install FreeBSD for the first time on a machine, I always make sure to install the sources when the installer gives me that option. That's because if I don't, it can be a convoluted process of finding the correct version of sources to install into /usr/src.

The payoff is that when I compile graphics/drm-kmod from ports, it compiles just fine, and gives me all the available drivers, I just need to pick the correct one (be it for AMD, Intel or NVidia). I have recent AMD hardware, so it's amdgpu.ko for me, and it finds the correct firmware (like Green Sardine or Sienna Cichlid or whatever). I even have a thread about Sienna Cichlid that I made a few years ago - it worked because I installed sources into into /usr/src from get-go.
 
you didn't do make clean before to make install, so no compilation took place. I guess you previously compiled it and the resulting files remained.
Thanks, I totallly missed that.

So, the source of releng/14.1 here can easily create another hurdle for those who did not have the source code of the base-install installed at installation time and want to build a (graphics driver) kernel module ...
 
Back
Top