Thursday, January 29, 2009

gnome-mplayer 0.9.4 will work with the *BSDs

I've had an open issue with gnome-mplayer not working on the BSDs for awhile now. It always seemed to be a locking error with the code and the problem didn't happen on any of my machines. After trying to have people help me debug it, it kept coming back to the same issue, the second call to g_mutex_lock didn't block, it would just go on thru. So I decided to bite the bullet and install FreeBSD 7 on a VM. I was able to duplicate the issue quite easily. So the next step was to write a test program that simulated my code. I did that and found that the test program behaved the same way that gnome-mplayer did in Linux and BSD. So I then opened a bug on GLIB. The comment was that the a GMutex was not guaranteed to be recursive or non-recursive. What this means is that depending on your environment the way it works changes. So I did a little chatting on irc and __tim told me to check out GCond objects. So I tweaked my test program from using a second lock to g_cond_wait(...) and changed the g_mutex_unlocks to g_cond_signal(...) . After that the test program ran correctly on both Linux and FreeBSD.

So after seeing how the test program worked, I made the needed changes to gnome-mplayer. Did some quick tests on Linux and FreeBSD and everything worked properly. The changes were committed to SVN, so expect to see gnome-mplayer available for *BSD in the near future.

Thursday, January 08, 2009

gecko-mediaplayer: Replacing XPCom with NPRuntime

Thought I would give a little post-op on the XPCom to NPRuntime conversion. One of the biggest issues with XPCom was the need for .idl files and the code that went along with them. How an .idl file worked was that you declared a class with a unique id and then the methods and properties of that class. Then you took that .idl file and ran it thru the xpidl compiler and this gave and .xpt and a .h file as the output. The .xpt was used by firefox,mozilla, et al to know what methods the class/plugin provided. The .h file was used by the code to create then entry points for the methods. Anyway, getting all the working on many different distrobutions was a pain. Many of the files needed for this step ended up in different places and usually the .pc files (the pkg-config files that say where everything is) were wrong.

So with libxul 1.9.1 coming out shortly and it changing things with XPCom again I decided to look at npruntime since that is where things need to go anyway. Before doing this I did make sure that I could get the plugin working in XPCom mode with 1.9.1 and I was able to, with some minimal fuss. But still decided to take a look into the conversion since I was sick of the whole idl thing.

I planned that the conversion to npruntime would take me about a month on an off and just getting it work, based on the issues I had to get xpcom working initially (this is the mplayerplug-in 2.0 code, version prior to 2.0 had no javascript support).

I started looking at the npruntime sample that I had I started cutting out code from gecko-mediaplayer first. Took about 2-3 hrs and I had the code running and linking against npruntime but without javascript code. I took, npn_gate,npp_gate and np_entry from the sample to get going. At first I didn't think I should touch those files, but after looking at them and reading the comments in them, it looked like I should edit them as needed. Once I got past this step I was actually able to get the plugin to do something other than stare at me. So I got it doing the basics and then I thought I should get javascript working.

So again I looked at the sample and noticed that the classes in the file, kinda resembled the stuff from XPCom and so I decided to get two methods working, play and pause. I had to declare an id and then define that id to be the same as the methods that I did in the .idl file. I then had to edit HasMethod to say, yeah I could handle that id. After I got HasMethod working I noticed that the code was dropping into Invoke and found that with a couple of lines of code I could take the same call that I used in the XPCom callbacks and apply it here. Once I got that working I started doing the bookwork and created all the methods and the callbacks. The same was pretty much true for the properties as well. And in about 8 hrs of work it was pretty much working.

The conversion turned out to be much less work than I expected it to be and I think the code is actually easier to understand now. Before I really dug into this, I looked at it and just was really dreading the conversion as I expected it to be a huge learning curve, but actually I was able to reuse a lot of what I already knew.

Friday, January 02, 2009

radeonhd drivers on r600

After installing libdrm and radeonhd from the r6xx-r7xx-support branch. And running configure with the --prefix=/usr and --libdir=/usr/lib64 and making a slight modification to the libtool file in drm so that it would install when the libdir was /usr/lib64 I got my system back up and working in the same state as before. Except that with radeonhd I need to enable the composite manager in metacity to make it display better.

After that I reran the gtkperf -c 500 -a test and got this

GtkPerf 0.40 - Starting testing: Fri Jan 2 12:57:55 2009

GtkEntry - time: 0.16
GtkComboBox - time: 4.70
GtkComboBoxEntry - time: 4.07
GtkSpinButton - time: 0.41
GtkProgressBar - time: 0.26
GtkToggleButton - time: 0.70
GtkCheckButton - time: 0.51
GtkRadioButton - time: 0.90
GtkTextView - Add text - time: 8.33
GtkTextView - Scroll - time: 0.98
GtkDrawingArea - Lines - time: 2.02
GtkDrawingArea - Circles - time: 3.88
GtkDrawingArea - Text - time: 2.93
GtkDrawingArea - Pixbufs - time: 0.35
Total time: 30.20

Which is a fun 5 seconds faster than the eariler test... excellent

Radeon r600 drivers

It appears that the r600/r700 AMD/ATI chipsets are finally making some progress on getting hardware acceleration going. So I'll be doing some testing here with them in the future.

As of right now I'm running Fedora 10 and am using the xorg-x11-drv-ati drivers that come with Fedora 10 and they are giving these performance metrics. rpm is xorg-x11-drv-ati-6.9.0-63.fc10.x86_64

gtkperf -c 500 -a

GtkPerf 0.40 - Starting testing: Fri Jan 2 11:46:31 2009

GtkEntry - time: 0.18
GtkComboBox - time: 6.01
GtkComboBoxEntry - time: 5.69
GtkSpinButton - time: 0.43
GtkProgressBar - time: 0.25
GtkToggleButton - time: 0.86
GtkCheckButton - time: 0.61
GtkRadioButton - time: 1.04
GtkTextView - Add text - time: 8.95
GtkTextView - Scroll - time: 1.61
GtkDrawingArea - Lines - time: 1.60
GtkDrawingArea - Circles - time: 4.31
GtkDrawingArea - Text - time: 3.20
GtkDrawingArea - Pixbufs - time: 0.45
Total time: 35.17

glxgears is not hardware accelerated yet.

1071 frames in 5.0 seconds = 214.146 FPS
1075 frames in 5.0 seconds = 214.934 FPS

Also to note that I am running two screens with one desktop across them.

gnome-mplayer and gecko-mediaplayer 0.9.3 released

Updated versions of gnome-mplayer and gecko-mediaplayer have been released. Pretty much several small fixes for a few annoying issues. But would recommend the update.