Highlights of WebKit GTK hackfest.

Below are highlights of items that we worked on during the hackfest. Please note that this is not the complete list, these are the just the ones which I remember as of now!

  • Martin and Gustavo worked on setting up JHbuild for testing. With the JHBuild, one can get test pass percentage as close to 100.
  • Carlos presented the progress of WebKit2 GTK API and his future goals.
  • Bob published his initial draft of WebKit GTK cookbook.
  • Xan, John, Claudio, Juan and Bastien discussed about the new design of epiphany browser and its integration with Gnome OS.
  • Andy worked on adding support for block-scoped let and const to JavaScriptCore.
  • Philippe worked on full-screen fixes for <video> tag.
  • Dan worked on clean-up of libsoup code in WebKit-GTK and other network issues.
  • Bastien wrote a replacement plugin for flash videos.
  • Mario and Joanmarie Diggs worked on the accessibility support in WebKit2-GTK+ and Ad Blocker extension for epiphany.
  • Alex, Joone, Martin and myself worked on Accelerated Compositing code. Joone concentrated on clutter implementation and came up with the initial patch for the same. Alex worked on cairo based texture mapper implementation and he has a patch. Martin and myself have been working on OpenGL based texture mapper and we hope to have a working prototype soon. I plan to dedicate another blog post detailing the texture mapper based accelerated compositing design, hopefully I will have it soon!
Image
 
Juan has a post summarizing the progress of WebKit-GTK hackfest in “WebKitGTK+ hackfest wrap up“. Mario and myself have been taking few pictures during the hackfest and they can be found in Mario’s flickr stream and my flickr stream.
 
Cheers!
Advertisement

WebKit GTK hackfest – An experience! #firsttimeinlife

As mentioned in the other post, last week I was in La Coruna, Spain, and attended WebKit GTK hackfest 2011 organized by Igalia. It was the first hackfest which I attended and my first visit to an Europian city. My main aim was to contribute to WebKit and share/gain knowledge. Apart for this goal, I also got a chance to meet many of the open source hackers.

Officially hackfest kicked off on 30th of Nov. Each of the hackers expressed their field of interest and the areas they would like to hack during the fest and we came up with the agenda for the whole hackfest. Thats the beauty of the open source software, you know, you got the freedom to choose your interest. I decided to work/learn accelerated compositing stuffs, webkit2 api review, v8 v/s jsc discussion and optimizing WebKit for mobile devices. Xan somehow managed to capture everyones interests on a big black board. Next 5 days, we hacked on these areas.

Image

I guess we were close to 20 in number. There were hackers from all around the world – US, UK, Brazil, Korea, Spain, Finland and India (my country), working for many different companies, such as Igalia, Collabara, Redhat, Gnome and Motorola Mobility (my employer). Apart from hacking together, we also shared cultural differences, played football, visited La Coruna city and had beer together. Overall, it was a great hackfest!

I would to thank Igalia and Collabara for organizing such a wonderful hackfest. And of-course, I am very thankful to my employer (Motorola Mobility) for sponsering my trip to the hackfest. I am planning to write few more blog posts on the progress we made during hackfest, wish me luck!

Cheer!

Hola España, Hola WebKitGTK+ hackfest!

Unknown place, unknown language, unknown people! Sitting at the corner of a bench in an airport, all what I see is small, neat and clean airport with few people walking here and there. Airport flight information board displays few of flights destined to Madrid, Barcelona and Lisboa. Stranglers passing-by me gives me a strange look and a gentle smile at the same time. And here am I, sitting at La Coruna airport, a new place, new city and hoping for lots of new excitements.

Journey started yesterday night from Bangalore airport. After attending my ex-roomies enagagement during the day, I took a BIAL bus to Bengaluru International Airport, and reached airport quite early at 11.30pm. World is small, met and had a good conversation with one of my ex-manager. My flight started at 4.25a.m, slept all the way in the flight and landed at Doha airport, Qatar at 6.30am. Connecting flight from Doha was at 7.30am, and reached Madrid at 1.00pm (Madrid time). I kind of enjoyed my journey in Qatar airways, probably it is one of the best airlines I had experienced. It was just an hour of journey from Madrid to La Coruna and here I am, in the beautiful city of La Coruna!

