freedreno/a6xx: timestamp logging support
authorRob Clark <robdclark@chromium.org>
Sat, 28 Mar 2020 17:43:42 +0000 (10:43 -0700)
committerMarge Bot <eric+marge@anholt.net>
Mon, 30 Mar 2020 23:20:13 +0000 (23:20 +0000)
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4366>

src/gallium/drivers/freedreno/a6xx/fd6_context.c
src/gallium/drivers/freedreno/a6xx/fd6_query.c

index 63d7ecedb4f3d0e7058bdd39524e0e7b6bbec9e1..6eb8e1f979d6aeaead51bc0411f2b316af9db006 100644 (file)
@@ -152,6 +152,7 @@ PC_UNKNOWN_9805:
        fd6_texture_init(pctx);
        fd6_prog_init(pctx);
        fd6_emit_init(pctx);
+       fd6_query_context_init(pctx);
 
        pctx = fd_context_init(&fd6_ctx->base, pscreen, primtypes, priv, flags);
        if (!pctx)
@@ -179,7 +180,6 @@ PC_UNKNOWN_9805:
 
        fd_context_setup_common_vbos(&fd6_ctx->base);
 
-       fd6_query_context_init(pctx);
        fd6_blitter_init(pctx);
 
        fd6_ctx->border_color_uploader = u_upload_create(pctx, 4096, 0,
index 90b93288d2afbf09db9e6b5b2363e6ae19893ff3..d99dd70bde3af6fb927ddc8201ea0e5682b35483 100644 (file)
@@ -204,8 +204,19 @@ timestamp_pause(struct fd_acc_query *aq, struct fd_batch *batch)
        /* We captured a timestamp in timestamp_resume(), nothing to do here. */
 }
 
+/* timestamp logging for fd_log(): */
+static void
+record_timestamp(struct fd_ringbuffer *ring, struct fd_bo *bo, unsigned offset)
+{
+       OUT_PKT7(ring, CP_EVENT_WRITE, 4);
+       OUT_RING(ring, CP_EVENT_WRITE_0_EVENT(CACHE_FLUSH_AND_INV_EVENT) |
+                       CP_EVENT_WRITE_0_TIMESTAMP);
+       OUT_RELOCW(ring, bo, offset, 0, 0);
+       OUT_RING(ring, 0x00000000);
+}
+
 static uint64_t
-ticks_to_ns(uint32_t ts)
+ticks_to_ns(uint64_t ts)
 {
        /* This is based on the 19.2MHz always-on rbbm timer.
         *
@@ -637,6 +648,9 @@ fd6_query_context_init(struct pipe_context *pctx)
        ctx->create_query = fd_acc_create_query;
        ctx->query_set_stage = fd_acc_query_set_stage;
 
+       ctx->record_timestamp = record_timestamp;
+       ctx->ts_to_ns = ticks_to_ns;
+
        pctx->create_batch_query = fd6_create_batch_query;
 
        fd_acc_query_register_provider(pctx, &occlusion_counter);