Mobile/DFBPorting: Difference between revisions

m (→‎Bugs: note all fixed, suggest search for [dfb])
 
(21 intermediate revisions by 7 users not shown)
Line 108: Line 108:
=== Using script ===
=== Using script ===


Note: This has been tested on Fedora Core 8.
Note: This has been tested on Fedora Core 8 and a Mandrake 9.1.


* Download and unpack [http://wiki.mozilla.org/images/8/8d/Install_gtk_060508.zip install_gtk_060508.zip]
* Download and unpack [https://wiki.mozilla.org/images/7/77/Install-gtk-cross-20081106.tar.zip Install-gtk-cross-20081106.tar.zip] ( or this previous version [https://wiki.mozilla.org/images/a/a5/Install_gtk_101708.zip Install_gtk_101708.zip] ''doesn't support --html option and not optimized to cross compilation'')
* Download and unpack [http://wiki.mozilla.org/images/b/b5/Platform_patches_060508.zip platform_patches_060508.zip]
* Edit your ''install.sh'' or  ''install-cross.sh'' to adjust parameters to your needs. You can use the ''--html'' option to check what will be executed by the script before installation.
* Try ''install_gtk.py --help'' for usage instructions
* When you are ready, suppress the ''--html'' option in ''install.sh'' then run it, that downloads all source packages and patchs, applies cairo and gtk patches, builds and installs. If you want to change parametrers, try ''install_gtk.py --help'' for usage instructions then modify ''install.sh''
* Run install_gtk.py that downloads all source packages, applies cairo and gtk patches, builds and installs
* Copy this [http://wiki.mozilla.org/Mobile/DFBPorting/directfbrc .directfbrc] to ~/.directfbrc then edit it to ajust parameters to your needs
* Copy this [http://wiki.mozilla.org/Mobile/DFBPorting/directfbrc .directfbrc] to ~/.directfbrc


Note: Installation might fail if the packages are not available from the download link mentioned in config.py.
Note: Installation might fail if the packages are not available from the download link mentioned in config.py.
Line 149: Line 148:
* '''Download URL: '''ftp://ftp.gtk.org/pub/gtk/v2.10/dependencies/jpegsrc.v6b.tar.gz
* '''Download URL: '''ftp://ftp.gtk.org/pub/gtk/v2.10/dependencies/jpegsrc.v6b.tar.gz
* '''Installation:'''
* '''Installation:'''
** tar -xzvf jpegsrc.v6b.tar.gz
** tar xzvf jpegsrc.v6b.tar.gz
** cd jpeg-6b
** cd jpeg-6b
** ./configure --prefix=/usr/local/dfb --without-x --enable-shared --without-libjasper
** ./configure --prefix=/usr/local/dfb --without-x --enable-shared --without-libjasper
Line 165: Line 164:
** make
** make
** make install  
** make install  
==== zlib ====
* '''Package Name: ''' zlib-1.2.3.tar.gz
* '''Download URL: ''' http://internap.dl.sourceforge.net/sourceforge/libpng/zlib-1.2.3.tar.gz
* '''Installation: '''
** tar zxvf zlib-1.2.3.tar.gz
** cd zlib-1.2.3
** ./configure --prefix=/usr/local/dfb
** make
** make install


==== libpng ====
==== libpng ====


* '''Package Name: ''' libpng-1.2.29.tar.bz2  
* '''Package Name: ''' libpng-1.2.34.tar.bz2  
* '''Download URL: ''' http://internap.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.29.tar.bz2
* '''Download URL: ''' http://internap.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.34.tar.bz2
* '''Installation: '''  
* '''Installation: '''  
** tar jxvf libpng-1.2.29.tar.bz2
** tar jxvf libpng-1.2.34.tar.bz2
** cd libpng-1.2.29
** cd libpng-1.2.34
** cp ./scripts/makefile.linux  ./Makefile
** Change “prefix=/usr/local” to “prefix=/usr/local/dfb” (line no 31) in Makefile manually
** make  
** make  
** make install
** make install
Line 192: Line 200:


* '''Package Name: ''' gettext-0.17.tar.gz
* '''Package Name: ''' gettext-0.17.tar.gz
* '''Download URL: ''' http://ftp.gnu.org/gnu/gettext/
* '''Download URL: ''' http://ftp.gnu.org/gnu/gettext/gettext-0.17.tar.gz
* '''Installation:'''
* '''Installation:'''
** tar zxvf gettext-0.17.tar.gz
** tar zxvf gettext-0.17.tar.gz
Line 237: Line 245:
==== DirectFB ====
==== DirectFB ====


* '''Package Name: ''' DirectFB-1.1.1.tar.gz
* '''Package Name: ''' DirectFB-1.2.0.tar.gz
* '''Patches: ''' Download following patches and apply to the source.
* '''Download URL: ''' http://www.directfb.org/downloads/Old/DirectFB-1.2.0.tar.gz
** [http://wiki.mozilla.org/images/5/5a/001-dfb-dok-list-crash-fix.patch.zip 001-dfb-dok-list-crash-fix.patch]
* '''Download URL: ''' http://www.directfb.org/downloads/Core/DirectFB-1.2.0-rc1.tar.gz
* '''Installation: '''
* '''Installation: '''
** apt-get install libsdl1.2-dev
** apt-get install libsdl1.2-dev
** tar zxvf DirectFB-1.2.0-rc1.tar.gz
** tar zxvf DirectFB-1.2.0.tar.gz
** cd DirectFB-1.2.0-rc1
** cd DirectFB-1.2.0
** ./configure --prefix=/usr/local/dfb --enable-sdl
** ./configure --prefix=/usr/local/dfb --enable-sdl
** make
** make
Line 263: Line 269:


* '''Package Name: ''' expat-2.0.1.tar.gz
* '''Package Name: ''' expat-2.0.1.tar.gz
* '''Download URL: ''' http://expat.sourceforge.net/
* '''Download URL: ''' http://internap.dl.sourceforge.net/sourceforge/expat/expat-2.0.1.tar.gz
* '''Installation: '''
* '''Installation: '''
** tar zxvf expat-2.0.1.tar.gz
** tar zxvf expat-2.0.1.tar.gz
Line 276: Line 282:
* '''Download URL: ''' http://www.fontconfig.org/release/fontconfig-2.4.91.tar.gz
* '''Download URL: ''' http://www.fontconfig.org/release/fontconfig-2.4.91.tar.gz
* '''Installation:'''
* '''Installation:'''
** tar fontconfig-2.4.91.tar.gz
** tar zxvf fontconfig-2.4.91.tar.gz
** cd fontconfig-2.4.91
** cd fontconfig-2.4.91
** ./configure --prefix=/usr/local/dfb --without-x --enable-directfb --disable-xlib --disable-win32
** ./configure --prefix=/usr/local/dfb --without-x --enable-directfb --disable-xlib --disable-win32
** make
** make
** make install  
** make install


==== pixman ====
==== pixman ====


* '''Package Name: ''' pixman-0.10.0.tar.gz
* '''Package Name: ''' pixman-0.12.0.tar.gz
* '''Download URL: ''' http://www.cairographics.org/releases/pixman-0.10.0.tar.gz
* '''Download URL: ''' http://www.cairographics.org/releases/pixman-0.12.0.tar.gz
* '''Installation: '''
* '''Installation: '''
** tar -zxvf pixman-0.10.0.tar.gz
** tar zxvf pixman-0.12.0.tar.gz
** cd pixman-0.10.0
** cd pixman-0.12.0
** ./configure --prefix=/usr/local/dfb  
** ./configure --prefix=/usr/local/dfb  
** make
** make
** make install  
** make install
 


==== cairo ====
==== cairo ====
Line 305: Line 310:
** [http://wiki.mozilla.org/images/3/3c/005-cairo-font-crash-fix.patch.zip 005-cairo-font-crash-fix.patch]
** [http://wiki.mozilla.org/images/3/3c/005-cairo-font-crash-fix.patch.zip 005-cairo-font-crash-fix.patch]
* '''Installation: '''
* '''Installation: '''
** tar -zxvf cairo-1.6.4.tar.gz
** tar zxvf cairo-1.6.4.tar.gz
** cd cairo-1.6.4
** cd cairo-1.6.4
** ./configure --prefix=/usr/local/dfb --enable-directfb=yes --enable-xlib=no --enable-xlib-xrender=no --enable-xcb=no --without-x --disable-win32
** ./configure --prefix=/usr/local/dfb --enable-directfb=yes --enable-xlib=no --enable-xlib-xrender=no --enable-xcb=no --without-x --disable-win32
Line 362: Line 367:
*** export LD_LIBRARY_PATH=/usr/local/dfb/lib
*** export LD_LIBRARY_PATH=/usr/local/dfb/lib
*** export PKG_CONFIG_PATH=/usr/local/dfb/lib/pkgconfig
*** export PKG_CONFIG_PATH=/usr/local/dfb/lib/pkgconfig
** Write a “Hello world” GTK application: hell_world.c and compile it
** Write a “Hello world” GTK application: hello_world.c and compile it
*** gcc `pkg-config --cflags --libs gtk+-2.0` hello_world.c –o hello_world
*** gcc `pkg-config --cflags --libs gtk+-2.0` hello_world.c –o hello_world
** Run hello_world
** Run hello_world
Line 371: Line 376:
=== Getting mozilla-dfb sources from hg ===
=== Getting mozilla-dfb sources from hg ===


* ''hg clone http://hg.mozilla.org/users/mreddy_sta.samsung.com/mozilla-dfb mozilla-dfb-src''
* ''hg clone http://hg.mozilla.org/users/pavlov_mozilla.com/mozilla-dfb mozilla-dfb-src''
* ''cd mozilla-dfb-src''
* ''cd mozilla-dfb-src''
* ''python client.py --skip-tamarin checkout
* ''python client.py --skip-tamarin checkout
* (on Mac OS X 10.4, perhaps) ''python client.py --cvs ocvs --skip-tamarin checkout


=== Build mozilla-dfb ===
=== Build mozilla-dfb ===
Line 384: Line 390:


== Bugs ==
== Bugs ==
A good bug search term is <tt>[https://bugzilla.mozilla.org/buglist.cgi?quicksearch=%5Bdfb%5D &#x5B;dfb&#x5D;]</tt>.


* Port Mozilla to Gtk-DirectFB : [https://bugzilla.mozilla.org/show_bug.cgi?id=422221 bug 422221]
As of November 2010, all these bugs were marked fixed in 2008 or 2009.
* Some parts of content area not painted when scrolled : [https://bugzilla.mozilla.org/show_bug.cgi?id=435471 bug 435471]
* Port Mozilla to Gtk-DirectFB : {{bug|422221}}
* Toolbar icons disappear randomly when other toolbar buttons are clicked : [https://bugzilla.mozilla.org/show_bug.cgi?id=435492 bug 435492]
* Some parts of content area not painted when scrolled : {{bug|435471}}
* Entire browser flickers when mouse is hovered over a toolbar menu popup : [https://bugzilla.mozilla.org/show_bug.cgi?id=435494 bug 435494]
* Toolbar icons disappear randomly when other toolbar buttons are clicked : {{bug|435492}}
* Menu items are not selectable using mouse in toolbar menu popup : [https://bugzilla.mozilla.org/show_bug.cgi?id=435499 bug 435499]
* Entire browser flickers when mouse is hovered over a toolbar menu popup : {{bug|435494}}
* Menu items are not selectable using mouse in toolbar menu popup : {{bug|435499}}


== Comments ==
== Comments ==
A "how to report a bug" section is needed.

Latest revision as of 22:38, 7 November 2010

Porting Goals

  • Firefox running with full functionality (including SVG) on DirectFB (web site, Wikipedia) -based platforms
  • Use GDK as much as possible so that the backend (X, DFB etc) dependencies are abstracted out
  • Use DirectFB calls only if absolutely necessary
    • Functionality not mappable to GDK
    • Any other compelling reasons related to performance

Porting Items

Native Surface Creation

Current State

cairo_xlib_* functions are used for creating surfaces on X. These cairo_xlib_* funtions are implemented in cairo and are specific to X backend.

Related files
  • gfx/thebes/public/gfxXlibSurface.h
  • gfx/thebes/public/gfxXlibSurface.cpp
  • All callers of gfxXlibSurface
    • widget/src/gtk2/nsWindow.cpp
    • gfx/thebes/src/gfxPlatformGtk.cpp
    • gfx/thebes/src/gfxASurface.cpp
    • layout/generic/nsObjectFrame.cpp


Proposed Porting Approach

  • Clone gfxXlibSurface to gfxGdkCairoSurface
  • Callers of gfxXlibSurface will now call gfxGdkCairoSurface.
  • gfxGdkCairoSurface implementation calls Xlib specific functions under MOZ_X11 switch and calls DirectFB specific functions under MOZ_DFB switch.
  • This approach will abstract out all backend specific functions and move them to a single place
  • Users of gfxXlibSurface to create cairo surface for a GdkWindow will simply call gfxGdkCairoSurface with GdkDrawable
  • Users of gfxXlibSurface to create cairo surface for an offscreen buffer (pixmap) will undergo some changes:
    • A gdk pixmap of required depth will be created and corresponding GdkDrawable will be passed to gfxGdkCairoSurface for creating cairo surface
    • All other x11 dependent code (checking for xrender extension etc) will be removed as gfxGdkCairoSurface will take care of all required functionality .
  • The actual cairo-xlib surface creation will use GdkDrawable's depth to call correct cairo_xlib functions:
    • cairo_xlib_surface_create() will be called if the GdkDrawable has non-NULL visual
    • else: cairo_xlib_surface_create_for_bitmap() will be called if the depth is 1
    • else : cairo_xlib_surface_create_with_xrender_format() will be called
  • The actual cairo-dfb surface creation will use type of GdkDrawable (Window or pixmap) to call correct cairo-dfb functions
    • cairo_directfb_surface_create() will be called with the DFB Surface returned from gdk_directfb_surface_lookup (), if the GdkDrawable is a Window
    • cairo_directfb_surface_create() will be called with a newly created DFB Surface. The new DFB Surface will be created using CreateSurface() with the GdkDrawable's depth mapped to DFB pixel format.

NativeRenderer

Current State

NativeRenderer's Draw function is called for drawing a GTK widget composited with cairo state. NativeRenderer calls cairo_draw_with_xlib that has lot of dependencies on cairo_xlib*. cairo_draw_with_xlib does all the fancy stuff (complex transforms) and finally calls NativeDraw with the Drawable associated with the cairo surface. cairo_xlib provides API to obtain Drawable associated with a given Cairo surface.

According to Vlad (on irc), cairo_draw_with_xlib is really there for supporting complex transforms (rotation, affine-transformations etc) that gfx natively doesn't support but depends on cairo. Effect of disabling cairo_draw_with_xlib is that the SVG and Canvas will not work; but native theming will work fine.


Related files
  • gfx/thebes/public/gfxXlibNativeRenderer.h
  • gfx/thebes/src/gfxXlibNativeRenderer.cpp
  • All callers of gfxXlibNativeRenderer
    • widget/src/gtk2/nsNativeThemeGTK.cpp
    • layout/generic/nsObjectFrame.cpp

Proposed Porting Approach

  • gfxXlibNativeRenderer will be cloned to gfxGdkNativeRenderer
    • GdkDrawable will replace (Display, Visual, Drawable) touple
  • All the users of gfxXlibNativeRenderer will use gfxGdkNativeRenderer
  • Getting GdkDrawable from cairo surface
    • A new static const field will be added to gfxASurface class
      • static const cairo_user_data_key_t backendRenderingContext;
    • During the surface creation time, gfxGdkCairoSurface.cpp will store the GdkDrawable as user data in cairo surface
      • SetData (&gfxASurface::backendRenderingContext, (void *) mDrawable, nsnull);
    • Draw function in gfxGdknativeRenderer.cpp will obtain the GdkDrawable by calling GetData() function
      • (GdkDrawable *) ctx->OriginalSurface()->GetData(&gfxASurface::backendRenderingContext);
  • cairo-xlib-utils.c and cairo-xlib-utils.h will be taken out from the build
  • cairo_draw_with_xlib call in Draw function inside gfxGdkNativeRenderer.cpp will be replaced with the following code snippet.
   double device_offset_x, device_offset_y;
   short offset_x = 0, offset_y = 0;
   cairo_surface_t * target = cairo_get_target (cr);
   cairo_matrix_t matrix;
   cairo_surface_get_device_offset (target, &device_offset_x, &device_offset_y);
   cairo_get_matrix (cr, &matrix);
   _convert_coord_to_short (matrix.x0 + device_offset_x, &offset_x);
   _convert_coord_to_short (matrix.y0 + device_offset_y, &offset_y);
   cairo_surface_flush (target);
   NativeDraw ((GdkDrawable *) ctx->OriginalSurface()->GetData(&gfxASurface::backendRenderingContext),
           offset_x, offset_y, NULL, 0);
   cairo_surface_mark_dirty (target);

TODO

In the current proposal we are ignoring cairo_draw_with_xlib; i.e., it will be disabled in the beginning phases of the porting. After the basic functionality is working on DFB, then we will work on this. Meanwhile, any input to port cairo_draw_with_xlib to GDK will be greatly appreciated.

Previous Work

GTK-DFB Package Installation

Using script

Note: This has been tested on Fedora Core 8 and a Mandrake 9.1.

  • Download and unpack Install-gtk-cross-20081106.tar.zip ( or this previous version Install_gtk_101708.zip doesn't support --html option and not optimized to cross compilation)
  • Edit your install.sh or install-cross.sh to adjust parameters to your needs. You can use the --html option to check what will be executed by the script before installation.
  • When you are ready, suppress the --html option in install.sh then run it, that downloads all source packages and patchs, applies cairo and gtk patches, builds and installs. If you want to change parametrers, try install_gtk.py --help for usage instructions then modify install.sh
  • Copy this .directfbrc to ~/.directfbrc then edit it to ajust parameters to your needs

Note: Installation might fail if the packages are not available from the download link mentioned in config.py.

Manual Installation

We are going to install under /usr/local/dfb to avoid confusion when X and DFB apps are running simultaneously.

Create installation directories under /usr/local/dfb:

  • mkdir /usr/local/dfb
  • mkdir -p /usr/local/dfb/man/man1
  • mkdir /usr/local/dfb/bin
  • mkdir /usr/local/dfb/lib
  • mkdir /usr/local/dfb/etc
  • mkdir /usr/local/dfb/include
  • mkdir /usr/local/dfb/info
  • mkdir /usr/local/dfb/sbin
  • mkdir /usr/local/dfb/share
  • mkdir /usr/local/dfb/src

Set the following environment variables in the build terminal

  • export LD_LIBRARY_PATH=/usr/local/dfb/lib
  • export PATH=/usr/local/dfb/bin/:$PATH
  • export PKG_CONFIG=/usr/local/dfb/bin/pkg-config
  • export PKG_CONFIG_PATH=/usr/local/dfb/lib/pkgconfig
  • export CPPFLAGS=-I/usr/local/dfb/include
  • export LDFLAGS=-L/usr/local/dfb/lib

jpeg

tiff

zlib

libpng

pkg-config

gettext

Note: This package might not be required.

glib

atk

freetype

DirectFB

After installing DirectFB, set it up to run over SDL on X11.

  • Create .directfbrc under home directory.
  • Add following lines to .directfbrc
    • wm=default
    • mode=800x600
    • depth=32
    • system=sdl
  • As root user, run the following command
    • touch /usr/local/dfb/lib/libgdk-x11-2.0.so.0

libexpat

fontconfig

  • Package Name: fontconfig-2.4.91.tar.gz
  • Download URL: http://www.fontconfig.org/release/fontconfig-2.4.91.tar.gz
  • Installation:
    • tar zxvf fontconfig-2.4.91.tar.gz
    • cd fontconfig-2.4.91
    • ./configure --prefix=/usr/local/dfb --without-x --enable-directfb --disable-xlib --disable-win32
    • make
    • make install

pixman

cairo

pango

gtk

libIDL

Test

  • Existing examples
    • Try running test applications under gtk+-2.12.9/tests directory
  • New Examples
    • Setup pkg-config and library paths
      • export LD_LIBRARY_PATH=/usr/local/dfb/lib
      • export PKG_CONFIG_PATH=/usr/local/dfb/lib/pkgconfig
    • Write a “Hello world” GTK application: hello_world.c and compile it
      • gcc `pkg-config --cflags --libs gtk+-2.0` hello_world.c –o hello_world
    • Run hello_world
      • A DirectFB window with hello_world widget inside should pop-up

Building and testing Firefox-DFB

Getting mozilla-dfb sources from hg

Build mozilla-dfb

  • Copy this .mozconfig to mozilla-dfb-src/.mozconfig
  • set LD_LIBRARY_PATH and PKG_CONFIG_PATH to installed gtk-dfb packages
  • make -f client.mk build in the mozilla-dfb-src directory

Issues

Bugs

A good bug search term is [dfb].

As of November 2010, all these bugs were marked fixed in 2008 or 2009.

  • Port Mozilla to Gtk-DirectFB : bug 422221
  • Some parts of content area not painted when scrolled : bug 435471
  • Toolbar icons disappear randomly when other toolbar buttons are clicked : bug 435492
  • Entire browser flickers when mouse is hovered over a toolbar menu popup : bug 435494
  • Menu items are not selectable using mouse in toolbar menu popup : bug 435499

Comments

A "how to report a bug" section is needed.