Tuesday, July 25, 2006

Fixing DRI for the ATI Rage Mobility M3 on Ubuntu

I'm setting up a cheap PC for my Mom with Ubuntu (yeah, it's a Linux distro that even Mom can use) and I noticed it was waaaay snappier than on Ali's Dell Latitude C600 laptop. I thought at first, is it the power management messing up and slowing the CPU down? As I was looking up benchmark programs I had another idea - the difference was that the video was much faster on the tower PC. Now, it's no screamer - it's got an old S3 AGP 1x video card, probably a bargain even when it was new, so I knew something was up.

Searching on Ubuntu video benchmark, I came across the popular glxgears demo. Now I can hear the purists screaming already, it's not a real benchmark - but it's very useful for debugging video card problems. Probably these bunch of semantic whiners are the ones that removed the FPS from the default display in glxgears (at least in Ubuntu 6 "Dapper Drake") and lacking a man page I had to Google to discover glxgears -printfps brings it back. The old PC was doing about 350fps, crap by today's standards but it looked nice and smooth. The laptop was getting 70fps and it was choppy as hell. Uh oh!!

The first thing I found was that "direct render" aka DRI wasn't working; I got something like this:

% glxinfo | grep direct
Xlib: extension "XFree86-DRI" missing on display ":0.0".
direct rendering: No
OpenGL renderer string: Mesa GLX Indirect

According to the ThinkWiki the ATI Mobility Rage 3M is supposed to support DRI. Big problem because the poor old CPU in this laptop is having to do all the work instead of offloading video tasks to the graphics card, which makes Ubuntu almost as slow as Windows XP which was on it previously before it decided to eat it's own registry.

At first I thought I needed to install the fglrx driver package as per the Ubuntu Desktop Guide. I followed the instructions and.... kaboom, X would no longer start. Oops, I should have read things more carefully - the ati driver X was using before was the right one, since this is an R128 card. After running sudo dpkg-reconfigure xserver-xorg and changing back to the ati driver, X came back, but I was back to square one - no direct rendering.

Well I searched some more and finally found the Tao Security Blog which pointed me in the right direction - I use FreeBSD a lot for my server work so his OS of choice didn't throw me off. Indeed, the problem was the paltry 8MB of memory on this card would not support DRI with 24 bpp. Changing it to 16 bpp and voila: Direct rendering enabled in my /var/log/Xorg.0.log

However, all was not well - glxgears still reported the same crap 70 fps.

The next piece of the puzzle came soon though, from the DRI Wiki. Enabling verbose mode via export LIBGL_DEBUG=verbose showed this interesting factoid when running glxgears:

libGL error: dlopen /usr/lib/dri/r128_dri.so failed (/usr/lib/dri/r128_dri.so: undefined symbol: _glapi_get_dispatch)

Well this drove me up the wall for a while. I dumped symbol tables, reinstalled all the libgl, mesa, etc packages in Synaptic, nothing helped. By the way, being able to search for files in Ubuntu packages helped a lot. Then I compared the size and dates of /usr/lib/libGL.so.1.2 and r128_dri.so between the laptop and the PC and lo, libGL.so.1.2 was different sizes and dates...

Some quick investigating told me I was still using the fglrx version of that file. Oops - how was I to know it would overwrite it with an incompatible version? Oh well - removing the xorg-driver-fglrx package finally fixed it.

Hooray! The Latitude is now pushing about 500 fps on glxgears, and the UI is much snappier. Playing anime video no longer stutters and chops if you do... anything else. The CPU is happier too, and Ali's lap should be kept a little cooler.

Trying a new programmer's editor: TextMate

