[cairo-commit] 3 commits - perf/cairo-perf-posix.c util/cairo-script util/cairo-trace

Andrea Canciani ranma42 at kemper.freedesktop.org
Wed Mar 31 07:16:19 PDT 2010


 perf/cairo-perf-posix.c                  |    7 +++++++
 util/cairo-script/cairo-script-scanner.c |   30 +++++++++++++++---------------
 util/cairo-trace/trace.c                 |   15 +++++++++++++++
 3 files changed, 37 insertions(+), 15 deletions(-)

New commits:
commit a81d347c2484e60ceec1d9dc81e1b88724496eaf
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Fri Feb 5 22:34:51 2010 +0100

    perf: Fix timestamp computation on MacOS X
    
    The OIL routines don't work as expected on MacOS X. The operating
    system gives access to the timestamp counter through the function
    mach_absolute_time.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/perf/cairo-perf-posix.c b/perf/cairo-perf-posix.c
index 68b78d0..50a415d 100644
--- a/perf/cairo-perf-posix.c
+++ b/perf/cairo-perf-posix.c
@@ -132,6 +132,13 @@ oil_profile_stamp_s390(void)
 #endif
 #endif
 
+#if defined(__APPLE__)
+#include <mach/mach_time.h>
+#undef OIL_STAMP
+#define OIL_STAMP mach_absolute_time
+#endif
+
+
 typedef struct _cairo_perf_timer {
 #if defined(CLOCK)
     struct timespec tv_start;
commit 55ce0b774869e9fa614c6f9fec7905f7205cb5ff
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Fri Feb 5 22:30:05 2010 +0100

    script: Fix script scanner endianness
    
    The script interpreter was reading the length of compressed data as
    an host-endian uint32_t, thus making cairo-script able to correctly
    read traces that were produced on the same endianness as the one they
    ran upon, but unsuitable for portabile cairo-scripts.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/util/cairo-script/cairo-script-scanner.c b/util/cairo-script/cairo-script-scanner.c
index 0422fe0..24d1616 100644
--- a/util/cairo-script/cairo-script-scanner.c
+++ b/util/cairo-script/cairo-script-scanner.c
@@ -43,6 +43,20 @@
 
 #define DEBUG_SCAN 0
 
+#if WORDS_BIGENDIAN
+#define le16(x) bswap_16 (x)
+#define le32(x) bswap_32 (x)
+#define be16(x) x
+#define be32(x) x
+#define to_be32(x) x
+#else
+#define le16(x) x
+#define le32(x) x
+#define be16(x) bswap_16 (x)
+#define be32(x) bswap_32 (x)
+#define to_be32(x) bswap_32 (x)
+#endif
+
 /*
  * whitespace:
  * 0 - nul
@@ -639,7 +653,7 @@ base85_end (csi_t *ctx, csi_scanner_t *scan, cairo_bool_t deflate)
     }
 
     if (deflate) {
-	uLongf len = *(uint32_t *) scan->buffer.base;
+        uLongf len = be32 (*(uint32_t *) scan->buffer.base);
 	Bytef *source = (Bytef *) (scan->buffer.base + sizeof (uint32_t));
 
 	status = csi_string_deflate_new (ctx, &obj,
@@ -766,20 +780,6 @@ scan_read (csi_scanner_t *scan, csi_file_t *src, void *ptr, int len)
     } while (_csi_unlikely (len));
 }
 
-#if WORDS_BIGENDIAN
-#define le16(x) bswap_16 (x)
-#define le32(x) bswap_32 (x)
-#define be16(x) x
-#define be32(x) x
-#define to_be32(x) x
-#else
-#define le16(x) x
-#define le32(x) x
-#define be16(x) bswap_16 (x)
-#define be32(x) bswap_32 (x)
-#define to_be32(x) bswap_32 (x)
-#endif
-
 static void
 string_read (csi_t *ctx,
 	     csi_scanner_t *scan,
commit 4f617eaf77540ba2140086bd5a19fe6d62503d62
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Fri Feb 5 22:27:28 2010 +0100

    trace: Fix trace endianness
    
    Trace files were using host-endian to represent the length of
    compressed data, making the trace format not portable.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c
index 36ca3e0..fd83ee9 100644
--- a/util/cairo-trace/trace.c
+++ b/util/cairo-trace/trace.c
@@ -71,6 +71,20 @@
 	  ((((uint32_t)(p)))              >> 24))
 #endif
 
+#if WORDS_BIGENDIAN
+#define le16(x) bswap_16 (x)
+#define le32(x) bswap_32 (x)
+#define be16(x) x
+#define be32(x) x
+#define to_be32(x) x
+#else
+#define le16(x) x
+#define le32(x) x
+#define be16(x) bswap_16 (x)
+#define be32(x) bswap_32 (x)
+#define to_be32(x) bswap_32 (x)
+#endif
+
 #if CAIRO_HAS_SYMBOL_LOOKUP
 #include "lookup-symbol.h"
 #endif
@@ -1366,6 +1380,7 @@ _write_data_start (struct _data_stream *stream, uint32_t len)
     _write_base85_data_start (stream);
 
     _trace_printf ("<|");
+    len = to_be32 (len);
     _write_base85_data (stream, (unsigned char *) &len, sizeof (len));
 }
 


More information about the cairo-commit mailing list