FreeBSDDesktop / kms-drm

the DRM part of the linuxkpi-based KMS
63 stars 26 forks source link

amdgpu on rx580 video sync issue #126

Open graudeejs opened 5 years ago

graudeejs commented 5 years ago

Hello!

When viewing fullscreen video on 4K monitor on Sapphire RX580, there is vertical sync artifacts around at 4/5ths of the screen (form top) - clearly sync issue. It's as if next fame is being rendered something like that. uname -a:

FreeBSD home 12.0-RELEASE-p2 FreeBSD 12.0-RELEASE-p2 GENERIC  amd64

dmesg/Xorg.log/clinfo: https://gist.github.com/graudeejs/cf5fecc90d36983c8abf1ba35bb79bf3

drm-fbsd12.0-kmod-4.16.g20181215
drm-kmod-g20181126
libdrm-2.4.96,1
opencl-2.2_1
mesa-demos-8.4.0_2
mesa-dri-18.1.9_3
mesa-libs-18.1.9_4

/boot/loader.conf:

hw.sysconf.disable=1
zfs_load="YES"
kern.vty="vt"

Let me know if there's any more info I can provide.

valpackett commented 5 years ago

You mean screen tearing?

That's extremely common with Xorg. Switch to Wayland :)

but, to try to solve on xorg:

graudeejs commented 5 years ago

You mean screen tearing?

Yes, screen tearing.

That's extremely common with Xorg. Switch to Wayland :)

but, to try to solve on xorg:

* install `xf86-video-amdgpu`, it helps with tearing

* use a compositor like compton

This doesn't seem to help.

About xf86-video-amdgpu: do I need to change anything (just install and that's it)? Generally my Xorg is autoconfigured except for:

Section "Monitor"
    Option  "UseEdidDpi"  "false"
    Identifier "Monitor0"
    DisplaySize 698 393
EndSection

Section "Screen"
    Identifier    "Screen0"
    Monitor       "Monitor0"
EndSection
valpackett commented 5 years ago

You can try:

Section "Device"
        Identifier "Card0"
        Driver "amdgpu"
        Option "AccelMethod" "glamor"
        Option "DRI" "3"
        Option "TearFree" "true"
EndSection
graudeejs commented 5 years ago

I'll try on weekend (need to swap video cards)

graudeejs commented 5 years ago

This din't help (maybe it slightly improved screen tearing)

graudeejs commented 5 years ago

Adding compton on top of that, improves screen tearing (but doesn't eliminate it entirely).

valpackett commented 5 years ago

The compton flags I used:

--backend glx --vsync none --glx-no-stencil --paint-on-overlay --glx-no-rebind-pixmap --glx-swap-method buffer-age --glx-use-copysubbuffermesa --sw-opti --unredir-if-possible --xrender-sync-fence
graudeejs commented 5 years ago
$ compton --backend glx --vsync none --glx-no-stencil --paint-on-overlay --glx-no-rebind-pixmap --glx-swap-method buffer-age --glx-use-copysubbuffermesa --sw-opti --unredir-if-possible --xrender-sync-fence
Xlib:  extension "GLX" missing on display ":0".
glx_init(): No GLX extension.
valpackett commented 5 years ago

woah, wait, "no GLX" sounds very very wrong, do you have 3D acceleration working? post your xorg log

valpackett commented 5 years ago

hm unless it's outputting that message when some other more specific thing is unavailable, which would be odd but can happen

graudeejs commented 5 years ago

I've got and idea, which you might know answer to. The thing is, amdgpu was unstable enough, that I also bought nvidia card until I can reliably use amdgpu. Is it possible, that when installing nvidia driver, some libs could conflict or be overwriten (everything installed from packages).

My gut feeling says, that pkgng should complain if conflicts would be detected.

Could this be the case?

graudeejs commented 5 years ago

I will post xorg logs in few hours, when I get home.

valpackett commented 5 years ago

Looking at the nvidia-driver package, it installs libraries with a suffix (libGL.solibGL-NVIDIA.so) but then installs a file to libmap.d that tells the library loader to load the -NVIDIA libraries instead of the normal ones. So there's no conflict on the package level, but at runtime, the NVIDIA libraries would be loaded instead of Mesa. You should uninstall nvidia-driver.

graudeejs commented 5 years ago

I don't know if it's me of what, but I removed nvidia driver and reinstalled all packages to make sure all files are properly set.

So as you expected this fixes glx issue.

And having xorg settings above without lag using fvwm2 (window manager) I feel like I can't see screen tearing (I was watching downloaded 4k Transformers trailer using mvp).

So to sum up:

Section "Device"
        Identifier "Card0"
        Driver "amdgpu"
        Option "AccelMethod" "glamor"
        Option "DRI" "3"
        Option "TearFree" "true"
EndSection

seam to help and compton --backend glx --vsync none --glx-no-stencil --paint-on-overlay --glx-no-rebind-pixmap --glx-swap-method buffer-age --glx-use-copysubbuffermesa --sw-opti --unredir-if-possible --xrender-sync-fence doesn't seam to be needed in my case.

I think this issue can be closed.

graudeejs commented 5 years ago

Just in case. Here's Xorg log I promissed: https://gist.github.com/graudeejs/cf5fecc90d36983c8abf1ba35bb79bf3#file-2019-01-23-xorg-log