freedreno: track staging and shadow perf ctrs for the HUD
authorRob Clark <robdclark@gmail.com>
Tue, 21 Nov 2017 18:20:53 +0000 (13:20 -0500)
committerRob Clark <robdclark@gmail.com>
Sun, 17 Dec 2017 17:41:32 +0000 (12:41 -0500)
Signed-off-by: Rob Clark <robdclark@gmail.com>
src/gallium/drivers/freedreno/freedreno_context.h
src/gallium/drivers/freedreno/freedreno_query.c
src/gallium/drivers/freedreno/freedreno_query.h
src/gallium/drivers/freedreno/freedreno_query_sw.c
src/gallium/drivers/freedreno/freedreno_resource.c

index 2f501cf815b42f9be0ba6f56b4de617dd12eb422..d8d23ad8539c3312d33b3894748b4cf39464ef39 100644 (file)
@@ -216,6 +216,7 @@ struct fd_context {
                uint64_t prims_generated;
                uint64_t draw_calls;
                uint64_t batch_total, batch_sysmem, batch_gmem, batch_restore;
+               uint64_t staging_uploads, shadow_uploads;
        } stats;
 
        /* Current batch.. the rule here is that you can deref ctx->batch
index 0d7bc9f205bd4a39f4f6b3e5277c18c14056fcd8..d76994e5d9e96fd09d2158e11c6873b739f29e8a 100644 (file)
@@ -129,6 +129,8 @@ fd_get_driver_query_info(struct pipe_screen *pscreen,
                        {"batches-gmem", FD_QUERY_BATCH_GMEM, {0}},
                        {"restores", FD_QUERY_BATCH_RESTORE, {0}},
                        {"prims-emitted", PIPE_QUERY_PRIMITIVES_EMITTED, {0}},
+                       {"staging", FD_QUERY_STAGING_UPLOADS, {0}},
+                       {"shadow", FD_QUERY_SHADOW_UPLOADS, {0}},
        };
 
        if (!info)
index a391a7a0ff8bb80752d5d86cb687600e2db69f7d..78717c687012ad6def88bade5e8dc6540573ecb5 100644 (file)
@@ -61,6 +61,8 @@ fd_query(struct pipe_query *pq)
 #define FD_QUERY_BATCH_SYSMEM    (PIPE_QUERY_DRIVER_SPECIFIC + 2)  /* batches using system memory (GMEM bypass) */
 #define FD_QUERY_BATCH_GMEM      (PIPE_QUERY_DRIVER_SPECIFIC + 3)  /* batches using GMEM */
 #define FD_QUERY_BATCH_RESTORE   (PIPE_QUERY_DRIVER_SPECIFIC + 4)  /* batches requiring GMEM restore */
+#define FD_QUERY_STAGING_UPLOADS (PIPE_QUERY_DRIVER_SPECIFIC + 5)  /* texture/buffer uploads using staging blit */
+#define FD_QUERY_SHADOW_UPLOADS  (PIPE_QUERY_DRIVER_SPECIFIC + 6)  /* texture/buffer uploads that shadowed rsc */
 
 void fd_query_screen_init(struct pipe_screen *pscreen);
 void fd_query_context_init(struct pipe_context *pctx);
index 50965161146ea6da83b55e32b840e83b620a7659..93da2dc08e1d8ebedf0642e35d356d08e55553ac 100644 (file)
@@ -67,6 +67,10 @@ read_counter(struct fd_context *ctx, int type)
                return ctx->stats.batch_gmem;
        case FD_QUERY_BATCH_RESTORE:
                return ctx->stats.batch_restore;
+       case FD_QUERY_STAGING_UPLOADS:
+               return ctx->stats.staging_uploads;
+       case FD_QUERY_SHADOW_UPLOADS:
+               return ctx->stats.shadow_uploads;
        }
        return 0;
 }
@@ -79,6 +83,8 @@ is_rate_query(struct fd_query *q)
        case FD_QUERY_BATCH_SYSMEM:
        case FD_QUERY_BATCH_GMEM:
        case FD_QUERY_BATCH_RESTORE:
+       case FD_QUERY_STAGING_UPLOADS:
+       case FD_QUERY_SHADOW_UPLOADS:
                return true;
        default:
                return false;
@@ -142,6 +148,8 @@ fd_sw_create_query(struct fd_context *ctx, unsigned query_type)
        case FD_QUERY_BATCH_SYSMEM:
        case FD_QUERY_BATCH_GMEM:
        case FD_QUERY_BATCH_RESTORE:
+       case FD_QUERY_STAGING_UPLOADS:
+       case FD_QUERY_SHADOW_UPLOADS:
                break;
        default:
                return NULL;
index e1375d24837ef8dd2f654274ad3995620db24c4b..a04c49b7094e9eff24cd596d30c01b3efbef8608 100644 (file)
@@ -500,6 +500,7 @@ fd_resource_transfer_map(struct pipe_context *pctx,
                        if (needs_flush && fd_try_shadow_resource(ctx, rsc, level, box)) {
                                needs_flush = busy = false;
                                rebind_resource(ctx, prsc);
+                               ctx->stats.shadow_uploads++;
                        } else {
                                struct fd_resource *staging_rsc;
 
@@ -531,6 +532,8 @@ fd_resource_transfer_map(struct pipe_context *pctx,
 
                                        fd_batch_reference(&write_batch, NULL);
 
+                                       ctx->stats.staging_uploads++;
+
                                        return buf;
                                }
                        }