From a8f7e12d92a8c3dab8ec2e821f51ed711849f1b5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 20 Jun 2013 19:37:31 +0100 Subject: [PATCH] trace: Don't dump texture transfers. Huge trace files with little value. Reviewed-by: Brian Paul --- src/gallium/drivers/trace/tr_context.c | 4 ++-- src/gallium/drivers/trace/tr_dump.c | 23 ++++++++++++++++------- src/gallium/drivers/trace/tr_dump.h | 2 +- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index d78dd3ed347..5514f62239c 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -1418,7 +1418,7 @@ trace_context_transfer_unmap(struct pipe_context *_context, trace_dump_arg_begin("data"); trace_dump_box_bytes(tr_trans->map, - resource->format, + resource, box, stride, layer_stride); @@ -1464,7 +1464,7 @@ trace_context_transfer_inline_write(struct pipe_context *_context, trace_dump_arg_begin("data"); trace_dump_box_bytes(data, - resource->format, + resource, box, stride, layer_stride); diff --git a/src/gallium/drivers/trace/tr_dump.c b/src/gallium/drivers/trace/tr_dump.c index 7111e0d174d..b6ab5038197 100644 --- a/src/gallium/drivers/trace/tr_dump.c +++ b/src/gallium/drivers/trace/tr_dump.c @@ -495,19 +495,28 @@ void trace_dump_bytes(const void *data, } void trace_dump_box_bytes(const void *data, - enum pipe_format format, + struct pipe_resource *resource, const struct pipe_box *box, unsigned stride, unsigned slice_stride) { size_t size; - if (slice_stride) - size = box->depth * slice_stride; - else if (stride) - size = util_format_get_nblocksy(format, box->height) * stride; - else { - size = util_format_get_nblocksx(format, box->width) * util_format_get_blocksize(format); + /* + * Only dump buffer transfers to avoid huge files. + * TODO: Make this run-time configurable + */ + if (resource->target != PIPE_BUFFER) { + size = 0; + } else { + enum pipe_format format = resource->format; + if (slice_stride) + size = box->depth * slice_stride; + else if (stride) + size = util_format_get_nblocksy(format, box->height) * stride; + else { + size = util_format_get_nblocksx(format, box->width) * util_format_get_blocksize(format); + } } trace_dump_bytes(data, size); diff --git a/src/gallium/drivers/trace/tr_dump.h b/src/gallium/drivers/trace/tr_dump.h index 4737a93a6c3..4758755fcf4 100644 --- a/src/gallium/drivers/trace/tr_dump.h +++ b/src/gallium/drivers/trace/tr_dump.h @@ -88,7 +88,7 @@ void trace_dump_uint(long long unsigned value); void trace_dump_float(double value); void trace_dump_bytes(const void *data, size_t size); void trace_dump_box_bytes(const void *data, - enum pipe_format format, + struct pipe_resource *resource, const struct pipe_box *box, unsigned stride, unsigned slice_stride); -- 2.30.2