From 0e91dccf9cd2894e46028bac39caa54d80e39e8e Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Sun, 14 Feb 2016 10:02:13 -0500 Subject: [PATCH] freedreno/query: some queries don't have ->begin_query() Signed-off-by: Rob Clark --- src/gallium/drivers/freedreno/freedreno_query.h | 12 ++++++++++++ src/gallium/drivers/freedreno/freedreno_query_hw.c | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/src/gallium/drivers/freedreno/freedreno_query.h b/src/gallium/drivers/freedreno/freedreno_query.h index c2c71da2790..1e4f45ffcd3 100644 --- a/src/gallium/drivers/freedreno/freedreno_query.h +++ b/src/gallium/drivers/freedreno/freedreno_query.h @@ -65,4 +65,16 @@ fd_query(struct pipe_query *pq) void fd_query_screen_init(struct pipe_screen *pscreen); void fd_query_context_init(struct pipe_context *pctx); +static inline bool +skip_begin_query(int type) +{ + switch (type) { + case PIPE_QUERY_TIMESTAMP: + case PIPE_QUERY_GPU_FINISHED: + return true; + default: + return false; + } +} + #endif /* FREEDRENO_QUERY_H_ */ diff --git a/src/gallium/drivers/freedreno/freedreno_query_hw.c b/src/gallium/drivers/freedreno/freedreno_query_hw.c index 8e421b614ba..fe985d57d13 100644 --- a/src/gallium/drivers/freedreno/freedreno_query_hw.c +++ b/src/gallium/drivers/freedreno/freedreno_query_hw.c @@ -160,6 +160,12 @@ static void fd_hw_end_query(struct fd_context *ctx, struct fd_query *q) { struct fd_hw_query *hq = fd_hw_query(q); + /* there are a couple special cases, which don't have + * a matching ->begin_query(): + */ + if (skip_begin_query(q->type) && !q->active) { + fd_hw_begin_query(ctx, q); + } if (!q->active) return; if (is_active(hq, ctx->stage)) -- 2.30.2