Bug 234596 - graphics/drm-kmod OpenGL emulators/linux_base-c6 games/linux-doom3 AMD Hardware not working with Linux binaries
Summary: graphics/drm-kmod OpenGL emulators/linux_base-c6 games/linux-doom3 AMD Hardwa...
Status: Closed Not Accepted
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Johannes M Dieterich
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-03 17:03 UTC by Stefan Rumetshofer
Modified: 2019-06-17 17:42 UTC (History)
6 users (show)

See Also:


Attachments
Output of the games (20.62 KB, text/plain)
2019-01-03 17:03 UTC, Stefan Rumetshofer
no flags Details
Output from /compat/linux/usr/bin/glxinfo32 (139.04 KB, text/plain)
2019-06-16 09:45 UTC, Stefan Rumetshofer
no flags Details
Output from /compat/linux/usr/bin/glxinfo64 (139.04 KB, text/plain)
2019-06-16 09:46 UTC, Stefan Rumetshofer
no flags Details
kdump of /compat/linux/usr/bin/glxgears (55.04 KB, application/x-xz)
2019-06-16 13:43 UTC, Stefan Rumetshofer
no flags Details
kdump of UnrealXLinux.bin (361.94 KB, application/x-xz)
2019-06-16 15:37 UTC, Stefan Rumetshofer
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Rumetshofer 2019-01-03 17:03:32 UTC
Created attachment 200742 [details]
Output of the games

I tried to run some Linux games with my AMD Radeon RX560 but they are all failing.
I tried games/linux-doom3 and the Linux Version of Unreal. Both run fine with NVIDA Hardware and the proprietary driver but with the AMD Hardware the screen goes black and then there are some messages on the console.

I have tried with linux-c6 and linux-c7 ports. Perhaps the errors come from the linux-mesa stuff because NVIDIA installs its own OpenGL stuff then this PR should go tho the maintainer of the emulators/linux_base ports.

In the attachements are the outputs of linux-doom3 with linux_base-c6 and with linux-c7
Also at the End of the file there is the output from Unreal on linux_base-c6 and linux_base-c7

Interesting is that linux-c6 tries to load the amdgpu_dri.so while linux-c7 tries to load radeonsi_dri.so.
Comment 1 Johannes M Dieterich freebsd_committer 2019-01-04 02:07:04 UTC
If I recall correctly, we've seen this issue and there may be a fix for it. Could you open an issue with 'upstream' (as this is not a problem with the port but the DRM itself)? Here: https://github.com/FreeBSDDesktop/kms-drm  . Thank you!
Comment 2 Kubilay Kocak freebsd_committer freebsd_triage 2019-01-04 02:37:36 UTC
Assign to committer (maintainer) that resolved
Comment 3 Piotr Kubaj freebsd_committer 2019-01-04 12:46:19 UTC
You could just use games/dhewm3.

