aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeon/r600_gpu_load.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/radeon/r600_gpu_load.c')
-rw-r--r--src/gallium/drivers/radeon/r600_gpu_load.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeon/r600_gpu_load.c b/src/gallium/drivers/radeon/r600_gpu_load.c
index 764d9b57262..e3488b3ac75 100644
--- a/src/gallium/drivers/radeon/r600_gpu_load.c
+++ b/src/gallium/drivers/radeon/r600_gpu_load.c
@@ -42,6 +42,7 @@
#define SAMPLES_PER_SEC 10000
#define GRBM_STATUS 0x8010
+#define SPI_BUSY(x) (((x) >> 22) & 0x1)
#define GUI_ACTIVE(x) (((x) >> 31) & 0x1)
static void r600_update_grbm_counters(struct r600_common_screen *rscreen,
@@ -51,6 +52,11 @@ static void r600_update_grbm_counters(struct r600_common_screen *rscreen,
rscreen->ws->read_registers(rscreen->ws, GRBM_STATUS, 1, &value);
+ if (SPI_BUSY(value))
+ p_atomic_inc(&counters->named.spi_busy);
+ else
+ p_atomic_inc(&counters->named.spi_idle);
+
if (GUI_ACTIVE(value))
p_atomic_inc(&counters->named.gui_busy);
else
@@ -144,6 +150,16 @@ static unsigned r600_end_counter(struct r600_common_screen *rscreen,
#define BUSY_INDEX(rscreen, field) (&rscreen->grbm_counters.named.field##_busy - \
rscreen->grbm_counters.array)
+uint64_t r600_begin_counter_spi(struct r600_common_screen *rscreen)
+{
+ return r600_read_counter(rscreen, BUSY_INDEX(rscreen, spi));
+}
+
+unsigned r600_end_counter_spi(struct r600_common_screen *rscreen, uint64_t begin)
+{
+ return r600_end_counter(rscreen, begin, BUSY_INDEX(rscreen, spi));
+}
+
uint64_t r600_begin_counter_gui(struct r600_common_screen *rscreen)
{
return r600_read_counter(rscreen, BUSY_INDEX(rscreen, gui));