nvc0: import nvc0 gallium driver
[mesa.git] / src / gallium / drivers / nvc0 / nvc0_fence.h
1
2 #ifndef __NVC0_FENCE_H__
3 #define __NVC0_FENCE_H__
4
5 #include "util/u_inlines.h"
6
7 struct nvc0_fence_trigger {
8 void (*func)(void *);
9 void *arg;
10 struct nvc0_fence_trigger *next;
11 };
12
13 #define NVC0_FENCE_STATE_EMITTED 1
14 #define NVC0_FENCE_STATE_SIGNALLED 2
15
16 /* reference first, so pipe_reference works directly */
17 struct nvc0_fence {
18 struct pipe_reference reference;
19 struct nvc0_fence *next;
20 struct nvc0_screen *screen;
21 int state;
22 uint32_t sequence;
23 struct nvc0_fence_trigger trigger;
24 };
25
26 void nvc0_fence_emit(struct nvc0_fence *);
27 void nvc0_fence_del(struct nvc0_fence *);
28
29 boolean nvc0_fence_wait(struct nvc0_fence *);
30
31 static INLINE void
32 nvc0_fence_reference(struct nvc0_fence **ref, struct nvc0_fence *fence)
33 {
34 if (pipe_reference(&(*ref)->reference, &fence->reference))
35 nvc0_fence_del(*ref);
36
37 *ref = fence;
38 }
39
40 #endif // __NVC0_FENCE_H__