2 * Copyright (C) 2013-2014 ARM Limited. All rights reserved.
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.
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.
12 * @file mali_timeline_fence_wait.h
14 * This file contains functions used to wait until a Timeline fence is signaled.
17 #ifndef __MALI_TIMELINE_FENCE_WAIT_H__
18 #define __MALI_TIMELINE_FENCE_WAIT_H__
21 #include "mali_timeline.h"
24 * If used as the timeout argument in @ref mali_timeline_fence_wait, a timer is not used and the
25 * function only returns when the fence is signaled.
27 #define MALI_TIMELINE_FENCE_WAIT_TIMEOUT_NEVER ((u32) -1)
30 * If used as the timeout argument in @ref mali_timeline_fence_wait, the function will return
31 * immediately with the current state of the fence.
33 #define MALI_TIMELINE_FENCE_WAIT_TIMEOUT_IMMEDIATELY 0
38 * The fence wait tracker is added to the Timeline system with the fence we are waiting on as a
39 * dependency. We will then perform a blocking wait, possibly with a timeout, until the tracker is
40 * activated, which happens when the fence is signaled.
42 struct mali_timeline_fence_wait_tracker {
43 mali_bool activated; /**< MALI_TRUE if the tracker has been activated, MALI_FALSE if not. */
44 _mali_osk_atomic_t refcount; /**< Reference count. */
45 struct mali_timeline_system *system; /**< Timeline system. */
46 struct mali_timeline_tracker tracker; /**< Timeline tracker. */
50 * Wait for a fence to be signaled, or timeout is reached.
52 * @param system Timeline system.
53 * @param fence Fence to wait on.
54 * @param timeout Timeout in ms, or MALI_TIMELINE_FENCE_WAIT_TIMEOUT_NEVER or
55 * MALI_TIMELINE_FENCE_WAIT_TIMEOUT_IMMEDIATELY.
56 * @return MALI_TRUE if signaled, MALI_FALSE if timed out.
58 mali_bool mali_timeline_fence_wait(struct mali_timeline_system *system, struct mali_timeline_fence *fence, u32 timeout);
61 * Used by the Timeline system to activate a fence wait tracker.
63 * @param fence_wait_tracker Fence waiter tracker.
65 void mali_timeline_fence_wait_activate(struct mali_timeline_fence_wait_tracker *fence_wait_tracker);
67 #endif /* __MALI_TIMELINE_FENCE_WAIT_H__ */