xref: /OK3568_Linux_fs/kernel/drivers/gpu/arm/mali400/mali/common/mali_timeline.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Copyright (C) 2013-2018 ARM Limited. All rights reserved.
3  *
4  * This program is free software and is provided to you under the terms of the GNU General Public License version 2
5  * as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence.
6  *
7  * A copy of the licence is included with the program, and can also be obtained from Free Software
8  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
9  */
10 
11 #ifndef __MALI_TIMELINE_H__
12 #define __MALI_TIMELINE_H__
13 
14 #include "mali_osk.h"
15 #include "mali_ukk.h"
16 #include "mali_session.h"
17 #include "mali_kernel_common.h"
18 #include "mali_spinlock_reentrant.h"
19 #include "mali_sync.h"
20 #include "mali_scheduler_types.h"
21 #include <linux/version.h>
22 
23 /**
24  * Soft job timeout.
25  *
26  * Soft jobs have to be signaled as complete after activation.  Normally this is done by user space,
27  * but in order to guarantee that every soft job is completed, we also have a timer.
28  */
29 #define MALI_TIMELINE_TIMEOUT_HZ ((unsigned long) (HZ * 3 / 2)) /* 1500 ms. */
30 
31 /**
32  * Timeline type.
33  */
34 typedef enum mali_timeline_id {
35 	MALI_TIMELINE_GP   = MALI_UK_TIMELINE_GP,   /**< GP job timeline. */
36 	MALI_TIMELINE_PP   = MALI_UK_TIMELINE_PP,   /**< PP job timeline. */
37 	MALI_TIMELINE_SOFT = MALI_UK_TIMELINE_SOFT, /**< Soft job timeline. */
38 	MALI_TIMELINE_MAX  = MALI_UK_TIMELINE_MAX
39 } mali_timeline_id;
40 
41 /**
42  * Used by trackers that should not be added to a timeline (@ref mali_timeline_system_add_tracker).
43  */
44 #define MALI_TIMELINE_NONE MALI_TIMELINE_MAX
45 
46 /**
47  * Tracker type.
48  */
49 typedef enum mali_timeline_tracker_type {
50 	MALI_TIMELINE_TRACKER_GP   = 0, /**< Tracker used by GP jobs. */
51 	MALI_TIMELINE_TRACKER_PP   = 1, /**< Tracker used by PP jobs. */
52 	MALI_TIMELINE_TRACKER_SOFT = 2, /**< Tracker used by soft jobs. */
53 	MALI_TIMELINE_TRACKER_WAIT = 3, /**< Tracker used for fence wait. */
54 	MALI_TIMELINE_TRACKER_SYNC = 4, /**< Tracker used for sync fence. */
55 	MALI_TIMELINE_TRACKER_MAX  = 5,
56 } mali_timeline_tracker_type;
57 
58 /**
59  * Tracker activation error.
60  */
61 typedef u32 mali_timeline_activation_error;
62 #define MALI_TIMELINE_ACTIVATION_ERROR_NONE      0
63 #define MALI_TIMELINE_ACTIVATION_ERROR_SYNC_BIT  (1<<1)
64 #define MALI_TIMELINE_ACTIVATION_ERROR_FATAL_BIT (1<<0)
65 
66 /**
67  * Type used to represent a point on a timeline.
68  */
69 typedef u32 mali_timeline_point;
70 
71 /**
72  * Used to represent that no point on a timeline.
73  */
74 #define MALI_TIMELINE_NO_POINT ((mali_timeline_point) 0)
75 
76 /**
77  * The maximum span of points on a timeline.  A timeline will be considered full if the difference
78  * between the oldest and newest points is equal or larger to this value.
79  */
80 #define MALI_TIMELINE_MAX_POINT_SPAN 65536
81 
82 /**
83  * Magic value used to assert on validity of trackers.
84  */
85 #define MALI_TIMELINE_TRACKER_MAGIC 0xabcdabcd
86 
87 struct mali_timeline;
88 struct mali_timeline_waiter;
89 struct mali_timeline_tracker;
90 
91 /**
92  * Timeline fence.
93  */
94 struct mali_timeline_fence {
95 	mali_timeline_point points[MALI_TIMELINE_MAX]; /**< For each timeline, a point or MALI_TIMELINE_NO_POINT. */
96 	s32                 sync_fd;                   /**< A file descriptor representing a sync fence, or -1. */
97 };
98 
99 /**
100  * Timeline system.
101  *
102  * The Timeline system has a set of timelines associated with a session.
103  */
104 struct mali_timeline_system {
105 	struct mali_spinlock_reentrant *spinlock;   /**< Spin lock protecting the timeline system */
106 	struct mali_timeline           *timelines[MALI_TIMELINE_MAX]; /**< The timelines in this system */
107 
108 	/* Single-linked list of unused waiter objects.  Uses the tracker_next field in tracker. */
109 	struct mali_timeline_waiter    *waiter_empty_list;
110 
111 	struct mali_session_data       *session;    /**< Session that owns this system. */
112 
113 	mali_bool                       timer_enabled; /**< Set to MALI_TRUE if soft job timer should be enabled, MALI_FALSE if not. */
114 
115 	_mali_osk_wait_queue_t         *wait_queue; /**< Wait queue. */
116 
117 #if defined(CONFIG_SYNC) || defined(CONFIG_SYNC_FILE)
118 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0)
119 	struct sync_timeline           *signaled_sync_tl; /**< Special sync timeline used to create pre-signaled sync fences */
120 #else
121 	struct mali_internal_sync_timeline           *signaled_sync_tl; /**< Special sync timeline used to create pre-signaled sync fences */
122 #endif
123 #endif /* defined(CONFIG_SYNC) || defined(CONFIG_SYNC_FILE) */
124 };
125 
126 /**
127  * Timeline.  Each Timeline system will have MALI_TIMELINE_MAX timelines.
128  */
129 struct mali_timeline {
130 	mali_timeline_point           point_next;   /**< The next available point. */
131 	mali_timeline_point           point_oldest; /**< The oldest point not released. */
132 
133 	/* Double-linked list of trackers.  Sorted in ascending order by tracker->time_number with
134 	 * tail pointing to the tracker with the oldest time. */
135 	struct mali_timeline_tracker *tracker_head;
136 	struct mali_timeline_tracker *tracker_tail;
137 
138 	/* Double-linked list of waiters.  Sorted in ascending order by waiter->time_number_wait
139 	 * with tail pointing to the waiter with oldest wait time. */
140 	struct mali_timeline_waiter  *waiter_head;
141 	struct mali_timeline_waiter  *waiter_tail;
142 
143 	struct mali_timeline_system  *system;       /**< Timeline system this timeline belongs to. */
144 	enum mali_timeline_id         id;           /**< Timeline type. */
145 
146 #if defined(CONFIG_SYNC) || defined(CONFIG_SYNC_FILE)
147 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0)
148 	struct sync_timeline         *sync_tl;      /**< Sync timeline that corresponds to this timeline. */
149 #else
150 	struct mali_internal_sync_timeline *sync_tl;
151 #endif
152 	mali_bool destroyed;
153 	struct mali_spinlock_reentrant *spinlock;       /**< Spin lock protecting the timeline system */
154 #endif /* defined(CONFIG_SYNC) || defined(CONFIG_SYNC_FILE) */
155 
156 	/* The following fields are used to time out soft job trackers. */
157 	_mali_osk_wq_delayed_work_t  *delayed_work;
158 	mali_bool                     timer_active;
159 };
160 
161 /**
162  * Timeline waiter.
163  */
164 struct mali_timeline_waiter {
165 	mali_timeline_point           point;         /**< Point on timeline we are waiting for to be released. */
166 	struct mali_timeline_tracker *tracker;       /**< Tracker that is waiting. */
167 
168 	struct mali_timeline_waiter  *timeline_next; /**< Next waiter on timeline's waiter list. */
169 	struct mali_timeline_waiter  *timeline_prev; /**< Previous waiter on timeline's waiter list. */
170 
171 	struct mali_timeline_waiter  *tracker_next;  /**< Next waiter on tracker's waiter list. */
172 };
173 
174 /**
175  * Timeline tracker.
176  */
177 struct mali_timeline_tracker {
178 	MALI_DEBUG_CODE(u32            magic); /**< Should always be MALI_TIMELINE_TRACKER_MAGIC for a valid tracker. */
179 
180 	mali_timeline_point            point; /**< Point on timeline for this tracker */
181 
182 	struct mali_timeline_tracker  *timeline_next; /**< Next tracker on timeline's tracker list */
183 	struct mali_timeline_tracker  *timeline_prev; /**< Previous tracker on timeline's tracker list */
184 
185 	u32                            trigger_ref_count; /**< When zero tracker will be activated */
186 	mali_timeline_activation_error activation_error;  /**< Activation error. */
187 	struct mali_timeline_fence     fence;             /**< Fence used to create this tracker */
188 
189 	/* Single-linked list of waiters.  Sorted in order of insertions with
190 	 * tail pointing to first waiter. */
191 	struct mali_timeline_waiter   *waiter_head;
192 	struct mali_timeline_waiter   *waiter_tail;
193 
194 #if defined(CONFIG_SYNC) || defined(CONFIG_SYNC_FILE)
195 	/* These are only used if the tracker is waiting on a sync fence. */
196 	struct mali_timeline_waiter   *waiter_sync; /**< A direct pointer to timeline waiter representing sync fence. */
197 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0)
198 	struct sync_fence_waiter       sync_fence_waiter; /**< Used to connect sync fence and tracker in sync fence wait callback. */
199 	struct sync_fence             *sync_fence;   /**< The sync fence this tracker is waiting on. */
200 #else
201 	struct mali_internal_sync_fence_waiter       sync_fence_waiter; /**< Used to connect sync fence and tracker in sync fence wait callback. */
202 	struct mali_internal_sync_fence             *sync_fence;   /**< The sync fence this tracker is waiting on. */
203 #endif
204 	_mali_osk_list_t               sync_fence_cancel_list; /**< List node used to cancel sync fence waiters. */
205 	_mali_osk_list_t                sync_fence_signal_list; /** < List node used to singal sync fence callback function. */
206 
207 #endif /* defined(CONFIG_SYNC) || defined(CONFIG_SYNC_FILE) */
208 
209 #if defined(CONFIG_MALI_DMA_BUF_FENCE)
210 	struct mali_timeline_waiter   *waiter_dma_fence; /**< A direct pointer to timeline waiter representing dma fence. */
211 #endif
212 
213 	struct mali_timeline_system   *system;       /**< Timeline system. */
214 	struct mali_timeline          *timeline;     /**< Timeline, or NULL if not on a timeline. */
215 	enum mali_timeline_tracker_type type;        /**< Type of tracker. */
216 	void                          *job;          /**< Owner of tracker. */
217 
218 	/* The following fields are used to time out soft job trackers. */
219 	unsigned long                 os_tick_create;
220 	unsigned long                 os_tick_activate;
221 	mali_bool                     timer_active;
222 };
223 
224 extern _mali_osk_atomic_t gp_tracker_count;
225 extern _mali_osk_atomic_t phy_pp_tracker_count;
226 extern _mali_osk_atomic_t virt_pp_tracker_count;
227 
228 /**
229  * What follows is a set of functions to check the state of a timeline and to determine where on a
230  * timeline a given point is.  Most of these checks will translate the timeline so the oldest point
231  * on the timeline is aligned with zero.  Remember that all of these calculation are done on
232  * unsigned integers.
233  *
234  * The following example illustrates the three different states a point can be in.  The timeline has
235  * been translated to put the oldest point at zero:
236  *
237  *
238  *
239  *                               [ point is in forbidden zone ]
240  *                                          64k wide
241  *                                MALI_TIMELINE_MAX_POINT_SPAN
242  *
243  *    [ point is on timeline     )                            ( point is released ]
244  *
245  *    0--------------------------##############################--------------------2^32 - 1
246  *    ^                          ^
247  *    \                          |
248  *     oldest point on timeline  |
249  *                               \
250  *                                next point on timeline
251  */
252 
253 /**
254  * Compare two timeline points
255  *
256  * Returns true if a is after b, false if a is before or equal to b.
257  *
258  * This funcion ignores MALI_TIMELINE_MAX_POINT_SPAN. Wrapping is supported and
259  * the result will be correct if the points is less then UINT_MAX/2 apart.
260  *
261  * @param a Point on timeline
262  * @param b Point on timeline
263  * @return MALI_TRUE if a is after b
264  */
mali_timeline_point_after(mali_timeline_point a,mali_timeline_point b)265 MALI_STATIC_INLINE mali_bool mali_timeline_point_after(mali_timeline_point a, mali_timeline_point b)
266 {
267 	return 0 > ((s32)b) - ((s32)a);
268 }
269 
270 /**
271  * Check if a point is on timeline.  A point is on a timeline if it is greater than, or equal to,
272  * the oldest point, and less than the next point.
273  *
274  * @param timeline Timeline.
275  * @param point Point on timeline.
276  * @return MALI_TRUE if point is on timeline, MALI_FALSE if not.
277  */
mali_timeline_is_point_on(struct mali_timeline * timeline,mali_timeline_point point)278 MALI_STATIC_INLINE mali_bool mali_timeline_is_point_on(struct mali_timeline *timeline, mali_timeline_point point)
279 {
280 	MALI_DEBUG_ASSERT_POINTER(timeline);
281 	MALI_DEBUG_ASSERT(MALI_TIMELINE_NO_POINT != point);
282 
283 	return (point - timeline->point_oldest) < (timeline->point_next - timeline->point_oldest);
284 }
285 
286 /**
287  * Check if a point has been released.  A point is released if it is older than the oldest point on
288  * the timeline, newer than the next point, and also not in the forbidden zone.
289  *
290  * @param timeline Timeline.
291  * @param point Point on timeline.
292  * @return MALI_TRUE if point has been release, MALI_FALSE if not.
293  */
mali_timeline_is_point_released(struct mali_timeline * timeline,mali_timeline_point point)294 MALI_STATIC_INLINE mali_bool mali_timeline_is_point_released(struct mali_timeline *timeline, mali_timeline_point point)
295 {
296 	mali_timeline_point point_normalized;
297 	mali_timeline_point next_normalized;
298 
299 	MALI_DEBUG_ASSERT_POINTER(timeline);
300 	MALI_DEBUG_ASSERT(MALI_TIMELINE_NO_POINT != point);
301 
302 	point_normalized = point - timeline->point_oldest;
303 	next_normalized = timeline->point_next - timeline->point_oldest;
304 
305 	return point_normalized > (next_normalized + MALI_TIMELINE_MAX_POINT_SPAN);
306 }
307 
308 /**
309  * Check if the tracker that the point relate to has been released.  A point is released if the tracker is not on the timeline.
310  * @param timeline Timeline.
311  * @param point Point on timeline.
312  * @return MALI_TRUE if the tracker has been release, MALI_FALSE if not.
313  */
mali_timeline_is_tracker_released(struct mali_timeline * timeline,mali_timeline_point point)314 MALI_STATIC_INLINE mali_bool mali_timeline_is_tracker_released(struct mali_timeline *timeline, mali_timeline_point point)
315 {
316 	struct mali_timeline_tracker *tracker;
317 
318 	MALI_DEBUG_ASSERT_POINTER(timeline);
319 	MALI_DEBUG_ASSERT(MALI_TIMELINE_NO_POINT != point);
320 
321 	tracker = timeline->tracker_tail;
322 
323 	while (NULL != tracker) {
324 		if (point == tracker->point)
325 			return MALI_FALSE;
326 		tracker = tracker->timeline_next;
327 	}
328 
329 	return MALI_TRUE;
330 }
331 
332 /**
333  * Check if a point is valid.  A point is valid if is on the timeline or has been released.
334  *
335  * @param timeline Timeline.
336  * @param point Point on timeline.
337  * @return MALI_TRUE if point is valid, MALI_FALSE if not.
338  */
mali_timeline_is_point_valid(struct mali_timeline * timeline,mali_timeline_point point)339 MALI_STATIC_INLINE mali_bool mali_timeline_is_point_valid(struct mali_timeline *timeline, mali_timeline_point point)
340 {
341 	MALI_DEBUG_ASSERT_POINTER(timeline);
342 	return mali_timeline_is_point_on(timeline, point) || mali_timeline_is_point_released(timeline, point);
343 }
344 
345 /**
346  * Check if timeline is empty (has no points on it).  A timeline is empty if next == oldest.
347  *
348  * @param timeline Timeline.
349  * @return MALI_TRUE if timeline is empty, MALI_FALSE if not.
350  */
mali_timeline_is_empty(struct mali_timeline * timeline)351 MALI_STATIC_INLINE mali_bool mali_timeline_is_empty(struct mali_timeline *timeline)
352 {
353 	MALI_DEBUG_ASSERT_POINTER(timeline);
354 	return timeline->point_next == timeline->point_oldest;
355 }
356 
357 /**
358  * Check if timeline is full.  A valid timeline cannot span more than 64k points (@ref
359  * MALI_TIMELINE_MAX_POINT_SPAN).
360  *
361  * @param timeline Timeline.
362  * @return MALI_TRUE if timeline is full, MALI_FALSE if not.
363  */
mali_timeline_is_full(struct mali_timeline * timeline)364 MALI_STATIC_INLINE mali_bool mali_timeline_is_full(struct mali_timeline *timeline)
365 {
366 	MALI_DEBUG_ASSERT_POINTER(timeline);
367 	return MALI_TIMELINE_MAX_POINT_SPAN <= (timeline->point_next - timeline->point_oldest);
368 }
369 
370 /**
371  * Create a new timeline system.
372  *
373  * @param session The session this timeline system will belong to.
374  * @return New timeline system.
375  */
376 struct mali_timeline_system *mali_timeline_system_create(struct mali_session_data *session);
377 
378 /**
379  * Abort timeline system.
380  *
381  * This will release all pending waiters in the timeline system causing all trackers to be
382  * activated.
383  *
384  * @param system Timeline system to abort all jobs from.
385  */
386 void mali_timeline_system_abort(struct mali_timeline_system *system);
387 
388 /**
389  * Destroy an empty timeline system.
390  *
391  * @note @ref mali_timeline_system_abort() should be called prior to this function.
392  *
393  * @param system Timeline system to destroy.
394  */
395 void mali_timeline_system_destroy(struct mali_timeline_system *system);
396 
397 /**
398  * Stop the soft job timer.
399  *
400  * @param system Timeline system
401  */
402 void mali_timeline_system_stop_timer(struct mali_timeline_system *system);
403 
404 /**
405  * Add a tracker to a timeline system and optionally also on a timeline.
406  *
407  * Once added to the timeline system, the tracker is guaranteed to be activated.  The tracker can be
408  * activated before this function returns.  Thus, it is also possible that the tracker is released
409  * before this function returns, depending on the tracker type.
410  *
411  * @note Tracker must be initialized (@ref mali_timeline_tracker_init) before being added to the
412  * timeline system.
413  *
414  * @param system Timeline system the tracker will be added to.
415  * @param tracker The tracker to be added.
416  * @param timeline_id Id of the timeline the tracker will be added to, or
417  *                    MALI_TIMELINE_NONE if it should not be added on a timeline.
418  * @return Point on timeline identifying this tracker, or MALI_TIMELINE_NO_POINT if not on timeline.
419  */
420 mali_timeline_point mali_timeline_system_add_tracker(struct mali_timeline_system *system,
421 		struct mali_timeline_tracker *tracker,
422 		enum mali_timeline_id timeline_id);
423 
424 /**
425  * Get latest point on timeline.
426  *
427  * @param system Timeline system.
428  * @param timeline_id Id of timeline to get latest point from.
429  * @return Latest point on timeline, or MALI_TIMELINE_NO_POINT if the timeline is empty.
430  */
431 mali_timeline_point mali_timeline_system_get_latest_point(struct mali_timeline_system *system,
432 		enum mali_timeline_id timeline_id);
433 
434 /**
435  * Initialize tracker.
436  *
437  * Must be called before tracker is added to timeline system (@ref mali_timeline_system_add_tracker).
438  *
439  * @param tracker Tracker to initialize.
440  * @param type Type of tracker.
441  * @param fence Fence used to set up dependencies for tracker.
442  * @param job Pointer to job struct this tracker is associated with.
443  */
444 void mali_timeline_tracker_init(struct mali_timeline_tracker *tracker,
445 				mali_timeline_tracker_type type,
446 				struct mali_timeline_fence *fence,
447 				void *job);
448 
449 /**
450  * Grab trigger ref count on tracker.
451  *
452  * This will prevent tracker from being activated until the trigger ref count reaches zero.
453  *
454  * @note Tracker must have been initialized (@ref mali_timeline_tracker_init).
455  *
456  * @param system Timeline system.
457  * @param tracker Tracker.
458  */
459 void mali_timeline_system_tracker_get(struct mali_timeline_system *system, struct mali_timeline_tracker *tracker);
460 
461 /**
462  * Release trigger ref count on tracker.
463  *
464  * If the trigger ref count reaches zero, the tracker will be activated.
465  *
466  * @param system Timeline system.
467  * @param tracker Tracker.
468  * @param activation_error Error bitmask if activated with error, or MALI_TIMELINE_ACTIVATION_ERROR_NONE if no error.
469  * @return Scheduling bitmask.
470  */
471 mali_scheduler_mask mali_timeline_system_tracker_put(struct mali_timeline_system *system, struct mali_timeline_tracker *tracker, mali_timeline_activation_error activation_error);
472 
473 /**
474  * Release a tracker from the timeline system.
475  *
476  * This is used to signal that the job being tracker is finished, either due to normal circumstances
477  * (job complete/abort) or due to a timeout.
478  *
479  * We may need to schedule some subsystems after a tracker has been released and the returned
480  * bitmask will tell us if it is necessary.  If the return value is non-zero, this value needs to be
481  * sent as an input parameter to @ref mali_scheduler_schedule_from_mask() to do the scheduling.
482  *
483  * @note Tracker must have been activated before being released.
484  * @warning Not calling @ref mali_scheduler_schedule_from_mask() after releasing a tracker can lead
485  * to a deadlock.
486  *
487  * @param tracker Tracker being released.
488  * @return Scheduling bitmask.
489  */
490 mali_scheduler_mask mali_timeline_tracker_release(struct mali_timeline_tracker *tracker);
491 
mali_timeline_tracker_activation_error(struct mali_timeline_tracker * tracker)492 MALI_STATIC_INLINE mali_bool mali_timeline_tracker_activation_error(
493 	struct mali_timeline_tracker *tracker)
494 {
495 	MALI_DEBUG_ASSERT_POINTER(tracker);
496 	return (MALI_TIMELINE_ACTIVATION_ERROR_FATAL_BIT &
497 		tracker->activation_error) ? MALI_TRUE : MALI_FALSE;
498 }
499 
500 /**
501  * Copy data from a UK fence to a Timeline fence.
502  *
503  * @param fence Timeline fence.
504  * @param uk_fence UK fence.
505  */
506 void mali_timeline_fence_copy_uk_fence(struct mali_timeline_fence *fence, _mali_uk_fence_t *uk_fence);
507 
508 _mali_osk_errcode_t mali_timeline_initialize(void);
509 
510 void mali_timeline_terminate(void);
511 
mali_timeline_has_gp_job(void)512 MALI_STATIC_INLINE mali_bool mali_timeline_has_gp_job(void)
513 {
514 	return 0 < _mali_osk_atomic_read(&gp_tracker_count);
515 }
516 
mali_timeline_has_physical_pp_job(void)517 MALI_STATIC_INLINE mali_bool mali_timeline_has_physical_pp_job(void)
518 {
519 	return 0 < _mali_osk_atomic_read(&phy_pp_tracker_count);
520 }
521 
mali_timeline_has_virtual_pp_job(void)522 MALI_STATIC_INLINE mali_bool mali_timeline_has_virtual_pp_job(void)
523 {
524 	return 0 < _mali_osk_atomic_read(&virt_pp_tracker_count);
525 }
526 
527 #if defined(DEBUG)
528 #define MALI_TIMELINE_DEBUG_FUNCTIONS
529 #endif /* DEBUG */
530 #if defined(MALI_TIMELINE_DEBUG_FUNCTIONS)
531 
532 /**
533  * Tracker state.  Used for debug printing.
534  */
535 typedef enum mali_timeline_tracker_state {
536 	MALI_TIMELINE_TS_INIT    = 0,
537 	MALI_TIMELINE_TS_WAITING = 1,
538 	MALI_TIMELINE_TS_ACTIVE  = 2,
539 	MALI_TIMELINE_TS_FINISH  = 3,
540 } mali_timeline_tracker_state;
541 
542 /**
543  * Get tracker state.
544  *
545  * @param tracker Tracker to check.
546  * @return State of tracker.
547  */
548 mali_timeline_tracker_state mali_timeline_debug_get_tracker_state(struct mali_timeline_tracker *tracker);
549 
550 /**
551  * Print debug information about tracker.
552  *
553  * @param tracker Tracker to print.
554  */
555 void mali_timeline_debug_print_tracker(struct mali_timeline_tracker *tracker, _mali_osk_print_ctx *print_ctx);
556 
557 /**
558  * Print debug information about timeline.
559  *
560  * @param timeline Timeline to print.
561  */
562 void mali_timeline_debug_print_timeline(struct mali_timeline *timeline, _mali_osk_print_ctx *print_ctx);
563 
564 #if !(LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0))
565 void mali_timeline_debug_direct_print_tracker(struct mali_timeline_tracker *tracker);
566 void mali_timeline_debug_direct_print_timeline(struct mali_timeline *timeline);
567 #endif
568 
569 /**
570  * Print debug information about timeline system.
571  *
572  * @param system Timeline system to print.
573  */
574 void mali_timeline_debug_print_system(struct mali_timeline_system *system, _mali_osk_print_ctx *print_ctx);
575 
576 #endif /* defined(MALI_TIMELINE_DEBUG_FUNCTIONS) */
577 
578 #if defined(CONFIG_MALI_DMA_BUF_FENCE)
579 /**
580  * The timeline dma fence callback when dma fence signal.
581  *
582  * @param pp_job_ptr The pointer to pp job that link to the signaled dma fence.
583  */
584 void mali_timeline_dma_fence_callback(void *pp_job_ptr);
585 #endif
586 
587 #endif /* __MALI_TIMELINE_H__ */
588