freebsd / drm-kmod

drm driver for FreeBSD
155 stars 69 forks source link

Update to Linux 5.11 drivers #163

Closed dumbbell closed 1 year ago

dumbbell commented 2 years ago

This branch synchronizes drm-kmod with Linux 5.11.

See https://github.com/freebsd/drm-kmod/pull/163#issuecomment-1157699164 for instructions to play with this branch.

Status:

dumbbell commented 2 years ago

I slightly lied on the progress :-) I cherry-picked only 484 out of 1334 patches (36%). I'm using this branch as of now to see how it behaves on a day-to-day basis.

dumbbell commented 2 years ago

The backport is complete for a few weeks now. I'm using this on a daily basis with an Intel CannonLake GPU (i915).

And starting from today, it seems to work with a discrete AMD Radeon RX 6700 XT! On top of that, the dGPU is plugged to my laptop using a Razer Core X Chroma Thunderbolt 3 external case :-) I will start to use that dGPU everyday to further test it.

Here is a screenshot using Sway/Wayland and this 6700 XT:

freebsd-rx-6700-xt

It depends on a FreeBSD src branch I didn't push yet.

evadot commented 2 years ago

Awesome news. Any suspend/resume regression ? (either intel or amdgpu works perfectly here on multiple machines) Also does amdgpu can still be unloaded and re-loaded (works here), i915kms still have some problems sometimes that I haven't been able to find and fix.

dumbbell commented 2 years ago
nevillehay commented 2 years ago

Thanks for all your hard work! I have an RX 6500XT. I'd like to test the 5.11 version. How can I do this?

dumbbell commented 2 years ago

Thank you for your interest!

You need to run FreeBSD 14-CURRENT to test it. I will assume you are tracking a very recent (i.e. a few days old) copy of 14-CURRENT.

Here are some instructions:

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

    git clone -b linuxkpi-changes-for-drm-from-5.11 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 udpate-to-v5.11 https://github.com/dumbbell/drm-kmod.git
    cd drm-kmod
    make -j8
    # The last command will overwrite modules installed by the `drm-*-kmod` package(s). Be sure
    # to remove them first!
    sudo pkg remove "$drm_kmod"
    sudo make install

    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 need updated firmwares. The branch holding the update is update-amdgpu-firmwares-for-drm-5.11:

    git clone -b update-amdgpu-firmwares-for-drm-5.11 https://github.com/dumbbell/drm-kmod-firmware.git
    cd drm-kmod-firmware
    make -C amdgpukmsfw -j8
    sudo make -C amdgpukmsfw install

Note that those instructions are not tested, I just wrote them from memory. Please report if you encounter any issues.

Otherwise, you shouldn't need to change anything to your setup. The driver for a Radeon RX 6xxx will be amdgpu, therefore you just need to kldload(8) this one either manually (sudo kldload amdgpu) or from /etc/rc.conf (kld_list="$kld_list amdgpu"). I recommend you load it manually first to ensure it works for you.

It's pretty stable for me currently (I'm using it as my daily driver at work/home). The only time it might crash and panic is when I exit Sway (Wayland).

dumbbell commented 2 years ago

I just updated the comment above with the freshly uploaded firmwares update.

nevillehay commented 2 years ago

Thanks a lot! I'll try this tomorrow or Monday. I take it this won't work on 13 STABLE?

dumbbell commented 2 years ago

I don't know. You could try to rebase the freebsd-src's linuxkpi-changes-for-drm-from-5.11 branch on top of stable/13 and see if it compiles already.

nevillehay commented 2 years ago

Okay. Thanks. I have to wait for a new CPU. Should be coming in the next couple of days. Sorry for the delay. I also have an r9-270x. Should I use my RX 6500xt or the r9-270x? The 270x works fine with drm-510-kmod.

On Sun, 19 Jun 2022, 00:01 Jean-Sébastien Pédron, @.***> wrote:

I don't know. You could try to rebase the freebsd-src's linuxkpi-changes-for-drm-from-5.11 branch on top of stable/13 and see if it compiles already.

— Reply to this email directly, view it on GitHub https://github.com/freebsd/drm-kmod/pull/163#issuecomment-1159479404, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGD624OVVBQQX2KHB3BWFQTVPXQFDANCNFSM5VBHKSUA . You are receiving this because you commented.Message ID: @.***>

