Jump to content

Boost Linux performace


daretmavi

Recommended Posts

It seems, that turning mesa_glthread on gives nice performance boost. (Avg FPS from 58 to 71)

Change vintagestory.desktop file
 

mono Vintagestory.exe

to

mesa_glthread=true mono Vintagestory.exe

 

mesa_glthread is off

fps58.png.673e28d20cc3dd93aeda553ce7ad3835.png

 

mesa_glthread is on

fps71.png.a4005c2f8b2815cf1617ffc4a0b099b9.png

 

Not sure about the stability. I have to test it a little bit more, but it looks promising.

Tested with AMD RX580 graphic card.

 

Link to comment
Share on other sites

I've been trying few methods: compile mono with llvm support, mono -O=all, wine-proton but none gave a performance boost. Mesa_glthread didn't improve my performance tests (4k, max settings), it does crash if I switch working environment and occasionally when entering the main menu.

Spoiler

Normal performance:

2022-01-29_14-04-02.thumb.jpg.0c636f5d6f87c851f3b5ac9b9f9aa4a1.jpg

mesa_glthread=true:

2022-01-29_14-06-15.thumb.jpg.6456e6fd14f16af0e8d287a43aec1f64.jpg

Settings:

2022-01-29_14-10-02.thumb.jpg.f44579cfa5d1b911bd0602a6994117e3.jpg

For me the biggest issue is the input delay after playing for a while, it mostly affects when moving around generating new terrain. The game is responsive but the view and mouse cursor are 0.5-1s behind the actual input. Worst case is if you load the world multiple times during a session and the lagging tends to continue even on a fresh start. Easiest fix is to restart the game completely but it's not great if you have to do it every hour or so. I wonder if it's linux/mono or the game causing the issue.

Link to comment
Share on other sites

1 hour ago, Tyron said:

Set mouse smoothing to 0, in case you haven't already

I've always had the mouse smoothing off. I suspect that the terrain generation is causing the issue since it's pushing gpu usage to 100% when travelling around. Having a limiter to cap terrain gen processing on the gpu to 95% would probably help. Check the following video for more info.

Link to comment
Share on other sites

I recently also have issues with performance on linux, game is using almost all of my 16 GB ram and GPU shows a big lag spikes. Dunno what happened, but I'm using 1.16.1 version of the game, all my mods are updated, checked almost everyone of them and it isn't an issue with mods. When I generated totally new world ram usage went down quite drastically. I have an i5 processor so it rather shouldn't happen.

Edited by Sinda
Link to comment
Share on other sites

  • 7 months later...
On 1/29/2022 at 1:45 PM, rogston said:

The game is responsive but the view and mouse cursor are 0.5-1s behind the actual input.

The fix for this (and input lag in general, even in other games) is to run the game with libstrangle, like this: (pick whatever target framerate you want)

strangle 60 mono ./Vintagestory.exe

I am not sure why this helps in Vintage Story, as usually this "trick" only solves the 1-2 frames (at minimum) worth of input lag in other games (such as most Source engine games) by changing the moment at which the framebuffer is flipped enough to stop extra frames from being buffered in the GPU driver side (nVidia drivers for example are known to buffer anywhere from 1 to more than 5 frames).

This however, does not explain the 0.5 - 1s worth of lag in Vintage Story, as that is very excessive. Perhaps OpenTK (if that is still used for windowing and input) has a sub-optimal input handler which makes things worse on high input rate (1000Hz) devices and libstrangle somehow manages to "throttle" that as well, so it has to process less events (and less stale events) each frame.

In any case, with this "tweak", the input lag is almost completely gone, and moving around no longer correlates to higher CPU usage as well.

  • Thanks 1
Link to comment
Share on other sites

On 9/8/2022 at 3:01 AM, Unquadtrium said:

The fix for this (and input lag in general, even in other games) is to run the game with libstrangle, like this: (pick whatever target framerate you want)

strangle 60 mono ./Vintagestory.exe

I am not sure why this helps in Vintage Story, as usually this "trick" only solves the 1-2 frames (at minimum) worth of input lag in other games (such as most Source engine games) by changing the moment at which the framebuffer is flipped enough to stop extra frames from being buffered in the GPU driver side (nVidia drivers for example are known to buffer anywhere from 1 to more than 5 frames).

This however, does not explain the 0.5 - 1s worth of lag in Vintage Story, as that is very excessive. Perhaps OpenTK (if that is still used for windowing and input) has a sub-optimal input handler which makes things worse on high input rate (1000Hz) devices and libstrangle somehow manages to "throttle" that as well, so it has to process less events (and less stale events) each frame.

In any case, with this "tweak", the input lag is almost completely gone, and moving around no longer correlates to higher CPU usage as well.

Thanks for the info. I got strangle to work with proton and native games but no luck with vs on latest stable mono version. No error messages on cli or logs.

Link to comment
Share on other sites

Well tried it on debian and this is the result:

 

