Let's Get Some Hybrid Graphics Up In Here!

if [ ! -f /etc/X11/xorg.conf ]; then
sudo cp /etc/X11/xorg.conf.fglrx /etc/X11/xorg.conf
fi
startx /usr/bin/openbox-session -- :1
How simple was that? And my script for starting X on my integrated card is about the same (only using XFCE, because XFCE is cool).

Oh AMD…

Everything finally works! I can play games on my discrete card, and I can browse the internet on my integrated card without the temperature going up to 90°! Only that's the problem – I can't. Even when working on my integrated card, the system often goes up to 89°-ish. The worst time was when my computer was idle, and then suddenly crashed because of a ‘Thermal Shutdown’. A bit of Googling later, I found the reason was that the discrete card was still running even though it wasn't running… The solution? Use acpi_call-git and turn the card off! And get this – it actually works! Ish.

I found that switching the AMD card on or off when the computer had just booted up worked successfully. However, if I switched the card off, worked on the integrated card for a while, and attempted to switch the card on, the whole system would semi-crash. All keyboard input and mouse clicking would be unresponsive, however moving the mouse around still moved the cursor. If I did this from a tty, I would get a beautiful wall of text about dereferencing NULL pointers or something.

Eventually, after searching in the most unexpected place – information for Nvidia cards that I stumbled upon for a completely unrelated reason – I found the issue: if the card is disabled when suspending to RAM, it stops working. This also appeared to be the case when locking the screen or turning off the display.

Because turning off all the problem-causing things seemed to be a little too much work, I gave up and just left the card running. My workaround was to shove a book underneath the laptop. Ventilation, you know!

Improvements

After testing out bumblebee-amd-hacks on GitHub, and discovering that it did not work at all for me, I discovered the pxp_switch_catalyst command, bundled with AMD Catalyst for Arch Linux. By making the necessary modifications to my switching scripts, I was now able to use hardware acceleration on my integrated card.

My Switching Scripts

$ cat /usr/local/bin/fglrxoff
------------------------------
#!/bin/bash
if [ -f /etc/X11/xorg.conf ]; then
sudo rm /etc/X11/xorg.conf
echo Using Intel driver
else
echo Already using Intel driver
fi

LIB_LINK="`readlink /usr/lib/catalystpxp/libGL.so.1.2 2>/dev/null`"
if [[ "${LIB_LINK}" = "/usr/lib/libGL.so.1.2" || "${LIB_LINK}" = "/usr/lib/libGL.so.1.2.0" || "${LIB_LINK}" = "/usr/lib/libGL.so" ]]; then
echo Already using Intel OpenGL
else
sudo /usr/lib/fglrx/switchlibGL intel >/dev/null
sudo /usr/lib/fglrx/switchlibglx intel >/dev/null
echo Switched to Intel OpenGL
fi

startx -- :0 vt7
------------------------------
$ cat /usr/local/bin/fglrxoff
------------------------------
#!/bin/bash
if [ -f /etc/X11/xorg.conf ]; then
echo Already using AMD driver
else
sudo cp /etc/X11/xorg.conf.fglrx /etc/X11/xorg.conf
echo Switched to AMD driver
fi

LIB_LINK="`readlink /usr/lib/catalystpxp/libGL.so.1.2 2>/dev/null`"
if [[ "${LIB_LINK}" = "/usr/lib/libGL.so.1.2" || "${LIB_LINK}" = "/usr/lib/libGL.so.1.2.0" || "${LIB_LINK}" = "/usr/lib/libGL.so" ]]; then
#Using Intel
#sudo pxp_switch_catalyst amd
sudo /usr/lib/fglrx/switchlibGL amd
sudo /usr/lib/fglrx/switchlibglx amd
echo Switched to AMD OpenGL
else
#Using AMD
echo Already using AMD OpenGL
fi

startx /usr/bin/openbox-session -- :1 vt8
------------------------------
/etc/X11/xorg.conf.fglrx is the xorg.conf file generated by aticonfig --initial.

Postscript: Oh Steam…

So, after all this work, I finally had a set-up I was happy with! ‘Shirt off, pants off, time to Dotes!’