I have a HP Pavilion from 2010 that has an IGP and a DGP in it: a Mobility HD 4230 series and a Mobility HD 5450 series. The open-source drivers run fine on both, particularly more on the HD 5450, and gaming is rather pleasant and bug-free.

My question is, though, as I have to constantly switch to discrete graphics for higher performance (and better power management), what would be a way to automate this process on boot?

In /etc/rc.d/rc.local, I've put the following:


# stop and restart GDM; switch to discrete graphics

service gdm stop
/usr/bin/vgaswitch OFF DIS
service gdm start

(Note that "vgaswitch" is a just a script I wrote to simplify multiple echo functions into /sys/kernel/debug/vgaswitcheroo/switch. Note also that I have to stop GDM first before I can switch graphics cards, perhaps since GDM holds a lock on the IGP.)

For some reason, however, I still get an error of "client failed to switch" even though executing that in terminal works perfectly fine. Is there a way that I can prevent GDM from starting up until the discrete graphics card has been switched to?