Running on 64 bit Linux with 15 GB. 
Game Version: v1.17.3 (Stable)
11.09.2022 11:08:10: Critical error occurred
Loaded Mods: 
OpenTK.Graphics.GraphicsContextException: Failed to create OpenGL context. Glx.CreateContext call returned 0.
  at OpenTK.Platform.X11.X11GLContext..ctor (OpenTK.Graphics.GraphicsMode mode, OpenTK.Platform.IWindowInfo window, OpenTK.Graphics.IGraphicsContext shared, System.Boolean direct, System.Int32 major, System.Int32 minor, OpenTK.Graphics.GraphicsContextFlags flags) [0x001dd] in <a4886e33f9fc416195d24950e7205b94>:0 
  at OpenTK.Platform.X11.X11Factory.CreateGLContext (OpenTK.Graphics.GraphicsMode mode, OpenTK.Platform.IWindowInfo window, OpenTK.Graphics.IGraphicsContext shareContext, System.Boolean directRendering, System.Int32 major, System.Int32 minor, OpenTK.Graphics.GraphicsContextFlags flags) [0x00000] in <a4886e33f9fc416195d24950e7205b94>:0 
  at OpenTK.Graphics.GraphicsContext..ctor (OpenTK.Graphics.GraphicsMode mode, OpenTK.Platform.IWindowInfo window, OpenTK.Graphics.IGraphicsContext shareContext, System.Int32 major, System.Int32 minor, OpenTK.Graphics.GraphicsContextFlags flags) [0x000c3] in <a4886e33f9fc416195d24950e7205b94>:0 
  at OpenTK.Graphics.GraphicsContext..ctor (OpenTK.Graphics.GraphicsMode mode, OpenTK.Platform.IWindowInfo window, System.Int32 major, System.Int32 minor, OpenTK.Graphics.GraphicsContextFlags flags) [0x00008] in <a4886e33f9fc416195d24950e7205b94>:0 
  at OpenTK.GameWindow..ctor (System.Int32 width, System.Int32 height, OpenTK.Graphics.GraphicsMode mode, System.String title, OpenTK.GameWindowFlags options, OpenTK.DisplayDevice device, System.Int32 major, System.Int32 minor, OpenTK.Graphics.GraphicsContextFlags flags, OpenTK.Graphics.IGraphicsContext sharedContext, System.Boolean isSingleThreaded) [0x00164] in <a4886e33f9fc416195d24950e7205b94>:0 
  at OpenTK.GameWindow..ctor (System.Int32 width, System.Int32 height, OpenTK.Graphics.GraphicsMode mode, System.String title, OpenTK.GameWindowFlags options, OpenTK.DisplayDevice device, System.Int32 major, System.Int32 minor, OpenTK.Graphics.GraphicsContextFlags flags, OpenTK.Graphics.IGraphicsContext sharedContext) [0x00000] in <a4886e33f9fc416195d24950e7205b94>:0 
  at OpenTK.GameWindow..ctor (System.Int32 width, System.Int32 height, OpenTK.Graphics.GraphicsMode mode, System.String title, OpenTK.GameWindowFlags options, OpenTK.DisplayDevice device, System.Int32 major, System.Int32 minor, OpenTK.Graphics.GraphicsContextFlags flags) [0x00000] in <a4886e33f9fc416195d24950e7205b94>:0 
  at Vintagestory.Client.NoObf.GameWindowNative..ctor (OpenTK.Graphics.GraphicsMode mode, OpenTK.GameWindowFlags flags, System.Int32 openGlMajor, System.Int32 openGlMinor) [0x00017] in <6215ae1029cd4696b4c4b2c34106b061>:0 
  at Vintagestory.Client.ClientProgram.Start (Vintagestory.Client.ClientProgramArgs args, System.String[] rawArgs) [0x0034c] in <9422a14f759b4537aaff44309dc950a2>:0 
  at Vintagestory.Client.ClientProgram+<>c__DisplayClass14_0.<.ctor>b__0 () [0x00000] in <9422a14f759b4537aaff44309dc950a2>:0 
  at Vintagestory.ClientNative.CrashReporter.Start (System.Threading.ThreadStart start) [0x00007] in <6215ae1029cd4696b4c4b2c34106b061>:0 

 

Not sure what to do about it xD
It is even worse - after changing it back in the activator to mono Vintagestory.exe I still get the same error in return :/ Any idea how to repair it?
EDIT
Fortunately restart of PC was enough to help but it was kinda scary xD Anyway would still like to know why this was the result and what to do to change it.

Edited by Sinda
Link to comment
Share on other sites

  • 9 months later...

mesa_glthread=true made my client randomly freeze and also the window became black every time I changed it's size. I never even loaded into any world, it had always hanged before that. Tested on Void Linux with AMD Ryzen 2600 + Radeon RX6700 + 32gb RAM.

Link to comment
Share on other sites

  • 4 weeks later...

Interesting. I'm also using Linux I'll have to try these out. So far performance (as in frame rate) has been fine on my side. I do have a strange issue where the system will lag very intensely for 5~ seconds or so (massive lag spikes) every once in awhile like 20 minutes. I thought it was chunk loading maybe, though that doesn't seem to be the case.

32GB DDR4 Ram
5800x3d
RTX3090

I'm playing on the high or very high preset IIRC at 4k resolution. GPU usage is usually around 40 - 50%, cpu usage negligible (something around 10% IIRC). I'm not really sure what is causing the hangups. 

I tried to run the game in gamescope though I can't seem to get it to fit nicely into the nested gamescope window. It's always a vertical slice so that is interesting behavior. I have only tried messing with gamescopes arguments a bit to no avail. I'll have to try a bit harder though maybe? I thought that maybe that would help with the occasional stuttering issue I'm having.

Anywho, when I next play here I'll have to try out just to see! Anyone have any ancedotes about proton / GeWine compared to "native" (as native as it can be, being mono that is)?

mesa_glthread=true mono Vintagestory.exe
Edited by Meekology
Link to comment
Share on other sites

I've had performance issues with the default Mono settings (a lot of suttering). Running things with:

mono-sgen --llvm --gc-params="nursery-size=32m,minor=simple-par" Vintagestory.exe
 

improved stuff a great deal. The .Net7 release resolves those issues.

Edited by sushieater
Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.