Can't remember if I first saw it on digg or heard it on TWiT or something like that, but I got turned on to a new programmer's (or markupsman's) editor called TextMate a few days ago. I've been a Vim diehard for many years, and I'll still use it a lot, but this has the potential of finally converting me to the land of GUI editing.

I think the tutorial videos are what really convinced me - I plunked down the rego fee after just a few minutes of playing with it, and that's not something I normally do. It's just so damn slick! I find myself paying for programs on OS X, something I never did on Windows (confessions of a pir8). It just seems like it's something I can use over many hours and not want to barf. BBEdit reminded me of a Windows app actually - clunky, monolithic and ugly. I never got the appeal.

The first issue I had with TextMate prompted this exchange on the mail list:

I don't seem to be able to set up TM to handle tabs the same way. Here's the relevant snippet from my vimrc:

" Leave default for printing etc
set tabstop=8
" But use spaces between real tabs
set softtabstop=4
set shiftwidth=4
" Use 'real' tabs (^I) when possible
set noexpandtab


This works great, real tabs (^I) are left alone at the usual 8 spaces, however I like to indent my blocks by 4 at a time. This tells vim to use a real tab if it can, and "pad out" with spaces at the end if the current indent isn't a multiple of 8. Here's what it looks like in vim:


<?php$
$page = new PageController($
'shop.tpl',-$
array($
> 'showAds' => FALSE,$
> 'icon'> => 'shop'),$
'Online Store');$
$page->render();$
?>$


If I configure TM to use soft tabs at 4, then all my previous code looks wrong because it sets hard tabs to 4 as well. If I set it to 8, then my existing code looks fine but I'm not getting my desired softtab indent of 4.

This is a pretty annoying problem for me because I have hundreds of thousands of lines of code formatted this way :( Kind of ironic since I did it this way to maximize compatibility!

I guess what I'm looking for is the ability to set soft tab size independantly of hard tab size - the former to 4, the latter to 8. Is this possible??

(I suppose if there's no other option, I could convert all tabs to 8 spaces in all my files. However I like using tabs because it cuts down on file sizes a tiny bit.)


Unfortunately the only current solution is to convert tabs to 8 spaces in my files, and I wanted a macro or command to do it on a file by file basis as I have the need to edit them rather than touching every file en masse. Haris and Allan gave me these fast responses:


You can record a macro that uses that, or of course you can write a command. Anything you can do in the shell, you can wrap around a TM macro/command.

...

Use the Filter Through Command... (or create a command [1].)

The shell command you want is: expand -t8 with input/output set to document/replace document.


I'll give it a try and see how it goes. I've got a lot of code to maintain now with my AutoShrine Network sites, with a mix of PHP, HTML, SQL and CSS, so it should be a good test case.

PS: BSD style(9) all the way baby!!

Georgia all messed up on OS X

Update: I finally got around to writing a little HTML file in my local Apache sandbox (thanks for bundling that, Apple!) and I was wrong, it was Georgia that was messed up, not Trebuchet. Downloading the new FFIL file from the download page below, wiping the previous TTF file and restarting seems to have solved it. Yay! Now Salon.com and a lot of other sites look right again - it's a pretty popular font these days, and having the spacing all messed up was really annoying. It's also the default font on Blogger so I can go back to using the Compose feature instead of Edit HTML....



A while back I copied all my fonts over from my PC to my PowerBook, and I think I messed up my installation of the Trebuchet font somehow. I've gone through Font Book and removed all the duplicates, and I'm reasonable certain the Trebuchet I've got is the one that shipped with Tiger, but for some reason in Firefox (haven't checked against Safari etc) sites that use Trebuchet have really messed up spacing, for instance anchor tags, italic text, navigating in textareas etc is completely screwed up. I found an archive of Microsoft's old Web Fonts package on the Download Microsoft Core Fonts page so I'm going to try installing that version and see if it fixes the problem.

Well, it installed Trebuchet MS, and I think the "bad" font is just Trebuchet so I'm sure it's getting chosen when CSS specifies it without the MS part, so I'm going to try removing Trebuchet and see what happens. I have a feeling other things that depend on it without the MS part will get messed up *sigh*

Font Book reports the only Trebuchet installed now is the MS Core Font version in my home directory, but it didn't seem to help. I moved these out of the system wide /Library/Fonts:

-rwxr--r-- 1 skye skye 134108 Aug 4 2004 trebuc.ttf*
-rwxr--r-- 1 skye skye 131188 Aug 4 2004 trebucbi.ttf*
-rwxr--r-- 1 skye skye 139288 Aug 4 2004 trebucit.ttf*

Maybe someone can comment on if those file sizes and dates match for your Tiger install. Quite annoying, considering how popular Treb is these days.

Monday, July 24, 2006

New Wifi Skype Phones, Very Cool

Sort of hot on the heels of the Netgear Skype Phone comes an even sexier Wifi based Skype phone from Belkin in sexy black. I want one. IMO it's this shift that the telco's are sweating bullets about and are much more concerned with than Google Video when it comes to Net neutrality. And if they're not, they're dumb (possible)...



July 20 - 15:03 EDT Belkin today announced its new Wi-Fi Phone for Skype,which gives users the increased mobility to place free, unlimited domestic and international calls over the Internet to other Skype users, and low-cost calls to ordinary phones worldwide. The Wi-Fi Phone will ship in North America in August with launches in Asia, Europe, and Australia to follow shortly. The Belkin Wi-Fi Phone connects to many Wi-Fi hotspots around the world, allowing users to easily access their Skype account without turning on the computer. It is perfect to use at home, in the office, or in a free public hotspot. The Wi-Fi Phone works anywhere in the world where there is a free Wi-Fi network, also making it an ideal traveling companion. The Wi-Fi Phone for Skype is priced at US$149.99."

NewerTech drops prices on Apple replacement batteries

This is a great idea - I'll definately get one of these uprated batteries, both my PowerBook G4 batteries have been through so many cycles they can barely make it through one DVD. Before my next big plane ride anyway. Then again, I've got a Video iPod now...
NewerTech drops prices on Apple replacement batteries
July 24 - 12:23 EDT Newer Technology has announced new low prices on its NuPower line of the highest capacity iBook and PowerBook replacement batteries. NewerTech NuPower extreme power batteries are available for every iBook and PowerBook model produced from 1998 to 2006 including: G3 PowerBooks at up to 62% more capacity, G4 PowerBooks at up to 48% more capacity, and iBooks at up to 50% more capacity, notes the company. Pricing for the replacement batteries start at US$99.95.

Welcome to my new blog

I've been hosting my own Serendipity based blog for a while, not really doing much with it though. I'm going to use this new, separate blog for more technical information so I can keep track of it and have a nice searchable interface. The bookmarks menu in my browser is a cluttered mess and I can never find anything...

My other blog (which basically covers our trip to New Zealand) is at sauceonrice.com/blog

This page is powered by Blogger. Isn't yours?