nevillehay commented 2 years ago

On second thought I'll do everything with the 6500xt installed

On Sun, 19 Jun 2022, 19:00 Neville Goddard, @.***> wrote:

Okay. Thanks. I have to wait for a new CPU. Should be coming in the next couple of days. Sorry for the delay. I also have an r9-270x. Should I use my RX 6500xt or the r9-270x? The 270x works fine with drm-510-kmod.

On Sun, 19 Jun 2022, 00:01 Jean-Sébastien Pédron, < @.***> wrote:

I don't know. You could try to rebase the freebsd-src's linuxkpi-changes-for-drm-from-5.11 branch on top of stable/13 and see if it compiles already.

— Reply to this email directly, view it on GitHub https://github.com/freebsd/drm-kmod/pull/163#issuecomment-1159479404, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGD624OVVBQQX2KHB3BWFQTVPXQFDANCNFSM5VBHKSUA . You are receiving this because you commented.Message ID: @.***>

dumbbell commented 2 years ago

Testing the r9-270x would also be a nice baseline test to spot any regressions. But any testing is welcome! So feel free to try whatever is more convenient for you of course!

nevillehay commented 2 years ago

Okay. Thanks. Do I need to install anything for compiling or will FreeBSD 14 with xfce desktop with src be enough. Do I need debugging tools?

On Sun, 19 Jun 2022, 20:41 Jean-Sébastien Pédron, @.***> wrote:

Testing the r9-270x would also be a nice baseline test to spot any regressions. But any testing is welcome! So feel free to try whatever is more convenient for you of course!

— Reply to this email directly, view it on GitHub https://github.com/freebsd/drm-kmod/pull/163#issuecomment-1159699823, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGD624PBKDITZLFOI2RXQZDVP4BPBANCNFSM5VBHKSUA . You are receiving this because you commented.Message ID: @.***>

dumbbell commented 2 years ago

Do you plan to install a new FreeBSD on a new partition or ZFS filesystem? Do you use boot environments?

If you are currently using FreeBSD 13.x, I would recommend to keep this one untouched, in case you hit any issues with 14-CURRENT that would block you. If you do a fresh install or duplicate your 13.x install into a new boot environment, you should be fine either way. It's been a very long time since I used the FreeBSD installer, but you should already have the base compiler available and it will be enough to recompile FreeBSD and the drm+firmwares kernel modules.

If you duplicate your existing install of 13.x, you can use that clone to do the testing with your existing ports and configuration. In my instructions, I only covered the compilation of the kernel, but that's ok: a 14-CURRENT kernel will work with a 13.x userland. As I said earlier, just make sure to not kldload the DRM drivers during boot, just to make sure to not break boot. Load the module manually at first.

nevillehay commented 2 years ago

Thanks for your quick replies. I'll do a fresh install of FreeBSD 14. I won't have FreeBSD 13 running at all. I have another computer running FreeBSD (actually GhostBSD) 13 stable so if the FreeBSD 14 goes belly up, it's not a problem

dumbbell commented 2 years ago

As for debugging configuration and tools, you need to enable kernel core dumps. I have dump_dev="AUTO" in /etc/rc.conf, I think it's enough. You may need to install gdb to get nice stacktraces as well. You can force a kernel crash with sudo sysctl debug.kdb.panic=1 to test that code dumps are saved correctly. During the next reboot, the kernel core dump will be written to /var/crash.

If you get a kernel core dump while testing the driver, I will be interested in the latest /var/crash/core.txt.$N file (by default, they are written in round-robin from 0 to 9, so the latest may not be the greatest integer). That said, depending on when/where the kernel crashes in the video driver, the kernel may just hang (and a long press on the power button is required) or reboot without writing a core dump.

nevillehay commented 2 years ago

Okay thanks very much for the information. I ordered a Ryzen 7 5800x and a cooler. They're coming tomorrow. When I'm up and running I'll let you know.

On Sun, 19 Jun 2022, 21:38 Jean-Sébastien Pédron, @.***> wrote:

As for debugging configuration and tools, you need to enable kernel core dumps. I have dump_dev="AUTO" in /etc/rc.conf, I think it's enough. You may need to install gdb to get nice stacktraces as well. You can force a kernel crash with sudo sysctl debug.kdb.panic=1 to test that code dumps are saved correctly. During the next reboot, the kernel core dump will be written to /var/crash.

