nv50,nvc0: use condition for occlusion queries when already complete
[mesa.git] / src / gallium / drivers / nouveau / nv50 / nv50_query_hw.h
1 #ifndef __NV50_QUERY_HW_H__
2 #define __NV50_QUERY_HW_H__
3
4 #include "nouveau_fence.h"
5 #include "nouveau_mm.h"
6
7 #include "nv50_query.h"
8
9 #define NV50_HW_QUERY_STATE_READY 0
10 #define NV50_HW_QUERY_STATE_ACTIVE 1
11 #define NV50_HW_QUERY_STATE_ENDED 2
12 #define NV50_HW_QUERY_STATE_FLUSHED 3
13
14 #define NVA0_HW_QUERY_STREAM_OUTPUT_BUFFER_OFFSET (PIPE_QUERY_TYPES + 0)
15
16 struct nv50_hw_query;
17
18 struct nv50_hw_query_funcs {
19 void (*destroy_query)(struct nv50_context *, struct nv50_hw_query *);
20 boolean (*begin_query)(struct nv50_context *, struct nv50_hw_query *);
21 void (*end_query)(struct nv50_context *, struct nv50_hw_query *);
22 boolean (*get_query_result)(struct nv50_context *, struct nv50_hw_query *,
23 boolean, union pipe_query_result *);
24 };
25
26 struct nv50_hw_query {
27 struct nv50_query base;
28 const struct nv50_hw_query_funcs *funcs;
29 uint32_t *data;
30 uint32_t sequence;
31 struct nouveau_bo *bo;
32 uint32_t base_offset;
33 uint32_t offset; /* base + i * rotate */
34 uint8_t state;
35 bool is64bit;
36 uint8_t rotate;
37 struct nouveau_mm_allocation *mm;
38 struct nouveau_fence *fence;
39 };
40
41 static inline struct nv50_hw_query *
42 nv50_hw_query(struct nv50_query *q)
43 {
44 return (struct nv50_hw_query *)q;
45 }
46
47 struct nv50_query *
48 nv50_hw_create_query(struct nv50_context *, unsigned, unsigned);
49 int
50 nv50_hw_get_driver_query_info(struct nv50_screen *, unsigned,
51 struct pipe_driver_query_info *);
52 bool
53 nv50_hw_query_allocate(struct nv50_context *, struct nv50_query *, int);
54 void
55 nv50_hw_query_pushbuf_submit(struct nouveau_pushbuf *, uint16_t,
56 struct nv50_query *, unsigned);
57 void
58 nv84_hw_query_fifo_wait(struct nouveau_pushbuf *, struct nv50_query *);
59
60 #endif