#include "util/u_memory.h"
#include "util/u_bitmask.h"
#include "util/u_upload_mgr.h"
-#include "os/os_time.h"
#include "svga_context.h"
#include "svga_screen.h"
/* Flush pending commands to hardware:
*/
- t0 = os_time_get();
+ t0 = svga_get_time(svga);
svga->swc->flush(svga->swc, &fence);
- svga->hud.flush_time += (os_time_get() - t0);
+ svga->hud.flush_time += (svga_get_time(svga) - t0);
svga->hud.num_flushes++;
#include "pipe/p_defines.h"
#include "pipe/p_state.h"
+#include "os/os_time.h"
+
#include "util/u_blitter.h"
#include "util/list.h"
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 */
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
case SVGA_QUERY_NUM_FALLBACKS:
case SVGA_QUERY_NUM_FLUSHES:
case SVGA_QUERY_NUM_VALIDATIONS:
- case SVGA_QUERY_MAP_BUFFER_TIME:
case SVGA_QUERY_NUM_RESOURCES_MAPPED:
case SVGA_QUERY_NUM_BYTES_UPLOADED:
case SVGA_QUERY_COMMAND_BUFFER_SIZE:
- case SVGA_QUERY_FLUSH_TIME:
case SVGA_QUERY_SURFACE_WRITE_FLUSHES:
case SVGA_QUERY_MEMORY_USED:
case SVGA_QUERY_NUM_SHADERS:
case SVGA_QUERY_NUM_CONST_BUF_UPDATES:
case SVGA_QUERY_NUM_CONST_UPDATES:
break;
+ case SVGA_QUERY_FLUSH_TIME:
+ case SVGA_QUERY_MAP_BUFFER_TIME:
+ /* These queries need os_time_get() */
+ svga->hud.uses_time = TRUE;
+ break;
default:
assert(!"unexpected query type in svga_create_query()");
}
#include "pipe/p_defines.h"
#include "util/u_inlines.h"
#include "os/os_thread.h"
-#include "os/os_time.h"
#include "util/u_math.h"
#include "util/u_memory.h"
#include "util/u_resource.h"
struct svga_buffer *sbuf = svga_buffer(resource);
struct pipe_transfer *transfer;
uint8_t *map;
- int64_t begin = os_time_get();
+ int64_t begin = svga_get_time(svga);
assert(box->y == 0);
assert(box->z == 0);
FREE(transfer);
}
- svga->hud.map_buffer_time += (os_time_get() - begin);
+ svga->hud.map_buffer_time += (svga_get_time(svga) - begin);
return map;
}
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
#include "os/os_thread.h"
-#include "os/os_time.h"
#include "util/u_format.h"
#include "util/u_inlines.h"
#include "util/u_math.h"
!svga_have_gb_dma(svga);
unsigned d;
void *returnVal;
- int64_t begin = os_time_get();
+ int64_t begin = svga_get_time(svga);
/* We can't map texture storage directly unless we have GB objects */
if (usage & PIPE_TRANSFER_MAP_DIRECTLY) {
returnVal = (void *) (map + offset);
}
- svga->hud.map_buffer_time += (os_time_get() - begin);
+ svga->hud.map_buffer_time += (svga_get_time(svga) - begin);
svga->hud.num_resources_mapped++;
return returnVal;