If you get a kernel core dump while testing the driver, I will be interested in the latest /var/crash/core.txt.$N file (by default, they are written in round-robin from 0 to 9). That said, depending on when/where the kernel crashes in the video driver, the kernel may just hang (and a long press on the power button is required) or reboot without writing a core dump.

— Reply to this email directly, view it on GitHub https://github.com/freebsd/drm-kmod/pull/163#issuecomment-1159714895, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGD624LX4MXUSP6ZJ6WCAHDVP4IELANCNFSM5VBHKSUA . You are receiving this because you commented.Message ID: @.***>

nevillehay commented 2 years ago

I got the new CPU, and got everything working fine on FreeBSD 13 stable. I just installed FreeBSD 14 from June 17 and there seems to be some sort of regression. Clean install with xfce desktop. I installed drm-kmod and this pulled in drm-510-kmod I also install gpu -firmware-kmod but during the boot process when it says loading amdgpu the screen goes black and stays black. I also put in rc.conf

kld_list="amdgpu"

I'll have to try a different version.

Currently using scfb to get to the desktop

On Mon, 20 Jun 2022, 11:05 Neville Goddard, @.***> wrote:

Okay thanks very much for the information. I ordered a Ryzen 7 5800x and a cooler. They're coming tomorrow. When I'm up and running I'll let you know.

On Sun, 19 Jun 2022, 21:38 Jean-Sébastien Pédron, < @.***> wrote:

As for debugging configuration and tools, you need to enable kernel core dumps. I have dump_dev="AUTO" in /etc/rc.conf, I think it's enough. You may need to install gdb to get nice stacktraces as well. You can force a kernel crash with sudo sysctl debug.kdb.panic=1 to test that code dumps are saved correctly. During the next reboot, the kernel core dump will be written to /var/crash.

If you get a kernel core dump while testing the driver, I will be interested in the latest /var/crash/core.txt.$N file (by default, they are written in round-robin from 0 to 9). That said, depending on when/where the kernel crashes in the video driver, the kernel may just hang (and a long press on the power button is required) or reboot without writing a core dump.

— Reply to this email directly, view it on GitHub https://github.com/freebsd/drm-kmod/pull/163#issuecomment-1159714895, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGD624LX4MXUSP6ZJ6WCAHDVP4IELANCNFSM5VBHKSUA . You are receiving this because you commented.Message ID: @.***>

nevillehay commented 2 years ago

I got to the second step. Here You need to checkout the branch referenced in this pull request and compile it:

git clone -b udpate-to-v5.11 https://github.com/dumbbell/drm-kmod.git cd drm-kmod make -j8

The last command will overwrite modules installed by the drm-*-kmod package(s). Be sure

to remove them first!

sudo pkg remove "$drm_kmod" sudo make install

make -j8 command stopped with this error:

/usr/home/neville/drm-kmod/drivers/dma-buf/sync_file.c:273:13: error: implicit declaration of function 'krealloc_array' is invalid in C99 [-Werror,-Wimplicit-function-declaration] nfences = krealloc_array(fences, i, sizeof(*fences), GFP_KERNEL); ^ /usr/home/neville/drm-kmod/drivers/dma-buf/sync_file.c:273:11: error: incompatible integer to pointer conversion assigning to 'struct dma_fence ' from 'int' [-Werror,-Wint-conversion] nfences = krealloc_array(fences, i, sizeof(fences), GFP_KERNEL); ^ ~~~~~~~~~~~~~~ 2 errors generated. [sync_file.o] Error code 1

make[1]: stopped in /usr/home/neville/drm-kmod/dmabuf 1 error

make[1]: stopped in /usr/home/neville/drm-kmod/dmabuf

make: stopped in /usr/home/neville/drm-kmod

Any ideas?

dumbbell commented 2 years ago

Did you link /usr/src to the freebsd-src clone? I think /usr/src contains or links to the vanilla FreeBSD sources.

There is a variable to indicate where to find the source tree but I don't recall it's name

nevillehay commented 2 years ago

No I didn't. I noticed your instructions for that but how do you link /usr/src to the clone? What is the command? Steps 1 and 3 went great! Again thanks for all your work.

