summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/os/os_time.c
diff options
context:
space:
mode:
authorJames Benton <jbenton@vmware.com>2012-12-03 07:00:37 +0000
committerJosé Fonseca <jfonseca@vmware.com>2012-12-03 17:21:57 +0000
commit16f0d70ffe6d42d22b9e6b927b297e75a199aa78 (patch)
tree743ca3f973a5389fd8ecb49c3181b2ae2b26dfd3 /src/gallium/auxiliary/os/os_time.c
parent041966801ec87e3bf32913e43d6882eca9434695 (diff)
llvmpipe: Implement PIPE_QUERY_TIMESTAMP and PIPE_QUERY_TIME_ELAPSED.
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 <airlied@redhat.com> Signed-off-by: José Fonseca <jfonseca@vmware.com>
Diffstat (limited to 'src/gallium/auxiliary/os/os_time.c')
-rw-r--r--src/gallium/auxiliary/os/os_time.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/os/os_time.c b/src/gallium/auxiliary/os/os_time.c
index 3e9d50a598a..40551252b25 100644
--- a/src/gallium/auxiliary/os/os_time.c
+++ b/src/gallium/auxiliary/os/os_time.c
@@ -36,6 +36,7 @@
#include "pipe/p_config.h"
#if defined(PIPE_OS_UNIX)
+# include <time.h> /* timeval */
# include <sys/time.h> /* timeval */
#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
# include <windows.h>
@@ -68,6 +69,20 @@ os_time_get(void)
}
+uint64_t
+os_time_get_nano(void)
+{
+#if defined(PIPE_OS_UNIX)
+ struct timespec tv;
+ clock_gettime(CLOCK_REALTIME, &tv);
+ return tv.tv_nsec + tv.tv_sec * 1000000000LL;
+
+#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
+ return os_time_get() * 1000;
+#endif
+}
+
+
#if defined(PIPE_SUBSYSTEM_WINDOWS_USER)
void