It's an open source reimplementation of Doom 3's engine with fixes for some issues that are not in the proprietary port.
Comment 4 Stefan Rumetshofer 2019-01-04 19:03:06 UTC
I know, dhewm runs fine with AMD Radeon.
I reported this because there are (OpenGL-)Problems with Linux Programs. linux-doom3 was just an Example. (I have the Original DVD to test the game). linux-quake4 is'nt working too.
As suggested above i will report an issue upstream.
Comment 5 Tijl Coosemans freebsd_committer 2019-01-04 19:56:52 UTC
Make sure you have linprocfs and linsysfs mounted.  Also try running with "env LIBGL_DRI3_DISABLE=true linux-doom3".  If linux-c6 tries to load amdgpu_dri.so it's probably too old for your graphics card and you'll have to use linux-c7.
Comment 6 Tijl Coosemans freebsd_committer 2019-06-10 12:16:17 UTC
Can you try again with the latest c7 ports?
Comment 7 Stefan Rumetshofer 2019-06-16 07:33:53 UTC
(In reply to Tijl Coosemans from comment #6)
Same problem with the latest c7 port. I think it has nothing to do with the linux compatibility because when i run the game with the intel driver from drm-kmod it runs fine on the onboard graphics chip.
Comment 8 Tijl Coosemans freebsd_committer 2019-06-16 09:13:24 UTC
I've just committed a change to graphics/linux-c7-glx-utils so it also installs glxinfo32 on amd64.  Can you install the updated port and then attach the output of both /compat/linux/usr/bin/glxinfo32 and /compat/linux/usr/bin/glxinfo64 to this bug?
Comment 9 Stefan Rumetshofer 2019-06-16 09:45:32 UTC
Created attachment 205110 [details]
Output from /compat/linux/usr/bin/glxinfo32
Comment 10 Stefan Rumetshofer 2019-06-16 09:46:18 UTC
Created attachment 205111 [details]
Output from /compat/linux/usr/bin/glxinfo64
Comment 11 Tijl Coosemans freebsd_committer 2019-06-16 10:28:08 UTC
Thanks, both seem to load radeonsi_dri.so fine now.  Does Unreal still fail to load radeonsi_dri.so?
Comment 12 Stefan Rumetshofer 2019-06-16 10:34:48 UTC
Yes it does.

Processors / Cores 8
Forcing CPU affinity disabled.
libGL error: unable to load driver: radeonsi_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: radeonsi
libGL error: unable to load driver: radeonsi_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: radeonsi
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  155 (GLX)
  Minor opcode of failed request:  3 (X_GLXCreateContext)
  Value in failed request:  0x0
  Serial number of failed request:  41
  Current serial number in output stream:  42
Comment 13 Stefan Rumetshofer 2019-06-16 10:45:07 UTC
I also tried /compat/linux/usr/bin/glxgears (is this 64bit?) from c7 and it fails with a Segfault.
Comment 14 Tijl Coosemans freebsd_committer 2019-06-16 11:16:08 UTC
Can you run Unreal through ktrace like this:

ktrace -i -f /path/to/ktrace.out /path/to/command
kdump -H -f /path/to/ktrace.out > /path/to/ktrace.txt

Then attach ktrace.txt.  You'll probably have to compress it using xz or something.

Same for /compat/linux/usr/bin/glxgears (which is indeed 64-bit).
Comment 15 Stefan Rumetshofer 2019-06-16 13:43:58 UTC
Created attachment 205129 [details]
kdump of /compat/linux/usr/bin/glxgears

Here is the dump from glxgears.
The dump from unreal is too big. The compressed file has 17.4MB
Should i cut off the beginning of the file?
Comment 16 Stefan Rumetshofer 2019-06-16 15:37:10 UTC
Created attachment 205137 [details]
kdump of UnrealXLinux.bin

Ok, here are the last lines of the kdump from unreal.
I hope it helps.
Comment 17 Tijl Coosemans freebsd_committer 2019-06-16 16:26:30 UTC
For glxgears PRIME_HANDLE_TO_FD ioctl returns EINVAL for some reason.  Maybe x11@ knows more about that.

Unreal seems to fail to load dependencies of /compat/linux/lib/libLLVM-6.0-rhel.so.  The directory that contains Unreal, does that contain any libraries?  What is the output of "find -s /path/to/unrealdir -name '*.so*'"?

What is the output of "/compat/linux/bin/sh ldd /path/to/UnrealXLinux.bin"?
Comment 18 Stefan Rumetshofer 2019-06-16 16:38:59 UTC
The libraries are in the "System" subfolder where also the UnrealXLinux.bin is.

% find -s Unreal/System -name '*.so*'
Unreal/System/ALAudio.so
Unreal/System/Audio.so
Unreal/System/Core.so
Unreal/System/Editor.so
Unreal/System/Emitter.so
Unreal/System/Engine.so
Unreal/System/Fire.so
Unreal/System/FMODAudioDrv.so
Unreal/System/IpDrv.so
Unreal/System/libalut.so.0
Unreal/System/libalut.so.0.1
Unreal/System/libalut.so.0.1.0
Unreal/System/libfmod-3.75.so
Unreal/System/libfmod.so
Unreal/System/libgcc_s.so
Unreal/System/libgcc_s.so.1
Unreal/System/libmikmod.so
Unreal/System/libmikmod.so.2
Unreal/System/libmikmod.so.2.0.4
Unreal/System/libmudflap.so
Unreal/System/libmudflap.so.0
Unreal/System/libmudflap.so.0.0.0
Unreal/System/libmudflapth.so
Unreal/System/libmudflapth.so.0
Unreal/System/libmudflapth.so.0.0.0
Unreal/System/libopenal.so
Unreal/System/libopenal.so.1
Unreal/System/libopenal.so.1.12.854
Unreal/System/libSDL-1.2.so
Unreal/System/libSDL-1.2.so.0
Unreal/System/libSDL-1.2.so.0.11.2
Unreal/System/libssp.so
Unreal/System/libssp.so.0
Unreal/System/libssp.so.0.0.0
Unreal/System/libstdc++.so
Unreal/System/libstdc++.so.6
Unreal/System/libstdc++.so.6.0.8
Unreal/System/libXxf86dga.so
Unreal/System/libXxf86dga.so.1
Unreal/System/libXxf86dga.so.1.0.0
Unreal/System/NullDrv.so
Unreal/System/NullNetDriver.so
Unreal/System/NullRender.so
Unreal/System/OpenGLDrv.so
Unreal/System/Render.so
Unreal/System/SDLDrv.so
Unreal/System/SDLGLDrv.so
Unreal/System/SDLSoftDrv.so
Unreal/System/SwFMOD.so
Unreal/System/UEnginePPC.so
Unreal/System/XDrv.so
Unreal/System/XMesaGLDrv.so

% ldd Unreal/System/UnrealXLinux.bin
linux32_vdso.so.1 =>  (0xffffe000)
        Core.so => ./Core.so (0x21200000)
        Engine.so => ./Engine.so (0x21a00000)
        libXxf86dga.so.1 => ./libXxf86dga.so.1 (0x21024000)
        libstdc++.so.6 => ./libstdc++.so.6 (0x2102c000)
        libm.so.6 => /lib/libm.so.6 (0x21125000)
        libgcc_s.so.1 => ./libgcc_s.so.1 (0x21167000)
        libc.so.6 => /lib/libc.so.6 (0x21d51000)
        libX11.so.6 => /lib/libX11.so.6 (0x2189b000)
        librt.so.1 => /lib/librt.so.1 (0x21173000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x2117d000)
        libdl.so.2 => /lib/libdl.so.2 (0x21198000)
        libXext.so.6 => /lib/libXext.so.6 (0x2119d000)
        /lib/ld-linux.so.2 (0x01001000)
        libxcb.so.1 => /lib/libxcb.so.1 (0x211b0000)
        libXau.so.6 => /lib/libXau.so.6 (0x211db000)
Comment 19 Johannes Lundberg freebsd_committer 2019-06-16 17:08:38 UTC
The PRIME_HANDLE_TO_FD ioctl failing for Xwayland is solved in Xorg 1.20. Hopefully this is the same and will also be fixed by 1.20.

There are three solutions

1) Wait for Xorg 1.20

