[cairo-commit] 4 commits - NEWS src/cairo-image-surface.c src/cairoint.h src/cairo-png.c src/Makefile.am

Carl Worth cworth at kemper.freedesktop.org
Thu Jun 7 15:05:33 PDT 2007


 NEWS                      |   73 +++++++++++++++++++++++++++++-----------------
 src/Makefile.am           |    3 -
 src/cairo-image-surface.c |    6 +--
 src/cairo-png.c           |    2 -
 src/cairoint.h            |   52 +++++++++++++++++++-------------
 5 files changed, 83 insertions(+), 53 deletions(-)

New commits:
diff-tree a5ee983e1cb97aff63b0c9c3a57125b37d0e3f74 (from e19c49269d0b236de91a5a9b5230bed7d76282ed)
Author: Carl Worth <cworth at cworth.org>
Date:   Thu Jun 7 15:03:43 2007 -0700

    Update release notes for 1.4.8

diff --git a/NEWS b/NEWS
index cfd8113..a2badde 100644
--- a/NEWS
+++ b/NEWS
@@ -1,37 +1,56 @@
-Release 1.4.x
+Release 1.4.8 (2007-06-07 Carl Worth <cworth at cworth.org>)
 =========================================================
-«Preamble»
+This is the fourth update in cairo's stable 1.4 series. It comes just
+over five weeks after the 1.4.6 release. This release includes a
+thread-safe surface-cache for solid patterns which significantly
+improves text rendering with the xlib backend. Also, dozens of error
+paths in cairo have been fixed thanks to extensive fault-injection
+testing by Chris Wilson.
 
 Surface cache for solid patterns
 --------------------------------
 Originally written by Jorn Baayen, the introduction of a small cache
-for surfaces created for solid patterns dramatically reduced the amount
-the number of required surface allocations and backend traffic.  For
-example, this reduces the volume of X requests during text rendering
-to the same level as Xft.  Unfortunately, the cache had to be removed
-when complications arose with threaded applications, like Evince,
-which were designed to only make lockless X requests from a single
-thread, but Cairo violated this design when it ejected cached surfaces,
-with corresponding X traffic, from auxiliary threads.  A solution was
-proposed by Behdad Esfahbod, and implemented by Chris Wilson, to
-introduce work queues for the xlib backend that deferred the
-destruction of the X resources until the next time the application
-directly operated on a xlib surface.
+for surfaces created for solid patterns improves performance
+dramatically. For example, this reduces the volume of X requests
+during text rendering to the same level as Xft.
+
+This cache first made its appearance in a 1.3.x snapshot, but was
+removed before appearing in any previous major release due to
+complications with multi-threaded programs. For example, programs like
+evince that would carefully restrict usage of cairo-xlib to a single
+thread were unpleasantly surprised to find that using cairo-image in a
+separate thread could trigger X requests.
+
+Behdad Esfahbod designed a fix which was implemented by Chris
+Wilson. Now, the necessary X requests are queued up until the next
+time the application directly operates on an xlib surface.
 
-Improved error handling patchs
+Improved error handling paths
 ------------------------------
