summaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2015-02-24 01:26:13 +0100
committerMarek Olšák <[email protected]>2015-04-28 16:05:45 +0200
commit6d05396b0047c74d740c53156eda1a8574403498 (patch)
tree72ef5fdda0559f8c693acd8ebc7f98e85bdbc8fe /src/gallium/winsys
parent0b8e73a6ae2a77d0e9a7810cca5b181ba5f0893e (diff)
r600g,radeonsi: add a driver query returning GPU load
Reviewed-by: Alex Deucher <[email protected]>
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm_winsys.c16
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_winsys.h3
2 files changed, 19 insertions, 0 deletions
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
index b3e3cb29429..a6f847f6bd5 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
@@ -582,6 +582,21 @@ static uint64_t radeon_query_value(struct radeon_winsys *rws,
return 0;
}
+static void radeon_read_registers(struct radeon_winsys *rws,
+ unsigned reg_offset,
+ unsigned num_registers, uint32_t *out)
+{
+ struct radeon_drm_winsys *ws = (struct radeon_drm_winsys*)rws;
+ unsigned i;
+
+ for (i = 0; i < num_registers; i++) {
+ uint32_t reg = reg_offset + i*4;
+
+ radeon_get_drm_value(ws->fd, RADEON_INFO_READ_REG, "read-reg", &reg);
+ out[i] = reg;
+ }
+}
+
static unsigned hash_fd(void *key)
{
int fd = pointer_to_intptr(key);
@@ -728,6 +743,7 @@ radeon_drm_winsys_create(int fd, radeon_screen_create_t screen_create)
ws->base.surface_init = radeon_drm_winsys_surface_init;
ws->base.surface_best = radeon_drm_winsys_surface_best;
ws->base.query_value = radeon_query_value;
+ ws->base.read_registers = radeon_read_registers;
radeon_bomgr_init_functions(ws);
radeon_drm_cs_init_functions(ws);
diff --git a/src/gallium/winsys/radeon/drm/radeon_winsys.h b/src/gallium/winsys/radeon/drm/radeon_winsys.h
index 996a2017b07..ee0a9040709 100644
--- a/src/gallium/winsys/radeon/drm/radeon_winsys.h
+++ b/src/gallium/winsys/radeon/drm/radeon_winsys.h
@@ -589,6 +589,9 @@ struct radeon_winsys {
uint64_t (*query_value)(struct radeon_winsys *ws,
enum radeon_value_id value);
+
+ void (*read_registers)(struct radeon_winsys *ws, unsigned reg_offset,
+ unsigned num_registers, uint32_t *out);
};