Intermittent scanline flickering with amdgpu in both VT and X

Hello!

I do not know what to call this so I have a hard time searching for solutions. I have what I would call intermittent scanline flickering.

It becomes visible when the VT console switches framebuffer driver from efifb to the fb driver during boot. It starts right after the screen clears and I see start FB_INFO:.

Code:
VT: Replacing driver "efifb" with new "fb".
start FB_INFO:
type=11 height=2160 width=3840 depth=32
pbase=0xf40cd3000 vbase=0xfffffe01b46d3000
name=drmn0 flags=0x0 stride=15360 bpp=32
end FB_INFO

If I remove "amdgpu" from kld_list there is no issue. I have tried 3 diffrent HDMI cables just to be sure it should not be a cable issue.

It is intermittent and the frequency it occurs is rather random. Ie. playing video or shaking a window does not make it worse.

The only way I can reliably provoke it is in a VT console when selecting with the mouse pointer on the 2nd half on the screen. The rest of the time it simply occurs randomly.


The issue carries over to X as well.


My X is autoconfigured:

Code:
[    29.122] (II) xfree86: Adding drm device (/dev/dri/card0)
[    29.122] (II) Platform probe for /dev/dri/card0
[    29.133] (--) PCI:*(4@0:0:0) 1002:1638:1002:1636 rev 201, Mem @ 0xd0000000/268435456, 0xe0000000/2097152, 0
xfcc00000/524288, I/O @ 0x0000e000/256, BIOS @ 0x????????/65536
[    29.133] (II) LoadModule: "glx"
[    29.134] (II) Loading /usr/local/lib/xorg/modules/extensions/libglx.so
[    29.139] (II) Module glx: vendor="X.Org Foundation"
[    29.139]    compiled for 1.21.1.11, module version = 1.0.0
[    29.139]    ABI class: X.Org Server Extension, version 10.0
[    29.139] (II) Applying OutputClass "AMDgpu" to /dev/dri/card0
[    29.139]    loading driver: amdgpu
[    29.139] (==) Matched amdgpu as autoconfigured driver 0
[    29.139] (==) Matched ati as autoconfigured driver 1
[    29.139] (==) Matched modesetting as autoconfigured driver 2
[    29.139] (==) Matched scfb as autoconfigured driver 3
[    29.139] (==) Matched vesa as autoconfigured driver 4
[    29.139] (==) Assigned the driver to the xf86ConfigLayout
[    29.139] (II) LoadModule: "amdgpu"
[    29.139] (II) Loading /usr/local/lib/xorg/modules/drivers/amdgpu_drv.so
[    29.141] (II) Module amdgpu: vendor="X.Org Foundation"
[    29.141]    compiled for 1.21.1.11, module version = 22.0.0
[    29.141]    Module class: X.Org Video Driver
[    29.141]    ABI class: X.Org Video Driver, version 25.2

I have tried manual configuration and setting TearFree and dropped the frequency from 60 to 30 Hz but to no avail.

Code:
xrandr --output HDMI-A-0 --set TearFree on
xrandr --output HDMI-A-0 --set EnablePageFlip off

Code:
FreeBSD 14.0-RELEASE-p6


pkg info:
drm-515-kmod-5.15.118_4        DRM drivers modules
drm-kmod-20220907_3            Metaport of DRM modules for the linuxkpi-based KMS components
gpu-firmware-amd-kmod-green-sardine-20230625_2 Firmware modules for green_sardine AMD GPUs
gpu-firmware-kmod-20240401,1   Firmware modules for the drm-kmod drivers
libdrm-2.4.120_1,1             Direct Rendering Manager library and headers
xf86-video-amdgpu-22.0.0_2     X.Org amdgpu display driver


dmesg:
amdgpu: ATOM BIOS: 113-CEZANNE-018
drmn0: successfully loaded firmware image 'amdgpu/green_sardine_*.bin'
[drm] Initialized amdgpu 3.42.0 20150101 for drmn0 on minor 0

I was considering just having patience and wait for 15 and drm-61-kmod and hope for the best. But as it is really annoying I hope that someone might have a nifty workaround I do not know about. A magic bitmask for kern.vt.fb.default_mode? Can I choose to keep using efifb? Which gods do I need to make a sacrifice to?

Any ideas would be greatly appreciated!

Kind Regards,
Claus
 
I was considering just having patience and wait for 15 and drm-61-kmod
graphics/drm-61-kmod is capable to run on 14.1.

