[1.1.91][Linux] Factorio uses a wrong GPU

We are aware of them, but they have low priority. We have more important things to do. They go here in order not to take space in the main bug thread list.
Post Reply
Marsohod
Manual Inserter
Manual Inserter
Posts: 2
Joined: Mon Oct 16, 2023 7:48 am
Contact:

[1.1.91][Linux] Factorio uses a wrong GPU

Post 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.
Attachments
factorio-previous.log
(32.95 KiB) Downloaded 32 times
factorio-current.log
(33.03 KiB) Downloaded 31 times

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

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

Post 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.
If you want to get ahold of me I'm almost always on Discord.

Marsohod
Manual Inserter
Manual Inserter
Posts: 2
Joined: Mon Oct 16, 2023 7:48 am
Contact:

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

Post 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?

User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 452
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

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

Post 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.
Don't forget, you're here forever.

Post Reply

Return to “Minor issues”