GTK for OLPC
This is the wiki page for the "GTK+ for OLPC" project, as a "Summer of Code" project. The student is Manu Cornet, mentor is Federico Mena-Quintero. You can find the initial goals of the project on the OLPC Google Summer of Code page.
GTK theme/engine torturer and crash tester
The application
This "gtk-theme-torturer" is an application to detect performance issues in GTK themes/engines. It does two things:
- For each of the most common widget types (very easy to add some more), it packs an instance of it in a container, and resizes/redraws it many, many times. You can set a "pain level" to determine the number of times widgets will get redrawn while scaling.
- It takes each one of the gtk_paint_* functions (implemented by the engines themselves) and tries all possible parameters configurations, including unusual values to see if the engine crashes.
The program also outputs detailed time measures (thanks to Federico's widget profiler infrastructure, which I tweaked a bit for the torturer).
The current version of gtk-theme-torturer is here (current tarball in the parent directory). Possible future enhancement: currently, the detailed log is sent to stdout. It would be more convenient to let the user choose (GtkFileChooser) a log file.
A few observations
I have made a small analysis on a few themes' performance, see the results (spreadsheet) and the original mail mentionning the results.
Note that all themes crash on a particular parameter set of gtk_draw_handle (GTK_STATE_NORMAL, GTK_SHADOW_NONE, GTK_ORIENTATION_HORIZONTAL, detail = NULL, width = height = 1, area = (0, 0, 1, 1)), still need to figure out why.
Simulation Tools
I made a hack for Xephyr to let it emulate "color swizzling". The laptop's DCON chip basically only selects the red signal for the first pixel, the green signal for the second pixel, etc., following this pattern :
The patch is here. Apply it to the hw/kdrive/ephyr directory. It adds a '-swizzle' option to Xephyr to switch between the two modes.
Color swizzling
Here is a new screenshot of the color swizzling in Xephyr, with luminosity relatively faithful to the real OLPC display. Click to enlarge:
Color swizzling and antialiasing
After the color swizzling, a bit of antialiasing is necessary to smooth things out. This is what the laptop does, and so does my Xephyr patch: see the difference between not-antialiased and antialiased modes (both are swizzled):
Make sure you view those at 100%, or the image resizing may look weird.
GTK+ theme engine
I began hacking the theme by first making it more crash-proof with the torturer: here is a short log about this. The next big, very big issue, is performance: the theme is much slower than most other popular themes when using the torturer. I still need to make precise time measurements (very soon) with the (torturer + profiler).
The first goal is to match Diana's mockups the best I can while making a light/fast theme. An important issue will be to adapt the theme to the hardware constraints (high dpi value, color swizzling, greyscale mode, etc.).
I will keep Marco Pesenti Gritti (marcopg) and Dan Williams (dcbw) posted on my progress and coordinate with them.
Various enhancements
Cursor blinking
I began with this (probably quite simple to do). The purpose is to let the cursor blink for a few seconds, then just stay on and stop blinking (affects GtkEntry and GtkTextView).
This is done by :
- Adding an XSetting called "gtk-cursor-blink-lifetime", which defaults to 5 seconds.
- Adding a timeout with the corresponding lifetime each time the code asks the cursor to begin blinking. When the timeout is over, the cursor stays on.
A (probably final) version of the patch (both for GtkEntry and GtkTreeView) is available here.