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