Small confusions around how to utilize hybrid graphics in minimal arch setup

Hey there! First off I recognize that my use case is pretty niche as I imagine most full fledged desktop environments magically take care of this for you. My setup is very minimal with Arch Linux where I start i3 manually from a TTY using a modified sx/startx script. For context I am a developer and would consider myself pretty technically competent and I’ve run Linux for a few years now. This is just my first foray into Arch/Linux on a box with hybrid graphics and unfortunately the relevant Arch wiki article on ‘PRIME’ is surprisingly not in the best state.

I am trying to better understand how the hybrid graphics can be utilized. this post helped me greatly understand the underlying architecture better but I’m still running into a minor issue with the dedicated GPU.

My issue is that with some apps started with the DRI_PRIME=1 env var to force them onto the dedicated GPU the GPU will auto suspend if the window is idle for a few seconds and the window will freeze up until I send it input again at which point the GPU comes back online and the window resumes after about another second. To monitor this I have a debug module in my polybar that constantly reads out the GPU status and I can pretty reliably get this to happen with Alacritty and Firefox for example. I have steam games where I have modified the startup command to include the DRI_PRIME var and those seem to keep the GPU on even if I move focus to another workspace/window.

My best guess as to what is happening is that there is something that is monitoring apps/windows to detect if they are ‘idle’ and shuts the GPU down if it thinks no apps currently need it on. It wouldn’t be surprising to know that most games are setup in a way where they constantly broadcast ‘keep the GPU on’ no matter what hence why I never get this issue there. I have even tried starting my entire Xserver with the DRI_PRIME env var and even then most apps will go idle and turn off the GPU.

This was a bit rambly but I’m hoping someone can help shed some light on a way I can possibly keep the dedicated GPU turned on. I know I probably don’t need the dedicated GPU for the majority of apps but in some ways I’m also just asking for curiosities sake and so I can be more in control of my system at a lower level.

Thanks!

If you want to force the dGPU to stay awake you can just modify the sysfs file (power/control) to turn off runtime PM.

You can alternatively set the timeout file (autosuspend_delay iirc) to way longer. Say like 60 seconds?

Thank you that info definitely got me on the right track. Specifically I was able to search around enough to eventually land on this piece of the linux documentation around what that file does. That then helped me better search for utilities that would help me manage that at a slightly higher level.

Great, glad you got a solution. I suggest posting more about the other tools you used for your solution here and/or the arch documentation so others can find it too :slight_smile: