Programmer’s Log Programmers Writing Stuff – Garry Bodsworth

13Jun/090

Cluttered Mind

Finally, I have contributed something back to an open-source project.

The memory leak in Clutter I mentioned in a previous post has been fixed. I submitted the patches last week, and they got pushed onto master in time for Clutter 1.0.

I've been playing around with Clutter a bit more now and it is well inside the GTK+ comfort zone. I am really pleased I can contribute something useful to a project of this size because I am so used to using libraries but not actually fixing them. It's the glory of open-source.

I've been playing around a little with Clutter 1.0 and its master clock based animation and it looks really interesting. Just be careful that some parameters are floats instead of ints now and this caused me to segfault.

Share:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Reddit
  • StumbleUpon
  • LinkedIn
  • Tumblr
  • Twitter
Filed under: Uncategorized No Comments
13Jun/092

Intel 945GM Linux Drivers – The Good Bits

Using the latest Linux drivers for Intel 945GM are really, really good. The best drivers available for Linux displays in my humble opinion, especially since the deficiencies are more hardware related rather than the software.

Using the UXA acceleration you can even composite x-video windows in OpenGL. The 3D performance is impressive for such an old device and as of the end of last week xvmc was working as well with GEM. It uses the latest tech available in Linux display drivers like Kernel Mode Setting and DRI2 (which is a new interface for speaking to the kernel).

The latest drivers are also not only well capable of good compositing, but they are also capable of it without tearing, even with x-video surfaces. The actual rendering itself doesn't tear any more thanks to people like Jesse Barnes who have put great effort into that work.

Since computers like netbooks/nettops are coming with the 945GM chipset, good support for it is essential. This is even better when it is open-source because you can help out with hackery and diagnosis (actually editing the code is very scary, but I tried a bit attempting to backport some changes to 2.7 because master was not stable enough at the time). It was a bit frustrating trying to balance performance, features and stability when deciding which driver version to finally run with, but I can see the driver is almost there with some minor stability work.

So I must say the guys have done really good work and 2.8 looks like it will be a really good release performance/feature-wise. I think I have wedged the hardware a few times, but I suppose the 2.7.99 releases are alpha, and also it is probably down to me hammering the graphics card.

Share:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Reddit
  • StumbleUpon
  • LinkedIn
  • Tumblr
  • Twitter
Filed under: Uncategorized 2 Comments
13Jun/090

Intel 945GM Linux Drivers – UXA and Memory Leaks

One of the things I have been plugging away with at work is getting Intel 945GM graphics drivers working at their best. I was using 2.6 and 2.7 with the new UXA acceleration because it works really well with composite and xvideo.

The problem was there was a memory leak that you could drive a bus through. Because the Linux driver stack is so complex (Mesa, X Driver, X-server, kernel gubbins, the Direct Rendering Manager library) it was proving extremely difficult to find where the memory was going because it was still being used even when the process was closed.

With the code I was writing I found I could get the memory of the computer fully utilised in less than one hundred iterations. Luckily that meant I could write a small test case. The bug hit particularly hard in Moblin which relied on the Intel drivers and Clutter. At least five bugs in Freedesktop Bugzilla seem to report it, plenty in Launchpad, and several in Moblin.

As it turned out Shuang He of Intel diagnosed the root of the problem in the Mesa driver where pixmaps weren't being released properly and has submitted some patches for that. The mesa patches have been applied if you use xorg-edgers on Ubuntu which makes life a lot easier considering I spent four hours building my own fixed Mesa...

Not only this but there was a memory leak in Clutter (which I submitted patches for) which are now in their git master repository.

Now with both of those things fixed compositing windows using Clutter works brilliantly and will work for an extended period of time rather than falling over after a short time. Also if these patches are used on Moblin v2, you should get a better experience.

Share:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Reddit
  • StumbleUpon
  • LinkedIn
  • Tumblr
  • Twitter
Filed under: Uncategorized No Comments
13Jun/090

It’s Aliiiive!

This poor corner of the Internet has been neglected of late, and it is almost time for me to renew my domain. So I have two options - let it die or pull my finger out and actually post some content. Inbetween work and a new baby I find spare time a bit scarce (or non-existent).

But the doors won't be shutting here because at some point the baby has to sleep at some point in the future and that means I get to use my laptop.

Share:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Reddit
  • StumbleUpon
  • LinkedIn
  • Tumblr
  • Twitter
Filed under: Uncategorized No Comments
16May/090

DisplayLink Open Source

Yesterday Displaylink released Linux source code for its USB display adapters. The project is LGPL and available on FreeDesktop. The project itself is called libdlo and is available from this link with the Git repository here. You can see DisplayLink's announcement here.

At the moment it is a low-level library for speaking to the device and is not yet wrapped in a Xorg driver. The code itself supports ASIC devices and only the USB versions (if that means something to you then you have probably worked for DisplayLink at some point).

The code itself is impressively documented, and means people should be able to get something up and running pretty fast. I'm sure some interesting and exciting projects will come out of this.

Well done to DisplayLink on doing this - this is going to be a really good thing for getting content onto displays. USB is a really good solution - imagine daisy-chaining lots of displays controlled by a single computer.

Share:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Reddit
  • StumbleUpon
  • LinkedIn
  • Tumblr
  • Twitter
13Apr/090

XBMC MythTV Bridge

It seems I spoke to soon, I stumbled across MythBox just after posting about MythTV. It seems it will let me schedule through XBMC my MythTV recordings and let me watch live TV.

The screenshots here look really good. And it seems then I will be able to leave behind MythFrontend. I'm not too sure where the Subversion repository lives, but you get all the python files in the tar.gz, which makes it look pretty hackable.

Share:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Reddit
  • StumbleUpon
  • LinkedIn
  • Tumblr
  • Twitter
13Apr/090

nVidia + Linux + ACPI = Borked

It's a simple equation and has cost me a day of trying to get ACPI suspend/hibernate working on Linux. It took me long enough to realise it was the nVidia driver causing the issue.

Whenever I tried suspend or hibernate I would get a black screen with a flashing cursor in the top left. After working out it was the nVidia driver I tried all the remedies I could find on the Internet by other people with the same bug. What I discovered was this problem has been around for going on at least three years and no solution is being worked on.

The obvious articles are here, here, here, here, and here.

All solutions provide slightly different but the same solution, you need to set NvAGP in your xorg.conf to either 0 or 1 and optionally use agp=off for your kernel. I tried various concoctions and none of them worked.

I think I worked out what the problem is though. If your motherboard chipset is not nVidia (I think they call them nForce) then NvAGP will never work because mine always drops back to agpgart. This must be why most of the success is seen on laptops where the IGP must be using nVidia chipsets. My motherboard has a VIA chipset (old and crusty I know) with a GeForce 8500GT hence my complete and utter lack of success.

Like I said this problem has been around for quite a while and the chipset problem could be why the only responses I have read from nVidia is that they are unable to reproduce it. So for me it will be a new sensible graphics card with hopefully fairly open drivers.

Share:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Reddit
  • StumbleUpon
  • LinkedIn
  • Tumblr
  • Twitter
Tagged as: , No Comments
13Apr/090

How To Ruin A Long Weekend

One of the things I was looking forward to this long weekend was watching DVDs. So I come back home on Thursday plonk my Tales Of The Black Freighter into my Windows Media Center 2005 box and I get jerky video and crackly sound. So I then spend a day trying to diagnose the problem.... Starting with making sure my Windows install is up to date with patches, new nVidia drivers (which managed to successfully break everything so I tried multiple versions), and new versions of the codecs I use. The best part was in Media Player I got no sound and fine video, but on Media Center I got jerky video and crackly sound. All from the same codec.

So, I decided it was time try MythTV properly, so I nuked the drive with a Xubuntu install which crashed halfway through showing me the true nature of my problem when there was no turning back - the DVD drive was dying. So I decided to proceed with my Linux install because I was on my way and liked the philosophy behind MythTV's design.

Now three days later I have a mostly working system, but I have had a number of casualties. First my DVD drive, then I blew up my monitor which I had to drive all the way to the office to collect, and now my graphics card is living on borrowed time (I will post about that in a bit). None of it is MythTV's or Ubuntu's fault, but I should of known when the weekend starts badly it can only get worse. I even got so desperate I considered installing Vista, but I am now really close to getting the whole system up and running.

As for MythTV itself - the features it provides were exactly what I wanted, DVD, TV, CD music, random downloaded videos. But it has proved to be such a pain, some of it Xubuntu's fault, some of it is MythTV's, and my greatest share of pain has come from nVidia.

The backend design of MythTV is a real good idea but it is painful to get up and running - even with the nicely supplied packages. Especially if you decide to change your IP address or XMLTV stops working briefly. The setup user interface is designed to be used from a big screen, but is extremely unintuitive and counter to any GUI guidelines you have ever seen. It took about three attempts to get the hook up between XMLTV and my DVB-T card correct and in the database.

The frontend is okay, but is at least five years behind anything you have seen for media centers (they have a new version they are working on but there is no planned release yet). You have to fiddle around so you can successfully eject DVDs, get your remote set up (involving text configuration files) which works okay but not intuitively (the stop button doesn't do what I expect on a Windows MCE remote), watch DVDs (enable the correct repositories), and getting your Samba mounts working (why on earth aren't Samba shares an optional directory rather than having to mess around with fstab?)

I did try X-Box Media Center as a front-end for the MythTV backend. It is much nicer to look at, provides some real good features (with a great iPlayer plug-in), worked with the MCE remote flawlessly and sensibly, and is only lacking the ability to schedule recordings. If that was possible I would use that as a frontend, because it seems much more stable than the MythTV UI. I did also try Boxee, the commercial version of XBMC, but although it looked quite nice I found it was not as good as XBMC it is derived from and its MythTV frontend refused to work as it is broken.

My thoughts this weekend have gone from MCE2005 to MythTV to XBMC to Boxee to XBMC to MythTV.... That also discounts the amount of time I sat down considering how I would write my own.

My main work now is to get hibernate and suspend working, but that requires a post all of its own. At least at that point I will be functionally equivalent to my Windows MCE2005 install that I nuked.

Share:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Reddit
  • StumbleUpon
  • LinkedIn
  • Tumblr
  • Twitter
22Mar/091

Watchmen

Since I am so behind the times I finally saw Watchmen the movie today.... I didn't know what to expect because it is a masterpiece of comic storytelling, but there are plenty of reviews out there to tell you whether they liked it or not.

What got me was a small part in the film when Rorschach goes into the bathroom to exact punishment on Big Figure and you can only see what the swinging door lets you. It was a masterful piece of storytelling which lets your imagination conjure up all kinds of terrible deaths. If noone has used this technique of the swinging door in films before then I applaud Zack Snyder for a piece of genuine cinema brilliance.

Share:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Reddit
  • StumbleUpon
  • LinkedIn
  • Tumblr
  • Twitter
Tagged as: 1 Comment
22Mar/092

Python Programming Dojo – Cambridge

Yesterday I ran the Python Programming Dojo in Cambridge. It was my first time running such a public speaking event. We had four people in attendance which made it a bit easier on me after four or five last minute drop-outs.

Basically, it was to cover getting started in Python development from first concepts through to more advanced ones. I can hardly believe I talked more or less continually for six hours(!) I had prepared cue cards so I didn't forget any subjects I wanted to cover and had smushed together a load of examples to go with each subject.

One of the most bizarre things was I didn't get onto the fact Python had classes until lunchtime at 1pm.... It was hard to try and cover the basics because everything relied on something else, so I was dynamically juggling the order of the subjects.

The best bit was the interaction where people were coding whilst I was talking and the discussion points and questions came out of that.

I found it really hard to explain list comprehensions because I kind of instinctively knew them, but I had managed up until now to never need to explain them.

The benefits of doing this class were many for me. First, up I had programmed in Python for a while but I just did it and didn't really think about why and how much I had used. Organising those thoughts was invaluable. Also, had to do speaking at the front of the room and I think I did okay apart from waving my hands too much and using the word "mad" too often in the description of Python features... The other benefit was I learnt some things as well.

The main Python feature I learnt was the flyweight pattern feature of Python classes. Basically if you define a variable as part of the class you maximise reuse of that object. If you defined a variable using self, it will be added to the class dictionary. We checked this by writing code which is the best way to learn.

I don't know if I will end up running one again or if it is a one-off, but I will try to update my examples and subjects to reflect what I discovered throughout the day (if I actually transfer them to digital format rather than hand-written cards I'll post it on here).

Finally, I'd like to thank Red Gate Software for supplying refreshments and somewhere to host it, Mark Dalgarno for organising it, and Clive Tong of Red Gate for making sure we could get in (and not forgetting the attendees).

Share:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Reddit
  • StumbleUpon
  • LinkedIn
  • Tumblr
  • Twitter
Filed under: Uncategorized 2 Comments