Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2006:
[Freeciv-Dev] (PR#16431) [PATCH] cairo conversion of gtk2 client
Home

[Freeciv-Dev] (PR#16431) [PATCH] cairo conversion of gtk2 client

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#16431) [PATCH] cairo conversion of gtk2 client
From: "Patrick Guimond" <patg@xxxxxxxxxxxxxxxxx>
Date: Thu, 13 Apr 2006 07:01:15 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=16431 >

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi

This is a patch for the GTK2 client to use cairo instead of GDK as it's
compositing interface.

Modifications:
 - canvas are now drawn to using cairo operators
 - sprites are loaded as cairo surfaces, currently using the same
   server-side pixmaps used by gdk to render to screen (X pixmaps)

As of GTK 2.8, GDK already uses cairo internaly, so this doesn't bring
any real difference from the user interface point of view. Results are
nearly identical, as the same set of rendering operations as before are
applied.

It mostly brings features for future development, consequences:

- - Getting rid of a lot of GdkPixbuf
- - Reduced memory usage
- - Possible alternative backends. cairo-glitz/OpenGL?
- - Future SVG tileset as it gets devellopped in cairo
- - Remote application responsiveness (am I the one running the client on
  a remote X server?)


Getting rid of a lot of GdkPixbuf avoids some duplication of info on the
client/server. From simple tests, it seems total memory usage on the
client has been lowered by a factor of 5 (e.g. 103 to 19MB obtained in a
test), while pixmap usage on the server side has increased by 3 (e.g.
10MB to 32MB in a test). The image data memory consumption on the client
side may in fact be even higher, as I didn't look at how much memory was
used by other resources. This should in fact be around 7-8 times less
memory usage from the graphics.

On the performance side, the client is doing a _lot_ less server
round-trips, reducing copy operations / network usage.

Compositing operations are done server-side, so the workload is
transfered to the X server instead of the client. Didn't see much
difference in cpu usage between the two from simple tests, but the major
difference is _where_ the computations are beeing done (where they
should be done...).

As for using glitz for OpenGL acceleration and putting sprites in
textures, I didn't make any attempts on this aspect. I don't think there
would be a huge gain, maybe if the client begins using gradients and
filters, but it may be useful in the future anyway.

Also, GTK developement seems to be getting GDK rendering out and pushing
more toward cairo, so doing the move currently could avoid some work in
the future.


NOTE that the patch modifies a lot of code. It seems to work fine for
what I tested, but it certainly contains bugs, so any
comments/modifications/others are greatly welcome.

The -m4 file in the patch set is the updated m4 required GTK version
check, which is 2.8 for cairo support.

patg


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFEPll50X14v95lmw4RAl+7AJ0YuSYGB0ncbqB65TvjpA5ptJzqNwCfV793
bD1jepyu0kFQ1D6ks3IAj3o=
=E3iM
-----END PGP SIGNATURE-----

--- gtk2-client.m4.orig 2006-04-13 07:41:22.000000000 -0400
+++ gtk2-client.m4      2006-04-13 07:40:33.000000000 -0400
@@ -6,7 +6,7 @@
 AC_DEFUN([FC_GTK2_CLIENT],
 [
   if test "$client" = "gtk-2.0" || test "$client" = yes ; then
-    AM_PATH_GTK_2_0(2.4.0,
+    AM_PATH_GTK_2_0(2.8.0,
       [
         client="gtk-2.0"
         CLIENT_CFLAGS="$GTK_CFLAGS"

Attachment: freeciv-gtk2-client-cairo.patch.gz
Description: GNU Zip compressed data


[Prev in Thread] Current Thread [Next in Thread]