You are not logged in.
I usually prefer using Integrated graphics on my laptop and after trying all kinds of graphic switching solutions I ended up with the Kernel's vgaswitcheroo and I love it. the problem is that I have to run this command as root every time after startup and then proceed with a logout-login
echo DIGD>/sys/kernel/debug/vgaswitcheroo/switch
I could not find a way to set this mode as default at boot so I don't have to do that every time. could somebody please help me on how to do that?
Last edited by hematinik (2022-06-19 07:35:39)
Offline
You could use sysctl configs should be
kernel.debug.vgaswitcheroo.switch = 1
but check with sysctl -a first if this is even exposed.
If it isn't you could make a systemd service that just runs this, e.g. /etc/systemd/service/switchtoIGPU.service
[Unit]
Description=Switching to igpu service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/sh -c "echo DIGD > /sys/kernel/debug/vgaswitcheroo/switch"
[Install]
WantedBy=multi-user.target
and enable with
systemctl enable switchtoIGPU.service
Offline
Thank you @V1del for your consideration, I tried the systemd approach and it didn't work. I could confirm that I'm still on the discrete graphics using `glxheads` and the following command:
cat /sys/kernel/debug/vgaswitcheroo/switch
I noticed that you suggested "/etc/systemd/service/switchtoIGPU.service" instead of "/etc/systemd/system/switchtoIGPU.service" I guess? because in that case `systemctl` would not be able to find the service.
Offline
a whoops yeah a typo on my part, did you check the service status? It is possible that the command runs before the vgaswitcheroo file node is present in which case you might have to delay execution with an explicit sleep or so
Offline
You are a lifesaver Sir! adding sleep did the trick. this is the modified service in case anyone might find helpful in future:
# /etc/systemd/system/switchtoIGPU.service
[Unit]
Description=Switching to igpu service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/sh -c "sleep 5 && echo DIGD>/sys/kernel/debug/vgaswitcheroo/switch"
[Install]
WantedBy=multi-user.target
Note: the 5 seconds is an overkill for sure, I'd go with 1 or 2 personally so you can decrease the delay and see how things go.
Offline