On Thu, 23 Jun 2022, 04:04 Jean-Sébastien Pédron, @.***> wrote:

Did you link /usr/src to the freebsd-src clone? I think /usr/src contains or links to the vanilla FreeBSD sources.

There is a variable to indicate where to find the source tree but I don't recall it's name

— Reply to this email directly, view it on GitHub https://github.com/freebsd/drm-kmod/pull/163#issuecomment-1163499305, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGD624JRHM343HZHWAKGYN3VQNPVHANCNFSM5VBHKSUA . You are receiving this because you commented.Message ID: @.***>

evadot commented 2 years ago

Did you link /usr/src to the freebsd-src clone? I think /usr/src contains or links to the vanilla FreeBSD sources.

There is a variable to indicate where to find the source tree but I don't recall it's name

export SYSDIR=/path/to/src/sys (the sys is important)

nevillehay commented 2 years ago

Thanks. Will do it tonight. Do I run this command first, then the others?

On Thu, 23 Jun 2022, 15:29 Emmanuel Vadot, @.***> wrote:

Did you link /usr/src to the freebsd-src clone? I think /usr/src contains or links to the vanilla FreeBSD sources.

There is a variable to indicate where to find the source tree but I don't recall it's name

export SYSDIR=/path/to/src/sys (the sys is important)

— Reply to this email directly, view it on GitHub https://github.com/freebsd/drm-kmod/pull/163#issuecomment-1164004971, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGD624NJQJOZK7PWC65XY2DVQP75TANCNFSM5VBHKSUA . You are receiving this because you commented.Message ID: @.***>

dumbbell commented 2 years ago

Thanks @evadot!

@nevillehay: Yes, you need to run this command before you try to compile drm-kmod. Note that if you change terminal or reboot, you'll have to run it again as the exported variable's scope is limited to a running shell instance.

When I suggesting to link, I had a symlink in mind, so something like ln -s /path/to/src /usr/src (assuming /usr/src does not exist). But you don't need both, the exported variable will work just fine.

nevillehay commented 2 years ago

By the way, there's small error here

1.

You need to checkout the FreeBSD src branch I mentionned, linuxkpi-changes-for-drm-from-5.11 https://github.com/dumbbell/freebsd-src/tree/linuxkpi-changes-for-drm-from-5.11, and compile a kernel from that branch:

git clone -b linuxkpi-changes-for-drm-from-5.11 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.

Should be

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

git clone -b linuxkpi-changes-for-drm-from-5.11 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

On Thu, 23 Jun 2022, 19:14 Neville Goddard, @.***> wrote:

Thanks a million. Will try it tonight. I'm using the RX 6500 XT now on scfb. Compiling the kernel went fine. Installing firmware also went fine. Hopefully everything will be fine tonight

On Thu, 23 Jun 2022, 17:23 Jean-Sébastien Pédron, < @.***> wrote:

Thanks @evadot https://github.com/evadot!

@nevillehay https://github.com/nevillehay: Yes, you need to run this command before you try to compile drm-kmod. Note that if you change terminal or reboot, you'll have to run it again as the exported variable's scope is limited to a running shell instance.

When I suggesting to link, I had a symlink in mind, so something like ln -s /path/to/src /usr/src (assuming /usr/src does not exist). But you don't need both, the exported variable will work just fine.

— Reply to this email directly, view it on GitHub https://github.com/freebsd/drm-kmod/pull/163#issuecomment-1164107142, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGD624I45LXBXQZAF6B5IK3VQQNJ3ANCNFSM5VBHKSUA . You are receiving this because you were mentioned.Message ID: @.***>

nevillehay commented 2 years ago

There should be an = after DEBUG_FLAGS

On Thu, 23 Jun 2022, 19:17 Neville Goddard, @.***> wrote:

By the way, there's small error here

1.

You need to checkout the FreeBSD src branch I mentionned, linuxkpi-changes-for-drm-from-5.11 https://github.com/dumbbell/freebsd-src/tree/linuxkpi-changes-for-drm-from-5.11, and compile a kernel from that branch:

git clone -b linuxkpi-changes-for-drm-from-5.11 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.

Should be

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

git clone -b linuxkpi-changes-for-drm-from-5.11 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

On Thu, 23 Jun 2022, 19:14 Neville Goddard, @.***> wrote:

