1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25#ifndef I915_TIMELINE_H
26#define I915_TIMELINE_H
27
28#include <linux/lockdep.h>
29
30#include "i915_active.h"
31#include "i915_syncmap.h"
32#include "i915_timeline_types.h"
33
34int i915_timeline_init(struct drm_i915_private *i915,
35 struct i915_timeline *tl,
36 struct i915_vma *hwsp);
37void i915_timeline_fini(struct i915_timeline *tl);
38
39struct i915_timeline *
40i915_timeline_create(struct drm_i915_private *i915,
41 struct i915_vma *global_hwsp);
42
43static inline struct i915_timeline *
44i915_timeline_get(struct i915_timeline *timeline)
45{
46 kref_get(&timeline->kref);
47 return timeline;
48}
49
50void __i915_timeline_free(struct kref *kref);
51static inline void i915_timeline_put(struct i915_timeline *timeline)
52{
53 kref_put(&timeline->kref, __i915_timeline_free);
54}
55
56static inline int __i915_timeline_sync_set(struct i915_timeline *tl,
57 u64 context, u32 seqno)
58{
59 return i915_syncmap_set(&tl->sync, context, seqno);
60}
61
62static inline int i915_timeline_sync_set(struct i915_timeline *tl,
63 const struct dma_fence *fence)
64{
65 return __i915_timeline_sync_set(tl, fence->context, fence->seqno);
66}
67
68static inline bool __i915_timeline_sync_is_later(struct i915_timeline *tl,
69 u64 context, u32 seqno)
70{
71 return i915_syncmap_is_later(&tl->sync, context, seqno);
72}
73
74static inline bool i915_timeline_sync_is_later(struct i915_timeline *tl,
75 const struct dma_fence *fence)
76{
77 return __i915_timeline_sync_is_later(tl, fence->context, fence->seqno);
78}
79
80int i915_timeline_pin(struct i915_timeline *tl);
81int i915_timeline_get_seqno(struct i915_timeline *tl,
82 struct i915_request *rq,
83 u32 *seqno);
84void i915_timeline_unpin(struct i915_timeline *tl);
85
86int i915_timeline_read_hwsp(struct i915_request *from,
87 struct i915_request *until,
88 u32 *hwsp_offset);
89
90void i915_timelines_init(struct drm_i915_private *i915);
91void i915_timelines_park(struct drm_i915_private *i915);
92void i915_timelines_fini(struct drm_i915_private *i915);
93
94#endif
95