tizen 2.4 release
[kernel/linux-3.0.git] / drivers / gpu / arm / mali400 / r4p0_rel0 / common / mali_scheduler.h
1 /*
2  * Copyright (C) 2012 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_SCHEDULER_H__
12 #define __MALI_SCHEDULER_H__
13
14 #include "mali_osk.h"
15 #include "mali_scheduler_types.h"
16 #include "mali_gp_scheduler.h"
17 #include "mali_pp_scheduler.h"
18
19 _mali_osk_errcode_t mali_scheduler_initialize(void);
20 void mali_scheduler_terminate(void);
21
22 u32 mali_scheduler_get_new_id(void);
23 u32 mali_scheduler_get_new_cache_order(void);
24
25 /**
26  * @brief Reset all groups
27  *
28  * This function resets all groups known by the both the PP and GP scheuduler.
29  * This must be called after the Mali HW has been powered on in order to reset
30  * the HW.
31  */
32 MALI_STATIC_INLINE void mali_scheduler_reset_all_groups(void)
33 {
34         mali_gp_scheduler_reset_all_groups();
35         mali_pp_scheduler_reset_all_groups();
36 }
37
38 /**
39  * @brief Zap TLB on all active groups running \a session
40  *
41  * @param session Pointer to the session to zap
42  */
43 MALI_STATIC_INLINE void mali_scheduler_zap_all_active(struct mali_session_data *session)
44 {
45         mali_gp_scheduler_zap_all_active(session);
46         mali_pp_scheduler_zap_all_active(session);
47 }
48
49 /**
50  * Check if bit is set in scheduler mask.
51  *
52  * @param mask Scheduler mask to check.
53  * @param bit Bit to check.
54  * @return MALI_TRUE if bit is set in scheduler mask, MALI_FALSE if not.
55  */
56 MALI_STATIC_INLINE mali_bool mali_scheduler_mask_is_set(mali_scheduler_mask mask, mali_scheduler_mask bit)
57 {
58         return MALI_SCHEDULER_MASK_EMPTY != (bit & mask);
59 }
60
61 /**
62  * Schedule GP and PP according to bitmask.
63  *
64  * @param mask A scheduling bitmask.
65  * @param deferred_schedule MALI_TRUE if schedule should be deferred, MALI_FALSE if not.
66  */
67 void mali_scheduler_schedule_from_mask(mali_scheduler_mask mask, mali_bool deferred_schedule);
68
69 /* Enable or disable scheduler hint. */
70 extern mali_bool mali_scheduler_hints[MALI_SCHEDULER_HINT_MAX];
71
72 MALI_STATIC_INLINE void mali_scheduler_hint_enable(mali_scheduler_hint hint)
73 {
74         MALI_DEBUG_ASSERT(hint < MALI_SCHEDULER_HINT_MAX);
75         mali_scheduler_hints[hint] = MALI_TRUE;
76 }
77
78 MALI_STATIC_INLINE void mali_scheduler_hint_disable(mali_scheduler_hint hint)
79 {
80         MALI_DEBUG_ASSERT(hint < MALI_SCHEDULER_HINT_MAX);
81         mali_scheduler_hints[hint] = MALI_FALSE;
82 }
83
84 MALI_STATIC_INLINE mali_bool mali_scheduler_hint_is_enabled(mali_scheduler_hint hint)
85 {
86         MALI_DEBUG_ASSERT(hint < MALI_SCHEDULER_HINT_MAX);
87         return mali_scheduler_hints[hint];
88 }
89
90 #endif /* __MALI_SCHEDULER_H__ */