ports/graphics/drm-61-kmod/Makefile
Code:
IGNORE=         not supported on older than 14-STABLE 1400508, no kernel support
Current 14.1p2 kernel version is 1401000.

The kmod must be build from ports, with 14.1 system source code installed, to match the 14.1 kernel version.
 
Sorry for the late reply. I have been away on vacation.

No change for 5.15.160 which has been running for a little while now:

Code:
FreeBSD 14.1-RELEASE

drm-515-kmod-5.15.160          DRM drivers modules
drm-kmod-20220907_3            Metaport of DRM modules for the linuxkpi-based KMS components
gpu-firmware-kmod-20240401,1   Firmware modules for the drm-kmod drivers
libdrm-2.4.121,1               Direct Rendering Manager library and headers


I will update the system now and then try with 6.1
 
I think I succeeded getting to 6.1. The issue is however still the same. Is there a newer "green sardine" driver/firmware which is worth trying with 6.1? Could this be some hsync/vsync thing?

Code:
cd /usr
git clone
git clone https://git.freebsd.org/src.git
git checkout releng/14.1
cd /usr/ports/graphics/drm-61-kmod
make
make install


$ dmesg | grep amdgpu
[drm] amdgpu kernel modesetting enabled.
amdgpu: ATOM BIOS: 113-CEZANNE-018
drmn0: successfully loaded firmware image 'amdgpu/green_sardine_sdma.bin'
[drm ERROR :amdgpu_bo_init] Unable to set WC memtype for the aperture base
[drm] amdgpu: 4096M of VRAM memory ready
[drm] amdgpu: 30637M of GTT memory ready.
drmn0: successfully loaded firmware image 'amdgpu/green_sardine_asd.bin'
drmn0: successfully loaded firmware image 'amdgpu/green_sardine_ta.bin'
drmn0: successfully loaded firmware image 'amdgpu/green_sardine_dmcub.bin'
drmn0: successfully loaded firmware image 'amdgpu/green_sardine_pfp.bin'
drmn0: successfully loaded firmware image 'amdgpu/green_sardine_me.bin'
drmn0: successfully loaded firmware image 'amdgpu/green_sardine_ce.bin'
drmn0: successfully loaded firmware image 'amdgpu/green_sardine_rlc.bin'
drmn0: successfully loaded firmware image 'amdgpu/green_sardine_mec.bin'
drmn0: successfully loaded firmware image 'amdgpu/green_sardine_vcn.bin'
[drm] Initialized amdgpu 3.49.0 20150101 for drmn0 on minor 0
name=drmn0 id=amdgpudrmfb flags=0x0 stride=15360


$ pkg info | grep -E 'drm|green-sardine'
drm-61-kmod-6.1.92             DRM drivers modules
drm-kmod-20220907_3            Metaport of DRM modules for the linuxkpi-based KMS components
gpu-firmware-amd-kmod-green-sardine-20230625_2 Firmware modules for green_sardine AMD GPUs
gpu-firmware-kmod-20240401,1   Firmware modules for the drm-kmod drivers
libdrm-2.4.122,1               Direct Rendering Manager library and headers


$ uname -r
14.1-RELEASE-p3
 
Interesting!! I have not given that any thought at all. My BIOS settings are conservative/auto/default.

RAM was autodetected (correctly) as DDR4-3200. I tried setting it as DDR4-3000 and DDR4-2666 but no change.
GFX Frequency and GFX Core Voltage are both set to Auto. I tried low settings for both with no change.
 
I am not sure if I should mark this as solved. But at least I have found a workaround which costs some more power.

Based on Tieks experience with the same GPU I have spent some time playing around in the BIOS. This is a Asrock X300 SFF system and in the "OC Tweaker" BIOS menu I have DISABLED "Global C-State Control". The rest is default.

With this disabled I see no glitches at all!

I had powerd running with -a adaptive. But even with powerd disabled I still have the glitch if C-State is enabled in the BIOS.

So at least now I can replicate the problem and it is not intermittent anymore.

I have created PR 318
 
UPDATE: You do not have to turn "Global C-State Control" off in the BIOS. You can set a non-acpi method for handling idle state with sysctl.

sysctl machdep.idle=mwait

With this I can toggle between mwait and acpi to provoke the problem. Would be interesting if this could be tested on Tieks system.

This can then be set in /etc/sysctl or as machdep.idle="mwait" in /boot/loader.conf.local
 
Back
Top