summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/svga/svga_context.h
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2016-08-02 14:27:33 -0600
committerBrian Paul <[email protected]>2016-08-16 08:24:53 -0600
commitf934117bbb9d58f0f5d9cfb4397fec9c6371ed64 (patch)
treebd4a5be0cbfbf7ff58cd26e3bd7db271a8ea1771 /src/gallium/drivers/svga/svga_context.h
parentdcf2126f90a1daf226417bde71a62ccf0305adea (diff)
svga: don't call os_get_time() when not needed by Gallium HUD
The calls to os_get_time() were showing up higher than expected in profiles. Reviewed-by: Charmaine Lee <[email protected]>
Diffstat (limited to 'src/gallium/drivers/svga/svga_context.h')
-rw-r--r--src/gallium/drivers/svga/svga_context.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h
index 4eb8a190879..1e62e715c3e 100644
--- a/src/gallium/drivers/svga/svga_context.h
+++ b/src/gallium/drivers/svga/svga_context.h
@@ -31,6 +31,8 @@
#include "pipe/p_defines.h"
#include "pipe/p_state.h"
+#include "os/os_time.h"
+
#include "util/u_blitter.h"
#include "util/list.h"
@@ -544,6 +546,8 @@ struct svga_context
uint64_t num_surface_views; /**< SVGA_QUERY_NUM_SURFACE_VIEWS */
uint64_t num_bytes_uploaded; /**< SVGA_QUERY_NUM_BYTES_UPLOADED */
uint64_t num_generate_mipmap; /**< SVGA_QUERY_NUM_GENERATE_MIPMAP */
+
+ boolean uses_time; /**< os_time_get() calls needed? */
} hud;
/** The currently bound stream output targets */
@@ -703,4 +707,15 @@ svga_rects_equal(const SVGA3dRect *r1, const SVGA3dRect *r2)
return memcmp(r1, r2, sizeof(*r1)) == 0;
}
+/**
+ * If the Gallium HUD is enabled, this will return the current time.
+ * Otherwise, just return zero.
+ */
+static inline int64_t
+svga_get_time(struct svga_context *svga)
+{
+ return svga->hud.uses_time ? os_time_get() : 0;
+}
+
+
#endif