@@ -120,7 +120,6 @@ int i915_timeline_init(struct drm_i915_private *i915,
120
120
const char * name ,
121
121
struct i915_vma * hwsp )
122
122
{
123
- struct i915_gt_timelines * gt = & i915 -> gt .timelines ;
124
123
void * vaddr ;
125
124
126
125
/*
@@ -168,10 +167,6 @@ int i915_timeline_init(struct drm_i915_private *i915,
168
167
169
168
i915_syncmap_init (& timeline -> sync );
170
169
171
- mutex_lock (& gt -> mutex );
172
- list_add (& timeline -> link , & gt -> list );
173
- mutex_unlock (& gt -> mutex );
174
-
175
170
return 0 ;
176
171
}
177
172
@@ -180,7 +175,7 @@ void i915_timelines_init(struct drm_i915_private *i915)
180
175
struct i915_gt_timelines * gt = & i915 -> gt .timelines ;
181
176
182
177
mutex_init (& gt -> mutex );
183
- INIT_LIST_HEAD (& gt -> list );
178
+ INIT_LIST_HEAD (& gt -> active_list );
184
179
185
180
spin_lock_init (& gt -> hwsp_lock );
186
181
INIT_LIST_HEAD (& gt -> hwsp_free_list );
@@ -189,6 +184,24 @@ void i915_timelines_init(struct drm_i915_private *i915)
189
184
i915_gem_shrinker_taints_mutex (i915 , & gt -> mutex );
190
185
}
191
186
187
+ static void timeline_add_to_active (struct i915_timeline * tl )
188
+ {
189
+ struct i915_gt_timelines * gt = & tl -> i915 -> gt .timelines ;
190
+
191
+ mutex_lock (& gt -> mutex );
192
+ list_add (& tl -> link , & gt -> active_list );
193
+ mutex_unlock (& gt -> mutex );
194
+ }
195
+
196
+ static void timeline_remove_from_active (struct i915_timeline * tl )
197
+ {
198
+ struct i915_gt_timelines * gt = & tl -> i915 -> gt .timelines ;
199
+
200
+ mutex_lock (& gt -> mutex );
201
+ list_del (& tl -> link );
202
+ mutex_unlock (& gt -> mutex );
203
+ }
204
+
192
205
/**
193
206
* i915_timelines_park - called when the driver idles
194
207
* @i915: the drm_i915_private device
@@ -205,7 +218,7 @@ void i915_timelines_park(struct drm_i915_private *i915)
205
218
struct i915_timeline * timeline ;
206
219
207
220
mutex_lock (& gt -> mutex );
208
- list_for_each_entry (timeline , & gt -> list , link ) {
221
+ list_for_each_entry (timeline , & gt -> active_list , link ) {
209
222
/*
210
223
* All known fences are completed so we can scrap
211
224
* the current sync point tracking and start afresh,
@@ -219,15 +232,9 @@ void i915_timelines_park(struct drm_i915_private *i915)
219
232
220
233
void i915_timeline_fini (struct i915_timeline * timeline )
221
234
{
222
- struct i915_gt_timelines * gt = & timeline -> i915 -> gt .timelines ;
223
-
224
235
GEM_BUG_ON (timeline -> pin_count );
225
236
GEM_BUG_ON (!list_empty (& timeline -> requests ));
226
237
227
- mutex_lock (& gt -> mutex );
228
- list_del (& timeline -> link );
229
- mutex_unlock (& gt -> mutex );
230
-
231
238
i915_syncmap_free (& timeline -> sync );
232
239
hwsp_free (timeline );
233
240
@@ -274,6 +281,8 @@ int i915_timeline_pin(struct i915_timeline *tl)
274
281
i915_ggtt_offset (tl -> hwsp_ggtt ) +
275
282
offset_in_page (tl -> hwsp_offset );
276
283
284
+ timeline_add_to_active (tl );
285
+
277
286
return 0 ;
278
287
279
288
unpin :
@@ -287,6 +296,8 @@ void i915_timeline_unpin(struct i915_timeline *tl)
287
296
if (-- tl -> pin_count )
288
297
return ;
289
298
299
+ timeline_remove_from_active (tl );
300
+
290
301
/*
291
302
* Since this timeline is idle, all bariers upon which we were waiting
292
303
* must also be complete and so we can discard the last used barriers
@@ -310,7 +321,7 @@ void i915_timelines_fini(struct drm_i915_private *i915)
310
321
{
311
322
struct i915_gt_timelines * gt = & i915 -> gt .timelines ;
312
323
313
- GEM_BUG_ON (!list_empty (& gt -> list ));
324
+ GEM_BUG_ON (!list_empty (& gt -> active_list ));
314
325
GEM_BUG_ON (!list_empty (& gt -> hwsp_free_list ));
315
326
316
327
mutex_destroy (& gt -> mutex );
0 commit comments