G5: Nouveau & 3D Acceleration


UPDATE 1: Updated glxgears output after running it not synced to vsync

As many of our readers may already be aware, both 2D and now 3D acceleration are working with the nouveau driver on PPC!  However, with a couple of hopefully temporary caveats that should hopefully disappear over time.  The caveats include the following:

1. You can only try/test this out by upgrading your system to Stretch (the next stable release of Debian still in development/testing) or Sid ( forever unstable). Eventually Stretch will become the next stable release (sometime early 2017) and by then let us hope that whatever version of mesa and its related libraries  included in the release still has working 3D and 2D acceleration with nouveau.

You could also try to compile the latest versions yourself using the instructions here, but keep in mind this route is difficult even for more experienced Linux users.

2. As exciting as this news is, the current performance is still lacking, but with regards to G5 machines, this should also be improved with the move to 64 KB page sizes in the future among many other things relevant to just nouveau and PPC development in general. Sadly, still no update on the 64 KB page size mapping bug yet either, but I am trying to keep in touch with the developers.

As first reported, by again, Peter Saisanas, in a comment from my last post, it appears the fix was included in Mesa's 11.0.3 release back in November.  He has also posted about his testing on the Debian PPC mailing list here.  One of the included fixes that may have resolved the remaining issues with 3D acceleration with nouveau on PPC in that release by Mesa developer Ilia Mirkin was "nv30: always go through translate module on big-endian."  That is the current theory anyways as looking through the rest of the fixes over that same release as well other recent releases, this one appears to be the most relevant.

I figured I would conduct my own testing as well by first upgrading to Stretch from Jessie (8.3) to Stretch.  I skipped backing up my current install as nothing on it is all that crucial. Most of my crucial files and configurations live on my G4 QS at the current time.  Since Stretch or Sid can be (is) unstable at times, you may not want to use it on a production system.  Choose your set up wisely.  I plan to eventually either partition my current SSD to host both Jessie and Stretch on separate dedicated partitions or use a drive in each available drive bay to host each release of Debian (one for testing and one for stable) so I can always fall back to one or the other in case something breaks.

Speaking of instability, there are issues when doing upgrades to or fresh installs of Stretch as the current kernel included with the release is broken on PPC. So you if you want to test this out, I would highly recommend first instaling Jessie and then downloading and installing one of the pre-built kernels available from Peter's Google Drive before doing the upgrade. I opted to use his latest kernel (at the time of this writing) 4.5.0-rc2. Just download the kernel-image deb and install it using the following command:

sudo dpkg -i  linux-image-4.5.0-rc2-powerpc64_2_powerpc.deb

With that out of the way, you will want to update your /etc/yaboot.conf file to either contain a new entry for the newly installed kernel or replace your existing one.

Here is an excerpt from my yaboot.conf file with the new kernel configuration:
image=/vmlinux-4.5.0-rc2-powerpc64
    label=Linux
    read-only
    initrd=/initrd.img-4.5.0-rc2-powerpc64


Save your changes and run the following:
sudo ybin -v

Next, go ahead reboot to the new kernel using whatever label you assigned to it in your yaboot configuration.
 
The kernels he has available work with a wide range of G5 towers and nVidia cards but if you are curious to see what has worked for others up to this point, see this post on the Debian PPC mailing list.

Once that is out of the way, upgrading to Stretch was simple enough as all it requires is editing your /etc/apt/sources.list file by replacing all occurrences of the word Jessie with Stretch.  If you are using vim for your text editing tool you can use the following trick once you have the file opened for editing:

:%s/jessie/stretch/

The %s basically means every occurrence of the string jessie with the string stretch.  Easy enough.  Save your changes run apt-get update and apt-get dist-upgrade per usual. This will update the list of packages from the stretch repositories and start the upgrade to testing.

Once the upgrade is complete, I would recommend rebooting one more time for good measure.  Once logged in, make sure mesa-utils or hardinfo (if you prefer a GUI to view what currently active renderer) is installed. Here is the output from my system:

br0c0l1@TheMaster:~$ glxinfo | grep -i renderer
    GLX_MESA_multithread_makecurrent, GLX_MESA_query_renderer,
    GLX_MESA_multithread_makecurrent, GLX_MESA_query_renderer,
