#!/usr/bin/bash

echo ==========================================================
[ -f '/etc/issue' ] && cat /etc/issue
echo Kernel version: `uname -r`

echo ==========================================================
echo Checking for compiz...
COMPIZ=`(ps -e |grep -is compiz) &> /dev/null && echo y`

echo ==========================================================
echo Checking for metacity compositing:
COMPOSITE=`gconftool-2 --get /apps/metacity/general/compositing_manager`

echo ==========================================================
echo "Checking for Graphics acceleration (XAA or EXA)."
XAA=`grep -q XAA /var/log/Xorg.0.log && echo y`

echo ==========================================================
echo Checking glx...
grep glx /var/log/Xorg.0.log

echo Checking glx direct rendering...
if [ "`which glxinfo`" ]; then
glxinfo|grep -i "direct rendering:"
glxinfo|grep -ie "vendor\|version"
else
echo Could not find glxinfo, cannot detect hardware acceleration.
fi

which glxgears &> /dev/null && (glxgears > /tmp/glxframes &) && sleep 7 && echo Close glxgears now 1>&2 ; sleep 1; echo Close glxgears now 1>&2 && sleep 5 && (killall glxgears;cat /tmp/glxframes)

echo ==========================================================

[ "$COMPIZ" == "y" ] && echo "Compiz (Desktop Effects) is on. It is recommended you turn it off."
[ "$XAA" == "y" ] && echo "X Window is using a slow acceleration mode called XAA. It is recommended you use EXA or later. Look this up in a search engine to find out how to do it on your system."
[ "$COMPOSITE" == "false" ] && echo "Compositing is turned off for Metacity. If you are using Gnome, you will not be able to annotate on the desktop, and some transparent windows in Inspire will not appear correctly."
