3.0-STABLE / drm-kmod / dual radeon problems

From: John Kennedy <warlock_at_phouka.net>
Date: Thu, 19 Aug 2021 18:51:36 UTC
[resending to freebsd-x11@ vs x11@]

  I'm making my semi-annual attempt to convert a windows box to a FreeBSD box
and having the same kind of issues.  It is a Dell Optiplex 9020 with dual
radeon cards (and currently 3 monitors, 4 if I can get it to work).

  TL;DR:  I can get it to work with any one card, but not both cards.

  [uname -aUK]
	FreeBSD admin 13.0-STABLE FreeBSD 13.0-STABLE #4 stable/13-n246840-86a96281df03: Wed Aug 18 09:55:41 PDT 2021     warlock@admin:/usr/obj/usr/src/amd64.amd64/sys/GENERIC  amd64 1300514 1300514

  [pkg info | grep -E -e 'drm-.*kmod' -e 'xorg-([0-9]|server)' -e video-ati]
	drm-fbsd13-kmod-5.4.92.g20210720_1 DRM modules for the linuxkpi-based KMS components
	drm-kmod-g20190710_1           Metaport of DRM modules for the linuxkpi-based KMS components
	xf86-video-ati-19.1.0_4,1      X.Org ati display driver
	xorg-7.7_3                     X.Org complete distribution metaport
	xorg-server-1.20.11_3,1        X.Org X server and related programs

  Kernel drivers are loaded (although I don't think no-.conf setup tries to use the radeon bits):

    [kldstat | grep -e radeon -e ^Id -e drm]
	    Id Refs Address                Size Name
	     5    1 0xffffffff830f9000   150c80 radeonkms.ko
	     6    2 0xffffffff8324a000    7f548 drm.ko
	    10    1 0xffffffff832e9000     4358 radeon_oland_pfp_bin.ko
	    11    1 0xffffffff832ee000     4358 radeon_oland_me_bin.ko
	    12    1 0xffffffff832f3000     4358 radeon_oland_ce_bin.ko
	    13    1 0xffffffff832f8000     41d8 radeon_oland_rlc_bin.ko
	    14    1 0xffffffff832fd000     9dd8 radeon_oland_mc_bin.ko
	    15    1 0xffffffff83307000    11410 radeon_oland_smc_bin.ko
	    16    1 0xffffffff83319000    37af0 radeon_TAHITI_uvd_bin.ko
	    17    1 0xffffffff83351000     de00 radeon_TAHITI_vce_bin.ko

  X sees both cards:

    [grep -e 'More than one' -e 'PCI:' /var/log/Xorg.0.log -e WW]
	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
	[ 80926.514] (!!) More than one possible primary device found
	[ 80926.514] (--) PCI: (1@0:0:0) 1002:6611:1028:210b rev 0, Mem @ 0xe0000000/268435456, 0xf7e00000/262144, I/O @ 0x0000e000/256, BIOS @ 0x????????/65536
	[ 80926.514] (--) PCI: (5@0:0:0) 1002:6611:1028:210b rev 0, Mem @ 0xd0000000/268435456, 0xf7d00000/262144, I/O @ 0x0000d000/256, BIOS @ 0x????????/65536
	[ 80926.517] (WW) VGA arbiter: cannot open kernel arbiter, no multi-card support

  I've seem people claim that VGA arbiter doesn't mean I can't use both cards
at once the same time, but I'll call it out here.  OS obviously sees both cards
and reports them like this:

  [pciconf -lv]
	vgapci0@pci0:1:0:0:     class=0x030000 rev=0x00 hdr=0x00 vendor=0x1002 device=0x6611 subvendor=0x1028 subdevice=0x210b
	     vendor     = 'Advanced Micro Devices, Inc. [AMD/ATI]'
	     device     = 'Oland [Radeon HD 8570 / R5 430 OEM / R7 240/340 / Radeon 520 OEM]'
	     class      = display
	     subclass   = VGA
	vgapci1@pci0:5:0:0:     class=0x030000 rev=0x00 hdr=0x00 vendor=0x1002 device=0x6611 subvendor=0x1028 subdevice=0x210b
	     vendor     = 'Advanced Micro Devices, Inc. [AMD/ATI]'
	     device     = 'Oland [Radeon HD 8570 / R5 430 OEM / R7 240/340 / Radeon 520 OEM]'
	     class      = display
	     subclass   = VGA

  X with no .conf only uses one monitor (or, more correctly, just the monitors
that are associated with the card it defaulted to).  I can play games with a
.conf using the device section and BusIDs to get it to use the two monitors on
the 2nd card, but then the first gets ignored.  I've experimented with
AutoAddGPU (true), and GPUDevice (2nd card) with no love.

  It seems like X doesn't want to recognize both cards (I think this is the one with radeon driver):

    [xrandr --listproviders)]
	Providers: number : 1
	Provider 0: id: 0x53 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 2 outputs: 2 associated providers: 0 name:OLAND @ pci:0000:05:00.0

  With no .conf, it just shows this:

    [xrandr --listproviders]
	Providers: number : 1
	Provider 0: id: 0x43 cap: 0xa, Sink Output, Sink Offload crtcs: 2 outputs: 2 associated providers: 0 name:modesetting

  Depending on which card I've picked with the .conf, it'll show that.
It seems like my first hurdle is to get X running on all cards at the
same time, then dig into Xinerama and monitor layouts so things show
up where they're supposed to.

  Any suggestions?  There has been a LOT of water under the bridge for the
DRM drivers and X11 from the web hits I'm finding.  I've attached the
Xorg.0.log when I don't have a custom configuration, but I assume it's
pretty useless since it says "Not automatically adding GPU devices",
which would seem to preclude my 2nd card.