From 16f0d70ffe6d42d22b9e6b927b297e75a199aa78 Mon Sep 17 00:00:00 2001 From: James Benton Date: Mon, 3 Dec 2012 07:00:37 +0000 Subject: llvmpipe: Implement PIPE_QUERY_TIMESTAMP and PIPE_QUERY_TIME_ELAPSED. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This required an update for the query storage in llvmpipe, there can now be an active query per query type, so an occlusion query can run at the same time as a time elapsed query. Based on PIPE_QUERY_TIME_ELAPSED patch from Dave Airlie. v2: fix up piglits for timers (also from Dave Airlie) a) if we don't render anything the result is 0, so just return the current time b) add missing screen get_timestamp callback. Signed-off-by: Dave Airlie Signed-off-by: José Fonseca --- src/gallium/drivers/llvmpipe/lp_screen.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/gallium/drivers/llvmpipe/lp_screen.c') diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 3f207d713af..acbde9da983 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -37,6 +37,7 @@ #include "draw/draw_context.h" #include "gallivm/lp_bld_type.h" +#include "os/os_time.h" #include "lp_texture.h" #include "lp_fence.h" #include "lp_jit.h" @@ -126,7 +127,8 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_OCCLUSION_QUERY: return 1; case PIPE_CAP_TIMER_QUERY: - return 0; + case PIPE_CAP_QUERY_TIMESTAMP: + return 1; case PIPE_CAP_TEXTURE_MIRROR_CLAMP: return 1; case PIPE_CAP_TEXTURE_SHADOW_MAP: @@ -210,7 +212,6 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT: return 16; case PIPE_CAP_START_INSTANCE: - case PIPE_CAP_QUERY_TIMESTAMP: case PIPE_CAP_TEXTURE_MULTISAMPLE: case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: case PIPE_CAP_CUBE_MAP_ARRAY: @@ -446,7 +447,11 @@ llvmpipe_fence_finish(struct pipe_screen *screen, return TRUE; } - +static uint64_t +llvmpipe_get_timestamp(struct pipe_screen *_screen) +{ + return os_time_get_nano(); +} /** * Create a new pipe_screen object @@ -491,6 +496,8 @@ llvmpipe_create_screen(struct sw_winsys *winsys) screen->base.fence_signalled = llvmpipe_fence_signalled; screen->base.fence_finish = llvmpipe_fence_finish; + screen->base.get_timestamp = llvmpipe_get_timestamp; + llvmpipe_init_screen_resource_funcs(&screen->base); lp_jit_screen_init(screen); -- cgit v1.2.3