-Cairo has a fairly unique error-handling scheme that retains error
-status with objects infected.  This requires lots of internal paths
-dealing with error returns and directing the error to the right
-object and releasing resources correctly (like all good libraries do).
-Chris Wilson previsouly stressed the memory allocation paths by
-injecting memory allocations faults into cairo's performance test suite
-and fixed all found issues.  In this release he has done the same, plus
-applying other static and dynamic stress tests on the main cairo test
-suite and fixed a whole lot of other error-handling errors.  We were
-pleased to find that his work fixed a highly-dupped crasher in
-gnome-about: http://bugzilla.gnome.org/show_bug.cgi?id=431990
+Chris Wilson continued the excellent work he started in cairo 1.4.4 to
+make cairo much more robust against out-of-memory and other errors. He
+applied his memory allocation fault injection cairo's main test suite,
+(previously he had applied it to cairo's performance suite).
+
+Chris's testing found dozens of bugs which he fixed. Many of these
+bugs had perhaps never been hit by any users. But at least one was
+hit by the gnome-about program which resulted in dozens of duplicated
+bug reports against that program:
 
+	http://bugzilla.gnome.org/show_bug.cgi?id=431990
+
+We were very pleasantly surprised to see this bug get fixed as a
+side-effect of Chris's work. Well done, Chris!
+
+Other fixes
+-----------
+Cleanup of mutex declarations (Behdad Esfahbod)
+
+Remove unnecessary clip region from SVG output (Emmanuel Pacaud)
+
+Remove Xsun from the buggy_repeat blacklist (Elaine Xiong)
+
+ATSUI: Fix glyph measurement: faster and more correct (Brian Ewins)
 
 Release 1.4.6 (2007-05-01 Carl Worth <cworth at cworth.org>)
 =========================================================
@@ -3720,3 +3739,5 @@ server.
 Carl Worth <cworth at isi.edu> wrote the first lines of Xr, after Keith
 Packard <keithp at keithp.com> proposed the plan for a stateful drawing
 library in C providing a PostScript-like rendering model.
+
+ LocalWords:  mutex BeOS extraordinaire
diff-tree e19c49269d0b236de91a5a9b5230bed7d76282ed (from 5ded4479d6ddbbe16c631144ef987c4c02e706a6)
Author: Carl Worth <cworth at cworth.org>
Date:   Thu Jun 7 12:19:46 2007 -0700

    Remove stale reference to cairo-xlib-test.h

diff --git a/src/Makefile.am b/src/Makefile.am
index 5263867..0378ca4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -51,8 +51,7 @@ libcairo_xlib_sources = cairo-xlib-surfa
 			cairo-xlib-surface-private.h \
 			cairo-xlib-display.c \
 			cairo-xlib-screen.c \
-			cairo-xlib-private.h \
-			cairo-xlib-test.h
+			cairo-xlib-private.h
 backend_pkgconfigs += cairo-xlib.pc
 endif
 
diff-tree 5ded4479d6ddbbe16c631144ef987c4c02e706a6 (from ec63a7839457e2d14c7b1a5b64d1a79daf044222)
Author: Carl Worth <cworth at cworth.org>
Date:   Thu May 31 15:35:14 2007 -0700

    Fix return value of cairo_surface_write_to_png for unsupported formats
    
    For some reason this was returning CAIRO_STATUS_NULL_POINTER.
    Now fixed to return CAIRO_STATUS_INVALID_FORMAT.

diff --git a/src/cairo-png.c b/src/cairo-png.c
index 76e901f..35db3d9 100644
--- a/src/cairo-png.c
+++ b/src/cairo-png.c
@@ -175,7 +175,7 @@ write_png (cairo_surface_t	*surface,
 	png_color_type = PNG_COLOR_TYPE_GRAY;
 	break;
     default:
-	status = CAIRO_STATUS_NULL_POINTER;
+	status = CAIRO_STATUS_INVALID_FORMAT;
 	goto BAIL3;
     }
 
diff-tree ec63a7839457e2d14c7b1a5b64d1a79daf044222 (from b6ee6c531c41adb57512fe0eaf21558e5d03f04b)
Author: Carl Worth <cworth at cworth.org>
Date:   Thu May 31 14:28:50 2007 -0700

    Add CAIRO_INTERNAL_FORMAT_RGB16_565 and prefer it over deprecated CAIRO_FORMAT_RGB16_565
    
    Also clarify the documentation for cairo_internal_format_t

diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index c61869a..ad41a4c 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -131,7 +131,7 @@ _cairo_image_surface_create_for_pixman_i
 
 /* Try to recover a cairo_format_t from a pixman_format
  * by looking at the bpp and masks values. */
-static cairo_format_t
+static cairo_internal_format_t
 _cairo_format_from_pixman_format (pixman_format_t *pixman_format)
 {
     unsigned int bpp, am, rm, gm, bm;
@@ -167,7 +167,7 @@ _cairo_format_from_pixman_format (pixman
 	    rm == 0xf800 &&
 	    gm == 0x07e0 &&
 	    bm == 0x001f)
-	    return CAIRO_FORMAT_RGB16_565;
+	    return CAIRO_INTERNAL_FORMAT_RGB16_565;
 	break;
     case 8:
 	if (am == 0xff &&
@@ -560,7 +560,7 @@ _cairo_content_from_format (cairo_format
     case CAIRO_INTERNAL_FORMAT_ABGR32:
 	return CAIRO_CONTENT_COLOR_ALPHA;
     case CAIRO_FORMAT_RGB24:
-    case CAIRO_FORMAT_RGB16_565:
+    case CAIRO_INTERNAL_FORMAT_RGB16_565:
     case CAIRO_INTERNAL_FORMAT_BGR24:
 	return CAIRO_CONTENT_COLOR;
     case CAIRO_FORMAT_A8:
diff --git a/src/cairoint.h b/src/cairoint.h
index 7b0d57e..07846b8 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -308,33 +308,43 @@ typedef enum cairo_internal_surface_type
     CAIRO_INTERNAL_SURFACE_TYPE_TEST_PAGINATED
 } cairo_internal_surface_type_t;
 
-/* For xlib fallbacks, we use image surfaces with formats that match
- * the visual of the X server. There are a couple of common X server
- * visuals for which we do not have corresponding public
- * cairo_format_t values, since we do not plan on always guaranteeing
- * that cairo will be able to draw to these formats.
+/* For xlib fallbacks, we need image surfaces with formats that match
+ * the visual of the X server. There are a few common X server visuals
+ * for which we do not have corresponding public cairo_format_t
+ * values, since we do not plan on always guaranteeing that cairo will
+ * be able to draw to these formats.
  *
- * So, currently pixman does provide support for these formats. It's
- * possible that in the future we will change the implementation to
- * instead convert to a supported format. This would allow us to be
- * able to simplify pixman to handle fewer formats.
+ * Currently pixman does advertise support for these formats, (with an
+ * interface to construct a format from a set of masks---but pixman
+ * may not actually have code to support any arbitrary set of
+ * maskes). So we lodge a cairo_internal_format_t in the internal
+ * cairo image surface to indicate what's going on. The value isn't
+ * actually used for much, since it is the set of pixman masks that
+ * control the rendering.
  *
- * The RGB16_565 case could probably have been handled this same way,
- * (and in fact we could still change it to do so, and maybe just
- * leave the value in the enum but deprecate it entirely). We can't
- * drop the value since it did appear in cairo 1.2.0 so it might
- * appear in code, (particularly bindings which are thorough about
- * things like that). But we did neglect to update CAIRO_FORMAT_VALID
- * for 1.2 so we know that no functional code is out there relying on
- * being able to create an image surface with a 565 format, (which is
- * good since things like write_to_png are missing support for the 565
- * format.
+ * But even though the value isn't used, it's still useful to maintain
+ * this list, as it indicates to use visual formats that have been
+ * encountered in practice. We can take advantage of this for future
+ * rewrites of pixman that might support a limited set of formats
+ * instead of general mask-based rendering, (or at least optimized
+ * rendering for a limited set of formats).
+ *
+ * Another approach that could be taken here is to convert the data at
+ * the time of the fallback to a supported format. This is similar to
+ * what needs to be done to support PseudoColor visuals, for example.
  *
  * NOTE: The implementation of CAIRO_FORMAT_VALID *must* *not*
- * consider these internal formats as valid. */
+ * consider these internal formats as valid.
+ *
+ * NOTE: When adding a value to this list, be sure to add it to
+ * _cairo_format_from_pixman_format, (which is probably the assert
+ * failure you're wanting to eliminate), but also don't forget to add
+ * it to cairo_content_from_format.
+ */
 typedef enum cairo_internal_format {
     CAIRO_INTERNAL_FORMAT_ABGR32 = 0x1000,
-    CAIRO_INTERNAL_FORMAT_BGR24
+    CAIRO_INTERNAL_FORMAT_BGR24,
+    CAIRO_INTERNAL_FORMAT_RGB16_565
 } cairo_internal_format_t;
 
 typedef enum cairo_direction {


More information about the cairo-commit mailing list