1#ifndef __NVC0_QUERY_HW_H__
2#define __NVC0_QUERY_HW_H__
3
4#include "nouveau_fence.h"
5#include "nouveau_mm.h"
6
7#include "nvc0_query.h"
8
9#define NVC0_HW_QUERY_TFB_BUFFER_OFFSET (PIPE_QUERY_TYPES + 0)
10
11struct nvc0_hw_query;
12
13struct nvc0_hw_query_funcs {
14   void (*destroy_query)(struct nvc0_context *, struct nvc0_hw_query *);
15   boolean (*begin_query)(struct nvc0_context *, struct nvc0_hw_query *);
16   void (*end_query)(struct nvc0_context *, struct nvc0_hw_query *);
17   boolean (*get_query_result)(struct nvc0_context *, struct nvc0_hw_query *,
18                               boolean, union pipe_query_result *);
19};
20
21struct nvc0_hw_query {
22   struct nvc0_query base;
23   const struct nvc0_hw_query_funcs *funcs;
24   uint32_t *data;
25   uint32_t sequence;
26   struct nouveau_bo *bo;
27   uint32_t base_offset;
28   uint32_t offset; /* base_offset + i * rotate */
29   uint8_t state;
30   boolean is64bit;
31   uint8_t rotate;
32   int nesting; /* only used for occlusion queries */
33   struct nouveau_mm_allocation *mm;
34   struct nouveau_fence *fence;
35};
36
37static inline struct nvc0_hw_query *
38nvc0_hw_query(struct nvc0_query *q)
39{
40   return (struct nvc0_hw_query *)q;
41}
42
43struct nvc0_query *
44nvc0_hw_create_query(struct nvc0_context *, unsigned, unsigned);
45int
46nvc0_hw_get_driver_query_info(struct nvc0_screen *, unsigned,
47                              struct pipe_driver_query_info *);
48bool
49nvc0_hw_query_allocate(struct nvc0_context *, struct nvc0_query *, int);
50void
51nvc0_hw_query_pushbuf_submit(struct nouveau_pushbuf *, struct nvc0_query *,
52                             unsigned);
53void
54nvc0_hw_query_fifo_wait(struct nvc0_context *, struct nvc0_query *);
55
56#endif
57