diff options
author | Marek Olšák <[email protected]> | 2014-01-22 01:29:18 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2014-01-28 01:39:39 +0100 |
commit | ba0c16f7b2283db9dbeef036cf54dd6b694e4eaa (patch) | |
tree | eb937dec47220c928a6af7e9a89f399fd7e8ac32 /src/gallium/drivers/radeon | |
parent | 4df3f25fa2c0bcf38be4a4fdcbb37428e4af10bd (diff) |
r600g,radeonsi: consolidate get_timestamp, get_driver_query_info
This enables more queries for the Gallium HUD with radeonsi.
Reviewed-by: Michel Dänzer <[email protected]>
Reviewed-by: Tom Stellard <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeon')
-rw-r--r-- | src/gallium/drivers/radeon/r600_pipe_common.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c index cabc6ef3259..ccd27fdff31 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.c +++ b/src/gallium/drivers/radeon/r600_pipe_common.c @@ -27,6 +27,7 @@ #include "r600_pipe_common.h" #include "r600_cs.h" #include "tgsi/tgsi_parse.h" +#include "util/u_memory.h" #include "util/u_format_s3tc.h" #include "util/u_upload_mgr.h" #include <inttypes.h> @@ -188,6 +189,36 @@ static const char* r600_get_name(struct pipe_screen* pscreen) } } +static uint64_t r600_get_timestamp(struct pipe_screen *screen) +{ + struct r600_common_screen *rscreen = (struct r600_common_screen*)screen; + + return 1000000 * rscreen->ws->query_value(rscreen->ws, RADEON_TIMESTAMP) / + rscreen->info.r600_clock_crystal_freq; +} + +static int r600_get_driver_query_info(struct pipe_screen *screen, + unsigned index, + struct pipe_driver_query_info *info) +{ + struct r600_common_screen *rscreen = (struct r600_common_screen*)screen; + struct pipe_driver_query_info list[] = { + {"draw-calls", R600_QUERY_DRAW_CALLS, 0}, + {"requested-VRAM", R600_QUERY_REQUESTED_VRAM, rscreen->info.vram_size, TRUE}, + {"requested-GTT", R600_QUERY_REQUESTED_GTT, rscreen->info.gart_size, TRUE}, + {"buffer-wait-time", R600_QUERY_BUFFER_WAIT_TIME, 0, FALSE} + }; + + if (!info) + return Elements(list); + + if (index >= Elements(list)) + return 0; + + *info = list[index]; + return 1; +} + static void r600_fence_reference(struct pipe_screen *screen, struct pipe_fence_handle **ptr, struct pipe_fence_handle *fence) @@ -343,6 +374,8 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen, rscreen->b.get_name = r600_get_name; rscreen->b.get_vendor = r600_get_vendor; + rscreen->b.get_driver_query_info = r600_get_driver_query_info; + rscreen->b.get_timestamp = r600_get_timestamp; rscreen->b.fence_finish = r600_fence_finish; rscreen->b.fence_reference = r600_fence_reference; rscreen->b.fence_signalled = r600_fence_signalled; |