diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2009-03-04 09:26:17 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2009-03-04 09:26:17 +0000 |
commit | 9099c7e7307a39bc630919faa65bba089fd15104 (patch) | |
tree | 0e72968431cf88427888c3828bd388559752eb85 /util/cairo-trace | |
parent | addeb32c751ac080fe634ea6f83076d018944e4a (diff) |
[trace] Disable mark dirty tracing.
Applications like firefox have a very conservative approach and mark
surfaces dirty before every render. As we record the image data every
time, firefox traces can grow very large with redundant data - so allow
the user to disable mark dirty tracing.
Diffstat (limited to 'util/cairo-trace')
-rw-r--r-- | util/cairo-trace/cairo-trace.in | 19 | ||||
-rw-r--r-- | util/cairo-trace/trace.c | 27 |
2 files changed, 35 insertions, 11 deletions
diff --git a/util/cairo-trace/cairo-trace.in b/util/cairo-trace/cairo-trace.in index 40c9d193..6660ff80 100644 --- a/util/cairo-trace/cairo-trace.in +++ b/util/cairo-trace/cairo-trace.in @@ -6,6 +6,7 @@ exec_prefix=@exec_prefix@ nofile= flush= nocallers= +nomarkdirty= usage() { cat << EOF @@ -14,10 +15,11 @@ cairo-trace will generate a log of all calls made by command to cairo. This log will be stored in a file in the local directory called command.pid.trace. Whatever else happens is driven by its argument: - --flush - Flush the output trace after every call. - --no-file - Disable the creation of an output file. Outputs to the - terminal instead. - --no-callers - Do not lookup the caller address/symbol/line whilst tracing. + --flush - Flush the output trace after every call. + --no-file - Disable the creation of an output file. Outputs to the + terminal instead. + --no-callers - Do not lookup the caller address/symbol/line whilst tracing. + --no-mark-dirty - Do not record image data for cairo_mark_dirty() Enviroment variables understood by cairo-trace: CAIRO_TRACE_FLUSH - flush the output after every function call. @@ -42,6 +44,10 @@ while test $skip -eq 1; do skip=1 nocallers=1 ;; + --no-mark-dirty) + skip=1 + nomarkdirty=1 + ;; --version) echo "cairo-trace, version @CAIRO_VERSION_MAJOR@.@CAIRO_VERSION_MINOR@.@CAIRO_VERSION_MICRO@." exit @@ -69,6 +75,11 @@ if test -n "$nocallers"; then export CAIRO_TRACE_LINE_INFO fi +if test -n "$nomarkdirty"; then + CAIRO_TRACE_MARK_DIRTY=0 + export CAIRO_TRACE_MARK_DIRTY +fi + if test -n "$flush"; then CAIRO_TRACE_FLUSH=1 export CAIRO_TRACE_FLUSH diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c index 029a7200..4a7096db 100644 --- a/util/cairo-trace/trace.c +++ b/util/cairo-trace/trace.c @@ -166,6 +166,7 @@ static FILE *logfile; static bool _flush; static bool _error; static bool _line_info; +static bool _mark_dirty; static const cairo_user_data_key_t destroy_key; #if __GNUC__ >= 3 @@ -692,6 +693,11 @@ _init_logfile (void) if (env != NULL) _line_info = atoi (env); + _mark_dirty = true; + env = getenv ("CAIRO_TRACE_MARK_DIRTY"); + if (env != NULL) + _mark_dirty = atoi (env); + filename = getenv ("CAIRO_TRACE_FD"); if (filename != NULL) { int fd = atoi (filename); @@ -3115,9 +3121,12 @@ cairo_surface_mark_dirty (cairo_surface_t *surface) { _emit_line_info (); if (surface != NULL && _write_lock ()) { - _emit_surface (surface); - _trace_printf ("%% mark-dirty\n"); - _emit_source_image (surface); + if (_mark_dirty) { + _emit_surface (surface); + _trace_printf ("%% mark-dirty\n"); + _emit_source_image (surface); + } else + _trace_printf ("%% s%ld mark-dirty\n", _get_surface_id (surface)); _write_unlock (); } @@ -3130,10 +3139,14 @@ cairo_surface_mark_dirty_rectangle (cairo_surface_t *surface, { _emit_line_info (); if (surface != NULL && _write_lock ()) { - _emit_surface (surface); - _trace_printf ("%% %d %d %d %d mark-dirty-rectangle\n", - x, y, width, height); - _emit_source_image_rectangle (surface, x,y, width, height); + if (_mark_dirty) { + _emit_surface (surface); + _trace_printf ("%% %d %d %d %d mark-dirty-rectangle\n", + x, y, width, height); + _emit_source_image_rectangle (surface, x,y, width, height); + } else + _trace_printf ("%% s%ld %d %d %d %d mark-dirty-rectangle\n", + _get_surface_id (surface), x, y, width, height); _write_unlock (); } |