2 #ifndef __NOUVEAU_FENCE_H__
3 #define __NOUVEAU_FENCE_H__
5 #include "util/u_inlines.h"
8 #define NOUVEAU_FENCE_STATE_AVAILABLE 0
9 #define NOUVEAU_FENCE_STATE_EMITTING 1
10 #define NOUVEAU_FENCE_STATE_EMITTED 2
11 #define NOUVEAU_FENCE_STATE_FLUSHED 3
12 #define NOUVEAU_FENCE_STATE_SIGNALLED 4
14 struct pipe_debug_callback
;
16 struct nouveau_fence_work
{
17 struct list_head list
;
22 struct nouveau_fence
{
23 struct nouveau_fence
*next
;
24 struct nouveau_screen
*screen
;
29 struct list_head work
;
32 void nouveau_fence_emit(struct nouveau_fence
*);
33 void nouveau_fence_del(struct nouveau_fence
*);
35 bool nouveau_fence_new(struct nouveau_screen
*, struct nouveau_fence
**);
36 bool nouveau_fence_work(struct nouveau_fence
*, void (*)(void *), void *);
37 void nouveau_fence_update(struct nouveau_screen
*, bool flushed
);
38 void nouveau_fence_next(struct nouveau_screen
*);
39 bool nouveau_fence_wait(struct nouveau_fence
*, struct pipe_debug_callback
*);
40 bool nouveau_fence_signalled(struct nouveau_fence
*);
42 void nouveau_fence_unref_bo(void *data
); /* generic unref bo callback */
46 nouveau_fence_ref(struct nouveau_fence
*fence
, struct nouveau_fence
**ref
)
52 if (--(*ref
)->ref
== 0)
53 nouveau_fence_del(*ref
);
59 static inline struct nouveau_fence
*
60 nouveau_fence(struct pipe_fence_handle
*fence
)
62 return (struct nouveau_fence
*)fence
;
65 #endif // __NOUVEAU_FENCE_H__