EU5.0.1 - Problem black window at startup in Linux

Hello guys, so I’m fixing the issue with new open source nvidia driver in ArchLinux is nvidia-open and switch server display to wayland.

1 Like

Hi,

I’ve also had this issue. I finally got it working on my machine by disabling high DPI awareness, see end of this post if you’re not interested in the background information.
I’m posting here in case it helps anybody else who stumbles over this issue and doesn’t want to switch to wayland.

With Unreal Engine 5.1 I was able to fix it with the scaling setting Chownas posted. After updating to Unreal Engine 5.2.1 that fix stopped working for me. I also have a Samsung C49RG9x and a NVIDIA GeForce RTX 3080. I’m on Manjaro with KDE and X11.

I had already noticed before (while trying to solve a scaling issue with GIMP 2.10) that XRandR reports the screen size wrong for my display. As can be seen in the xrandr call output:
DP-2 connected primary 5120x1440+0+0 (normal left inverted right x axis y axis) 1mm x 1mm

I tried fixing this value by specifying the physical screen size and directly setting DPI (and other stuff I don’t remember), but nothing lead to a change in that value. So I tried to find another solution and dug into the source code of Unreal Engine.

As was already mentioned in a previous post Unreal Engine uses SDL2 to get the display information. I got the SDL2 source and created a mini project to check what information it retrieves. As suspected it gets the display width and height of 1mm from XRandR (in X11_AddXRandRDisplay) and calculates wrong DPI values:

hdpi = 130048
vdpi = 36576
ddpi = 95525.6172

The code in Unreal calls SDL2’s “SDL_GetDisplayDPI” that returns those wrong values, if high DPI awareness is enabled.
(As a sidenote: The expected DPI value for the display is around 109.)

Here is what is going wrong from my understanding:

  • The editor window size is calculated as very large, because of the high DPI value and the scale that is computed from the DPI (scale = 868).
  • However, the window is clamped to fit onto the screen based on the pixel size.
    WindowSize: [0] = 1038128 [1] = 748216 → clamped to [0] = 5120 [1] = 1396
  • When drawing into the window the wrong DPI value / scaling factor is used to calculate the positions for the elements and they are drawn outside of the visible window. This leads to only the gray gradient being visible in the window.

The display DPI and scaling are calculated inside an if-statement that checks FPlatformApplicationMisc::IsHighDPIAwarenessEnabled().
E.g., the function FLinuxPlatformApplicationMisc::GetDPIScaleFactorAtPoint(float X, float Y) returns just 1, if DPI awareness is not enabled.
In my SDL test project and also by changing another part in the engine code I noticed that it is working when a scaling of 1 is used.

I came to the conclusion that I probably just need to disable the high DPI awareness to fix my issue. I checked how I can disable it and ended up in the function FSlateApplication::InitHighDPI(const bool bForceEnable) that sets the console variable EnableHighDPIAwareness from the EditorSettings or from command line argument.

Disabling high DPI awareness:

  • Add launch parameter -nohighdpi to start the editor
    or
  • Add
[HDPI]
EnableHighDPIAwareness=False

to Engine/Saved/Config/LinuxEditor/EditorSettings.ini

2 Likes