And did I tell you that I am here to attend WebKit-GTK hackfest? Yes, this is the first time I am attending WebKit-GTK hackfest and super excited to meet and hack with few of Igalians, Collabara and other hackers. I had interacted with many of Igalian’s earlier via emails and irc, but this is the first opportunity to meet them all. Also, this is the first time Motorola Mobility is participating in WebKit-GTK hackfest, hoping to contribute few more patches WebKit-GTK.

Stay tuned for updates from WebKit-GTK hackfest!

WebKit-GTK : JSC v/s V8 performance on ARM

As I mentioned in the other post [1], recently I managed to get WebKit-GTK compiled with V8. My previous post presented the performance data between JSC and V8 taken on a x86-64 bit machine and based on the performance metrics, it turns out that, V8 performs better over JSC, at-least in x86-64 bit machine.

Having said that, it would be interesting to see the performance numbers on a ARM device. This post captures the results of V8 and Sun spider on an ARM target.

Reference device:
The reference ARM target used for the performance measurement is Panda Board [2]. Panda board has OMAP4430, 1GHz, Dual core ARM cortex-A9 processor with 1GB of low power DDR2 RAM. I had ARM version of Ubuntu Natty 11.04 running on this device.

Build Configuration:
WebKit Revision : 91387
V8 Revision : 9014

Benchmarking procedure:
There are 3 popular Javascript performance bench-marking tools , viz, V8 bench-marking tool by Google, Sun spider bench-marking tool by WebKit community and Dromaeo bench-marking tool by Mozilla. Here I captured the bench-marking results with V8 and Sun-spider tools. Each of test suite in each tool is run for 5 times and average of these 5 runs is taken for comparison. Data is shared here. I couldn’t able to get the data with Dromaeo[5], as this suite takes longer time and my Panda board used to get over-heated and display used to get turned off before the completion of the test.

V8 benchmarking :
Below graph shows the performance result taken with V8 benchmarking suite[3],

As the chart shows, with exception to ‘Splay’ test case, V8 performs significantly better than JSC! In-fact, this result is almost same as the results taken on x86-64 bit machine [1]. On an average V8 seems to be 3 times faster than JSC.

Sun-Spider benchmarking :
As with V8 benchmarking suite, even sun-spider benchmarking suite[4] also favors V8 (except in 3d and regex test cases) over JSC. On an average there seems to be ~1.5 times increase in performance with V8.

Conclusion:
Well, based on these results, it seems like, V8 performs better over JSC, not only in x86-64 bit machine, but also on an embedded ARM device.

References:
[1]. https://xc0ffee.wordpress.com/2011/08/27/webkit-gtk-jsc-vs-v8/
[2]. http://pandaboard.org/
[3]. http://v8.googlecode.com/svn/data/benchmarks/v6/run.html
[4]. http://www.webkit.org/perf/sunspider-0.9.1/sunspider-0.9.1/driver.html
[5]. http://dromaeo.com/

WebKit-GTK – JSC v/s V8

Well, its been quite some time since I started to work on porting V8 Java Script Engine [1] to WebKit-GTK and recently I managed to get WebKit-GTK running with V8! This work can be found in my gitorious branch at nayankk-webkit. By default, WebKit-GTK will be built with JSC (Java Script Core) Java Script Engine, use the below command for compiling WebKit-GTK with V8 backend,

sh autogen.sh --with-jsengine=v8

After porting V8 to WebKit-GTK, next curious thing, of-course, is to compare the performance of V8 andJSC . Quite some time back, performance comparison on WebKit-Qt port by webkit.sed.hu [2] seems to favor V8 in x86 machine. This blog post captures the performance of WebKit-GTK with JSC and V8 Javascript engines taken on a x86 machine. Performance data on ARM would be the subject of another blog post.

Machine:
Performance data is taken on a quad-core Intel i5 x86 reference machine with 4GB of RAM running at 2.4GHz. Operating system used is Ubuntu Natty 11.04

Build Configuration:
WebKit Revision : 91387
V8 Revision : 9014

Benchmarking procedure:
There are 3 popular Javascript performance bench-marking tools , viz, V8 bench-marking tool by Google, Sun spider bench-marking tool by WebKit community and Dromaeo bench-marking tool by Mozilla. Here I captured the bench-marking results with all 3 tools. Each of test suite in each tool is run for 5 times and average of these 5 runs is taken for comparison. Data is shared here.

V8 benchmarking :
This tools is developed by Google V8 team. Version 6 of this bench-marking tool[3] is  used here for comparison. Here are the results,

As you can see from the graph, V8 defeats JSC by significant margin in all test suites. Note that, higher the score, better the performance.

Sun-Spider benchmarking :
This Java-script bench-marking tools developed by WebKit Team[4]. Results of these tests are here,

Well, these results show that, performance of V8 is slightly less in 3d, bitops and control-flow operations. In rest of all test cases, V8 performs significantly better than JSC.

Dromaeo benchmarking:
Dromaeo[5] has a collection of Java Script performance test suite. Result here are taken for ‘All recommended tests’ of dromaeo.

As with other test suites, Dromaeo also shows significant improvement in performance when V8 engine is used. However, a notable difference is with the test cases using Prototype JS framework, most of which favor JSC over V8.

Conclusion:
As seen with all charts, V8 seems to win against JSC, at-least in x86 machine. However, it would be interesting to see the result on an ARM target, which would be the subject of my next blog post.

References:
[1]. http://code.google.com/p/v8/
[2]. http://webkit.sed.hu/blog/20101216/benchmarking-qtwebkit-v8-linux
[3]. http://v8.googlecode.com/svn/data/benchmarks/v6/run.html
[4]. http://www.webkit.org/perf/sunspider-0.9.1/sunspider-0.9.1/driver.html
[5]. http://dromaeo.com/


Linker “ld: cannot find /lib/libpthread.so.0″

Having frustrated using Scratchbox to compile my module code for ARM device, I decided to switch to cross-compilation in Desktop for ARM target. I feel scratchbox is one of the most stupidest, difficult to use, good-for-nothing software, which serves nothing better than what cross compiler toolchains can do. And the worst part is, if you do not have admin rights at the host system where scratchbox is installed, then it means, you can not install and use your favourate softwares, like emacs, git!! Stealing your freedom?, definately not a good deal!. Right?

Well, next task was to setup the cross-compilation environment, in my host x86 machine, using appropriate toolchains, with the aid of gcc’s –sysroot option. I managed to write a small script to cross-compile my code using scratchbox-toolchain-arm-linux-cs2010q1-202 cross compiler (http://www.scratchbox.org/download/files/sbox-releases/hathor/tarball/). Compilation went through fine, however, while linking my module, linker thowed below error, even though I made sure all paths are properly set,

/opt/compilers/arm-linux-cs2010q1-202/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld: skipping incompatible /lib/libpthread.so.0 when searching for /lib/libpthread.so.0
/opt/compilers/arm-linux-cs2010q1-202/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld: cannot find /lib/libpthread.so.0

It seems like linker is searching for “/lib/libpthread.so.0″ instead of plain “libpthread.so.0″. After scratching head for hours and googling, I figured the cause for this error. The linker script at libc/usr/lib/libpthread.so has the following grouping,

GROUP ( /lib/libpthread.so.0 /usr/lib/libpthread_nonshared.a )

And so this is where the /lib/libpthread.so.0 path is coming from. Modifiying the above line and removing the path information, like below,

GROUP ( libpthread.so.0 libpthread_nonshared.a )

linking just happened perfectly fine! Best part is, the compilation happens much faster now. Also I am able to use all my native sotwares freely. I got my “freedom” back. :)

My first real Beagle Board

I always wanted myself to own an embedded device, so that I can play around with it, for fun!. So, I purchased Beagle Board XM, an ARM Cortex A8 based embedded device with 512 MB of DDR RAM. One need to buy few other accessories as well to work with Beagle Board. Below is my shopping list,

a). Beagle Board XM Rev A
b). HDMI DVI-D Male Cable – To connect Beagle Board to monitor.
c). 5V@2.5A Power Adapter – To power on the Beagle Board. Mini USB cable can also be used to power on the device.
d). USB to Serial RS232 cable – To connect to host machine.
e). USB Mini-B Device Cable.

Beagle Board XM comes with 4GB micro SD card, which is supposed to contain Angstrom validation image. Unfortunately, microSD card which I received was empty! Here is how I created validation image. BTW, I used Ubuntu Maverick to create this image.
a). wget http://beagleboard-validation.s3.amazonaws.com/deploy/201008201549/sd/beagleboard-validation-201008201549.img.gz
b). zcat beagleboard-validation-0201008201549.img.gz | dd of=/dev/your/sd/card bs=8225280
More details can be found here.

Next task was to power on the device. Its quite simple,
a). Connect USB to Serial RS232 to host computer. I use ‘gtkterm’ terminal program to connect to device via serial cable. Configure gtkterm for Baud Rate – 115200, DATA – 8 bit, PARITY- none, STOP – 1bit, FLOW CONTROL – none. Following is the output of ‘dmesg’ upon connecting the cable,
[ 1851.984446] usb 2-1.2: pl2303 converter now attached to ttyUSB0
b). Connect the HDMI cable to monitor.
c). Power on the device using 5V power adapter.

Bingo! ‘gtkterm’ started showing the boot-up script logs. After validation image got loaded onto RAM, Beagle Board logo got displayed in my monitor, followed by linux kernel boot logs which ended in login shell. Just enter ‘root’ in the username field and that is all!

Making of “Jai Ganesh – Yeh Jo Desh Hai Tera”.

As mentioned in my other blog, on the occasion of Ganesh Festival, me and my friend Sonam had taken nearly 4750+ photographs with the intention of making a small video. Keeping the efforts to take the photographs apart, we had spent more than a week to make a video from these photographs. We used both Linux and Windows softwares to make this video (Though I wish I should have used only Linux softwares :)). This blog outlines the method we followed.

1. Well, the first task for us to convert all photographs from original 4200×3400 to smaller resolution of 640×480, as it is pointless to have such high resolution for video. Manually selecting each files and converting to lower resolution using some photo editing softwares was painful (rather impossible), given that we had 4750+ photographs. So, we wrote a small shell script to convert all images to lower resolution, this script was run whole night and all photographs were converted in one go. This script uses ‘convert’ utility provided by ImageMagick. Below is the script,


#/bin/sh

for f in *.JPG; do
convert -resize 640x480 $f `basename $f`.jpg;
rm $f
done

2. The one special effect in the video are the clips which of made up of multiple-shot photographs. Nearly 300 photographs were taken to make a multi-shot clip of 30sec at the rate of 10fps. We used ‘mencoder’ provided by mplayer to encode all these photographs as a mpeg clip. Following command will generate an MPEG clip of 10fps using all photographs present in current directory.


mencoder "mf://*.jpg" -mf fps=10 -o 8.mpeg -ovc lavc -lavcopts vcodec=mjpeg

Don’t ask me what other options do in the above command. I really have no idea why they are needed also. It was just a copy paste from one of internet resource, and I am lazy, I didn’t had the patience to look what each options do 🙂

3. Now its the time of making the actual video using multi-shot clips, other images and a music track. We tried various Linux softwares, like Cinelerra, KDEnlive, Kino, Lives etc. None of them proved good for our purpose, or probably we didn’t had the patience to learn them! We switched to Windows and used a software called ‘CyberLink PowerDirector Ultra 8.00’. This software has really cool UI interface which allow easy video editing, music track addition, transition effects etc. I must admit, there are few of things in which Windows out-performs Linux, hopefully this gap gets narrowed quickly.

4. Thats it. Our video is now ready MPEG format! One last step was to convert this video into FLV format, so that we can upload them in Youtube. Linux ffmpeg does it for us. It reduced the original size of 172MB into 32MB FLV file.

ffmpeg -i JaiGanesh.mpeg -b 600k -r 30 -ab 128k -ar 44100 -s 640x480 -ac 2 -y JaiGanesh.flv

Hope you enjoyed the video. Do drop you feedback. Jai Ganesh!. 🙂

Broadcom BCM4328 WiFi driver support in Debian Lenny for Dell XPS M1330.

I am mad, and love trying different linux distros in my laptop. Recently I switched to my all time favorite Debian. Well, installed the latest and greatest of Debian, i.e., Lenny 5.0.6. Debian looked pretty as earlier, but it need to start wearing more and more modern dresses, I mean, themes. 🙂

However, as with Ubuntu, support for BroadCom WiFi was not included by default in Debian as well. They say, it is because of proprietary nature of BroadCom driver. So, I had to find the suitable windows driver for my BroadCom WiFi and install it in Linux using ‘ndiswrapper’. This process has been automated quite well in Ubuntu 10.04+, where in you just need to sign an agreement that you will use restricted hardware, by activating it under ‘System->Administration->Hardware Driver’.

I have Dell XPS 1330 and my WiFi hardware is – BroadCom BCM4328 802.11/a/b/g/n (rev 03). Earlier, many a times I have installed driver for this hardware using ndiswrapper, but I always forget it immediately. This time, I decided to write a blog post on this procedure, so that I can refer to it any time in future instead of wasting time trying to get the driver the procedure right.

