From: Nicolai Hähnle <[email protected]>

---
 src/gallium/drivers/radeonsi/si_debug.c      | 5 ++++-
 src/gallium/drivers/radeonsi/si_hw_context.c | 3 +++
 src/gallium/drivers/radeonsi/si_pipe.h       | 1 +
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_debug.c 
b/src/gallium/drivers/radeonsi/si_debug.c
index 1aca98bcde7..fbb8e4c43de 100644
--- a/src/gallium/drivers/radeonsi/si_debug.c
+++ b/src/gallium/drivers/radeonsi/si_debug.c
@@ -23,20 +23,21 @@
  * Authors:
  *      Marek Olšák <[email protected]>
  */
 
 #include "si_pipe.h"
 #include "si_compute.h"
 #include "sid.h"
 #include "gfx9d.h"
 #include "sid_tables.h"
 #include "ddebug/dd_util.h"
+#include "util/u_dump.h"
 #include "util/u_log.h"
 #include "util/u_memory.h"
 #include "ac_debug.h"
 
 static void si_dump_bo_list(struct si_context *sctx,
                            const struct radeon_saved_cs *saved, FILE *f);
 
 DEBUG_GET_ONCE_OPTION(replace_shaders, "RADEON_REPLACE_SHADERS", NULL)
 
 static void si_dump_shader(struct si_screen *sscreen,
@@ -369,21 +370,23 @@ static void si_log_chunk_type_cs_print(void *data, FILE 
*f)
                                    &last_trace_id, map ? 1 : 0, "IB", 
ctx->b.chip_class,
                                    NULL, NULL);
                } else {
                        si_parse_current_ib(f, ctx->b.gfx.cs, chunk->gfx_begin,
                                            chunk->gfx_end, &last_trace_id, map 
? 1 : 0,
                                            "IB", ctx->b.chip_class);
                }
        }
 
        if (chunk->dump_bo_list) {
-               fprintf(f, "Flushing.\n\n");
+               fprintf(f, "Flushing. Time: ");
+               util_dump_ns(f, scs->time_flush);
+               fprintf(f, "\n\n");
                si_dump_bo_list(ctx, &scs->gfx, f);
        }
 }
 
 static const struct u_log_chunk_type si_log_chunk_type_cs = {
        .destroy = si_log_chunk_type_cs_destroy,
        .print = si_log_chunk_type_cs_print,
 };
 
 static void si_log_cs(struct si_context *ctx, struct u_log_context *log,
diff --git a/src/gallium/drivers/radeonsi/si_hw_context.c 
b/src/gallium/drivers/radeonsi/si_hw_context.c
index 317b50c8aa8..bc8b1e78f29 100644
--- a/src/gallium/drivers/radeonsi/si_hw_context.c
+++ b/src/gallium/drivers/radeonsi/si_hw_context.c
@@ -20,20 +20,22 @@
  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  * USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
  * Authors:
  *      Jerome Glisse
  */
 
 #include "si_pipe.h"
 #include "radeon/r600_cs.h"
 
+#include "util/os_time.h"
+
 void si_destroy_saved_cs(struct si_saved_cs *scs)
 {
        si_clear_saved_cs(&scs->gfx);
        r600_resource_reference(&scs->trace_buf, NULL);
        free(scs);
 }
 
 /* initialize */
 void si_need_cs_space(struct si_context *ctx)
 {
@@ -116,20 +118,21 @@ void si_context_gfx_flush(void *context, unsigned flags,
 
        si_emit_cache_flush(ctx);
 
        if (ctx->current_saved_cs) {
                si_trace_emit(ctx);
                si_log_hw_flush(ctx);
 
                /* Save the IB for debug contexts. */
                si_save_cs(ws, cs, &ctx->current_saved_cs->gfx, true);
                ctx->current_saved_cs->flushed = true;
+               ctx->current_saved_cs->time_flush = os_time_get_nano();
        }
 
        /* Flush the CS. */
        ws->cs_flush(cs, flags, &ctx->b.last_gfx_fence);
        if (fence)
                ws->fence_reference(fence, ctx->b.last_gfx_fence);
        ctx->b.num_gfx_cs_flushes++;
 
        /* Check VM faults if needed. */
        if (ctx->screen->b.debug_flags & DBG(CHECK_VM)) {
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h 
b/src/gallium/drivers/radeonsi/si_pipe.h
index 701b051e60f..0d638e13206 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -340,20 +340,21 @@ struct si_image_handle
 
 struct si_saved_cs {
        struct pipe_reference   reference;
        struct si_context       *ctx;
        struct radeon_saved_cs  gfx;
        struct r600_resource    *trace_buf;
        unsigned                trace_id;
 
        unsigned                gfx_last_dw;
        bool                    flushed;
+       int64_t                 time_flush;
 };
 
 struct si_context {
        struct r600_common_context      b;
        struct blitter_context          *blitter;
        void                            *custom_dsa_flush;
        void                            *custom_blend_resolve;
        void                            *custom_blend_fmask_decompress;
        void                            *custom_blend_eliminate_fastclear;
        void                            *custom_blend_dcc_decompress;
-- 
2.11.0

_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to