[cairo-commit] 2 commits - perf/cairo-perf-trace.c src/cairo-ft-font.c

Chris Wilson ickle at kemper.freedesktop.org
Wed Jun 3 13:53:26 PDT 2009


 perf/cairo-perf-trace.c |   21 ++++++++++-----------
 src/cairo-ft-font.c     |    4 +++-
 2 files changed, 13 insertions(+), 12 deletions(-)

New commits:
commit 2eaced24475622e73fbf6e3307ab46e3fe37eaef
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jun 3 21:49:17 2009 +0100

    [perf] Reconstruct interpreter for each run
    
    Destroy the interpreter after each run of a trace so that we collect any
    left-over garbage.

diff --git a/perf/cairo-perf-trace.c b/perf/cairo-perf-trace.c
index 0312eb8..e8012cb 100644
--- a/perf/cairo-perf-trace.c
+++ b/perf/cairo-perf-trace.c
@@ -149,7 +149,6 @@ _similar_surface_create (void *closure,
 
 static void
 execute (cairo_perf_t		 *perf,
-	 cairo_script_interpreter_t *csi,
 	 cairo_surface_t	 *target,
 	 const char		 *trace)
 {
@@ -202,10 +201,13 @@ execute (cairo_perf_t		 *perf,
 	fflush (perf->summary);
     }
 
-    cairo_script_interpreter_install_hooks (csi, &hooks);
-
     low_std_dev_count = 0;
     for (i = 0; i < perf->iterations; i++) {
+	cairo_script_interpreter_t *csi;
+
+	csi = cairo_script_interpreter_create ();
+	cairo_script_interpreter_install_hooks (csi, &hooks);
+
 	cairo_perf_yield ();
 	cairo_perf_timer_start ();
 
@@ -215,6 +217,8 @@ execute (cairo_perf_t		 *perf,
 	cairo_perf_timer_stop ();
 	times[i] = cairo_perf_timer_elapsed ();
 
+	cairo_script_interpreter_destroy (csi);
+
 	if (perf->raw) {
 	    if (i == 0)
 		printf ("[*] %s.%s %s.%d %g",
@@ -405,7 +409,6 @@ have_trace_filenames (cairo_perf_t *perf)
 static void
 cairo_perf_trace (cairo_perf_t *perf,
 		  cairo_boilerplate_target_t *target,
-		  cairo_script_interpreter_t *csi,
 		  const char *trace)
 {
     cairo_surface_t *surface;
@@ -427,7 +430,7 @@ cairo_perf_trace (cairo_perf_t *perf,
 
     cairo_perf_timer_set_synchronize (target->synchronize, closure);
 
-    execute (perf, csi, surface, trace);
+    execute (perf, surface, trace);
 
     cairo_surface_destroy (surface);
 
@@ -451,7 +454,6 @@ int
 main (int argc, char *argv[])
 {
     cairo_perf_t perf;
-    cairo_script_interpreter_t *csi;
     const char *trace_dir = "cairo-traces";
     cairo_bool_t names_are_traces;
     unsigned int n;
@@ -477,8 +479,6 @@ main (int argc, char *argv[])
     perf.targets = cairo_boilerplate_get_targets (&perf.num_targets, NULL);
     perf.times = xmalloc (perf.iterations * sizeof (cairo_perf_ticks_t));
 
-    csi = cairo_script_interpreter_create ();
-
     /* do we have a list of filenames? */
     names_are_traces = have_trace_filenames (&perf);
 
@@ -494,7 +494,7 @@ main (int argc, char *argv[])
 	if (names_are_traces) {
 	    for (n = 0; n < perf.num_names; n++) {
 		if (access (perf.names[n], R_OK) == 0)
-		    cairo_perf_trace (&perf, target, csi, perf.names[n]);
+		    cairo_perf_trace (&perf, target, perf.names[n]);
 	    }
 	} else {
 	    DIR *dir;
@@ -522,7 +522,7 @@ main (int argc, char *argv[])
 		    continue;
 
 		xasprintf (&trace, "%s/%s", trace_dir, de->d_name);
-		cairo_perf_trace (&perf, target, csi, trace);
+		cairo_perf_trace (&perf, target, trace);
 		free (trace);
 
 	    }
@@ -538,7 +538,6 @@ main (int argc, char *argv[])
 	    break;
     }
 
-    cairo_script_interpreter_destroy (csi);
     cairo_perf_fini (&perf);
 
     return 0;
commit 1b92ea250fdaef9add1a68bb8565847e6d56b023
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jun 3 20:28:49 2009 +0100

    [ft] Don't call FT_Done_Face() on a face we do not own
    
    _font_map_release_face_lock_held() was being called unconditionally during
    _cairo_ft_font_reset_static_data(). This presents two problems. The first
    is that we call FT_Done_Face() on an object not owned by cairo, and the
    second is that the bookkeeping is then incorrect which will trigger an
    assert later.

diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index 6c64284..50dd6de 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -235,7 +235,9 @@ _cairo_ft_unscaled_font_map_pluck_entry (void *entry, void *closure)
     _cairo_hash_table_remove (font_map->hash_table,
 			      &unscaled->base.hash_entry);
 
-    _font_map_release_face_lock_held (font_map, unscaled);
+    if (! unscaled->from_face)
+	_font_map_release_face_lock_held (font_map, unscaled);
+
     _cairo_ft_unscaled_font_fini (unscaled);
     free (unscaled);
 }


More information about the cairo-commit mailing list