static void
fd_sw_end_query(struct fd_context *ctx, struct fd_query *q)
{
	struct fd_sw_query *sq = fd_sw_query(q);
	sq->end_value = read_counter(ctx, q->type);
	if (is_rate_query(q))
		sq->end_time = os_time_get();
}
static boolean
fd_sw_begin_query(struct fd_context *ctx, struct fd_query *q)
{
	struct fd_sw_query *sq = fd_sw_query(q);
	sq->begin_value = read_counter(ctx, q->type);
	if (is_rate_query(q))
		sq->begin_time = os_time_get();
   return true;
}
static void
fd_sw_end_query(struct fd_context *ctx, struct fd_query *q)
{
	struct fd_sw_query *sq = fd_sw_query(q);
	sq->end_value = read_counter(ctx, q->type);
	if (is_time_rate_query(q)) {
		sq->end_time = os_time_get();
	} else if (is_draw_rate_query(q)) {
		sq->end_time = ctx->stats.draw_calls;
	}
}
static boolean
fd_sw_begin_query(struct fd_context *ctx, struct fd_query *q)
{
	struct fd_sw_query *sq = fd_sw_query(q);
	sq->begin_value = read_counter(ctx, q->type);
	if (is_time_rate_query(q)) {
		sq->begin_time = os_time_get();
	} else if (is_draw_rate_query(q)) {
		sq->begin_time = ctx->stats.draw_calls;
	}
	return true;
}
static boolean
fd_sw_get_query_result(struct fd_context *ctx, struct fd_query *q,
		boolean wait, union pipe_query_result *result)
{
	struct fd_sw_query *sq = fd_sw_query(q);

	result->u64 = sq->end_value - sq->begin_value;

	if (is_rate_query(q)) {
		double fps = (result->u64 * 1000000) /
				(double)(sq->end_time - sq->begin_time);
		result->u64 = (uint64_t)fps;
	}

	return true;
}
示例#6
0
static void
fd_sw_destroy_query(struct fd_context *ctx, struct fd_query *q)
{
	struct fd_sw_query *sq = fd_sw_query(q);
	free(sq);
}