Extended renderer info (GLX_MESA_query_renderer):
OpenGL renderer string: Gallium 0.4 on NV47

As you can see we are using version 0.4 of Gallium on NV47 (my G5 machine's Quadro 4500FX nVidia card) to provide graphics rendering.

Here is the output when running glxgears:

br0c0l1@TheMaster:~$ vblank_mode=0 glxgears
ATTENTION: default value of option vblank_mode overridden by environment.
1840 frames in 5.0 seconds = 367.913 FPS
1861 frames in 5.0 seconds = 372.069 FPS
1828 frames in 5.0 seconds = 365.374 FPS
1823 frames in 5.0 seconds = 364.437 FPS

So again, not spectacular in terms of performance, but it is definitely a worthy start.  It is comforting and exciting to know we have made it this far. One thing I think I should make clear is that having 3D acceleration does not improve video playback performance as that is already optimized to its fullest with 2D acceleration.  3D acceleration helps considerably though if you are into gaming and OpenGL/WebGl projects.

I cannot thank Peter Saisanas enough for the work he puts into nouvea and PPC and kudos to the nouveau developers for not leaving us PPC users in the dust! 

I encourage you to try this out and report your findings with either 3D acceleration on nouvea and/or Peter's pre-built G5 kernels either here in the comments or on the Debian PowerPC mailing list.

And finally, as I always say, let the rest of us due our due diligence and report bugs!

Parts exchange brainstorm


After getting lots of interest from an earlier post about starting a parts exchange here - it is now time to start figuring out how to set it up best for everyone that desires to potentially use it one day.

Tell me what you would like it to both include and exclude, and any other details you can think of to create an exchange system that is efficient and beneficial to all.

This is for you guys...  all the PowerPC users that need help getting certain parts, whether the reason be geography or lack of money.  Lets make it the best it can be.

One thing I can tell you for sure is that you won't have to post personal details like address or full name to anyone but the person you're sending or receiving parts with.

Now lets fill the comments up with great ideas!

A summary of players


I'm a big advocate of Linux and BSD for security, but when it comes to offline things, like playing video files and DVD's, I am very pro-Mac OS PowerPC.  To me, there is no better OS to play video on than Mac OS X, and especially on Tiger (10.4) and Leopard (10.5), which as I'm sure you all know were the last two Apple OS to support PowerPC.

All my life I have been a big user and collector of video since before I ever even used computers, but from 2002 on I have been willingly engulfed in digital video on Mac OS X.  In all that time I have learned a thing or three about all the playback applications available, and the strengths and weaknesses of each.  These are my findings.


VLC

VLC is the all-round most stable and capable player ever made available on any OS in my opinion.  It's no MPlayer or CorePlayer in terms of CPU efficiency, but is still a lightweight compared to true resource hogs like Quicktime.  I recommend you use 0.9.10 on Tiger, and 1.1.12 on Leopard.  For Leopard users, the 2.xx versions are a bit more resource needy, and only worth running if you have a dual CPU system; because 2+ is more SMP optimized, but that is really the only true advantage.  So Leopard single CPU users should stick to 1.1.12.

Strengths:
  • stable
  • most codec capable player
  • most tweak-able player (via its vast extended preferences)
  • the best audio and subtitle sync repair of any player

Weaknesses:
  • not as resource efficient as others
  • the expanded preferences can really overwhelm some
  • the "Media library" below the playlist is sketchy at best


MPlayer

MPlayer is much more a lean and raw player compared to VLC and others, but it's quite resource efficient, and scrubs through video in a truly beastly manner.  There are various versions by various developers, but there are three versions that are very worth the HD space they use.  Those three are comprised of two versions of MPlayer OSX (one optimized for G3 and one for G4), and the rev14 version of MPlayer OSX Extended (Tiger users need rev11), which is by far the best thrid-party real media player.

I have some very old real player formatted video I downloaded years ago, but would never install Real Player on any system of mine, nor should you, as it is spyware VLC can play real media also, but it plays very jerky, and with lots of resources available.  The extended version, while newer, is less efficient and has some interlacing issues, so I use it strictly for real media, and a combo of MPlayer OSX and VLC for everything else non-HD.  Bottom line...  use extended for real media only, and the regular OSX version for all your other MPlayer needs.

Strengths:
  • efficient all-round
  • scrubs/scans through video better and more aggressively than any other player
  • frame dropping feature to help it smoothly play video that is slightly beyond your systems capability
  • very effective disk cache option which will offer smooth playback from very slow media, like old CD-R
  • very simple and straight forward preferences (if that's what you prefer)

Weaknesses:
  • struggles with some audio and some x264
  • not anywhere near as codec capable as VLC
  • limited preferences/settings
  • only the "Extended" version is really usable on G5's


CorePlayer

Even though this cannot be bought any longer, it's worth covering for those that do have it, and to help others gain more perspective with it.

CorePlayer OSX is the absolute champion of resource efficiency, and is a master of x264 codec playback, but to be honest, that is where its good qualities end.  The GUI is very sloppily put together, and just generally awkward to use, but not so bad that it's unusable; just clunky and oddball.  I guess this is what happens when you port cellphone software to the desktop, but forget to make it more desktop functional.  It also has little support for AC3 audio, or really any video wrapper that isn't AVI, MP4, M4V or MKV.

Strengths:
  • out of this world efficiency
  • a master at x264 playback

Weaknesses:
  • ugly as hell
  • clunky and awkward to use
  • limited codec support
  • most of the preferences do nothing in terms of producing noticeable results 
  • lack of proper subtitle support


Quicktime

QT is the undisputed champion of bloat when it comes to playback apps.  There is no other application that consumes more of your CPU than this one.

The only use I have for it is the editing feature in the pro version, which is actually quite simple and elegant, but still uses way too many resources.

Bottom line...  don't use it to play video.

Strengths:
  • simple and elegant video editor (with $30 pro version)

Weaknesses:
  • bloated garbage for playback
  • next to no codec support without third-party codecs installed


Apple DVD Player

Even though you can play DVD's in VLC, this application is more efficient at it, and makes the experience much more like using a real DVD player on a TV.  If you run Leopard, and have a CPU under 1GHz, then you should disable deinterlacing (in the "View" menu) for best results.

Since I cannot really find any weaknesses with this, I won't bother doing a strengths/weaknesses for it.  It plays DVD's really well and efficiently, and that's all you really need to know.


Wrapper Roundup

It makes sense to end this with a list of video wrappers, and which players are best for each.  Since this is all based on personal experience, I welcome any findings the readers have also.

Here is the list:

.AVI  -  VLC or MPlayer OSX
.MP4  -  VLC or CorePlayer
.M4V  -  VLC or CorePlayer
.MKV  -  VLC or CorePlayer
.MOV  -  VLC or CorePlayer
.MPG  -  VLC or MPlayer OSX
.WMV  -  MPlayer OSX
.ASF  -  MPlayer OSX or VLC
.FLV  -  VLC
.RM  -  MPlayer Extended
.RAM  -  MPlayer Extended

When it comes to HD, there really is no choice but CorePlayer without a G4 1.2GHz+.  A faster single G4 or dual 1GHz+ will play most 720p in VLC.  You may struggle with any 60fps content though.  As for 1080 without CorePlayer...  thats more for later duals and quad G5's.  On my single 1.8GHz G4 7448 I need CorePlayer to play 1080 smoothly.  60fps 720p h.264 is my limit without CorePlayer.  G4 1.2-1.5GHz would be limited to 24-30fps 720p.

Anyway...  that's about it for this summary.  If you require any additional info, please ask in comments, or add any of your experiences with the apps and codecs above, or others not mentioned.

Adblocking with DNS


Ads on websites can be both annoying and resource intensive for older PowerPC systems. Waiting for the browser to load all the ads just so you can use the site can be trying on your patience. This is where adblocking becomes a great help.

Dan has a really good post comparing different types of adblocking tools for TenFourFox. I would like to suggest another method you can use that will take the work of adblocking off of your browser and machine by using DNS. If you have a spare machine (I will be using my Mac mini G4 running Jessie) then setting this up will be pretty simple.

First we will install bind9 then setup DNS caching and forwarding. Then we will setup the adblock portion. Finally we will set up a simple webserver to present a transparent pixel instead of the ads.


Setting up DNS caching

First we will need to install bind9 if you have not already. This is as simple as running the command as root, apt-get install bind9. Next you will want to edit the file /etc/bind/named.conf.options. Below is my file.

acl goodclients {
    192.168.0.0/24;
    localhost;
    localnets;
};

options {
    directory "/var/cache/bind";

        recursion yes;
        allow-query { goodclients; };

    // If there is a firewall between you and nameservers you want
    // to talk to, you may need to fix the firewall to allow multiple
    // ports to talk.  See http://www.kb.cert.org/vuls/id/800113

    // If your ISP provided one or more IP addresses for stable
    // nameservers, you probably want to use them as forwarders. 
    // Uncomment the following block, and insert the addresses replacing
    // the all-0's placeholder.

     forwarders {
         208.67.222.222;
        208.67.220.220;
     };

    //========================================================================
    // If BIND logs error messages about the root key being expired,
    // you will need to update your keys.  See https://www.isc.org/bind-keys
    //========================================================================
    dnssec-validation auto;

    auth-nxdomain no;    # conform to RFC1035
    listen-on-v6 { any; };
};


The acl section defines who is allowed to ask queries to the DNS server. This stops unwanted people from trying to use your server. It is better suited if this was server was accessible from the internet, but it is good practice to do.

Next we want to turn on recursion and define who is allowed to query. DNS recursion is when the DNS server queries other servers on behalf of the client and sends the reply back.

Then we will define the forwarders to use. Some people refer google DNS, but I like using OpenDNS. This should be all you need to set up caching. A great tutorial on DNS caching the can be found at Digitial Ocean.


Adblocking

Now you need to get a blacklist file, which can be found here. Select the bind8 option and download the file. The open it and edit the zone lines to look as follows.

zone “101com.com” IN { type master; notify no; file “/etc/bind/null.zone.file”; };

If you are handy with vim then doing this should be really quick and easy.

The next thing is to copy the file to the /etc/bind directory and add this line to the /etc/bind/named.conf.local file.

include “/etc/bind/blacklist”;

Now it is time to create the /etc/bind/null.zone.file. This will redirect the ad urls to the simple webserver we will setup shortly. You want to set the A records to point the web server. In my case the mini serves as both. Here is my file.

$TTL 86400 ; one day

@ IN SOA ads.attlocal.net. hostmaster.attlocal.net. (
2002061000 ; serial number YYMMDDNN
28800 ; refresh 8 hours
7200 ; retry 2 hours
864000 ; expire 10 days
86400 ) ; min ttl 1 day
NS debian-minippc.attlocal.net

A web server

@ IN A web server
* IN A web server


Now you want to restart bind so that it takes all these changes you made. The first command to run is named-confcheck. This does a sanity check on the configs. If all is good then you should return to the prompt. Then to restart the command is systemctl bind9 restart and to check status of the service systemctl status bind9.

This finishes all that you need to set up the DNS server.


Pixelserver

Like I said in the beginning we want to set up a simple server to present a transparent image to replace the ads. If not then you page will full of page not found errors.

Pixelserver is a simple pearl script that can be found here. Download the file and edit it so that the listening ip address is your server. Then you change the permissions and run the server.
chmod u+x pixelserver.pl
./pixelserver.pl

Now point your machine to get DNS requests to your  server and test. Here is an example of a successful query.
herminio-hernandezs-power-mac-g4:~ herminio$ nslookup foo.doubleclick.com
Server: dns server
Address: dns server#53

Name: foo.doubleclick.com
Address: pixelserver

You should see the domain name point to your web server. Now browse the web ad free!

UPDATE I:

If you want to start the pixelserver.pl script on boot. Then you going to have it managed by systemd. This is not too hard to do.

First I put a copy of the script in the /usr/bin directory. Then entered the /etc/systemd/system directory and create a service file ( I called mine pixelserv.service). Here is what it looks like.

[Unit]
Description=pixelsirv.pl

[Service]
ExecStart=/usr/bin/pixelserver.pl

[Install]
WantedBy=multi-user.target

Then run systemctl enable pixelserv.service after run systemctl restart pixelserv.service. Now check to see if systemd is running the service.
root@debian-minippc:/etc/systemd/system# systemctl status pixelserv.service
● pixelserv.service - pixelsirv.pl
Loaded: loaded (/etc/systemd/system/pixelserv.service; enabled)
Active: active (running) since Thu 2015-11-19 00:37:26 CST; 7s ago
Main PID: 5345 (pixelserver.pl)
CGroup: /system.slice/pixelserv.service
└─5345 /usr/bin/perl -Tw /usr/bin/pixelserver.pl

UPDATE II:

If you do not turn off dnssec-validation in the /etc/bind/named.conf.options file then forwarding will break. Change the setting to what you see below then restart bind.

dnssec-validation no;

UPDATE III:

If anyone is stuck with provider wifi router that will not let you modify the DNS option in DHCP then you can add this line to the /etc/dhcp/dhclient.conf file.
prepend domain-name-servers server ip address
Then run the command dhclent <interface> to restart dhcp and you should be good.

PowerPC parts exchange?


I have had this idea for a while, but it somehow always went to the back of my mind.  What would you guys think of me adding a parts exchange area to this blog?  I'm asking my fellow authors as well as all the readers.

It would simply be an area on this blog where fellow PowerPC users can give and receive any spare parts they have, especially if they don't really have a use for it themselves.  If we do this, I would like to start it as a pure parts exchange, where the only real money involved is for shipping.  If it goes well then we could even add the ability for people to use it as a sort of PowerPC-specific Craigslist of sorts, but parts are MUCH cheaper to ship compared to systems.

I'm not talking about you all sending spare parts to one place, then making them available to others, as that would be horribly inefficient, but rather a page here to put people that have and/or need parts in touch with each other.  You would then work out your details with each other in private, in your preferred method of communication.  A central parts portal, if you will, for our always shrinking little PowerPC community.

So tell me what you guys think.  I don't want to add this here if no one will really use it.

Since none of the Apple PowerPC parts can be bought new any longer, I think an exchange could really fill a parts void for many.

New SATA PCI card findings


This will be brief...  as there really isn't much to tell, but a more recent finding has changed everything for me.

About three or four years ago, I had come to the conclusion that booting from SATA PCI cards was only about 99.9% stable.  This is because every so often things would just lock up system-wide, and I would be forced to do a hard boot.  Not a good thing when you're smack dab in the middle of important work.  After tolerating it for a couple years...  I finally decided that I would stick to SATA card attached drives for storage only, and boot from IDE/PATA drives instead.

About four or five months ago, I realized that during all those system lockups I had drive sleep enabled.  So I decided to try it for a while without any type of sleep enabled, other than display sleep, which has no effect whatsoever on hard drives.  I never use system sleep, as my systems are always 24/7 on, but I normally use drive and display sleep on every OS.

So I have now been running a WD Caviar Black 2TB as my boot drive for about five months, with drive sleep disabled on every OS, and have never once had an issue.  I have now found 100% reliability with SATA card booting!

The WD Black is the perfect drive to use in a system where drives don't sleep, because it's built for higher endurance than most drives, and has more performance to go along with that.

I had already tried every version of firmware for my FirmTek SATA cards, and nothing solved it, but disabling drive sleep did.  The only real difference now in my computing habbits is that I need to unmount all the externals I'm not using, since they are typically backup drives, and don't go to sleep any longer. 

Keep in mind that these finding are all based off use in two Sawtooth, along with one Gigabit Ethernet system.

Anyway, I had told some readers in the past via comments that SATA card booting wasn't 100% stable, and I just wanted to share how I did find that sweet spot on my hardware.

For the record...  this is all with the FirmTek SeriTek/1S2 PCI controller; I own three.  The Sonnet 2-port PCI is the same card, as they are made for Sonnet by FirmTek.  By the way...  the best firware to use in G4 towers is 5.1.3.  You still need to disable drive sleep, but the newer firmware (5.3.x) is meant for early G5's with standard PCI, and most of these cards ship with the newer version.  So if you have a G4, and you have the 5.3.x firmware, you need to downgrade to 5.1.3 for best results.  You can download the 5.1.3 firmware here.

Please share any SATA PCI controller stories and findings you may have in comments.