#!/usr/bin/perl -w # Erwann Chenede - # compiz sanity check for OpenSolaris use strict; use POSIX qw (uname); my $card_type = "none"; #list of supported intel video card supported # from SUNWdrmr/postinstall my @intel_cards = ( "pci8086,2562", "pci8086,2572", "pci8086,2582", "pci8086,2592", "pci8086,2772", "pci8086,27a2", "pci8086,2972", "pci8086,2982", "pci8086,2992", "pci8086,29a2", "pci8086,2a02", "pci8086,2a12" ); #list of supported ATI video card supported # minskey install.sh script in the radeon tarball my @ati_cards = ( "pci1002,4136", "pci1002,4137", "pci1002,4144", "pci1002,4145", "pci1002,4146", "pci1002,4147", "pci1002,4150", "pci1002,4151", "pci1002,4152", "pci1002,4153", "pci1002,4154", "pci1002,4156", "pci1002,4237", "pci1002,4242", "pci1002,4243", "pci1002,4336", "pci1002,4337", "pci1002,4437", "pci1002,4966", "pci1002,4967", "pci1002,4a49", "pci1002,4a4b", "pci1002,4c57", "pci1002,4c58", "pci1002,4c59", "pci1002,4c5a", "pci1002,4c64", "pci1002,4c65", "pci1002,4c66", "pci1002,4c67", "pci1002,4e44", "pci1002,4e45", "pci1002,4e46", "pci1002,4e47", "pci1002,4e48", "pci1002,4e49", "pci1002,4e4a", "pci1002,4e4b", "pci1002,4e50", "pci1002,4e51", "pci1002,4e54", "pci1002,4e56", "pci1002,5144", "pci1002,5145", "pci1002,5146", "pci1002,5147", "pci1002,5148", "pci1002,5149", "pci1002,514a", "pci1002,514b", "pci1002,514c", "pci1002,514d", "pci1002,514e", "pci1002,514f", "pci1002,5157", "pci1002,5158", "pci1002,5159", "pci1002,515a", "pci1002,515e", "pci1002,5168", "pci1002,5169", "pci1002,516a", "pci1002,516b", "pci1002,516c", "pci1002,5460", "pci1002,554f", "pci1002,5653", "pci1002,5834", "pci1002,5835", "pci1002,5836", "pci1002,5837", "pci1002,5960", "pci1002,5961", "pci1002,5962", "pci1002,5963", "pci1002,5964", "pci1002,5969", "pci1002,596a", "pci1002,596b", "pci1002,5b60", "pci1002,5c61", "pci1002,5c62", "pci1002,5c63", "pci1002,5c64", "pci1002,5d4d" ); # Platform, Os, Architecture check my ($os,undef, $os_version, $version, $arch) = POSIX::uname(); sub os_check { if (!($os =~ m/SunOS/i)) { print "This script only works on Solaris. exiting (os = $os)\n"; exit(1); } if (!($arch =~ m/i686|i86pc/i)) { print "ERROR : This system is not a i386. Compiz on Solaris only runs on i386\n"; exit(1); } if ($os_version ne "5.11") { print "ERROR : This system doesn't run Solaris 11. Compiz only runs on Solaris 11\n"; exit (1); } $version =~ s/.*_([0-9][0-9]).*/$1/; print "=-=-=-=-=-= Platform checks =-=-=-=-=-=-=\n"; print "os version is : ${os_version} \n"; print "current architecture : ${arch} \n"; print "build number : $version\n"; if ($version < 75) { print "hmmm, this version is a bit old...\nyou need build at least build 75 to run this compiz 0.6.0 \n"; exit 0; } } # Check for supported video Cards sub card_check { my $PRTCONF = '/usr/sbin/prtconf'; open (OUT, "$PRTCONF -v |") or die ("cannot exec prtconf: $!"); while () { chomp; if ($_ =~ m/nvidia/) { $card_type = "nvidia"; last; } foreach my $card (@intel_cards) { if ($_ =~ /$card/) { $card_type = "i915"; last; } } foreach my $card (@ati_cards) { if ($_ =~ /$card/) { $card_type = "radeon"; last; } } } close OUT; if ($card_type eq "none") { return 0; } return 1; } # Check for Drivers sub drivers_check { my $MODINFO = '/usr/sbin/modinfo'; open (OUT, "$MODINFO |") or die ("cannot exec modinfo: $!"); while () { chomp; if ($_ =~ m/$card_type/) { return 1; } } close OUT; return 0; } # Check For Xorg Configuration sub ati_xorg_conf_check { # check if xorg.conf has the right settings my $in_section_module = "False"; my $in_section_device = "False"; my $in_section_Server_Layout = "False"; my $AIGLX = "False"; my $GLcore = "not loaded"; my $glx = "not loaded"; my $dri = "not loaded"; my $GARTSize = "undefined"; #64" my $AGPFastWrite = "undefined"; #True" my $EnablePageFlip = "undefined"; #True" my $AGPMode = "undefined"; #4" my $DynamicClocks = "undefined"; #on" my $EnableDepthMoves = "undefined"; #True" my $ColorTiling = "undefined"; #on" my $DMAForXv = "undefined"; #on" my $AccelDFS = "undefined"; #1" my $AccelMethod = "undefined"; # "XAA" my $XAANoOffscreenPixmaps = "undefined"; # true my $driver = "undefined"; # "ati" my $Composite = "Disable"; # "Enable" my $xorg_conf = ""; # now parse the resulting xorg.conf open (IN, "/etc/X11/xorg.conf") or die "cannot open /etc/X11/xorg.conf for reading : $!"; while () { chomp; #skip comments next if (/^\s*#/); if ($in_section_Server_Layout eq "True") { if (/EndSection/) { $in_section_Server_Layout = "False"; } if (/Option.*AIGLX/ && (/true/i || /on/i || "1")) { $AIGLX = "True"; } } else { if (/Section "ServerLayout"/) { $in_section_Server_Layout = "True"; } } if ($in_section_module eq "True") { if (/EndSection/) { $in_section_module = "False"; } if (/GLcore/) { $GLcore = "loaded"; } if (/glx/) { $glx= "loaded"; } if (/dri/) { $dri = "loaded"; } } else { if (/Section "Module"/) { $in_section_module = "True"; } } if ($in_section_device eq "True") { if (/EndSection/) { $in_section_device = "False"; } if (/GARTSize.*"(.*)"/) { $GARTSize = $1; } if (/AGPFastWrite/ && (/true/i || /on/i || "1")) { $AGPFastWrite = "True"; } if (/EnablePageFlip/ && (/true/i || /on/i || "1")) { $EnablePageFlip= "True"; } if (/AGPMode.*"(.*)"/) { $AGPMode = $1; } if (/DynamicClocks/ && (/true/i || /on/i || "1")) { $DynamicClocks= "True"; } if (/EnableDepthMoves/ && (/true/i || /on/i || "1")) { $EnableDepthMoves = "True"; } if (/ColorTiling/ && (/true/i || /on/i || "1")) { $ColorTiling = "True"; } if (/DMAForXv/ && (/true/i || /on/i || "1")) { $DMAForXv = "True"; } if (/AccelDFS/ && (/true/i || /on/i || "1")) { $AccelDFS = "True"; } if (/AccelMethod/ && /XAA/) { $AccelMethod = "XAA"; } if (/XAANoOffscreenPixmaps/ && /true/i) { $XAANoOffscreenPixmaps = "True"; } if (/Driver/ && /ati/) { $driver= "ati"; } } else { if (/Section "Device"/) { $in_section_device = "True"; } elsif (/Option.*Composite.*Enable/) { $Composite = "Enable"; } } } close (IN); if ($AIGLX eq "True" && $Composite ne "Disable" && $GLcore ne "not loaded" && $glx ne "not loaded" && $dri ne "not loaded" && $GARTSize eq 64 && $AGPFastWrite eq "True" && $EnablePageFlip eq "True" && $AGPMode eq 4 && $DynamicClocks eq "True" && $EnableDepthMoves eq "True" && $ColorTiling eq "True" && $DMAForXv eq "True" && $AccelDFS eq "True" && $AccelMethod eq "XAA" && $XAANoOffscreenPixmaps eq "True" && $driver eq "ati") { print "xorg.conf is properly configured\n"; } else { print "xorg.conf isn't configured for compiz support see details below :\n"; print "=-=-=-=-= Extension Section =-=-=-=-=-=-=\n"; print "Composite :\t $Composite\n"; print "=-=-=-=-= Server Layout Section =-=-=-=-=-=-=\n"; print "AIGLX :\t $AIGLX\n"; print "=-=-=-=-= Module Section =-=-=-=-=-=-=\n"; print "GLcore :\t $GLcore\n"; print "=-=-=-=-= Module Section =-=-=-=-=-=-=\n"; print "GLcore :\t $GLcore\n"; print "glx :\t $glx\n"; print "dri :\t $dri\n"; print "=-=-=-=-= Module Device =-=-=-=-=-=-=\n"; print "GARTSize :\t $GARTSize\n"; print "AGPFastWrite :\t $AGPFastWrite\n"; print "EnablePageFlip :\t $EnablePageFlip\n"; print "AGPMode :\t $AGPMode\n"; print "DynamicClocks :\t $DynamicClocks\n"; print "EnableDepthMoves :\t $EnableDepthMoves\n"; print "ColorTiling :\t $ColorTiling\n"; print "DMAForXv :\t $DMAForXv\n"; print "AccelDFS :\t $AccelDFS\n"; print "AccelMethod :\t $AccelMethod\n"; print "XAANoOffscreenPixmaps :\t $XAANoOffscreenPixmaps\n"; print "driver :\t $driver\n"; } } sub nvidia_xorg_conf_check { my $NVIDIAXCONFIG = '/usr/bin/nvidia-xconfig'; if (! -e "/etc/X11/xorg.conf") { print "No /etc/X11/xorg.conf detected\n"; print "Compiz will not run without a proper xorg.conf configuration file.\n\n"; if ($card_type eq "nvidia") { print "This is not a fatal error as the installer will try to generate an\n"; print "appropriate configuration file.\n"; } else { print "Can you generate it by running as root from the console :\n"; print "/usr/X11/bin/Xorg -configure \nthen place and rename "; print "the resulting file in /etc/X11/xorg.conf\n"; exit 0; } } open (OUT, "$NVIDIAXCONFIG -t |") or die ("cannot exec nvidia-xconfig : $!"); my $RenderAccel = "False"; my $AllowGLXWithComposite = "False"; my $AddARGBGLXVisuals = "False"; my $Composite = "Disable"; while () { chomp; if ($_ =~ m/RenderAccel/ && $_ =~ m/True/) { $RenderAccel = "True"; } if ($_ =~ m/AllowGLXWithComposite/ && $_ =~ m/True/) { $AllowGLXWithComposite= "True"; } if ($_ =~ m/AddARGBGLXVisuals/ && $_ =~ m/True/) { $AddARGBGLXVisuals = "True"; } if ($_ =~ m/Composite/ && $_ =~ m/Enable/) { $Composite = "Enable"; } } close OUT; print "Xorg.conf for compiz \n"; print " Render Acceleration : $RenderAccel\n"; print " GLX with Composite : $AllowGLXWithComposite\n"; print " ARGB visuals with GLX: $AddARGBGLXVisuals\n"; print " Composite extension : $Composite\n"; if ($RenderAccel ne "True" || $AllowGLXWithComposite ne "True" || $AddARGBGLXVisuals ne "True" || $Composite ne "Enable") { print "\nXorg.conf is not configured to run compiz.\n"; print "The installer will add these configuration\noptions.\n"; } } sub xorg_version_check { my $XORG = '/usr/X11/bin/Xorg'; open (OUT, "$XORG -version 2>&1 |") or die ("cannot exec $XORG -version 2>&1: $!"); my $xorg_version = "undefined"; while () { chomp $_; if ($_ =~ m/X Window System Version/) { $xorg_version = $_; $xorg_version =~ s/X Window System Version //; } } close OUT; print "X Window System Version : "; if ($xorg_version ne "7.2.0" && $version <= 70) { print "too old you need at least 7.2.0 (you have $xorg_version)\n"; } elsif ($xorg_version ne "1.3.0" && $version > 70) { print "too old you need at least 7.2.0 or the newer 1.3.0 (you have $xorg_version)\n"; } else { print "$xorg_version\n"; } } sub jds_check { open (OUT, "/etc/product-info") or die ("cannot open /etc/product-info: $!"); my $jds_release = 0; my $jds_build_num = 0; my $jds_build_type = 0; while () { chomp $_; if ($_ =~ m/release=/) { $jds_release = $_; $jds_release =~ s/release=//; } if ($_ =~ m/build=/) { $jds_build_num = $_; $jds_build_num =~ s/build=//; } if ($_ =~ m/buildType=/) { $jds_build_type = $_; $jds_build_type =~ s/buildType=//; } } close OUT; print "JDS version : $jds_release b$jds_build_num $jds_build_type\n"; if ($jds_build_num < 75) { print "\n your JDS version is too old\n"; print "Please install a more recent version of JDS to run Compiz fully.\n"; print "See http://www.opensolaris.org/os/project/jds/ for installation details\n"; } } ################## main ############################# print "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n"; print "= Compiz on Solaris checklist script =\n"; print "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n"; print "this script run sanity checks to evaluate\n"; print "if compiz is likely to run efficiently on\n"; print "your system\n\n"; os_check (); print "=-=-=-=-=-= Video Card checks =-=-=-=-=-=\n"; print "supported card type : "; if (card_check ()) { print "$card_type\n"; } else { print "none\n"; print "no supported card detected. Compiz not likely to work on this system\n"; exit (1); } if (($card_type eq "i915") && ($version < 70)) { print "\nERROR : intel drivers supporting compiz were integrated in build 70\n"; print "the version of solaris detected ($version) is too old\n"; exit (1); } print "3D drivers loaded : "; if (drivers_check ()) { print "yes\n"; } else { print "no\n"; print "no 3D drivers detected.\n Compiz will not run on this system as is.\n"; if ($card_type eq "nvidia") { print "\nNvidia drivers need to be installed to run Compiz. \nCheck http://www.nvidia.com/object/unix.html\n\n"; } elsif ($card_type eq "i915") { print "Opensolaris build 70 is required for intel video cards\n"; } elsif ($card_type eq "radeon") { print "ERROR : You need to install the radeon DRI drivers.\nCheck http://opensolaris.org/os/project/dri/files/\n\n"; exit (1); } } print "=-=-=-=-= Software stack Checks =-=-=-=-=\n"; xorg_version_check (); jds_check (); print "=-=-= X Server configuration checks =-=-=\n"; if ($card_type eq "radeon") { ati_xorg_conf_check (); } else { #nvidia_xorg_conf_check is also used for intel as nvidia-xconfig is just used as #a parser here. nvidia_xorg_conf_check (); } print "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n"; print "Compiz should be able to run on this system\n";