Thanks a million. Will try it tonight. I'm using the RX 6500 XT now on scfb. Compiling the kernel went fine. Installing firmware also went fine. Hopefully everything will be fine tonight

On Thu, 23 Jun 2022, 17:23 Jean-Sébastien Pédron, < @.***> wrote:

Thanks @evadot https://github.com/evadot!

@nevillehay https://github.com/nevillehay: Yes, you need to run this command before you try to compile drm-kmod. Note that if you change terminal or reboot, you'll have to run it again as the exported variable's scope is limited to a running shell instance.

When I suggesting to link, I had a symlink in mind, so something like ln -s /path/to/src /usr/src (assuming /usr/src does not exist). But you don't need both, the exported variable will work just fine.

— Reply to this email directly, view it on GitHub https://github.com/freebsd/drm-kmod/pull/163#issuecomment-1164107142, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGD624I45LXBXQZAF6B5IK3VQQNJ3ANCNFSM5VBHKSUA . You are receiving this because you were mentioned.Message ID: @.***>

dumbbell commented 2 years ago

Thank you! I just fixed the comment.

nevillehay commented 2 years ago

I saw one message

Driver bug unable to set devclass

nevillehay commented 2 years ago

But I noticed in sndstat I have 2 HDMI devices

dumbbell commented 2 years ago

I saw one message

Driver bug unable to set devclass

Were you trying to kldload the driver? Could you please share the output of dmesg(8) after doing that?

nevillehay commented 2 years ago

Okay. I'll do it tomorrow. It's quite late now. If there's anything else you need please let me know

On Fri, 24 Jun 2022, 00:37 Jean-Sébastien Pédron, @.***> wrote:

I saw one message

Driver bug unable to set devclass

Were you trying to kldload the driver? Could you please share the output of dmesg(8) after doing that?

— Reply to this email directly, view it on GitHub https://github.com/freebsd/drm-kmod/pull/163#issuecomment-1164567071, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGD624KE4SU5BGZIXRJAHR3VQSAB3ANCNFSM5VBHKSUA . You are receiving this because you were mentioned.Message ID: @.***>

dumbbell commented 2 years ago

Just a general comment: after you try to compile the code, kldload the driver or start X.Org or a Wayland compositor and want to report feedback or ask for help, could you please always provide the output of dmesg(8) (also available in /var/log/messages), plus the X.Org log file or the output from the Wayland compositor (depending on what applies to you)?

If you get a kernel panic, I'm interested in the most recent /var/crash/core.txt.*. If no a core dump is written to disk, then a photo of the kernel stacktrace on screen would be nice as well.

Thank you :-)

nevillehay commented 2 years ago

After i run kldload amdgpu

I get

(6) [drm] amdgpu kernel modesetting enabled

But then I enter startx it says that no screens are found. X won't start.

On Fri, 24 Jun 2022, 00:47 Jean-Sébastien Pédron, @.***> wrote:

Just a general comment: after you try to compile the code, kldload the driver or start X.Org or a Wayland compositor and want to report feedback or ask for help, could you please always provide the output of dmesg(8) (also available in /var/log/messages), plus the X.Org log file or the output from the Wayland compositor (depending on what applies to you)?

If you get a kernel panic, I'm interested in the most recent /var/crash/core.txt.*. If no a core dump is written to disk, then a photo of the kernel stacktrace on screen would be nice as well.

Thank you :-)

— Reply to this email directly, view it on GitHub https://github.com/freebsd/drm-kmod/pull/163#issuecomment-1164581041, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGD624JDUNHS2KGCVEZ7D3DVQSBIXANCNFSM5VBHKSUA . You are receiving this because you were mentioned.Message ID: @.***>

dumbbell commented 2 years ago

I can't help you without the output of dmesg(8) (after kldloading the driver) and the X.Org log file unfortunately.

nevillehay commented 2 years ago

No worries. You'll have them tonight.

On Fri, 24 Jun 2022, 18:34 Jean-Sébastien Pédron, @.***> wrote:

I can't help you without the output of dmesg(8) (after kldloading the driver) and the X.Org log file unfortunately.

— Reply to this email directly, view it on GitHub https://github.com/freebsd/drm-kmod/pull/163#issuecomment-1165391982, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGD624PGCLQQ3VH7QK4GD4TVQV6J7ANCNFSM5VBHKSUA . You are receiving this because you were mentioned.Message ID: @.***>

