Page 1 of 1

[1.1.91][Linux] Factorio uses a wrong GPU

Posted: Mon Oct 16, 2023 8:40 am
by Marsohod
So, the problem is quite simple. I have a dual GPU setup (an integrated GPU & a discrete GPU) and, by default, Factorio selects the iGPU regardless of the current graphic settings. It's not noticeable on the vanilla game but, with mods, the game squeezes everything out of the iGPU and runs at 1 FPS both in the main menu & the game.

I found a temporary solution to this issue by setting the DRI_PRIME=1 env var, which forces the use of a discrete GPU, before starting the game but actually it should select the most powerful GPU automatically, like other games do.

In attached logs, you can see the only difference is in a selected GPU & VRAM size.
  • factorio-previous.log was started without the DRI_PRIME=1 env var.
  • factorio-current.log was started with it.

Re: [1.1.91][Linux] Factorio uses a wrong GPU

Posted: Mon Oct 16, 2023 11:37 pm
by Rseding91
As far as I can find.. there's simply no way for a piece of software to determine which GPU it should use on non-windows? For windows programs there's this: https://gist.github.com/statico/6809850727c708f08458 which we already use. Maybe someone else with more non-windows experience can show me otherwise.

Re: [1.1.91][Linux] Factorio uses a wrong GPU

Posted: Tue Oct 17, 2023 2:20 am
by Marsohod
Hmm, sadly, yes, since Factorio uses OpenGL as its graphic API, there's no way to request a device type like it's usually done with Vulkan. Then maybe a GPU can be selected based on its VRAM size?

Re: [1.1.91][Linux] Factorio uses a wrong GPU

Posted: Wed Oct 25, 2023 12:27 am
by raiguard
As was mentioned, OpenGL doesn't provide this capability, and the workaround we use only works on Windows. Even providing a GPU selector isn't feasible unless we port the game to Vulkan.

I would recommend writing a wrapper script to launch the game with your environment variable.