2) Build your own x11-servers/xorg-server from https://github.com/FreeBSDDesktop/freebsd-ports/tree/feature/xserver-1.20 (I think it's OK to only build this package and install it over the old one). 

3) Patch the drm driver by removing DRM_AUTH from the two lines where PRIME_HANDLE_TO_FD and it's reverse ioctls are defined.  See https://github.com/FreeBSDDesktop/kms-drm/issues/33
Comment 20 Stefan Rumetshofer 2019-06-16 17:38:29 UTC
I will try to merge the xorg-server port into my poudriere ports tree and build that port. This will take some time.
Comment 21 Tijl Coosemans freebsd_committer 2019-06-16 18:39:43 UTC
Try deleting (or renaming) these:

Unreal/System/libgcc_s.so
Unreal/System/libgcc_s.so.1
Unreal/System/libstdc++.so
Unreal/System/libstdc++.so.6
Unreal/System/libstdc++.so.6.0.8
Unreal/System/libXxf86dga.so
Unreal/System/libXxf86dga.so.1
Unreal/System/libXxf86dga.so.1.0.0

These are probably older versions of the ones in /compat/linux/usr/lib.
Comment 22 Stefan Rumetshofer 2019-06-17 16:23:27 UTC
So now i'm on xorg-server-1.20.4,1 but the errors are still the same.
/compat/linux/usr/bin/glxgears => Segmentation fault
linux-doom3 => Segmentation fault
Unreal is still not working too an when i remove the suggested libraries it ends wit a Segmentation fault.
Comment 23 Johannes Lundberg freebsd_committer 2019-06-17 16:32:03 UTC
(In reply to Stefan Rumetshofer from comment #22)

I take it this is with LIBGL_DRI3_DISABLE=1?
Comment 24 Stefan Rumetshofer 2019-06-17 17:42:58 UTC
(In reply to Johannes Lundberg from comment #23)
Shit, i forgot to set the variable after i restarted Xorg.
glxgears and Unreal are running now.