Here we go, below is the procedure I used to make WiFi work in my sweet laptop.

1. Install ndiswrapper.

sudo apt-get install ndiswrapper-common

2. Backlist ‘ssb‘ and ‘bcm43xx‘ drivers by adding them to /etc/modprobe.d/blacklist

3. Find appropriate WiFi windows XP driver for BCM4328. Note that Windows Vista driver (bcmwl6) will not work. You need to have Windows XP drivers only (bcmwl5). This driver can be found in driver installation disk which comes along with laptop. In my case, it was present in r174291.exe package.

4.Once you find the appropriate driver, install the driver using ndiswrapper
ndiswrapper -i bcmwl5.inf

5. Add this module to linux kernel
modprobe ndiswrapper

6. Load ndiswrapper kernel module during boot and reboot.
echo ndiswrapper >> /etc/modules

Thats all!. Small indicator present near the power button in laptop will start blinking during the next boot. Simple. Isn’t it?

I am a saint in the church of emacs!

There’s always a war between the most powerful editors – emacs v/s vi. This rivalry has become a lasting part of hacker culture and the free software community. I was a happy user of vi, until I discovered the power of emacs. And now, trust me, I just love using emacs, its one of my passion. I believe, I can spend entire day with just emacs opened and without switching to any other window. This sweet editor has support for gdb, autocomplete, cscope, compilation, emails and even browser. What more could one wish for? In this post, I will talk about some tips to add wings to emacs and make it fly freely.

When you have a project with thousands of million lines of code, like linux kernel source or webkit source, it necessitates to have some source code navigation tools. Mostly obvious choice is cscope. How about integrating cscope with emacs? Well, you have xcscope!

Installation of xcscope is very simple,
a). Download xcscope. Make sure that, this file is saved in some path searchable by emacs.
b). Make sure cscope-indexer is installed.
c). Edit your emacs and this line
    (require 'xcscope)
d). Optionally, have key bindings for some of the common cscope commands,
    (define-key global-map [(ctrl f3)] 'cscope-set-initial-directory)
    (define-key global-map [(ctrl f4)] 'cscope-unset-initial-directory)
    (define-key global-map [(ctrl f5)] 'cscope-find-this-symbol)
    (define-key global-map [(ctrl f6)] 'cscope-find-global-definition-no-prompting)
    (define-key global-map [(ctrl f7)] 'cscope-find-egrep-pattern)
    (define-key global-map [(ctrl f8)] 'cscope-find-this-file)
    (define-key global-map [(ctrl f9)] 'cscope-next-symbol)
    (define-key global-map [(ctrl f10)] 'cscope-next-file)
    (define-key global-map [(ctrl f11)] 'cscope-prev-symbol)
    (define-key global-map [(ctrl f12)] 'cscope-prev-file)
    (define-key global-map [(meta f9)] 'cscope-display-buffer)
    (define-key global-map [(meta f10)] 'cscope-display-buffer-toggle)

Hmmm. My emacs looked better with cscope, but, we, the engineers are lazy typing lots of code. That when I found Emacs Auto Complete. This pretty lisp package has a very neat way of displaying drop-down with list of possible auto completion. Worth having it in your emacs.

Whats more? Want to integrate Git inside emacs? Check GIT emacs. Though I am not really impressed with the features of this packages, it does serve the purpose.

M-x compile allows you to invoke the compilation from within emacs. One issue which I had with compilation buffer is, some characters from compilation output were not getting displayed, instead their ascii codes used to get displayed. It turns out that, we need to tell emacs that compilation output is in UTF-8, so that it can interpret them correctly. To do so, have this line in you .emacs file.
(prefer-coding-system 'utf-8)

Other annoying part of compilation buffer is, its not used to get scrolled as compilation goes. To automatically scroll the compilation buffer and stop scrolling when an error occurs, add these line in .emacs.
(custom-set-variables
'(compilation-scroll-output first-error))

Cool. My emacs looks a lot prettier now, but, there is something that made it to look sad! Yes, the fonts. I really hated the default font of emacs!. I always wished to have ‘monospace’ font to which vim defaults to. Well, you got to do following steps to have monospace font.

echo "Emacs.font: Monospace-10" >> ~/.Xresources
xrdb -merge ~/.Xresources

Now my emacs is the most sexiest editor and I am one of the happy saints in the church of emacs!