trace: Don't dump texture transfers.
authorJosé Fonseca <jfonseca@vmware.com>
Thu, 20 Jun 2013 18:37:31 +0000 (19:37 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Fri, 21 Jun 2013 13:30:19 +0000 (14:30 +0100)
Huge trace files with little value.
Reviewed-by: Brian Paul <brianp@vmware.com>
src/gallium/drivers/trace/tr_context.c
src/gallium/drivers/trace/tr_dump.c
src/gallium/drivers/trace/tr_dump.h

index d78dd3ed3479533645c9bdca3b496cf8c4c5e9bc..5514f62239cd8440f627afae1389ccbee0ebcbdd 100644 (file)
@@ -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);
index 7111e0d174dea5ef68bbdcf6b3ededf43c70104e..b6ab5038197fcfe49052ff462aab84f4ac860325 100644 (file)
@@ -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);
index 4737a93a6c3e7f9e82cc6dfd9d7d259efd6bac00..4758755fcf4fef4da8b445aa6e8b7175c01fd144 100644 (file)
@@ -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);