nevillehay commented 2 years ago

Here are some files: xorg-amdgpuload.txt This is the xorg log file with amdgpu in rc.conf This is an xorg log file without amdgpu in rc.conf xorg-noamdgpu.txt

Here is var/log/messages messages1.txt

dmesg with amdgpu in rc.conf dmesg1.txt

I'll send another dmesg after kldload amdgpu

nevillehay commented 2 years ago

Here are some files: xorg-amdgpuload.txt This is the xorg log

nevillehay commented 2 years ago

dmesg file after loading amdgpu dmesg-kldload-amdgpu.txt

dumbbell commented 2 years ago

Could you please share the output of pciconf -lv?

My guess is that the Radeon RX 6500 XT you have is not yet supported by the driver as of Linux 5.11. This graphic card was released in January 2022. The output of pciconf -lv will show us the PCI ID of that card, so I can look it up in the source code.

The Radeon RX 6700 XT I have is older (March 2021). Here is a sample of what I get in dmesg(8) when the driver initializes the card:

Jun 24 10:45:01 giotto kernel: [drm] amdgpu kernel modesetting enabled.
Jun 24 10:45:01 giotto kernel: drmn2: <drmn> on vgapci2
Jun 24 10:45:01 giotto kernel: vgapci2: child drmn2 requested pci_enable_io
Jun 24 10:45:01 giotto syslogd: last message repeated 1 times
Jun 24 10:45:01 giotto kernel: [drm] initializing kernel modesetting (NAVY_FLOUNDER 0x1002:0x73DF 0x1DA2:0xE445 0xC1).
Jun 24 10:45:01 giotto kernel: drmn2: Trusted Memory Zone (TMZ) feature not supported
Jun 24 10:45:01 giotto kernel: [drm] register mmio base: 0xD4100000
Jun 24 10:45:01 giotto kernel: [drm] register mmio size: 1048576
Jun 24 10:45:01 giotto kernel: [drm] add ip block number 0 <nv_common>
Jun 24 10:45:01 giotto kernel: [drm] add ip block number 1 <gmc_v10_0>
Jun 24 10:45:01 giotto kernel: [drm] add ip block number 2 <navi10_ih>
Jun 24 10:45:01 giotto kernel: [drm] add ip block number 3 <psp>
Jun 24 10:45:01 giotto kernel: [drm] add ip block number 4 <smu>
Jun 24 10:45:01 giotto kernel: [drm] add ip block number 5 <dm>
Jun 24 10:45:01 giotto kernel: [drm] add ip block number 6 <gfx_v10_0>
Jun 24 10:45:01 giotto kernel: [drm] add ip block number 7 <sdma_v5_2>
Jun 24 10:45:01 giotto kernel: [drm] add ip block number 8 <vcn_v3_0>
Jun 24 10:45:01 giotto kernel: [drm] add ip block number 9 <jpeg_v3_0>
Jun 24 10:45:01 giotto kernel: drmn2: Fetched VBIOS from VFCT
Jun 24 10:45:01 giotto kernel: amdgpu: ATOM BIOS: 113-D5121200-O04
...
nevillehay commented 2 years ago

I think you're correct Here is pciconf -lv pciconf.txt

And pciconf -lv | grep -B 3 -A 2 display pciconf-display.txt

nevillehay commented 2 years ago

I don't think it's supported even in Linux. It's navi 24

dumbbell commented 2 years ago

It is supported by Linux. The card's PCI ID was added to the driver in the following commit: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=a2e9b1666ea728aac7107e28d2106fce7e2aba5e

It's part of Linux 5.15.

andreaf74 commented 2 years ago

It is supported by Linux. The card's PCI ID was added to the driver in the following commit: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=a2e9b1666ea728aac7107e28d2106fce7e2aba5e

It's part of Linux 5.15.

