[Mesa-dev] [PATCH 1/6] trace: Don't dump texture transfers.

jfonseca at vmware.com jfonseca at vmware.com
Fri Jun 21 04:53:25 PDT 2013


From: José Fonseca <jfonseca at vmware.com>

Huge trace files with little value.
---
 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 d78dd3e..5514f62 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 7111e0d..b6ab503 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 4737a93..4758755 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);
-- 
1.8.1.2



More information about the mesa-dev mailing list