• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 #include "i915_sw_winsys.h"
3 #include "util/u_memory.h"
4 #include "util/u_atomic.h"
5 #include "util/u_inlines.h"
6 
7 struct i915_sw_fence
8 {
9    struct pipe_reference reference;
10 };
11 
12 struct pipe_fence_handle *
i915_sw_fence_create()13 i915_sw_fence_create()
14 {
15    struct i915_sw_fence *fence = CALLOC_STRUCT(i915_sw_fence);
16 
17    pipe_reference_init(&fence->reference, 1);
18 
19    return (struct pipe_fence_handle *)fence;
20 }
21 
22 static void
i915_sw_fence_reference(struct i915_winsys * iws,struct pipe_fence_handle ** ptr,struct pipe_fence_handle * fence)23 i915_sw_fence_reference(struct i915_winsys *iws,
24                         struct pipe_fence_handle **ptr,
25                         struct pipe_fence_handle *fence)
26 {
27    struct i915_sw_fence *old = (struct i915_sw_fence *)*ptr;
28    struct i915_sw_fence *f = (struct i915_sw_fence *)fence;
29 
30    if (pipe_reference(&((struct i915_sw_fence *)(*ptr))->reference, &f->reference)) {
31       FREE(old);
32    }
33    *ptr = fence;
34 }
35 
36 static int
i915_sw_fence_signalled(struct i915_winsys * iws,struct pipe_fence_handle * fence)37 i915_sw_fence_signalled(struct i915_winsys *iws,
38                         struct pipe_fence_handle *fence)
39 {
40    assert(0);
41 
42    return 0;
43 }
44 
45 static int
i915_sw_fence_finish(struct i915_winsys * iws,struct pipe_fence_handle * fence)46 i915_sw_fence_finish(struct i915_winsys *iws,
47                      struct pipe_fence_handle *fence)
48 {
49    return 0;
50 }
51 
52 void
i915_sw_winsys_init_fence_functions(struct i915_sw_winsys * isws)53 i915_sw_winsys_init_fence_functions(struct i915_sw_winsys *isws)
54 {
55    isws->base.fence_reference = i915_sw_fence_reference;
56    isws->base.fence_signalled = i915_sw_fence_signalled;
57    isws->base.fence_finish = i915_sw_fence_finish;
58 }
59