Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4358 Serge 1
 
2
#include "util/u_memory.h"
3
#include "util/u_atomic.h"
4
#include "util/u_inlines.h"
5
6
 
7
 * Because gem does not have fence's we have to create our own fences.
8
 *
9
 * They work by keeping the batchbuffer around and checking if that has
10
 * been idled. If bo is NULL fence has expired.
11
 */
12
struct i915_drm_fence
13
{
14
   struct pipe_reference reference;
15
   drm_intel_bo *bo;
16
};
17
18
 
19
 
20
i915_drm_fence_create(drm_intel_bo *bo)
21
{
22
   struct i915_drm_fence *fence = CALLOC_STRUCT(i915_drm_fence);
23
24
 
25
   /* bo is null if fence already expired */
26
   if (bo) {
27
      drm_intel_bo_reference(bo);
28
      fence->bo = bo;
29
   }
30
31
 
32
}
33
34
 
35
i915_drm_fence_reference(struct i915_winsys *iws,
36
                          struct pipe_fence_handle **ptr,
37
                          struct pipe_fence_handle *fence)
38
{
39
   struct i915_drm_fence *old = (struct i915_drm_fence *)*ptr;
40
   struct i915_drm_fence *f = (struct i915_drm_fence *)fence;
41
42
 
43
      if (old->bo)
44
         drm_intel_bo_unreference(old->bo);
45
      FREE(old);
46
   }
47
   *ptr = fence;
48
}
49
50
 
51
i915_drm_fence_signalled(struct i915_winsys *iws,
52
                          struct pipe_fence_handle *fence)
53
{
54
   struct i915_drm_fence *f = (struct i915_drm_fence *)fence;
55
56
 
57
   if (!f->bo)
58
	   return 1;
59
60
 
61
}
62
63
 
64
i915_drm_fence_finish(struct i915_winsys *iws,
65
                       struct pipe_fence_handle *fence)
66
{
67
   struct i915_drm_fence *f = (struct i915_drm_fence *)fence;
68
69
 
70
   if (!f->bo)
71
      return 0;
72
73
 
74
   drm_intel_bo_unreference(f->bo);
75
   f->bo = NULL;
76
77
 
78
}
79
80
 
81
i915_drm_winsys_init_fence_functions(struct i915_drm_winsys *idws)
82
{
83
   idws->base.fence_reference = i915_drm_fence_reference;
84
   idws->base.fence_signalled = i915_drm_fence_signalled;
85
   idws->base.fence_finish = i915_drm_fence_finish;
86
}
87