i3status-rust
i3status-rust copied to clipboard
nvidia_gpu block resumes GPU from suspend on Optimus devices
System info
CPU : AMD Ryzen 9 5900HS with Radeon Graphics GPU : NVIDIA GeForce RTX 3070 Mobile iGPU : AMD ATI Radeon Vega Series
Issue
On Laptops with both an iGPU and a dedicated GPU, the dedicated GPU can be suspended to lower power draw, and gets resumed when high performance is needed (PRIME - Arch Wiki).
I can query the GPU state with this command:
cat /sys/bus/pci/devices/0000:01:00.0/power/runtime_status
I noticed that the nvidia_gpu block resumes my dedicated GPU from its suspended state.
I suggest that a new block option should get added that checks if the GPU is suspended and avoids resuming it.
Reported in #1880.
I suggest that a new block option should get added that checks if the GPU is suspended and avoids resuming it.
By "avoids resuming" do you mean stops updating?
Just displaying something like this instead of waking up the GPU only to get its stats:
Block config
[[block]]
block = "custom"
command = "cat /sys/bus/pci/devices/0000:01:00.0/power/runtime_status"
interval = 2
format = " \uf26c $text "
And when you detect that it's active, just display the stuff normally.
I tried to achieve this behavior with a special toml config but couldn't get it working as intended without just doing the whole thing (check for power state, and then retrieve all of the info) in a script.
Ah, okay, this sounds good. Maybe we can add suspended_format to customize the text, or even hide the block.
cat /sys/bus/pci/devices/0000:01:00.0/power/runtime_status
Do you know a generic way to get this path?
Also, I don't have an nvidia gpu to play with, so would you be interested in implementing this?
This 000:01:00.0 part of the path refers to the PCI slot of the NVIDIA GPU retrieved with lspci ([domain:]bus:device.function). I'll have to find a way to find this reliably.
I have some rust projects but I'm still a beginner. I'll take a look at the code in a few days and tell you if I'm confident in implementing this.
Took a look into the code, I'm confident, but after putting more toughs into the thing, I don't know what to implement, thing is, if we wait for the GPU to wake up before retrieving the info, the info retrieval process is going to keep it active.
Hi I was having the same issue. My workaround was to change the retrieve interval to 10-15s when the values are low, so, when the block is the only thing keeping the card active; the longer interval becomes long enough to allow it to go to sleep. I made a script and use a custom block instead of this one.