[Mesa-dev] [PATCH 3/4] winsys/radeon: Keep bo statistics
Lauri Kasanen
cand at gmx.com
Wed Jan 1 06:58:20 PST 2014
These will be used later on for optimizing the VRAM placement.
Currently some glxgears overhead (~7% less), real apps yet to be benched.
Signed-off-by: Lauri Kasanen <cand at gmx.com>
---
src/gallium/winsys/radeon/drm/radeon_drm_bo.c | 3 +++
src/gallium/winsys/radeon/drm/radeon_drm_bo.h | 16 ++++++++++++++++
src/gallium/winsys/radeon/drm/radeon_drm_cs.c | 8 ++++++++
3 files changed, 27 insertions(+)
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
index e94af60..61d489c 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
@@ -529,6 +529,9 @@ static void *radeon_bo_map(struct radeon_winsys_cs_handle *buf,
fprintf(ws->bo_stats_file, "%p cpu mapped @%llu\n", bo, stats_time_get());
}
+ bo->stats.num_cpu_ops++;
+ bo->stats.last_cpu_time = stats_time_get();
+
return radeon_bo_do_map(bo);
}
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.h b/src/gallium/winsys/radeon/drm/radeon_drm_bo.h
index 0f7e1f0..a18e5fb 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.h
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.h
@@ -45,6 +45,20 @@ struct radeon_bo_desc {
unsigned initial_domains;
};
+struct radeon_bo_stats {
+ uint64_t num_reads;
+ uint64_t num_writes;
+ uint64_t num_cpu_ops;
+
+ /* Milliseconds in a monotonic clock */
+ uint64_t last_read_time;
+ uint64_t last_write_time;
+ uint64_t last_cpu_time;
+
+ /* Depth, MSAA, etc. */
+ bool high_prio;
+};
+
struct radeon_bo {
struct pb_buffer base;
@@ -68,6 +82,8 @@ struct radeon_bo {
boolean flinked;
uint32_t flink;
+
+ struct radeon_bo_stats stats;
};
struct pb_manager *radeon_bomgr_create(struct radeon_drm_winsys *rws);
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
index f3d9b1f..407d8bd 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
@@ -361,6 +361,14 @@ static unsigned radeon_drm_cs_add_reloc(struct radeon_winsys_cs *rcs,
}
}
+ if (usage & RADEON_USAGE_WRITE) {
+ bo->stats.num_writes++;
+ bo->stats.last_write_time = stats_time_get();
+ } else {
+ bo->stats.num_reads++;
+ bo->stats.last_read_time = stats_time_get();
+ }
+
return index;
}
--
1.8.3.1
More information about the mesa-dev
mailing list