1 #ifndef __NVC0_QUERY_H__
2 #define __NVC0_QUERY_H__
3
4 #include "pipe/p_context.h"
5
6 #include "nouveau_context.h"
7
8 struct nvc0_context;
9 struct nvc0_query;
10
11 struct nvc0_query_funcs {
12 void (*destroy_query)(struct nvc0_context *, struct nvc0_query *);
13 boolean (*begin_query)(struct nvc0_context *, struct nvc0_query *);
14 void (*end_query)(struct nvc0_context *, struct nvc0_query *);
15 boolean (*get_query_result)(struct nvc0_context *, struct nvc0_query *,
16 boolean, union pipe_query_result *);
17 void (*get_query_result_resource)(struct nvc0_context *nvc0,
18 struct nvc0_query *q,
19 boolean wait,
20 enum pipe_query_value_type result_type,
21 int index,
22 struct pipe_resource *resource,
23 unsigned offset);
24 };
25
26 struct nvc0_query {
27 const struct nvc0_query_funcs *funcs;
28 uint16_t type;
29 uint16_t index;
30 };
31
32 static inline struct nvc0_query *
nvc0_query(struct pipe_query * pipe)33 nvc0_query(struct pipe_query *pipe)
34 {
35 return (struct nvc0_query *)pipe;
36 }
37
38 /*
39 * Driver queries groups:
40 */
41 #define NVC0_HW_SM_QUERY_GROUP 0
42 #define NVC0_HW_METRIC_QUERY_GROUP 1
43 #define NVC0_SW_QUERY_DRV_STAT_GROUP 2
44
45 void nvc0_init_query_functions(struct nvc0_context *);
46
47 #endif
48