Too bad :( , I tried your patch for the same reason as @nevillehay and I got the same results, so I believe we should wait for linuxkpi to be aligned at least to 5.15.

If needed I'll be more than willing to test future upgrades.

Thanks

dumbbell commented 2 years ago

Thank you @andreaf74 for taking the time to test!

nevillehay commented 2 years ago

Thanks for your help everyone!

JonathanxD commented 2 years ago

First, thanks a lot for your hard work, I've been using FreeBSD in “terminal-only mode” for a couple of months, but couldn't do everything I needed to. This week I found this PR and I was able to clone the fork repos, compile and load the module.

When I suggesting to link, I had a symlink in mind, so something like ln -s /path/to/src /usr/src (assuming /usr/src does not exist). But you don't need both, the exported variable will work just fine.

It didn't worked for me, I had to make a symlink, otherwise the compiler would complain about declaration conflicts under x86_64 headers, looks like it was importing both the system one and the cloned one, but I'm not sure, because clang was reporting the path as ./x86_64 (relative to CWD) instead of something like /usr/src/, and the conflicting one was being reported on the cloned source repo.

I don't know if this is because I was on FreeBSD 13.1-RELEASE kernel, but shouldn't since I specified the source path, probably there still another env that I should've changed.

Apart from this, everything seems to be working, sometimes I get hard kernel crashes on the first boot, but in the second one it just works, and crashes on “logout” as well.

Xorg seems to not be working as it should, KDE only starts using startplasma-x11 when I boot using UEFI, but don't in BIOS mode, also, Xorg doesn't detect radeonsi driver correctly and seems to be falling back to llvmpipe, but I'm not sure if this is real, since without this module I couldn't get any graphical interface working even with llvmpipe, it was only possible with UEFI GOP and BIOS VESA. But under Wayland, the experience is just as good as in Linux, Sway loads correctly and glxinfo reports my graphics card. Even Firefox shows the right information.

Sound also seems to be working correctly through HDMI and DisplayPort, but I didn't got too far to ensure that it is reliable, since FreeBSD OSS is pretty mature, I don't think I would've any problem since I think nothing have changed in this area in AMD drivers.

swappy-20220728_222221

Also, as you can see, I have two monitor setup, and it is working flawlessly.

I'm very excited in seeing this reaching a mature state, and it already looks like it's almost there.

Note: Idk how is the state of Firefox on FreeBSD, but it seems that it is only running under XWayland, while on Linux it runs under Wayland natively, but it doesn't matter, it is working perfectly with Video Acceleration

dumbbell commented 2 years ago

Thank you very much for testing :-)

The only crash I get is when I exit from Sway so far. Perhaps we hit the same issue. Unfortunately, I don't get a kernel core dump. Do you have core dumps for the panics you have?

I spent quite some time trying to configure Intel AMT to have a remote serial console over the network, but I couldn't get it to work on FreeBSD (it works on Windows on the same laptop).

About X.Org vs. Wayland, I still didn't test X.Org yet.

Beside fixing the panics, the last big piece of work is the I2C. The drivers in this branch currently relies on the GPLv2 implementation. I need to add the missing bits to the implementation in FreeBSD base. That's why I can't rebase this branch on top of the latest master because the GPLv2 copy was removed.

JonathanxD commented 2 years ago

Do you have core dumps for the panics you have?

I do, I can get them anytime, just need to keep restarting until they happen, I don't know if there is a way to get those messages in Plain Text after the fact (I didn't configured a swap partition so I can't use regular kernel debugging techniques, and I don't have that much knowledge on FreeBSD).

I'm attaching the dump as an image, but if you know if there is a way to get those as text, it would be way easier to read.

crash

dumbbell commented 2 years ago

Any ETA on when this will be ready and pushed to the main repository? :)

Hi @sescu54!

No ETA :) I've been quite busy with other things this summer.

What's left to do:

I won't test suspend & resume because it never worked for me, so I can't see regressions :)

Did you test the driver on your hardware?

evadot commented 2 years ago

Any ETA on when this will be ready and pushed to the main repository? :)

Hi @sescu54!

No ETA :) I've been quite busy with other things this summer.

What's left to do:

* Fix a panic, perhaps in the i915 driver, which occurs when another panic is being treated. Probably a difference of behavior between the Linux and FreeBSD consoles. So far, I couldn't find the reason.

* Fix a panic in the amdgpu driver triggered when I exit Sway (but it doesn't happen 100% of the time). I didn't look at it yet and it happens rarely now.

* Test with X.Org. Not started yet.

I won't test suspend & resume because it never worked for me, so I can't see regressions :)

Suspend/Resume works on all my hardware on main and 13.1, please try again.

Did you test the driver on your hardware?